$name = sprintf("%s (%s)", getMessage('LANG_UNKNOWN_MODULE'), $mod);
if (SQL_NUMROWS($result) == 0) {
// Add module to database
- $dummy = CHECK_MODULE($mod);
+ $dummy = checkModulePermissions($mod);
} // END - if
} // END - if
}
// Check validity of a given module name (no file extension)
-function CHECK_MODULE ($mod) {
+function checkModulePermissions ($mod) {
// Filter module name (names with low chars and underlines are fine!)
$mod = preg_replace("/[^a-z_]/", "", $mod);
} // END - if
// Destroy cache here
- REBUILD_CACHE("mod_reg", "modreg");
+ rebuildCacheFiles("modreg", "modreg");
// And reload data
- $ret = CHECK_MODULE($mod_chk);
+ $ret = checkModulePermissions($mod_chk);
} else {
// Module not found we don't add it to the database
$ret = "404";
$GLOBALS['nav_depth'] = "0";
// Run the filter chain
- $ret = RUN_FILTER('post_youhere_line', array('access_level' => $ACC_LVL, 'type' => $type, 'content' => ""));
+ $ret = runFilterChain('post_youhere_line', array('access_level' => $ACC_LVL, 'type' => $type, 'content' => ""));
$OUT .= $ret['content'];
} // END - if
}
//* DEBUG: */ echo __LINE__.":".$MODE."/".$act."/".$wht."*<br />\n";
if (($MODE != "admin") && ($UPDATE === true)) {
// Update guest or member menu
- $SQL = SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_%s_menu` SET counter=counter+1 WHERE `action`='%s' AND `what`='%s'".$ADD." LIMIT 1",
+ $sql = SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_%s_menu` SET counter=counter+1 WHERE `action`='%s' AND `what`='%s'".$ADD." LIMIT 1",
array($MODE, $act, $wht), __FUNCTION__, __LINE__, false);
} elseif (($wht != "overview") && (!empty($wht))) {
// Other actions
- $SQL = SQL_QUERY_ESC("SELECT id, what FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE `action`='%s' AND `what`='%s'".$ADD." ORDER BY action DESC LIMIT 1",
+ $sql = SQL_QUERY_ESC("SELECT id, what FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE `action`='%s' AND `what`='%s'".$ADD." ORDER BY action DESC LIMIT 1",
array($MODE, $act, $wht), __FUNCTION__, __LINE__, false);
} else {
// Admin login overview
- $SQL = SQL_QUERY_ESC("SELECT id, what FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE `action`='%s' AND (what='' OR `what` IS NULL)".$ADD." ORDER BY action DESC LIMIT 1",
+ $sql = SQL_QUERY_ESC("SELECT id, what FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE `action`='%s' AND (what='' OR `what` IS NULL)".$ADD." ORDER BY action DESC LIMIT 1",
array($MODE, $act), __FUNCTION__, __LINE__, false);
}
// Run SQL command
- $result = SQL_QUERY($SQL, __FUNCTION__, __LINE__);
+ $result = SQL_QUERY($sql, __FUNCTION__, __LINE__);
if ($UPDATE === true) {
// Check updated/affected rows
$ret = (SQL_AFFECTEDROWS() == 1);
}
// Update module counter
-function COUNT_MODULE($mod) {
+function countModuleHit($mod) {
if ($mod != "css") {
// Do count all other modules but not accesses on CSS file css.php!
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET clicks=clicks+1 WHERE module='%s' LIMIT 1",
} elseif ((($ref == $uid) || ($ref == 0)) && (GET_EXT_VERSION("cache") >= "0.1.2")) {
// Remove cache here
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):ref={$ref} - CACHE!<br />\n";
- REBUILD_CACHE("refsystem", "refsystem");
+ rebuildCacheFiles("refsystem", "refsystem");
}
// "Walk" back here
if ($totalUsers >= getConfig('activate_xchange')) {
// Activate System
- $SQLs = array(
+ SET_SQLS(array(
"UPDATE `{!_MYSQL_PREFIX!}_mod_reg` SET `locked`='N', hidden='N', mem_only='Y' WHERE module='order' LIMIT 1",
"UPDATE `{!_MYSQL_PREFIX!}_member_menu` SET `visible`='Y', `locked`='N' WHERE `what`='order' OR `what`='unconfirmed' LIMIT 2",
"UPDATE `{!_MYSQL_PREFIX!}_config` SET activate_xchange='0' WHERE config=0 LIMIT 1"
- );
+ ));
// Run SQLs
- RUN_FILTER('run_sqls', array('dry_run' => false, 'sqls' => $SQLs));
+ runFilterChain('run_sqls');
- // Rebuild cache
- REBUILD_CACHE("config", "config");
+ // Rebuild caches
+ rebuildCacheFiles("config", "config");
+ rebuildCacheFiles("modreg", "modreg");
} // END - if
}
//
function IS_DEMO () {
return ((EXT_IS_ACTIVE("demo")) && (get_session('admin_login') == "demo"));
}
-//
-function LOAD_CONFIG ($no="0") {
- $CFG_DUMMY = array();
-
- // Check for cache extension, cache-array and if the requested configuration is in cache
- if ((is_array($GLOBALS['cache_array'])) && (isset($GLOBALS['cache_array']['config'][$no])) && (is_array($GLOBALS['cache_array']['config'][$no]))) {
- // Load config from cache
- //* DEBUG: */ echo gettype($GLOBALS['cache_array']['config'][$no])."<br />\n";
- foreach ($GLOBALS['cache_array']['config'][$no] as $key => $value) {
- $CFG_DUMMY[$key] = $value;
- } // END - foreach
-
- // Count cache hits if exists
- if ((isset($CFG_DUMMY['cache_hits'])) && (EXT_IS_ACTIVE("cache"))) {
- $CFG_DUMMY['cache_hits']++;
- } // END - if
- } elseif ((!EXT_IS_ACTIVE("cache")) || (!isset($GLOBALS['cache_array']['config'][$no]))) {
- // Load config from DB
- $result_config = SQL_QUERY_ESC("SELECT * FROM `{!_MYSQL_PREFIX!}_config` WHERE config=%d LIMIT 1",
- array(bigintval($no)), __FUNCTION__, __LINE__);
-
- // Get config from database
- $CFG_DUMMY = SQL_FETCHARRAY($result_config);
-
- // Free result
- SQL_FREERESULT($result_config);
- // Remember this config in the array
- $GLOBALS['cache_array']['config'][$no] = $CFG_DUMMY;
- }
-
- // Return config array
- return $CFG_DUMMY;
-}
// Gets the matching what name from module
function GET_WHAT ($modCheck) {
// Is the request element set?
}
}
- // Set it in $_CONFIG as well
+ // Set it in config as well
setConfigEntry($entry, $values[$idx]);
} // END - foreach
// @TODO Find a way for updating $_CONFIG here
$entries .= sprintf("=%s%s%s", $entries, $updateMode, (float)$values);
} else {
- // Set it in $_CONFIG first
+ // Set it in config first
setConfigEntry($entries, $values);
// Regular entry to update
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):entries={$entries},affectedRows={$affectedRows}<br />\n";
// Rebuild cache
- REBUILD_CACHE("config", "config");
+ rebuildCacheFiles("config", "config");
}
// Prepares an SQL statement part for HTML mail and/or holiday depency
}
// Recuced the amount of received emails for the receipients for given email
-function REDUCT_RECIPIENT_RECEIVED_MAILS ($column, $id, $count) {
+function REDUCED_RECIPIENT_RECEIVED_MAILS ($column, $id, $count) {
// Search for mail in database
$result = SQL_QUERY_ESC("SELECT `userid` FROM `{!_MYSQL_PREFIX!}_user_links` WHERE `%s`=%s ORDER BY `userid` ASC LIMIT %s",
array($column, bigintval($id), $count), __FUNCTION__, __LINE__);
SQL_FREERESULT($result);
}
+// Init SQLs array
+function INIT_SQLS () {
+ SET_SQLS(array());
+}
+
+// Checks wether the sqls array is initialized
+function IS_SQLS_INITIALIZED () {
+ return ((isset($GLOBALS['sqls'])) && (is_array($GLOBALS['sqls'])));
+}
+
+// Setter for SQLs array
+function SET_SQLS ($SQLs) {
+ $GLOBALS['sqls'] = (array) $SQLs;
+}
+
+// Getter for SQLs array
+function GET_SQLS () {
+ return $GLOBALS['sqls'];
+}
+
+// Add an SQL to the list
+function ADD_SQL ($sql) {
+ $GLOBALS['sqls'][] = (string) $sql;
+}
+
+// Setter for SQLs key
+function SET_SQL_KEY ($key, $value) {
+ $GLOBALS['sqls'][$key] = (string) $value;
+}
+
+// Counter for SQLs array
+function COUNT_SQLS () {
+ // Default is false
+ $count = false;
+
+ // Is the array there?
+ if (IS_SQLS_INITIALIZED()) {
+ // Then count it
+ $count = count($GLOBALS['sqls']);
+ } // END - if
+
+ // Return it
+ return $count;
+}
+
+// Checks wether the SQLs array is filled
+function IS_SQLS_VALID () {
+ return (
+ (IS_SQLS_INITIALIZED()) &&
+ (COUNT_SQLS() > 0)
+ );
+}
+
// [EOF]
?>