From nobunobu @ users.sourceforge.jp Wed Nov 1 00:03:39 2006 From: nobunobu @ users.sourceforge.jp (NobuNobu) Date: Wed, 1 Nov 2006 00:03:39 +0900 Subject: [xoops-cvslog 5534] CVS update: xoops2jp/html/modules/legacy/admin/class Message-ID: <20061031150339.C87032AC020@users.sourceforge.jp> Index: xoops2jp/html/modules/legacy/admin/class/ModuleUpdater.class.php diff -u xoops2jp/html/modules/legacy/admin/class/ModuleUpdater.class.php:1.1.2.7 xoops2jp/html/modules/legacy/admin/class/ModuleUpdater.class.php:1.1.2.8 --- xoops2jp/html/modules/legacy/admin/class/ModuleUpdater.class.php:1.1.2.7 Tue Oct 31 16:04:22 2006 +++ xoops2jp/html/modules/legacy/admin/class/ModuleUpdater.class.php Wed Nov 1 00:03:39 2006 @@ -154,7 +154,7 @@ ksort($this->_mMilestone); foreach ($this->_mMilestone as $t_version => $t_value) { - if ($t_version > $this->_mCurrentVersion) { + if ($t_version > $this->getCurrentVersion()) { return $t_version; } } @@ -170,7 +170,7 @@ ksort($this->_mMilestone); foreach ($this->_mMilestone as $t_version => $t_value) { - if ($t_version >= $this->_mCurrentVersion) { + if ($t_version >= $this->getCurrentVersion()) { if (is_callable(array($this, $t_value))) { return true; } @@ -192,7 +192,7 @@ ksort($this->_mMilestone); foreach ($this->_mMilestone as $t_version => $t_value) { - if ($t_version > $this->_mCurrentVersion) { + if ($t_version > $this->getCurrentVersion()) { if (is_callable(array($this, $t_value))) { return $this->$t_value(); } @@ -236,7 +236,7 @@ require_once XOOPS_MODULE_PATH . "/" . $module->getVar('dirname') . "/" . $installScript; $funcName = 'xoops_module_update_' . $module->getVar('dirname'); if (function_exists($funcName)) { - if (!call_user_func($funcName, $module, $this->mPreVersion)) { + if (!call_user_func($funcName, $module, $this->getCurrentVersion())) { $log->addError("Failed to execute " . $funcName); } } From minahito @ users.sourceforge.jp Wed Nov 1 15:39:05 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Wed, 1 Nov 2006 15:39:05 +0900 Subject: [xoops-cvslog 5535] CVS update: xoops2jp/html/modules/legacy/lib/ShadeSoap Message-ID: <20061101063905.1FCD12AC033@users.sourceforge.jp> Index: xoops2jp/html/modules/legacy/lib/ShadeSoap/index.html diff -u /dev/null xoops2jp/html/modules/legacy/lib/ShadeSoap/index.html:1.1.2.1 --- /dev/null Wed Nov 1 15:39:05 2006 +++ xoops2jp/html/modules/legacy/lib/ShadeSoap/index.html Wed Nov 1 15:39:04 2006 @@ -0,0 +1 @@ + \ No newline at end of file From minahito @ users.sourceforge.jp Wed Nov 1 15:39:05 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Wed, 1 Nov 2006 15:39:05 +0900 Subject: [xoops-cvslog 5536] CVS update: xoops2jp/html/modules/legacy/lib/ShadePlus Message-ID: <20061101063905.49DD62AC05F@users.sourceforge.jp> Index: xoops2jp/html/modules/legacy/lib/ShadePlus/index.html diff -u /dev/null xoops2jp/html/modules/legacy/lib/ShadePlus/index.html:1.1.2.1 --- /dev/null Wed Nov 1 15:39:05 2006 +++ xoops2jp/html/modules/legacy/lib/ShadePlus/index.html Wed Nov 1 15:39:05 2006 @@ -0,0 +1 @@ + \ No newline at end of file From minahito @ users.sourceforge.jp Wed Nov 1 15:46:56 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Wed, 1 Nov 2006 15:46:56 +0900 Subject: [xoops-cvslog 5537] CVS update: xoops2jp/html/modules/legacy/lib/ShadePlus Message-ID: <20061101064656.E0DB52AC05E@users.sourceforge.jp> Index: xoops2jp/html/modules/legacy/lib/ShadePlus/SoapClient.class.php diff -u xoops2jp/html/modules/legacy/lib/ShadePlus/SoapClient.class.php:1.1.2.2 xoops2jp/html/modules/legacy/lib/ShadePlus/SoapClient.class.php:1.1.2.3 --- xoops2jp/html/modules/legacy/lib/ShadePlus/SoapClient.class.php:1.1.2.2 Tue Oct 31 19:30:53 2006 +++ xoops2jp/html/modules/legacy/lib/ShadePlus/SoapClient.class.php Wed Nov 1 15:46:56 2006 @@ -34,9 +34,9 @@ * POSSIBILITY OF SUCH DAMAGE. */ -if (!defined('XCube_AbstractServiceClient')) exit(); +if (!class_exists('XCube_AbstractServiceClient')) exit(); -class ShadePlus_SoapClient extends XCube_AbstractServiceClient +class Shade_SoapClient extends XCube_AbstractServiceClient { var $mClient = null; From minahito @ users.sourceforge.jp Wed Nov 1 15:47:54 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Wed, 1 Nov 2006 15:47:54 +0900 Subject: [xoops-cvslog 5538] CVS update: xoops2jp/html/modules/legacy/preload/Primary Message-ID: <20061101064754.39C362AC033@users.sourceforge.jp> Index: xoops2jp/html/modules/legacy/preload/Primary/NuSoapLoader.class.php diff -u xoops2jp/html/modules/legacy/preload/Primary/NuSoapLoader.class.php:1.1.2.2 xoops2jp/html/modules/legacy/preload/Primary/NuSoapLoader.class.php:1.1.2.3 --- xoops2jp/html/modules/legacy/preload/Primary/NuSoapLoader.class.php:1.1.2.2 Sun Oct 15 01:43:37 2006 +++ xoops2jp/html/modules/legacy/preload/Primary/NuSoapLoader.class.php Wed Nov 1 15:47:54 2006 @@ -22,13 +22,13 @@ $root =& XCube_Root::getSingleton(); if (is_object($service) && is_a($service, 'XCube_Service')) { - $client = new XCube_ServiceClient($service); + $client =& new XCube_ServiceClient($service); } else { require_once XOOPS_ROOT_PATH . "/modules/legacy/lib/nusoap/nusoap.php"; require_once XOOPS_ROOT_PATH . "/modules/legacy/lib/ShadePlus/SoapClient.class.php"; - $client = new Shade_SoapClient($service); + $client =& new Shade_SoapClient($service); } } From minahito @ users.sourceforge.jp Wed Nov 1 15:50:45 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Wed, 1 Nov 2006 15:50:45 +0900 Subject: [xoops-cvslog 5539] CVS update: xoops2jp/html/modules/legacy/class Message-ID: <20061101065045.574C92AC05E@users.sourceforge.jp> Index: xoops2jp/html/modules/legacy/class/Legacy_Utils.class.php diff -u xoops2jp/html/modules/legacy/class/Legacy_Utils.class.php:1.1.2.3 xoops2jp/html/modules/legacy/class/Legacy_Utils.class.php:1.1.2.4 --- xoops2jp/html/modules/legacy/class/Legacy_Utils.class.php:1.1.2.3 Tue Oct 31 15:06:17 2006 +++ xoops2jp/html/modules/legacy/class/Legacy_Utils.class.php Wed Nov 1 15:50:45 2006 @@ -112,13 +112,15 @@ if (!class_exists($className)) { $filePath = XOOPS_ROOT_PATH . '/modules/' . $block->get('dirname') . '/blocks/' . $block->get('func_file'); if (!file_exists($filePath)) { - continue; + $retBlock =& new Legacy_BlockProcedureAdapter($block); + return $retBlock; } require_once $filePath; if (!class_exists($className)) { - continue; + $retBlock =& new Legacy_BlockProcedureAdapter($block); + continue $retBlock; } } From minahito @ users.sourceforge.jp Wed Nov 1 20:54:23 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Wed, 1 Nov 2006 20:54:23 +0900 Subject: [xoops-cvslog 5540] CVS update: xoops2jp/html/modules/legacy/admin/class Message-ID: <20061101115423.0908F2AC022@users.sourceforge.jp> Index: xoops2jp/html/modules/legacy/admin/class/ModuleUpdater.class.php diff -u xoops2jp/html/modules/legacy/admin/class/ModuleUpdater.class.php:1.1.2.8 xoops2jp/html/modules/legacy/admin/class/ModuleUpdater.class.php:1.1.2.9 --- xoops2jp/html/modules/legacy/admin/class/ModuleUpdater.class.php:1.1.2.8 Wed Nov 1 00:03:39 2006 +++ xoops2jp/html/modules/legacy/admin/class/ModuleUpdater.class.php Wed Nov 1 20:54:22 2006 @@ -1,11 +1,44 @@ _mCurrentXoopsModule. And, that function build the + * target-$xoopsModule from xoops_version, and then set it to this class through + * setTargetXoopsModule(). Also you can access it by $this->_mTargetXoopsModule. + * + * @see Legacy_ModuleInstallUtils */ class Legacy_ModulePhasedUpgrader { @@ -77,7 +110,7 @@ * the _mCurrentVersion as backup for the case where the value of this * object is changed for updating. * - * @access public + * @public * @param XoopsModule $xoopsModule */ function setCurrentXoopsModule(&$xoopsModule) @@ -254,6 +287,41 @@ } /** + * Updates all of module templates. + * + * @access protected + * @note You may do custom + */ + function _updateModuleTemplates() + { + Legacy_ModuleInstallUtils::uninstallAllOfModuleTemplates($this->_mTargetXoopsModule, $this->mLog); + Legacy_ModuleInstallUtils::installAllModuleTemplates($this->_mTargetXoopsModule, $this->mLog); + } + + /** + * Updates all of blocks. + * + * @access protected + * @note You may do custom + */ + function _updateBlocks() + { + Legacy_ModuleInstallUtils::uninstallAllOfBlocks($this->_mTargetXoopsModule, $this->mLog); + Legacy_ModuleInstallUtils::installAllOfBlocks($this->_mTargetXoopsModule, $this->mLog); + } + + /** + * Updates all of preferences & notifications. + * + * @access protected + * @note You may do custom + */ + function _updatePreferences() + { + $this->_upgradePreference(); + } + + /** * This method executes upgrading automatically by the diff of * xoops_version. * @@ -267,18 +335,9 @@ $this->mLog->addReport(_AD_LEGACY_MESSAGE_UPDATE_STARTED); // - // Uninstall all of existed module templates - // - Legacy_ModuleUtils::uninstallAllModuleTemplates($this->_mTargetXoopsModule, $this->mLog); - if (!$this->_mForceMode && $this->mLog->hasError()) { - $this->_processReport(); - return false; - } - - // - // Install all of module templates. + // Updates all of module templates // - Legacy_ModuleUtils::installAllModuleTemplates($this->_mTargetXoopsModule, $this->mLog); + $this->_updateTemplates(); if (!$this->_mForceMode && $this->mLog->hasError()) { $this->_processReport(); return false; @@ -287,8 +346,7 @@ // // Update blocks. // - Legacy_ModuleUtils::uninstallAllBlocks($this->_mTargetXoopsModule, $this->mLog); - Legacy_ModuleUtils::installAllBlocks($this->_mTargetXoopsModule, $this->mLog); + $this->_updateBlocks(); if (!$this->_mForceMode && $this->mLog->hasError()) { $this->_processReport(); return false; @@ -297,7 +355,7 @@ // // Update preferences & notifications. // - $this->_upgradePreference(); + $this->_updatePreferences(); if (!$this->_mForceMode && $this->mLog->hasError()) { $this->_processReport(); return false; @@ -322,7 +380,14 @@ return true; } - function _upgradePreference() + /** + * Tries to smart update all of preferences & notifications. + * + * @todo This method is perhaps uncompleted. If you have written more smart + * function, please contribute it to us. + * @note The utility method for the custom-update-installer. + */ + function _upgradePreferences() { $configHandler =& xoops_gethandler('config'); From minahito @ users.sourceforge.jp Wed Nov 1 20:54:30 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Wed, 1 Nov 2006 20:54:30 +0900 Subject: [xoops-cvslog 5541] CVS update: xoops2jp/html/modules/legacy/admin/class Message-ID: <20061101115430.B00242AC05E@users.sourceforge.jp> Index: xoops2jp/html/modules/legacy/admin/class/ModuleUpdateFramework.class.php diff -u xoops2jp/html/modules/legacy/admin/class/ModuleUpdateFramework.class.php:1.1.2.2 xoops2jp/html/modules/legacy/admin/class/ModuleUpdateFramework.class.php:removed --- xoops2jp/html/modules/legacy/admin/class/ModuleUpdateFramework.class.php:1.1.2.2 Thu Oct 26 00:27:23 2006 +++ xoops2jp/html/modules/legacy/admin/class/ModuleUpdateFramework.class.php Wed Nov 1 20:54:30 2006 @@ -1,113 +0,0 @@ - {methodName} - * - * Example: - * var $_mMilestone = array('020' => 'update020', '025' => 'update025'); - * - * @access protected - */ - var $_mMilestone = array(); - - /** - * @access protected - */ - var $_mTargetVersion = 0; - - /** - * @access protected - */ - var $_mIsEnableFramework = false; - - function &loadModuleObject($dirname) - { - $ret = null; - - $moduleHandler =& xoops_gethandler('module'); - $module =& $moduleHandler->getByDirname($dirname); - - if (!is_object($module)) { - return $ret; - } - - $this->mPreVersion = $module->get('version'); - $name = $module->get('name','n'); - $module->loadInfoAsVar($dirname); - $module->set('name', $name, true); - - ksort($this->_mMilestone); - - foreach ($this->_mMilestone as $version => $value) { - if ($version > $this->mPreVersion) { - $this->_mTargetVersion = $version; - $module->set('version', $version); - - $this->_mIsEnableFramework = true; - return $module; - } - } - - $this->_mTargetVersion = intval($module->modinfo['version'] * 100); - - return $module; - } - - function updateXoopsModule() - { - $moduleHandler =& xoops_gethandler('module'); - if (!$moduleHandler->insert($this->mModule)) { - $this->mLog->addError("*Could not install module information*"); - return false; - } - - return true; - } - - function execute() - { - if ($this->_mIsEnableFramework) { - $this->mModule =& $this->loadModuleObject($this->mDirname); - - if (!is_object($this->mModule)) { - $this->_processReport(); - return false; - } - - $method = $this->_mMilestone[$this->_mTargetVersion]; - - if (is_callable(array($this, $method))) { - $this->mModule->set('version', $this->_mTargetVersion); - - $this->$method(); - - $this->_processReport(); - - return true; - } - else { - // - // TODO need error message. - // - $this->mLog->addError('Update framework is a wrong.'); - return false; - } - } - else { - parent::execute(); - } - } -} - - -?> \ No newline at end of file From minahito @ users.sourceforge.jp Wed Nov 1 20:54:36 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Wed, 1 Nov 2006 20:54:36 +0900 Subject: [xoops-cvslog 5542] CVS update: xoops2jp/html/modules/legacy/admin/templates Message-ID: <20061101115436.AE5702AC022@users.sourceforge.jp> Index: xoops2jp/html/modules/legacy/admin/templates/module_uninstall.html diff -u xoops2jp/html/modules/legacy/admin/templates/module_uninstall.html:1.1.2.5 xoops2jp/html/modules/legacy/admin/templates/module_uninstall.html:1.1.2.6 --- xoops2jp/html/modules/legacy/admin/templates/module_uninstall.html:1.1.2.5 Mon Oct 16 00:29:46 2006 +++ xoops2jp/html/modules/legacy/admin/templates/module_uninstall.html Wed Nov 1 20:54:36 2006 @@ -41,10 +41,7 @@ <{$smarty.const._AD_LEGACY_LANG_VERSION}> - <{math equation="v/100" v=$module->get('version') format="%.2f"}> - <{if $module->get('version') != $module->modinfo.version * 100 }> - » <{math equation=$module->modinfo.version format="%.2f"}> - <{/if}> + <{$currentVersion}> From minahito @ users.sourceforge.jp Wed Nov 1 20:54:56 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Wed, 1 Nov 2006 20:54:56 +0900 Subject: [xoops-cvslog 5543] CVS update: xoops2jp/html/modules/legacy/admin/class Message-ID: <20061101115456.672912AC022@users.sourceforge.jp> Index: xoops2jp/html/modules/legacy/admin/class/ModuleInstallUtils.class.php diff -u /dev/null xoops2jp/html/modules/legacy/admin/class/ModuleInstallUtils.class.php:1.1.2.1 --- /dev/null Wed Nov 1 20:54:56 2006 +++ xoops2jp/html/modules/legacy/admin/class/ModuleInstallUtils.class.php Wed Nov 1 20:54:56 2006 @@ -0,0 +1,183 @@ +getInfo('templates'); + if ($templates != false) { + foreach ($templates as $template) { + Legacy_ModuleUtils::installModuleTemplate($module, $template, $log); + } + } + } + + /** + * Uninstalls all of module templates $module specify. This function is + * usefull for uninstaller and updater. In the case of update, you should + * call this function before installAllOfModuleTemplates(). In the case of + * uninstall, you must set 'false' to $defaultOnly. + * + * This function gets informations about templates from the database. + * + * @section Attention + * + * This function depends the specific spec of Legacy_RenderSystem, but this + * static function is needed by the 2nd installer of Legacy System. + * + * @static + * @param XoopsModule $module + * @param Legacy_ModuleUtilsSimpleLog $log + * @param bool $defaultOnly Indicates whether this function deletes templates from all of tplsets. + * @note FOR THE CUSTOM-INSTALLER + * @see Legacy_ModuleInstallUtils::installAllOfModuleTemplates() + */ + function uninstallAllOfModuleTemplates(&$module, &$log, $defaultOnly = true) + { + $tplHandler =& xoops_gethandler('tplfile'); + + // + // The following processing depends on the structure of Legacy_RenderSystem. + // + $tplHandler =& xoops_gethandler('tplfile'); + $delTemplates = null; + + if ($defaultOnly) { + $delTemplates =& $tplHandler->find('default', 'module', $module->get('mid')); + } + else { + $delTemplates =& $tplHandler->find(null, 'module', $module->get('mid')); + } + + if (is_array($delTemplates) && count($delTemplates) > 0) { + // + // clear cache + // + $xoopsTpl =& new XoopsTpl(); + $xoopsTpl->clear_cache(null, "mod_" . $module->get('dirname')); + + foreach ($delTemplates as $tpl) { + if (!$tplHandler->delete($tpl)) { + $log->addError(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_TEMPLATE_UNINSTALLED, $tpl->get('tpl_file'))); + } + } + } + } + + /** + * Installs all of blocks $module specify. + * + * This function gets informations about blocks from xoops_version. + * + * @static + * @param XoopsModule $module + * @param Legacy_ModuleUtilsSimpleLog $log + * @note FOR THE CUSTOM-INSTALLER + * @see Legacy_ModuleInstallUtils::uninstallAllOfBlocks() + */ + function installAllOfBlocks(&$module, &$log) + { + $definedBlocks = $module->getInfo('blocks'); + if($definedBlocks == false) { + return true; + } + + $handler =& xoops_gethandler('block'); + + $func_num = 0; + foreach ($definedBlocks as $block) { + $func_num++; + $newBlock =& Legacy_ModuleUtils::createBlockByInfo($module, $block, $func_num); + Legacy_ModuleUtils::installBlock($module, $newBlock, $block, $this->mLog); + } + } + + /** + * Uninstalls all of blocks which $module specifies, and its permissions. + * + * This function gets informations about templates from the database. + * + * @static + * @param XoopsModule $module + * @param Legacy_ModuleUtilsSimpleLog $log + * @return bool + * + * @note FOR THE CUSTOM-INSTALLER + * @see Legacy_ModuleInstallUtils::installAllOfBlocks() + * @see Legacy_ModuleInstallUtils::uninstallBlock() + */ + function uninstallAllOfBlocks(&$module, &$log) + { + $handler =& xoops_gethandler('block'); + $criteria = new Criteria('mid', $module->get('mid')); + + $blockArr =& $handler->getObjectsDirectly($criteria); + + $successFlag = true; + + foreach (array_keys($blockArr) as $idx) { + $successFlag &= Legacy_ModuleInstallUtils::uninstallBlock($blockArr[$idx], $log); + } + + return $successFlag; + } + + /** + * Uninstalls a block which $block specifies. In the same time, deletes + * permissions for the block. + * + * @param XoopsBlock $block + * @param Legacy_ModuleUtilsSimpleLog $log + * @note FOR THE CUSTOM-INSTALLER + * + * @todo error handling & delete the block's template. + */ + function uninstallBlock(&$block, &$log) + { + $blockHandler =& xoops_gethandler('block'); + $blockHandler->delete($block); + $log->addReport(XCube_Utils::formatMessage(_AD_LEGACY_MESSAGE_UNINSTALLATION_BLOCK_SUCCESSFUL, $block->get('name'))); + + // + // Deletes permissions + // + $gpermHandler =& xoops_gethandler('groupperm'); + $criteria =& new CriteriaCompo(); + $criteria->add(new Criteria('gperm_name', 'block_read')); + $criteria->add(new Criteria('gperm_itemid', $block->get('bid'))); + $criteria->add(new Criteria('gperm_modid', 1)); + $gpermHandler->deleteAll($criteria); + } +} + +?> \ No newline at end of file From minahito @ users.sourceforge.jp Wed Nov 1 20:55:09 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Wed, 1 Nov 2006 20:55:09 +0900 Subject: [xoops-cvslog 5544] CVS update: xoops2jp/html/modules/legacy/admin/class Message-ID: <20061101115509.B83AF2AC05E@users.sourceforge.jp> Index: xoops2jp/html/modules/legacy/admin/class/ModuleUninstaller.class.php diff -u xoops2jp/html/modules/legacy/admin/class/ModuleUninstaller.class.php:1.1.2.2 xoops2jp/html/modules/legacy/admin/class/ModuleUninstaller.class.php:1.1.2.3 --- xoops2jp/html/modules/legacy/admin/class/ModuleUninstaller.class.php:1.1.2.2 Sun Oct 15 01:00:51 2006 +++ xoops2jp/html/modules/legacy/admin/class/ModuleUninstaller.class.php Wed Nov 1 20:55:09 2006 @@ -2,58 +2,62 @@ if (!defined('XOOPS_ROOT_PATH')) exit(); -require_once XOOPS_LEGACY_PATH."/admin/class/AbstractModuleInstaller.class.php"; +require_once XOOPS_LEGACY_PATH . "/admin/class/ModuleUtils.class.php"; +require_once XOOPS_LEGACY_PATH . "/admin/class/ModuleInstallUtils.class.php"; -class Legacy_ModuleUninstaller extends Legacy_AbstractModuleInstaller +class Legacy_ModuleUninstaller { - function Legacy_ModuleUninstaller($dirname) + /** + * This instance is prepared automatically in the constructor. + * + * @public + * @var Legacy_ModuleUtilsSimpleLog + */ + var $mLog = null; + + var $_mForceMode = false; + + /** + * @protected + * @var XoopsModule + */ + var $_mXoopsModule = null; + + function Legacy_ModuleUninstaller() { - parent::Legacy_AbstractModuleInstaller($dirname); - - $this->mProcessScript->register('Legacy_ModuleUninstaller.ProcessScript'); - $this->mProcessScript->add('Legacy_ModuleUninstaller::_processScript'); - - $this->mInstallTable->register('Legacy_ModuleInstaller.InstallTable'); - $this->mInstallTable->add('Legacy_ModuleUninstaller::_uninstallTable'); - - $this->mInstallTemplate->register('Legacy_ModuleUninstaller.InstallTemplate'); - $this->mInstallTemplate->add('Legacy_ModuleUninstaller::_uninstallTemplate'); + $this->mLog =& new Legacy_ModuleUtilsSimpleLog(); } /** - * Load xoops module object that isn't installed and return it. - * @static - * @access public - * @param $dirname string - * @return XoopsModule + * Sets the current XoopsModule. + * + * @public + * @param XoopsModule $xoopsModule */ - function &loadModuleObject($dirname) + function setCurrentXoopsModule(&$xoopsModule) { - $error = null; - - $moduleHandler =& xoops_gethandler('module'); - $module =& $moduleHandler->getByDirname($dirname); - - if (!is_object($module)) { - $this->mLog->addError(_AD_LEGACY_ERROR_MODULE_NOT_FOUND); - return $error; - } - - if ($module->getVar('isactive') != 0) { - $this->mLog->addError(_AD_LEGACY_ERROR_CASE_OF_ACTIVE_MODULE); - return $error; - } - - return $module; + $this->_mXoopsModule =& $xoopsModule; + } + + /** + * Sets a value indicating whether the force mode is on. + * @param bool $isForceMode + */ + function setForceMode($isForceMode) + { + $this->_mForceMode = $isForceMode; } /** - * Delete module information from XOOPS database because this class is uninstaller. + * Deletes module information from XOOPS database because this class is + * uninstaller. + * + * @protected */ - function _installModule() + function _uninstallModule() { $moduleHandler =& xoops_gethandler('module'); - if (!$moduleHandler->delete($this->mModule)) { + if (!$moduleHandler->delete($this->_mXoopsModule)) { $this->mLog->addError(_AD_LEGACY_ERROR_DELETE_MODULEINFO_FROM_DB); } else { @@ -63,13 +67,15 @@ /** * Drop table because this class is uninstaller. + * + * @protected */ - function _uninstallTable(&$module, &$log) + function _uninstallTables() { $root =& XCube_Root::getSingleton(); $db =& $root->mController->getDB(); - $tables = $module->getInfo('tables'); + $tables = $this->_mXoopsModule->getInfo('tables'); if ($tables != false && is_array($tables)) { foreach($tables as $table) { // @@ -77,10 +83,10 @@ // $sql = "DROP TABLE " . $db->prefix($table); if ($db->query($sql)) { - $log->addReport(XCube_Utils::formatMessage(_AD_LEGACY_MESSAGE_DROP_TABLE, $db->prefix($table))); + $this->mLog->addReport(XCube_Utils::formatMessage(_AD_LEGACY_MESSAGE_DROP_TABLE, $db->prefix($table))); } else { - $log->addError(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_DROP_TABLE, $db->prefix($table))); + $this->mLog->addError(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_DROP_TABLE, $db->prefix($table))); } } } @@ -88,66 +94,46 @@ /** * Delete template because this class is uninstaller. + * @protected */ - function _uninstallTemplate(&$module, &$log) + function _uninstallTemplates() { - $tplHandler =& xoops_gethandler('tplfile'); - - $deleteTemplates =& $tplHandler->find(null, 'module', $module->getVar('mid')); - - foreach($deleteTemplates as $tpl) { - if (!$tplHandler->delete($tpl)) { - $log->addError(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_TEMPLATE_UNINSTALLED, $tpl->getVar('tpl_file'))); - } - } + Legacy_ModuleInstallUtils::uninstallAllOfModuleTemplates($this->_mXoopsModule, $this->mLog, false); } /** * Delete all of module's blocks. + * + * @note Templates Delete is move into Legacy_ModuleInstallUtils. */ - function _installBlock() + function _uninstallBlocks() { - $blockHandler =& xoops_gethandler('block'); - $criteria = new Criteria('mid', $this->mModule->getVar('mid')); - - $blocks =& $blockHandler->getObjectsDirectly($criteria); - - $gpermHandler =& xoops_gethandler('groupperm'); - foreach ($blocks as $block) { - $blockHandler->delete($block); - $this->mLog->addReport(XCube_Utils::formatMessage(_AD_LEGACY_MESSAGE_BLOCK_HAS_BEEN_UNINSTALLED, $block->get('name'))); - - // - // delete permission - // - $criteria =& new CriteriaCompo(); - $criteria->add(new Criteria('gperm_name', 'block_read')); - $criteria->add(new Criteria('gperm_itemid', $block->getVar('bid'))); - $criteria->add(new Criteria('gperm_modid', 1)); - $gpermHandler->deleteAll($criteria); - } + Legacy_ModuleInstallUtils::uninstallAllOfBlocks($this->_mXoopsModule, $this->mLog); + // + // Additional + // $tplHandler =& xoops_gethandler('tplfile'); - $criteria =& new Criteria('tpl_module', $this->mModule->getVar('dirname')); + $criteria =& new Criteria('tpl_module', $this->_mXoopsModule->get('dirname')); if(!$tplHandler->deleteAll($criteria)) { $this->mLog->addError(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_COULD_NOT_DELETE_BLOCK_TEMPLATES, $tplHandler->db->error())); } } - function _installPreference() + function _uninstallPreferences() { Legacy_ModuleUtils::deleteAllConfigs($this->mModule, $this->mLog); } - function _processScript(&$module, &$log) + function _processScript() { - $installScript = trim($module->getInfo('onUninstall')); + $installScript = trim($this->_mXoopsModule->getInfo('onUninstall')); if ($installScript != false) { - require_once XOOPS_MODULE_PATH . "/" . $module->getVar('dirname') . "/" . $installScript; - $funcName = 'xoops_module_uninstall_' . $module->getVar('dirname'); + require_once XOOPS_MODULE_PATH . "/" . $this->_mXoopsModule->get('dirname') . "/" . $installScript; + $funcName = 'xoops_module_uninstall_' . $this->_mXoopsModule->get('dirname'); if (function_exists($funcName)) { - if (!call_user_func($funcName, $module)) { - $log->addError(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_FAILED_TO_EXECUTE_CALLBACK, $funcName)); + if (!call_user_func($funcName, $this->_mXoopsModule)) { + $this->mLog->addError(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_FAILED_TO_EXECUTE_CALLBACK, $funcName)); } } } @@ -156,17 +142,59 @@ function _processReport() { if (!$this->mLog->hasError()) { - $this->mLog->add(XCube_Utils::formatMessage(_AD_LEGACY_MESSAGE_UNINSTALLATION_MODULE_SUCCESSFUL, $this->mModule->get('name'))); + $this->mLog->add(XCube_Utils::formatMessage(_AD_LEGACY_MESSAGE_UNINSTALLATION_MODULE_SUCCESSFUL, $this->_mXoopsModule->get('name'))); } else { - if (is_object($this->mModule)) { - $this->mLog->addError(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_UNINSTALLATION_MODULE_FAILURE, $this->mModule->get('name'))); + if (is_object($this->_mXoopsModule)) { + $this->mLog->addError(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_UNINSTALLATION_MODULE_FAILURE, $this->_mXoopsModule->get('name'))); } else { - $this->mLog->addError(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_UNINSTALLATION_MODULE_FAILURE, $this->mDirname)); + $this->mLog->addError(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_UNINSTALLATION_MODULE_FAILURE, $this->_mXoopsModule->get('dirname'))); } } } + + /** + * @todo Check whether $this->_mXoopsObject is ready. + */ + function executeUninstall() + { + $this->_uninstallTables(); + if (!$this->_mForceMode && $this->mLog->hasError()) { + $this->_processReport(); + return false; + } + + $this->_uninstallModule(); + if (!$this->_mForceMode && $this->mLog->hasError()) { + $this->_processReport(); + return false; + } + + $this->_uninstallTemplates(); + if (!$this->_mForceMode && $this->mLog->hasError()) { + $this->_processReport(); + return false; + } + + $this->_uninstallBlocks(); + if (!$this->_mForceMode && $this->mLog->hasError()) { + $this->_processReport(); + return false; + } + + $this->_uninstallPreferences(); + if (!$this->_mForceMode && $this->mLog->hasError()) { + $this->_processReport(); + return false; + } + + $this->_processScript(); + + $this->_processReport(); + + return true; + } } ?> \ No newline at end of file Index: xoops2jp/html/modules/legacy/admin/class/ModuleUtils.class.php diff -u xoops2jp/html/modules/legacy/admin/class/ModuleUtils.class.php:1.1.2.4 xoops2jp/html/modules/legacy/admin/class/ModuleUtils.class.php:1.1.2.5 --- xoops2jp/html/modules/legacy/admin/class/ModuleUtils.class.php:1.1.2.4 Tue Oct 31 16:21:47 2006 +++ xoops2jp/html/modules/legacy/admin/class/ModuleUtils.class.php Wed Nov 1 20:55:09 2006 @@ -44,8 +44,12 @@ } /** + * @brief Old utility class with static methods for installation. + * * This provides static methods for the module installation. Methods of this * class may move to base class of installers. + * + * @deprecated see Legacy_ModuleInstallUtils */ class Legacy_ModuleUtils { @@ -574,12 +578,12 @@ */ function deleteAllConfigs(&$module, &$log) { - if ($this->mModule->getVar('hasconfig') == 0) { + if ($module->get('hasconfig') == 0) { return; } $configHandler =& xoops_gethandler('config'); - $configs =& $configHandler->getConfigs(new Criteria('conf_modid', $this->mModule->getVar('mid'))); + $configs =& $configHandler->getConfigs(new Criteria('conf_modid', $module->get('mid'))); if (count($configs) == 0) { return; From minahito @ users.sourceforge.jp Wed Nov 1 20:55:09 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Wed, 1 Nov 2006 20:55:09 +0900 Subject: [xoops-cvslog 5545] CVS update: xoops2jp/html/modules/legacy/admin/actions Message-ID: <20061101115509.E47772AC05F@users.sourceforge.jp> Index: xoops2jp/html/modules/legacy/admin/actions/ModuleUpdateAction.class.php diff -u xoops2jp/html/modules/legacy/admin/actions/ModuleUpdateAction.class.php:1.1.2.5 xoops2jp/html/modules/legacy/admin/actions/ModuleUpdateAction.class.php:1.1.2.6 --- xoops2jp/html/modules/legacy/admin/actions/ModuleUpdateAction.class.php:1.1.2.5 Mon Oct 30 18:52:32 2006 +++ xoops2jp/html/modules/legacy/admin/actions/ModuleUpdateAction.class.php Wed Nov 1 20:55:09 2006 @@ -10,6 +10,56 @@ require_once XOOPS_LEGACY_PATH . "/admin/class/ModuleUpdater.class.php"; require_once XOOPS_LEGACY_PATH . "/admin/forms/ModuleUpdateForm.class.php"; +/** + * @brief Module Update function having possibility to extend by module developers. + * + * The precondition is that the specified module has been installed. + * + * @section cupdate The custom-update-installer + * + * Module developers can use their own custom-update-installer in this action. + * This function uses Legacy_ModulePhasedUpgrader to update moudles. But, this + * class can't smart update modules correctly & automatically, because the + * module updat function bases on XOOPS2 JP spec. We have no rules to declare + * modules strictly. + * + * To solve it, module developers should use the custom-update-installer, + * because module developers know detail changelog of their module. + * + * @subsection convention Convention + * + * See Legacy_ModuleUpdateAction::_getInstaller(). + * + * \li $modversion['legacy_installer']['updater']['class'] = {classname}; + * \li $modversion['legacy_installer']['updater']['namespace'] = {namespace}; (Optional) + * \li $modversion['legacy_installer']['updater']['filepath'] = {filepath}; (Optional) + * + * You must declare your sub-class of Legacy_ModulePhasedUpgrader as + * {namespace}_{classname} in {filepath}. You must specify classname. Others + * are decided by the naming convention without your descriptions. Namespace + * is ucfirst(dirname). Filepath is "admin/class/{classname}.class.php". + * + * For example, "news" module. + * + * $modversion['legacy_installer']['updater']['class'] = "Updater"; + * + * You must declare News_Updater in XOOPS_ROOT_PATH . "/modules/news/admin/class/Updater.class.php". + * + * In the case where you specify the filepath, take care you describe the + * filepath with absolute path. + * + * @subsection process Install Process + * + * \li Gets a instance of the update installer class through Legacy_ModuleUpdateAction::_getInstaller(). + * \li Sets the current XoopsModule to the instance. + * \li Builds the target XoopsModule from xoops_version, and sets it to the instance. + * \li Sets a value indicating whether an administrator hopes the force-mode, to the instance. + * \li Calls executeUpgrade(). + * + * @see Legacy_ModuleUpdateAction::_getInstaller() + * @see Legacy_ModulePhasedUpgrader + * @see Legacy_ModuleInstallUtils + */ class Legacy_ModuleUpdateAction extends Legacy_Action { /** Index: xoops2jp/html/modules/legacy/admin/actions/ModuleUninstallAction.class.php diff -u xoops2jp/html/modules/legacy/admin/actions/ModuleUninstallAction.class.php:1.1.2.2 xoops2jp/html/modules/legacy/admin/actions/ModuleUninstallAction.class.php:1.1.2.3 --- xoops2jp/html/modules/legacy/admin/actions/ModuleUninstallAction.class.php:1.1.2.2 Sun Oct 15 00:55:35 2006 +++ xoops2jp/html/modules/legacy/admin/actions/ModuleUninstallAction.class.php Wed Nov 1 20:55:09 2006 @@ -10,24 +10,83 @@ require_once XOOPS_LEGACY_PATH . "/admin/class/ModuleUninstaller.class.php"; require_once XOOPS_LEGACY_PATH . "/admin/forms/ModuleUninstallForm.class.php"; + /** - * Uninstall module + * @brief Module Uninstall function having possibility to extend by module developers. + * + * The precondition is that the specified module has been installed && none-actived. + * + * @section cuninstall The custom-uninstaller + * + * Module developers can use their own custom-uninstaller in this action. + * Unlike the module update function, the standard uninstaller in this action + * is perhaps no problems. But, duplicatable modules or some modules with the + * special framework may need the custom-uninstaller. + * + * @subsection convention Convention + * + * See Legacy_ModuleUninstallAction::_getInstaller(). + * + * \li $modversion['legacy_installer']['uninstaller']['class'] = {classname}; + * \li $modversion['legacy_installer']['uninstaller']['namespace'] = {namespace}; (Optional) + * \li $modversion['legacy_installer']['uninstaller']['filepath'] = {filepath}; (Optional) + * + * You must declare your sub-class of Legacy_ModuleUninstaller as + * {namespace}_{classname} in {filepath}. You must specify classname. Others + * are decided by the naming convention without your descriptions. Namespace + * is ucfirst(dirname). Filepath is "admin/class/{classname}.class.php". + * + * For example, "news" module. + * + * $modversion['legacy_installer']['uninstaller']['class'] = "Uninstaller"; + * + * You must declare News_Uninstaller in XOOPS_ROOT_PATH . "/modules/news/admin/class/Uninstallerr.class.php". + * + * In the case where you specify the filepath, take care you describe the + * filepath with absolute path. + * + * @subsection process Uninstall Process + * + * \li Gets a instance of the uninstaller class through Legacy_ModuleUninstallAction::_getInstaller(). + * \li Sets the current XoopsModule to the instance. + * \li Sets a value indicating whether an administrator hopes the force-mode, to the instance. + * \li Calls executeUninstall(). + * + * @see Legacy_ModuleUpdateAction::_getInstaller() + * @see Legacy_ModuleUninstaller + * @see Legacy_ModuleInstallUtils + * + * @todo These classes are good to abstract again. */ -class Legacy_ModuleUninstallAction extends Legacy_AbstractModuleInstallAction +class Legacy_ModuleUninstallAction extends Legacy_Action { /** + * @private * @var XCube_Delegate */ var $mUninstallSuccess = null; /** + * @private * @var XCube_Delegate */ var $mUninstallFail = null; + /** + * @private + * @var XoopsModule + */ + var $mXoopsModule = null; + + /** + * @private + * @var Legacy_ModuleUinstaller + */ + var $mInstaller = null; + function Legacy_ModuleUninstallAction($flag) { - parent::Legacy_AbstractModuleInstallAction($flag); + parent::Legacy_Action($flag); $this->mUninstallSuccess =& new XCube_Delegate(); $this->mUninstallSuccess->register('Legacy_ModuleUninstallAction.UninstallSuccess'); @@ -36,9 +95,58 @@ $this->mUninstallFail->register('Legacy_ModuleUninstallAction.UninstallFail'); } - function &_getInstaller($dirname) + function prepare(&$controller, &$xoopsUser) { - $installer =& new Legacy_ModuleUninstaller($dirname); + $dirname = $controller->mRoot->mContext->mRequest->getRequest('dirname'); + + $handler =& xoops_gethandler('module'); + $this->mXoopsModule =& $handler->getByDirname($dirname); + + if (!(is_object($this->mXoopsModule) && $this->mXoopsModule->get('isactive') == 0)) { + return false; + } + + $this->_setupActionForm(); + + $this->mInstaller =& $this->_getInstaller(); + + // + // Set the current object. + // + $this->mInstaller->setCurrentXoopsModule($this->mXoopsModule); + + return true; + } + + function &_getInstaller() + { + $dirname = $this->mXoopsModule->get('dirname'); + $this->mXoopsModule->loadInfo($dirname, false); + + $info = $this->mXoopsModule->modinfo; + + if (isset($info['legacy_installer']) && is_array($info['legacy_installer']) && isset($info['legacy_installer']['uninstaller'])) { + $updateInfo = $info['legacy_installer']['uninstaller']; + + $className = $updateInfo['class']; + $filePath = isset($updateInfo['filepath']) ? $updateInfo['filepath'] : XOOPS_MODULE_PATH . "/${dirname}/admin/class/${className}.class.php"; + $namespace = isset($updateInfo['namespace']) ? $updateInfo['namespace'] : ucfirst($dirname); + + if ($namespace != null) { + $className = "${namespace}_${className}"; + } + + if (!class_exists($className) && file_exists($filePath)) { + require_once $filePath; + } + + if (class_exists($className)) { + $installer =& new $className(); + return $installer; + } + } + + $installer =& new Legacy_ModuleUninstaller(); return $installer; } @@ -48,32 +156,54 @@ $this->mActionForm->prepare(); } + function getDefaultView(&$controller, &$xoopsUser) + { + $this->mActionForm->load($this->mXoopsModule); + + return LEGACY_FRAME_VIEW_INPUT; + } + + function execute(&$controller, &$xoopsUser) + { + if (isset($_REQUEST['_form_control_cancel'])) { + return LEGACY_FRAME_VIEW_CANCEL; + } + + $this->mActionForm->fetch(); + $this->mActionForm->validate(); + + if ($this->mActionForm->hasError()) { + return $this->getDefaultView($controller, $xoopsUser); + } + + $this->mInstaller->setForceMode($this->mActionForm->get('force')); + $this->mInstaller->executeUninstall(); + + return LEGACY_FRAME_VIEW_SUCCESS; + } + function executeViewSuccess(&$controller, &$xoopsUser, &$renderer) { - if (!$this->mLog->hasError()) { - $this->mUninstallSuccess->call(new XCube_Ref($this->mModuleObject), new XCube_Ref($this->mLog)); - XCube_DelegateUtils::call('Legacy.Admin.Event.ModuleUninstall.' . ucfirst($this->mModuleObject->get('dirname') . '.Success'), new XCube_Ref($this->mModuleObject), new XCube_Ref($this->mLog)); + if (!$this->mInstaller->mLog->hasError()) { + $this->mUninstallSuccess->call(new XCube_Ref($this->mXoopsModule), new XCube_Ref($this->mInstaller->mLog)); + XCube_DelegateUtils::call('Legacy.Admin.Event.ModuleUninstall.' . ucfirst($this->mXoopsModule->get('dirname') . '.Success'), new XCube_Ref($this->mXoopsModule), new XCube_Ref($this->mInstaller->mLog)); } else { - $this->mUninstallFail->call(new XCube_Ref($this->mModuleObject), new XCube_Ref($this->mLog)); - XCube_DelegateUtils::call('Legacy.Admin.Event.ModuleUninstall.' . ucfirst($this->mModuleObject->get('dirname') . '.Fail'), new XCube_Ref($this->mModuleObject), new XCube_Ref($this->mLog)); + $this->mUninstallFail->call(new XCube_Ref($this->mXoopsModule), new XCube_Ref($this->mInstaller->mLog)); + XCube_DelegateUtils::call('Legacy.Admin.Event.ModuleUninstall.' . ucfirst($this->mXoopsModule->get('dirname') . '.Fail'), new XCube_Ref($this->mXoopsModule), new XCube_Ref($this->mInstaller->mLog)); } $renderer->setTemplateName("module_uninstall_success.html"); - $renderer->setAttribute('module',$this->mModuleObject); - $renderer->setAttribute('log', $this->mLog->mMessages); + $renderer->setAttribute('module',$this->mXoopsModule); + $renderer->setAttribute('log', $this->mInstaller->mLog->mMessages); } - function executeViewIndex(&$controller, &$xoopsUser, &$renderer) + function executeViewInput(&$controller, &$xoopsUser, &$renderer) { $renderer->setTemplateName("module_uninstall.html"); $renderer->setAttribute('actionForm', $this->mActionForm); - $renderer->setAttribute('module', $this->mModuleObject); - } - - function executeViewInput(&$controller, &$xoopsUser, &$renderer) - { - $this->executeViewIndex(&$controller, &$xoopsUser, &$renderer); + $renderer->setAttribute('module', $this->mXoopsModule); + $renderer->setAttribute('currentVersion', round($this->mXoopsModule->get('version') / 100, 2)); } function executeViewCancel(&$controller, &$xoopsUser, &$renderer) From minahito @ users.sourceforge.jp Wed Nov 1 22:42:17 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Wed, 1 Nov 2006 22:42:17 +0900 Subject: [xoops-cvslog 5546] CVS update: xoops2jp/html/modules/legacy/admin/class Message-ID: <20061101134217.71AE32AC014@users.sourceforge.jp> Index: xoops2jp/html/modules/legacy/admin/class/ModuleUninstaller.class.php diff -u xoops2jp/html/modules/legacy/admin/class/ModuleUninstaller.class.php:1.1.2.3 xoops2jp/html/modules/legacy/admin/class/ModuleUninstaller.class.php:1.1.2.4 --- xoops2jp/html/modules/legacy/admin/class/ModuleUninstaller.class.php:1.1.2.3 Wed Nov 1 20:55:09 2006 +++ xoops2jp/html/modules/legacy/admin/class/ModuleUninstaller.class.php Wed Nov 1 22:42:17 2006 @@ -122,7 +122,7 @@ function _uninstallPreferences() { - Legacy_ModuleUtils::deleteAllConfigs($this->mModule, $this->mLog); + Legacy_ModuleUtils::deleteAllConfigs($this->_mXoopsModule, $this->mLog); } function _processScript() From minahito @ users.sourceforge.jp Wed Nov 1 23:56:56 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Wed, 1 Nov 2006 23:56:56 +0900 Subject: [xoops-cvslog 5547] CVS update: xoops2jp/html/modules/legacy/admin/templates Message-ID: <20061101145656.C298A2AC014@users.sourceforge.jp> Index: xoops2jp/html/modules/legacy/admin/templates/module_install.html diff -u xoops2jp/html/modules/legacy/admin/templates/module_install.html:1.1.2.3 xoops2jp/html/modules/legacy/admin/templates/module_install.html:1.1.2.4 --- xoops2jp/html/modules/legacy/admin/templates/module_install.html:1.1.2.3 Sun Oct 15 01:54:59 2006 +++ xoops2jp/html/modules/legacy/admin/templates/module_install.html Wed Nov 1 23:56:56 2006 @@ -40,10 +40,8 @@ <{$smarty.const._AD_LEGACY_LANG_VERSION}> - <{math equation="v/100" v=$module->get('version') format="%.2f"}> - <{if $module->get('version') != $module->modinfo.version * 100 }> - » <{math equation=$module->modinfo.version format="%.2f"}> - <{/if}> + + <{$currentVersion}> From minahito @ users.sourceforge.jp Thu Nov 2 00:01:08 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Thu, 2 Nov 2006 00:01:08 +0900 Subject: [xoops-cvslog 5548] CVS update: xoops2jp/html/modules/legacy/admin/actions Message-ID: <20061101150108.AA6BC2AC055@users.sourceforge.jp> Index: xoops2jp/html/modules/legacy/admin/actions/ModuleInstallAction.class.php diff -u xoops2jp/html/modules/legacy/admin/actions/ModuleInstallAction.class.php:1.1.2.2 xoops2jp/html/modules/legacy/admin/actions/ModuleInstallAction.class.php:1.1.2.3 --- xoops2jp/html/modules/legacy/admin/actions/ModuleInstallAction.class.php:1.1.2.2 Sun Oct 15 00:54:58 2006 +++ xoops2jp/html/modules/legacy/admin/actions/ModuleInstallAction.class.php Thu Nov 2 00:01:08 2006 @@ -11,13 +11,54 @@ require_once XOOPS_LEGACY_PATH."/admin/forms/ModuleInstallForm.class.php"; /** - * Install module + * @brief Module Install function having possibility to extend by module developers. + * + * The precondition is that the specified module has been not installed. + * + * @section cinstall The custom-installer + * + * Module developers can use their own custom-installer in this action. Unlike + * the module update function, the standard installer in this action is perhaps + * no problems. But, duplicatable modules or some modules with the special + * framework may need the custom-installer. + * + * @subsection convention Convention + * + * See Legacy_ModuleInstallAction::_getInstaller(). + * + * \li $modversion['legacy_installer']['installer']['class'] = {classname}; + * \li $modversion['legacy_installer']['installer']['namespace'] = {namespace}; (Optional) + * \li $modversion['legacy_installer']['installer']['filepath'] = {filepath}; (Optional) + * + * You must declare your sub-class of Legacy_ModuleInstaller as + * {namespace}_{classname} in {filepath}. You must specify classname. Others + * are decided by the naming convention without your descriptions. Namespace + * is ucfirst(dirname). Filepath is "admin/class/{classname}.class.php". + * + * For example, "news" module. + * + * $modversion['legacy_installer']['installer']['class'] = "Installer"; + * + * You must declare News_Installer in XOOPS_ROOT_PATH . "/modules/news/admin/class/Installerr.class.php". + * + * In the case where you specify the filepath, take care you describe the + * filepath with absolute path. + * + * @subsection process Install Process + * + * \li Gets a instance of the installer class through Legacy_ModuleInstallAction::_getInstaller(). + * \li Sets the new XoopsModule built from xoops_version, to the instance. + * \li Sets a value indicating whether an administrator hopes the force-mode, to the instance. + * \li Calls executeInstall(). + * + * @see Legacy_ModuleInstallAction::_getInstaller() + * @see Legacy_ModuleInstaller + * @see Legacy_ModuleInstallUtils + * + * @todo These classes are good to abstract again. */ -class Legacy_ModuleInstallAction extends Legacy_AbstractModuleInstallAction +class Legacy_ModuleInstallAction extends Legacy_Action { - var $mLicence; - var $mLicenceText; - /** * @var XCube_Delegate */ @@ -28,9 +69,21 @@ */ var $mInstallFail = null; + /** + * @private + * @var XoopsModule + */ + var $mXoopsModule = null; + + /** + * @private + * @var Legacy_ModuleUinstaller + */ + var $mInstaller = null; + function Legacy_ModuleInstallAction($flag) { - parent::Legacy_AbstractModuleInstallAction($flag); + parent::Legacy_Action($flag); $this->mInstallSuccess =& new XCube_Delegate(); $this->mInstallSuccess->register('Legacy_ModuleInstallAction.InstallSuccess'); @@ -39,58 +92,136 @@ $this->mInstallFail->register('Legacy_ModuleInstallAction.InstallFail'); } - function &_getInstaller($dirname) + function prepare(&$controller, &$xoopsUser) { - $installer =& new Legacy_ModuleInstaller($dirname); + $dirname = $controller->mRoot->mContext->mRequest->getRequest('dirname'); + + $handler =& xoops_gethandler('module'); + $this->mXoopsModule =& $handler->getByDirname($dirname); + + if (is_object($this->mXoopsModule)) { + return false; + } + + $this->mXoopsModule =& $handler->create(); + $this->mXoopsModule->set('weight', 1); + $this->mXoopsModule->loadInfoAsVar($dirname); + + if ($this->mXoopsModule->get('dirname') == null) { + return null; + } + + if ($this->mXoopsModule->get('dirname') == 'system') { + $this->mXoopsModule->set('mid', 1); + } + + $this->_setupActionForm(); + + $this->mInstaller =& $this->_getInstaller(); + + // + // Set the current object. + // + $this->mInstaller->setCurrentXoopsModule($this->mXoopsModule); + + return true; + } + + function &_getInstaller() + { + $dirname = $this->mXoopsModule->get('dirname'); + $this->mXoopsModule->loadInfo($dirname, false); + + $info = $this->mXoopsModule->modinfo; + + if (isset($info['legacy_installer']) && is_array($info['legacy_installer']) && isset($info['legacy_installer']['installer'])) { + $updateInfo = $info['legacy_installer']['installer']; + + $className = $updateInfo['class']; + $filePath = isset($updateInfo['filepath']) ? $updateInfo['filepath'] : XOOPS_MODULE_PATH . "/${dirname}/admin/class/${className}.class.php"; + $namespace = isset($updateInfo['namespace']) ? $updateInfo['namespace'] : ucfirst($dirname); + + if ($namespace != null) { + $className = "${namespace}_${className}"; + } + + if (!class_exists($className) && file_exists($filePath)) { + require_once $filePath; + } + + if (class_exists($className)) { + $installer =& new $className(); + return $installer; + } + } + + $installer =& new Legacy_ModuleInstaller(); return $installer; } - + function _setupActionForm() { $this->mActionForm =& new Legacy_ModuleInstallForm(); $this->mActionForm->prepare(); } - function executeViewSuccess(&$controller,&$xoopsUser,&$renderer) + function getDefaultView(&$controller, &$xoopsUser) + { + $this->mActionForm->load($this->mXoopsModule); + + return LEGACY_FRAME_VIEW_INPUT; + } + + function execute(&$controller, &$xoopsUser) { - if (!$this->mLog->hasError()) { - $this->mInstallSuccess->call(new XCube_Ref($this->mModuleObject), new XCube_Ref($this->mLog)); - XCube_DelegateUtils::call('Legacy.Admin.Event.ModuleInstall.' . ucfirst($this->mModuleObject->get('dirname') . '.Success'), new XCube_Ref($this->mModuleObject), new XCube_Ref($this->mLog)); + if (isset($_REQUEST['_form_control_cancel'])) { + return LEGACY_FRAME_VIEW_CANCEL; } - else { - $this->mInstallFail->call(new XCube_Ref($this->mModuleObject), new XCube_Ref($this->mLog)); - XCube_DelegateUtils::call('Legacy.Admin.Event.ModuleInstall.' . ucfirst($this->mModuleObject->get('dirname') . '.Fail'), new XCube_Ref($this->mModuleObject), new XCube_Ref($this->mLog)); + + $this->mActionForm->fetch(); + $this->mActionForm->validate(); + + if ($this->mActionForm->hasError()) { + return $this->getDefaultView($controller, $xoopsUser); } + + $this->mInstaller->setForceMode($this->mActionForm->get('force')); + $this->mInstaller->executeInstall(); - $renderer->setTemplateName("module_install_success.html"); - $renderer->setAttribute('module', $this->mModuleObject); - $renderer->setAttribute('log', $this->mLog->mMessages); + return LEGACY_FRAME_VIEW_SUCCESS; } - - function executeViewIndex(&$controller,&$xoopsUser,&$renderer) + + /** + * @todo no $renderer. It should be $render. + */ + function executeViewSuccess(&$controller,&$xoopsUser,&$renderer) { - $renderer->setAttribute('module', $this->mModuleObject); - $renderer->setAttribute('actionForm', $this->mActionForm); - - if (isset($this->mModuleObject->modinfo['installer'])) { - // - // Jump - // - $controller->executeForward('index.php?action=InstallWizard&dirname=' . $this->mModuleObject->get('dirname')); + if (!$this->mInstaller->mLog->hasError()) { + $this->mInstallSuccess->call(new XCube_Ref($this->mXoopsModule), new XCube_Ref($this->mInstaller->mLog)); + XCube_DelegateUtils::call('Legacy.Admin.Event.ModuleInstall.' . ucfirst($this->mXoopsModule->get('dirname') . '.Success'), new XCube_Ref($this->mXoopsModule), new XCube_Ref($this->mInstaller->mLog)); } else { - $renderer->setTemplateName("module_install.html"); + $this->mInstallFail->call(new XCube_Ref($this->mXoopsModule), new XCube_Ref($this->mInstaller->mLog)); + XCube_DelegateUtils::call('Legacy.Admin.Event.ModuleInstall.' . ucfirst($this->mXoopsModule->get('dirname') . '.Fail'), new XCube_Ref($this->mXoopsModule), new XCube_Ref($this->mInstaller->mLog)); } + + $renderer->setTemplateName("module_install_success.html"); + $renderer->setAttribute('module', $this->mXoopsModule); + $renderer->setAttribute('log', $this->mInstaller->mLog->mMessages); } - function executeViewInput(&$controller, &$xoopsUser, &$renderer) + /** + * @todo no $renderer. It should be $render. + */ + function executeViewInput(&$controller,&$xoopsUser,&$renderer) { $renderer->setTemplateName("module_install.html"); - $renderer->setAttribute('module', $this->mModuleObject); + $renderer->setAttribute('module', $this->mXoopsModule); $renderer->setAttribute('actionForm', $this->mActionForm); + $renderer->setAttribute('currentVersion', round($this->mXoopsModule->get('version') / 100, 2)); } - - function executeViewCancel(&$controller, &$xoopsUser, &$renderer) + + function executeViewCancel(&$controller, &$xoopsUser, &$render) { $controller->executeForward("./index.php?action=InstallList"); } From minahito @ users.sourceforge.jp Thu Nov 2 00:01:25 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Thu, 2 Nov 2006 00:01:25 +0900 Subject: [xoops-cvslog 5549] CVS update: xoops2jp/html/modules/legacy/admin/actions Message-ID: <20061101150125.A5B782AC068@users.sourceforge.jp> Index: xoops2jp/html/modules/legacy/admin/actions/ModuleUninstallAction.class.php diff -u xoops2jp/html/modules/legacy/admin/actions/ModuleUninstallAction.class.php:1.1.2.3 xoops2jp/html/modules/legacy/admin/actions/ModuleUninstallAction.class.php:1.1.2.4 --- xoops2jp/html/modules/legacy/admin/actions/ModuleUninstallAction.class.php:1.1.2.3 Wed Nov 1 20:55:09 2006 +++ xoops2jp/html/modules/legacy/admin/actions/ModuleUninstallAction.class.php Thu Nov 2 00:01:25 2006 @@ -52,7 +52,7 @@ * \li Sets a value indicating whether an administrator hopes the force-mode, to the instance. * \li Calls executeUninstall(). * - * @see Legacy_ModuleUpdateAction::_getInstaller() + * @see Legacy_ModuleUninstallAction::_getInstaller() * @see Legacy_ModuleUninstaller * @see Legacy_ModuleInstallUtils * From minahito @ users.sourceforge.jp Thu Nov 2 00:01:42 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Thu, 2 Nov 2006 00:01:42 +0900 Subject: [xoops-cvslog 5550] CVS update: xoops2jp/html/modules/legacy/admin/class Message-ID: <20061101150142.8859F2AC06D@users.sourceforge.jp> Index: xoops2jp/html/modules/legacy/admin/class/ModuleInstaller.class.php diff -u xoops2jp/html/modules/legacy/admin/class/ModuleInstaller.class.php:1.1.2.3 xoops2jp/html/modules/legacy/admin/class/ModuleInstaller.class.php:1.1.2.4 --- xoops2jp/html/modules/legacy/admin/class/ModuleInstaller.class.php:1.1.2.3 Tue Oct 31 16:21:21 2006 +++ xoops2jp/html/modules/legacy/admin/class/ModuleInstaller.class.php Thu Nov 2 00:01:42 2006 @@ -1,141 +1,146 @@ mProcessScript->register('Legacy_ModuleInstaller.ProcessScript'); - $this->mProcessScript->add('Legacy_ModuleInstaller::_processScript'); - - $this->mInstallTable->register('Legacy_ModuleInstaller.InstallTable'); - $this->mInstallTable->add('Legacy_ModuleUtils::installTable'); - - $this->mInstallTemplate->register('Legacy_ModuleInstaller.InstallTemplate'); - $this->mInstallTemplate->add('Legacy_ModuleInstaller::_installTemplate'); + $this->mLog =& new Legacy_ModuleUtilsSimpleLog(); } - /** - * Load xoops module object that isn't installed and return it. - * @static - * @access public - * @param $dirname string - * @return XoopsModule - */ - function &loadModuleObject($dirname) - { - $ret = null; - - $moduleHandler =& xoops_gethandler('module'); - $module =& $moduleHandler->getByDirname($dirname); - - if (is_object($module)) - return $ret; - - $module =& $moduleHandler->create(); - $module->setVar('weight', 1); - $module->loadInfoAsVar($this->mDirname); - - if ($module->get('dirname') == null) { - return $ret; - } - - if ($module->get('dirname') == 'system') { - $module->setVar('mid', 1); - } - - if (isset($module->modinfo['installer']) && isset($module->modinfo['installer']['licence']) ) { - $this->mAgree = true; - } - - return $module; - } - + /** + * Sets the current XoopsModule. + * + * @public + * @param XoopsModule $xoopsModule + */ + function setCurrentXoopsModule(&$xoopsModule) + { + $this->_mXoopsModule =& $xoopsModule; + } + + /** + * Sets a value indicating whether the force mode is on. + * @param bool $isForceMode + */ + function setForceMode($isForceMode) + { + $this->_mForceMode = $isForceMode; + } + + function _installTables() + { + Legacy_ModuleInstallUtils::installSQLAutomatically($this->_mXoopsModule, $this->mLog); + } + + /** + * @todo Do rewrite. + */ function _installModule() { - if (parent::_installModule()) { - $gpermHandler =& xoops_gethandler('groupperm'); + $moduleHandler =& xoops_gethandler('module'); + if (!$moduleHandler->insert($this->_mXoopsModule)) { + $this->mLog->addError("*Could not install module information*"); + return false; + } + + $gpermHandler =& xoops_gethandler('groupperm'); - // - // Add a permission which administrators can manage. - // - if ($this->mModule->getInfo('hasAdmin')) { - $adminPerm =& $this->_createPermission(XOOPS_GROUP_ADMIN); - $adminPerm->setVar('gperm_name', 'module_admin'); + // + // Add a permission which administrators can manage. + // + if ($this->_mXoopsModule->getInfo('hasAdmin')) { + $adminPerm =& $this->_createPermission(XOOPS_GROUP_ADMIN); + $adminPerm->setVar('gperm_name', 'module_admin'); - if (!$gpermHandler->insert($adminPerm)) { - $log->addError(_AD_LEGACY_ERROR_COULD_NOT_SET_ADMIN_PERMISSION); - } + if (!$gpermHandler->insert($adminPerm)) { + $this->mLog->addError(_AD_LEGACY_ERROR_COULD_NOT_SET_ADMIN_PERMISSION); } + } - // - // Add a permission which administrators can manage. (Special for Legacy System Module) - // - if ($this->mModule->getVar('dirname') == 'system') { - $root =& XCube_Root::getSingleton(); - $root->mLanguageManager->loadModuleAdminMessageCatalog('system'); - - require_once XOOPS_ROOT_PATH . "/modules/system/constants.php"; - - $fileHandler = opendir(XOOPS_ROOT_PATH . "/modules/system/admin"); - while ($file = readdir($fileHandler)) { - $infoFile = XOOPS_ROOT_PATH . "/modules/system/admin/" . $file . "/xoops_version.php"; - if (file_exists($infoFile)) { - require_once $infoFile; - if (!empty($modversion['category'])) { - $sysAdminPerm =& $this->_createPermission(XOOPS_GROUP_ADMIN); - $adminPerm->setVar('gperm_itemid', $modversion['category']); - $adminPerm->setVar('gperm_name', 'system_admin'); - if (!$gpermHandler->insert($adminPerm)) { - $log->addError(_AD_LEGACY_ERROR_COULD_NOT_SET_SYSTEM_PERMISSION); - } - unset($sysAdminPerm); + // + // Add a permission which administrators can manage. (Special for Legacy System Module) + // + if ($this->_mXoopsModule->getVar('dirname') == 'system') { + $root =& XCube_Root::getSingleton(); + $root->mLanguageManager->loadModuleAdminMessageCatalog('system'); + + require_once XOOPS_ROOT_PATH . "/modules/system/constants.php"; + + $fileHandler = opendir(XOOPS_ROOT_PATH . "/modules/system/admin"); + while ($file = readdir($fileHandler)) { + $infoFile = XOOPS_ROOT_PATH . "/modules/system/admin/" . $file . "/xoops_version.php"; + if (file_exists($infoFile)) { + require_once $infoFile; + if (!empty($modversion['category'])) { + $sysAdminPerm =& $this->_createPermission(XOOPS_GROUP_ADMIN); + $adminPerm->setVar('gperm_itemid', $modversion['category']); + $adminPerm->setVar('gperm_name', 'system_admin'); + if (!$gpermHandler->insert($adminPerm)) { + $this->mLog->addError(_AD_LEGACY_ERROR_COULD_NOT_SET_SYSTEM_PERMISSION); } - unset($modversion); + unset($sysAdminPerm); } + unset($modversion); } } - - if ($this->mModule->getInfo('hasMain')) { - $read_any = $this->mModule->getInfo('read_any'); - if ($read_any) { - $memberHandler =& xoops_gethandler('member'); - $groupObjects =& $memberHandler->getGroups(); - // - // Add a permission all group members and guest can read. - // - foreach($groupObjects as $group) { - $readPerm =& $this->_createPermission($group->getVar('groupid')); - $readPerm->setVar('gperm_name', 'module_read'); + } + + if ($this->_mXoopsModule->getInfo('hasMain')) { + $read_any = $this->_mXoopsModule->getInfo('read_any'); + if ($read_any) { + $memberHandler =& xoops_gethandler('member'); + $groupObjects =& $memberHandler->getGroups(); + // + // Add a permission all group members and guest can read. + // + foreach($groupObjects as $group) { + $readPerm =& $this->_createPermission($group->getVar('groupid')); + $readPerm->setVar('gperm_name', 'module_read'); - if (!$gpermHandler->insert($readPerm)) { - $log->addError(_AD_LEGACY_ERROR_COULD_NOT_SET_READ_PERMISSION); - } + if (!$gpermHandler->insert($readPerm)) { + $log->addError(_AD_LEGACY_ERROR_COULD_NOT_SET_READ_PERMISSION); } - } else { - // - // Add a permission which administrators can read. - // - $root =& XCube_Root::getSingleton(); - $groups = $root->mContext->mXoopsUser->getGroups(); - foreach($groups as $mygroup) { - $readPerm =& $this->_createPermission($mygroup); - $readPerm->setVar('gperm_name', 'module_read'); + } + } else { + // + // Add a permission which administrators can read. + // + $root =& XCube_Root::getSingleton(); + $groups = $root->mContext->mXoopsUser->getGroups(); + foreach($groups as $mygroup) { + $readPerm =& $this->_createPermission($mygroup); + $readPerm->setVar('gperm_name', 'module_read'); - if (!$gpermHandler->insert($readPerm)) { - $log->addError(_AD_LEGACY_ERROR_COULD_NOT_SET_READ_PERMISSION); - } + if (!$gpermHandler->insert($readPerm)) { + $this->mLog->addError(_AD_LEGACY_ERROR_COULD_NOT_SET_READ_PERMISSION); } } } @@ -155,7 +160,7 @@ $perm =& $gpermHandler->create(); $perm->setVar('gperm_groupid', $group); - $perm->setVar('gperm_itemid', $this->mModule->getVar('mid')); + $perm->setVar('gperm_itemid', $this->_mXoopsModule->getVar('mid')); $perm->setVar('gperm_modid', 1); return $perm; @@ -164,46 +169,30 @@ /** * @static */ - function _installTemplate(&$module, &$log) + function _installTemplates() { - Legacy_ModuleUtils::installAllModuleTemplates($module, $log); + Legacy_ModuleInstallUtils::installAllOfModuleTemplates($this->_mXoopsModule, $this->mLog); } - function _installBlock() + function _installBlocks() { - $definedBlocks = $this->mModule->getInfo('blocks'); - if($definedBlocks == false) - return true; - - $blockHandler =& xoops_gethandler('block'); - - $func_num=0; - foreach ($definedBlocks as $block) { - $func_num++; - $newBlock =& Legacy_ModuleUtils::createBlockByInfo($this->mModule, $block, $func_num); - - Legacy_ModuleUtils::installBlock($this->mModule, $newBlock, $block, $this->mLog); - } + Legacy_ModuleInstallUtils::installAllOfBlocks($this->_mXoopsModule, $this->mLog); } - function _installNotification() - { - } - - function _installPreference() + function _installPreferences() { - Legacy_ModuleUtils::insertAllConfigs($this->mModule, $this->mLog); + Legacy_ModuleInstallUtils::installAllOfConfigs($this->_mXoopsModule, $this->mLog); } - function _processScript(&$module, &$log) + function _processScript() { - $installScript = trim($module->getInfo('onInstall')); + $installScript = trim($this->_mXoopsModule->getInfo('onInstall')); if ($installScript != false) { - require_once XOOPS_MODULE_PATH . "/" . $module->getVar('dirname') . "/" . $installScript; - $funcName = 'xoops_module_install_' . $module->getVar('dirname'); + require_once XOOPS_MODULE_PATH . "/" . $this->_mXoopsModule->get('dirname') . "/" . $installScript; + $funcName = 'xoops_module_install_' . $this->_mXoopsModule->get('dirname'); if (function_exists($funcName)) { if (!call_user_func($funcName, $module)) { - $log->addError(XCUbe_Utils::formatMessage(_AD_LEGACY_ERROR_FAILED_TO_EXECUTE_CALLBACK, $funcName)); + $this->mLog->addError(XCUbe_Utils::formatMessage(_AD_LEGACY_ERROR_FAILED_TO_EXECUTE_CALLBACK, $funcName)); } } } @@ -212,11 +201,11 @@ function _processReport() { if (!$this->mLog->hasError()) { - $this->mLog->add(XCube_Utils::formatMessage(_AD_LEGACY_MESSAGE_INSTALLATION_MODULE_SUCCESSFUL, $this->mModule->get('name'))); + $this->mLog->add(XCube_Utils::formatMessage(_AD_LEGACY_MESSAGE_INSTALLATION_MODULE_SUCCESSFUL, $this->_mXoopsModule->get('name'))); } else { - if (is_object($this->mModule)) { - $this->mLog->addError(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_INSTALLATION_MODULE_FAILURE, $this->mModule->get('name'))); + if (is_object($this->_mXoopsModule)) { + $this->mLog->addError(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_INSTALLATION_MODULE_FAILURE, $this->_mXoopsModule->get('name'))); } else { $this->mLog->addError(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_INSTALLATION_MODULE_FAILURE, $this->mDirname)); @@ -224,10 +213,47 @@ } } - function hasAgree() - { - return $this->mAgree; - } + /** + * @todo Check whether $this->_mXoopsObject is ready. + */ + function executeInstall() + { + $this->_installTables(); + if (!$this->_mForceMode && $this->mLog->hasError()) { + $this->_processReport(); + return false; + } + + $this->_installModule(); + if (!$this->_mForceMode && $this->mLog->hasError()) { + $this->_processReport(); + return false; + } + + $this->_installTemplates(); + if (!$this->_mForceMode && $this->mLog->hasError()) { + $this->_processReport(); + return false; + } + + $this->_installBlocks(); + if (!$this->_mForceMode && $this->mLog->hasError()) { + $this->_processReport(); + return false; + } + + $this->_installPreferences(); + if (!$this->_mForceMode && $this->mLog->hasError()) { + $this->_processReport(); + return false; + } + + $this->_processScript(); + + $this->_processReport(); + + return true; + } } ?> \ No newline at end of file From minahito @ users.sourceforge.jp Thu Nov 2 00:02:00 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Thu, 2 Nov 2006 00:02:00 +0900 Subject: [xoops-cvslog 5551] CVS update: xoops2jp/html/modules/legacy/admin/class Message-ID: <20061101150200.35BD82AC068@users.sourceforge.jp> Index: xoops2jp/html/modules/legacy/admin/class/ModuleInstallUtils.class.php diff -u xoops2jp/html/modules/legacy/admin/class/ModuleInstallUtils.class.php:1.1.2.1 xoops2jp/html/modules/legacy/admin/class/ModuleInstallUtils.class.php:1.1.2.2 --- xoops2jp/html/modules/legacy/admin/class/ModuleInstallUtils.class.php:1.1.2.1 Wed Nov 1 20:54:56 2006 +++ xoops2jp/html/modules/legacy/admin/class/ModuleInstallUtils.class.php Thu Nov 2 00:02:00 2006 @@ -15,6 +15,54 @@ class Legacy_ModuleInstallUtils { /** + * Executes SQL file which xoops_version of $module specifies. This + * function is usefull for installers, but it's impossible to control + * for detail. + * + * @static + * @param XoopsModule $module + * @param Legacy_ModuleUtilsSimpleLog $log + * @note FOR THE CUSTOM-INSTALLER + */ + function installSQLAutomatically(&$module, &$log) + { + $sqlfileInfo =& $module->getInfo('sqlfile'); + $dirname = $module->getVar('dirname'); + + if (!isset($sqlfileInfo[XOOPS_DB_TYPE])) { + return; + } + + require_once XOOPS_MODULE_PATH . "/legacy/admin/class/Legacy_SQLScanner.class.php"; + $scanner =& new Legacy_SQLScanner(); + $scanner->setDB_PREFIX(XOOPS_DB_PREFIX); + + $sqlfile = $sqlfileInfo[XOOPS_DB_TYPE]; + if (!$scanner->loadFile(XOOPS_MODULE_PATH . "/${dirname}/" . $sqlfile)) { + $log->addError(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_SQL_FILE_NOT_FOUND, $sqlfile)); + return false; + } + + $scanner->parse(); + $sqls = $scanner->getSQL(); + + $root =& XCube_Root::getSingleton(); + $db =& $root->mController->getDB(); + + // + // TODO The following variable exists for rollback, but it is not implemented. + // + foreach ($sqls as $sql) { + if (!$db->query($sql)) { + $log->addError($db->error()); + return; + } + } + + $log->addReport(_AD_LEGACY_MESSAGE_DATABASE_SETUP_FINISHED); + } + + /** * Installs all of module templates $module specify. This function is * usefull for installer and updater. In the case of updater, you should * uninstall all of module templates before this function. @@ -37,10 +85,69 @@ $templates = $module->getInfo('templates'); if ($templates != false) { foreach ($templates as $template) { - Legacy_ModuleUtils::installModuleTemplate($module, $template, $log); + Legacy_ModuleInstallUtils::installModuleTemplate($module, $template, $log); } } } + + /** + * Inserts the specified template to DB. + * + * @section Attention + * + * This function depends the specific spec of Legacy_RenderSystem, but this + * static function is needed by the 2nd installer of Legacy System. + * + * @static + * @param XoopsModule $module + * @param string[][] $template + * @param Legacy_ModuleUtilsSimpleLog $log + * @return bool + * + * @note This is not usefull a litte for custom-installers. + * @todo We'll need the way to specify the template by identity or others. + */ + function installModuleTemplate($module, $template, &$log) + { + $tplHandler =& xoops_gethandler('tplfile'); + + $fileName = trim($template['file']); + + $tpldata = Legacy_ModuleInstallUtils::readTemplateFile($module->get('dirname'), $fileName); + if ($tpldata == false) + return false; + + // + // Create template file object, then store it. + // + $tplfile =& $tplHandler->create(); + $tplfile->setVar('tpl_refid', $module->getVar('mid')); + $tplfile->setVar('tpl_lastimpoerted', 0); + $tplfile->setVar('tpl_lastmodified', time()); + + if (preg_match("/\.css$/i", $fileName)) { + $tplfile->setVar('tpl_type', 'css'); + } + else { + $tplfile->setVar('tpl_type', 'module'); + } + + $tplfile->setVar('tpl_source', $tpldata, true); + $tplfile->setVar('tpl_module', $module->getVar('dirname')); + $tplfile->setVar('tpl_tplset', 'default'); + $tplfile->setVar('tpl_file', $fileName, true); + + $description = isset($tpl['description']) ? $tpl['description'] : ''; + $tplfile->setVar('tpl_desc', $description, true); + + if ($tplHandler->insert($tplfile)) { + $log->addReport(XCube_Utils::formatMessage(_AD_LEGACY_MESSAGE_TEMPLATE_INSTALLED, $fileName)); + } + else { + $log->addError(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_COULD_NOT_INSTALL_TEMPLATE, $fileName)); + return false; + } + } /** * Uninstalls all of module templates $module specify. This function is @@ -117,8 +224,8 @@ $func_num = 0; foreach ($definedBlocks as $block) { $func_num++; - $newBlock =& Legacy_ModuleUtils::createBlockByInfo($module, $block, $func_num); - Legacy_ModuleUtils::installBlock($module, $newBlock, $block, $this->mLog); + $newBlock =& Legacy_ModuleInstallUtils::createBlockByInfo($module, $block, $func_num); + Legacy_ModuleInstallUtils::installBlock($module, $newBlock, $block, $this->mLog); } } @@ -153,6 +260,128 @@ } /** + * Create XoopsBlock object by array that is defined in xoops_version, return it. + * @param $module XoopsModule + * @param $block array + * @return XoopsBlock + */ + function &createBlockByInfo(&$module, $block, $func_num) + { + $options = isset($block['options']) ? $block['options'] : null; + $edit_func = isset($block['edit_func']) ? $block['edit_func'] : null; + $template = isset($block['template']) ? $block['template'] : null; + $visible = isset($block['visible']) ? $block['visible'] : (isset($block['visible_any']) ? $block['visible_any']: 0); + $blockHandler =& xoops_gethandler('block'); + $blockObj =& $blockHandler->create(); + + $blockObj->set('mid', $module->getVar('mid')); + $blockObj->set('options', $options); + $blockObj->set('name', $block['name']); + $blockObj->set('title', $block['name']); + $blockObj->set('block_type', 'M'); + $blockObj->set('c_type', 1); + $blockObj->set('isactive', 1); + $blockObj->set('dirname', $module->getVar('dirname')); + $blockObj->set('func_file', $block['file']); + + // + // IMPORTANT CONVENTION + // + $show_func = ""; + if (isset($block['class'])) { + $show_func = "cl::" . $block['class']; + } + else { + $show_func = $block['show_func']; + } + + $blockObj->set('show_func', $show_func); + $blockObj->set('edit_func', $edit_func); + $blockObj->set('template', $template); + $blockObj->set('last_modified', time()); + $blockObj->set('visible', $visible); + + $func_num = isset($block['func_num']) ? intval($block['func_num']) : $func_num; + $blockObj->set('func_num', $func_num); + + return $blockObj; + } + + /** + * This function can receive both new and update. + * @param $module XoopsModule + * @param $blockObj XoopsBlock + * @param $block array + * @return bool + */ + function installBlock(&$module, &$blockObj, &$block, &$log) + { + $isNew = $blockObj->isNew(); + $blockHandler =& xoops_gethandler('block'); + + if (!empty($block['show_all_module'])) { + $autolink = false; + } else { + $autolink = true; + } + if (!$blockHandler->insert($blockObj, $autolink)) { + $log->addError(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_COULD_NOT_INSTALL_BLOCK, $blockObj->getVar('name'))); + + return false; + } + else { + $log->addReport(XCube_Utils::formatMessage(_AD_LEGACY_MESSAGE_BLOCK_INSTALLED, $blockObj->getVar('name'))); + + $tplHandler =& xoops_gethandler('tplfile'); + + if (!Legacy_ModuleInstallUtils::installAllOfBlockTemplates($module, $blockObj)) { + $log->addError(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_BLOCK_TEMPLATE_INSTALL, $blockObj->getVar('name'))); + } + + // + // Process of a permission. + // + if ($isNew) { + if (!empty($block['show_all_module'])) { + $link_sql = "INSERT INTO " . $blockHandler->db->prefix('block_module_link') . " (block_id, module_id) VALUES (".$blockObj->getVar('bid').", 0)"; + if (!$blockHandler->db->query($link_sql)) { + $log->addWarn(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_COULD_NOT_SET_LINK, $blockObj->getVar('name'))); + } + } + $gpermHandler =& xoops_gethandler('groupperm'); + $bperm =& $gpermHandler->create(); + $bperm->setVar('gperm_itemid', $blockObj->getVar('bid')); + $bperm->setVar('gperm_name', 'block_read'); + $bperm->setVar('gperm_modid', 1); + + if (!empty($block['visible_any'])) { + $memberHandler =& xoops_gethandler('member'); + $groupObjects =& $memberHandler->getGroups(); + foreach($groupObjects as $group) { + $bperm->setVar('gperm_groupid', $group->getVar('groupid')); + $bperm->setNew(); + if (!$gpermHandler->insert($bperm)) { + $log->addWarn(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_COULD_NOT_SET_BLOCK_PERMISSION, $blockObj->getVar('name'))); + } + } + } else { + $root =& XCube_Root::getSingleton(); + $groups = $root->mContext->mXoopsUser->getGroups(); + foreach ($groups as $mygroup) { + $bperm->setVar('gperm_groupid', $mygroup); + $bperm->setNew(); + if (!$gpermHandler->insert($bperm)) { + $log->addWarn(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_COULD_NOT_SET_BLOCK_PERMISSION, $blockObj->getVar('name'))); + } + } + } + } + + return true; + } + } + + /** * Uninstalls a block which $block specifies. In the same time, deletes * permissions for the block. * @@ -178,6 +407,252 @@ $criteria->add(new Criteria('gperm_modid', 1)); $gpermHandler->deleteAll($criteria); } + + /** + * Save the information of block's template specified and the source code of it + * to database. + * @return bool + */ + function installAllOfBlockTemplates(&$module, &$block) + { + if ($block->get('template') == null) { + return true; + } + + $tplHandler =& xoops_gethandler('tplfile'); + + $criteria =& new CriteriaCompo(); + $criteria->add(new Criteria('tpl_type', 'block')); + $criteria->add(new Criteria('tpl_tplset', 'default')); + $criteria->add(new Criteria('tpl_module', $module->getVar('dirname'))); + $criteria->add(new Criteria('tpl_file', $block->getVar('template'))); + $tplfiles =& $tplHandler->getObjects($criteria); + + if (count($tplfiles) > 0) { + $tplfile =& $tplfiles[0]; + } + else { + $tplfile =& $tplHandler->create(); + $tplfile->setVar('tpl_refid', $block->getVar('bid')); + $tplfile->setVar('tpl_tplset', 'default'); + $tplfile->setVar('tpl_file', $block->getVar('template')); + $tplfile->setVar('tpl_module', $module->getVar('dirname')); + $tplfile->setVar('tpl_type', 'block'); + // $tplfile->setVar('tpl_desc', $tpl_desc); + $tplfile->setVar('tpl_lastimported', 0); + } + + $tplSource = Legacy_ModuleInstallUtils::readTemplateFile($module->getVar('dirname'), $block->getVar('template'), true); + $tplfile->setVar('tpl_source', $tplSource); + $tplfile->setVar('tpl_lastmodified', time()); + + return $tplHandler->insert($tplfile); + } + + /** + * Read template file, return it. + * + * @note This is must, but it depends on ... + */ + function readTemplateFile($dirname, $fileName, $isblock = false) + { + // + // Load template data + // + if ($isblock) { + $filePath = XOOPS_MODULE_PATH . "/" . $dirname . "/templates/blocks/" . $fileName; + } + else { + $filePath = XOOPS_MODULE_PATH . "/" . $dirname . "/templates/" . $fileName; + } + + if (!file_exists($filePath)) { + return false; + } + + $lines = file($filePath); + if ($lines == false) { + return false; + } + + $tpldata = ""; + foreach ($lines as $line) { + // + // Unify linefeed to "\r\n" + // + $tpldata .= str_replace("\n", "\r\n", str_replace("\r\n", "\n", $line)); + } + + return $tpldata; + } + + function installAllOfConfigs(&$module, &$log) + { + $configInfos = Legacy_ModuleInstallUtils::getConfigInfosFromManifesto($module); + + $count = 0; + if (is_array($configInfos)) { + $configHandler =& xoops_gethandler('config'); + + foreach ($configInfos as $configInfo) { + $config =& $configHandler->createConfig(); + + $config->loadFromConfigInfo($module->get('mid'), $configInfo, $count++); + + if ($configHandler->insertConfig($config)) { + $log->addReport(XCube_Utils::formatMessage(_AD_LEGACY_MESSAGE_INSERT_CONFIG, $configInfo['name'])); + } + else { + $log->addError(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_COULD_NOT_INSERT_CONFIG, $configInfo['name'])); + } + + unset($config); + } + } + } + + /** + * Get & build config items from Manifesto by specific module object. + */ + function &getConfigInfosFromManifesto(&$module) + { + $configInfos = $module->getInfo('config'); + + // + // Insert comment config by old style. + // + if ($module->getVar('hascomments') !=0 ) { + require_once XOOPS_ROOT_PATH . "/include/comment_constants.php"; + + $configInfos[] = array('name' => 'com_rule', + 'title' => '_CM_COMRULES', + 'description' => '', + 'formtype' => 'select', + 'valuetype' => 'int', + 'default' => 1, + 'options' => array('_CM_COMNOCOM' => XOOPS_COMMENT_APPROVENONE, '_CM_COMAPPROVEALL' => XOOPS_COMMENT_APPROVEALL, '_CM_COMAPPROVEUSER' => XOOPS_COMMENT_APPROVEUSER, '_CM_COMAPPROVEADMIN' => XOOPS_COMMENT_APPROVEADMIN) + ); + + $configInfos[] = array('name' => 'com_anonpost', + 'title' => '_CM_COMANONPOST', + 'description' => '', + 'formtype' => 'yesno', + 'valuetype' => 'int', + 'default' => 0 + ); + } + + // + // Insert comment config by old style. + // + if ($module->get('hasnotification') != 0) { + require_once XOOPS_ROOT_PATH . '/include/notification_constants.php'; + require_once XOOPS_ROOT_PATH . '/include/notification_functions.php'; + + $t_options = array(); + $t_options['_NOT_CONFIG_DISABLE'] = XOOPS_NOTIFICATION_DISABLE; + $t_options['_NOT_CONFIG_ENABLEBLOCK'] = XOOPS_NOTIFICATION_ENABLEBLOCK; + $t_options['_NOT_CONFIG_ENABLEINLINE'] = XOOPS_NOTIFICATION_ENABLEINLINE; + $t_options['_NOT_CONFIG_ENABLEBOTH'] = XOOPS_NOTIFICATION_ENABLEBOTH; + + $configInfos[] = array( + 'name' => 'notification_enabled', + 'title' => '_NOT_CONFIG_ENABLE', + 'description' => '_NOT_CONFIG_ENABLEDSC', + 'formtype' => 'select', + 'valuetype' => 'int', + 'default' => XOOPS_NOTIFICATION_ENABLEBOTH, + 'options' => $t_options + ); + + // + // FIXME: doesn't work when update module... can't read back the + // array of options properly... " changing to " + // + + unset ($t_options); + + $t_options = array(); + $t_categoryArr =& notificationCategoryInfo('', $module->get('mid')); + foreach ($t_categoryArr as $t_category) { + $t_eventArr =& notificationEvents($t_category['name'], false, $module->get('mid')); + foreach ($t_eventArr as $t_event) { + if (!empty($event['invisible'])) { + continue; + } + $t_optionName = $t_category['title'] . ' : ' . $t_event['title']; + $t_options[$t_optionName] = $t_category['name'] . '-' . $t_event['name']; + } + } + + $configInfos[] = array( + 'name' => 'notification_events', + 'title' => '_NOT_CONFIG_EVENTS', + 'description' => '_NOT_CONFIG_EVENTSDSC', + 'formtype' => 'select_multi', + 'valuetype' => 'array', + 'default' => array_values($t_options), + 'options' => $t_options + ); + } + + return $configInfos; + } + + /** + * Delete all configs of $module. + * + * @param $module XoopsModule + */ + function uninstallAllOfConfigs(&$module, &$log) + { + if ($module->get('hasconfig') == 0) { + return; + } + + $configHandler =& xoops_gethandler('config'); + $configs =& $configHandler->getConfigs(new Criteria('conf_modid', $module->get('mid'))); + + if (count($configs) == 0) { + return; + } + + foreach ($configs as $config) { + $configHandler->deleteConfig($config); + } + } + + /** + * Executes SQL query as cube style. + */ + function DBquery($query, &$module, $log) + { + require_once XOOPS_MODULE_PATH . "/legacy/admin/class/Legacy_SQLScanner.class.php"; + + $successFlag = true; + + $scanner =& new Legacy_CubeStyleSQLScanner(); + $scanner->setDB_PREFIX(XOOPS_DB_PREFIX); + $scanner->setDirname($module->get('dirname')); + $scanner->setBuffer($query); + $scanner->parse(); + $sqlArr = $scanner->getSQL(); + + $root =& XCube_Root::getSingleton(); + + foreach ($sqlArr as $sql) { + if ($root->mController->mDB->query($sql)) { + $log->addReport("Success: ${sql}"); + $successFlag &= true; + } + else { + $log->addError("Failure: ${sql}"); + $successFlag = false; + } + } + + return $successFlag; + } } ?> \ No newline at end of file From minahito @ users.sourceforge.jp Thu Nov 2 00:02:14 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Thu, 2 Nov 2006 00:02:14 +0900 Subject: [xoops-cvslog 5552] CVS update: xoops2jp/html/modules/legacy/admin/class Message-ID: <20061101150214.7D4802AC055@users.sourceforge.jp> Index: xoops2jp/html/modules/legacy/admin/class/ModuleUtils.class.php diff -u xoops2jp/html/modules/legacy/admin/class/ModuleUtils.class.php:1.1.2.5 xoops2jp/html/modules/legacy/admin/class/ModuleUtils.class.php:1.1.2.6 --- xoops2jp/html/modules/legacy/admin/class/ModuleUtils.class.php:1.1.2.5 Wed Nov 1 20:55:09 2006 +++ xoops2jp/html/modules/legacy/admin/class/ModuleUtils.class.php Thu Nov 2 00:02:14 2006 @@ -53,209 +53,14 @@ */ class Legacy_ModuleUtils { - /** - */ - function installTable(&$module, &$log) - { - $sqlfileInfo =& $module->getInfo('sqlfile'); - $dirname = $module->getVar('dirname'); - - if (!isset($sqlfileInfo[XOOPS_DB_TYPE])) { - return; - } - - require_once XOOPS_MODULE_PATH . "/legacy/admin/class/Legacy_SQLScanner.class.php"; - $scanner =& new Legacy_SQLScanner(); - $scanner->setDB_PREFIX(XOOPS_DB_PREFIX); - - $sqlfile = $sqlfileInfo[XOOPS_DB_TYPE]; - if (!$scanner->loadFile(XOOPS_MODULE_PATH . "/${dirname}/" . $sqlfile)) { - $log->addError(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_SQL_FILE_NOT_FOUND, $sqlfile)); - return false; - } - - $scanner->parse(); - $sqls = $scanner->getSQL(); - - $root =& XCube_Root::getSingleton(); - $db =& $root->mController->getDB(); - - // - // TODO The following variable exists for rollback, but it is not implemented. - // - foreach ($sqls as $sql) { - if (!$db->query($sql)) { - $log->addError($db->error()); - return; - } - } - - $log->addReport(_AD_LEGACY_MESSAGE_DATABASE_SETUP_FINISHED); - } - - /** - * Insert template to DB. - * This function depends on the structure of Legacy_RenderSystem. We should - * move this to another mechanism. - * - * @param $dirname string - * @param $$template string[][] - * @param $log Legacy_ModuleUtilsSimpleLog * - * @param bool - * - * @deprecated see installModuleTemplate() - */ - function installTemplate($module, $template, &$log) - { - return Legacy_ModuleUtils::installModuleTemplate($module, $template, $log); - } - - function installModuleTemplate($module, $template, &$log) - { - $tplHandler =& xoops_gethandler('tplfile'); - - $fileName = trim($template['file']); - - $tpldata = Legacy_ModuleUtils::readTemplateFile($module->get('dirname'), $fileName); - if ($tpldata == false) - return false; - - // - // Create template file object, then store it. - // - $tplfile =& $tplHandler->create(); - $tplfile->setVar('tpl_refid', $module->getVar('mid')); - $tplfile->setVar('tpl_lastimpoerted', 0); - $tplfile->setVar('tpl_lastmodified', time()); - - if (preg_match("/\.css$/i", $fileName)) { - $tplfile->setVar('tpl_type', 'css'); - } - else { - $tplfile->setVar('tpl_type', 'module'); - } - - $tplfile->setVar('tpl_source', $tpldata, true); - $tplfile->setVar('tpl_module', $module->getVar('dirname')); - $tplfile->setVar('tpl_tplset', 'default'); - $tplfile->setVar('tpl_file', $fileName, true); - - $description = isset($tpl['description']) ? $tpl['description'] : ''; - $tplfile->setVar('tpl_desc', $description, true); - - if ($tplHandler->insert($tplfile)) { - $log->addReport(XCube_Utils::formatMessage(_AD_LEGACY_MESSAGE_TEMPLATE_INSTALLED, $fileName)); - } - else { - $log->addError(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_COULD_NOT_INSTALL_TEMPLATE, $fileName)); - return false; - } - } - - /** - * Installs all of module templates. - */ - function installAllModuleTemplates(&$module, &$log) - { - $templates = $module->getInfo('templates'); - if ($templates != false) { - foreach ($templates as $template) { - Legacy_ModuleUtils::installModuleTemplate($module, $template, $log); - } - } - } - - /** - * Read template file, return it. - * - * @return string or false - */ - function readTemplateFile($dirname, $fileName, $isblock = false) - { - // - // Load template data - // - if ($isblock) { - $filePath = XOOPS_MODULE_PATH . "/" . $dirname . "/templates/blocks/" . $fileName; - } - else { - $filePath = XOOPS_MODULE_PATH . "/" . $dirname . "/templates/" . $fileName; - } - - if (!file_exists($filePath)) { - return false; - } - - $lines = file($filePath); - if ($lines == false) { - return false; - } - - $tpldata = ""; - foreach ($lines as $line) { - // - // Unify linefeed to "\r\n" - // - $tpldata .= str_replace("\n", "\r\n", str_replace("\r\n", "\n", $line)); - } - - return $tpldata; - } - - /** - * Create XoopsBlock object by array that is defined in xoops_version, return it. - * @param $module XoopsModule - * @param $block array - * @return XoopsBlock - */ - function &createBlockByInfo(&$module, $block, $func_num) - { - $options = isset($block['options']) ? $block['options'] : null; - $edit_func = isset($block['edit_func']) ? $block['edit_func'] : null; - $template = isset($block['template']) ? $block['template'] : null; - $visible = isset($block['visible']) ? $block['visible'] : (isset($block['visible_any']) ? $block['visible_any']: 0); - $blockHandler =& xoops_gethandler('block'); - $blockObj =& $blockHandler->create(); - - $blockObj->set('mid', $module->getVar('mid')); - $blockObj->set('options', $options); - $blockObj->set('name', $block['name']); - $blockObj->set('title', $block['name']); - $blockObj->set('block_type', 'M'); - $blockObj->set('c_type', 1); - $blockObj->set('isactive', 1); - $blockObj->set('dirname', $module->getVar('dirname')); - $blockObj->set('func_file', $block['file']); - - // - // IMPORTANT CONVENTION - // - $show_func = ""; - if (isset($block['class'])) { - $show_func = "cl::" . $block['class']; - } - else { - $show_func = $block['show_func']; - } - - $blockObj->set('show_func', $show_func); - $blockObj->set('edit_func', $edit_func); - $blockObj->set('template', $template); - $blockObj->set('last_modified', time()); - $blockObj->set('visible', $visible); - - $func_num = isset($block['func_num']) ? intval($block['func_num']) : $func_num; - $blockObj->set('func_num', $func_num); - - return $blockObj; - } - /** * Merge existing block XoopsBlock object and new XoopsBlock object from xoops_verion * @param $oldBlock XoopsBlock * @param $newBlock XoopsBlock * @param $changedFlag bool * @return XoopsBlock + * + * @deprecated */ function &mergeBlockObject(&$oldBlock, &$newBlock, &$changedFlag) { @@ -287,371 +92,9 @@ return $blockObj; } - /** - * This function can receive both new and update. - * @param $module XoopsModule - * @param $blockObj XoopsBlock - * @param $block array - * @return bool - */ - function installBlock(&$module, &$blockObj, &$block, &$log) - { - $isNew = $blockObj->isNew(); - $blockHandler =& xoops_gethandler('block'); - - if (!empty($block['show_all_module'])) { - $autolink = false; - } else { - $autolink = true; - } - if (!$blockHandler->insert($blockObj, $autolink)) { - $log->addError(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_COULD_NOT_INSTALL_BLOCK, $blockObj->getVar('name'))); - - return false; - } - else { - $log->addReport(XCube_Utils::formatMessage(_AD_LEGACY_MESSAGE_BLOCK_INSTALLED, $blockObj->getVar('name'))); - - $tplHandler =& xoops_gethandler('tplfile'); - - if (!Legacy_ModuleUtils::installBlockTemplate($module, $blockObj)) { - $log->addError(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_BLOCK_TEMPLATE_INSTALL, $blockObj->getVar('name'))); - } - - // - // Process of a permission. - // - if ($isNew) { - if (!empty($block['show_all_module'])) { - $link_sql = "INSERT INTO " . $blockHandler->db->prefix('block_module_link') . " (block_id, module_id) VALUES (".$blockObj->getVar('bid').", 0)"; - if (!$blockHandler->db->query($link_sql)) { - $log->addWarn(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_COULD_NOT_SET_LINK, $blockObj->getVar('name'))); - } - } - $gpermHandler =& xoops_gethandler('groupperm'); - $bperm =& $gpermHandler->create(); - $bperm->setVar('gperm_itemid', $blockObj->getVar('bid')); - $bperm->setVar('gperm_name', 'block_read'); - $bperm->setVar('gperm_modid', 1); - - if (!empty($block['visible_any'])) { - $memberHandler =& xoops_gethandler('member'); - $groupObjects =& $memberHandler->getGroups(); - foreach($groupObjects as $group) { - $bperm->setVar('gperm_groupid', $group->getVar('groupid')); - $bperm->setNew(); - if (!$gpermHandler->insert($bperm)) { - $log->addWarn(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_COULD_NOT_SET_BLOCK_PERMISSION, $blockObj->getVar('name'))); - } - } - } else { - $root =& XCube_Root::getSingleton(); - $groups = $root->mContext->mXoopsUser->getGroups(); - foreach ($groups as $mygroup) { - $bperm->setVar('gperm_groupid', $mygroup); - $bperm->setNew(); - if (!$gpermHandler->insert($bperm)) { - $log->addWarn(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_COULD_NOT_SET_BLOCK_PERMISSION, $blockObj->getVar('name'))); - } - } - } - } - - return true; - } - } - - /** - * Installs all of blocks of the specified module. - */ - function installAllBlocks(&$module, &$log) - { - $definedBlocks = $module->getInfo('blocks'); - if($definedBlocks == false) { - return true; - } - - $handler =& xoops_gethandler('block'); - - $func_num = 0; - foreach ($definedBlocks as $block) { - $func_num++; - $newBlock =& Legacy_ModuleUtils::createBlockByInfo($module, $block, $func_num); - Legacy_ModuleUtils::installBlock($module, $newBlock, $block, $this->mLog); - } - } - - function uninstallBlock(&$block, &$log) - { - $blockHandler =& xoops_gethandler('block'); - $blockHandler->delete($block); - $log->addReport(XCube_Utils::formatMessage(_AD_LEGACY_MESSAGE_UNINSTALLATION_BLOCK_SUCCESSFUL, $block->get('name'))); - // - // delete permission - // - $gpermHandler =& xoops_gethandler('groupperm'); - $criteria =& new CriteriaCompo(); - $criteria->add(new Criteria('gperm_name', 'block_read')); - $criteria->add(new Criteria('gperm_itemid', $block->getVar('bid'))); - $criteria->add(new Criteria('gperm_modid', 1)); - $gpermHandler->deleteAll($criteria); - } - - /** - * Uninstalls all of blocks installing now. - * - * @note check at Beta 3. - */ - function uninstallAllBlocks(&$module, &$log) - { - $handler =& xoops_gethandler('block'); - $blockArr =& $handler->getByModule($module->get('mid')); - - $successFlag = true; - - foreach (array_keys($blockArr) as $idx) { - $successFlag &= Legacy_ModuleUtils::uninstallBlock($blockArr[$idx], $log); - } - - return $successFlag; - } - - /** - * Save the information of block's template specified and the source code of it - * to database. - * @return bool - */ - function installBlockTemplate(&$module, &$block) - { - if ($block->get('template') == null) { - return true; - } - - $tplHandler =& xoops_gethandler('tplfile'); - - $criteria =& new CriteriaCompo(); - $criteria->add(new Criteria('tpl_type', 'block')); - $criteria->add(new Criteria('tpl_tplset', 'default')); - $criteria->add(new Criteria('tpl_module', $module->getVar('dirname'))); - $criteria->add(new Criteria('tpl_file', $block->getVar('template'))); - $tplfiles =& $tplHandler->getObjects($criteria); - - if (count($tplfiles) > 0) { - $tplfile =& $tplfiles[0]; - } - else { - $tplfile =& $tplHandler->create(); - $tplfile->setVar('tpl_refid', $block->getVar('bid')); - $tplfile->setVar('tpl_tplset', 'default'); - $tplfile->setVar('tpl_file', $block->getVar('template')); - $tplfile->setVar('tpl_module', $module->getVar('dirname')); - $tplfile->setVar('tpl_type', 'block'); - // $tplfile->setVar('tpl_desc', $tpl_desc); - $tplfile->setVar('tpl_lastimported', 0); - } - - $tplSource = Legacy_ModuleUtils::readTemplateFile($module->getVar('dirname'), $block->getVar('template'), true); - $tplfile->setVar('tpl_source', $tplSource); - $tplfile->setVar('tpl_lastmodified', time()); - - return $tplHandler->insert($tplfile); - } - - function insertAllConfigs(&$module, &$log) - { - $configInfos = Legacy_ModuleUtils::getConfigInfosFromManifesto($module); - - $count = 0; - if (is_array($configInfos)) { - $configHandler =& xoops_gethandler('config'); - - foreach ($configInfos as $configInfo) { - $config =& $configHandler->createConfig(); - - $config->loadFromConfigInfo($module->get('mid'), $configInfo, $count++); - - if ($configHandler->insertConfig($config)) { - $log->addReport(XCube_Utils::formatMessage(_AD_LEGACY_MESSAGE_INSERT_CONFIG, $configInfo['name'])); - } - else { - $log->addError(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_COULD_NOT_INSERT_CONFIG, $configInfo['name'])); - } - - unset($config); - } - } - } - - /** - * Get & build config items from Manifesto by specific module object. - */ - function &getConfigInfosFromManifesto(&$module) - { - $configInfos = $module->getInfo('config'); - - // - // Insert comment config by old style. - // - if ($module->getVar('hascomments') !=0 ) { - require_once XOOPS_ROOT_PATH . "/include/comment_constants.php"; - - $configInfos[] = array('name' => 'com_rule', - 'title' => '_CM_COMRULES', - 'description' => '', - 'formtype' => 'select', - 'valuetype' => 'int', - 'default' => 1, - 'options' => array('_CM_COMNOCOM' => XOOPS_COMMENT_APPROVENONE, '_CM_COMAPPROVEALL' => XOOPS_COMMENT_APPROVEALL, '_CM_COMAPPROVEUSER' => XOOPS_COMMENT_APPROVEUSER, '_CM_COMAPPROVEADMIN' => XOOPS_COMMENT_APPROVEADMIN) - ); - - $configInfos[] = array('name' => 'com_anonpost', - 'title' => '_CM_COMANONPOST', - 'description' => '', - 'formtype' => 'yesno', - 'valuetype' => 'int', - 'default' => 0 - ); - } - - // - // Insert comment config by old style. - // - if ($module->get('hasnotification') != 0) { - require_once XOOPS_ROOT_PATH . '/include/notification_constants.php'; - require_once XOOPS_ROOT_PATH . '/include/notification_functions.php'; - - $t_options = array(); - $t_options['_NOT_CONFIG_DISABLE'] = XOOPS_NOTIFICATION_DISABLE; - $t_options['_NOT_CONFIG_ENABLEBLOCK'] = XOOPS_NOTIFICATION_ENABLEBLOCK; - $t_options['_NOT_CONFIG_ENABLEINLINE'] = XOOPS_NOTIFICATION_ENABLEINLINE; - $t_options['_NOT_CONFIG_ENABLEBOTH'] = XOOPS_NOTIFICATION_ENABLEBOTH; - - $configInfos[] = array( - 'name' => 'notification_enabled', - 'title' => '_NOT_CONFIG_ENABLE', - 'description' => '_NOT_CONFIG_ENABLEDSC', - 'formtype' => 'select', - 'valuetype' => 'int', - 'default' => XOOPS_NOTIFICATION_ENABLEBOTH, - 'options' => $t_options - ); - - // - // FIXME: doesn't work when update module... can't read back the - // array of options properly... " changing to " - // - - unset ($t_options); - - $t_options = array(); - $t_categoryArr =& notificationCategoryInfo('', $module->get('mid')); - foreach ($t_categoryArr as $t_category) { - $t_eventArr =& notificationEvents($t_category['name'], false, $module->get('mid')); - foreach ($t_eventArr as $t_event) { - if (!empty($event['invisible'])) { - continue; - } - $t_optionName = $t_category['title'] . ' : ' . $t_event['title']; - $t_options[$t_optionName] = $t_category['name'] . '-' . $t_event['name']; - } - } - - $configInfos[] = array( - 'name' => 'notification_events', - 'title' => '_NOT_CONFIG_EVENTS', - 'description' => '_NOT_CONFIG_EVENTSDSC', - 'formtype' => 'select_multi', - 'valuetype' => 'array', - 'default' => array_values($t_options), - 'options' => $t_options - ); - } - - return $configInfos; - } - - - /** - * Delete all configs of $module. - * - * @param $module XoopsModule - */ - function deleteAllConfigs(&$module, &$log) - { - if ($module->get('hasconfig') == 0) { - return; - } - - $configHandler =& xoops_gethandler('config'); - $configs =& $configHandler->getConfigs(new Criteria('conf_modid', $module->get('mid'))); - - if (count($configs) == 0) { - return; - } - - foreach ($configs as $config) { - $configHandler->deleteConfig($config); - } - } - /** - * @static - */ - function uninstallAllModuleTemplates(&$module, &$log) - { - $tplHandler =& xoops_gethandler('tplfile'); - // - // The following processing depends on the structure of Legacy_RenderSystem. - // - $tplHandler =& xoops_gethandler('tplfile'); - $delTemplates =& $tplHandler->find('default', 'module', $module->get('mid')); - if (is_array($delTemplates) && count($delTemplates) > 0) { - // - // clear cache - // - $xoopsTpl =& new XoopsTpl(); - $xoopsTpl->clear_cache(null, "mod_" . $module->get('dirname')); - - foreach ($delTemplates as $tpl) { - if (!$tplHandler->delete($tpl)) { - $log->addError(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_TEMPLATE_UNINSTALLED, $tpl->get('tpl_file'))); - } - } - } - } - /** - * - */ - function DBquery($query, &$module, $log) - { - require_once XOOPS_MODULE_PATH . "/legacy/admin/class/Legacy_SQLScanner.class.php"; - - $successFlag = true; - - $scanner =& new Legacy_CubeStyleSQLScanner(); - $scanner->setDB_PREFIX(XOOPS_DB_PREFIX); - $scanner->setDirname($module->get('dirname')); - $scanner->setBuffer($query); - $scanner->parse(); - $sqlArr = $scanner->getSQL(); - - $root =& XCube_Root::getSingleton(); - - foreach ($sqlArr as $sql) { - if ($root->mController->mDB->query($sql)) { - $log->addReport("Success: ${sql}"); - $successFlag &= true; - } - else { - $log->addError("Failure: ${sql}"); - $successFlag = false; - } - } - - return $successFlag; - } } ?> \ No newline at end of file From minahito @ users.sourceforge.jp Thu Nov 2 00:02:25 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Thu, 2 Nov 2006 00:02:25 +0900 Subject: [xoops-cvslog 5553] CVS update: xoops2jp/html/modules/legacy/admin/class Message-ID: <20061101150225.9E0E52AC055@users.sourceforge.jp> Index: xoops2jp/html/modules/legacy/admin/class/ModuleUpdater.class.php diff -u xoops2jp/html/modules/legacy/admin/class/ModuleUpdater.class.php:1.1.2.9 xoops2jp/html/modules/legacy/admin/class/ModuleUpdater.class.php:1.1.2.10 --- xoops2jp/html/modules/legacy/admin/class/ModuleUpdater.class.php:1.1.2.9 Wed Nov 1 20:54:22 2006 +++ xoops2jp/html/modules/legacy/admin/class/ModuleUpdater.class.php Thu Nov 2 00:02:25 2006 @@ -295,7 +295,7 @@ function _updateModuleTemplates() { Legacy_ModuleInstallUtils::uninstallAllOfModuleTemplates($this->_mTargetXoopsModule, $this->mLog); - Legacy_ModuleInstallUtils::installAllModuleTemplates($this->_mTargetXoopsModule, $this->mLog); + Legacy_ModuleInstallUtils::installAllOfModuleTemplates($this->_mTargetXoopsModule, $this->mLog); } /** @@ -318,7 +318,7 @@ */ function _updatePreferences() { - $this->_upgradePreference(); + $this->_upgradePreferences(); } /** @@ -337,7 +337,7 @@ // // Updates all of module templates // - $this->_updateTemplates(); + $this->_updateModuleTemplates(); if (!$this->_mForceMode && $this->mLog->hasError()) { $this->_processReport(); return false; @@ -404,7 +404,7 @@ // Next, load config item from xoops_version.php. // $newConfigArr = array(); - $t_configInfoArr = Legacy_ModuleUtils::getConfigInfosFromManifesto($this->_mTargetXoopsModule); + $t_configInfoArr = Legacy_ModuleInstallUtils::getConfigInfosFromManifesto($this->_mTargetXoopsModule); $count = 0; if (is_array($t_configInfoArr)) { From minahito @ users.sourceforge.jp Thu Nov 2 00:02:35 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Thu, 2 Nov 2006 00:02:35 +0900 Subject: [xoops-cvslog 5554] CVS update: xoops2jp/html/modules/legacy/admin/class Message-ID: <20061101150235.C48DC2AC055@users.sourceforge.jp> Index: xoops2jp/html/modules/legacy/admin/class/ModuleUninstaller.class.php diff -u xoops2jp/html/modules/legacy/admin/class/ModuleUninstaller.class.php:1.1.2.4 xoops2jp/html/modules/legacy/admin/class/ModuleUninstaller.class.php:1.1.2.5 --- xoops2jp/html/modules/legacy/admin/class/ModuleUninstaller.class.php:1.1.2.4 Wed Nov 1 22:42:17 2006 +++ xoops2jp/html/modules/legacy/admin/class/ModuleUninstaller.class.php Thu Nov 2 00:02:35 2006 @@ -122,7 +122,7 @@ function _uninstallPreferences() { - Legacy_ModuleUtils::deleteAllConfigs($this->_mXoopsModule, $this->mLog); + Legacy_ModuleInstallUtils::uninstallAllOfConfigs($this->_mXoopsModule, $this->mLog); } function _processScript() From tom_g3x @ users.sourceforge.jp Thu Nov 2 00:50:44 2006 From: tom_g3x @ users.sourceforge.jp (Tom Hayakawa) Date: Thu, 2 Nov 2006 00:50:44 +0900 Subject: [xoops-cvslog 5555] CVS update: xoops2jp/html/modules/user/language/english Message-ID: <20061101155044.3538C2AC06D@users.sourceforge.jp> Index: xoops2jp/html/modules/user/language/english/admin.php diff -u xoops2jp/html/modules/user/language/english/admin.php:1.1.2.30.2.3 xoops2jp/html/modules/user/language/english/admin.php:1.1.2.30.2.4 --- xoops2jp/html/modules/user/language/english/admin.php:1.1.2.30.2.3 Sat Oct 14 23:17:57 2006 +++ xoops2jp/html/modules/user/language/english/admin.php Thu Nov 2 00:50:44 2006 @@ -42,7 +42,7 @@ define('_AD_USER_LANG_GROUP_ASSIGN', "Assign a member"); define('_AD_USER_LANG_GROUP_ASSIN_MEMBERS', "List of members of this group"); define('_AD_USER_LANG_GROUP_DELETE', "Delete group"); -define('_AD_USER_LANG_GROUP_DELETE_ADVICE', "Delete "); +define('_AD_USER_LANG_GROUP_DELETE_ADVICE', "Are you sure you want to delete this user group?"); define('_AD_USER_LANG_GROUP_DELETE_ADVICE2', "When you delete a group, user accounts of the group will not be deleted."); define('_AD_USER_LANG_GROUP_DESC', "Description"); define('_AD_USER_LANG_GROUP_EDIT', "Edit groups"); @@ -104,7 +104,7 @@ define('_AD_USER_LANG_UNDER_POSTS', "Number of Posts is less than X"); define('_AD_USER_LANG_USER', "User"); define('_AD_USER_LANG_USER_DELETE', "Delete a user"); -define('_AD_USER_LANG_USER_DELETE_ADVICE', "Delete "); +define('_AD_USER_LANG_USER_DELETE_ADVICE', "Are you sure you want to delete this user?"); define('_AD_USER_LANG_USER_EDIT', "Edit a user"); define('_AD_USER_LANG_USER_LIST', "User administration"); define('_AD_USER_LANG_USER_NEW', "Add a new user"); From tom_g3x @ users.sourceforge.jp Thu Nov 2 00:50:44 2006 From: tom_g3x @ users.sourceforge.jp (Tom Hayakawa) Date: Thu, 2 Nov 2006 00:50:44 +0900 Subject: [xoops-cvslog 5556] CVS update: xoops2jp/html/modules/user/language/japanese Message-ID: <20061101155044.5EC202AC097@users.sourceforge.jp> Index: xoops2jp/html/modules/user/language/japanese/admin.php diff -u xoops2jp/html/modules/user/language/japanese/admin.php:1.1.2.37.2.3 xoops2jp/html/modules/user/language/japanese/admin.php:1.1.2.37.2.4 --- xoops2jp/html/modules/user/language/japanese/admin.php:1.1.2.37.2.3 Sat Oct 14 23:17:57 2006 +++ xoops2jp/html/modules/user/language/japanese/admin.php Thu Nov 2 00:50:44 2006 @@ -42,7 +42,7 @@ define('_AD_USER_LANG_GROUP_ASSIGN', "メンバーの登録"); define('_AD_USER_LANG_GROUP_ASSIN_MEMBERS', "このグループに登録されているユーザー一覧"); define('_AD_USER_LANG_GROUP_DELETE', "ユーザーグループの削除"); -define('_AD_USER_LANG_GROUP_DELETE_ADVICE', "_%s_ のユーザーグループを削除します。よろしいですか?"); +define('_AD_USER_LANG_GROUP_DELETE_ADVICE', "このユーザーグループを削除します。よろしいですか?"); define('_AD_USER_LANG_GROUP_DELETE_ADVICE2', "グループを削除してもユーザーは削除されません"); define('_AD_USER_LANG_GROUP_DESC', "説明"); define('_AD_USER_LANG_GROUP_EDIT', "ユーザーグループ編集"); @@ -104,7 +104,7 @@ define('_AD_USER_LANG_UNDER_POSTS', "投稿数がX件以下"); define('_AD_USER_LANG_USER', "ユーザー"); define('_AD_USER_LANG_USER_DELETE', "ユーザーの削除"); -define('_AD_USER_LANG_USER_DELETE_ADVICE', "_%s_ のユーザーを削除します。よろしいですか?"); +define('_AD_USER_LANG_USER_DELETE_ADVICE', "このユーザーを削除します。よろしいですか?"); define('_AD_USER_LANG_USER_EDIT', "ユーザーの編集"); define('_AD_USER_LANG_USER_LIST', "ユーザー管理"); define('_AD_USER_LANG_USER_NEW', "ユーザー新規登録"); From tom_g3x @ users.sourceforge.jp Thu Nov 2 00:50:44 2006 From: tom_g3x @ users.sourceforge.jp (Tom Hayakawa) Date: Thu, 2 Nov 2006 00:50:44 +0900 Subject: [xoops-cvslog 5557] CVS update: xoops2jp/html/modules/user/admin/templates Message-ID: <20061101155044.9495F2AC06D@users.sourceforge.jp> Index: xoops2jp/html/modules/user/admin/templates/user_delete.html diff -u xoops2jp/html/modules/user/admin/templates/user_delete.html:1.1.2.14 xoops2jp/html/modules/user/admin/templates/user_delete.html:1.1.2.14.2.1 --- xoops2jp/html/modules/user/admin/templates/user_delete.html:1.1.2.14 Sun Aug 20 11:57:49 2006 +++ xoops2jp/html/modules/user/admin/templates/user_delete.html Thu Nov 2 00:50:44 2006 @@ -6,7 +6,7 @@

<{$smarty.const._AD_USER_LANG_USER_DELETE}> (<{$object->getShow('uname')}>)

-
<{$smarty.const._AD_USER_LANG_USER_DELETE_ADVICE|replace:"_%s_":$object->getShow('uname')}>
+
<{$smarty.const._AD_USER_LANG_USER_DELETE_ADVICE}>
<{if $actionForm->hasError()}>
Index: xoops2jp/html/modules/user/admin/templates/group_delete.html diff -u xoops2jp/html/modules/user/admin/templates/group_delete.html:1.1.2.16 xoops2jp/html/modules/user/admin/templates/group_delete.html:1.1.2.16.2.1 --- xoops2jp/html/modules/user/admin/templates/group_delete.html:1.1.2.16 Sun Aug 20 22:38:31 2006 +++ xoops2jp/html/modules/user/admin/templates/group_delete.html Thu Nov 2 00:50:44 2006 @@ -7,7 +7,7 @@

<{$smarty.const._AD_USER_LANG_GROUP_DELETE}> (<{$object->getShow('name')}>)

- <{$smarty.const._AD_USER_LANG_GROUP_DELETE_ADVICE|replace:"_%s_":$object->getShow('name')}>
+ <{$smarty.const._AD_USER_LANG_GROUP_DELETE_ADVICE}>
<{$smarty.const._AD_USER_LANG_GROUP_DELETE_ADVICE2}>
From minahito @ users.sourceforge.jp Thu Nov 2 13:51:42 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Thu, 2 Nov 2006 13:51:42 +0900 Subject: [xoops-cvslog 5558] CVS update: xoops2jp/html/kernel Message-ID: <20061102045142.3BF842AC030@users.sourceforge.jp> Index: xoops2jp/html/kernel/configitem.php diff -u xoops2jp/html/kernel/configitem.php:1.2.8.7 xoops2jp/html/kernel/configitem.php:1.2.8.7.2.1 --- xoops2jp/html/kernel/configitem.php:1.2.8.7 Sun Sep 10 14:55:46 2006 +++ xoops2jp/html/kernel/configitem.php Thu Nov 2 13:51:42 2006 @@ -1,5 +1,5 @@ getOptionItems(); + $thisOptions =& $this->getConfOptions(); $hisOptions =& $config->getConfOptions(); if (count($thisOptions) == count($hisOptions)) { From minahito @ users.sourceforge.jp Thu Nov 2 13:54:01 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Thu, 2 Nov 2006 13:54:01 +0900 Subject: [xoops-cvslog 5559] CVS update: xoops2jp/html/modules/legacy/admin/actions Message-ID: <20061102045401.15AE32AC052@users.sourceforge.jp> Index: xoops2jp/html/modules/legacy/admin/actions/ModuleUpdateAction.class.php diff -u xoops2jp/html/modules/legacy/admin/actions/ModuleUpdateAction.class.php:1.1.2.6 xoops2jp/html/modules/legacy/admin/actions/ModuleUpdateAction.class.php:1.1.2.7 --- xoops2jp/html/modules/legacy/admin/actions/ModuleUpdateAction.class.php:1.1.2.6 Wed Nov 1 20:55:09 2006 +++ xoops2jp/html/modules/legacy/admin/actions/ModuleUpdateAction.class.php Thu Nov 2 13:54:00 2006 @@ -130,7 +130,7 @@ * * The precondition is the existence of mXoopsModule. */ - function _getInstaller() + function &_getInstaller() { $dirname = $this->mXoopsModule->get('dirname'); $this->mXoopsModule->loadInfo($dirname, false); From minahito @ users.sourceforge.jp Thu Nov 2 13:58:07 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Thu, 2 Nov 2006 13:58:07 +0900 Subject: [xoops-cvslog 5560] CVS update: xoops2jp/html/kernel Message-ID: <20061102045807.68C202AC030@users.sourceforge.jp> Index: xoops2jp/html/kernel/configitem.php diff -u xoops2jp/html/kernel/configitem.php:1.2.8.7.2.1 xoops2jp/html/kernel/configitem.php:1.2.8.7.2.2 --- xoops2jp/html/kernel/configitem.php:1.2.8.7.2.1 Thu Nov 2 13:51:42 2006 +++ xoops2jp/html/kernel/configitem.php Thu Nov 2 13:58:07 2006 @@ -1,5 +1,5 @@ getConfOptions(); + $thisOptions =& $this->getOptionItems(); $hisOptions =& $config->getConfOptions(); if (count($thisOptions) == count($hisOptions)) { From minahito @ users.sourceforge.jp Thu Nov 2 14:56:09 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Thu, 2 Nov 2006 14:56:09 +0900 Subject: [xoops-cvslog 5561] CVS update: xoops2jp/html/include Message-ID: <20061102055609.B58572AC030@users.sourceforge.jp> Index: xoops2jp/html/include/version.php diff -u xoops2jp/html/include/version.php:1.4.8.12.2.2 xoops2jp/html/include/version.php:1.4.8.12.2.3 --- xoops2jp/html/include/version.php:1.4.8.12.2.2 Mon Oct 23 19:03:44 2006 +++ xoops2jp/html/include/version.php Thu Nov 2 14:56:09 2006 @@ -1,9 +1,9 @@ \ No newline at end of file From minahito @ users.sourceforge.jp Thu Nov 2 15:21:52 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Thu, 2 Nov 2006 15:21:52 +0900 Subject: [xoops-cvslog 5562] CVS update: xoops2jp/html/include Message-ID: <20061102062152.1872D2AC023@users.sourceforge.jp> Index: xoops2jp/html/include/version.php diff -u xoops2jp/html/include/version.php:1.4.8.12.2.3 xoops2jp/html/include/version.php:1.4.8.12.2.4 --- xoops2jp/html/include/version.php:1.4.8.12.2.3 Thu Nov 2 14:56:09 2006 +++ xoops2jp/html/include/version.php Thu Nov 2 15:21:51 2006 @@ -1,9 +1,9 @@ \ No newline at end of file From minahito @ users.sourceforge.jp Thu Nov 2 16:36:10 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Thu, 2 Nov 2006 16:36:10 +0900 Subject: [xoops-cvslog 5563] CVS update: xoops2jp/html/modules/legacy/preload/Primary Message-ID: <20061102073610.E4E402AC023@users.sourceforge.jp> Index: xoops2jp/html/modules/legacy/preload/Primary/SiteClose.class.php diff -u xoops2jp/html/modules/legacy/preload/Primary/SiteClose.class.php:1.1.2.2 xoops2jp/html/modules/legacy/preload/Primary/SiteClose.class.php:1.1.2.3 --- xoops2jp/html/modules/legacy/preload/Primary/SiteClose.class.php:1.1.2.2 Sun Oct 15 01:44:14 2006 +++ xoops2jp/html/modules/legacy/preload/Primary/SiteClose.class.php Thu Nov 2 16:36:10 2006 @@ -57,8 +57,14 @@ foreach ($_POST['uninstalled_modules'] as $module) { $module = basename($module); if (in_array($module, $retArray['uninstalled'])) { - $installer =& new Legacy_ModuleInstaller($module); - $installer->execute(); + $handler =& xoops_gethandler('module'); + $xoopsModule =& $handler->create(); + $xoopsModule->set('weight', 1); + $xoopsModule->loadInfoAsVar($module); + + $installer =& new Legacy_ModuleInstaller(); + $installer->setCurrentXoopsModule($xoopsModule); + $installer->executeInstall(); } } } @@ -86,8 +92,14 @@ foreach ($_POST['option_modules'] as $module) { $module = basename($module); if (in_array($module, $optionModules)) { - $installer =& new Legacy_ModuleInstaller($module); - $installer->execute(); + $handler =& xoops_gethandler('module'); + $xoopsModule =& $handler->create(); + $xoopsModule->set('weight', 1); + $xoopsModule->loadInfoAsVar($module); + + $installer =& new Legacy_ModuleInstaller(); + $installer->setCurrentXoopsModule($xoopsModule); + $installer->executeInstall(); } } } @@ -111,8 +123,12 @@ require_once XOOPS_LEGACY_PATH . "/admin/class/ModuleUninstaller.class.php"; $module = basename($_POST['cube_module_uninstallok']); if (in_array($module, $retArray['disabled'])) { - $uninstaller =& new Legacy_ModuleUninstaller($module); - $uninstaller->execute(); + $handler =& xoops_gethandler('module'); + $xoopsModule =& $handler->getByDirname($module); + + $uninstaller =& new Legacy_ModuleUninstaller(); + $uninstaller->setCurrentXoopsModule($xoopsModule); + $uninstaller->executeUninstall(); } $controller->executeRedirect(XOOPS_URL . '/',1); } From minahito @ users.sourceforge.jp Thu Nov 2 16:37:28 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Thu, 2 Nov 2006 16:37:28 +0900 Subject: [xoops-cvslog 5564] CVS update: xoops2jp/html/modules/legacy Message-ID: <20061102073728.171262AC15F@users.sourceforge.jp> Index: xoops2jp/html/modules/legacy/xoops_version.php diff -u xoops2jp/html/modules/legacy/xoops_version.php:1.1.2.4 xoops2jp/html/modules/legacy/xoops_version.php:1.1.2.5 --- xoops2jp/html/modules/legacy/xoops_version.php:1.1.2.4 Tue Oct 17 13:47:37 2006 +++ xoops2jp/html/modules/legacy/xoops_version.php Thu Nov 2 16:37:27 2006 @@ -26,14 +26,14 @@ // ------------------------------------------------------------------------- // $modversion['name'] = _MI_LEGACY_NAME; -$modversion['version'] = 1.00; +$modversion['version'] = 2.01; $modversion['description'] = _MI_LEGACY_NAME_DESC; $modversion['author'] = ""; $modversion['credits'] = "The XOOPS Cube Project"; $modversion['help'] = "help.html"; $modversion['license'] = "GPL see LICENSE"; $modversion['official'] = 1; -$modversion['image'] = "images/legacy.gif"; +$modversion['image'] = "images/legacy.png"; $modversion['dirname'] = "legacy"; $modversion['cube_style'] = true; From minahito @ users.sourceforge.jp Thu Nov 2 16:37:36 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Thu, 2 Nov 2006 16:37:36 +0900 Subject: [xoops-cvslog 5565] CVS update: xoops2jp/html/modules/legacy/images Message-ID: <20061102073736.7F0972AC164@users.sourceforge.jp> Index: xoops2jp/html/modules/legacy/images/legacy.gif Index: xoops2jp/html/modules/legacy/images/legacy.png From minahito @ users.sourceforge.jp Thu Nov 2 16:37:53 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Thu, 2 Nov 2006 16:37:53 +0900 Subject: [xoops-cvslog 5566] CVS update: xoops2jp/html/modules/legacy/kernel Message-ID: <20061102073753.1C5642AC15B@users.sourceforge.jp> Index: xoops2jp/html/modules/legacy/kernel/Legacy_BlockProcedure.class.php diff -u xoops2jp/html/modules/legacy/kernel/Legacy_BlockProcedure.class.php:1.1.2.3 xoops2jp/html/modules/legacy/kernel/Legacy_BlockProcedure.class.php:1.1.2.4 --- xoops2jp/html/modules/legacy/kernel/Legacy_BlockProcedure.class.php:1.1.2.3 Tue Oct 17 00:35:31 2006 +++ xoops2jp/html/modules/legacy/kernel/Legacy_BlockProcedure.class.php Thu Nov 2 16:37:52 2006 @@ -138,6 +138,10 @@ $cacheInfo->setBlock($this); return $cacheInfo; } + + function execute() + { + } } /** From minahito @ users.sourceforge.jp Thu Nov 2 16:38:17 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Thu, 2 Nov 2006 16:38:17 +0900 Subject: [xoops-cvslog 5567] CVS update: xoops2jp/html/modules/legacy/kernel Message-ID: <20061102073817.00A562AC161@users.sourceforge.jp> Index: xoops2jp/html/modules/legacy/kernel/Legacy_Controller.class.php diff -u xoops2jp/html/modules/legacy/kernel/Legacy_Controller.class.php:1.1.2.11 xoops2jp/html/modules/legacy/kernel/Legacy_Controller.class.php:1.1.2.12 --- xoops2jp/html/modules/legacy/kernel/Legacy_Controller.class.php:1.1.2.11 Tue Oct 31 15:06:32 2006 +++ xoops2jp/html/modules/legacy/kernel/Legacy_Controller.class.php Thu Nov 2 16:38:17 2006 @@ -1255,13 +1255,7 @@ $context->mModule =& Legacy_Utils::createModule($module); $context->mXoopsModule =& $context->mModule->getXoopsModule(); - - if ($context->mXoopsModule->get('hasconfig') == 1 || $context->mXoopsModule->get('hascomments') == 1) { - $handler =& xoops_gethandler('config'); - - $context->mModule->setModuleConfig($handler->getConfigsByCat(0, $context->mXoopsModule->get('mid'))); - $context->mModuleConfig = $context->mModule->getModuleConfig(); - } + $context->mModuleConfig = $context->mModule->getModuleConfig(); // // Load Roles From minahito @ users.sourceforge.jp Thu Nov 2 16:38:28 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Thu, 2 Nov 2006 16:38:28 +0900 Subject: [xoops-cvslog 5568] CVS update: xoops2jp/html/modules/legacy/kernel Message-ID: <20061102073828.1AE282AC15B@users.sourceforge.jp> Index: xoops2jp/html/modules/legacy/kernel/Legacy_Module.class.php diff -u xoops2jp/html/modules/legacy/kernel/Legacy_Module.class.php:1.1.2.7 xoops2jp/html/modules/legacy/kernel/Legacy_Module.class.php:1.1.2.8 --- xoops2jp/html/modules/legacy/kernel/Legacy_Module.class.php:1.1.2.7 Fri Oct 20 17:05:54 2006 +++ xoops2jp/html/modules/legacy/kernel/Legacy_Module.class.php Thu Nov 2 16:38:27 2006 @@ -52,6 +52,11 @@ function Legacy_AbstractModule(&$module) { $this->setXoopsModule($module); + + if ($module->get('hasconfig') == 1 || $module->get('hascomments') == 1) { + $handler =& xoops_gethandler('config'); + $this->setModuleConfig($handler->getConfigsByCat(0, $module->get('mid'))); + } } /** From minahito @ users.sourceforge.jp Thu Nov 2 16:38:37 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Thu, 2 Nov 2006 16:38:37 +0900 Subject: [xoops-cvslog 5569] CVS update: xoops2jp/html/modules/legacy/preload/Primary Message-ID: <20061102073837.4E2E82AC15B@users.sourceforge.jp> Index: xoops2jp/html/modules/legacy/preload/Primary/index.html diff -u /dev/null xoops2jp/html/modules/legacy/preload/Primary/index.html:1.1.2.1 --- /dev/null Thu Nov 2 16:38:37 2006 +++ xoops2jp/html/modules/legacy/preload/Primary/index.html Thu Nov 2 16:38:37 2006 @@ -0,0 +1 @@ + \ No newline at end of file From minahito @ users.sourceforge.jp Thu Nov 2 16:38:49 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Thu, 2 Nov 2006 16:38:49 +0900 Subject: [xoops-cvslog 5570] CVS update: xoops2jp/html/modules/legacyRender Message-ID: <20061102073849.33AB12AC161@users.sourceforge.jp> Index: xoops2jp/html/modules/legacyRender/xoops_version.php diff -u xoops2jp/html/modules/legacyRender/xoops_version.php:1.1.2.11.2.1 xoops2jp/html/modules/legacyRender/xoops_version.php:1.1.2.11.2.2 --- xoops2jp/html/modules/legacyRender/xoops_version.php:1.1.2.11.2.1 Fri Oct 13 18:32:39 2006 +++ xoops2jp/html/modules/legacyRender/xoops_version.php Thu Nov 2 16:38:49 2006 @@ -1,18 +1,18 @@ Index: xoops2jp/html/modules/legacyRender/images/legacyRender.gif Index: xoops2jp/html/modules/legacyRender/images/legacyRender.png From minahito @ users.sourceforge.jp Thu Nov 2 16:39:21 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Thu, 2 Nov 2006 16:39:21 +0900 Subject: [xoops-cvslog 5572] CVS update: xoops2jp/html/modules/legacy/class Message-ID: <20061102073921.2FB272AC023@users.sourceforge.jp> Index: xoops2jp/html/modules/legacy/class/Legacy_Utils.class.php diff -u xoops2jp/html/modules/legacy/class/Legacy_Utils.class.php:1.1.2.4 xoops2jp/html/modules/legacy/class/Legacy_Utils.class.php:1.1.2.5 --- xoops2jp/html/modules/legacy/class/Legacy_Utils.class.php:1.1.2.4 Wed Nov 1 15:50:45 2006 +++ xoops2jp/html/modules/legacy/class/Legacy_Utils.class.php Thu Nov 2 16:39:21 2006 @@ -1,11 +1,13 @@ Index: xoops2jp/html/modules/pm/images/pm.png Index: xoops2jp/html/modules/pm/images/pm.gif From minahito @ users.sourceforge.jp Thu Nov 2 16:39:35 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Thu, 2 Nov 2006 16:39:35 +0900 Subject: [xoops-cvslog 5574] CVS update: xoops2jp/html/modules/pm Message-ID: <20061102073935.923952AC15F@users.sourceforge.jp> Index: xoops2jp/html/modules/pm/xoops_version.php diff -u xoops2jp/html/modules/pm/xoops_version.php:1.1.2.16 xoops2jp/html/modules/pm/xoops_version.php:1.1.2.16.2.1 --- xoops2jp/html/modules/pm/xoops_version.php:1.1.2.16 Thu Aug 17 18:09:51 2006 +++ xoops2jp/html/modules/pm/xoops_version.php Thu Nov 2 16:39:35 2006 @@ -1,5 +1,5 @@ Index: xoops2jp/html/modules/stdCache/images/stdCache.gif Index: xoops2jp/html/modules/stdCache/images/stdCache.png From minahito @ users.sourceforge.jp Thu Nov 2 16:39:49 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Thu, 2 Nov 2006 16:39:49 +0900 Subject: [xoops-cvslog 5576] CVS update: xoops2jp/html/modules/stdCache Message-ID: <20061102073949.4D38C2AC15B@users.sourceforge.jp> Index: xoops2jp/html/modules/stdCache/xoops_version.php diff -u xoops2jp/html/modules/stdCache/xoops_version.php:1.1.2.3.2.1 xoops2jp/html/modules/stdCache/xoops_version.php:1.1.2.3.2.2 --- xoops2jp/html/modules/stdCache/xoops_version.php:1.1.2.3.2.1 Sat Oct 14 13:53:12 2006 +++ xoops2jp/html/modules/stdCache/xoops_version.php Thu Nov 2 16:39:49 2006 @@ -1,14 +1,14 @@ Index: xoops2jp/html/modules/user/xoops_version.php diff -u xoops2jp/html/modules/user/xoops_version.php:1.1.2.24.2.1 xoops2jp/html/modules/user/xoops_version.php:1.1.2.24.2.2 --- xoops2jp/html/modules/user/xoops_version.php:1.1.2.24.2.1 Sun Oct 15 00:51:00 2006 +++ xoops2jp/html/modules/user/xoops_version.php Thu Nov 2 16:40:05 2006 @@ -1,5 +1,5 @@ Index: xoops2jp/html/modules/user/images/user.png Index: xoops2jp/html/modules/user/images/user.gif From minahito @ users.sourceforge.jp Thu Nov 2 18:56:45 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Thu, 2 Nov 2006 18:56:45 +0900 Subject: [xoops-cvslog 5579] CVS update: xoops2jp/html/modules/legacy/admin/theme Message-ID: <20061102095645.45CC62AC01F@users.sourceforge.jp> Index: xoops2jp/html/modules/legacy/admin/theme/admin_theme.html diff -u xoops2jp/html/modules/legacy/admin/theme/admin_theme.html:1.1.2.3 xoops2jp/html/modules/legacy/admin/theme/admin_theme.html:1.1.2.4 --- xoops2jp/html/modules/legacy/admin/theme/admin_theme.html:1.1.2.3 Fri Oct 20 10:48:31 2006 +++ xoops2jp/html/modules/legacy/admin/theme/admin_theme.html Thu Nov 2 18:56:45 2006 @@ -5,14 +5,14 @@ -<{$xoops_sitename}> : <{$smarty.const._CPHOME}> : <{$currentModule->getVar('name')}> +<{$xoops_sitename}> : <{$smarty.const._CPHOME}> : <{$currentModule->mXoopsModule->getShow('name')}> <{stylesheet file=style.css}> <{stylesheet file=module.css}> <{stylesheet file=style.css}> <{stylesheet file=module.css}> From minahito @ users.sourceforge.jp Mon Nov 6 18:39:50 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Mon, 6 Nov 2006 18:39:50 +0900 Subject: [xoops-cvslog 5632] CVS update: xoops2jp/html/modules/legacyRender/kernel Message-ID: <20061106093950.5E38C2AC137@users.sourceforge.jp> Index: xoops2jp/html/modules/legacyRender/kernel/Legacy_AdminRenderSystem.class.php diff -u xoops2jp/html/modules/legacyRender/kernel/Legacy_AdminRenderSystem.class.php:1.1.2.8 xoops2jp/html/modules/legacyRender/kernel/Legacy_AdminRenderSystem.class.php:1.1.2.9 --- xoops2jp/html/modules/legacyRender/kernel/Legacy_AdminRenderSystem.class.php:1.1.2.8 Mon Oct 30 20:46:25 2006 +++ xoops2jp/html/modules/legacyRender/kernel/Legacy_AdminRenderSystem.class.php Mon Nov 6 18:39:50 2006 @@ -169,7 +169,7 @@ // Other attributes // $this->mSmarty->assign('xoops_sitename', htmlspecialchars($this->mController->mRoot->mContext->getXoopsConfig('sitename'), ENT_QUOTES)); - $this->mSmarty->assign('xoops_pagetitle', htmlspecialchars($this->mController->mRoot->mContext->getXoopsConfig('slogan'), ENT_QUOTES)); + $this->mSmarty->assign('xoops_pagetitle', $moduleObject->mXoopsModule->getShow('name')); // // Theme rendering From minahito @ users.sourceforge.jp Mon Nov 6 19:17:34 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Mon, 6 Nov 2006 19:17:34 +0900 Subject: [xoops-cvslog 5633] CVS update: xoops2jp/html/modules/user/language/english Message-ID: <20061106101734.CE5672AC138@users.sourceforge.jp> Index: xoops2jp/html/modules/user/language/english/admin.php diff -u xoops2jp/html/modules/user/language/english/admin.php:1.1.2.30.2.4 xoops2jp/html/modules/user/language/english/admin.php:1.1.2.30.2.5 --- xoops2jp/html/modules/user/language/english/admin.php:1.1.2.30.2.4 Thu Nov 2 00:50:44 2006 +++ xoops2jp/html/modules/user/language/english/admin.php Mon Nov 6 19:17:34 2006 @@ -117,5 +117,7 @@ define('_AD_USER_TIP_DELETE_AVATAR', "Users who are using this avatar will have blank.gif as the avatar image file."); define('_AD_USER_TIPS_MAILJOB_SEND', "If there are too many users to send mail, the server may not respond as expected (blank page etc.). In that case, reload the browser several times to complete sending mail to all users."); define('_AD_USER_TIPS_RECOUNT_POSTS', "You may recalculate the number of posts for the user by clicking on the 'Recalculate' button below."); +define('_AD_USER_TIPS_USER_EDIT', "If you hope to change password, input 'Password' & 'Verify password'."); +define('_AD_USER_TIPS_USER_NEW', "You must input 'User name', 'Email address' and 'Password' & 'Verify password'."); ?> From minahito @ users.sourceforge.jp Mon Nov 6 19:17:34 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Mon, 6 Nov 2006 19:17:34 +0900 Subject: [xoops-cvslog 5634] CVS update: xoops2jp/html/modules/user/language/japanese Message-ID: <20061106101735.01CDB2AC13E@users.sourceforge.jp> Index: xoops2jp/html/modules/user/language/japanese/admin.php diff -u xoops2jp/html/modules/user/language/japanese/admin.php:1.1.2.37.2.4 xoops2jp/html/modules/user/language/japanese/admin.php:1.1.2.37.2.5 --- xoops2jp/html/modules/user/language/japanese/admin.php:1.1.2.37.2.4 Thu Nov 2 00:50:44 2006 +++ xoops2jp/html/modules/user/language/japanese/admin.php Mon Nov 6 19:17:34 2006 @@ -117,5 +117,7 @@ define('_AD_USER_TIP_DELETE_AVATAR', "このアバターを使用しているユーザーのアバターはブランクに変更されます"); define('_AD_USER_TIPS_MAILJOB_SEND', "送信対象ユーザー数が多すぎる場合、反応が返ってこないケース(真っ白になるなど)があります。
その場合はブラウザでリロード(再読込)操作を行ってください。操作を繰り返すことで全ユーザーへ送信できます。"); define('_AD_USER_TIPS_RECOUNT_POSTS', "もし投稿数が間違っているようであれば、再計算することができます。"); +define('_AD_USER_TIPS_USER_EDIT', "パスワードを変更したいときだけ、パスワードとパスワード確認を入力してください"); +define('_AD_USER_TIPS_USER_NEW', "ユーザー名、メールアドレス、パスワードとパスワード確認は必ず入力してください"); ?> From minahito @ users.sourceforge.jp Mon Nov 6 19:20:19 2006 From: minahito @ users.sourceforge.jp (Minahito) Date: Mon, 6 Nov 2006 19:20:19 +0900 Subject: [xoops-cvslog 5635] CVS update: xoops2jp/html/modules/user/admin/templates Message-ID: <20061106102019.C04CB2AC038@users.sourceforge.jp> Index: xoops2jp/html/modules/user/admin/templates/user_edit.html diff -u xoops2jp/html/modules/user/admin/templates/user_edit.html:1.1.2.21.2.1 xoops2jp/html/modules/user/admin/templates/user_edit.html:1.1.2.21.2.2 --- xoops2jp/html/modules/user/admin/templates/user_edit.html:1.1.2.21.2.1 Mon Oct 16 00:29:45 2006 +++ xoops2jp/html/modules/user/admin/templates/user_edit.html Mon Nov 6 19:20:19 2006 @@ -11,10 +11,13 @@ <{if $actionForm->get('uid')}>

<{$smarty.const._AD_USER_LANG_USER_EDIT}> (<{$actionForm->get('uname')}>)

+
<{$smarty.const._AD_USER_TIPS_USER_EDIT}>
<{else}>

<{$smarty.const._AD_USER_LANG_USER_NEW}>

+
<{$smarty.const._AD_USER_TIPS_USER_NEW}>
<{/if}> + <{if $actionForm->hasError()}>