From 2e68ea39a430a7217e58747b877acaa3e92ea997 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 7 Feb 2009 03:35:45 +0000 Subject: [PATCH] More fixes from bugtracker issues, thanks to profi-concept --- .gitattributes | 2 + DOCS/de/TODO.txt | 9 ++- inc/databases.php | 2 +- inc/db/lib.php | 10 +-- inc/extensions/ext-iso3166.php | 2 +- inc/extensions/ext-logs.php | 89 +++++++++++++++++++++++ inc/extensions/ext-other.php | 4 +- inc/extensions/ext-sql_patches.php | 2 +- inc/extensions/ext-user.php | 11 ++- inc/extensions/ext-wernis.php | 11 ++- inc/functions.php | 26 ++++++- inc/install-inc.php | 8 +- inc/language/bank_de.php | 3 - inc/language/en.ph | 2 - inc/language/logs_de.php | 49 +++++++++++++ inc/libs/admins_functions.php | 2 +- inc/modules/admin/admin-inc.php | 66 ++++++++++------- inc/modules/admin/what-admins_add.php | 28 +++---- inc/modules/admin/what-config_cats.php | 2 +- inc/modules/admin/what-config_email.php | 10 +-- inc/modules/admin/what-config_payouts.php | 2 +- inc/modules/admin/what-config_points.php | 45 +++++++----- inc/modules/admin/what-edit_emails.php | 2 +- inc/modules/admin/what-guest_add.php | 8 +- inc/modules/admin/what-list_country.php | 2 +- inc/modules/admin/what-logs.php | 32 +++++--- inc/modules/admin/what-refbanner.php | 46 +++++------- inc/modules/admin/what-repair_amenu.php | 2 +- inc/modules/admin/what-repair_cats.php | 28 +++---- inc/modules/admin/what-repair_gmenu.php | 2 +- inc/modules/admin/what-repair_mmenu.php | 2 +- inc/modules/admin/what-usage.php | 10 ++- inc/mysql-connect.php | 6 +- inc/stylesheet.php | 3 +- install/menu-de.sql | 12 --- install/menu-en.sql | 12 --- 36 files changed, 360 insertions(+), 192 deletions(-) create mode 100644 inc/extensions/ext-logs.php create mode 100644 inc/language/logs_de.php diff --git a/.gitattributes b/.gitattributes index 67b6872cff..a6a10877d2 100644 --- a/.gitattributes +++ b/.gitattributes @@ -121,6 +121,7 @@ inc/extensions/ext-events.php -text inc/extensions/ext-holiday.php -text inc/extensions/ext-html_mail.php -text inc/extensions/ext-iso3166.php -text +inc/extensions/ext-logs.php -text inc/extensions/ext-mailid.php -text inc/extensions/ext-maintenance.php -text inc/extensions/ext-mediadata.php -text @@ -186,6 +187,7 @@ inc/language/en.php -text inc/language/holiday_de.php -text inc/language/html_mail_de.php -text inc/language/install_de.php -text +inc/language/logs_de.php -text inc/language/mailid_de.php -text inc/language/maintenance_de.php -text inc/language/mediadata_de.php -text diff --git a/DOCS/de/TODO.txt b/DOCS/de/TODO.txt index b9732b3c54..f107a994f9 100644 --- a/DOCS/de/TODO.txt +++ b/DOCS/de/TODO.txt @@ -2,12 +2,17 @@ = TODO-Liste = ============== -[16.12.2008 14:40 Uhr]: +[07.02.2009 02:55 Uhr]: + +--- IMMER OFFEN: --- +- Alle @TODO abarbeiten +- Alle @DEPRECATED entfernen, wo es geht und evtl. Ersatzcode finden --- OFFEN: --- +- Den gesamten HTML-Code auf XHTML portieren und mit http://validator.w3.org validieren - Alle JavaScripte aus den HTML-Templates umlagern und per js.php?tag=xxx aufrufen -- Die Datenbankspalten ext_has_css nach ext_css und id nach ext_id umbenennen +- Die Datenbankspalten ext_has_css nach ext_css und id nach ext_id umbenennen (Tabelle extensions) - Dokumentation erweitern - Englische Uebersetzung komplettieren - Mehr Datenbank-Schichten hinzufuegen, wie fuer ODBC/M$SQL/Oracle diff --git a/inc/databases.php b/inc/databases.php index 10595529d2..925c495438 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -115,7 +115,7 @@ define('USAGE_BASE', "usage"); define('SERVER_URL', "http://www.mxchange.org"); // Current SVN revision -define('CURR_SVN_REVISION', "710"); +define('CURR_SVN_REVISION', "711"); // Take a prime number which is long (if you know a longer one please try it out!) define('_PRIME', 591623); diff --git a/inc/db/lib.php b/inc/db/lib.php index 4384bfea81..083e5f240d 100644 --- a/inc/db/lib.php +++ b/inc/db/lib.php @@ -41,18 +41,18 @@ if (!defined('__SECURITY')) { if (_DB_TYPE == "_DB_TYPE") define('_DB_TYPE', "mysql3"); // Create include file name -$INC = sprintf("%sinc/db/lib-%s.php", PATH, _DB_TYPE); +$FQFN = sprintf("%sinc/db/lib-%s.php", PATH, _DB_TYPE); -if ((file_exists($INC)) && (is_readable($INC))) { +if (FILE_READABLE($FQFN)) { // Include abstraction layer - require_once($INC); + require_once($FQFN); } else { // Bye, bye... - die("Cannot load database abstraction layer! R.I.P."); + die("Cannot load database abstraction layer "._DB_TYPE." -> R.I.P."); } // Remove this globally used variable -unset($INC); +unset($FQFN); // ?> diff --git a/inc/extensions/ext-iso3166.php b/inc/extensions/ext-iso3166.php index 4c2cd173ac..64066bd5ee 100644 --- a/inc/extensions/ext-iso3166.php +++ b/inc/extensions/ext-iso3166.php @@ -64,7 +64,7 @@ case "activate": // Do stuff when admin activates this extension case "deactivate": // Do stuff when admin deactivates this extension // SQL commands to run - $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_countries` SET is_active = 'N' WHERE provider = 'ext-iso3166';"; + $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_countries` SET is_active='N' WHERE provider = 'ext-iso3166';"; break; case "update": // Update an extension diff --git a/inc/extensions/ext-logs.php b/inc/extensions/ext-logs.php new file mode 100644 index 0000000000..0326ef7b1c --- /dev/null +++ b/inc/extensions/ext-logs.php @@ -0,0 +1,89 @@ + diff --git a/inc/extensions/ext-other.php b/inc/extensions/ext-other.php index 719e9a7cd3..52a1974345 100644 --- a/inc/extensions/ext-other.php +++ b/inc/extensions/ext-other.php @@ -50,12 +50,12 @@ 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[] = ""; + $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('setup','config_other','Sonstige Einstellungen','Sonstige Einstellungen an Ihrem Mailtausch.','13')"; break; case "remove": // Do stuff when removing extension // SQL commands to run - $SQLs[] = ""; + $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_admin_menu` WHERE what='config_other' LIMIT 1"; break; case "activate": // Do stuff when admin activates this extension diff --git a/inc/extensions/ext-sql_patches.php b/inc/extensions/ext-sql_patches.php index 1d10934a85..cb4003c39d 100644 --- a/inc/extensions/ext-sql_patches.php +++ b/inc/extensions/ext-sql_patches.php @@ -746,7 +746,7 @@ default: // Do stuff when extension is loaded $hashFile = sprintf("%sinc/.secret/.%s", PATH, getConfig('file_hash')); if (FILE_READABLE($hashFile)) { // Read file - $_CONFIG['secret_key'] = implode("", file($hashFile)); + $_CONFIG['secret_key'] = READ_FILE($hashFile); } else { // Remove it from database UPDATE_CONFIG("file_hash", ""); diff --git a/inc/extensions/ext-user.php b/inc/extensions/ext-user.php index 3ba1a8a8ce..fee1d8d030 100644 --- a/inc/extensions/ext-user.php +++ b/inc/extensions/ext-user.php @@ -47,7 +47,16 @@ 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[] = ""; + $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user',NULL,'Mitglieder-Management','Mitglieder freischalten, sperren, Accounts editieren, Neuanmeldungen verwalten, {!POINTS!} gutschreiben und abziehen und und und...',3)"; + $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user','del_user','Mitglied löschen','Löschen Sie hier Mitglied, die gegen die AGBs mehrmals verstossen haben. Bitte seien Sie nett zu Ihren Mitgliedern und löschen Sie nicht gleich.',1)"; + $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user','chk_regs','Anmeldungen prüfen','Prüfen Sie hier neue Anmeldungen zu Ihrem System. Hier können Sie im Falle einer Fehler-Mail den Mitglied gleich wieder löschen!',2)"; + $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user','lock_user','Mitglied sperren / entsperren','Sperren Sie Mitglied, die zu viele unbestätigte Mails haben oder gegen Ihre AGBs verstossen haben über diesen Menüpunkt.',3)"; + $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user','list_user','Mitglied auflisten','Listen Sie alle Mitglied oder eingeschränkt nach Suchkritieren Ihre Userdatenbank auf. Sie könen per Klick auf die Usernummer sich Details zum Mitglied ansehen.',4)"; + $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user','add_points','{!POINTS!} gutschreiben','Buchen Sie einem Mitglied direkt {!POINTS!} auf. Sie können dazu auch einen Kommentar mitsenden.',5)"; + $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user','edit_user','Account editieren','Daten eines Mitglieder-Accountes ändern.',6)"; + $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user','list_refs','Referals anzeigen','Mit diesem Menüpunkt können Sie die generierten Referals eines Mitgliedes auflisten.',7)"; + $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user','list_links','Unbestätigte Mails','Mit diesem Menüpunkt können Sie die vom Mitglied nicht bestätigten Mails anzeigen.',8)"; + $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('user','list_cats','Kategorien anzeigen','Listet die ausgewählten Kategorien eines Mitgliedes auf.',9)"; // Load CSS-File? $EXT_CSS = "Y"; diff --git a/inc/extensions/ext-wernis.php b/inc/extensions/ext-wernis.php index 3d8855fdf2..3bc9f01bf2 100644 --- a/inc/extensions/ext-wernis.php +++ b/inc/extensions/ext-wernis.php @@ -38,13 +38,13 @@ if (!defined('__SECURITY')) { } // Version of this extension -$EXT_VERSION = "0.0.3"; +$EXT_VERSION = "0.0.4"; // Auto-set extension version if (empty($EXT_VER)) $EXT_VER = $EXT_VERSION; // Version history array (add more with , "0.1" and so on) -$EXT_VER_HISTORY = array("0.0", "0.0.1", "0.0.2", "0.0.3"); +$EXT_VER_HISTORY = array("0.0", "0.0.1", "0.0.2", "0.0.3", "0.0.4"); switch ($EXT_LOAD_MODE) { @@ -136,6 +136,13 @@ case "update": // Update an extension // Update notes (these will be set as task text!) $UPDATE_NOTES = "Spaltentyp von VARCHAR(6) auf BIGINT(5) geändert."; break; + + case "0.0.4": // SQL queries for v0.0.4 + $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `wernis_refid` INT(5) UNSIGNED ZEROFILL NOT NULL DEFAULT '00000'"; + + // Update notes (these will be set as task text!) + $UPDATE_NOTES = "Fehlende Ref-Id hinzugetan."; + break; } break; diff --git a/inc/functions.php b/inc/functions.php index fd8b2c5a90..1133a3b1cb 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -347,7 +347,7 @@ function LOAD_TEMPLATE($template, $return=false, $content=array()) { // Now does the final template exists? if (FILE_READABLE($file)) { // The local file does exists so we load it. :) - $tmpl_file = implode("", file($file)); + $tmpl_file = READ_FILE($file); // Replace ' to our own chars to preventing them being quoted while (strpos($tmpl_file, "'") !== false) { $tmpl_file = str_replace("'", '{QUOT}', $tmpl_file); } @@ -881,7 +881,7 @@ function LOAD_EMAIL_TEMPLATE($template, $content=array(), $UID="0") { $newContent = ""; if (FILE_READABLE($file)) { // The local file does exists so we load it. :) - $tmpl_file = implode("", file($file)); + $tmpl_file = READ_FILE($file); $tmpl_file = addslashes($tmpl_file); // Run code @@ -2990,6 +2990,28 @@ function incrementConfigEntry ($configEntry, $value=1) { } } +// Read a given file +function READ_FILE ($FQFN, $sqlPrepare = false) { + // Load the file + if (function_exists('file_get_contents')) { + // Use new function + $content = file_get_contents($FQFN); + } else { + // Fall-back to implode-file chain + $content = implode("", file($FQFN)); + } + + // Prepare SQL queries? + if ($sqlPreppare === true) { + // Remove some unwanted chars + $content = str_replace("\r", "", $content); + $content = str_replace("\n\n", "\n", $content); + } // END - if + + // Return the content + return $content; +} + ////////////////////////////////////////////////// // // // AUTOMATICALLY RE-GENERATED MISSING FUNCTIONS // diff --git a/inc/install-inc.php b/inc/install-inc.php index 5768d4807b..0ff9df8997 100644 --- a/inc/install-inc.php +++ b/inc/install-inc.php @@ -348,12 +348,8 @@ if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndT // Should be save here because file_exists() is there but we check it again. :) $file = secureString($_POST['spath']) . "install/" . $dump; if (FILE_READABLE($file)) { - // Load the file - $sql = implode("", file($file)); - - // Remove some unwanted chars - $sql = str_replace("\r", "", $sql); - $sql = str_replace("\n\n", "\n", $sql); + // Read the file + $SQLs = READ_FILE($file, true); // And split it up against ;\n ... $SQLs = merge_array($SQLs, explode(";\n", $sql)); diff --git a/inc/language/bank_de.php b/inc/language/bank_de.php index f08218a52c..4a7d605ec2 100644 --- a/inc/language/bank_de.php +++ b/inc/language/bank_de.php @@ -65,9 +65,6 @@ define('ADMIN_LIST_BANK_PACKAGES_ACCOUNT_FEE', "Grundgebühr"); define('ADMIN_LIST_BANK_PACKAGES_STATUS', "Erwerbbar?"); define('ADMIN_LIST_BANK_PACKAGES_ACCOUNT_INTEREST_PLUS', "Zinsen f. Haben"); define('ADMIN_LIST_BANK_PACKAGES_ACCOUNT_INTEREST_MINUS', "Zinsen f. Soll"); -define('ADMIN_STATUS_CHANGED_1', "Es wurden "); -define('ADMIN_STATUS_CHANGED_2', " von "); -define('ADMIN_STATUS_CHANGED_3', " Einträgen geändert."); define('ADMIN_DELETE_BANK_PACKAGES', "Angebotspakete entgültig entfernen"); define('ADMIN_DELETE_BANK_PACKAGES_NOTES', "Hinweis: Wenn Sie die aufgelisteten Angebotspakete entgültig löschen, kann eventuell Ihre Bank nicht korrekt funktionieren, da eventuell einige Mitglieder dieses Paket ausgewählt haben. Bitte schauen Sie unter Konten auflisten vorher nach!"); define('ADMIN_EDIT_BANK_PACKAGES', "Angebotspakete ändern"); diff --git a/inc/language/en.ph b/inc/language/en.ph index fecebe1803..9d5e3a9bad 100644 --- a/inc/language/en.ph +++ b/inc/language/en.ph @@ -386,8 +386,6 @@ define('_OTHERS', "Andere"); define('_ALL2', "Alle"); define('WE_HAVE', "Wir haben"); define('MEMBER_TEST_URL', "Zur beworbenen Seite"); -define('ADMIN_LOGS_DIR_404_1', "Das Verzeichnis mit den Zugriffslogbüchern konnte nicht gefunden werden! ("); -define('ADMIN_LOGS_DIR_404_2', ")"); define('ADMIN_USAGE_DIR_404_1', "Das Verzeichnis mit den Webalizer-Statistiken konnte nicht gefunden werden! ("); define('ADMIN_USAGE_DIR_404_2', ")"); define('ADMIN_ENTER_REDIRECT_URL', "URL eingeben, wenn abgelehnt werden soll"); diff --git a/inc/language/logs_de.php b/inc/language/logs_de.php new file mode 100644 index 0000000000..72ef8c9c4a --- /dev/null +++ b/inc/language/logs_de.php @@ -0,0 +1,49 @@ +"); +define('ADMIN_LOGS_DIR_404_2', ") Vermutlich unterstützt Ihr Server dieses nicht."); +define('LOGFILE_NOT_READABLE_1', "Das Logbuch "); +define('LOGFILE_NOT_READABLE_2', " konnte nicht geladen werden."); +define('UNKNOWN_LOGFILE_FORMAT_1', "Das Logbuch "); +define('UNKNOWN_LOGFILE_FORMAT_2', " hat ein ungültiges oder nicht unterstütztes Format."); + +// +?> diff --git a/inc/libs/admins_functions.php b/inc/libs/admins_functions.php index 251e2a4e07..dd8d3273f1 100644 --- a/inc/libs/admins_functions.php +++ b/inc/libs/admins_functions.php @@ -248,7 +248,7 @@ WHERE id=%s LIMIT 1", // Display message if (!empty($MSG)) { - LOAD_TEMPLATE("admin_settings_saved", false, "".$MSG.""); + LOAD_TEMPLATE("admin_settings_saved", false, $MSG); } } diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index 5965d8f394..31de75a568 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -37,24 +37,27 @@ if (!defined('__SECURITY')) { require($INC); } -// -function REGISTER_ADMIN ($user, $md5, $email=WEBMASTER) -{ - $ret = "failed"; +// Register an administrator account +function REGISTER_ADMIN ($user, $md5, $email=WEBMASTER) { + // Login does already exist + $ret = "already"; + + // Lookup the user $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_admins WHERE login='%s' LIMIT 1", - array($user), __FILE__, __LINE__); + array($user), __FILE__, __LINE__); + + // Is the entry there? if (SQL_NUMROWS($result) == 0) { // Ok, let's create the admin login SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_admins (login, password, email) VALUES ('%s', '%s', '%s')", array($user, $md5, $email), __FILE__, __LINE__); $ret = "done"; - } else { - // Free memory - SQL_FREERESULT($result); + } // END - if - // Login does already exist - $ret = "already"; - } + // Free memory + SQL_FREERESULT($result); + + // Return result return $ret; } // Only be executed on login procedure! @@ -626,6 +629,7 @@ function ADMIN_MENU_SELECTION($MODE, $default="", $defid="") { // Return output return $OUT; } + // Save settings to the database function ADMIN_SAVE_SETTINGS (&$POST, $tableName="_config", $whereStatement="config=0", $translateComma=array(), $alwaysAdd=false) { global $_CONFIG, $cacheArray, $cacheInstance; @@ -713,21 +717,22 @@ function ADMIN_SAVE_SETTINGS (&$POST, $tableName="_config", $whereStatement="con SQL_FREERESULT($result); // Simply run generated SQL string - $result = SQL_QUERY($SQL, __FILE__, __LINE__); + SQL_QUERY($SQL, __FILE__, __LINE__); // Rebuild cache REBUILD_CACHE("config", "config"); // Settings saved - LOAD_TEMPLATE("admin_settings_saved", false, "".SETTINGS_SAVED.""); + LOAD_TEMPLATE("admin_settings_saved", false, SETTINGS_SAVED); } -// -function ADMIN_MAKE_MENU_SELECTION($menu, $type, $name, $default="") { + +// Generate a selection box +function ADMIN_MAKE_MENU_SELECTION ($menu, $type, $name, $default="") { // Open the requested menu directory $handle = opendir(sprintf("%sinc/modules/%s/", PATH, $menu)) or mxchange_die("Cannot load menu ".$menu."!"); // Init the selection box - $OUT = "\n \n"; // Walk through all files while ($file = readdir($handle)) { @@ -735,16 +740,18 @@ function ADMIN_MAKE_MENU_SELECTION($menu, $type, $name, $default="") { if (($file != ".") && ($file != "..") && ($file != "lost+found") && (strpos($file, "".$type."-") > -1) && (strpos($file, ".php") > 0)) { // Then test if the file is readable $test = sprintf("%sinc/modules/%s/%s", PATH, $menu, $file); - if ((is_file($test)) && (is_readable($test))) { + + // Is the file there? + if (FILE_READABLE($test)) { // Extract the value for what=xxx $part = substr($file, (strlen($type) + 1)); $part = substr($part, 0, -4); // Is that part different from the overview? if ($part != "overview") { - $OUT .= "