From: <ph...@us...> - 2008-06-30 14:46:40
|
Revision: 1847 http://xoops.svn.sourceforge.net/xoops/?rev=1847&view=rev Author: phppp Date: 2008-06-30 07:46:46 -0700 (Mon, 30 Jun 2008) Log Message: ----------- Cleaning up Modified Paths: -------------- XoopsCore/trunk/upgrade/language/english/upgrade.php XoopsCore/trunk/upgrade/login.php Added Paths: ----------- XoopsCore/trunk/upgrade/cnt-2.2.x-to-2.3.0/ XoopsCore/trunk/upgrade/cnt-2.2.x-to-2.3.0/index.php XoopsCore/trunk/upgrade/cnt-2.2.x-to-2.3.0/language/ XoopsCore/trunk/upgrade/cnt-2.2.x-to-2.3.0/language/english.php Removed Paths: ------------- XoopsCore/trunk/upgrade/upd--2.2-to-2.3.0/ Added: XoopsCore/trunk/upgrade/cnt-2.2.x-to-2.3.0/index.php =================================================================== --- XoopsCore/trunk/upgrade/cnt-2.2.x-to-2.3.0/index.php (rev 0) +++ XoopsCore/trunk/upgrade/cnt-2.2.x-to-2.3.0/index.php 2008-06-30 14:46:46 UTC (rev 1847) @@ -0,0 +1,382 @@ +<?php +/* + You may not change or alter any portion of this comment or credits + of supporting developers from this source code or any supporting source code + which is considered copyrighted (c) material of the original comment or credit authors. + + 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. +*/ + +/** + * Upgrader from 2.2.* to 2.3.0 + * + * See the enclosed file license.txt for licensing information. + * If you did not receive this file, get it at http://www.fsf.org/copyleft/gpl.html + * + * @copyright The XOOPS project http://www.xoops.org/ + * @license http://www.fsf.org/copyleft/gpl.html GNU General Public License (GPL) + * @package upgrader + * @since 2.3.0 + * @author Taiwen Jiang <ph...@us...> + * @version $Id: index.php 1369 2008-03-04 02:53:55Z phppp $ + */ + +class upgrade_220 extends xoopsUpgrade +{ + var $tasks = array('config', 'profile', 'block', 'pm'); + + function upgrade_220() + { + $this->xoopsUpgrade( basename(dirname(__FILE__)) ); + } + + /** + * Check if config category already removed + * + */ + function check_config() + { + $sql = "SHOW COLUMNS FROM `" . $GLOBALS['xoopsDB']->prefix('configcategory') . "` LIKE 'confcat_modid'"; + $result = $GLOBALS['xoopsDB']->queryF($sql); + if (!$result) return true; + if ($GLOBALS['xoopsDB']->getRowsNum($result) > 0) return false; + return true; + } + + /** + * Check if user profile table already converted + * + */ + function check_profile() + { + $sql = "SHOW TABLES LIKE '" . $GLOBALS['xoopsDB']->prefix("user_profile") . "'"; + $result = $GLOBALS['xoopsDB']->queryF($sql); + if (!$result) return true; + if ($GLOBALS['xoopsDB']->getRowsNum($result) > 0) return false; + return true; + } + + /** + * Check if block table already converted + * + */ + function check_block() + { + $sql = "SHOW TABLES LIKE '" . $GLOBALS['xoopsDB']->prefix("block_instance") . "'"; + $result = $GLOBALS['xoopsDB']->queryF($sql); + if (!$result) return true; + if ($GLOBALS['xoopsDB']->getRowsNum($result) > 0) return false; + return true; + } + + /** + * Check if private message table already converted + * + */ + function check_pm() + { + $sql = "SHOW COLUMNS FROM " . $GLOBALS['xoopsDB']->prefix("priv_msgs"); + $result = $GLOBALS['xoopsDB']->queryF($sql); + if (!$result) return false; + if ($GLOBALS['xoopsDB']->getRowsNum($result) > 8) return false; + return true; + } + + function apply() + { + if (empty($_GET['upd220'])) { + $this->logs[] = _CONFIRM_UPGRADE_220; + $res = false; + } else { + $res = parent::apply(); + } + return $res; + + if (empty($_SESSION['xoops_upgrade'][__CLASS__ . '_ok'])) { + $_SESSION['xoops_upgrade'][__CLASS__ . '_ok'] = "true"; + $this->logs[] = _CONFIRM_UPGRADE_220; + $res = false; + } else { + $res = parent::apply(); + $_SESSION['xoops_upgrade'][__CLASS__ . '_ok'] = NULL; + } + return $res; + } + + function apply_config() + { + global $xoopsDB; + + $result = true; + + //Set core configuration back to zero for system module + $xoopsDB->queryF("UPDATE `" . $xoopsDB->prefix('config') . "` SET conf_modid = 0 WHERE conf_modid = 1"); + + //Change debug modes so there can only be one active at any one time + $xoopsDB->queryF("UPDATE `" . $xoopsDB->prefix('config') . "` SET conf_formtype = 'select', conf_valuetype = 'int' WHERE conf_name = 'debug_mode'"); + + //Reset category ID for non-system configs + $xoopsDB->queryF("UPDATE `" . $xoopsDB->prefix('config') . "` SET conf_catid = 0 WHERE conf_modid > 1 AND conf_catid > 0"); + + // remove admin theme configuration item + $xoopsDB->queryF("DELETE FROM `" . $xoopsDB->prefix('config') . "` WHERE conf_name='theme_set_admin'"); + + //Drop non-System config categories + $xoopsDB->queryF("DELETE FROM `" . $xoopsDB->prefix('configcategory') . "` WHERE confcat_modid > 1"); + + //Drop category information fields added in 2.2 + $xoopsDB->queryF("ALTER TABLE `" . $xoopsDB->prefix("configcategory") . "` DROP `confcat_nameid`, DROP `confcat_description`, DROP `confcat_modid`"); + + // Re-add user configuration category + $xoopsDB->queryF("INSERT INTO `" . $xoopsDB->prefix("configcategory") . "` (confcat_id, confcat_name, confcat_order) VALUES (2, '_MD_AM_USERSETTINGS', 2)"); + + //Rebuild user configuration items + //Get values from Profile module + $profile_config_arr = array(); + $module_handler = xoops_gethandler('module'); + $config_handler = xoops_gethandler('config'); + $profile_module = $module_handler->getByDirname('profile'); + if (is_object($profile_module)) { + $profile_config = $config_handler->getConfigs(new Criteria('conf_modid', $profile_module->getVar('mid'))); + foreach (array_keys($profile_config) as $i) { + $profile_config_arr[$profile_config[$i]->getVar('conf_name')] = $profile_config[$i]->getVar('conf_value', 'n'); + } + } else { + $profile_config_arr['minpass'] = 5; + $profile_config_arr['minuname'] = 3; + $profile_config_arr['new_user_notify'] = 1; + $profile_config_arr['new_user_notify_group'] = XOOPS_GROUP_ADMIN; + $profile_config_arr['activation_type'] = 0; + $profile_config_arr['activation_group'] = XOOPS_GROUP_ADMIN; + $profile_config_arr['uname_test_level'] = 0; + $profile_config_arr['avatar_allow_upload'] = 0; + $profile_config_arr['avatar_width'] = 80; + $profile_config_arr['avatar_height'] = 80; + $profile_config_arr['avatar_maxsize'] = 35000; + $profile_config_arr['self_delete'] = 0; + $profile_config_arr['bad_unames'] = serialize(array('webmaster', '^xoops', '^admin')); + $profile_config_arr['bad_emails'] = serialize(array('xoops.org$')); + $profile_config_arr['maxuname'] = 10; + $profile_config_arr['avatar_minposts'] = 0; + $profile_config_arr['allow_chgmail'] = 0; + $profile_config_arr['reg_dispdsclmr'] = 0; + $profile_config_arr['reg_disclaimer'] = ""; + $profile_config_arr['allow_register'] = 1; + } + + $xoopsDB->queryF( + "INSERT INTO `" . $xoopsDB->prefix("config") . "` (conf_modid, conf_catid, conf_name, conf_title, conf_value, conf_desc, conf_formtype, conf_valuetype, conf_order) VALUES " . + " (0, 2, 'minpass', '_MD_AM_MINPASS', " . $xoopsDB->quote($profile_config_arr['minpass']) . ", '_MD_AM_MINPASSDSC', 'textbox', 'int', 1)," . + " (0, 2, 'minuname', '_MD_AM_MINUNAME', " . $xoopsDB->quote($profile_config_arr['minuname']) . ", '_MD_AM_MINUNAMEDSC', 'textbox', 'int', 2)," . + " (0, 2, 'new_user_notify', '_MD_AM_NEWUNOTIFY', " . $xoopsDB->quote($profile_config_arr['new_user_notify']) . "', '_MD_AM_NEWUNOTIFYDSC', 'yesno', 'int', 4)," . + " (0, 2, 'new_user_notify_group', '_MD_AM_NOTIFYTO', " . $xoopsDB->quote($profile_config_arr['new_user_notify_group']) . "', '_MD_AM_NOTIFYTODSC', 'group', 'int', 6)," . + " (0, 2, 'activation_type', '_MD_AM_ACTVTYPE', " . $xoopsDB->quote($profile_config_arr['activation_type']) . ", '_MD_AM_ACTVTYPEDSC', 'select', 'int', 8)," . + " (0, 2, 'activation_group', '_MD_AM_ACTVGROUP', " . $xoopsDB->quote($profile_config_arr['activation_group']) . ", '_MD_AM_ACTVGROUPDSC', 'group', 'int', 10)," . + " (0, 2, 'uname_test_level', '_MD_AM_UNAMELVL', " . $xoopsDB->quote($profile_config_arr['uname_test_level']) . ", '_MD_AM_UNAMELVLDSC', 'select', 'int', 12)," . + " (0, 2, 'avatar_allow_upload', '_MD_AM_AVATARALLOW', " . $xoopsDB->quote($profile_config_arr['avatar_allow_upload']) . ", '_MD_AM_AVATARALWDSC', 'yesno', 'int', 14)," . + " (0, 2, 'avatar_width', '_MD_AM_AVATARW', " . $xoopsDB->quote($profile_config_arr['avatar_width']) . ", '_MD_AM_AVATARWDSC', 'textbox', 'int', 16)," . + " (0, 2, 'avatar_height', '_MD_AM_AVATARH', " . $xoopsDB->quote($profile_config_arr['avatar_height']) . ", '_MD_AM_AVATARHDSC', 'textbox', 'int', 18)," . + " (0, 2, 'avatar_maxsize', '_MD_AM_AVATARMAX', " . $xoopsDB->quote($profile_config_arr['avatar_maxsize']) . ", '_MD_AM_AVATARMAXDSC', 'textbox', 'int', 20)," . + " (0, 2, 'self_delete', '_MD_AM_SELFDELETE', " . $xoopsDB->quote($profile_config_arr['self_delete']) . ", '_MD_AM_SELFDELETEDSC', 'yesno', 'int', 22)," . + " (0, 2, 'bad_unames', '_MD_AM_BADUNAMES', " . $xoopsDB->quote($profile_config_arr['bad_unames']) . ", '_MD_AM_BADUNAMESDSC', 'textarea', 'array', 24)," . + " (0, 2, 'bad_emails', '_MD_AM_BADEMAILS', " . $xoopsDB->quote($profile_config_arr['bad_emails']) . ", '_MD_AM_BADEMAILSDSC', 'textarea', 'array', 26)," . + " (0, 2, 'maxuname', '_MD_AM_MAXUNAME', " . $xoopsDB->quote($profile_config_arr['maxuname']) . ", '_MD_AM_MAXUNAMEDSC', 'textbox', 'int', 3)," . + " (0, 2, 'avatar_minposts', '_MD_AM_AVATARMP', " . $xoopsDB->quote($profile_config_arr['avatar_minposts']) . ", '_MD_AM_AVATARMPDSC', 'textbox', 'int', 15)," . + " (0, 2, 'allow_chgmail', '_MD_AM_ALLWCHGMAIL', " . $xoopsDB->quote($profile_config_arr['allow_chgmail']) . ", '_MD_AM_ALLWCHGMAILDSC', 'yesno', 'int', 3)," . + " (0, 2, 'reg_dispdsclmr', '_MD_AM_DSPDSCLMR', " . $xoopsDB->quote($profile_config_arr['reg_dispdsclmr']) . ", '_MD_AM_DSPDSCLMRDSC', 'yesno', 'int', 30)," . + " (0, 2, 'reg_disclaimer', '_MD_AM_REGDSCLMR', " . $xoopsDB->quote($profile_config_arr['reg_disclaimer']) . ", '_MD_AM_REGDSCLMRDSC', 'textarea', 'text', 32)," . + " (0, 2, 'allow_register', '_MD_AM_ALLOWREG', " . $xoopsDB->quote($profile_config_arr['allow_register']) . ", '_MD_AM_ALLOWREGDSC', 'yesno', 'int', 0)" + ); + + //Rebuild user configuration options + $configs = $config_handler->getConfigs(new Criteria('conf_name', "('activation_type', 'uname_test_level')", "IN")); + $id_activation_type = $configs[0]->getVar("conf_id"); + $id_uname_test_level = $configs[1]->getVar("conf_id"); + $xoopsDB->queryF( + "INSERT INTO `" . $xoopsDB->prefix("configoption") . "` (confop_name, confop_value, conf_id) VALUES " . + " ('_MD_AM_USERACTV', '0', {$id_activation_type})," . + " ('_MD_AM_AUTOACTV', '1', {$id_activation_type})," . + " ('_MD_AM_ADMINACTV', '2', {$id_activation_type})," . + " ('_MD_AM_STRICT', '0', {$id_uname_test_level})," . + " ('_MD_AM_MEDIUM', '1', {$id_uname_test_level})," . + " ('_MD_AM_LIGHT', '2', {$id_uname_test_level})" + ); + + return $result; + } + + function apply_profile() + { + global $xoopsDB; + // Restore users table + $xoopsDB->queryF( + "ALTER TABLE `" . $xoopsDB->prefix("users") . "` + ADD url varchar(100) NOT NULL default '', + ADD user_regdate int(10) unsigned NOT NULL default '0', + ADD user_icq varchar(15) NOT NULL default '', + ADD user_from varchar(100) NOT NULL default '', + ADD user_sig tinytext NOT NULL, + ADD user_viewemail tinyint(1) unsigned NOT NULL default '0', + ADD actkey varchar(8) NOT NULL default '', + ADD user_aim varchar(18) NOT NULL default '', + ADD user_yim varchar(25) NOT NULL default '', + ADD user_msnm varchar(100) NOT NULL default '', + ADD posts mediumint(8) unsigned NOT NULL default '0', + ADD attachsig tinyint(1) unsigned NOT NULL default '0', + ADD theme varchar(100) NOT NULL default '', + ADD timezone_offset float(3,1) NOT NULL default '0.0', + ADD last_login int(10) unsigned NOT NULL default '0', + ADD umode varchar(10) NOT NULL default '', + ADD uorder tinyint(1) unsigned NOT NULL default '0', + ADD notify_method tinyint(1) NOT NULL default '1', + ADD notify_mode tinyint(1) NOT NULL default '0', + ADD user_occ varchar(100) NOT NULL default '', + ADD bio tinytext NOT NULL, + ADD user_intrest varchar(150) NOT NULL default '', + ADD user_mailok tinyint(1) unsigned NOT NULL default '1' + " + ); + + // Copy data from profile table + $profile_fields = array("url", "user_regdate", "user_icq", "user_from", "user_sig", "user_viewemail", "actkey", "user_aim", "user_yim", "user_msnm", "posts", "attachsig", "theme", "timezone_offset", "last_login", "umode", "uorder", "notify_method", "notify_mode", "user_occ", "bio", "user_intrest", "user_mailok"); + foreach ($profile_fields as $field) { + $xoopsDB->queryF("UPDATE `" . $xoopsDB->prefix("users") . "` u, `" . $xoopsDB->prefix("user_profile") . "` p SET u.{$field} = p.{$field} WHERE u.uid=p.profileid"); + } + //Set loginname as uname + $xoopsDB->queryF("UPDATE `" . $xoopsDB->prefix("users") . "` SET uname=loginname"); + + //Drop loginname + $xoopsDB->queryF("ALTER TABLE " . $xoopsDB->prefix("users") . " DROP loginname"); + + // Drop user profile table + $xoopsDB->queryF("DROP TABLE " . $xoopsDB->prefix("user_profile")); + + // Drop user profile field table + $xoopsDB->queryF("DROP TABLE " . $xoopsDB->prefix("user_profile_field")); + + return true; + } + + function apply_block() + { + global $xoopsDB; + $xoopsDB->queryF("UPDATE " . $xoopsDB->prefix("block_module_link") . " SET module_id = -1, pageid = 0 WHERE module_id < 2 AND pageid = 1"); + + //Change block module link to remove pages + //Remove page links for module subpages + $xoopsDB->queryF("DELETE FROM " . $xoopsDB->prefix("block_module_link") . " WHERE pageid > 0"); + + //Drop primary key since it includes pageid + $xoopsDB->queryF("ALTER TABLE " . $xoopsDB->prefix("block_module_link") . " DROP PRIMARY KEY"); + + //Drop pageid field + $xoopsDB->queryF("ALTER TABLE " . $xoopsDB->prefix("block_module_link") . " DROP pageid"); + + // Recreate primary key + $xoopsDB->queryF("ALTER TABLE " . $xoopsDB->prefix("block_module_link") . " ADD PRIMARY KEY (`block_id` , `module_id`)"); + + // Create new block table + $sql = "CREATE TABLE " . $xoopsDB->prefix("newblocks_xoops230") . " ( + bid mediumint(8) unsigned NOT NULL auto_increment, + mid smallint(5) unsigned NOT NULL default '0', + func_num tinyint(3) unsigned NOT NULL default '0', + options varchar(255) NOT NULL default '', + name varchar(150) NOT NULL default '', + title varchar(255) NOT NULL default '', + content text NOT NULL, + side tinyint(1) unsigned NOT NULL default '0', + weight smallint(5) unsigned NOT NULL default '0', + visible tinyint(1) unsigned NOT NULL default '0', + block_type char(1) NOT NULL default '', + c_type char(1) NOT NULL default '', + isactive tinyint(1) unsigned NOT NULL default '0', + dirname varchar(50) NOT NULL default '', + func_file varchar(50) NOT NULL default '', + show_func varchar(50) NOT NULL default '', + edit_func varchar(50) NOT NULL default '', + template varchar(50) NOT NULL default '', + bcachetime int(10) unsigned NOT NULL default '0', + last_modified int(10) unsigned NOT NULL default '0', + PRIMARY KEY (bid), + KEY mid (mid), + KEY visible (visible), + KEY isactive_visible_mid (isactive,visible,mid), + KEY mid_funcnum (mid,func_num) + ) TYPE=MyISAM; + "; + $xoopsDB->queryF($sql); + + // Copy data from block instance table and blocks table + $sql = " INSERT INTO " . $xoopsDB->prefix("newblocks_xoops230") . + " (bid, mid, options, name, title, side, weight, visible, " . + " block_type, ". + " isactive, dirname, func_file,". + " show_func, edit_func, template, bcachetime, last_modified)". + " SELECT " . + " i.instanceid, c.mid, i.options, c.name, i.title, i.side, i.weight, i.visible, ". + " CASE WHEN c.show_func='b_system_custom_show' THEN 'C' WHEN c.mid = 1 THEN 'S' ELSE 'M' END,". + " c.isactive, c.dirname, c.func_file,". + " c.show_func, c.edit_func, c.template, i.bcachetime, c.last_modified". + " FROM " . $xoopsDB->prefix("block_instance") . " AS i," . + " " . $xoopsDB->prefix("newblocks") . " AS c" . + " WHERE i.bid = c.bid" . + " ORDER BY i.instanceid ASC"; + $xoopsDB->queryF($sql); + + // Dealing with tables + $xoopsDB->queryF("DROP TABLE `" . $xoopsDB->prefix("block_instance") . "`;"); + $xoopsDB->queryF("DROP TABLE `" . $xoopsDB->prefix("newblocks") . "`;"); + $xoopsDB->queryF("RENAME TABLE `" . $xoopsDB->prefix("newblocks_xoops230") . "` TO `" . $xoopsDB->prefix("newblocks") . "`;"); + + // Deal with custom blocks, convert options to type and content + $sql = "SELECT bid, options FROM `" . $xoopsDB->prefix("newblocks") . "` WHERE show_func='b_system_custom_show'"; + $result = $xoopsDB->query($sql); + while (list($bid, $options) = $xoopsDB->fetchRow($result)) { + $_options = unserialize($options); + $content = $_options[0]; + $type = $_options[1]; + $xoopsDB->queryF("UPDATE `" . $xoopsDB->prefix("newblocks") . "` SET c_type = '{$type}', options = '', content = " . $xoopsDB->quote($content) . " WHERE bid = {$bid}"); + } + + // Deal with block options, convert array values to "," and "|" delimited + $sql = "SELECT bid, options FROM `" . $xoopsDB->prefix("newblocks") . "` WHERE show_func <> 'b_system_custom_show' AND options <> ''"; + $result = $xoopsDB->query($sql); + while (list($bid, $_options) = $xoopsDB->fetchRow($result)) { + $options = unserialize($_options); + if (empty($options) || !is_array($options)) $options = array(); + $count = count($options); + //Convert array values to comma-separated + for ($i = 0; $i < $count; $i++) { + if (is_array($options[$i])) { + $options[$i] = implode(',', $options[$i]); + } + } + $options = implode('|', $options); + $sql = "UPDATE `" . $xoopsDB->prefix("newblocks") . "` SET options = " . $xoopsDB->quote($options) . " WHERE bid = {$bid}"; + $xoopsDB->queryF($sql); + } + + return true; + } + + function apply_pm() + { + global $xoopsDB; + $sql = "ALTER TABLE `" . $xoopsDB->prefix("priv_msgs") . "` + DROP `from_delete`, + DROP `to_delete`, + DROP `to_save`, + DROP `from_save`; + "; + $xoopsDB->queryF($sql); + + return true; + } +} + +$upg = new upgrade_220(); +return $upg; + +?> Added: XoopsCore/trunk/upgrade/cnt-2.2.x-to-2.3.0/language/english.php =================================================================== --- XoopsCore/trunk/upgrade/cnt-2.2.x-to-2.3.0/language/english.php (rev 0) +++ XoopsCore/trunk/upgrade/cnt-2.2.x-to-2.3.0/language/english.php 2008-06-30 14:46:46 UTC (rev 1847) @@ -0,0 +1,11 @@ +<?php +// $Id$ + +define( "_CONFIRM_UPGRADE_220", " +At this moment the upgrade scripts will discard all profile fields that are not defined in XOOPS 2.0 or 2.3 series.<br /> +You are highly recommended to make a full backup of your database and XOOPS code before performing the upgrade.<br /> +Please make sure you fully understand this and its consequences.<br /><br /> +To cancel the upgrade, <a href='index.php'>click here</a>.<br /> +Or to <a href='index.php?action=next&upd220=ok'>proceed</a>. +"); +?> \ No newline at end of file Modified: XoopsCore/trunk/upgrade/language/english/upgrade.php =================================================================== --- XoopsCore/trunk/upgrade/language/english/upgrade.php 2008-06-29 10:57:28 UTC (rev 1846) +++ XoopsCore/trunk/upgrade/language/english/upgrade.php 2008-06-30 14:46:46 UTC (rev 1847) @@ -1,5 +1,5 @@ <?php -// $Id: upgrade.php 558 2006-06-20 06:35:23Z skalpa $ +// $Id$ define( "_XOOPS_UPGRADE", "XOOPS system upgrade" ); define( "_CHECKING_APPLIED", "Checking applied upgrades:" ); Modified: XoopsCore/trunk/upgrade/login.php =================================================================== --- XoopsCore/trunk/upgrade/login.php 2008-06-29 10:57:28 UTC (rev 1846) +++ XoopsCore/trunk/upgrade/login.php 2008-06-30 14:46:46 UTC (rev 1847) @@ -1,10 +1,11 @@ <?php -require '../mainfile.php'; -if (empty($_POST['uname']) || empty($_POST['pass'])) { +defined("XOOPS_ROOT_PATH") OR DIE(); + +if (empty($_POST['uname']) || empty($_POST['pass'])) { ?> <h2><?php echo _USER_LOGIN; ?></h2> -<form action="<?php echo XOOPS_URL; ?>/upgrade/login.php?op=login" method="post"> +<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <div class="xo-formfield required"> <label><?php echo _USERNAME; ?></label> <input type="text" name="uname" size="26" maxlength="25" value="" /> @@ -19,7 +20,7 @@ </div> <input type="hidden" name="xoops_redirect" value="/upgrade/index.php" /> </form> -<?php +<?php } else { $uname = !isset($_POST['uname']) ? '' : trim($_POST['uname']); @@ -36,13 +37,12 @@ $isAllowed = false; if (is_object($user) && $user->getVar('level') > 0) { $isAllowed = true; - } - if ($isAllowed && $xoopsConfig['closesite'] == 1) { - $isAllowed = false; - foreach ($user->getGroups() as $group) { - if (in_array($group, $xoopsConfig['closesite_okgrp']) || XOOPS_GROUP_ADMIN == $group) { + if ($xoopsConfig['closesite'] == 1) { + $groups = $user->getGroups(); + if (in_array(XOOPS_GROUP_ADMIN, $groups) || array_intersect($groups, $xoopsConfig['closesite_okgrp'])) { $isAllowed = true; - break; + } else { + $isAllowed = false; } } } @@ -71,5 +71,6 @@ } header("location: " . XOOPS_URL . "/upgrade/index.php"); + exit(); } ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |