From 0cbf3444544a6e3307e8da3af785da677688eba3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 21 Sep 2008 21:17:37 +0000 Subject: [PATCH] Fixes for installation mode --- inc/databases.php | 2 +- inc/extensions.php | 4 ++-- inc/functions.php | 2 +- inc/header.php | 2 +- inc/install-inc.php | 4 ++-- inc/language/surfbar_de.php | 4 ++++ inc/libs/surfbar_functions.php | 43 +++++++++++++++++++++++++++++++++- inc/load_extensions.php | 2 +- inc/modules/admin.php | 4 ++-- inc/mysql-connect.php | 12 ++++------ inc/mysql-manager.php | 2 +- inc/stylesheet.php | 2 +- inc/theme-manager.php | 2 +- 13 files changed, 64 insertions(+), 21 deletions(-) diff --git a/inc/databases.php b/inc/databases.php index a441f85285..542f5afa3d 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -113,7 +113,7 @@ define('USAGE_BASE', "usage"); define('SERVER_URL', "http://www.mxchange.org"); // This current patch level -define('CURR_SVN_REVISION', "382"); +define('CURR_SVN_REVISION', "383"); // Take a prime number which is long (if you know a longer one please try it out!) define('_PRIME', 591623); diff --git a/inc/extensions.php b/inc/extensions.php index 84506151e1..3973f4132a 100644 --- a/inc/extensions.php +++ b/inc/extensions.php @@ -319,7 +319,7 @@ function EXT_IS_ACTIVE ($ext_name) { global $cacheArray, $_CONFIG; // Extensions are all inactive during installation - if ((!defined('mxchange_installed')) || (isBooleanConstantAndTrue('mxchange_installing')) || (empty($ext_name))) return false; + if ((!isBooleanConstantAndTrue('mxchange_installed')) || (isBooleanConstantAndTrue('mxchange_installing')) || (empty($ext_name))) return false; // Not active is the default $active = "N"; @@ -368,7 +368,7 @@ function GET_EXT_VERSION ($ext_name) { $ret = false; // Extensions are all inactive during installation - if ((!defined('mxchange_installed')) || (isBooleanConstantAndTrue('mxchange_installing'))) return ""; + if ((!isBooleanConstantAndTrue('mxchange_installed')) || (isBooleanConstantAndTrue('mxchange_installing'))) return ""; //* DEBUG: */ echo __FUNCTION__.": ext_name={$ext_name}
\n"; // Is the cache written? diff --git a/inc/functions.php b/inc/functions.php index c4a1171f00..90fc0dfde3 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -321,7 +321,7 @@ function LOAD_TEMPLATE($template, $return=false, $content="") { // Add surrounding HTML comments to help finding bugs faster $ret = "\n".$ret."\n"; - } elseif ((IS_ADMIN()) || ((isBooleanConstantAndTrue('mxchange_installing')) && (!defined('mxchange_installed')))) { + } elseif ((IS_ADMIN()) || ((isBooleanConstantAndTrue('mxchange_installing')) && (!isBooleanConstantAndTrue('mxchange_installed')))) { // Only admins shall see this warning or when installation mode is active $ret = "
".TEMPLATE_404."
(".basename($file).")
diff --git a/inc/header.php b/inc/header.php index 1031590a81..8f2d54deae 100644 --- a/inc/header.php +++ b/inc/header.php @@ -80,7 +80,7 @@ if (($header != "1") && ($header != "2")) { // Remember title in constant for the template define('__PAGE_TITLE', html_entity_decode($TITLE)); - } elseif ((!defined('mxchange_installed')) || (!defined('admin_registered'))) { + } elseif ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndTrue('admin_registered'))) { // Load language file because it was missing in installation finalizer step... *sigh* require_once(sprintf("%sinc/language/install_%s.php", PATH, diff --git a/inc/install-inc.php b/inc/install-inc.php index 80f4686904..47f6e86b48 100644 --- a/inc/install-inc.php +++ b/inc/install-inc.php @@ -136,7 +136,7 @@ if ((isset($_GET['page']) && ($_GET['page'] == 5))) { } // Is MXChange installed or no admin registered so far? -if ((!defined('mxchange_installed')) || (!defined('admin_registered'))) +if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndTrue('admin_registered'))) { // Set URL for FORM actions define('__BURL_ACTION', $burl); @@ -331,7 +331,7 @@ if ((!defined('mxchange_installed')) || (!defined('admin_registered'))) break; case "finalize": // Write captured data to files - if ((!empty($_POST['finalize'])) && (!defined('mxchange_installed'))) { + if ((!empty($_POST['finalize'])) && (!isBooleanConstantAndTrue('mxchange_installed'))) { // You have submitted data then we have to reset the fatal messages $FATAL = array(); $SQLs = array(); diff --git a/inc/language/surfbar_de.php b/inc/language/surfbar_de.php index 319a96e80b..be6cb67efb 100644 --- a/inc/language/surfbar_de.php +++ b/inc/language/surfbar_de.php @@ -124,5 +124,9 @@ define('SURFBAR_URL_STATUS_STOPPED', "Angehalten"); define('SURFBAR_URL_STATUS_REJECTED', "Abgelehnt"); define('SURFBAR_URL_STATUS_DELETED', "Gelöscht"); +// Member actions - submit buttons +define('MEMBER_SURFBAR_ACTION_RETREAT_SUBMIT', "Zurücknehmen"); +define('MEMBER_SURFBAR_ACTION_FRAMETEST_SUBMIT', "Framkiller-Test"); + // ?> diff --git a/inc/libs/surfbar_functions.php b/inc/libs/surfbar_functions.php index f4c90eb585..0a40440988 100644 --- a/inc/libs/surfbar_functions.php +++ b/inc/libs/surfbar_functions.php @@ -940,9 +940,50 @@ ORDER BY u.id ASC", // Return the array return $URLs; } +// "Getter" for member action array for given status +function SURFBAR_GET_ACTION_ARRAY ($status) { + // Init array + $returnArray = array(); + + // Get all assigned actions + $result = SQL_QUERY_ESC("SELECT action FROM "._MYSQL_PREFIX."_surfbar_actions WHERE status='%s' ORDER BY id ASC", + array($status), __FILE__, __LINE__); + + // Some entries there? + if (SQL_NUMROWS($result) > 0) { + // Load all actions + while (list($action) = SQL_FETCHROW($result)) { + $returnArray[] = $action; + } // END - if + } // END - if + + // Free result + SQL_FREERESULT($result); + + // Return result + return $returnArray; +} // Create list of actions depending on status for the user function SURFBAR_MEMBER_ACTIONS ($id, $status) { - /* DEBUG: */ die("id={$id},status={$status}"); + // Load all actions in an array for given status + $actionArray = SURFBAR_GET_ACTION_ARRAY($status); + + // Init HTML code + $OUT = ""; + + // "Walk" through all actions and create forms + foreach ($actionArray as $action) { + // Add form for this action + $OUT .= sprintf("
+ +
", + $action, + strtoupper($action) + ); + } // END - if + + // Return code + return $OUT; } // Determine next id for surfbar or get data for given id, always call this before you call other // getters below this function!!! diff --git a/inc/load_extensions.php b/inc/load_extensions.php index bc9a4a5bb4..4a70153045 100644 --- a/inc/load_extensions.php +++ b/inc/load_extensions.php @@ -42,7 +42,7 @@ $EXT_CSS_FILES = array(); $ADD = ""; // Skip loading extensions -if ((!defined('mxchange_installed')) || (isBooleanConstantAndTrue('mxchange_installing'))) return; +if ((!isBooleanConstantAndTrue('mxchange_installed')) || (isBooleanConstantAndTrue('mxchange_installing'))) return; // Load default sql_patches extension if present if (FILE_READABLE(PATH."inc/extensions/ext-sql_patches.php")) { diff --git a/inc/modules/admin.php b/inc/modules/admin.php index 36a322a0c9..d1a7284046 100644 --- a/inc/modules/admin.php +++ b/inc/modules/admin.php @@ -49,7 +49,7 @@ require_once(PATH."inc/modules/admin/admin-inc.php"); // Fix "deleted" cookies in PHP4 (PHP5 does remove them, PHP4 sets them to deleted!) FIX_DELETED_COOKIES(array('admin_login', 'admin_md5', 'admin_last', 'admin_to')); -if (!defined('admin_registered')) { +if (!isBooleanConstantAndTrue('admin_registered')) { // Admin is not registered so we have to inform the user if ((isset($_POST['ok'])) && ((empty($_POST['login'])) || (empty($_POST['pass'])) || (strlen($_POST['pass']) < 4))) $_POST['ok'] = "***"; if ((isset($_POST['ok'])) && ($_POST['ok'] != "***")) { @@ -90,7 +90,7 @@ if (!defined('admin_registered')) { $ret = "done"; } - if (!defined('admin_registered')) { + if (!isBooleanConstantAndTrue('admin_registered')) { // Write to config that registration is done admin_WriteData(PATH."inc/config.php", "ADMIN-SETUP", "define('admin_registered', ", ");", "true", 0); diff --git a/inc/mysql-connect.php b/inc/mysql-connect.php index fd24ac4903..f7df593665 100644 --- a/inc/mysql-connect.php +++ b/inc/mysql-connect.php @@ -94,10 +94,8 @@ if ((empty($MySQL['login'])) && (!defined('mxchange_installing')) && (!isset($_G if ((!isBooleanConstantAndTrue('mxchange_installing')) && (isBooleanConstantAndTrue('mxchange_installed'))) { // Check for write-permission for config.php and inc directory if (empty($GLOBALS['module'])) $GLOBALS['module'] = "index"; - if (($GLOBALS['module'] != "admin") && (isBooleanConstantAndTrue('admin_registered')) && (!isset($_SERVER['WINDIR']))) { - // DEPRECATED: if (is_INCWritable("config")) ADD_FATAL(FATAL_CONFIG_WRITABLE); - // DEPRECATED: if (is_INCWritable("dummy")) ADD_FATAL(FATAL_INC_WRITABLE); - } + + // CSS array $EXT_CSS_FILES = array(); if ((!empty($MySQL['host'])) && (!empty($MySQL['login'])) && (!empty($MySQL['password'])) && (!empty($MySQL['dbase']))) { @@ -223,10 +221,10 @@ if ((!isBooleanConstantAndTrue('mxchange_installing')) && (isBooleanConstantAndT if (($installPhp != "install.php") && ($CSS != "1") && ($CSS != -1)) { // Redirect to the installation system LOAD_URL("install.php"); - } + } // END - if // Double-check installation mode - if ((!defined('mxchange_installed')) || (!defined('admin_registered'))) { + if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndTrue('admin_registered'))) { // Check for file permissions if (!is_INCWritable("config")) { ADD_FATAL(CONFIG_IS_WRITE_PROTECTED); @@ -237,7 +235,7 @@ if ((!isBooleanConstantAndTrue('mxchange_installing')) && (isBooleanConstantAndT if (!is_INCWritable(".secret/dummy")) { ADD_FATAL(SECRET_IS_WRITE_PROTECTED); } - } + } // END - if } // Any fatal messages? diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index 003589d527..2774a3ba1c 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -101,7 +101,7 @@ function CHECK_MODULE($mod) { $ret = "major"; // Check if script is installed if not return a "done" to prevent some errors - if ((!defined('mxchange_installed')) || (isBooleanConstantAndTrue('mxchange_installing')) || (!defined('admin_registered'))) return "done"; + if ((!isBooleanConstantAndTrue('mxchange_installed')) || (isBooleanConstantAndTrue('mxchange_installing')) || (!isBooleanConstantAndTrue('admin_registered'))) return "done"; // Check if cache is latest version $locked = "Y"; $hidden = "N"; $admin = "N"; $mem = "N"; $found = false; diff --git a/inc/stylesheet.php b/inc/stylesheet.php index edebd693fc..10341b96e8 100644 --- a/inc/stylesheet.php +++ b/inc/stylesheet.php @@ -43,7 +43,7 @@ $STYLES = array( ); // Add stylesheet for installation -if ((basename($_SERVER['PHP_SELF']) == "install.php") || (!defined('mxchange_installed')) || (isset($_GET['installing']))) $STYLES[] = "install.css"; +if ((basename($_SERVER['PHP_SELF']) == "install.php") || (!isBooleanConstantAndTrue('mxchange_installed')) || (isset($_GET['installing']))) $STYLES[] = "install.css"; // When no CSS output-mode is set, set it to file-output if (empty($_CONFIG['css_php'])) $_CONFIG['css_php'] = "FILE"; diff --git a/inc/theme-manager.php b/inc/theme-manager.php index b568553745..ab5cb1dbe6 100644 --- a/inc/theme-manager.php +++ b/inc/theme-manager.php @@ -63,7 +63,7 @@ function GET_CURR_THEME() { // Fix it to default $ret = "default"; } // END - if - } elseif ((!defined('mxchange_installed')) && ((isBooleanConstantAndTrue('mxchange_installing')) || ($CSS == true)) && ((!empty($_GET['theme'])) || (!empty($_POST['theme'])))) { + } 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'])); -- 2.39.2