Minahito
minah****@users*****
2006年 7月 1日 (土) 16:25:13 JST
Index: xoops2jp/html/modules/base/admin/class/ModuleUtils.class.php diff -u xoops2jp/html/modules/base/admin/class/ModuleUtils.class.php:1.1.2.17 xoops2jp/html/modules/base/admin/class/ModuleUtils.class.php:1.1.2.18 --- xoops2jp/html/modules/base/admin/class/ModuleUtils.class.php:1.1.2.17 Mon May 22 15:28:50 2006 +++ xoops2jp/html/modules/base/admin/class/ModuleUtils.class.php Sat Jul 1 16:25:12 2006 @@ -4,6 +4,10 @@ require_once XOOPS_ROOT_PATH."/class/template.php"; +define("MODINSTALL_LOGTYPE_REPORT", "report"); +define("MODINSTALL_LOGTYPE_WARNING", "warning"); +define("MODINSTALL_LOGTYPE_ERROR", "error"); + /** * A temporary log class. */ @@ -14,7 +18,7 @@ function add($msg) { - $this->mMessages[] = array('type' => 'report', 'message' => $msg); + $this->mMessages[] = array('type' => MODINSTALL_LOGTYPE_REPORT, 'message' => $msg); } function addReport($msg) @@ -24,12 +28,12 @@ function addWarning($msg) { - $this->mMessages[] = array('type' => 'warning', 'message' => $msg); + $this->mMessages[] = array('type' => MODINSTALL_LOGTYPE_WARNING, 'message' => $msg); } function addError($msg) { - $this->mMessages[] = array('type' => 'error', 'message' => $msg); + $this->mMessages[] = array('type' => MODINSTALL_LOGTYPE_ERROR, 'message' => $msg); $this->mFetalErrorFlag = true; } @@ -58,7 +62,7 @@ $sqlfile = $sqlfileInfo[XOOPS_DB_TYPE]; if (!file_exists(XOOPS_MODULE_PATH . "/" . $dirname . "/" . $sqlfile)) { - $log->addError("SQL file not found at $sqlfile"); + $log->addError(XCube_Utils::formatMessage(_AD_BASE_ERROR_SQL_FILE_NOT_FOUND, $sqlfile)); return false; } @@ -80,7 +84,7 @@ } } - $log->addReport("*Database table setup finished.*"); + $log->addReport(_AD_BASE_MESSAGE_DATABASE_SETUP_FINISHED); } /** @@ -127,10 +131,10 @@ $tplfile->setVar('tpl_desc', $description, true); if ($tplHandler->insert($tplfile)) { - $log->addReport(@sprintf("Template '${fileName}' has been installed.")); + $log->addReport(XCube_Utils::formatMessage(_AD_BASE_MESSAGE_TEMPLATE_INSTALLED, $fileName)); } else { - $log->addError(@sprintf(_MD_A_BASE_ERROR_INSERT_TEMPLATE, $fileName)); + $log->addError(XCube_Utils::formatMessage(_AD_BASE_ERROR_COULD_NOT_INSTALL_TEMPLATE, $fileName)); return false; } @@ -261,17 +265,17 @@ $autolink = true; } if (!$blockHandler->insert($blockObj, $autolink)) { - $log->addError("ERROR : Could not install block whose name is " . $blockObj->getVar('name')); + $log->addError(XCube_Utils::formatMessage(_AD_BASE_ERROR_COULD_NOT_INSTALL_BLOCK, $blockObj->getVar('name'))); return false; } else { - $log->addReport("block " . $blockObj->getVar('name') . " has been installed"); + $log->addReport(XCube_Utils::formatMessage(_AD_BASE_MESSAGE_BLOCK_INSTALLED, $blockObj->getVar('name'))); $tplHandler =& xoops_gethandler('tplfile'); if (!Legacy_ModuleUtils::installBlockTemplate($module, $blockObj)) { - $log->addError("Could not install block template " . $blockObj->getVar('name')); + $log->addError(XCube_Utils::formatMessage(_AD_BASE_ERROR_BLOCK_TEMPLATE_INSTALL, $blockObj->getVar('name'))); } // @@ -281,7 +285,7 @@ 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("Could not set link with all module " . $blockObj->getVar('name')); + $log->addWarn(XCube_Utils::formatMessage(_AD_BASE_ERROR_COULD_NOT_SET_LINK, $blockObj->getVar('name'))); } } $gpermHandler =& xoops_gethandler('groupperm'); @@ -297,7 +301,7 @@ $bperm->setVar('gperm_groupid', $group->getVar('groupid')); $bperm->setNew(); if (!$gpermHandler->insert($bperm)) { - $log->addWarn("Could not set block permission " . $blockObj->getVar('name')); + $log->addWarn(XCube_Utils::formatMessage(_AD_BASE_ERROR_COULD_NOT_SET_BLOCK_PERMISSION, $blockObj->getVar('name'))); } } } else { @@ -307,7 +311,7 @@ $bperm->setVar('gperm_groupid', $mygroup); $bperm->setNew(); if (!$gpermHandler->insert($bperm)) { - $log->addWarn("Could not set block permission " . $blockObj->getVar('name')); + $log->addWarn(XCube_Utils::formatMessage(_AD_BASE_ERROR_COULD_NOT_SET_BLOCK_PERMISSION, $blockObj->getVar('name'))); } } } @@ -435,7 +439,7 @@ } if (!$configHandler->insertConfig($config)) { - $log->addError("ERROR: Could not insert config " . $configInfo['name']); + $log->addError(XCube_Utils::formatMessage(_AD_BASE_ERROR_COULD_NOT_INSERT_CONFIG, $configInfo['name'])); } unset($config);