inc/extensions/ext-wernis.php -text
inc/extensions/ext-yoomedia.php -text
inc/fatal_errors.php -text
+inc/filters.php -text
inc/footer.php -text
inc/functions.php -text
inc/gen_mediadata.php -text
inc/libs/country_functions.php -text
inc/libs/debug_functions.php -text
inc/libs/doubler_functions.php -text
+inc/libs/events_functions.php -text
inc/libs/holiday_functions.php -text
inc/libs/html_mail_functions.php -text
inc/libs/mediadata_functions.php -text
inc/libs/sponsor_functions.php -text
inc/libs/surfbar_functions.php -text
inc/libs/task_functions.php -text
+inc/libs/theme_functions.php -text
inc/libs/transfer_functions.php -text
inc/libs/user_functions.php -text
inc/libs/wernis_functions.php -text
inc/sql_error.php -text
inc/stats_bonus.php -text
inc/stylesheet.php -text
+inc/theme-dummy.php -text
inc/theme-manager.php -text
inc/weekly/.htaccess -text
inc/weekly/weekly_ -text
$status = "failed";
// Check if account was found
- if ((SQL_NUMROWS($result) == 1) && ($result != false)) {
+ if (SQL_NUMROWS($result) == 1) {
// Found an ID so we simply set it
list($uid, $clicks, $ref_payout, $status, $last) = SQL_FETCHROW($result);
// Check expired rallyes (hard-coded 3 days limit for displaying expired rallyes!)
require_once(PATH."inc/libs/rallye_functions.php");
RALLYE_DELETE_EXPIRED_RALLYES();
-}
+} // END - if
//
?>
define('SERVER_URL', "http://www.mxchange.org");
// Current SVN revision
-define('CURR_SVN_REVISION', "634");
+define('CURR_SVN_REVISION', "635");
// Take a prime number which is long (if you know a longer one please try it out!)
define('_PRIME', 591623);
// Is the extension already loaded?
//* DEBUG: */ echo "Loading extension {$ext_name}.<br />\n";
- if (isset($EXT_LOADED[$ext_name])) {
+ if ((isset($EXT_LOADED[$ext_name])) && (empty($EXT_LOAD_MODE))) {
// Debug message
DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Extension %s already loaded.", $ext_name));
return false;
- }
+ } // END - if
// Construct FQFN for extension file
$extInclude = sprintf("%sinc/extensions/ext-%s.php", PATH, $ext_name);
} // END - foreach
// Remove cache file(s) if extension is active
- if ((EXT_IS_ACTIVE("cache")) || (GET_EXT_VERSION("cache") != "")) {
- //* DEBUG: */ echo __LINE__.": DESTROY!<br />\n";
- // Remove cache files
- if ($cacheInstance->loadCacheFile("extensions", true)) $cacheInstance->destroyCacheFile();
- if ($cacheInstance->loadCacheFile("mod_reg")) $cacheInstance->destroyCacheFile();
- if ($cacheInstance->loadCacheFile("config")) $cacheInstance->destroyCacheFile();
- } // END - if
+ RUN_FILTER('post_extension_installed', $ext_name);
// Check for added include files
if (count($INC_POOL > 0)) {
// Remove cache file(s) if extension is active
if (((EXT_IS_ACTIVE("cache")) || (GET_EXT_VERSION("cache") != "")) && (((SQL_AFFECTEDROWS() == 1)) || ($sqlRan === true) || ($EXT_LOAD_MODE == "activate") || ($EXT_LOAD_MODE == "deactivate"))) {
- //* DEBUG: */ echo __LINE__.": DESTROY!<br />\n";
- // Remove cache files
- if ($cacheInstance->loadCacheFile("extensions", true)) $cacheInstance->destroyCacheFile();
- if ($cacheInstance->loadCacheFile("mod_reg")) $cacheInstance->destroyCacheFile();
- if ($cacheInstance->loadCacheFile("config")) $cacheInstance->destroyCacheFile();
+ // Run filters
+ RUN_FILTER('post_extension_run_sql', $ext_name);
// @TODO This causes the whole (!) menu cache being purged
CACHE_PURGE_ADMIN_MENU();
// Update extension's version
$result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_extensions SET ext_version='%s' WHERE ext_name='%s' LIMIT 1",
- array($EXT_VERSION, $ext), __FILE__, __LINE__);
-
- // Update cache
- if (EXT_IS_ACTIVE("cache")) {
- if ($cacheInstance->loadCacheFile("extensions", true)) $cacheInstance->destroyCacheFile();
- if ($cacheInstance->loadCacheFile("config")) $cacheInstance->destroyCacheFile();
- if ($cacheInstance->loadCacheFile("mod_reg")) $cacheInstance->destroyCacheFile();
- } // END - if
+ array($EXT_VERSION, $ext), __FILE__, __LINE__);
// Remove array
unset($SQLs);
+
+ // Run filters on success extension update
+ RUN_FILTER('extension_update', $ext);
} else {
// In "dry-run" mode return array with SQL commands
return $SQLs;
}
// Output verbose SQL table for extension
-function EXTENSION_VERBOSE_TABLE($SQLs, $title = ADMIN_SQLS_EXECUTED_ON_REMOVAL, $dashed = "", $switch = false, $WIDTH = "480") {
+function EXTENSION_VERBOSE_TABLE ($SQLs, $title = ADMIN_SQLS_EXECUTED_ON_REMOVAL, $dashed = "", $switch = false, $width = "480") {
global $_CONFIG;
$S = false; $SW = 2; $i = 1;
$OUT = "";
if ((is_array($SQLs)) && (GET_EXT_VERSION("sql_patches") >= "0.0.7") && ($_CONFIG['verbose_sql'] == "Y")) {
$OUT = "<DIV align=\"center\">
-<TABLE border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"".$WIDTH."\" align=\"center\"".$dashed.">
+<TABLE border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"".$width."\" align=\"center\"".$dashed.">
<TR>
<TD colspan=\"2\" align=\"center\" class=\"admin_title bottom2\" height=\"24\">
<STRONG>".$title.":</STRONG>
} elseif (!EXT_IS_ACTIVE("cache")) {
// Load from database
$result = SQL_QUERY_ESC("SELECT ext_name FROM "._MYSQL_PREFIX."_extensions WHERE id=%s LIMIT 1",
- array(bigintval($id)), __FILE__, __LINE__);
+ array(bigintval($id)), __FILE__, __LINE__);
list($ret) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
}
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
break;
}
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
break;
}
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
break;
}
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
break;
}
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
break;
}
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
// Do we have a daily-reset-run?
if (isBooleanConstantAndTrue('__DAILY_RESET') && (!DEBUG_MODE) && ($CSS != 1))
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
break;
}
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
// Remove old entries
$OLD = $_CONFIG['beg_timeout'];
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
if ((isBooleanConstantAndTrue('__DAILY_RESET')) && ($_CONFIG['birthday_points'] > 0)) {
// Daily reset was run and we shall pay points so we start checking for members who
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
if (isBooleanConstantAndTrue('__DAILY_RESET') && (!DEBUG_MODE) && ($CSS != 1)) {
// Daily reset was run so let's check if active rallye is activated
break;
}
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
break;
}
}
// Version number
-$EXT_VERSION = "0.2.0";
+$EXT_VERSION = "0.2.1";
// 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", "0.2.0");
+$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", "0.2.1");
switch ($EXT_LOAD_MODE)
{
case "remove": // Do stuff when removing extension
// SQL commands to run
$SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_admin_menu` WHERE what='config_cache' OR what='cache_stats' LIMIT 2";
+
+ // Unregister all filters
+ UNREGISTER_FILTER('extension_update', 'CACHE_DESTROY_ON_EXT_CHANGE');
+ UNREGISTER_FILTER('post_extension_installed', 'CACHE_DESTROY_ON_EXT_CHANGE');
+ UNREGISTER_FILTER('post_extension_run_sql', 'CACHE_DESTROY_ON_EXT_CHANGE');
+ UNREGISTER_FILTER('post_admin_added', 'CACHE_DESTROY_ON_ADMIN_CHANGE');
+ UNREGISTER_FILTER('post_admin_edited', 'CACHE_DESTROY_ON_ADMIN_CHANGE');
+ UNREGISTER_FILTER('post_admin_deleted', 'CACHE_DESTROY_ON_ADMIN_CHANGE');
+ UNREGISTER_FILTER('post_admin_reset_pass', 'CACHE_DESTROY_ON_ADMIN_CHANGE');
break;
case "activate": // Do stuff when admin activates this extension
// Update notes (these will be set as task text!)
$UPDATE_NOTES = "Die Erweiterung hängt nun von der <strong>sql_patches</strong> ab.";
break;
+
+ case "0.2.1": // SQL queries for v0.2.1
+ // Register the new filter
+ REGISTER_FILTER('extension_update', 'CACHE_DESTROY_ON_EXT_CHANGE');
+ REGISTER_FILTER('post_extension_installed', 'CACHE_DESTROY_ON_EXT_CHANGE');
+ REGISTER_FILTER('post_extension_run_sql', 'CACHE_DESTROY_ON_EXT_CHANGE');
+ REGISTER_FILTER('post_admin_added', 'CACHE_DESTROY_ON_ADMIN_CHANGE');
+ REGISTER_FILTER('post_admin_edited', 'CACHE_DESTROY_ON_ADMIN_CHANGE');
+ REGISTER_FILTER('post_admin_deleted', 'CACHE_DESTROY_ON_ADMIN_CHANGE');
+ REGISTER_FILTER('post_admin_reset_pass', 'CACHE_DESTROY_ON_ADMIN_CHANGE');
+
+ // Update notes (these will be set as task text!)
+ $UPDATE_NOTES = "Filter hinzugefügt für Erweiterungsmanagement.";
+ break;
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
// Create instance on class
if ($cacheMode != "init") {
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
break;
}
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
break;
}
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
break;
}
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
if ((isBooleanConstantAndTrue('__DAILY_RESET')) && ($_CONFIG['doubler_send_mode'] == "RESET")) {
// So let's check for points
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
break;
}
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
break;
}
}
break;
-default: // Do stuff when extension is loaded
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+default: // Do stuff when extension is loaded
// Define all arrary variables as global!
global $HTML_TAGS, $URL_ENDS, $VALID_EMAI_CHARS;
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
break;
}
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
break;
}
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
break;
}
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
break;
}
-if ((isset($dry_run)) && (isset($EXT_LOAD_MODE)))
-{
- if ((!$dry_run) && ($EXT_LOAD_MODE == "update") && ($EXT_VER == "0.0.4"))
- {
+if ((isset($dry_run)) && (isset($EXT_LOAD_MODE))) {
+ if ((!$dry_run) && ($EXT_LOAD_MODE == "update") && ($EXT_VER == "0.0.4")) {
// Add auto-check file
$INC_POOL[] = sprintf("%sinc/gen_mediadata.php", PATH);
- }
-}
+ } // END - if
+} // END - if
// Keep this extension always active!
$EXT_ALWAYS_ACTIVE = "Y";
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
break;
}
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
break;
}
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
// URL ends which are used to indentify the end of an URL or email link
// Don't use these chars in links... ;-)
'2','3','4','5','6','7','8','9'
);
- if (isBooleanConstantAndTrue('__DAILY_RESET') && (!DEBUG_MODE) && ($CSS != 1))
- {
+ if (isBooleanConstantAndTrue('__DAILY_RESET') && (!DEBUG_MODE) && ($CSS != 1)) {
// Daily reset was run so let's check out for expired newsletter orders
$INC_POOL[] = sprintf("%sinc/monthly/monthly_newsletter.php", PATH);
}
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
// @TODO|@DEPRECATED Please rewrite these constants, LOAD_CONFIG() is no more needed in extensions
$dummy = LOAD_CONFIG();
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
break;
}
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
break;
}
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
// Do daily reset only when installed and extension version is at least 0.1.1
- if ((isBooleanConstantAndTrue('__DAILY_RESET')) && (isBooleanConstantAndTrue('mxchange_installed')) && (isBooleanConstantAndTrue('mxchange_installed')) && (isBooleanConstantAndTrue('admin_registered')) && (GET_EXT_VERSION("order") >= "0.1.1"))
- {
+ if ((isBooleanConstantAndTrue('__DAILY_RESET')) && (isBooleanConstantAndTrue('mxchange_installed')) && (isBooleanConstantAndTrue('mxchange_installed')) && (isBooleanConstantAndTrue('admin_registered')) && (GET_EXT_VERSION("order") >= "0.1.1")) {
// Reset mail order values
$result_ext = SQL_QUERY("UPDATE `"._MYSQL_PREFIX."_user_data` SET mail_orders=0 WHERE mail_orders > 0", __FILE__, __LINE__);
}
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
break;
}
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
break;
}
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
break;
}
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
// Do we have a daily-reset-run?
- if (isBooleanConstantAndTrue('__DAILY_RESET') && (!DEBUG_MODE) && ($CSS != 1))
- {
+ if (isBooleanConstantAndTrue('__DAILY_RESET') && (!DEBUG_MODE) && ($CSS != 1)) {
// So let's check for profiles which needs an update
$INC_POOL[] = sprintf("%sinc/profile-updte.php", PATH);
}
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
// Do stuff only when not in CSS mode
if (($CSS != "1") && ($CSS != "-1") && ($cacheMode != "init")) {
FROM "._MYSQL_PREFIX."_rallye_data AS d
WHERE d.is_active='Y' AND d.notified='Y' AND d.expired='N' AND (d.end_time <= UNIX_TIMESTAMP()".$OR.")
LIMIT 1", __FILE__, __LINE__);
- if ((SQL_NUMROWS($result) == 1) && (EXT_IS_ACTIVE("autopurge")))
- {
+ if ((SQL_NUMROWS($result) == 1) && (EXT_IS_ACTIVE("autopurge"))) {
// End rallye here...
RALLYE_EXPIRE_RALLYES($result);
- }
+ } // END - if
// Free memory
SQL_FREERESULT($result);
- }
+ } // END - if
break;
}
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
// When the refback is not installed we cannot load it's configuration... *sigh*
break;
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
break;
}
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
break;
}
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
break;
}
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
// Check if mod_rewrite is loadeded
if (!IF_APACHE_MODULE_LOADED('mod_rewrite')){
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
break;
}
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
break;
}
}
// Version number
-$EXT_VERSION = "0.5.8";
+$EXT_VERSION = "0.5.9";
// Auto-set extension version
if (!isset($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", "0.2.0", "0.2.1", "0.2.2", "0.2.3", "0.2.4", "0.2.5", "0.2.6", "0.2.7", "0.2.8", "0.2.9", "0.3.0", "0.3.1", "0.3.2", "0.3.3", "0.3.4", "0.3.5", "0.3.6", "0.3.7", "0.3.8", "0.3.9", "0.4.0", "0.4.1", "0.4.2", "0.4.3", "0.4.4", "0.4.5", "0.4.6", "0.4.7", "0.4.8", "0.4.9", "0.5.0", "0.5.1", "0.5.2", "0.5.3", "0.5.4", "0.5.5", "0.5.6", "0.5.7", "0.5.8");
+$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", "0.2.1", "0.2.2", "0.2.3", "0.2.4", "0.2.5", "0.2.6", "0.2.7", "0.2.8", "0.2.9", "0.3.0", "0.3.1", "0.3.2", "0.3.3", "0.3.4", "0.3.5", "0.3.6", "0.3.7", "0.3.8", "0.3.9", "0.4.0", "0.4.1", "0.4.2", "0.4.3", "0.4.4", "0.4.5", "0.4.6", "0.4.7", "0.4.8", "0.4.9", "0.5.0", "0.5.1", "0.5.2", "0.5.3", "0.5.4", "0.5.5", "0.5.6", "0.5.7", "0.5.8", "0.5.9");
switch ($EXT_LOAD_MODE)
{
case "remove": // Do stuff when removing extension
// Drop tables
- $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_themes";
$SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_admin_menu_las";
$SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_admin_menu_las_data";
$SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_admin_menu_stats";
$SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_user_stats_data`";
$SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_user_book`";
+ $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_filters`";
// Delete admin menu entries
$SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_admin_menu` WHERE
-`what`='theme_import' OR
-`what`='theme_edit' OR
`what`='config_extensions' OR
`what`='config_home' OR
`what`='list_unconfirmed' OR
`what`='config_admin' OR
`what`='config_proxy' OR
`what`='config_session' OR
-LIMIT 13";
-
- // Delete guest menu entries
- $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_guest_menu` WHERE action='themes' LIMIT 1";
+`what`='list_filter'
+LIMIT 10";
// Delete/update member menu entries
$SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_member_menu` WHERE
-action='themes' OR
-`what`='themes' OR
`what`='stats2' OR
`what`='reflist' OR
(action='stats' AND (`what`='' OR what IS NULL)) OR
action='account'";
// Drop indexes
- $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_extensions DROP UNIQUE KEY (ext_name)";
- $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_admins DROP UNIQUE KEY (login)";
- $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` DROP INDEX (status)";
- $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_refbanner DROP INDEX (visible)";
- $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_refdepths DROP UNIQUE KEY (level)";
- $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_refsystem DROP INDEX (level)";
- $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_pool DROP INDEX (data_type)";
- $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_mod_reg DROP UNIQUE KEY (module)";
- $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_admin_menu` DROP INDEX (action)";
- $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_admin_menu` DROP INDEX (what)";
- $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system DROP INDEX (task_type)";
- $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system DROP INDEX (status)";
- $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system DROP INDEX (task_created)";
- $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system DROP FULLTEXT (subject)";
- $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system DROP INDEX (subject)";
- $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_extensions DROP INDEX (ext_active)";
- $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` DROP INDEX (status)";
- $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` DROP FULLTEXT (family)";
- $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` DROP INDEX (max_mails)";
- $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` DROP INDEX (password)";
- $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_guest_menu` DROP INDEX (action)";
- $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_guest_menu` DROP INDEX (what)";
- $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_guest_menu` DROP INDEX (sort)";
- $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_guest_menu` DROP INDEX (visible)";
- $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_guest_menu` DROP INDEX (locked)";
- $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_member_menu` DROP INDEX (what)";
- $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_member_menu` DROP INDEX (sort)";
- $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_member_menu` DROP INDEX (visible)";
- $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_member_menu` DROP INDEX (locked)";
- $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_cats DROP INDEX (visible)";
- $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_cats DROP INDEX (sort)";
+ $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_extensions DROP UNIQUE KEY `ext_name`";
+ $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_admins DROP UNIQUE KEY `login`";
+ $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` DROP INDEX `status`";
+ $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_refbanner DROP INDEX `visible`";
+ $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_refdepths DROP UNIQUE KEY `level`";
+ $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_refsystem DROP INDEX `level`";
+ $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_pool DROP INDEX `data_type`";
+ $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_mod_reg DROP UNIQUE KEY `module`";
+ $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_admin_menu` DROP INDEX `action`";
+ $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_admin_menu` DROP INDEX `what`";
+ $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system DROP INDEX `task_type`";
+ $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system DROP INDEX `status`";
+ $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system DROP INDEX `task_created`";
+ $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system DROP FULLTEXT `subject`";
+ $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_task_system DROP INDEX `subject`";
+ $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_extensions DROP INDEX `ext_active`";
+ $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` DROP INDEX `status`";
+ $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` DROP FULLTEXT `family`";
+ $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` DROP INDEX `max_mails`";
+ $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` DROP INDEX `password`";
+ $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_guest_menu` DROP INDEX `action`";
+ $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_guest_menu` DROP INDEX `what`";
+ $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_guest_menu` DROP INDEX `sort`";
+ $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_guest_menu` DROP INDEX `visible`";
+ $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_guest_menu` DROP INDEX `locked`";
+ $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_member_menu` DROP INDEX `what`";
+ $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_member_menu` DROP INDEX `sort`";
+ $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_member_menu` DROP INDEX `visible`";
+ $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_member_menu` DROP INDEX `locked`";
+ $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_cats DROP INDEX `visible`";
+ $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_cats DROP INDEX `sort`";
break;
case "activate": // Do stuff when admin activates this extension
break;
case "0.1.4": // SQL queries for v0.1.4
- $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD default_theme VARCHAR(255) NOT NULL DEFAULT '".GET_CURR_THEME()."'";
- $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_admin_menu` WHERE action='theme' LIMIT 3";
- $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('theme', NULL, 'Themes','Verwalten Sie hier alle Designs (Themes) Ihres Mailtausch-Scriptes.', 8)";
- $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('theme','theme_import','Importieren','Es wird das Verzeichnis "theme" nach neuen Ordnern durchsucht und anschliessend in die Datenbank gesperrt aufgenommen.', 1)";
- $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('theme','theme_edit','Modifizieren','Ändern Sie Titel, Freigaben usw. an den Themes. Sie können bis auf das Standart-Theme "default" auch Themes aus der Datenbank entfernen. Vorher sollten Sie es jedoch vom Server löschen, damit es niht erneut importiert werden kann.', 2)";
- $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_guest_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('themes',NULL,'Design-Auswahl',4,'Y','N')";
- $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('themes',NULL,'Design-Auswahl',3,'Y','N')";
- $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_themes";
- $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_themes (
-id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
-theme_path VARCHAR(255) NOT NULL DEFAULT '',
-theme_active ENUM('Y','N') NOT NULL DEFAULT 'N',
-theme_ver VARCHAR(255) NOT NULL DEFAULT '0.0',
-PRIMARY KEY(id)
-) TYPE=MyISAM";
-
// Update notes (these will be set as task text!)
- $UPDATE_NOTES = "Theme-Support integriert. Bitte laden Sie sich zu dieser Version das <A href=\"http://www.mxchange.org\">281-Patch</A> (wenn Ihr Script v0.2.0-pre7 ist) herunter, da ansonsten die Themes nicht klappen werden!";
+ $UPDATE_NOTES = "Ungültiges Update (nach ext-theme.php verschoben!).";
break;
case "0.1.5": // SQL queries for v0.1.5
break;
case "0.2.7": // SQL queries for v0.2.7
- $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('main','themes','Designs', 6,'Y','N')";
- $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` ADD curr_theme VARCHAR(255) NOT NULL DEFAULT 'default'";
$SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD stats_limit BIGINT(20) UNSIGNED NOT NULL DEFAULT 10";
$SQLs[] = "UPDATE `"._MYSQL_PREFIX."_admin_menu` SET `what`='config_stats' WHERE `what`='stats' LIMIT 1";
case "0.3.1": // SQL queries for v0.3.1
$SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_extensions ADD UNIQUE KEY (ext_name)";
- $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_themes ADD UNIQUE KEY (theme_path)";
- $SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_themes ADD INDEX (theme_active)";
$SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_admins ADD UNIQUE KEY (login)";
$SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` ADD INDEX (status)";
$SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_refbanner ADD INDEX (visible)";
$SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('extras',NULL,'Extras',5,'Y','N')";
$SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('rals',NULL,'Rallyes',6,'Y','N')";
$SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('account',NULL,'Ihr Account',7,'Y','N')";
- $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET sort='8' WHERE action='themes' LIMIT 1";
$SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET action='stats', sort='1', title='Klick-Mails' WHERE `what`='stats' LIMIT 1";
- $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET action='account', sort='1', title='Designs' WHERE `what`='themes' LIMIT 1";
$SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET action='extras', sort='3' WHERE `what`='reflinks' LIMIT 1";
// Update notes (these will be set as task text!)
// Update notes (these will be set as task text!)
$UPDATE_NOTES = "Sprachdateinamen werden nicht mehr in der Datenbank behalten.";
break;
+
+ case "0.5.9": // SQL queries for v0.5.9
+ $SQLs[] = "DROP TABLE IF EXISTS `"._MYSQL_PREFIX."_filters`";
+ $SQLs[] = "CREATE TABLE `"._MYSQL_PREFIX."_filters` (
+`filter_id` BIGINT(20) UNSIGNED AUTO_INCREMENT,
+`filter_name` VARCHAR(255) NOT NULL DEFAULT '',
+`filter_function` VARCHAR(255) NOT NULL DEFAULT '',
+`filter_active` ENUM('N','Y') NOT NULL DEFAULT 'Y',
+PRIMARY KEY (`filter_id`)
+) TYPE=MyISAM COMMENT='Filter system'";
+ $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('setup','list_filter','Filter-Management', 'Zeigt alle im System registrierten Filter an und lässt diese de- bzw. wieder aktivieren.', 17)";
+
+ // Update notes (these will be set as task text!)
+ $UPDATE_NOTES = "Tabellen für Filter-System hinzugefügt.";
+ break;
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
// When the sql_patches is not installed we cannot load it's configuration... *sigh*
if (GET_EXT_VERSION("sql_patches") != '') {
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
break;
}
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
// Set some constants we need???
define('edit', "edit");
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
break;
}
}
// Version number
-$EXT_VERSION = "0.0.7";
+$EXT_VERSION = "0.0.8";
// 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");
+$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");
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 ('theme','theme_check','Prüfen','Nach neuen Themes suchen bzw. nach Updates zu den Themes suchen.', 3)";
break;
case "remove": // Do stuff when removing extension
- // SQL commands to run
- $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_admin_menu` WHERE what='theme_check' LIMIT 1";
+ // Drop theme table
+ $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_themes";
+
+ // Delete admin menu
+ $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_admin_menu` WHERE `action`='theme' LIMIT 4";
+
+ // Delete guest menu entries
+ $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_guest_menu` WHERE action='themes' LIMIT 1";
+
+ // Delete/update member menu entries
+ $SQLs[] = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_member_menu` WHERE action='themes' OR `what`='themes' LIMIT 2";
break;
case "activate": // Do stuff when admin activates this extension
// Update notes (these will be set as task text!)
$UPDATE_NOTES = "Designname (von Menschen lesbar) hinzugefügt.";
break;
+
+ case "0.0.8": // SQL queries for v0.0.8
+ // Theme table
+ $SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_themes";
+ $SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_themes (
+id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+theme_path VARCHAR(255) NOT NULL DEFAULT '',
+theme_active ENUM('Y','N') NOT NULL DEFAULT 'N',
+theme_ver VARCHAR(255) NOT NULL DEFAULT '0.0',
+PRIMARY KEY(`id`),
+UNIQUE KEY(`theme_path`),
+INDEX(`theme_active`),
+) TYPE=MyISAM";
+
+ // Admin menu
+ $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('theme', NULL, 'Themes','Verwalten Sie hier alle Designs (Themes) Ihres Mailtausch-Scriptes.', 8)";
+ $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('theme','theme_import','Importieren','Es wird das Verzeichnis "theme" nach neuen Ordnern durchsucht und anschliessend in die Datenbank gesperrt aufgenommen.', 1)";
+ $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('theme','theme_edit','Modifizieren','Ändern Sie Titel, Freigaben usw. an den Themes. Sie können bis auf das Standart-Theme "default" auch Themes aus der Datenbank entfernen. Vorher sollten Sie es jedoch vom Server löschen, damit es niht erneut importiert werden kann.', 2)";
+ $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('theme','theme_check','Prüfen','Nach neuen Themes suchen bzw. nach Updates zu den Themes suchen.', 3)";
+
+ // Guest menu
+ $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_guest_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('themes',NULL,'Design-Auswahl',4,'Y','N')";
+
+ // Memember menu
+ $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('themes',NULL,'Design-Auswahl',3,'Y','N')";
+ $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('main','themes','Designs', 6,'Y','N')";
+ $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET sort='8' WHERE action='themes' LIMIT 1";
+ $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET action='account', sort='1', title='Designs' WHERE `what`='themes' LIMIT 1";
+
+ // User data
+ $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` ADD curr_theme VARCHAR(255) NOT NULL DEFAULT 'default'";
+
+ // Update notes (these will be set as task text!)
+ $UPDATE_NOTES = "Update von <u>sql_patches</u> übertragen. (Kann Fehlermeldungen verursacht haben!)";
+ break;
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
break;
}
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
break;
}
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
if ((isBooleanConstantAndTrue('__DAILY_RESET')) && ($_CONFIG['ap_transfer'] == "Y")) {
// Automatically remove outdated or not displayed transactions
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
break;
}
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
+ // Init array
+ global $WERNIS;
+ $WERNIS = array();
break;
}
-// Init array
-global $WERNIS;
-$WERNIS = array();
-
//
?>
}
break;
+case "test": // For testing purposes. For details see file inc/modules/admin/what-extensions.php, arround line 305.
+ break;
+
default: // Do stuff when extension is loaded
// The translation table
$yoomediaTranslationTable = array(
--- /dev/null
+<?php
+/************************************************************************
+ * MXChange v0.2.1 Start: 12/16/2008 *
+ * =============== Last change: 12/16/2008 *
+ * *
+ * -------------------------------------------------------------------- *
+ * File : filters.php *
+ * -------------------------------------------------------------------- *
+ * Short description : Functions for filter system *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung : Funktionen fuer Filter-System *
+ * -------------------------------------------------------------------- *
+ * *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2008 by Roland Haeder *
+ * For more information visit: http://www.mxchange.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ************************************************************************/
+
+// Some security stuff...
+if (!defined('__SECURITY')) {
+ $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4)."/security.php";
+ require($INC);
+}
+
+// Init "generic filter system"
+function INIT_FILTER_SYSTEM() {
+ global $filters, $loadedFilters;
+
+ // Is the filter already initialized?
+ if ((isset($filters)) && (is_array($filters))) {
+ // Then abort here
+ ADD_FATAL(FILTER_FAILED_ALREADY_INIT);
+ return false;
+ } // END - if
+
+ // Init the filter system (just some ideas)
+ $filters = array(
+ // Filters for pre-init phase
+ 'preinit' => array(),
+ // Filters for post-init phase
+ 'postinit' => array(),
+ // Filters for shutdown phase
+ 'shutdown' => array()
+ );
+
+ // Init loaded filters
+ $loadedFilters = array();
+
+ // Load all saved filers if sql_patches is updated
+ if (GET_EXT_VERSION("sql_patches") >= "0.5.9") {
+ // Load all active filers
+ $result = SQL_QUERY("SELECT `filter_name`, `filter_function`, `filter_active`
+FROM `"._MYSQL_PREFIX."_filters`
+ORDER BY `filter_id` ASC", __FILE__, __LINE__);
+
+ // Are there entries?
+ if (SQL_NUMROWS($result) > 0) {
+ // Load all filters
+ while ($filterArray = SQL_FETCHARRAY($result)) {
+ // Mark this filter as loaded (from database)
+ $loadedFilters[$filterArray['filter_name']][$filterArray['filter_function']] = true;
+
+ // Set this filter
+ $filters[$filterArray['filter_name']][$filterArray['filter_function']] = $filterArray['filter_active'];
+ } // END - while
+ } // END - if
+
+ // Free result
+ SQL_FREERESULT($result);
+ } // END - if
+
+ // @TODO Find some more init/shutdown filter functions
+
+ // Register shutdown filters
+ REGISTER_FILTER('shutdown', 'FLUSH_FILTERS');
+ REGISTER_FILTER('shutdown', 'SHUTDOWN_DATABASE');
+}
+
+// "Registers" a new filter function
+function REGISTER_FILTER ($filterName, $filterFunction, $silentAbort = true) {
+ global $filters;
+
+ // Extend the filter function name
+ $filterFunction = sprintf("FILTER_%s", strtoupper($filterFunction));
+
+ // Is that filter already there?
+ if (isset($filters[$filterName][$filterFunction])) {
+ // Then abort here
+ if (!$silentAbort) {
+ ADD_FATAL(sprintf(FILTER_FAILED_ALREADY_ADDED, $filterFunction, $filterName));
+ } // END - if
+
+ // Abort here
+ return false;
+ } // END - if
+
+ // Is the function there?
+ if (!function_exists($filterFunction)) {
+ // Then abort here
+ ADD_FATAL(sprintf(FILTER_FAILED_NOT_FOUND, $filterFunction, $filterName));
+ return false;
+ } // END - if
+
+ // Simply add it to the array
+ $filters[$filterName][$filterFunction] = "Y";
+}
+
+// "Unregisters" a filter from the given chain
+function UNREGISTER_FILTER ($filterName, $filterFunction) {
+ global $filters;
+
+ // Is that filter there?
+ if (!isset($filters[$filterName][$filterFunction])) {
+ // Not found, so abort here
+ ADD_FATAL(sprintf(FILTER_FAILED_NOT_REMOVED, $filterFunction, $filterName));
+ return false;
+ } // END - if
+
+ // Mark for filter removal
+ $filters[$filterName][$filterFunction] = "R";
+}
+
+// "Runs" the given filters, data is optional and can be any type of data
+function RUN_FILTER ($filterName, $data = null, $silentAbort = true) {
+ global $filters;
+
+ // Is that filter chain there?
+ if (!isset($filters[$filterName])) {
+ // Then abort here (quick'N'dirty hack)
+ if ((!$silentAbort) && (defined('FILTER_FAILED_NO_FILTER_FOUND'))) {
+ ADD_FATAL(sprintf(FILTER_FAILED_NO_FILTER_FOUND, $filterName));
+ } // END - if
+
+ // Abort here
+ return false;
+ } // END - if
+
+ // Default return value
+ $returnValue = $data;
+
+ // Then run all filters
+ foreach ($filters[$filterName] as $filterFunction=>$active) {
+ // Debug message
+ /* DEBUG: */ echo __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): name={$filterName}, func={$filterFunction}, active={$active}<br />\n";
+
+ // Is the filter active?
+ if ($active == "Y") {
+ // Call the filter chain
+ $returnValue = call_user_func_array($filterFunction, array($returnValue));
+ } // END - if
+ } // END - foreach
+
+ // Return the filtered content
+ return $returnValue;
+}
+
+// -----------------------------------------------------------------------------
+// Generic filter functions we always need
+// -----------------------------------------------------------------------------
+
+// Filter for flushing all new filters to the database
+function FILTER_FLUSH_FILTERS () {
+ global $filters, $link, $loadedFilters;
+
+ // Is a database link here and not in installation mode?
+ if ((!is_resource($link)) && (!isBooleanConstantAndTrue('mxchange_installing'))) {
+ // Abort here
+ ADD_FATAL(sprintf(FILTER_FLUSH_FAILED_NO_DATABASE, $filterFunction, $filterName));
+ return false;
+ } // END - if
+
+ // Is the extension sql_patches updated?
+ if (EXT_VERSION_IS_OLDER("sql_patches", "0.5.9")) {
+ // Abort silently here
+ return false;
+ } // END - if
+
+ // Nothing is added/remove by default
+ $inserted = 0; $removed = 0;
+
+ // Prepare SQL queries
+ $insertSQL = "INSERT INTO `"._MYSQL_PREFIX."_filters` (`filter_name`,`filter_function`,`filter_active`) VALUES";
+ $removeSQL = "DELETE LOW_PRIORITY FROM `"._MYSQL_PREFIX."_filters` WHERE";
+
+ // Write all filters to database
+ foreach ($filters as $filterName => $filterArray) {
+ // Walk through all filters
+ foreach ($filterArray as $filterFunction => $active) {
+ // Is this filter loaded?
+ if (!isset($loadedFilters[$filterName][$filterFunction])) {
+ // Add this filter (all filters are active by default)
+ $insertSQL .= sprintf("('%s','%s','Y'),", $filterName, $filterFunction);
+ $inserted++;
+ } elseif ($active == "R") {
+ // Remove this filter
+ $removeSQL .= sprintf(" (`filter_name`='%s' AND `filter_function`='%s') OR", $filterName, $filterFunction);
+ $removed++;
+ }
+ } // END - foreach
+ } // END - foreach
+
+ // Something has been added?
+ if ($inserted > 0) {
+ // Finish SQL command
+ $insertSQL = substr($insertSQL, 0, -1);
+
+ // And run it
+ SQL_QUERY($insertSQL, __FILE__, __LINE__);
+ } // END - if
+
+ // Something has been removed?
+ if ($removed > 0) {
+ // Finish SQL command
+ $removeSQL = substr($removeSQL, 0, -2) . "LIMIT ".$removed;
+
+ // And run it
+ SQL_QUERY($removeSQL, __FILE__, __LINE__);
+ } // END - if
+}
+
+// Filter for shutting down the database link
+function FILTER_SHUTDOWN_DATABASE () {
+ global $link;
+
+ if (is_resource($link)) {
+ // Close link
+ SQL_CLOSE($link, __FILE__, __LINE__);
+ } else {
+ // No database link
+ ADD_FATAL(NO_DB_LINK);
+ }
+}
+
+//
+?>
// And the last closing HTML tag
OUTPUT_HTML("</html>");
+} // END - if
- // Footer has been reached
- $footer = 1;
-
- // Output HTML code
- OUTPUT_HTML("");
-
- if (is_resource($link)) {
- // Close link
- SQL_CLOSE($link, __FILE__, __LINE__);
- } else {
- // No database link
- ADD_FATAL(NO_DB_LINK);
- }
-} elseif ($CSS == "1") {
- // Footer has been reached
- $footer = 1;
+// Footer has been reached
+$footer = 1;
- // Output CSS content
- OUTPUT_HTML("");
-}
+// Output HTML code
+OUTPUT_HTML("");
//
?>
}
// Check if our config file is writeable or not
-function is_INCWritable($inc) {
+function IS_INC_WRITEABLE($inc) {
// Generate FQFN
$fqfn = sprintf("%sinc/%s.php", PATH, $inc);
} // END - if
// Load user's data
- //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):UID={$UID},template={$template}<br />\n";
- if ($UID > 0) {
+ //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):UID={$UID},template={$template},content[]=".gettype($content)."<br />\n";
+ if (($UID > 0) && (is_array($content))) {
+ // If nickname extension is installed, fetch nickname as well
if (EXT_IS_ACTIVE("nickname")) {
//* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):NICKNAME!<br />\n";
// Load nickname
array(bigintval($UID)), __FILE__, __LINE__);
}
- // Is content an array?
- //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):content[]=".gettype($content)."<br />\n";
- if (is_array($content)) {
- // Fetch and migrate data
- //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):content()=".count($content)." - PRE<br />\n";
- $content = array_merge($content, SQL_FETCHARRAY($result));
- //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):content()=".count($content)." - AFTER<br />\n";
- } // END - if
+ // Fetch and merge data
+ //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):content()=".count($content)." - PRE<br />\n";
+ $content = array_merge($content, SQL_FETCHARRAY($result));
+ //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):content()=".count($content)." - AFTER<br />\n";
// Free result
SQL_FREERESULT($result);
if (isset($content['gender'])) $content['gender'] = TRANSLATE_GENDER($content['gender']);
// Overwrite email from data if present
- if (isset($content['email'])) $email = $content['email'];
+ if (isset($content['email'])) $email = $content['email'];
// Store email for some functions in global data array
$DATA['email'] = $email;
if ((isBooleanConstantAndTrue('DEBUG_MODE')) || ($force)) {
// Log this message away
$fp = fopen(PATH."inc/cache/debug.log", 'a') or mxchange_die("Cannot write logfile debug.log!");
- fwrite($fp, date("d.m.Y|H:i:s", time())."|".basename(__FILE__)."|".__LINE__."|".strip_tags($message)."\n");
+ fwrite($fp, date("d.m.Y|H:i:s", time())."|".basename($file)."|".$line."|".strip_tags($message)."\n");
fclose($fp);
} // END - if
}
// Set cookie
set_session('refid', $GLOBALS['refid']);
} // END - if
+
+ // Return determined refid
+ return $GLOBALS['refid'];
}
// Destroys the admin session
function DESTROY_ADMIN_SESSION () {
// Kill maybe existing session variables including array elements
- set_session('admin_login' , "");
- set_session('admin_md5' , "");
- set_session('admin_last' , "");
- set_session('admin_to' , "");
+ set_session('admin_login', "");
+ set_session('admin_md5' , "");
+ set_session('admin_last' , "");
+ set_session('admin_to' , "");
// Destroy session and return status
return @session_destroy();
//
if (!function_exists('html_entity_decode')) {
// Taken from documentation on www.php.net
- function html_entity_decode($string) {
+ function html_entity_decode ($string) {
$trans_tbl = get_html_translation_table(HTML_ENTITIES);
$trans_tbl = array_flip($trans_tbl);
return strtr($string, $trans_tbl);
install_WriteData($_POST['spath']."inc/config.php", "SMTP-USER", "define('SMTP_USER', \"", "\");", $_POST['smtp_user'], 0);
install_WriteData($_POST['spath']."inc/config.php", "SMTP-PASSWORD", "define('SMTP_PASSWORD', \"", "\");", $_POST['smtp_pass'], 0);
install_WriteData($_POST['spath']."inc/config.php", "INSTALLED", "define('mxchange_installed', ", ");", "true", 0);
-
- // Close the link
- SQL_CLOSE($link, __FILE__, __LINE__);
} else {
// Installation area not found!
ADD_FATAL(INSTALL_MISSING_DUMPS);
define('ADMIN_BUILD_STATUS_HANDLER', "Status-Handler");
define('TASK_SUBJ_EXTENSION_DEACTIVATED', "Erweiterung deaktiviert");
define('ADMIN_SUBJECT_EXTENSION_DEACTIVATED', "Automatische Deaktivierung einer Erweiterung");
+define('FATAL_EXTENSION_LOADED', "Erweiterung <u>%s/u> bereits geladen!");
define('MEMBER_MAIL_BONUS_CONFIRMED_ON', "Sie haben diese Bonusmail <span class=\"data\">%s</span> bestätigt.");
define('MEMBER_MAIL_NORMAL_CONFIRMED_ON', "Sie haben diese Klickmail <span class=\"data\">%s</span> bestätigt.");
define('ADMIN_TASK_IS_EXTENSION_UPDATE', "Erweiterung-Update");
define('ADMIN_TASK_IS_EXTENSION_DEACTIVATION', "Erweiterung-Management");
+// Filter sub-system
+define('FILTER_FAILED_ALREADY_INIT', "Filter-System ist bereits initialisiert.");
+define('FILTER_FAILED_ALREADY_ADDED', "Die Filterfunktion <u>%s</u> ist bereits der Filterkette <u>%s</u> hinzugefügt.");
+define('FILTER_FAILED_NOT_FOUND', "Die Filterfunktion <u>%s</u> wurde nicht gefunden und konnte der Filterkette <u>%s</u> nicht hinzugefügt werden.");
+define('FILTER_FAILED_NO_FILTER_FOUND', "Die Filterkette <u>%s</u> konnte nicht gefunden werden.");
+define('FILTER_FAILED_NOT_REMOVED', "Die Filterfunktion <u>%s</u> konnte nicht aus der Filterkette <u>%s</u> entfernt werden, da sie nicht existiert.");
+define('FILTER_FLUSH_FAILED_NO_DATABASE', "Kann die Filterketten nicht speichern. Datenbank fehlt!");
+
//
?>
}
// Remove cache file
- if ((EXT_IS_ACTIVE("cache")) && ($cache_update == "1")) {
- if ($cacheInstance->loadCacheFile("admins")) $cacheInstance->destroyCacheFile();
- }
+ RUN_FILTER('post_admin_edited', $_POST);
}
// Make admin accounts editable
}
// Remove cache if cache system is activated
- if ((EXT_IS_ACTIVE("cache")) && ($cache_update == "1")) {
- if ($cacheInstance->loadCacheFile("admins")) $cacheInstance->destroyCacheFile();
- }
+ RUN_FILTER('post_admin_deleted', $_POST);
}
// List all admin accounts
return $this->ret;
}
}
+
+// Destroy the cache on extension changes
+function FILTER_CACHE_DESTROY_ON_EXT_CHANGE () {
+ global $cacheInstance;
+
+ // Update cache
+ if (EXT_IS_ACTIVE("cache")) {
+ if ($cacheInstance->loadCacheFile("config")) $cacheInstance->destroyCacheFile();
+ if ($cacheInstance->loadCacheFile("extensions", true)) $cacheInstance->destroyCacheFile();
+ if ($cacheInstance->loadCacheFile("mod_reg")) $cacheInstance->destroyCacheFile();
+ } // END - if
+}
+
+// Destroy the cache on changing admin
+function FILTER_CACHE_DESTROY_ON_ADMIN_CHANGE () {
+ global $cacheInstance;
+
+ // Update cache
+ if (EXT_IS_ACTIVE("cache")) {
+ if ($cacheInstance->loadCacheFile("admin")) $cacheInstance->destroyCacheFile();
+ } // END - if
+}
+
//
?>
require($INC);
}
-//
-function COUNTRY_GENERATE_INFO($ID)
-{
+// Generate a human-readable country description with code
+function COUNTRY_GENERATE_INFO ($id) {
+ // Load code and description
$result = SQL_QUERY_ESC("SELECT code, descr FROM "._MYSQL_PREFIX."_countries WHERE id=%s LIMIT 1",
- array(bigintval($ID)), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 1)
- {
+ array(bigintval($id)), __FILE__, __LINE__);
+
+ // Is there an entry?
+ if (SQL_NUMROWS($result) == 1) {
+ // Load entry
list($code, $descr) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
- $ret = $descr." (".$code.")";
- }
- else
- {
+
+ // Construct human-readable description
+ $ret = sprintf("%s (%s)", $descr, $code);
+ } else {
// Not found!
$ret = COUNTRY_NOT_FOUND;
}
+ // Free the result
+ SQL_FREERESULT($result);
+
// Return info
return $ret;
}
--- /dev/null
+<?php
+/************************************************************************
+ * MXChange v0.2.1 Start: 12/16/2008 *
+ * =============== Last change: 12/16/2008 *
+ * *
+ * -------------------------------------------------------------------- *
+ * File : events_functions.php *
+ * -------------------------------------------------------------------- *
+ * Short description : Functions for the event system *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung : Funktionen fuer das Event-System *
+ * -------------------------------------------------------------------- *
+ * *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2008 by Roland Haeder *
+ * For more information visit: http://www.mxchange.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ************************************************************************/
+
+// Some security stuff...
+if (!defined('__SECURITY')) {
+ $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
+ require($INC);
+}
+
+//
+?>
//
// Solved tasks
//
- $value = GET_TOTAL_DATA("DELETED", "task_system", "id", "status", true, sprintf(" AND assigned_admin=%s", GET_ADMIN_ID(get_session('admin_login'))));
+ $value = GET_TOTAL_DATA("CLOSED", "task_system", "id", "status", true, sprintf(" AND assigned_admin=%s", GET_ADMIN_ID(get_session('admin_login'))));
if ($value > 0) {
define('__TASK_SOLVED_VALUE', "<A href=\"".URL."/modules.php?module=admin&what=list_task&type=solved\">".$value."</A>");
--- /dev/null
+<?php
+/************************************************************************
+ * MXChange v0.2.1 Start: 12/03/2004 *
+ * =============== Last change: 12/13/2004 *
+ * *
+ * -------------------------------------------------------------------- *
+ * File : theme-manager.php *
+ * -------------------------------------------------------------------- *
+ * Short description : Theme manager *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung : Themen-Manager *
+ * -------------------------------------------------------------------- *
+ * *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2008 by Roland Haeder *
+ * For more information visit: http://www.mxchange.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ************************************************************************/
+
+// Some security stuff...
+if (!defined('__SECURITY')) {
+ $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
+ require($INC);
+}
+
+// Always make sure the session management is initialized first
+require_once(PATH."inc/session.php");
+
+// Get current theme name
+function GET_CURR_THEME() {
+ global $INC_POOL, $_CONFIG, $CSS, $cacheArray;
+
+ // The default theme is 'default'... ;-)
+ $ret = "default";
+
+ // Load default theme if not empty from configuration
+ if (!empty($_CONFIG['default_theme'])) $ret = $_CONFIG['default_theme'];
+
+ if (!isSessionVariableSet('mxchange_theme')) {
+ // Set default theme
+ set_session("mxchange_theme", $ret);
+ } elseif ((isSessionVariableSet('mxchange_theme')) && (GET_EXT_VERSION("sql_patches") >= "0.1.4")) {
+ //die("<pre>".print_r($cacheArray['themes'], true)."</pre>");
+ // Get theme from cookie
+ $ret = get_session('mxchange_theme');
+
+ // Is it valid?
+ if (THEME_GET_ID($ret) == 0) {
+ // Fix it to default
+ $ret = "default";
+ } // END - if
+ } elseif ((!isBooleanConstantAndTrue('mxchange_installed')) && ((isBooleanConstantAndTrue('mxchange_installing')) || ($CSS == true)) && ((!empty($_GET['theme'])) || (!empty($_POST['theme'])))) {
+ // Prepare FQFN for checking
+ $theme = sprintf("%stheme/%s/theme.php", PATH, SQL_ESCAPE($_GET['theme']));
+
+ // Installation mode active
+ if ((!empty($_GET['theme'])) && (FILE_READABLE($theme))) {
+ // Set cookie from URL data
+ set_session("mxchange_theme", $_GET['theme']);
+ } elseif (FILE_READABLE(sprintf("%stheme/%s/theme.php", PATH, SQL_ESCAPE($_POST['theme'])))) {
+ // Set cookie from posted data
+ set_session("mxchange_theme", $_POST['theme']);
+ }
+
+ // Set return value
+ $ret = get_session('mxchange_theme');
+ } else {
+ // Invalid design, reset cookie
+ set_session("mxchange_theme", $ret);
+ }
+
+ // Add (maybe) found theme.php file to inclusion list
+ $theme = sprintf("%stheme/%s/theme.php", PATH, SQL_ESCAPE($ret));
+
+ // Try to load the requested include file
+ if (FILE_READABLE($theme)) $INC_POOL[] = $theme;
+
+ // Return theme value
+ return $ret;
+}
+
+function THEME_SELECTION_BOX($mod, $act, $wht, $result) {
+ // Construction URL
+ $FORM = URL."/modules.php?module=".$mod;
+ if (!empty($act)) $FORM .= "&action=".$act;
+ if (!empty($wht)) $FORM .= "&what=".$wht;
+ define('__FORM_VALUE', $FORM);
+
+ // Initialize array
+ $THEMES = array(
+ 'theme_unix' => array(), // Unix name from filesystem
+ 'theme_name' => array() // Title
+ );
+
+ // Load all themes
+ while(list($theme) = SQL_FETCHROW($result)) {
+ // Load it's theme.php file
+ $INC = sprintf("%stheme/%s/theme.php", PATH, SQL_ESCAPE($theme));
+ if (FILE_READABLE($INC)) {
+ // And save all data in array
+ require($INC);
+ $THEMES['theme_unix'][] = $theme;
+ $THEMES['theme_name'][] = $THEME_NAME;
+ } // END - if
+ } // END - while
+
+ // Sort whole array by title
+ array_pk_sort($THEMES, array("theme_name"));
+
+ // Construct selection form for the box template
+ $OUT = "";
+ foreach ($THEMES['theme_unix'] as $key => $theme) {
+ $OUT .= " <OPTION value=\"".$theme."\"";
+ if ($theme == GET_CURR_THEME()) $OUT .= " selected=\"selected\"";
+ $OUT .= ">".$THEMES['theme_name'][$key]."</OPTION>\n";
+ } // END - foreach
+
+ // Return generated selection
+ define('__THEME_SELECTION_OPTIONS', $OUT);
+ $OUT = LOAD_TEMPLATE("theme_select_form", true);
+ return $OUT;
+}
+
+// Get version from name
+function THEME_GET_VERSION ($name) {
+ global $cacheArray, $_CONFIG;
+
+ // Is the extension "theme" installed?
+ if (!EXT_IS_ACTIVE("theme")) {
+ // Then abort here
+ return "0.0";
+ } // END - if
+
+ // Default version "number"
+ $cver = "-.-";
+
+ // Is the cache entry there?
+ if (isset($cacheArray['themes']['theme_ver'][$name])) {
+ // Get the version from cache
+ $cver = $cacheArray['themes']['theme_ver'][$name];
+
+ // Count up
+ if (isset($_CONFIG['cache_hits'])) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
+ } elseif (GET_EXT_VERSION("cache") != "0.1.8") {
+ // Load version from database
+ $result = SQL_QUERY_ESC("SELECT theme_ver FROM "._MYSQL_PREFIX."_themes WHERE theme_path='%s' LIMIT 1",
+ array($name), __FILE__, __LINE__);
+
+ // Entry found?
+ if (SQL_NUMROWS($result) == 1) {
+ // Fetch data
+ list($cver) = SQL_FETCHROW($result);
+ } // END - if
+
+ // Free result
+ SQL_FREERESULT($result);
+ }
+
+ // Return version
+ return $cver;
+}
+
+// Get id from theme
+function THEME_GET_ID ($name) {
+ global $cacheArray, $_CONFIG;
+
+ // Is the extension "theme" installed?
+ if (!EXT_IS_ACTIVE("theme")) {
+ // Then abort here
+ return 0;
+ } // END - if
+
+ // Default id
+ $id = 0;
+
+ // Is the cache entry there?
+ if (isset($cacheArray['themes']['id'][$name])) {
+ // Get the version from cache
+ $id = $cacheArray['themes']['id'][$name];
+
+ // Count up
+ if (isset($_CONFIG['cache_hits'])) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
+ } elseif (GET_EXT_VERSION("cache") != "0.1.8") {
+ // Check if current theme is already imported or not
+ $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_themes WHERE theme_path='%s' LIMIT 1",
+ array($name), __FILE__, __LINE__);
+
+ // Entry found?
+ if (SQL_NUMROWS($result) == 1) {
+ // Fetch data
+ list($id) = SQL_FETCHROW($result);
+ } // END - if
+
+ // Free result
+ SQL_FREERESULT($result);
+ }
+
+ // Return id
+ return $id;
+}
+
+// Checks wether a theme is found in db
+function THEME_CHECK_EXIST ($name) {
+ // Get theme and is it not nul?
+ return (THEME_GET_ID($name) > 0);
+}
+
+// Checks if a theme is active
+function THEME_IS_ACTIVE ($name) {
+ global $cacheArray, $_CONFIG;
+
+ // Is the extension "theme" installed?
+ if (!EXT_IS_ACTIVE("theme")) {
+ // Then abort here
+ return false;
+ } // END - if
+
+ // Default is nothing active
+ $active = false;
+
+ // Is the cache entry there?
+ if (isset($cacheArray['themes']['theme_active'][$name])) {
+ // Get the version from cache
+ $active = ($cacheArray['themes']['theme_active'][$name] == "Y");
+
+ // Count up
+ if (isset($_CONFIG['cache_hits'])) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
+ } elseif (GET_EXT_VERSION("cache") != "0.1.8") {
+ // Check if current theme is already imported or not
+ $result = SQL_QUERY_ESC("SELECT theme_active FROM "._MYSQL_PREFIX."_themes WHERE theme_path='%s' AND theme_active='Y' LIMIT 1",
+ array($name), __FILE__, __LINE__);
+
+ // Is the theme active and installed?
+ $active = (SQL_NUMROWS($result) == 1);
+
+ // Free result
+ SQL_FREERESULT($result);
+ }
+
+ // Return result
+ return $active;
+}
+
+// Gets current human-readable theme name
+function GET_CURR_THEME_NAME () {
+ global $cacheArray, $_CONFIG;
+
+ // Is the extension "theme" installed?
+ if (!EXT_IS_ACTIVE("theme")) {
+ // Then abort here
+ return "default";
+ } // END - if
+
+ // Get the Uni* name
+ $name = GET_CURR_THEME();
+
+ // Is the cache entry there?
+ if (isset($cacheArray['themes']['theme_name'][$name])) {
+ // Get the version from cache
+ $name = $cacheArray['themes']['theme_name'][$name];
+
+ // Count up
+ if (isset($_CONFIG['cache_hits'])) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
+ } elseif (GET_EXT_VERSION("cache") != "0.1.8") {
+ // Check if current theme is already imported or not
+ $result = SQL_QUERY_ESC("SELECT theme_name FROM "._MYSQL_PREFIX."_themes WHERE theme_path='%s' AND theme_active='Y' LIMIT 1",
+ array($name), __FILE__, __LINE__);
+
+ // Load theme name
+ list($name) = SQL_FETCHROW($result);
+
+ // Free result
+ SQL_FREERESULT($result);
+ }
+
+ // Return name
+ return $name;
+}
+
+// Initialize variables
+$currTheme = GET_CURR_THEME();
+
+// Check if new theme is selcted
+if ((!empty($_POST['new_theme'])) && ($_POST['new_theme'] != $currTheme)) {
+ // Set new theme for guests
+ $newTheme = $_POST['new_theme'];
+
+ // Change to new theme
+ set_session("mxchange_theme", $newTheme);
+
+ // Remove current from array and set new
+ $theme = sprintf("%stheme/%s/theme.php", PATH, $currTheme);
+ unset($INC_POOL[array_search($theme, $INC_POOL)]);
+ $INC_POOL[] = sprintf("%stheme/%s/theme.php", PATH, $newTheme);
+} // END - if
+
+//
+?>
// At least one found?
if ((SQL_NUMROWS($res_ext_crt) > 0) && ((($cacheMode == "init") && ($CSS != "1") && ($CSS != "-1")) || ($cacheMode == "no"))) {
- // Load theme management
- require_once(PATH."inc/theme-manager.php");
+ // Load session management
+ require_once(PATH."inc/session.php");
// Extensions are registered so we load them
while ($content = SQL_FETCHARRAY($res_ext_crt)) {
// Rewrite overview module
if ($GLOBALS['what'] == "overview") {
$GLOBALS['action'] = GET_ACTION($GLOBALS['module'], $GLOBALS['what']);
- }
+ } // END - if
// Add data to URL
if (!empty($GLOBALS['what'])) $URL .= "what=".$GLOBALS['what'];
$ret = WRONG_PASS." [<A href=\"".URL."/modules.php?module=admin&reset_pass=1\">".ADMIN_RESET_PASS."</A>]\n";
DESTROY_ADMIN_SESSION();
break;
- }
- }
+ } // END - switch
+ } // END - if
+
+ // Error detected?
if ($ret != "done") {
if (!empty($_POST['login'])) {
define('__LOGIN_VALUE', $_POST['login']);
if (isset($_POST['ok'])) {
// Set messages to zero
-
$MSG1 = ""; $MSG2 = "";
+
// No login entered?
if (empty($_POST['login'])) $MSG1 = ADMIN_NO_LOGIN;
// Load login form template
LOAD_TEMPLATE("admin_login_form", false, $content);
- }
+ } // END - if
} elseif (isset($_GET['logout'])) {
// Only try to remove cookies
if (DESTROY_ADMIN_SESSION()) {
SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_admins SET password='%s' WHERE login='%s' LIMIT 1",
array($passHash, $login), __FILE__, __LINE__);
+ // Run filters
+ RUN_FILTER('post_admin_reset_pass', array('login' => $login, 'hash' => $passHash));
+
// Return output
return ADMIN_PASSWORD_RESET_DONE;
}
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')",
- array($_POST['login'], generateHash($_POST['pass1']), $_POST['email']), __FILE__, __LINE__);
+ SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_admins (login, password, email) VALUES ('%s','%s','%s')",
+ array($_POST['login'], generateHash($_POST['pass1']), $_POST['email']), __FILE__, __LINE__);
// Admin login saved
LOAD_TEMPLATE("admin_settings_saved", false, "<FONT class=\"admin_done\">".ADMIN_ADMINS_ADD_DONE."</FONT>");
- // Remove cache file
- if (EXT_IS_ACTIVE("cache")) {
- if ($cacheInstance->loadCacheFile("admins")) $cacheInstance->destroyCacheFile();
- }
- } else {
- // Free memory
- SQL_FREERESULT($result);
- }
+ // Run filter chain
+ RUN_FILTER('post_admin_added', $_POST);
+ } // END - if
+
+ // Free memory
+ SQL_FREERESULT($result);
}
if ($FORM) {
$ext_name = trim(substr($subj, 1, strpos($subj, ":") - 1));
// Test the extension for deprecation
- $EXT_DEPRECATED = "N"; $EXT_LOAD_MODE = "";
+ $EXT_DEPRECATED = "N"; $EXT_LOAD_MODE = "test";
include(PATH."inc/extensions/ext-".$ext_name.".php");
// Is the extension deprecated?
// Load database library
require_once(PATH."inc/db/lib.php");
-// // Non-database functions
+// Non-database functions
require_once(PATH."inc/functions.php");
+// Filter functions
+require_once(PATH."inc/filters.php");
+
// Functions which interact with the database
require_once(PATH."inc/mysql-manager.php");
die("Error message written to debug.log. Please try to call <a href=\"".URL."\">the main page</a> to continue.");
} else {
// No debug extension found
- print("Please report this error at <a href=\"http://forum.mxchange.org\" target=\"_blank\">forum.mxchange.org</a>:<pre>");
+ print("Please report this error at <a href=\"http://forum.mxchange.org\" rel=\"external\" target=\"_blank\">forum.mxchange.org</a>:<pre>");
debug_print_backtrace();
die("</pre>Thank you for your help finding bugs.");
}
// Set error handler
set_error_handler('__errorHandler');
+// Call-back function for running shutdown functions
+function __run_shutdown_filter () {
+ // Call the filter chain 'shutdown'
+ RUN_FILTER('shutdown', null, false);
+}
+
+// Register shutdown hook
+register_shutdown_function('__run_shutdown_filter');
+
// Check if the user setups his MySQL stuff...
if ((empty($MySQL['login'])) && (!defined('mxchange_installing')) && (!isset($_GET['installing'])) && (isBooleanConstantAndTrue('mxchange_installed'))) {
// No login entered and outside installation mode
// Loading patching system is required here...
require_once(PATH."inc/patch-system.php"); // Initialize patch system
- // Functions which are related to themes
- require_once(PATH."inc/theme-manager.php");
+ // Session management
+ require_once(PATH."inc/session.php");
// Run daily reset
require_once(PATH."inc/check-reset.php");
// Include required files
require_once(PATH."inc/databases.php");
- require_once(PATH."inc/theme-manager.php");
+ require_once(PATH."inc/session.php");
// Check if we are in installation routine
$installPhp = basename($_SERVER['PHP_SELF']);
// Double-check installation mode
if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndTrue('admin_registered'))) {
// Check for file permissions
- if (!is_INCWritable("config")) {
+ if (!IS_INC_WRITEABLE("config")) {
ADD_FATAL(CONFIG_IS_WRITE_PROTECTED);
- }
- if (!is_INCWritable("dummy")) {
+ } // END - if
+ if (!IS_INC_WRITEABLE("dummy")) {
ADD_FATAL(DUMMY_IS_WRITE_PROTECTED);
- }
- if (!is_INCWritable(".secret/dummy")) {
+ } // END - if
+ if (!IS_INC_WRITEABLE(".secret/dummy")) {
ADD_FATAL(SECRET_IS_WRITE_PROTECTED);
- }
+ } // END - if
} // END - if
}
+// Init filter system
+INIT_FILTER_SYSTEM();
+
// Any fatal messages?
if (!is_array($FATAL)) $FATAL = array();
-if (((sizeof($FATAL) > 0) || (!empty($FATAL[0]))) && (isBooleanConstantAndTrue('mxchange_installed')) && (!defined('mxchange_installing')) && ($CSS != "1"))
-{
+if (((sizeof($FATAL) > 0) || (!empty($FATAL[0]))) && (isBooleanConstantAndTrue('mxchange_installed')) && (!defined('mxchange_installing')) && ($CSS != "1")) {
// One or more fatal error(s) occur during connect...
include (PATH."inc/header.php");
include (PATH."inc/fatal_errors.php");
unset($FATAL);
include (PATH."inc/footer.php");
exit;
-}
+} // END - if
//
?>
// Get it directly from URL
return $GLOBALS['action'];
}
- //* DEBUG: */ echo __LINE__."*".$ret."*<br />\n";
+ //* DEBUG: */ echo __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): ret=".$ret."<br />\n";
if (MODULE_HAS_MENU($MODE)) {
// Rewriting modules to menu
// Load from database
$result = SQL_QUERY_ESC("SELECT action FROM "._MYSQL_PREFIX."_%s_menu WHERE what='%s' LIMIT 1",
- array($MODE, $wht), __FILE__, __LINE__);
+ array($MODE, $wht), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Load action value and pray that this one is the right you want... ;-)
list($ret) = SQL_FETCHROW($result);
// Update points
$result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_jackpot SET points=points+%s WHERE ok='ok' LIMIT 1",
- array($points), __FILE__, __LINE__);
+ array($points), __FILE__, __LINE__);
}
}
//
// Return what value
return $wht;
}
-//
-function MODULE_HAS_MENU($mod, $forceDb = false) {
+
+// Checks if the module has a menu
+function MODULE_HAS_MENU ($mod, $forceDb = false) {
global $cacheArray, $_CONFIG;
// All is false by default
// Check cache and count hit
$ret = ($cacheArray['extensions']['ext_menu'][$mod] == "Y");
if (isset($_CONFIG['cache_hits'])) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
+ } elseif ((IS_ADMIN()) && ($mod == "admin")) {
+ // Admin module has always a menu!
+ $ret = true;
}
} elseif ((GET_EXT_VERSION("sql_patches") >= "0.3.6") && ((!EXT_IS_ACTIVE("cache")) || ($forceDb === true))) {
// Check database for entry
$result = SQL_QUERY_ESC("SELECT has_menu FROM "._MYSQL_PREFIX."_mod_reg WHERE module='%s' LIMIT 1",
- array($mod), __FILE__, __LINE__);
+ array($mod), __FILE__, __LINE__);
+
+ // Entry found?
if (SQL_NUMROWS($result) == 1) {
+ // Load "has_menu" column
list($has_menu) = SQL_FETCHROW($result);
// Fake cache... ;-)
}
// Return status
+ //* DEBUG: */ var_dump($ret);
return $ret;
}
if (is_array($EXT_CSS_FILES)) {
// Load extension's CSS files
foreach ($EXT_CSS_FILES as $value) $STYLES[] = $value;
- }
+ } // END - if
// Create missing configuration file
if (!function_exists('GET_CURR_THEME')) {
- // Dummy for e.g. down database links
- function GET_CURR_THEME () {
- return "default";
- }
+ // Load dummy theme functions
+ require_once(PATH."inc/theme-dummy.php");
} // END - if
// Output inclusion lines
--- /dev/null
+<?php
+/************************************************************************
+ * MXChange v0.2.1 Start: 12/16/2008 *
+ * =============== Last change: 12/16/2008 *
+ * *
+ * -------------------------------------------------------------------- *
+ * File : theme-dummy.php *
+ * -------------------------------------------------------------------- *
+ * Short description : Dummy functions for theme manager *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung : Platzhalter-Funktionen fuer Theme-Manager *
+ * -------------------------------------------------------------------- *
+ * *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2008 by Roland Haeder *
+ * For more information visit: http://www.mxchange.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ************************************************************************/
+
+// Some security stuff...
+if (!defined('__SECURITY')) {
+ $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
+ require($INC);
+} elseif (EXT_IS_ACTIVE("theme")) {
+ // Abort loading here
+ ADD_FATAL(sprintf(FATAL_EXTENSION_LOADED, "theme"));
+ return;
+}
+
+// Dummy getter for current theme
+function GET_CURR_THEME () {
+ return "default";
+}
+
+//
+?>
<?php
-/************************************************************************
- * MXChange v0.2.1 Start: 12/03/2004 *
- * =============== Last change: 12/13/2004 *
- * *
- * -------------------------------------------------------------------- *
- * File : theme-manager.php *
- * -------------------------------------------------------------------- *
- * Short description : Theme manager *
- * -------------------------------------------------------------------- *
- * Kurzbeschreibung : Themen-Manager *
- * -------------------------------------------------------------------- *
- * *
- * -------------------------------------------------------------------- *
- * Copyright (c) 2003 - 2008 by Roland Haeder *
- * For more information visit: http://www.mxchange.org *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
- * MA 02110-1301 USA *
- ************************************************************************/
-
-// Some security stuff...
-if (!defined('__SECURITY')) {
- $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
- require($INC);
-}
-
-// Always make sure the session management is initialized first
-require_once(PATH."inc/session.php");
-
-// Get current theme name
-function GET_CURR_THEME() {
- global $INC_POOL, $_CONFIG, $CSS, $cacheArray;
-
- // The default theme is 'default'... ;-)
- $ret = "default";
-
- // Load default theme if not empty from configuration
- if (!empty($_CONFIG['default_theme'])) $ret = $_CONFIG['default_theme'];
-
- if (!isSessionVariableSet('mxchange_theme')) {
- // Set default theme
- set_session("mxchange_theme", $ret);
- } elseif ((isSessionVariableSet('mxchange_theme')) && (GET_EXT_VERSION("sql_patches") >= "0.1.4")) {
- //die("<pre>".print_r($cacheArray['themes'], true)."</pre>");
- // Get theme from cookie
- $ret = get_session('mxchange_theme');
-
- // Is it valid?
- if (THEME_GET_ID($ret) == 0) {
- // Fix it to default
- $ret = "default";
- } // END - if
- } elseif ((!isBooleanConstantAndTrue('mxchange_installed')) && ((isBooleanConstantAndTrue('mxchange_installing')) || ($CSS == true)) && ((!empty($_GET['theme'])) || (!empty($_POST['theme'])))) {
- // Prepare FQFN for checking
- $theme = sprintf("%stheme/%s/theme.php", PATH, SQL_ESCAPE($_GET['theme']));
-
- // Installation mode active
- if ((!empty($_GET['theme'])) && (FILE_READABLE($theme))) {
- // Set cookie from URL data
- set_session("mxchange_theme", $_GET['theme']);
- } elseif (FILE_READABLE(sprintf("%stheme/%s/theme.php", PATH, SQL_ESCAPE($_POST['theme'])))) {
- // Set cookie from posted data
- set_session("mxchange_theme", $_POST['theme']);
- }
-
- // Set return value
- $ret = get_session('mxchange_theme');
- } else {
- // Invalid design, reset cookie
- set_session("mxchange_theme", $ret);
- }
-
- // Add (maybe) found theme.php file to inclusion list
- $theme = sprintf("%stheme/%s/theme.php", PATH, SQL_ESCAPE($ret));
-
- // Try to load the requested include file
- if (FILE_READABLE($theme)) $INC_POOL[] = $theme;
-
- // Return theme value
- return $ret;
-}
-
-function THEME_SELECTION_BOX($mod, $act, $wht, $result) {
- // Construction URL
- $FORM = URL."/modules.php?module=".$mod;
- if (!empty($act)) $FORM .= "&action=".$act;
- if (!empty($wht)) $FORM .= "&what=".$wht;
- define('__FORM_VALUE', $FORM);
-
- // Initialize array
- $THEMES = array(
- 'theme_unix' => array(), // Unix name from filesystem
- 'theme_name' => array() // Title
- );
-
- // Load all themes
- while(list($theme) = SQL_FETCHROW($result)) {
- // Load it's theme.php file
- $INC = sprintf("%stheme/%s/theme.php", PATH, SQL_ESCAPE($theme));
- if (FILE_READABLE($INC)) {
- // And save all data in array
- require($INC);
- $THEMES['theme_unix'][] = $theme;
- $THEMES['theme_name'][] = $THEME_NAME;
- } // END - if
- } // END - while
-
- // Sort whole array by title
- array_pk_sort($THEMES, array("theme_name"));
-
- // Construct selection form for the box template
- $OUT = "";
- foreach ($THEMES['theme_unix'] as $key => $theme) {
- $OUT .= " <OPTION value=\"".$theme."\"";
- if ($theme == GET_CURR_THEME()) $OUT .= " selected=\"selected\"";
- $OUT .= ">".$THEMES['theme_name'][$key]."</OPTION>\n";
- } // END - foreach
-
- // Return generated selection
- define('__THEME_SELECTION_OPTIONS', $OUT);
- $OUT = LOAD_TEMPLATE("theme_select_form", true);
- return $OUT;
-}
-
-// Get version from name
-function THEME_GET_VERSION ($name) {
- global $cacheArray, $_CONFIG;
-
- // Default version "number"
- $cver = "-.-";
-
- // Is the cache entry there?
- if (isset($cacheArray['themes']['theme_ver'][$name])) {
- // Get the version from cache
- $cver = $cacheArray['themes']['theme_ver'][$name];
-
- // Count up
- if (isset($_CONFIG['cache_hits'])) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
- } elseif (GET_EXT_VERSION("cache") != "0.1.8") {
- // Load version from database
- $result = SQL_QUERY_ESC("SELECT theme_ver FROM "._MYSQL_PREFIX."_themes WHERE theme_path='%s' LIMIT 1",
- array($name), __FILE__, __LINE__);
-
- // Entry found?
- if (SQL_NUMROWS($result) == 1) {
- // Fetch data
- list($cver) = SQL_FETCHROW($result);
- } // END - if
-
- // Free result
- SQL_FREERESULT($result);
- }
-
- // Return version
- return $cver;
-}
-
-// Get id from theme
-function THEME_GET_ID ($name) {
- global $cacheArray, $_CONFIG;
-
- // Default id
- $id = 0;
-
- // Is the cache entry there?
- if (isset($cacheArray['themes']['id'][$name])) {
- // Get the version from cache
- $id = $cacheArray['themes']['id'][$name];
-
- // Count up
- if (isset($_CONFIG['cache_hits'])) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
- } elseif (GET_EXT_VERSION("cache") != "0.1.8") {
- // Check if current theme is already imported or not
- $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_themes WHERE theme_path='%s' LIMIT 1",
- array($name), __FILE__, __LINE__);
-
- // Entry found?
- if (SQL_NUMROWS($result) == 1) {
- // Fetch data
- list($id) = SQL_FETCHROW($result);
- } // END - if
-
- // Free result
- SQL_FREERESULT($result);
- }
-
- // Return id
- return $id;
-}
-
-// Checks wether a theme is found in db
-function THEME_CHECK_EXIST ($name) {
- // Get theme and is it not nul?
- return (THEME_GET_ID($name) > 0);
-}
-
-// Checks if a theme is active
-function THEME_IS_ACTIVE ($name) {
- global $cacheArray, $_CONFIG;
-
- // Default is nothing active
- $active = false;
-
- // Is the cache entry there?
- if (isset($cacheArray['themes']['theme_active'][$name])) {
- // Get the version from cache
- $active = ($cacheArray['themes']['theme_active'][$name] == "Y");
-
- // Count up
- if (isset($_CONFIG['cache_hits'])) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
- } elseif (GET_EXT_VERSION("cache") != "0.1.8") {
- // Check if current theme is already imported or not
- $result = SQL_QUERY_ESC("SELECT theme_active FROM "._MYSQL_PREFIX."_themes WHERE theme_path='%s' AND theme_active='Y' LIMIT 1",
- array($name), __FILE__, __LINE__);
-
- // Is the theme active and installed?
- $active = (SQL_NUMROWS($result) == 1);
-
- // Free result
- SQL_FREERESULT($result);
- }
-
- // Return result
- return $active;
-}
-
-// Gets current human-readable theme name
-function GET_CURR_THEME_NAME () {
- global $cacheArray, $_CONFIG;
-
- // Get the Uni* name
- $name = GET_CURR_THEME();
-
- // Is the cache entry there?
- if (isset($cacheArray['themes']['theme_name'][$name])) {
- // Get the version from cache
- $name = $cacheArray['themes']['theme_name'][$name];
-
- // Count up
- if (isset($_CONFIG['cache_hits'])) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
- } elseif (GET_EXT_VERSION("cache") != "0.1.8") {
- // Check if current theme is already imported or not
- $result = SQL_QUERY_ESC("SELECT theme_name FROM "._MYSQL_PREFIX."_themes WHERE theme_path='%s' AND theme_active='Y' LIMIT 1",
- array($name), __FILE__, __LINE__);
-
- // Is the theme active and installed?
- $name = (SQL_NUMROWS($result) == 1);
-
- // Free result
- SQL_FREERESULT($result);
- }
-
- // Return name
- return $name;
-}
-
-// Initialize variables
-$currTheme = GET_CURR_THEME();
-
-// Check if new theme is selcted
-if ((!empty($_POST['new_theme'])) && ($_POST['new_theme'] != $currTheme)) {
- // Set new theme for guests
- $newTheme = $_POST['new_theme'];
-
- // Change to new theme
- set_session("mxchange_theme", $newTheme);
-
- // Remove current from array and set new
- $theme = sprintf("%stheme/%s/theme.php", PATH, $currTheme);
- unset($INC_POOL[array_search($theme, $INC_POOL)]);
- $INC_POOL[] = sprintf("%stheme/%s/theme.php", PATH, $newTheme);
-} // END - if
-
-//
+// DEPRECATED!
?>