tsabitah |
Valuable expert |
|
|
Joined: Jul 07, 2010 |
Posts: 328 |
Location: surabaya |
|
|
|
|
|
|
Code: | <?php
defined('MINIMUS') or die('Access denied core kernel MINIMUS directly...');
define('SECUR_MAX', true);
if (@!is_file(ROOT_PATH . '/modules/Copyrights/includes/index.php')) {
header('location: index.php');
die();
}
if (@ is_file(ROOT_PATH . '/includes/javascript.php')) {
header('location: index.php');
die();
}
// secure
$ct_rules = array('absolute_path', 'ad_click', 'alert', 'basepath', 'bash_history', '.bash_history', 'cat=http://', 'cgi-', 'chmod', 'chmod(', 'chmod%20', '%20chmod', 'chmod=', 'chown%20', 'chgrp%20', 'chown(', '/chown', 'chgrp(', 'chr(', 'chr=', 'chr%20', '%20chr', 'chunked', 'cookie=', 'cmd', 'cmd=', '%20cmd', 'cmd%20', '.conf', 'config.php', 'cp%20', '%20cp', 'cp(', 'diff%20', 'dat?', 'db_mysql.inc', 'document.location', 'document.cookie', 'drop%20', 'echr(', '%20echr', 'echr%20', 'echr=', '}else{', '.eml', 'esystem(', 'esystem%20', '.exe', 'exploit', 'file\://', 'file=http://', 'file=.http://', '*file=http://*', 'fopen', 'fwrite', '~ftp', 'ftp.exe', 'getenv', '%20getenv', 'getenv%20', 'getenv(', 'grep%20', '_global', 'global_', 'global[', '_globals', 'globals_', 'globals[', 'grep(', 'g\+\+', 'halt%20', '.history', '?hl=', '.htpasswd', 'http_', 'http-equiv', 'http/1.', 'http_php', 'http_user_agent', 'http_host', '&icq', 'if{', 'if%20{', 'img src', 'img%20src', '.inc.php', '.inc', 'insert%20into', 'ISO-8859-1', 'ISO-', 'javascript\://', '.jsp', '.js', 'kill%20', 'kill(', 'killall', '%20like', 'like%20', 'locate%20', 'locate(', 'lsof%20', 'mdir%20', '%20mdir', 'mdir(', 'mcd%20', 'motd%20', 'mrd%20', 'rm%20', '%20mcd', '%20mrd', 'mcd(', 'mrd(', 'mcd=', 'mod_gzip_status', 'modules/', 'mrd=', 'mv%20', 'name=http://', '*name=http://*', 'nc.exe', 'new_password', 'nigga(', '%20nigga', 'nigga%20', '~nobody', 'org.apache', '+outfile+', '%20outfile%20', '*/outfile/*', ' outfile ', 'outfile', 'password=http:', 'passwd%20', '%20passwd', 'passwd(', 'phpadmin', 'perl%20', '/perl', 'phpbb_root_path', '*/phpbb_root_path/*', 'p0hh', 'ping%20', '.pl', 'powerdown%20', 'rm(', '%20rm', 'rmdir%20', 'mv(', 'rmdir(', '_php', 'php_', 'phpinfo()', '<?php', 'reboot%20', '/robot.txt', '~root', 'root_path', 'rush=', '%20rush', 'rush%20', 'secure_site, ok', 'select%20', 'select from', 'select%20from', '_server', 'server_', 'server[', 'server-info', 'server-status', 'servlet', 'sql=', '<script', '<script>', '</script', 'script>', '/script', 'switch{', 'switch%20{', '.system', 'system(', 'telnet%20', 'traceroute%20', '.txt', 'union%20', '%20union', 'union(', 'union=', 'vi(', 'vi%20', 'wget', 'wget%20', '%20wget', 'wget(', 'window.open', 'wwwacl', 'xp_enumdsn', 'xp_availablemedia', 'xp_filelist', 'xp_cmdshell', '$_request', '$_get', '$request', '$get', '&aim', '/etc/password', '/etc/shadow', '/etc/groups', '/etc/gshadow', '/bin/ps', 'uname\x20-a', '/usr/bin/id', '/bin/echo', '/bin/kill', '/bin/', '/chgrp', '/usr/bin', 'bin/python', 'bin/tclsh', 'bin/nasm', '/usr/x11r6/bin/xterm', '/bin/mail', '/etc/passwd', '/home/ftp', '/home/www', '/servlet/con', 'http://www.google.de/search', 'google.de/search', 'yahoo.de', 'lycos.de', 'google.com', 'google.fr', 'fireball.de', '?>');
// Now the URL Protection Engine
$check = str_replace($ct_rules, '*', GET_QUERY_STRING);
if (GET_QUERY_STRING != $check)
die('Union attack detected ! stop it .....');
// bots secure
$ct_rules = array('atspider', 'autoemailspider', 'cherrypicker', 'collage', 'custo', 'dsurf', 'dts agent', 'ecatch', 'elitesys', 'emailcollector', 'emailsiphon', 'esirover', 'extrac', 'emailwolf', 'getbot ', 'geturl', 'getweb', 'havindex', 'hulud', 'httrack', 'internet explore', 'infospiders', 'jeeves', 'jpeg hunt', 'kdd explorer', 'lightningdownload', 'memoweb', 'munky', 'pbwf', 'roverbot', 'spiderbot', 'ssearcher100', 'sweeper', 'teleport', 'templeton', 'vobsub', 'w3mir', 'webbandit', 'webcatcher', 'webcopier', 'webcopy', 'webfetcher', 'webmirror', 'webreaper', 'webvac', 'webwalk', 'wget', 'webcopier ', 'webzip', 'wonder', 'xget');
$check = str_replace($ct_rules, '*', strtolower(USER_AGENT));
if (strtolower(USER_AGENT) != $check)
die('Bot attack detected ! stop it ...');
Function Foot()
{
global $ThemeSel, $sitename, $foot;
define('CONTROL_END', true);
if (is_file(INCLUDE_PATH . 'kernel/perso/custom_footer.php'))
include_once(INCLUDE_PATH . 'kernel/perso/custom_footer.php');
if (is_file(INCLUDE_PATH . 'themes/' . $ThemeSel . '/footer.html')) {
$tmpl_file = INCLUDE_PATH . 'themes/' . $ThemeSel . '/footer.html';
} else {
$tmpl_file = INCLUDE_PATH . 'kernel/template/footer.html';
}
$thefile = implode('', file($tmpl_file));
$thefile = addslashes($thefile);
$thefile = "\$r_file=\"" . $thefile . "\";";
eval($thefile);
echo $r_file;
endmax();
if (URL_FRIENDLY === true)
GoogleTap_SG::GTv2_footer();
echo display_debug();
$GLOBALS['db']->sql_close();
if (is_file(INCLUDE_PATH . 'kernel/google_analytics/index.html'))
include_once(INCLUDE_PATH . 'kernel/google_analytics/index.html');
echo '</body>' . "\n" . '</html>';
if (Funct_ob_end_flush === true)
@ob_end_flush();
die();
}
if (!defined('FORUM_ADMIN')) {
Function Redirect_Url($UrlX)
{
isset($UrlX) ? $UrlX = secure($UrlX, '', 'clean') : $UrlX = 'index.php';
($UrlX != 'none') ? $UrlX = $UrlX : $UrlX = 'index.php';
$UrlX = str_replace('&', '&', $UrlX);
header('Location:' . $UrlX);
die();
}
}
Function Ramasse_Miette($folder = false, $time = false)
{
$folder = secure($folder, '', 'clean', 'sec');
$time = secure($time, 'num');
if (empty($folder)) {
return;
}
if (!is_dir($folder)) {
return;
}
if (empty($time))
$time = 2419200;
$dir = @opendir($folder);
while ($filename = @readdir($dir)) {
if ($filename === '.' or $filename === '..' or $filename === '.htaccess' or $filename === 'index.html' or $filename === 'index.php')
continue;
$vartime = @filemtime($folder . $filename);
if (($vartime + $time) <= MAX_TIME)
@unlink($folder . $filename);
}
}
Function Kill_Sessions()
{
$dir = ROOT_PATH . '/' . CACHE . '/' . SESSIONS_PATH . '/';
$jpc = @opendir($dir);
while ($filename = @readdir($jpc)) {
if ($filename === '.' or $filename === '..' or $filename === '.htaccess' or $filename === 'index.html' or $filename === 'index.php')
continue;
@unlink($dir . $filename);
}
}
Function Empty_Cache_Module($module)
{
if (!defined('ADMIN_ALLOW'))
return false;
if (empty($module))
return false;
$module = secure($module, '', '', 'xss');
$dir = ROOT_PATH . '/' . CACHE . '/Modules/';
$jpc = @opendir($dir);
while ($filename = @readdir($jpc)) {
if ($filename === '.' or $filename === '..' or $filename === '.htaccess' or $filename === 'index.html' or $filename === 'index.php')
continue;
if (strstr($filename, $module))
@unlink($dir . $filename);
}
}
Function MaxCache()
{
if (!defined('CONTROL_END')) {
header('location: ../index.php');
die();
}
define('MAX_CACHE1', true);
define('LOADING', true);
$sigle = $MAXtop = $copyright = $ml = $iws = '';
if (defined('MAX_CACHE')) {
if (MAXADV_IMAGEMAXCACHE === true) {
$sigle = 'Cache Active';
} else {
$sigle = '<img src="images/powered/maxcacheon.gif" alt="Max Cache On" title="Max Cache On" />';
}
} else {
if (MAXADV_IMAGEMAXCACHE === true) {
$sigle = 'Cache NoActive';
} else {
$sigle = '<img src="images/powered/maxcacheoff.gif" alt="Max Cache Off" title="Max Cache Off" border="0" />';
}
}
if (MAXADV_IMAGETOP === true) {
$MAXtop = 'Top';
} else {
$MAXtop = '<img src="images/powered/top.gif" alt="Top" title="Top" border="0" />';
}
if (MAXADV_IMAGECOPY === true) {
$copyright = 'Copyrights';
} else {
$copyright = '<img src="images/powered/copyright.gif" alt="Copyrights" title="Copyrights" border="0" />';
}
if (MAXADV_IMAGEML === true) {
$ml = _LEGALSMENTIONS;
} else {
$ml = '<img src="images/powered/mentions-legales.gif" alt="' . _LEGALSMENTIONS . '" title="' . _LEGALSMENTIONS . '" border="0" />';
}
if (MAXADV_IMAGEWEBSITE === true) {
$iws = 'PHP Minimus Blog and CMS';
} else {
$iws = '<img src="images/powered/Maximus.gif" alt="PHP Minimus CMS" title="PHP Minimus CMS" border="0" />';
}
echo ' ;;<a href="#max_top">' . $MAXtop . '</a> ;;' . $sigle . ' ;;<a href="index.php?name=Copyrights">' . $copyright . '</a> ;;<a href="http://www.php-minimus.org" target="new">' . $iws . '</a>' . "\n";
br('1');
}
Function OpenCache($var_name = false, $var_mod = false, $var_ext = false, $retention = false, $status = false)
{
$retention = secure($retention, 'num');
if (empty($retention))
return;
global $cookie;
if (empty($cookie[1]))
$cookie[1] = 'Anonyme';
if ($status == 1) {
$cookie[1] = 'Anonyme';
} elseif (($status == 2) && (!defined('ADMIN_ALLOW'))) {
$cookie[1] = 'Anonyme';
}
$path = ROOT_PATH . '/' . CACHE . '/Modules/' . $var_name . '_' . PREFIX_CACHE . '_' . $var_mod . '_' . $cookie[1] . '.' . $var_ext;
if (@is_file($path)) {
$vartime = @filemtime($path);
if (($vartime + $retention) <= MAX_TIME)
@unlink($path);
}
if (@is_file($path)) {
@readfile($path);
define('MAX_CACHE', true);
incof();
} else {
@ob_start();
}
}
function CloseCache($var_name = false, $var_mod = false, $var_ext = false, $retention = false, $status = false)
{
$retention = secure($retention, 'num');
if (empty($retention))
return;
global $begin_content, $end_content, $cookie;
if (empty($cookie[1]))
$cookie[1] = 'Anonyme';
if ($status == 1) {
$cookie[1] = 'Anonyme';
} elseif (($status == 2) && (!defined('ADMIN_ALLOW'))) {
$cookie[1] = 'Anonyme';
}
$path = ROOT_PATH . '/' . CACHE . '/Modules/' . $var_name . '_' . PREFIX_CACHE . '_' . $var_mod . '_' . $cookie[1] . '.' . $var_ext;
$content = '';
if ($var_ext == 'php') {
$content .= $begin_content;
$content .= $end_content;
}
$content .= "\n\n<!-- Start Cache module $var_name $var_mod $retention PHP Minimus Blog/CMS v2009 -->\n";
$content .= @ob_get_contents();
$content .= "\n<!-- End Cache module $var_name $var_mod $retention PHP Minimus Blog/CMS v2009 -->\n\n";
$file = @fopen($path, 'w');
@fwrite($file, $content);
@fclose($file);
}
FUNCTION Delete_Cache_SQL($filename)
{
if (empty($filename))
return;
if (@is_file(ROOT_PATH . '/' . CACHE . '/Configuration/' . PREFIX_CACHE . '_cache_' . $filename . '.php'))
@unlink(ROOT_PATH . '/' . CACHE . '/Configuration/' . PREFIX_CACHE . '_cache_' . $filename . '.php');
}
FUNCTION cache_sql($filename, $varname, $datas)
{
if (empty($filename))
return;
if (empty($varname))
return;
if (empty($datas))
return;
$file = @fopen(ROOT_PATH . '/' . CACHE . '/Configuration/' . PREFIX_CACHE . '_cache_' . $filename . '.php', 'wb');
if (!$file)
die('Unable to write configuration cache file to cache directory. Please make sure PHP has write access to the directory \'' . CACHE . '/Configuration/\'');
@fwrite($file, '<?php' . "\n\n" . 'defined(\'MAXIMUS\') or Header(\'Location: ../index.php\');' . "\n\n" . '$' . $varname . ' = '.@var_export($datas, true) . ';' . "\n\n" . '');
@fclose($file);
}
Function Incoh($var_mod = false, $var_ext = false, $retention = false, $status = false)
{
if (@is_file(ROOT_PATH . '/kernel/header.php'))
include_once(ROOT_PATH . '/kernel/header.php');
echo "\n\n<!-- Web Site under PHP Minimus Blog/CMS Copyrights v2009 -->\n\n";
if ($retention != false)
opencache(MODULE_NAME, $var_mod, $var_ext, $retention, $status);
}
Function Incof($var_mod = false, $var_ext = false, $retention = false, $status = false)
{
if ($retention != false)
closecache(MODULE_NAME, $var_mod, $var_ext, $retention, $status);
echo "\n\n<!-- Web Site under PHP Minimus Blog/CMS Copyrights v2009 -->\n\n";
if (is_file(ROOT_PATH . '/kernel/footer.php'))
include_once(ROOT_PATH . '/kernel/footer.php');
}
Function EndMax()
{
global $copyright, $total_time, $start_time;
echo "\n\n<!-- PHP Minimus Start Statistics v2009 -->\n";
echo "\n<!-- End Footer by PHP Minimus CMS/Blog v2009 -->\n";
if (Serverload_Status === true)
$serverload = ServerLoad();
$excuted_queries = $GLOBALS['db']->num_queries;
list($usec, $sec) = explode(' ', microtime());
$endtime = ((float)$usec + (float)$sec);
$total_time = @round(($endtime - $start_time), 4);
$sql_time = @round($GLOBALS['db']->sql_time, 4);
$sql_part = @round($sql_time / $total_time * 100);
$php_part = 100 - $sql_part;
(preg_match('`(left|center|right)`', MAXADV_COPYRIGHTS_PLACE)) ? $place = MAXADV_COPYRIGHTS_PLACE : $place = 'left';
echo "\n\n<div align='$place'><!-- $copyright -->\n\n";
br('1');
if (MAXADV_TIME_GENERATION === true)
echo '<font size="1">[ ' . _PAGEGENERATION . ' <strong>' . $total_time . '</strong> sec ]</font>';
if (MAXADV_PHPMYSQL === true) {
if ($sql_part >= 100) {
$sql_part = '99';
$php_part = '1';
}
echo '<font size="1"> [ ' . _TIME_PHP_SQL . ' PHP: <strong>' . $php_part . '%</strong> - SQL: <strong>' . $sql_part . '%</strong> ]</font> ';
}
if (MAXADV_SQLREQUESTS === true)
echo '<font size="1"> [ ' . _SQLREQUESTS . ': <strong>' . $excuted_queries . '</strong> ]</font> ';
if (MAXADV_VIEWSPAGE === true && Serverload_Status === true)
echo '<font size="1"> [ <strong>' . $serverload . '</strong> ' . _PAGESVIEWSHOUR . ' ]</font> ';
br('1');
echo MaxCache();
echo '</div>';
}
Function Copy_Files_Secure($folder)
{
if (@!is_file(INCLUDE_PATH . '' . CACHE . '/' . $folder . '/.htaccess'))
@copy(INCLUDE_PATH . 'kernel/securefiles/.htaccess', INCLUDE_PATH . '' . CACHE . '/' . $folder . '/.htaccess');
if (@!is_file(INCLUDE_PATH . '' . CACHE . '/' . $folder . '/index.html'))
@copy(INCLUDE_PATH . 'kernel/securefiles/index.html', INCLUDE_PATH . '' . CACHE . '/' . $folder . '/index.html');
if (@!is_file(INCLUDE_PATH . '' . CACHE . '/' . $folder . '/index.php'))
@copy(INCLUDE_PATH . 'kernel/securefiles/index.php', INCLUDE_PATH . '' . CACHE . '/' . $folder . '/index.php');
}
if (!isset($lo)) {
$lo = '';
}
switch ($lo) {
case 'mod_debug':
if (defined('ADMIN_ALLOW')) {
$state = secure($state, 'bin');
if ($state == 1) {
@setcookie('mod_debug', $state, time() + 2592000);
} else {
@setcookie('mod_debug', false);
}
}
redirect_url(get_referer());
die();
break;
case 'mod_debug_errors':
if (defined('ADMIN_ALLOW')) {
$state = secure($state, 'bin');
if ($state == 1) {
@ $_SESSION['mod_debug_errors'] = 1;
} else {
@ $_SESSION['mod_debug_errors'] = 0;
}
}
redirect_url(get_referer());
die();
break;
case "newcache":
if (defined('ADMIN_ALLOW')) {
$CACHE_CONFIG['data_dir'] = INCLUDE_PATH . '' . CACHE . '/Modules/';
$jpc = @opendir($CACHE_CONFIG['data_dir']);
while ($filename = @readdir($jpc)) {
if ($filename === '.' or $filename === '..' or $filename === '.htaccess' or $filename === 'index.html' or $filename === 'index.php')
continue;
if (@strstr($filename, $name))
@unlink($CACHE_CONFIG['data_dir'] . $filename);
}
Copy_Files_Secure('Modules');
}
redirect_url(get_referer());
die();
break;
case 'newsessions':
if (defined('ADMIN_ALLOW')) {
$CACHE_CONFIG['data_dir'] = INCLUDE_PATH . '' . CACHE . '/' . SESSIONS_PATH . '/';
$jpc = @opendir($CACHE_CONFIG['data_dir']);
while ($filename = @readdir($jpc)) {
if ($filename === '.' or $filename === '..' or $filename === '.htaccess' or $filename === 'index.html' or $filename === 'index.php')
continue;
@unlink($CACHE_CONFIG['data_dir'] . $filename);
echo $CACHE_CONFIG['data_dir'] . $filename;
}
Copy_Files_Secure('sessions');
}
redirect_url(get_referer());
die();
break;
case 'VideCache':
if (!defined('ADMIN_ALLOW')) {
redirect_url(get_referer());
die();
}
if ((empty($folder)) || ($folder != 'Modules') && ($folder != 'Configuration')) {
redirect_url(get_referer());
die();
}
$CACHE_CONFIG['data_dir'] = INCLUDE_PATH . '' . CACHE . '/' . $folder . '/';
$jpc = @opendir($CACHE_CONFIG['data_dir']);
while ($filename = @readdir($jpc)) {
if ($filename === '.' or $filename === '..' or $filename === '.htaccess' or $filename === 'index.html' or $filename === 'index.php')
continue;
@unlink($CACHE_CONFIG['data_dir'] . $filename);
}
Copy_Files_Secure($folder);
redirect_url(get_referer());
die();
break;
}
if (!function_exists('convert_size2')) {
function convert_size2($size)
{
$sizekb = @round(($size / 1024), 3);
$sizemb = @round(($sizekb / 1024), 3);
$sizegb = @round(($sizemb / 1024), 3);
if ($sizegb >= 1) {
$sizereal = " <strong>$sizegb</strong> " . _MEM_1 . "";
} elseif ($sizemb >= 1) {
$sizereal = " <strong>$sizemb</strong> " . _MEM_2 . "";
} elseif ($sizekb >= 1) {
$sizereal = " <strong>$sizekb</strong> " . _MEM_3 . "";
} else {
$sizereal = " <strong>$size</strong> " . _MEM_4 . "";
}
return $sizereal;
}
}
function display_debug()
{
global $admin, $user, $wb_query, $lang;
if (defined('ADMIN_ALLOW')) {
$play_debug = $play_debug1 = '';
if (MAXIMUS_DEBUG === true) {
$play_debug = '<a href="?lo=mod_debug&state=0"><img src="images/pause.png" alt="' . _DEBUG_MOD_DEBUG_STOP . '" title="' . _DEBUG_MOD_DEBUG_STOP . '" border="0" /></a>';
} else {
$play_debug = '<a href="?lo=mod_debug&state=1"><img src="images/go.png" alt="' . _DEBUG_MOD_DEBUG_START . '" title="' . _DEBUG_MOD_DEBUG_START . '" border="0" /></a>';
}
if (MAXIMUS_DISPLAY_ERROR === true) {
$play_debug1 = '<a href="?lo=mod_debug_errors&state=0"><img src="images/alert.png" alt="' . _DEBUG_MOD_DEBUG_ERROR_STOP . '" title="' . _DEBUG_MOD_DEBUG_ERROR_STOP . '" border="0" /></a>';
} else {
$play_debug1 = '<a href="?lo=mod_debug_errors&state=1"><img src="images/run.png" alt="' . _DEBUG_MOD_DEBUG_ERROR_START . '" title="' . _DEBUG_MOD_DEBUG_ERROR_START . '" border="0" /></a>';
}
$content_debug1 = '<br/><table style="width:100%;"><tr><td colspan="2"> ' . $play_debug . ' ' . $play_debug1 . ' ' . _MAX_DISTROY . ': <a href="./?lo=VideCache&folder=Modules" title="' . _MAX_DISTROY . ' ' . _EMPTY_CACHE_MODULES . '">' . _EMPTY_CACHE_MODULES . '</a> - ';
if (defined('MODULE_NAME'))
$content_debug1 .= '<a href="./?lo=newcache&name=' . MODULE_NAME . '" title="' . _MAX_DISTROY . ' ' . _EMPTY_CACHE_MODULE . ' ' . MODULE_NAME . '">' . _EMPTY_CACHE_MODULE . ' ' . MODULE_NAME . '</a> - ';
$content_debug1 .= '<a href="./?lo=newsessions" title="' . _MAX_DISTROY . ' ' . _EMPTY_SESSIONS . '">' . _EMPTY_SESSIONS . '</a></td></tr></table>' . "\n";
echo $content_debug1;
}
if (MAXIMUS_DEBUG === true && defined('ADMIN_ALLOW')) {
$content_debug = "<script type='text/javascript'>\n
//<![CDATA[\n
function affiche_debug(div) {\n
var elem = document.getElementById(div);\n
if (elem.style.display=='') {elem.style.display='none'; return;}\n
elem.style.display='';\n
}\n
//]]>\n
</script>\n\n";
$admin_cook = $admin[0] . ':' . $admin[1];
$tablo_content = 'border-bottom: 1px grey dotted; padding-left: 0.5em;';
$tablo_title = 'background: #fef7e6; border-bottom: 1px black solid; font-weight : bold; padding-left: 0.2em;';
$content_debug .= '---------------------------------------------------------------------------';
$content_debug .= "<table style='width:100%;'><tr><td colspan='2' style='color: red;'>" . _MAX_WARNING_SECURITY . "</td></tr>\n";
$content_debug .= "<tr><td style='$tablo_title'>Type du Cookie</td><td style='$tablo_title'>Données issues des cookies</td></tr>\n";
$content_debug .= "<tr><td style='$tablo_content'><em>Cookie User:</em></td><td style='$tablo_content'> " . base64_decode($user) . "</td></tr>\n";
$content_debug .= "<tr><td style='$tablo_content'><em>Cookie Admin:</em></td><td style='$tablo_content'> $admin_cook</td></tr>\n";
// $content_debug .= "<tr><td style='$tablo_content'><em>Cookie Secure Admin:</em></td><td style='$tablo_content'> $admin_cook2</td></tr>\n";
$content_debug .= "<tr><td style='$tablo_content'><em>Cookie Langue:</em></td><td style='$tablo_content'> $lang</td></tr>\n";
$content_debug .= "<tr><td style='$tablo_content'><em>PHP_SELF:</em></td><td style='$tablo_content'> " . $_SERVER['PHP_SELF'] . "</td></tr></table>\n";
$content_debug .= "<br/>\n<br/>\n<div id='debugquery'>\n";
$content_debug .= "<table style='width:100%;'><tr><td style='$tablo_title'>Time</td><td style='$tablo_title'>Calcul</td><td style='$tablo_title'>Type</td><td style='$tablo_title'>Query</td></tr>\n";
$total = count($wb_query['query']);
for ($a = 0; $a < $total; $a++) {
$content_debug .= "<tr><td style='$tablo_content'>". @$wb_query['sqltime'][$a] . "</td>\n";
$content_debug .= "<td style='$tablo_content'>". @$wb_query['time'][$a] . "</td>\n";
$content_debug .= "<td style='$tablo_content'>". @$wb_query['type'][$a] . "</td>\n";
$content_debug .= "<td style='$tablo_content'>";
if (!empty($wb_query['query'][$a]) and ($wb_query['query'][$a] != @$wb_query['error'][$a + 1])) {
$content_debug .= "<font color='green'>" . str_replace('&', '&', $wb_query['query'][$a]) . "</font>";
}
if (!empty($wb_query['error'][$a])) {
$content_debug .= "<font color='red'>" . str_replace('&', '&', $wb_query['error'][$a]) . "</font>";
}
$content_debug .= "</td></tr>\n";
}
$content_debug .= "</table>\n";
$content_debug .= "<br /></div>\n";
$total_req = $total;
$content_debug .= "<a style='cursor: pointer; cursor: hand' onclick='affiche_debug(\"debugquery\");'>Nbre de Requêtes SQL $total_req</a><br /><br />\n";
// load files
$content_debug .= "<div id='debugfiles' style='display: none'>\n";
$included_files = @get_included_files();
$i = 1;
$taille = $total = '';
foreach ($included_files as $filename) {
$taille = filesize($filename);
$content_debug .= $filename . " - " . convert_size2($taille) . " <br />\n";
$i++;
$total = $total + $taille;
}
$content_debug .= "<br /></div>\n";
$content_debug .= "<a style='cursor: pointer; cursor: hand' onclick='affiche_debug(\"debugfiles\");'>Taille totale: " . convert_size2($total) . " » Nbre d´includes $i</a><br /><br />\n";
return $content_debug;
}
}
class Referencement
{
function sitemaps($fichier, $contenu)
{
if (@is_writeable(CACHE . '/sitemaps/')) {
$file = @fopen(CACHE . '/sitemaps/' . $fichier . '.xml', 'w+');
$content = "<?xml ";
$content .= "version='";
$content .= "1.0'";
$content .= " encoding='";
$content .= "UTF-8'";
$content .= "?>\n";
$content .= "<urlset xmlns='";
$content .= "http://www.google.com/schemas/sitemap/0.84'";
$content .= ">\n";
$content .= $contenu;
$content .= "</urlset>";
@fwrite($file, $content);
@fclose($file);
}
}
}
class op_database
{
Function optimize_alltable()
{
$local_query = 'SHOW TABLE STATUS FROM ' . DBNAME;
if ($GLOBALS['db']->get_num($local_query)) {
foreach ($GLOBALS['db']->get_list_row($local_query) as $row) {
$GLOBALS['db']->query('OPTIMIZE TABLE ' . $row[0] . ' ');
}
}
}
Function optimize($table)
{
$GLOBALS['db']->query('OPTIMIZE TABLE `' . $table . '`');
}
}
FUNCTION Maximus_URL($url, $under = false)
{
$title = strtr($url, 'ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÒÓÔÕÖÙÚÛÜÝáâãäåçèéêëìíîïðòóôõöùúûüýÿ', 'AAAAAACEEEEIIIIOOOOOUUUUYaaaaaaceeeeiiiioooooouuuuyy');
if ($under == false) {
return str_replace(' ', '_', strtolower($title));
} else {
return strtolower($title);
}
}
FUNCTION OpenCacheBoite($var_name = false, $var_ext = false, $retention = false, $status = false)
{
if (empty($retention))
return;
global $max_time, $cookie;
if (empty($cookie[1]))
$cookie[1] = 'Anonyme';
if ($status == '1') {
$cookie[1] = 'Anonyme';
} elseif (($status == '2') && (!defined('ADMIN_ALLOW'))) {
$cookie[1] = 'Anonyme';
}
$path = CACHE . '/Modules/' . $var_name . '_' . PREFIX_CACHE . '_' . $cookie[1] . '.' . $var_ext;
if (@is_file($path)) {
$vartime = @filemtime($path);
if (($vartime + $retention) <= $max_time)
@unlink($path);
}
if (@is_file($path)) {
@readfile($path);
} else {
@ob_start();
}
}
function CloseCacheBoite($content = false, $var_name = false, $var_ext = false, $retention = false, $status = false)
{
if (empty($retention))
return;
global $begin_content, $end_content, $cookie;
if (empty($cookie[1]))
$cookie[1] = 'Anonyme';
if ($status == '1') {
$cookie[1] = 'Anonyme';
} elseif (($status == '2') && (!defined('ADMIN_ALLOW'))) {
$cookie[1] = 'Anonyme';
}
$path = CACHE . '/Modules/' . $var_name . '_' . PREFIX_CACHE . '_' . $cookie[1] . '.' . $var_ext;
if (!is_file($path)) {
if ($var_ext == 'php') {
$content = $begin_content;
$content .= $end_content;
}
$contentu = '';
$contentu .= "\n\n<!-- Start Cache boite/modules $var_name PHP Minimus Blog/CMS 2009 -->\n";
$contentu .= $content;
$contentu .= "\n<!-- End Cache boite/modules $var_name PHP Minimus Blog/CMS 2009 -->\n\n";
$file = @fopen($path, 'w');
@fwrite($file, $contentu);
@fclose($file);
echo $content;
}
}
function importation($url, $type)
{
global $sitename, $language;
$errno = $errstr = $data = '';
if (@!is_writable($type))
die('You can\'t import this type !');
if (@!is_writable(CACHE . '/sessions/'))
die('You can\'t import this script !');
$repertoire = CACHE . '/sessions/';
$maxsize = 800000;
$er = 0;
if (empty($url))
die('Marqueur is empty');
$fp = @fsockopen('www.php-minimus.org', 80, $errno, $errstr, 5);
if (!$fp) {
die('<h2>Pack download impossible ...</h2><p>Impossible PHP Minimus connexion... Controle PHP functions enabled</p>');
} else {
$out = "GET /import.php?id=" . $url . " HTTP/1.1\r\n";
$out .= "Host: www.php-minimus.org\r\n";
$out .= "User-Agent: PHPMinimusImportateur **" . $sitename . "**" . GET_IP . "\r\n";
$out .= "Referer: " . URL_SITE . "\r\n";
$out .= "Accept-Language: " . $language . "\r\n";
$out .= "Connection: Close\r\n\r\n";
@fwrite($fp, $out);
while (@!feof($fp)) {
@fgets($fp, 128);
}
@fclose($fp);
}
if (!($fsock = @fsockopen('www.php-minimus.org', 80, $errno, $errstr, 20)))
die('<h2>Pack download impossible ...</h2><p>Impossible PHP Minimus connexion.</p>');
@fputs($fsock, "GET /modules/Downloads/uploads/dls/" . $url . ".zip HTTP/1.1\r\n");
@fputs($fsock, "Host: www.php-minimus.org\r\n");
@fputs($fsock, "Accept-Language: " . $language . "\r\n");
@fputs($fsock, "Accept-Encoding: none\r\n");
@fputs($fsock, "User-Agent: Minimus\r\n");
@fputs($fsock, "Connection: close\r\n\r\n");
while (@!feof($fsock)) {
$data .= @fread($fsock, $maxsize);
}
@fclose($fsock);
if (@!preg_match('#Content-Length\: ([0-9]+)[^ /][\s]+#i', $data, $file_data1) && (@!preg_match(",^Content-Encoding: .*gzip,i", $data)))
die('<h2>Importation impossible ...</h2><p>No datas ...</p>');
$filesize = $file_data1[1];
if ($filesize > 0 && $filesize < $maxsize) {
$data = @substr($data, @strlen($data) - $filesize, $filesize);
$filename = $repertoire . $url . '.zip';
if (@is_file($filename))
@unlink($filename);
if (@is_file($filename)) {
Kill_Sessions();
die('File is exists ... Retry it !');
} else {
$fptr = @fopen($filename, 'wb');
$bytes_written = @fwrite($fptr, $data, $filesize);
@fclose($fptr);
if ($bytes_written != $filesize) {
@unlink($tmp_filename);
die("<h2>Download impossible ...</h2><p>Writing error ...</p>");
}
echo "<p> " . $url . " success ... continue ! DONT TOUCH !!! </p>";
}
} else {
die('<h2>Download impossible ...</h2><p>So big file ...</p>');
}
}
function import_dezip($theme, $type)
{
if ($type == 'themes' or $type == 'modules' or $type == 'kernel') {
if (@is_file('kernel/addons/pclzip.lib.php')) {
include_once('kernel/addons/pclzip.lib.php');
if (@is_file(CACHE . '/sessions/' . $theme . '.zip')) {
$archive = new PclZip(CACHE . '/sessions/' . $theme . '.zip');
($type == 'kernel') ? $type1 = '' : $type1 = $type;
if (!$archive->extract(PCLZIP_OPT_PATH, $type1))
echo 'Error : ' . $archive->errorInfo(true);
}
}
}
}
?> |
|
|