From: <tr...@us...> - 2011-11-19 16:27:58
|
Revision: 8312 http://xoops.svn.sourceforge.net/xoops/?rev=8312&view=rev Author: trabis Date: 2011-11-19 16:27:49 +0000 (Sat, 19 Nov 2011) Log Message: ----------- Do some cleaning on @package Adding registry class (borrowed from Zend) so modules can avoid using GLOBALS. Modified Paths: -------------- XoopsCore/branches/2.6.x/2.6.0/htdocs/class/database/databasefactory.php XoopsCore/branches/2.6.x/2.6.0/htdocs/class/preload.php XoopsCore/branches/2.6.x/2.6.0/htdocs/class/theme.php XoopsCore/branches/2.6.x/2.6.0/htdocs/class/userutility.php XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/form.php XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsload.php XoopsCore/branches/2.6.x/2.6.0/htdocs/include/common.php XoopsCore/branches/2.6.x/2.6.0/htdocs/kernel/object.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/activate.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/category.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/field.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/permissions.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/step.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/user.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/visibility.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/changemail.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/changepass.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/class/category.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/class/field.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/class/profile.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/class/visibility.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/edituser.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/footer.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/header.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/include/forms.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/include/install.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/include/update.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/index.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/lostpass.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/preloads/core.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/register.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/search.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/user.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/userinfo.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/xoops_version.php Added Paths: ----------- XoopsCore/branches/2.6.x/2.6.0/htdocs/class/registry.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/class/form/ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/class/form/category.php XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/class/form/index.html Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/class/database/databasefactory.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/class/database/databasefactory.php 2011-11-19 16:20:16 UTC (rev 8311) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/class/database/databasefactory.php 2011-11-19 16:27:49 UTC (rev 8312) @@ -21,13 +21,6 @@ defined('XOOPS_ROOT_PATH') or die('Restricted access'); -/** - * XoopsDatabaseFactory - * - * @package Kernel - * @author Kazumi Ono <on...@xo...> - * @access public - */ class XoopsDatabaseFactory { Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/class/preload.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/class/preload.php 2011-11-19 16:20:16 UTC (rev 8311) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/class/preload.php 2011-11-19 16:27:49 UTC (rev 8312) @@ -106,7 +106,7 @@ { foreach ($this->_preloads as $preload) { include_once XOOPS_ROOT_PATH . '/modules/' . $preload['module'] . '/preloads/' . $preload['file']. '.php'; - $class_name = ucfirst($preload['module']) . ucfirst($preload['file']) . 'Preload' ; + $class_name = ucfirst($preload['module']) . ucfirst($preload['file']) . 'Preload'; if (!class_exists($class_name)) { continue; } Added: XoopsCore/branches/2.6.x/2.6.0/htdocs/class/registry.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/class/registry.php (rev 0) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/class/registry.php 2011-11-19 16:27:49 UTC (rev 8312) @@ -0,0 +1,210 @@ +<?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. +*/ + +/** + * Registry + * + * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @package class + * @since 2.6.0 + * @author trabis <lus...@gm...> + * @version $Id:$ + */ + +defined('XOOPS_ROOT_PATH') or die('Restricted access'); + +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to li...@ze... so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Registry + * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class XoopsRegistry extends ArrayObject +{ + /** + * Class name of the singleton registry object. + * @var string + */ + private static $_registryClassName = 'XoopsRegistry'; + + /** + * Registry object provides storage for shared objects. + * @var XoopsRegistry + */ + private static $_registry = null; + + /** + * Retrieves the default registry instance. + * + * @return XoopsRegistry + */ + public static function getInstance() + { + if (self::$_registry === null) { + self::init(); + } + + return self::$_registry; + } + + /** + * Set the default registry instance to a specified instance. + * + * @param XoopsRegistry $registry An object instance of type XoopsRegistry, + * or a subclass. + * @return void + * @throws Zend_Exception if registry is already initialized. + */ + public static function setInstance(XoopsRegistry $registry) + { + if (self::$_registry !== null) { + trigger_error('Registry is already initialized'); + } + + self::setClassName(get_class($registry)); + self::$_registry = $registry; + } + + /** + * Initialize the default registry instance. + * + * @return void + */ + protected static function init() + { + self::setInstance(new self::$_registryClassName()); + } + + /** + * Set the class name to use for the default registry instance. + * Does not affect the currently initialized instance, it only applies + * for the next time you instantiate. + * + * @param string $registryClassName + * @return void + * @throws Zend_Exception if the registry is initialized or if the + * class name is not valid. + */ + public static function setClassName($registryClassName = 'XoopsRegistry') + { + if (self::$_registry !== null) { + trigger_error('Registry is already initialized'); + } + + if (!is_string($registryClassName)) { + trigger_error("Argument is not a class name"); + } + + self::$_registryClassName = $registryClassName; + } + + /** + * Unset the default registry instance. + * Primarily used in tearDown() in unit tests. + * @returns void + */ + public static function _unsetInstance() + { + self::$_registry = null; + } + + /** + * getter method, basically same as offsetGet(). + * + * This method can be called from an object of type Zend_Registry, or it + * can be called statically. In the latter case, it uses the default + * static instance stored in the class. + * + * @param string $index - get the value associated with $index + * @return mixed + * @throws Zend_Exception if no entry is registered for $index. + */ + public static function get($index) + { + $instance = self::getInstance(); + + if (!$instance->offsetExists($index)) { + trigger_error("No entry is registered for key '$index'"); + } + + return $instance->offsetGet($index); + } + + /** + * setter method, basically same as offsetSet(). + * + * This method can be called from an object of type Zend_Registry, or it + * can be called statically. In the latter case, it uses the default + * static instance stored in the class. + * + * @param string $index The location in the ArrayObject in which to store + * the value. + * @param mixed $value The object to store in the ArrayObject. + * @return void + */ + public static function set($index, $value) + { + $instance = self::getInstance(); + $instance->offsetSet($index, $value); + } + + /** + * Returns TRUE if the $index is a named value in the registry, + * or FALSE if $index was not found in the registry. + * + * @param string $index + * @return boolean + */ + public static function isRegistered($index) + { + if (self::$_registry === null) { + return false; + } + return self::$_registry->offsetExists($index); + } + + /** + * Constructs a parent ArrayObject with default + * ARRAY_AS_PROPS to allow access as an object + * + * @param array $array data array + * @param integer $flags ArrayObject flags + */ + public function __construct($array = array(), $flags = parent::ARRAY_AS_PROPS) + { + parent::__construct($array, $flags); + } + + /** + * @param string $index + * @return mixed + * + * Workaround for http://bugs.php.net/bug.php?id=40442 (ZF-960). + */ + public function offsetExists($index) + { + return array_key_exists($index, $this); + } + +} Property changes on: XoopsCore/branches/2.6.x/2.6.0/htdocs/class/registry.php ___________________________________________________________________ Added: svn:executable + * Added: svn:keywords + Author Date Id Rev URL Added: svn:eol-style + native Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/class/theme.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/class/theme.php 2011-11-19 16:20:16 UTC (rev 8311) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/class/theme.php 2011-11-19 16:27:49 UTC (rev 8312) @@ -465,8 +465,7 @@ //Get meta information for cached pages if ($this->contentCacheLifetime && $this->contentCacheId && $content = $cache->read($this->contentCacheId, $this->headersCacheEngine)) { - //print_R($content); - //we need to merge metas set by blocks ) with the module cached meta + //we need to merge metas set by blocks with the module cached meta $this->htmlHeadStrings = array_merge($this->htmlHeadStrings, $content['htmlHeadStrings']); foreach ($content['metas'] as $type => $value) { $this->metas[$type] = array_merge($this->metas[$type], $content['metas'][$type]); @@ -504,7 +503,6 @@ // We assume no overlap between $GLOBALS['xoopsOption']['xoops_module_header'] and $this->template->get_template_vars( 'xoops_module_header' ) ? $this->template->assign('xoops_module_header', $this->renderMetas(null, true) . "\n" . $header); - if ($canvasTpl) { $this->canvasTemplate = $canvasTpl; } Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/class/userutility.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/class/userutility.php 2011-11-19 16:20:16 UTC (rev 8311) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/class/userutility.php 2011-11-19 16:27:49 UTC (rev 8312) @@ -22,12 +22,6 @@ defined('XOOPS_ROOT_PATH') or die('Restricted access'); -/** - * XoopsUserUtility - * - * @package Kernel - * @author Taiwen Jiang <ph...@us...> - */ class XoopsUserUtility { /** Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/form.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/form.php 2011-11-19 16:20:16 UTC (rev 8311) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsform/form.php 2011-11-19 16:27:49 UTC (rev 8312) @@ -140,6 +140,15 @@ } /** + * @param string $value + * @return void + */ + public function setAction($value = '') + { + $this->_action = $value; + } + + /** * get the "action" attribute for the <form> tag * * @param bool $encode To sanitizer the text? Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsload.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsload.php 2011-11-19 16:20:16 UTC (rev 8311) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/class/xoopsload.php 2011-11-19 16:27:49 UTC (rev 8312) @@ -324,6 +324,7 @@ 'xoopsprivmessagehandler' => XOOPS_ROOT_PATH . '/kernel/privmessage.php', 'xoopsranks' => XOOPS_ROOT_PATH . '/kernel/ranks.php', 'xoopsrankshandler' => XOOPS_ROOT_PATH . '/kernel/ranks.php', + 'xoopsregistry' => XOOPS_ROOT_PATH . '/class/registry.php', 'xoopssecurity' => XOOPS_ROOT_PATH . '/class/xoopssecurity.php', 'xoopssessionhandler' => XOOPS_ROOT_PATH . '/kernel/session.php', 'xoopssimpleform' => XOOPS_ROOT_PATH . '/class/xoopsform/simpleform.php', Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/include/common.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/include/common.php 2011-11-19 16:20:16 UTC (rev 8311) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/include/common.php 2011-11-19 16:27:49 UTC (rev 8312) @@ -41,19 +41,14 @@ */ require_once XOOPS_ROOT_PATH . DS . 'class' . DS . 'xoopsload.php'; + /** - * YOU SHOULD BE CAREFUL WITH THE PRELOAD METHODS IN 2.4*, THEY WILL BE DEPRECATED AND IMPLEMENTED IN A DIFFERENT WAY - */ -/** * Create Instance of Preload Object */ $xoopsPreload = XoopsPreload::getInstance(); $xoopsPreload->triggerEvent('core.include.common.start'); /** - * YOU SHOULD BE CAREFUL WITH THE {@Xoops}, MOST METHODS WILL BE DEPRECATED - */ -/** * Create Instance of Xoops Object * Atention, not all methods can be used at this point */ @@ -64,7 +59,7 @@ $xoops->option =& $GLOBALS['xoopsOption']; /** - * Create Instance of xoopsSecurity Object and check Superglobals + * Create Instance of xoopsSecurity Object and check super globals */ $xoops->security = new XoopsSecurity(); $xoops->security->checkSuperglobals(); @@ -239,9 +234,6 @@ } /** - * YOU SHOULD NEVER USE THE FOLLOWING METHOD, IT WILL BE REMOVED - */ -/** * Theme Selection */ $xoops->themeSelect(); @@ -301,9 +293,6 @@ $xoopsUserIsAdmin =& $xoops->userIsAdmin; $xoopsModuleConfig =& $xoops->moduleConfig; -/** - * YOU SHOULD AVOID USING THE FOLLOWING FUNCTION, IT WILL BE REMOVED - */ //Creates 'system_modules_active' cache file if it has been deleted. $xoops->getActiveModules(); Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/kernel/object.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/kernel/object.php 2011-11-19 16:20:16 UTC (rev 8311) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/kernel/object.php 2011-11-19 16:27:49 UTC (rev 8312) @@ -777,9 +777,8 @@ * @author Taiwen Jiang <ph...@us...> * @author Jan Keller Pedersen <mit...@xo...> * @copyright copyright (c) The XOOPS project - * @package Kernel + * @package kernel */ - class XoopsPersistableObjectHandler extends XoopsObjectHandler { /** Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/activate.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/activate.php 2011-11-19 16:20:16 UTC (rev 8311) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/activate.php 2011-11-19 16:27:49 UTC (rev 8312) @@ -1,14 +1,17 @@ <?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. +*/ + /** * Extended User Profile * - * 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. - * * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * @package profile @@ -20,7 +23,6 @@ include dirname(__FILE__) . DIRECTORY_SEPARATOR . 'header.php'; $xoops = Xoops::getInstance(); - $xoops->loadLanguage('admin'); $xoops->header(); @@ -35,28 +37,27 @@ $thisuser = $member_handler->getUser($id); if (!is_object($thisuser)) { $xoops->redirect(XOOPS_URL, 1, ''); - exit(); } if ($thisuser->getVar('actkey') != $actkey) { $xoops->redirect(XOOPS_URL . '/', 5, _US_ACTKEYNOT); } else { if ($thisuser->getVar('level') > 0) { - $xoops->redirect(XOOPS_URL . '/modules/' . $GLOBALS['xoopsModule']->getVar('dirname', 'n'). '/index.php', 5, _US_ACONTACT, false); + $xoops->redirect(XOOPS_URL . '/modules/' . $xoops->module->getVar('dirname', 'n'). '/index.php', 5, _US_ACONTACT, false); } else { if (false != $member_handler->activateUser($thisuser)) { - $GLOBALS['xoopsConfigUser'] = $xoops->getConfigs(XOOPS_CONF_USER); - if ($GLOBALS['xoopsConfigUser']['activation_type'] == 2) { + $xoops->getConfigs(XOOPS_CONF_USER); + if ($xoops->getConfig('activation_type') == 2) { $myts = MyTextSanitizer::getInstance(); $xoopsMailer = $xoops->getMailer(); $xoopsMailer->useMail(); $xoopsMailer->setTemplate('activated.tpl'); - $xoopsMailer->assign('SITENAME', $GLOBALS['xoopsConfig']['sitename']); - $xoopsMailer->assign('ADMINMAIL', $GLOBALS['xoopsConfig']['adminmail']); + $xoopsMailer->assign('SITENAME', $xoops->getConfig('sitename')); + $xoopsMailer->assign('ADMINMAIL', $xoops->getConfig('adminmail')); $xoopsMailer->assign('SITEURL', XOOPS_URL . "/"); $xoopsMailer->setToUsers($thisuser); - $xoopsMailer->setFromEmail($GLOBALS['xoopsConfig']['adminmail']); - $xoopsMailer->setFromName($GLOBALS['xoopsConfig']['sitename']); - $xoopsMailer->setSubject(sprintf(_US_YOURACCOUNT, $GLOBALS['xoopsConfig']['sitename']) ); + $xoopsMailer->setFromEmail($xoops->getConfig('adminmail')); + $xoopsMailer->setFromName($xoops->getConfig('sitename')); + $xoopsMailer->setSubject(sprintf(_US_YOURACCOUNT, $xoops->getConfig('sitename'))); $xoops->footer(); if (!$xoopsMailer->send()) { printf(_US_ACTVMAILNG, $thisuser->getVar('uname') ); @@ -73,7 +74,7 @@ } } // Not implemented yet: re-send activiation code -} else if (!empty($_REQUEST['email']) && $xoopsConfigUser['activation_type'] != 0) { +} else if (!empty($_REQUEST['email']) && $xoops->getConfig('activation_type') != 0) { $myts = MyTextSanitizer::getInstance(); $member_handler = $xoops->getHandlerMember(); $getuser = $member_handler->getUsers(new Criteria('email', $myts->addSlashes(trim($_REQUEST['email'])))); @@ -81,17 +82,17 @@ $xoops->redirect(XOOPS_URL, 2, _US_SORRYNOTFOUND); } if ($getuser[0]->isActive()) { - $xoops->redirect(XOOPS_URL, 2, sprintf(_US_USERALREADYACTIVE, $getuser[0]->getVar('email'))); + $xoops->redirect(XOOPS_URL, 2, sprintf(_US_ACONTACT, $getuser[0]->getVar('email'))); } $xoopsMailer = $xoops->getMailer(); $xoopsMailer->useMail(); $xoopsMailer->setTemplate('register.tpl'); - $xoopsMailer->assign('SITENAME', $GLOBALS['xoopsConfig']['sitename']); - $xoopsMailer->assign('ADMINMAIL', $GLOBALS['xoopsConfig']['adminmail']); + $xoopsMailer->assign('SITENAME', $xoops->getConfig('sitename')); + $xoopsMailer->assign('ADMINMAIL', $xoops->getConfig('adminmail')); $xoopsMailer->assign('SITEURL', XOOPS_URL . "/"); $xoopsMailer->setToUsers($getuser[0]); - $xoopsMailer->setFromEmail($GLOBALS['xoopsConfig']['adminmail']); - $xoopsMailer->setFromName($GLOBALS['xoopsConfig']['sitename']); + $xoopsMailer->setFromEmail($xoops->getConfig('adminmail')); + $xoopsMailer->setFromName($xoops->getConfig('sitename')); $xoopsMailer->setSubject(sprintf(_US_USERKEYFOR, $getuser[0]->getVar('uname') )); if (!$xoopsMailer->send()) { echo _US_YOURREGMAILNG; @@ -105,6 +106,5 @@ $form->display(); } -$xoBreadcrumbs[] = array('title' => _PROFILE_MA_REGISTER); -include dirname(__FILE__) . DIRECTORY_SEPARATOR . 'footer.php'; -?> \ No newline at end of file +$xoops->appendConfig('profile_breadcrumbs', array('title' => _PROFILE_MA_REGISTER)); +include dirname(__FILE__) . DIRECTORY_SEPARATOR . 'footer.php'; \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/category.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/category.php 2011-11-19 16:20:16 UTC (rev 8311) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/category.php 2011-11-19 16:27:49 UTC (rev 8312) @@ -41,7 +41,7 @@ $criteria = new CriteriaCompo(); $criteria->setSort('cat_weight'); $criteria->setOrder('ASC'); - $GLOBALS['xoopsTpl']->assign('categories', $handler->getObjects($criteria, true, false) ); + $xoops->tpl->assign('categories', $handler->getObjects($criteria, true, false) ); $template_main = "profile_admin_categorylist.html"; break; @@ -97,7 +97,7 @@ break; } if ( isset($template_main) ) { - $GLOBALS['xoopsTpl']->display("module:profile|{$template_main}"); + $xoops->tpl->display("module:profile|{$template_main}"); } xoops_cp_footer(); ?> \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/field.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/field.php 2011-11-19 16:20:16 UTC (rev 8311) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/field.php 2011-11-19 16:27:49 UTC (rev 8312) @@ -43,7 +43,7 @@ $categories[$cats[$i]->getVar('cat_id')] = $cats[$i]->getVar('cat_title'); } } - $GLOBALS['xoopsTpl']->assign('categories', $categories); + $xoops->tpl->assign('categories', $categories); unset($categories); $valuetypes = array(XOBJ_DTYPE_ARRAY => _PROFILE_AM_ARRAY, XOBJ_DTYPE_EMAIL => _PROFILE_AM_EMAIL, @@ -86,8 +86,8 @@ array_multisort($weights[$i], SORT_ASC, array_keys($categories[$i]), SORT_ASC, $categories[$i]); } ksort($categories); - $GLOBALS['xoopsTpl']->assign('fieldcategories', $categories); - $GLOBALS['xoopsTpl']->assign('token', $GLOBALS['xoopsSecurity']->getTokenHTML() ); + $xoops->tpl->assign('fieldcategories', $categories); + $xoops->tpl->assign('token', $GLOBALS['xoopsSecurity']->getTokenHTML() ); $template_main = "profile_admin_fieldlist.html"; break; @@ -159,7 +159,7 @@ } else { $obj = $profilefield_handler->create(); $obj->setVar('field_name', $_REQUEST['field_name']); - $obj->setVar('field_moduleid', $GLOBALS['xoopsModule']->getVar('mid') ); + $obj->setVar('field_moduleid', $xoops->module->getVar('mid') ); $obj->setVar('field_show', 1); $obj->setVar('field_edit', 1); $obj->setVar('field_config', 1); @@ -232,7 +232,7 @@ foreach ($perm_arr as $perm ) { $criteria = new CriteriaCompo(new Criteria('gperm_name', $perm) ); $criteria->add(new Criteria('gperm_itemid', intval($obj->getVar('field_id') )) ); - $criteria->add(new Criteria('gperm_modid', intval($GLOBALS['xoopsModule']->getVar('mid') )) ); + $criteria->add(new Criteria('gperm_modid', intval($xoops->module->getVar('mid') )) ); if ( isset($_REQUEST[$perm]) && is_array($_REQUEST[$perm]) ) { $perms = $groupperm_handler->getObjects($criteria); if ( count($perms) > 0 ) { @@ -248,7 +248,7 @@ $perm_obj = $groupperm_handler->create(); $perm_obj->setVar('gperm_name', $perm); $perm_obj->setVar('gperm_itemid', intval($obj->getVar('field_id') )); - $perm_obj->setVar('gperm_modid', $GLOBALS['xoopsModule']->getVar('mid') ); + $perm_obj->setVar('gperm_modid', $xoops->module->getVar('mid') ); $perm_obj->setVar('gperm_groupid', $groupid); $groupperm_handler->insert($perm_obj); unset($perm_obj); @@ -297,7 +297,7 @@ } if ( isset($template_main) ) { - $GLOBALS['xoopsTpl']->display("module:profile|{$template_main}"); + $xoops->tpl->display("module:profile|{$template_main}"); } xoops_cp_footer(); ?> \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/permissions.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/permissions.php 2011-11-19 16:20:16 UTC (rev 8311) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/permissions.php 2011-11-19 16:27:49 UTC (rev 8312) @@ -63,7 +63,7 @@ $opform->addElement($op_select); $opform->display(); -$module_id = $GLOBALS['xoopsModule']->getVar('mid'); +$module_id = $xoops->module->getVar('mid'); $form = new XoopsGroupPermForm($title_of_form, $module_id, $perm_name, $perm_desc, 'admin/permissions.php', $anonymous); if ( $op == "access" ) { Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/step.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/step.php 2011-11-19 16:20:16 UTC (rev 8311) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/step.php 2011-11-19 16:27:49 UTC (rev 8312) @@ -25,7 +25,7 @@ $handler = $xoops->getModuleHandler('regstep'); switch ($op ) { case "list": - $GLOBALS['xoopsTpl']->assign('steps', $handler->getObjects(null, true, false) ); + $xoops->tpl->assign('steps', $handler->getObjects(null, true, false) ); $template_main = "profile_admin_steplist.html"; break; @@ -76,7 +76,7 @@ } if ( !empty($template_main) ) { - $GLOBALS['xoopsTpl']->display("module:profile|{$template_main}"); + $xoops->tpl->display("module:profile|{$template_main}"); } xoops_cp_footer(); Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/user.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/user.php 2011-11-19 16:20:16 UTC (rev 8311) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/user.php 2011-11-19 16:27:49 UTC (rev 8312) @@ -23,36 +23,36 @@ xoops_cp_header(); $op = isset($_REQUEST['op']) ? $_REQUEST['op'] : 'list'; -if ( $op == "editordelete" ) { +if ($op == "editordelete") { $op = isset($_REQUEST['delete']) ? "delete" : "edit"; } $handler = $xoops->getHandlerMember(); -switch($op ) { +switch ($op) { default: case "list": $form = new XoopsThemeForm(_PROFILE_AM_EDITUSER, 'form', 'user.php'); - $form->addElement(new XoopsFormSelectUser(_PROFILE_AM_SELECTUSER, 'id') ); - $form->addElement(new XoopsFormHidden('op', 'editordelete') ); + $form->addElement(new XoopsFormSelectUser(_PROFILE_AM_SELECTUSER, 'id')); + $form->addElement(new XoopsFormHidden('op', 'editordelete')); $button_tray = new XoopsFormElementTray(''); - $button_tray->addElement(new XoopsFormButton('', 'edit', _EDIT, 'submit') ); - $button_tray->addElement(new XoopsFormButton('', 'delete', _DELETE, 'submit') ); + $button_tray->addElement(new XoopsFormButton('', 'edit', _EDIT, 'submit')); + $button_tray->addElement(new XoopsFormButton('', 'delete', _DELETE, 'submit')); $form->addElement($button_tray); $form->display(); case "new": - $xoops->loadLanguage("main", $GLOBALS['xoopsModule']->getVar('dirname', 'n') ); + $xoops->loadLanguage("main", $xoops->module->getVar('dirname', 'n')); include_once '../include/forms.php'; $obj = $handler->createUser(); - $obj->setGroups(array(XOOPS_GROUP_USERS) ); + $obj->setGroups(array(XOOPS_GROUP_USERS)); $form = profile_getUserForm($obj); $form->display(); break; case "edit": - $xoops->loadLanguage("main", $GLOBALS['xoopsModule']->getVar('dirname', 'n') ); + $xoops->loadLanguage("main", $xoops->module->getVar('dirname', 'n')); $obj = $handler->getUser($_REQUEST['id']); - if ( in_array(XOOPS_GROUP_ADMIN, $obj->getGroups() ) && !in_array(XOOPS_GROUP_ADMIN, $GLOBALS['xoopsUser']->getGroups() ) ) { + if (in_array(XOOPS_GROUP_ADMIN, $obj->getGroups()) && !in_array(XOOPS_GROUP_ADMIN, $xoops->user->getGroups())) { // If not webmaster trying to edit a webmaster - disallow $xoops->redirect("user.php", 3, _US_NOEDITRIGHT); } @@ -62,9 +62,9 @@ break; case "save": - $xoops->loadLanguage("main", $GLOBALS['xoopsModule']->getVar('dirname', 'n') ); - if ( !$GLOBALS['xoopsSecurity']->check() ) { - $xoops->redirect('user.php', 3, _US_NOEDITRIGHT . "<br />" . implode('<br />', $GLOBALS['xoopsSecurity']->getErrors() )); + $xoops->loadLanguage("main", $xoops->module->getVar('dirname', 'n')); + if (!$GLOBALS['xoopsSecurity']->check()) { + $xoops->redirect('user.php', 3, _US_NOEDITRIGHT . "<br />" . implode('<br />', $GLOBALS['xoopsSecurity']->getErrors())); exit; } @@ -75,61 +75,64 @@ $userfields = $profile_handler->getUserVars(); // Get ids of fields that can be edited $gperm_handler = $xoops->getHandlerGroupperm(); - $editable_fields = $gperm_handler->getItemIds('profile_edit', $GLOBALS['xoopsUser']->getGroups(), $GLOBALS['xoopsModule']->getVar('mid') ); + $editable_fields = $gperm_handler->getItemIds('profile_edit', $xoops->user->getGroups(), $xoops->module->getVar('mid')); $uid = empty($_POST['uid']) ? 0 : intval($_POST['uid']); - if ( !empty($uid) ) { + if (!empty($uid)) { $user = $handler->getUser($uid); $profile = $profile_handler->get($uid); - if ( !is_object($profile) ) { + if (!is_object($profile)) { $profile = $profile_handler->create(); $profile->setVar('profile_id', $uid); } } else { $user = $handler->createUser(); $profile = $profile_handler->create(); - if ( count($fields) > 0 ) { - foreach (array_keys($fields) as $i ) { + if (count($fields) > 0) { + foreach (array_keys($fields) as $i) { $fieldname = $fields[$i]->getVar('field_name'); - if ( in_array($fieldname, $userfields) ) { + if (in_array($fieldname, $userfields)) { $default = $fields[$i]->getVar('field_default'); - if ( $default === '' || $default === null) continue; + if ($default === '' || $default === null) { + continue; + } $user->setVar($fieldname, $default); } } } - $user->setVar('user_regdate', time() ); + $user->setVar('user_regdate', time()); $user->setVar('level', 1); } $myts = MyTextSanitizer::getInstance(); $user->setVar('uname', $_POST['uname']); - $user->setVar('email', trim($_POST['email']) ); - if ( isset($_POST['level']) && $user->getVar('level') != intval($_POST['level']) ) { - $user->setVar('level', intval($_POST['level']) ); + $user->setVar('email', trim($_POST['email'])); + if (isset($_POST['level']) && $user->getVar('level') != intval($_POST['level'])) { + $user->setVar('level', intval($_POST['level'])); } $password = $vpass = null; - if ( !empty($_POST['password']) ) { - $password = $myts->stripSlashesGPC(trim($_POST['password']) ); - $vpass = @$myts->stripSlashesGPC(trim($_POST['vpass']) ); - $user->setVar('pass', md5($password) ); - } elseif ( $user->isNew() ) { + if (!empty($_POST['password'])) { + $password = $myts->stripSlashesGPC(trim($_POST['password'])); + $vpass = @$myts->stripSlashesGPC(trim($_POST['vpass'])); + $user->setVar('pass', md5($password)); + } elseif ($user->isNew()) { $password = $vpass = ''; } $stop = XoopsUserUtility::validate($user, $password, $vpass); $errors = array(); - if ( $stop != "" ) { + if ($stop != "") { $errors[] = $stop; } - foreach (array_keys($fields) as $i ) { + foreach (array_keys($fields) as $i) { $fieldname = $fields[$i]->getVar('field_name'); - if ( in_array($fields[$i]->getVar('field_id'), $editable_fields) && isset($_REQUEST[$fieldname]) ) { - if ( in_array($fieldname, $userfields) ) { - $value = $fields[$i]->getValueForSave($_REQUEST[$fieldname], $user->getVar($fieldname, 'n') ); + if (in_array($fields[$i]->getVar('field_id'), $editable_fields) && isset($_REQUEST[$fieldname])) { + if (in_array($fieldname, $userfields)) { + $value = $fields[$i]->getValueForSave($_REQUEST[$fieldname], $user->getVar($fieldname, 'n')); $user->setVar($fieldname, $value); } else { - $value = $fields[$i]->getValueForSave( ( isset($_REQUEST[$fieldname]) ? $_REQUEST[$fieldname] : ""), $profile->getVar($fieldname, 'n') ); + $value = $fields[$i]->getValueForSave((isset($_REQUEST[$fieldname]) ? $_REQUEST[$fieldname] + : ""), $profile->getVar($fieldname, 'n')); $profile->setVar($fieldname, $value); } } @@ -137,37 +140,37 @@ $new_groups = isset($_POST['groups']) ? $_POST['groups'] : array(); - if ( count($errors) == 0 ) { - if ( $handler->insertUser($user) ) { - $profile->setVar('profile_id', $user->getVar('uid') ); + if (count($errors) == 0) { + if ($handler->insertUser($user)) { + $profile->setVar('profile_id', $user->getVar('uid')); $profile_handler->insert($profile); - include_once $GLOBALS['xoops']->path( "/modules/system/constants.php" ); - if ( $gperm_handler->checkRight("system_admin", XOOPS_SYSTEM_GROUP, $GLOBALS['xoopsUser']->getGroups(), 1) ) { + include_once $xoops->path("/modules/system/constants.php"); + if ($gperm_handler->checkRight("system_admin", XOOPS_SYSTEM_GROUP, $xoops->user->getGroups(), 1)) { //Update group memberships $cur_groups = $user->getGroups(); $added_groups = array_diff($new_groups, $cur_groups); $removed_groups = array_diff($cur_groups, $new_groups); - if ( count($added_groups) > 0 ) { - foreach ($added_groups as $groupid ) { - $handler->addUserToGroup($groupid, $user->getVar('uid') ); + if (count($added_groups) > 0) { + foreach ($added_groups as $groupid) { + $handler->addUserToGroup($groupid, $user->getVar('uid')); } } - if ( count($removed_groups) > 0 ) { - foreach ($removed_groups as $groupid ) { - $handler->removeUsersFromGroup($groupid, array($user->getVar('uid') )); + if (count($removed_groups) > 0) { + foreach ($removed_groups as $groupid) { + $handler->removeUsersFromGroup($groupid, array($user->getVar('uid'))); } } } - if ( $user->isNew() ) { + if ($user->isNew()) { $xoops->redirect('user.php', 2, _PROFILE_AM_USERCREATED, false); } else { $xoops->redirect('user.php', 2, _US_PROFUPDATED, false); } } } else { - foreach ($errors as $err ) { + foreach ($errors as $err) { $user->setErrors($err); } } @@ -179,23 +182,23 @@ break; case "delete": - if ( $_REQUEST['id'] == $GLOBALS['xoopsUser']->getVar('uid') ) { + if ($_REQUEST['id'] == $xoops->user->getVar('uid')) { $xoops->redirect('user.php', 2, _PROFILE_AM_CANNOTDELETESELF); } $obj = $handler->getUser($_REQUEST['id']); $groups = $obj->getGroups(); - if ( in_array(XOOPS_GROUP_ADMIN, $groups) ) { + if (in_array(XOOPS_GROUP_ADMIN, $groups)) { $xoops->redirect('user.php', 3, _PROFILE_AM_CANNOTDELETEADMIN, false); } - if ( isset($_REQUEST['ok']) && $_REQUEST['ok'] == 1 ) { - if ( !$GLOBALS['xoopsSecurity']->check() ) { - $xoops->redirect('user.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors() ), false); + if (isset($_REQUEST['ok']) && $_REQUEST['ok'] == 1) { + if (!$GLOBALS['xoopsSecurity']->check()) { + $xoops->redirect('user.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()), false); } $profile_handler = $xoops->getModuleHandler('profile'); - $profile = $profile_handler->get($obj->getVar('uid') ); - if ( !$profile || $profile->isNew() || $profile_handler->delete($profile) ) { - if ( $handler->deleteUser($obj) ) { + $profile = $profile_handler->get($obj->getVar('uid')); + if (!$profile || $profile->isNew() || $profile_handler->delete($profile)) { + if ($handler->deleteUser($obj)) { $xoops->redirect('user.php', 3, sprintf(_PROFILE_AM_DELETEDSUCCESS, $obj->getVar('uname') . " (" . $obj->getVar('email') . ")"), false); } else { echo $obj->getHtmlErrors(); @@ -205,7 +208,9 @@ } } else { - $xoops->confirm(array('ok' => 1, 'id' => $_REQUEST['id'], 'op' => 'delete'), $_SERVER['REQUEST_URI'], sprintf(_PROFILE_AM_RUSUREDEL, $obj->getVar('uname') . " (" . $obj->getVar('email') . ")") ); + $xoops->confirm(array( + 'ok' => 1, 'id' => $_REQUEST['id'], 'op' => 'delete' + ), $_SERVER['REQUEST_URI'], sprintf(_PROFILE_AM_RUSUREDEL, $obj->getVar('uname') . " (" . $obj->getVar('email') . ")")); } break; } Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/visibility.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/visibility.php 2011-11-19 16:20:16 UTC (rev 8311) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/admin/visibility.php 2011-11-19 16:27:49 UTC (rev 8312) @@ -72,9 +72,9 @@ $groups[0] = _PROFILE_AM_FIELDVISIBLETOALL; asort($groups); -$GLOBALS['xoopsTpl']->assign('fields', $fields); -$GLOBALS['xoopsTpl']->assign('visibilities', $visibilities); -$GLOBALS['xoopsTpl']->assign('groups', $groups); +$xoops->tpl->assign('fields', $fields); +$xoops->tpl->assign('visibilities', $visibilities); +$xoops->tpl->assign('groups', $groups); $add_form = new XoopsSimpleForm('', 'addform', 'visibility.php'); @@ -93,9 +93,9 @@ $add_form->addElement($sel_pg); $add_form->addElement(new XoopsFormButton('', 'submit', _ADD, 'submit') ); -$add_form->assign($GLOBALS['xoopsTpl']); +$add_form->assign($xoops->tpl); -$GLOBALS['xoopsTpl']->display("module:profile|profile_admin_visibility.html"); +$xoops->tpl->display("module:profile|profile_admin_visibility.html"); xoops_cp_footer(); ?> \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/changemail.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/changemail.php 2011-11-19 16:20:16 UTC (rev 8311) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/changemail.php 2011-11-19 16:27:49 UTC (rev 8312) @@ -1,14 +1,17 @@ <?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. +*/ + /** * Extended User Profile * - * 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. - * * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * @package profile @@ -19,13 +22,12 @@ include dirname(__FILE__) . DIRECTORY_SEPARATOR . 'header.php'; $xoops = Xoops::getInstance(); - $xoops->loadLanguage('user'); -$GLOBALS['xoopsConfigUser'] = $xoops->getConfigs(XOOPS_CONF_USER); +$xoops->getConfigs(XOOPS_CONF_USER); -if (!$GLOBALS['xoopsUser'] || $GLOBALS['xoopsConfigUser']['allow_chgmail'] != 1) { - $xoops->redirect(XOOPS_URL . "/modules/" . $GLOBALS['xoopsModule']->getVar('dirname', 'n') . "/", 2, _NOPERM); +if (!$xoops->user || $xoops->getConfig('allow_chgmail') != 1) { + $xoops->redirect(XOOPS_URL . "/modules/" . $xoops->module->getVar('dirname', 'n') . "/", 2, _NOPERM); } $xoops->header('profile_email.html'); @@ -36,13 +38,13 @@ $form->addElement(new XoopsFormPassword(_US_PASSWORD, 'passwd', 15, 50), true); $form->addElement(new XoopsFormText(_PROFILE_MA_NEWMAIL, 'newmail', 15, 50), true); $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); - $form->assign($GLOBALS['xoopsTpl']); + $form->assign($xoops->tpl); } else { $myts = MyTextSanitizer::getInstance(); $pass = @$myts->stripSlashesGPC(trim($_POST['passwd'])); $email = @$myts->stripSlashesGPC(trim($_POST['newmail'])); $errors = array(); - if (md5($pass) != $GLOBALS['xoopsUser']->getVar('pass', 'n')) { + if (md5($pass) != $xoops->user->getVar('pass', 'n')) { $errors[] = _PROFILE_MA_WRONGPASSWORD; } if (!$xoops->checkEmail($email)) { @@ -53,35 +55,34 @@ $msg = implode('<br />', $errros); } else { //update password - $GLOBALS['xoopsUser']->setVar('email', trim($_POST['newmail'])); + $xoops->user->setVar('email', trim($_POST['newmail'])); $member_handler = $xoops->getHandlerMember(); - if ($member_handler->insertUser($GLOBALS['xoopsUser'])) { + if ($member_handler->insertUser($xoops->user)) { $msg = _PROFILE_MA_EMAILCHANGED; //send email to new email address $xoopsMailer = $xoops->getMailer(); $xoopsMailer->useMail(); - $xoopsMailer->setTemplateDir($GLOBALS['xoopsModule']->getVar('dirname', 'n')); + $xoopsMailer->setTemplateDir($xoops->module->getVar('dirname', 'n')); $xoopsMailer->setTemplate('emailchanged.tpl'); - $xoopsMailer->assign("SITENAME", $GLOBALS['xoopsConfig']['sitename']); - $xoopsMailer->assign("ADMINMAIL", $GLOBALS['xoopsConfig']['adminmail']); + $xoopsMailer->assign("SITENAME", $xoops->getConfig('sitename')); + $xoopsMailer->assign("ADMINMAIL", $xoops->getConfig('adminmail')); $xoopsMailer->assign("SITEURL", XOOPS_URL . "/"); $xoopsMailer->assign("NEWEMAIL", $email); $xoopsMailer->setToEmails($email); - $xoopsMailer->setFromEmail($GLOBALS['xoopsConfig']['adminmail']); - $xoopsMailer->setFromName($GLOBALS['xoopsConfig']['sitename']); - $xoopsMailer->setSubject(sprintf(_PROFILE_MA_NEWEMAIL, $GLOBALS['xoopsConfig']['sitename'])); + $xoopsMailer->setFromEmail($xoops->getConfig('adminmail')); + $xoopsMailer->setFromName($xoops->getConfig('sitename')); + $xoopsMailer->setSubject(sprintf(_PROFILE_MA_NEWEMAIL, $xoops->getConfig('sitename'))); $xoopsMailer->send(); } else { - $msg = implode('<br />', $GLOBALS['xoopsUser']->getErrors() ); + $msg = implode('<br />', $xoops->user->getErrors() ); } } - $xoops->redirect(XOOPS_URL . '/modules/' . $GLOBALS['xoopsModule']->getVar('dirname', 'n') . '/userinfo.php?uid=' . $GLOBALS['xoopsUser']->getVar('uid'), 2, $msg); + $xoops->redirect(XOOPS_URL . '/modules/' . $xoops->module->getVar('dirname', 'n') . '/userinfo.php?uid=' . $xoops->user->getVar('uid'), 2, $msg); } -$xoBreadcrumbs[] = array('title' => _PROFILE_MA_CHANGEMAIL); +$xoops->appendConfig('profile_breadcrumbs', array('title' => _PROFILE_MA_CHANGEMAIL)); -include dirname(__FILE__) . DIRECTORY_SEPARATOR . 'footer.php'; -?> \ No newline at end of file +include dirname(__FILE__) . DIRECTORY_SEPARATOR . 'footer.php'; \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/changepass.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/changepass.php 2011-11-19 16:20:16 UTC (rev 8311) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/changepass.php 2011-11-19 16:27:49 UTC (rev 8312) @@ -1,14 +1,17 @@ <?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. +*/ + /** * Extended User Profile * - * 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. - * * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * @package profile @@ -35,9 +38,8 @@ $form->addElement(new XoopsFormPassword(_US_VERIFYPASS, 'vpass', 15, 50), true); $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); $form->assign($xoops->tpl); + $xoops->appendConfig('profile_breadcrumbs', array('title' => _PROFILE_MA_CHANGEPASSWORD)); - $xoBreadcrumbs[] = array('title' => _PROFILE_MA_CHANGEPASSWORD); - } else { $xoops->getConfigs(XOOPS_CONF_USER); $myts = MyTextSanitizer::getInstance(); Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/class/category.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/class/category.php 2011-11-19 16:20:16 UTC (rev 8311) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/class/category.php 2011-11-19 16:27:49 UTC (rev 8312) @@ -1,14 +1,17 @@ <?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. +*/ + /** * Extended User Profile * - * 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. - * * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * @package profile @@ -20,13 +23,12 @@ defined('XOOPS_ROOT_PATH') or die("XOOPS root path not defined"); -/** - * @package kernel - * @copyright copyright © 2000 XOOPS.org - */ class ProfileCategory extends XoopsObject { - function __construct() + /** + * Constructor + */ + public function __construct() { $this->initVar('cat_id', XOBJ_DTYPE_INT, null, true); $this->initVar('cat_title', XOBJ_DTYPE_TXTBOX); @@ -34,11 +36,6 @@ $this->initVar('cat_weight', XOBJ_DTYPE_INT); } - function ProfileCategory() - { - $this->__construct(); - } - /** * Get {@link XoopsThemeForm} for adding/editing categories * @@ -46,43 +43,25 @@ * * @return object */ - function getForm($action = false) + public function getForm($action = false) { + $xoops = Xoops::getInstance(); + $form = $xoops->getModuleForm($this, 'category', 'profile'); if ($action === false) { $action = $_SERVER['REQUEST_URI']; } - $title = $this->isNew() ? sprintf(_PROFILE_AM_ADD, _PROFILE_AM_CATEGORY) : sprintf(_PROFILE_AM_EDIT, _PROFILE_AM_CATEGORY); - - $form = new XoopsThemeForm($title, 'form', $action, 'post', true); - $form->addElement(new XoopsFormText(_PROFILE_AM_TITLE, 'cat_title', 35, 255, $this->getVar('cat_title'))); - if (!$this->isNew()) { - //Load groups - $form->addElement(new XoopsFormHidden('id', $this->getVar('cat_id'))); - } - $form->addElement(new XoopsFormTextArea(_PROFILE_AM_DESCRIPTION, 'cat_description', $this->getVar('cat_description', 'e'))); - $form->addElement(new XoopsFormText(_PROFILE_AM_WEIGHT, 'cat_weight', 35, 35, $this->getVar('cat_weight', 'e'))); - - $form->addElement(new XoopsFormHidden('op', 'save') ); - $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); - + $form->setAction($action); return $form; } } -/** - * @package kernel - * @copyright copyright © 2000 XOOPS.org - */ class ProfileCategoryHandler extends XoopsPersistableObjectHandler { - function ProfileCategoryHandler(&$db) + /** + * @param null|XoopsDatabase $db + */ + function __construct(XoopsDatabase $db = null) { - $this->__construct($db); - } - - function __construct(&$db) - { parent::__construct($db, "profile_category", "profilecategory", "cat_id", 'cat_title'); } -} -?> \ No newline at end of file +} \ No newline at end of file Modified: XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/class/field.php =================================================================== --- XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/class/field.php 2011-11-19 16:20:16 UTC (rev 8311) +++ XoopsCore/branches/2.6.x/2.6.0/htdocs/modules/profile/class/field.php 2011-11-19 16:27:49 UTC (rev 8312) @@ -1,14 +1,17 @@ <?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. +*/ + /** * Extended User Profile * - * 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. - * * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * @package profile @@ -26,7 +29,10 @@ */ class ProfileField extends XoopsObject { - function __construct() + /** + * Constructor + */ + public function __construct() { $this->initVar('field_id', XOBJ_DTYPE_INT, null); $this->initVar('cat_id', XOBJ_DTYPE_INT, null, true); @@ -43,30 +49,35 @@ $this->initVar('field_edit', XOBJ_DTYPE_INT, 0); $this->initVar('field_show', XOBJ_DTYPE_INT, 0); $this->initVar('field_config', XOBJ_DTYPE_INT, 0); - $this->initVar('field_options', XOBJ_DTYPE_ARRAY, array() ); + $this->initVar('field_options', XOBJ_DTYPE_ARRAY, array()); $this->initVar('step_id', XOBJ_DTYPE_INT, 0); } - function ProfileField() - { - $this->__construct(); - } - /** * Extra treatment dealing with non latin encoding * Tricky solution + * + * @param string $key + * @param mixed $value + * @param bool $not_gpc + * @return void */ - function setVar($key, $value, $not_gpc = false) + public function setVar($key, $value, $not_gpc = false) { if ($key == 'field_options' && is_array($value)) { - foreach (array_keys($value) as $idx ) { + foreach (array_keys($value) as $idx) { $value[$idx] = base64_encode($value[$idx]); } } parent::setVar($key, $value, $not_gpc); } - function getVar($key, $format = 's') + /** + * @param string $key + * @param string $format + * @return array|mixed + */ + public function getVar($key, $format = 's') { $value = parent::getVar($key, $format); if ($key == 'field_options' && !empty($value)) { @@ -78,16 +89,17 @@ } /** - * Returns a {@link XoopsFormElement} for editing the value of this field - * - * @param XoopsUser $user {@link XoopsUser} object to edit the value of - * @param ProfileProfile $profile {@link ProfileProfile} object to edit the value of - * - * @return XoopsFormElement - **/ - function getEditElement($user, $profile) + * Returns a {@link XoopsFormElement} for editing the value of this field + * + * @param XoopsUser $user {@link XoopsUser} object to edit the value of + * @param ProfileProfile $profile {@link ProfileProfile} object to edit the value of + * + * @return XoopsFormElement + **/ + public function getEditElement(XoopsUser $user, ProfileProfile $profile) { - $value = in_array($this->getVar('field_name'), $this->getUserVars() ) ? $user->getVar($this->getVar('field_name'), 'e') : $profile->getVar($this->getVar('field_name'), 'e'); + $value = in_array($this->getVar('field_name'), $this->getUserVars()) + ? $user->getVar($this->getVar('field_name'), 'e') : $profile->getVar($this->getVar('field_name'), 'e'); $caption = $this->getVar('field_title'); $caption = defined($caption) ? constant($caption) : $caption; @@ -103,7 +115,7 @@ $options[$optkey] = $optval; } } - switch ($this->getVar('field_type') ) { + switch ($this->getVar('field_type')) { default: case "autotext": //autotext is not for editing @@ -128,11 +140,9 @@ if (!in_array('', array_keys($options))) { $element->addOption('', _NONE); - $eltmsg = empty($caption) ? sprintf(_FORM_ENTER, $name) : sprintf( _FORM_ENTER, $caption); + $eltmsg = empty($caption) ? sprintf(_FORM_ENTER, $name) : sprintf(_FORM_ENTER, $caption); $eltmsg = str_replace('"', '\"', stripslashes($eltmsg)); - $element->customValidationCode[] = "\nvar hasSelected = false; var selectBox = myform.{$name};" . - "for (i = 0; i < selectBox.options.length; i++ ) { if ( selectBox.options[i].selected == true && selectBox.options[i].value != '' ) { hasSelected = true; break; } }" . - "if ( !hasSelected ) { window.alert(\"{$eltmsg}... [truncated message content] |