From bb47f1005eabd32848497388bf0e99012b6fd1cf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 7 Feb 2009 03:49:48 +0000 Subject: [PATCH] Again more fixes from bugtracker, thanks to profi-concept --- .gitattributes | 2 + inc/databases.php | 8 +-- inc/extensions/ext-logs.php | 1 + inc/extensions/ext-usage.php | 90 ++++++++++++++++++++++++++++++++ inc/language/_de.php | 2 + inc/language/logs_de.php | 4 +- inc/language/usage_de.php | 44 ++++++++++++++++ inc/modules/admin/what-logs.php | 6 +-- inc/modules/admin/what-usage.php | 73 ++++++++++++++------------ install/menu-de.sql | 1 - install/menu-en.sql | 1 - 11 files changed, 186 insertions(+), 46 deletions(-) create mode 100644 inc/extensions/ext-usage.php create mode 100644 inc/language/usage_de.php diff --git a/.gitattributes b/.gitattributes index a6a10877d2..b0c1b1cf65 100644 --- a/.gitattributes +++ b/.gitattributes @@ -152,6 +152,7 @@ inc/extensions/ext-task.php -text inc/extensions/ext-theme.php -text inc/extensions/ext-top10.php -text inc/extensions/ext-transfer.php -text +inc/extensions/ext-usage.php -text inc/extensions/ext-user.php -text inc/extensions/ext-wernis.php -text inc/extensions/ext-yoomedia.php -text @@ -213,6 +214,7 @@ inc/language/task_de.php -text inc/language/theme_de.php -text inc/language/top10_de.php -text inc/language/transfer_de.php -text +inc/language/usage_de.php -text inc/language/user_de.php -text inc/language/wernis_de.php -text inc/language/yoomedia_de.php -text diff --git a/inc/databases.php b/inc/databases.php index 925c495438..6fc682b4ba 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -105,17 +105,11 @@ if ((strpos($COOKIES, "/") == "0") && (strpos(substr(URL, 8), "/") > 0)) { // Cookie-Path ( for lame servers... ;-) ) define('COOKIE_PATH', $COOKIES); -// Base directory for access logfiles -define('LOGS_BASE', "logs"); - -// Base directory for usage statistics -define('USAGE_BASE', "usage"); - // Server-URL (DO NOT CHANGE THIS OR YOU CANNOT CHECK FOR UPDATES/EXTENSIONS!) define('SERVER_URL', "http://www.mxchange.org"); // Current SVN revision -define('CURR_SVN_REVISION', "711"); +define('CURR_SVN_REVISION', "712"); // Take a prime number which is long (if you know a longer one please try it out!) define('_PRIME', 591623); diff --git a/inc/extensions/ext-logs.php b/inc/extensions/ext-logs.php index 0326ef7b1c..385a5dd1c1 100644 --- a/inc/extensions/ext-logs.php +++ b/inc/extensions/ext-logs.php @@ -51,6 +51,7 @@ switch ($EXT_LOAD_MODE) case "register": // Do stuff when installation is running (modules.php?module=admin&action=login is called) // SQL commands to run $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('stats','logs','Aufruflogbücher','Verwalten Sie Ihre Aufruflogbücher mit diesem Admin-Bereich! (Derzeit nur Download!)',8)"; + $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `logs_base` VARCHAR(255) NOT NULL DEFAULT 'logs'"; break; case "remove": // Do stuff when removing extension diff --git a/inc/extensions/ext-usage.php b/inc/extensions/ext-usage.php new file mode 100644 index 0000000000..75d5e09e1f --- /dev/null +++ b/inc/extensions/ext-usage.php @@ -0,0 +1,90 @@ + diff --git a/inc/language/_de.php b/inc/language/_de.php index f7a0f27a4a..f30ca6935e 100644 --- a/inc/language/_de.php +++ b/inc/language/_de.php @@ -37,5 +37,7 @@ if (!defined('__SECURITY')) { require($INC); } +// Language definitions + // ?> diff --git a/inc/language/logs_de.php b/inc/language/logs_de.php index 72ef8c9c4a..d1714ecd52 100644 --- a/inc/language/logs_de.php +++ b/inc/language/logs_de.php @@ -1,7 +1,7 @@ %s scheint auf Ihrem Server zu fehlen. Funktion nicht verfügbar."); + +// +?> diff --git a/inc/modules/admin/what-logs.php b/inc/modules/admin/what-logs.php index 2496ac5035..a5ce46945d 100644 --- a/inc/modules/admin/what-logs.php +++ b/inc/modules/admin/what-logs.php @@ -84,11 +84,11 @@ if (!empty($_GET['access'])) { } } else { // List access logfiles - $dir = PATH.LOGS_BASE."/"; + $dir = PATH.getConfig('logs_base')."/"; if (is_dir($dir)) { // logs directory does exist OUTPUT_HTML("
    "); - $handle = opendir($dir) or mxchange_die("Cannot open directory ".LOGS_BASE."!"); + $handle = opendir($dir) or mxchange_die("Cannot open directory ".getConfig('logs_base')."!"); while ($file = readdir($handle)) { // We currenly only like files with "access" as prefix, should be more flexible! if (substr($file, 0, 6) == "access") { @@ -100,7 +100,7 @@ if (!empty($_GET['access'])) { OUTPUT_HTML("
"); } else { // logs directory does not exist - LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_LOGS_DIR_404_1.LOGS_BASE.ADMIN_LOGS_DIR_404_2); + LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_LOGS_DIR_404_1.getConfig('logs_base').ADMIN_LOGS_DIR_404_2); } } diff --git a/inc/modules/admin/what-usage.php b/inc/modules/admin/what-usage.php index 65b2810ca7..fb3bd33282 100644 --- a/inc/modules/admin/what-usage.php +++ b/inc/modules/admin/what-usage.php @@ -41,14 +41,19 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) { ADD_DESCR("admin", __FILE__); // Base directory (should be moved to database) -$usage = "usage/"; +$usage = getConfig('usage_base')."/"; if (!empty($_GET['image'])) { if ($_GET['type'] == "usage") { - $file = sprintf("%s%susage.png", PATH, $usage); + $file = sprintf("%s%s/usage.png", PATH, getConfig('usage_base')); } else { if (strpos($_GET['image'], "\\") > 0) $_GET['image'] = substr($_GET['image'], 0, strpos($_GET['image'], "\\")); - $file = sprintf("%s%s%s_usage_%s.png", PATH, $usage, SQL_ESCAPE($_GET['type']), SQL_ESCAPE($_GET['image'])); + $file = sprintf("%s%s/%s_usage_%s.png", + PATH, + getConfig('usage_base'), + SQL_ESCAPE($_GET['type']), + SQL_ESCAPE($_GET['image']) + ); } if (FILE_READABLE($file)) { @@ -59,44 +64,48 @@ if (!empty($_GET['image'])) { } exit(); } elseif (empty($_GET['usage'])) { - $file = sprintf("%s%sindex.html", PATH, $usage); + $file = sprintf("%s%s/index.html", PATH, getConfig('usage_base')); } else { - $file = sprintf("%s%susage_%s.html", + $file = sprintf("%s%s/usage_%s.html", PATH, - $usage, + getConfig('usage_base'), SQL_ESCAPE($_GET['usage']) ); } -if (!empty($file)) { - if (FILE_READABLE($file)) { - // @TODO This code is double, see functions.php, LOAD_TEMPLATE and LOAD_EMAIL_TEMPLATE - $tmpl_file = READ_FILE($file); - $tmpl_file = addslashes($tmpl_file); - $tmpl_file = "\$content=\"".$tmpl_file."\";"; - eval($tmpl_file); - // Double code until here +if ((!empty($file)) && (FILE_READABLE($file) { + // @TODO This code is double, see LOAD_TEMPLATE and LOAD_EMAIL_TEMPLATE in functions.php + $tmpl_file = READ_FILE($file); + $tmpl_file = addslashes($tmpl_file); + $tmpl_file = "\$content=\"".$tmpl_file."\";"; + eval($tmpl_file); + // Until here... + + // Replace URLs + $content = str_replace("usage.png", URL."/modules.php?module=admin&what=".$GLOBALS['what']."&type=usage&image=usage", $content); + $content = str_replace("daily_usage_", URL."/modules.php?module=admin&what=".$GLOBALS['what']."&type=daily&image=", $content); + $content = str_replace("hourly_usage_", URL."/modules.php?module=admin&what=".$GLOBALS['what']."&type=hourly&image=", $content); + $content = str_replace("ctry_usage_", URL."/modules.php?module=admin&what=".$GLOBALS['what']."&type=ctry&image=", $content); + $content = str_replace("usage_", URL."/modules.php?module=admin&what=".$GLOBALS['what']."&usage=", str_replace(".html", "", $content)); + + // Disabled due to too much trouble + //$content = str_replace("HREF=\"http://", "href=\"".URL."/modules.php?module=loader&url=http://", $content); + $test = strtolower($content); - // Replace URLs - $content = str_replace("usage.png", URL."/modules.php?module=admin&what=".$GLOBALS['what']."&type=usage&image=usage", $content); - $content = str_replace("daily_usage_", URL."/modules.php?module=admin&what=".$GLOBALS['what']."&type=daily&image=", $content); - $content = str_replace("hourly_usage_", URL."/modules.php?module=admin&what=".$GLOBALS['what']."&type=hourly&image=", $content); - $content = str_replace("ctry_usage_", URL."/modules.php?module=admin&what=".$GLOBALS['what']."&type=ctry&image=", $content); - $content = str_replace("usage_", URL."/modules.php?module=admin&what=".$GLOBALS['what']."&usage=", str_replace(".html", "", $content)); - // Disabled due to too much trouble - //$content = str_replace("HREF=\"http://", "href=\"".URL."/modules.php?module=loader&url=http://", $content); - $test = strtolower($content); - $body_start = strpos($test, ""); - if (($body_start > 0) && ($body_end > 0)) - { - $content = substr(substr($content, 0, $body_end), $body_start); - $content = substr($content, strpos($content, ">") + 1); - OUTPUT_HTML("
+ // Do we need to strip out above and including plus trailing tag? + if ((strpos($test, " 0) && (strpos($test, "") > 0)) { + // Okay, then do so. + $content = substr(substr($content, 0, $body_end), $body_start); + $content = substr($content, strpos($content, ">") + 1); + } // END - if + + // Output code + OUTPUT_HTML("
".$content."
"); - } - } +} else { + // Nothing to load, then we have no directory "usage" + LOAD_TEMPLATE("admin_settings_saved", false, sprintf(ADMIN_USAGE_DIRECTORY_404, getConfig('usage_base'))); } // diff --git a/install/menu-de.sql b/install/menu-de.sql index 0e38ada52f..19a284a0bc 100644 --- a/install/menu-de.sql +++ b/install/menu-de.sql @@ -90,7 +90,6 @@ INSERT INTO `mxchange_payments` VALUES (3,30,30.000,'Klick-Mail 30 Sek.',29.000) INSERT INTO `mxchange_payments` VALUES (4,40,40.000,'Klick-Mail 40 Sek.',39.000); INSERT INTO `mxchange_payments` VALUES (5,50,50.000,'Klick-Mail 50 Sek.',49.000); -INSERT INTO `mxchange_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('stats','usage','Aufrufstatistik','Erkennt automatisch Ihre Aufrufstatisiken und bindet diese in das Admin-Interface ein. (Derzeit nur Webalizer!)',9); INSERT INTO `mxchange_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('email','email_archiv','E-Mail Archiv','Sehen Sie sich hier bereits gesendete Mails an.','6'); INSERT INTO `mxchange_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('email','del_email','E-Mail löschen','Löschen Sie hierrüber E-Mails (sowohl Bonus- als auch Normal-Mails) aus Ihrem Mailtausch-System. Nur bei Normal-Mails: {!POINTS!} aus den unbestätigten Mails werden dem Werber wieder vergütet.','7'); INSERT INTO `mxchange_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('misc','updates','Updates prüfen','Prüft, ob eine neue Version oder ein Patch auf dem Server exisitiert. Sie müssen dann die Patches/Updates selber herunterladen und einspielen. Dabei werden keine Daten von Ihrer Installation an uns gesendet!','8'); diff --git a/install/menu-en.sql b/install/menu-en.sql index 0e38ada52f..19a284a0bc 100644 --- a/install/menu-en.sql +++ b/install/menu-en.sql @@ -90,7 +90,6 @@ INSERT INTO `mxchange_payments` VALUES (3,30,30.000,'Klick-Mail 30 Sek.',29.000) INSERT INTO `mxchange_payments` VALUES (4,40,40.000,'Klick-Mail 40 Sek.',39.000); INSERT INTO `mxchange_payments` VALUES (5,50,50.000,'Klick-Mail 50 Sek.',49.000); -INSERT INTO `mxchange_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('stats','usage','Aufrufstatistik','Erkennt automatisch Ihre Aufrufstatisiken und bindet diese in das Admin-Interface ein. (Derzeit nur Webalizer!)',9); INSERT INTO `mxchange_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('email','email_archiv','E-Mail Archiv','Sehen Sie sich hier bereits gesendete Mails an.','6'); INSERT INTO `mxchange_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('email','del_email','E-Mail löschen','Löschen Sie hierrüber E-Mails (sowohl Bonus- als auch Normal-Mails) aus Ihrem Mailtausch-System. Nur bei Normal-Mails: {!POINTS!} aus den unbestätigten Mails werden dem Werber wieder vergütet.','7'); INSERT INTO `mxchange_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('misc','updates','Updates prüfen','Prüft, ob eine neue Version oder ein Patch auf dem Server exisitiert. Sie müssen dann die Patches/Updates selber herunterladen und einspielen. Dabei werden keine Daten von Ihrer Installation an uns gesendet!','8'); -- 2.30.2