From f13b0c89b6dce2dc31ef3c58f0e2ad4821d7bee8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 5 Dec 2008 21:10:00 +0000 Subject: [PATCH] More fixes applied from profi-conecpt, cache system rewritten: now all cache files must depend on extension versions --- inc/databases.php | 2 +- inc/extensions.php | 14 +++---- inc/extensions/ext-cache.php | 17 ++++++--- inc/extensions/ext-sql_patches.php | 2 +- inc/functions.php | 2 +- inc/libs/admins_functions.php | 4 +- inc/libs/cache_functions.php | 41 ++++++++++++--------- inc/libs/refback_functions.php | 2 +- inc/load_extensions.php | 19 ++++++++-- inc/loader/load_cache-admin.php | 5 ++- inc/loader/load_cache-config.php | 9 +++-- inc/loader/load_cache-modreg.php | 3 +- inc/loader/load_cache-refdepths.php | 3 +- inc/loader/load_cache-refsystem.php | 3 +- inc/loader/load_cache-them.php | 2 +- inc/modules/admin/admin-inc.php | 2 +- inc/modules/admin/what-admins_add.php | 20 ++++------ inc/modules/admin/what-config_admins.php | 6 +-- inc/modules/admin/what-config_cache.php | 12 +++--- inc/modules/admin/what-config_mods.php | 2 +- inc/modules/admin/what-config_points.php | 2 +- inc/modules/admin/what-extensions.php | 4 +- inc/mysql-manager.php | 2 +- templates/de/html/install/install_page2.tpl | 12 +++--- templates/de/html/install/install_page3.tpl | 8 ++-- 25 files changed, 113 insertions(+), 85 deletions(-) diff --git a/inc/databases.php b/inc/databases.php index 1419c54ffb..d1341d0e3e 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -114,7 +114,7 @@ define('USAGE_BASE', "usage"); define('SERVER_URL', "http://www.mxchange.org"); // Current SVN revision -define('CURR_SVN_REVISION', "599"); +define('CURR_SVN_REVISION', "600"); // 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.php b/inc/extensions.php index 9d2c0a4418..cfe82ae48e 100644 --- a/inc/extensions.php +++ b/inc/extensions.php @@ -202,8 +202,8 @@ function EXTENSION_REGISTER ($ext_name, $id, $dry_run=false) //* DEBUG: */ echo __LINE__.": DESTROY!
\n"; // Remove cache files if ($cacheInstance->cache_file("extensions", true)) $cacheInstance->cache_destroy(); - if ($cacheInstance->cache_file("mod_reg", true)) $cacheInstance->cache_destroy(); - if ($cacheInstance->cache_file("config", true)) $cacheInstance->cache_destroy(); + if ($cacheInstance->cache_file("mod_reg")) $cacheInstance->cache_destroy(); + if ($cacheInstance->cache_file("config")) $cacheInstance->cache_destroy(); } // END - if // Check for added include files @@ -339,8 +339,8 @@ function EXTENSION_RUN_SQLS($id, $EXT_LOAD_MODE) { //* DEBUG: */ echo __LINE__.": DESTROY!
\n"; // Remove cache files if ($cacheInstance->cache_file("extensions", true)) $cacheInstance->cache_destroy(); - if ($cacheInstance->cache_file("mod_reg", true)) $cacheInstance->cache_destroy(); - if ($cacheInstance->cache_file("config", true)) $cacheInstance->cache_destroy(); + if ($cacheInstance->cache_file("mod_reg")) $cacheInstance->cache_destroy(); + if ($cacheInstance->cache_file("config")) $cacheInstance->cache_destroy(); // @TODO This causes the whole (!) menu cache being purged CACHE_PURGE_ADMIN_MENU(); @@ -537,9 +537,9 @@ function EXTENSION_UPDATE($file, $ext, $EXT_VER, $dry_run=false) // Update cache if (EXT_IS_ACTIVE("cache")) { - if ($cacheInstance->cache_file("extensions", true) == true) $cacheInstance->cache_destroy(); - if ($cacheInstance->cache_file("config", true) == true) $cacheInstance->cache_destroy(); - if ($cacheInstance->cache_file("mod_reg", true) == true) $cacheInstance->cache_destroy(); + if ($cacheInstance->cache_file("extensions", true)) $cacheInstance->cache_destroy(); + if ($cacheInstance->cache_file("config")) $cacheInstance->cache_destroy(); + if ($cacheInstance->cache_file("mod_reg")) $cacheInstance->cache_destroy(); } // END - if // Remove array diff --git a/inc/extensions/ext-cache.php b/inc/extensions/ext-cache.php index 7cda547dcd..9bfd6e0459 100644 --- a/inc/extensions/ext-cache.php +++ b/inc/extensions/ext-cache.php @@ -39,13 +39,13 @@ if (!defined('__SECURITY')) { } // Version number -$EXT_VERSION = "0.1.9"; +$EXT_VERSION = "0.2.0"; // 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", "0.0.4", "0.0.5", "0.0.6", "0.0.7", "0.0.8", "0.0.9", "0.1.0", "0.1.1", "0.1.2", "0.1.3", "0.1.4", "0.1.5", "0.1.6", "0.1.7", "0.1.8", "0.1.9"); +$EXT_VER_HISTORY = array("0.0", "0.0.1", "0.0.2", "0.0.3", "0.0.4", "0.0.5", "0.0.6", "0.0.7", "0.0.8", "0.0.9", "0.1.0", "0.1.1", "0.1.2", "0.1.3", "0.1.4", "0.1.5", "0.1.6", "0.1.7", "0.1.8", "0.1.9", "0.2.0"); switch ($EXT_LOAD_MODE) { @@ -92,11 +92,10 @@ case "update": // Update an extension case "0.0.4": // SQL queries for v0.0.4 // Update notes (these will be set as task text!) - if (EXT_IS_ACTIVE("cache")) - { + if (EXT_IS_ACTIVE("cache")) { // Check for cache when extension is already installed if ($cacheInstance->cache_file("extensions", true)) $cacheInstance->cache_destroy(); - } + } // END - if $UPDATE_NOTES = "Spalte "keep_active" ist hinzugefügt. Cache wurde reinitialisiert."; break; @@ -190,6 +189,14 @@ case "update": // Update an extension // Update notes (these will be set as task text!) $UPDATE_NOTES = "Administratormenü experimentell gecacht."; break; + + case "0.2.0": // SQL queries for v0.2.0 + // This update depends on sql_patches + $EXT_UPDATE_DEPENDS = "sql_patches"; + + // Update notes (these will be set as task text!) + $UPDATE_NOTES = "Die Erweiterung hängt nun von der sql_patches ab."; + break; } break; diff --git a/inc/extensions/ext-sql_patches.php b/inc/extensions/ext-sql_patches.php index 8d8b5cc467..c35f2ffe25 100644 --- a/inc/extensions/ext-sql_patches.php +++ b/inc/extensions/ext-sql_patches.php @@ -727,7 +727,7 @@ default: // Do stuff when extension is loaded require_once(PATH."inc/libs/cache_functions.php"); require_once(PATH."inc/extensions/ext-cache.php"); if ($cacheInstance->cache_file("extensions", true)) $cacheInstance->cache_destroy(); - if ($cacheInstance->cache_file("mod_reg", true)) $cacheInstance->cache_destroy(); + if ($cacheInstance->cache_file("mod_reg")) $cacheInstance->cache_destroy(); } // END - if } // END - if diff --git a/inc/functions.php b/inc/functions.php index 65d558956b..5b3b3855c3 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -2602,7 +2602,7 @@ function REBUILD_CACHE ($cache, $inc="") { // Shall I remove the cache file? if ((EXT_IS_ACTIVE("cache")) && (is_object($cacheInstance))) { // Rebuild cache - if ($cacheInstance->cache_file($cache, true)) { + if ($cacheInstance->cache_file($cache)) { // Destroy it $cacheInstance->cache_destroy(); } // END - if diff --git a/inc/libs/admins_functions.php b/inc/libs/admins_functions.php index e83bb3d1b9..535adf41ac 100644 --- a/inc/libs/admins_functions.php +++ b/inc/libs/admins_functions.php @@ -255,7 +255,7 @@ WHERE id=%s LIMIT 1", // Remove cache file if ((EXT_IS_ACTIVE("cache")) && ($cache_update == "1")) { - if ($cacheInstance->cache_file("admins", true)) $cacheInstance->cache_destroy(); + if ($cacheInstance->cache_file("admins")) $cacheInstance->cache_destroy(); } } @@ -368,7 +368,7 @@ function ADMINS_REMOVE_ADMIN_ACCOUNTS ($POST) { // Remove cache if cache system is activated if ((EXT_IS_ACTIVE("cache")) && ($cache_update == "1")) { - if ($cacheInstance->cache_file("admins", true)) $cacheInstance->cache_destroy(); + if ($cacheInstance->cache_file("admins")) $cacheInstance->cache_destroy(); } } diff --git a/inc/libs/cache_functions.php b/inc/libs/cache_functions.php index a3b1d0a15e..88b506223d 100644 --- a/inc/libs/cache_functions.php +++ b/inc/libs/cache_functions.php @@ -49,6 +49,7 @@ class mxchange_cache var $cache_pointer = false; var $cache_data = ""; var $cache_version = ""; + var $cache_file = ""; // Constructor function mxchange_cache($interval, $path, $tested) { @@ -87,8 +88,11 @@ class mxchange_cache } } - function cache_file($file, $ignore_ctime=false) { - global $INC; + // Checks validity of cache file and if content is given + function cache_file ($file, $forceContent = false) { + // Remember cache file + $this->cache_file = $file; + // Construct FQFN (full qualified file name) $inc = $this->cache_path.$file.".cache"; @@ -109,10 +113,10 @@ class mxchange_cache $this->cache_ctime = $ctime; // Is the cache file outdated? - if (((time() - $ctime) >= $this->update_interval) && (!$ignore_ctime)) { + if (($status) && ((time() - $ctime) >= $this->update_interval)) { // Ok, we need an update! $status = false; - } + } // END - if // Return status return $status; @@ -196,23 +200,29 @@ class mxchange_cache $cache_version = null; // Load cache file - $this->cache_data = implode("", file($this->cache_inc)); + $this->cache_data[$this->cache_file] = implode("", file($this->cache_inc)); // Execute cache file - eval($this->cache_data); + eval($this->cache_data[$this->cache_file]); if (is_array($data)) { // Cache data - $this->cache_data = $data; + $this->cache_data[$this->cache_file] = $data; // Cache version found? - if ((isset($cache_version)) && (is_array($cache_version))) { + if ((is_array($cache_version)) && (count($cache_version) > 0)) { // Remember it as well... - $this->cache_version = $cache_version; - } // END - if + $this->cache_version[$this->cache_file] = $cache_version; + } else { + // Invalid cache so destroy it + $this->cache_destroy(); + + // Clear cached data + $this->cache_data[$this->cache_file] = array(); + } // Return cache - return $this->cache_data; + return $this->cache_data[$this->cache_file]; } else { // Cache problem detected! $this->cache_destroy(); @@ -242,8 +252,7 @@ class mxchange_cache } } - function cache_remove($search, $data, $array) - { + function cache_remove($search, $data, $array) { global $ARRAY; if ((FILE_READABLE($this->cache_inc)) && (is_writeable($this->cache_inc))) { // Load cache into dummy array @@ -287,8 +296,7 @@ class mxchange_cache } } - function cache_replace($search, $replace, $search_key, $array) - { + function cache_replace($search, $replace, $search_key, $array) { global $ARRAY; if ((FILE_READABLE($this->cache_inc)) && (is_writeable($this->cache_inc))) { @@ -361,9 +369,8 @@ class mxchange_cache // Get extension version $ext_ver = GET_EXT_VERSION($ext_name); - //* DEBUG: */ echo __METHOD__.": ext_name={$ext_name},ext_ver={$ext_ver},cache_version={$this->cache_version}
\n"; // Compare both - return ((isset($this->cache_version[$ext_name])) && ($this->cache_version[$ext_name] == $ext_ver)); + return ((isset($this->cache_version[$this->cache_file][$ext_name])) && ($this->cache_version[$this->cache_file][$ext_name] == $ext_ver)); } function add_raw_row ($key, $value) { diff --git a/inc/libs/refback_functions.php b/inc/libs/refback_functions.php index e7a2b5987b..469b04d304 100644 --- a/inc/libs/refback_functions.php +++ b/inc/libs/refback_functions.php @@ -247,7 +247,7 @@ function UPDATE_REFBACK_TABLE($uid) { if ((($cacheArray['up_refid'][$cacheArray['back_level']] == $uid) || ($cacheArray['up_refid'][$cacheArray['back_level']] == 0)) && (GET_EXT_VERSION("cache") >= "0.1.2") && (!isset($cacheArray['back_cached']))) { // Remove cache here //* DEBUG: */ print __FUNCTION__."(".__LINE__."):uid={$uid},ref={$cacheArray['up_refid'][$cacheArray['back_level']]} - CACHE!
\n"; - if ($cacheInstance->cache_file("refback", true)) $cacheInstance->cache_destroy(); + if ($cacheInstance->cache_file("refback")) $cacheInstance->cache_destroy(); $cacheArray['back_cached'] = 1; } // END - if diff --git a/inc/load_extensions.php b/inc/load_extensions.php index e7d7e0b900..87f1179fb1 100644 --- a/inc/load_extensions.php +++ b/inc/load_extensions.php @@ -64,7 +64,7 @@ if (EXT_IS_ACTIVE("cache")) { include_once(PATH."inc/libs/cache_functions.php"); $cacheMode = ""; include_once(PATH."inc/extensions/ext-cache.php"); - switch($cacheInstance->cache_file("extensions", true)) { + switch (($cacheInstance->cache_file("extensions", true)) && ($cacheInstance->ext_version_matches("sql_patches"))) { case true : $cacheMode = "load"; break; case false: $cacheMode = "init"; break; } @@ -75,6 +75,7 @@ if (EXT_IS_ACTIVE("cache")) { if ($cacheMode == "init") { // Init cache file $cacheInstance->cache_init("EXTENSIONS"); + $cacheInstance->store_extension_version("sql_patches"); if ($_CONFIG['cache_exts'] == "N") $cacheMode = "skip"; } // END - if @@ -94,6 +95,15 @@ if ($cacheMode == "load") { // Load extension data from cache file $EXT_DUMMY = $cacheInstance->cache_load(); + // Is the cache file fine? + if (!isset($EXT_DUMMY['ext_name'])) { + // Cache file is damaged so kill it + $cacheInstance->cache_destroy(); + + // Skip any further execution + return; + } // END - if + // Begin with the cache preparation of extensions $EXT_NAMES = array(); foreach ($EXT_DUMMY['ext_name'] as $k => $name) { @@ -108,7 +118,7 @@ if ($cacheMode == "load") { if (FILE_READABLE($INC)) { // Add it $EXT_POOL[] = $INC; - } + } // END - if } // END - if // Load CSS file @@ -122,12 +132,15 @@ if ($cacheMode == "load") { // Version number $EXT_DUMMY['ext_version'][$name] = $EXT_DUMMY['ext_version'][$k]; unset($EXT_DUMMY['ext_version'][$k]); + // Extension is active $EXT_DUMMY['ext_active'][$name] = $EXT_DUMMY['ext_active'][$k]; unset($EXT_DUMMY['ext_active'][$k]); + // Ext menu $EXT_DUMMY['ext_menu'][$name] = $EXT_DUMMY['ext_menu'][$k]; unset($EXT_DUMMY['ext_menu'][$k]); + // Extension id $EXT_DUMMY['ext_id'][$name] = $EXT_DUMMY['ext_id'][$k]; $id = $EXT_DUMMY['ext_id'][$name]; @@ -296,7 +309,7 @@ if ((SQL_NUMROWS($res_ext_crt) > 0) && ((($cacheMode == "init") && ($CSS != "1") // Free memory SQL_FREERESULT($res_ext_crt); -} +} // END - if // Load include files if found if (!empty($INC_POOL[0])) { diff --git a/inc/loader/load_cache-admin.php b/inc/loader/load_cache-admin.php index b9cbd32f4b..7e28bda282 100644 --- a/inc/loader/load_cache-admin.php +++ b/inc/loader/load_cache-admin.php @@ -38,7 +38,7 @@ if (!defined('__SECURITY')) { } // END - if // Let's start with the admins table... -if (($cacheInstance->cache_file("admins", true) == true) && ($cacheInstance->ext_version_matches("admins"))) { +if (($cacheInstance->cache_file("admins")) && ($cacheInstance->ext_version_matches("admins"))) { // Load cache global $cacheArray; $cacheArray['admins'] = $cacheInstance->cache_load(); @@ -116,13 +116,14 @@ $cacheInstance->cache_close(); // Next cached table are the admins_acls... if (GET_EXT_VERSION("admins") >= "0.3") { // Check for cache file - if ($cacheInstance->cache_file("admins_acls", true) == true) { + if (($cacheInstance->cache_file("admins_acls")) && ($cacheInstance->ext_version_matches("admins"))) { // Load referal system from cache global $cacheArray; $cacheArray['admin_acls'] = $cacheInstance->cache_load(); } elseif (($_CONFIG['cache_acls'] == "Y") && ($CSS != "1") && ($CSS != "-1")) { // Create cache file here $cacheInstance->cache_init("ADMINS_ACLS"); + $cacheInstance->store_extension_version("admins"); // Load all modules and their data $result = SQL_QUERY("SELECT id, admin_id, action_menu, what_menu, access_mode FROM "._MYSQL_PREFIX."_admins_acls ORDER BY admin_id, action_menu, what_menu", __FILE__, __LINE__); diff --git a/inc/loader/load_cache-config.php b/inc/loader/load_cache-config.php index 8139855b7f..a8ca165691 100644 --- a/inc/loader/load_cache-config.php +++ b/inc/loader/load_cache-config.php @@ -38,16 +38,19 @@ if (!defined('__SECURITY')) { } // Next cached table is the configuration (config)... -if ($cacheInstance->cache_file("config", true) == true) { +if (($cacheInstance->cache_file("config", true)) && ($cacheInstance->ext_version_matches("sql_patches"))) { // Load config from cache global $cacheArray; - $cacheArrayConfig = $cacheInstance->cache_load(); + $cacheArray['config'] = $cacheInstance->cache_load(); + + // TODO: Do we really need to cache the config??? } elseif (($_CONFIG['cache_config'] == "Y") && ($CSS != "1") && ($CSS != "-1")) { // Create cache file here $cacheInstance->cache_init("CONFIG"); + $cacheInstance->store_extension_version("sql_patches"); // Load all modules and their data - $result = SQL_QUERY("SELECT * FROM "._MYSQL_PREFIX."_config ORDER BY config", __FILE__, __LINE__); + $result = SQL_QUERY("SELECT * FROM "._MYSQL_PREFIX."_config ORDER BY config ASC", __FILE__, __LINE__); while ($data = SQL_FETCHARRAY($result)) { // Add row to cache file $cacheInstance->add_row($data); diff --git a/inc/loader/load_cache-modreg.php b/inc/loader/load_cache-modreg.php index ed6797493d..126888ba9b 100644 --- a/inc/loader/load_cache-modreg.php +++ b/inc/loader/load_cache-modreg.php @@ -38,7 +38,7 @@ if (!defined('__SECURITY')) { } // Next cached table is the module registry (mod_reg)... -if ($cacheInstance->cache_file("mod_reg", true) == true) { +if (($cacheInstance->cache_file("mod_reg")) && ($cacheInstance->ext_version_matches("sql_patches"))) { // Load cache global $cacheArray; $cacheArray['modules'] = $cacheInstance->cache_load(); @@ -67,6 +67,7 @@ if ($cacheInstance->cache_file("mod_reg", true) == true) { } elseif (($_CONFIG['cache_modreg'] == "Y") && ($CSS != "1") && ($CSS != "-1")) { // Create cache file here $cacheInstance->cache_init("MODULES"); + $cacheInstance->store_extension_version("sql_patches"); // Load all modules and their data if (GET_EXT_VERSION("sql_patches") >= "0.3.6") { diff --git a/inc/loader/load_cache-refdepths.php b/inc/loader/load_cache-refdepths.php index 3d1dc5e19c..973e7cbeda 100644 --- a/inc/loader/load_cache-refdepths.php +++ b/inc/loader/load_cache-refdepths.php @@ -38,13 +38,14 @@ if (!defined('__SECURITY')) { } // Next cached table is the referal system (refdepths)... -if ($cacheInstance->cache_file("refdepths", true) == true) { +if (($cacheInstance->cache_file("refdepths")) && ($cacheInstance->ext_version_matches("sql_patches"))) { // Load referal system from cache global $cacheArray; $cacheArray['ref_depths'] = $cacheInstance->cache_load(); } elseif (($_CONFIG['cache_refdepth'] == "Y") && ($CSS != "1") && ($CSS != "-1")) { // Create cache file here $cacheInstance->cache_init("REFDEPTHS"); + $cacheInstance->store_extension_version("sql_patches"); // Load all modules and their data $result = SQL_QUERY("SELECT id, level, percents FROM "._MYSQL_PREFIX."_refdepths ORDER BY level", __FILE__, __LINE__); diff --git a/inc/loader/load_cache-refsystem.php b/inc/loader/load_cache-refsystem.php index 5d8c7d12ef..c012c7926d 100644 --- a/inc/loader/load_cache-refsystem.php +++ b/inc/loader/load_cache-refsystem.php @@ -38,13 +38,14 @@ if (!defined('__SECURITY')) { } // Next cached table is the referal system (refsystem)... -if ($cacheInstance->cache_file("refsystem", true) == true) { +if (($cacheInstance->cache_file("refsystem")) && ($cacheInstance->ext_version_matches("sql_patches"))) { // Load referal system from cache global $cacheArray; $cacheArray['ref_system'] = $cacheInstance->cache_load(); } elseif (($_CONFIG['cache_refsys'] == "Y") && ($CSS != "1") && ($CSS != "-1")) { // Create cache file here $cacheInstance->cache_init("REFSYSTEM"); + $cacheInstance->store_extension_version("sql_patches"); // Load all modules and their data $result = SQL_QUERY("SELECT id, userid, level, counter FROM "._MYSQL_PREFIX."_refsystem ORDER BY userid, level", __FILE__, __LINE__); diff --git a/inc/loader/load_cache-them.php b/inc/loader/load_cache-them.php index 61b30df937..fde1f1bc54 100644 --- a/inc/loader/load_cache-them.php +++ b/inc/loader/load_cache-them.php @@ -38,7 +38,7 @@ if (!defined('__SECURITY')) { } // Next cached table is the referal system (themes)... -if (($cacheInstance->cache_file("themes", true) == true) && ($cacheInstance->ext_version_matches("theme"))) { +if (($cacheInstance->cache_file("themes")) && ($cacheInstance->ext_version_matches("theme"))) { // Load referal system from cache global $cacheArray; $cache = $cacheInstance->cache_load(); diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index 9b745c7f3a..970dd69ff5 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -389,7 +389,7 @@ function ADD_ADMIN_MENU($act, $wht, $return=false) { $cacheName = "admin_".$act."_".$wht."_".GET_LANGUAGE()."_".strtolower(get_session('admin_login')); // Is that cache there? - if ($cacheInstance->cache_file($cacheName, true)) { + if ($cacheInstance->cache_file($cacheName)) { // Then load it $data = $cacheInstance->cache_load(); diff --git a/inc/modules/admin/what-admins_add.php b/inc/modules/admin/what-admins_add.php index fad779b17f..45fd36eaaf 100644 --- a/inc/modules/admin/what-admins_add.php +++ b/inc/modules/admin/what-admins_add.php @@ -45,13 +45,11 @@ global $cacheInstance; // Display form is default $FORM = true; -if ((isset($_POST['add'])) && (!empty($_POST['login'])) && (!empty($_POST['email'])) && (!empty($_POST['pass1'])) && (!empty($_POST['pass2'])) && ($_POST['pass1'] == $_POST['pass2'])) -{ +if ((isset($_POST['add'])) && (!empty($_POST['login'])) && (!empty($_POST['email'])) && (!empty($_POST['pass1'])) && (!empty($_POST['pass2'])) && ($_POST['pass1'] == $_POST['pass2'])) { // Add admin when not added already $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_admins WHERE login='%s' LIMIT 1", - array($_POST['login']), __FILE__, __LINE__); - if (SQL_NUMROWS($result) == 0) - { + array($_POST['login']), __FILE__, __LINE__); + if (SQL_NUMROWS($result) == 0) { // Login does not exist so we can create it. $FORM = false; $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_admins (login, password, email) VALUES ('%s','%s','%s')", @@ -61,20 +59,16 @@ if ((isset($_POST['add'])) && (!empty($_POST['login'])) && (!empty($_POST['email LOAD_TEMPLATE("admin_settings_saved", false, "".ADMIN_ADMINS_ADD_DONE.""); // Remove cache file - if (EXT_IS_ACTIVE("cache")) - { - if ($cacheInstance->cache_file("admins", true)) $cacheInstance->cache_destroy(); + if (EXT_IS_ACTIVE("cache")) { + if ($cacheInstance->cache_file("admins")) $cacheInstance->cache_destroy(); } - } - else - { + } else { // Free memory SQL_FREERESULT($result); } } -if ($FORM) -{ +if ($FORM) { // Clear unset variables if (empty($_POST['login'])) $_POST['login'] = ""; if (empty($_POST['email'])) $_POST['email'] = ""; diff --git a/inc/modules/admin/what-config_admins.php b/inc/modules/admin/what-config_admins.php index c531b3b30f..05ca3dd2dd 100644 --- a/inc/modules/admin/what-config_admins.php +++ b/inc/modules/admin/what-config_admins.php @@ -89,7 +89,7 @@ if ((isset($_POST['edit'])) && ($SEL > 0)) { // Update cache when installed if (EXT_IS_ACTIVE("cache")) { - if ($cacheInstance->cache_file("admins_acls", true) == true) $cacheInstance->cache_destroy(); + if ($cacheInstance->cache_file("admins_acls")) $cacheInstance->cache_destroy(); // Purge menu cache CACHE_PURGE_ADMIN_MENU($_POST['admin'][$id]); @@ -151,7 +151,7 @@ if ((isset($_POST['edit'])) && ($SEL > 0)) { // Update cache when installed if (EXT_IS_ACTIVE("cache")) { - if ($cacheInstance->cache_file("admins_acls", true) == true) $cacheInstance->cache_destroy(); + if ($cacheInstance->cache_file("admins_acls")) $cacheInstance->cache_destroy(); // @TODO This causes the whole (!) menu cache being rebuild CACHE_PURGE_ADMIN_MENU(); @@ -191,7 +191,7 @@ VALUES ('%s','%s','%s','%s')", // Update cache when installed if (EXT_IS_ACTIVE("cache")) { - if ($cacheInstance->cache_file("admins_acls", true) == true) $cacheInstance->cache_destroy(); + if ($cacheInstance->cache_file("admins_acls")) $cacheInstance->cache_destroy(); // Purge cache CACHE_PURGE_ADMIN_MENU($_POST['admin_id'], $_POST['action_menu'], $_POST['what_menu']); diff --git a/inc/modules/admin/what-config_cache.php b/inc/modules/admin/what-config_cache.php index da06438288..27b9f6d9a9 100644 --- a/inc/modules/admin/what-config_cache.php +++ b/inc/modules/admin/what-config_cache.php @@ -51,25 +51,25 @@ if (isset($_POST['ok'])) { } // Delete deactivated cache files - if (($_POST['cache_admins'] == "N") && ($cacheInstance->cache_file("admins", true))) { + if (($_POST['cache_admins'] == "N") && ($cacheInstance->cache_file("admins"))) { $cacheInstance->cache_destroy(); } - if (($_POST['cache_acls'] == "N") && ($cacheInstance->cache_file("acls", true))) { + if (($_POST['cache_acls'] == "N") && ($cacheInstance->cache_file("acls"))) { $cacheInstance->cache_destroy(); } if (($_POST['cache_exts'] == "N") && ($cacheInstance->cache_file("extensions", true))) { $cacheInstance->cache_destroy(); } - if (($_POST['cache_config'] == "N") && ($cacheInstance->cache_file("config", true))) { + if (($_POST['cache_config'] == "N") && ($cacheInstance->cache_file("config"))) { $cacheInstance->cache_destroy(); } - if (($_POST['cache_modreg'] == "N") && ($cacheInstance->cache_file("modreg", true))) { + if (($_POST['cache_modreg'] == "N") && ($cacheInstance->cache_file("modreg"))) { $cacheInstance->cache_destroy(); } - if (($_POST['cache_refdepth'] == "N") && ($cacheInstance->cache_file("refdepth", true))) { + if (($_POST['cache_refdepth'] == "N") && ($cacheInstance->cache_file("refdepth"))) { $cacheInstance->cache_destroy(); } - if (($_POST['cache_refsys'] == "N") && ($cacheInstance->cache_file("refsys", true))) { + if (($_POST['cache_refsys'] == "N") && ($cacheInstance->cache_file("refsys"))) { $cacheInstance->cache_destroy(); } diff --git a/inc/modules/admin/what-config_mods.php b/inc/modules/admin/what-config_mods.php index dceeebda8a..b4cdc29005 100644 --- a/inc/modules/admin/what-config_mods.php +++ b/inc/modules/admin/what-config_mods.php @@ -106,7 +106,7 @@ if (isset($_POST['edit'])) // Remove cache file if version matches if (GET_EXT_VERSION("cache") >= "0.1.2") { - if ($cacheInstance->cache_file("mod_reg", true)) $cacheInstance->cache_destroy(); + if ($cacheInstance->cache_file("mod_reg")) $cacheInstance->cache_destroy(); } // Entries updated diff --git a/inc/modules/admin/what-config_points.php b/inc/modules/admin/what-config_points.php index af0d44c407..44cafc4f76 100644 --- a/inc/modules/admin/what-config_points.php +++ b/inc/modules/admin/what-config_points.php @@ -103,7 +103,7 @@ if (isset($_POST['ok'])) { // Update cache file if (GET_EXT_VERSION("cache") >= "0.1.2") { - if ($cacheInstance->cache_file("refdepths", true)) $cacheInstance->cache_destroy(); + if ($cacheInstance->cache_file("refdepths")) $cacheInstance->cache_destroy(); } break; diff --git a/inc/modules/admin/what-extensions.php b/inc/modules/admin/what-extensions.php index 516143a429..9c4c1c119b 100644 --- a/inc/modules/admin/what-extensions.php +++ b/inc/modules/admin/what-extensions.php @@ -310,9 +310,9 @@ case "register": // Register new extension // Do we need to update cache file? if ((EXT_IS_ACTIVE("cache")) && ($cacheMode != "no")) { // Remove cache file (will be auto-created again!) - if ($cacheInstance->cache_file("config" , true)) $cacheInstance->cache_destroy(); + if ($cacheInstance->cache_file("config")) $cacheInstance->cache_destroy(); if ($cacheInstance->cache_file("extensions", true)) $cacheInstance->cache_destroy(); - if ($cacheInstance->cache_file("mod_reg" , true)) $cacheInstance->cache_destroy(); + if ($cacheInstance->cache_file("mod_reg")) $cacheInstance->cache_destroy(); } // END - if } elseif (GET_EXT_VERSION($ext_name) != "") { // Motify the admin that we have a problem here... diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index ef0072bff8..1e4856595c 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -1732,7 +1732,7 @@ function IS_DEMO() { return ((EXT_IS_ACTIVE("demo")) && (get_session('admin_login') == "demo")); } // -function LOAD_CONFIG($no="0") { +function LOAD_CONFIG ($no="0") { global $cacheArray; $CFG_DUMMY = array(); diff --git a/templates/de/html/install/install_page2.tpl b/templates/de/html/install/install_page2.tpl index d6cfe7d5f5..b6f5972998 100644 --- a/templates/de/html/install/install_page2.tpl +++ b/templates/de/html/install/install_page2.tpl @@ -17,7 +17,7 @@ {--MYSQL_HOST--} :  - @@ -25,7 +25,7 @@ {--MYSQL_DBASE--} :  - @@ -33,7 +33,7 @@ {--MYSQL_PREFIX--} :  - @@ -41,7 +41,7 @@ {--MYSQL_LOGIN--} :  - @@ -50,7 +50,7 @@ {--MYSQL_PASS1--} :  + size="25" class="install_normal" class="install_normal">   @@ -58,7 +58,7 @@ {--MYSQL_PASS2--} :  + size="25" class="install_normal" class="install_normal">   diff --git a/templates/de/html/install/install_page3.tpl b/templates/de/html/install/install_page3.tpl index b48b5da280..e7db28b4c4 100644 --- a/templates/de/html/install/install_page3.tpl +++ b/templates/de/html/install/install_page3.tpl @@ -17,7 +17,7 @@ {--TEXT_SMTP_HOST--} :  - + @@ -26,7 +26,7 @@ {--TEXT_SMTP_USER--} :  - + @@ -35,7 +35,7 @@ {--TEXT_SMTP_PASS1--} :  - + @@ -44,7 +44,7 @@ {--TEXT_SMTP_PASS2--} :  - + -- 2.30.2