本文整理汇总了PHP中XCube_Utils::formatMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP XCube_Utils::formatMessage方法的具体用法?PHP XCube_Utils::formatMessage怎么用?PHP XCube_Utils::formatMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XCube_Utils
的用法示例。
在下文中一共展示了XCube_Utils::formatMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update041
function update041()
{
$this->mLog->addReport(_AD_LEGACY_MESSAGE_UPDATE_STARTED);
//Add Table
$sqlfileInfo = $this->_mTargetXoopsModule->getInfo('sqlfile');
$dirname = $this->_mTargetXoopsModule->getVar('dirname');
$sqlfile = $sqlfileInfo[XOOPS_DB_TYPE];
$sqlfilepath = XOOPS_MODULE_PATH . '/' . $dirname . '/' . $sqlfile;
require_once XOOPS_MODULE_PATH . '/legacy/admin/class/Legacy_SQLScanner.class.php';
$scanner = new Legacy_SQLScanner();
$scanner->setDB_PREFIX(XOOPS_DB_PREFIX);
$scanner->setDirname($this->_mTargetXoopsModule->get('dirname'));
if (!$scanner->loadFile($sqlfilepath)) {
$this->mLog->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();
foreach ($sqls as $sql) {
if (strpos($sql, '_message_users') !== false) {
if (!$db->query($sql)) {
$this->mLog->addError($db->error());
return false;
}
}
}
$this->mLog->addReport(_AD_LEGACY_MESSAGE_DATABASE_SETUP_FINISHED);
//add table
$this->updatemain();
return true;
}
示例2: executeViewIndex
function executeViewIndex(&$controller, &$xoopsUser, &$render)
{
//
// Because this action's template uses USER message catalog, load it.
//
$root =& $controller->mRoot;
$config_handler =& xoops_gethandler('config');
$moduleConfigUser =& $config_handler->getConfigsByDirname('user');
if ($moduleConfigUser['use_ssl'] == 1 && !empty($_POST[$moduleConfigUser['sslpost_name']])) {
session_id($_POST[$moduleConfigUser['sslpost_name']]);
}
$render->setTemplateName("legacy_misc_ssllogin.html");
$render->setAttribute("message", XCube_Utils::formatMessage(_MD_LEGACY_MESSAGE_LOGIN_SUCCESS, $xoopsUser->get('uname')));
}
示例3: preBlockFilter
function preBlockFilter()
{
if (LEGACY_INSTALLERCHECKER_ACTIVE == true && is_dir(XOOPS_ROOT_PATH . "/install")) {
$root =& XCube_Root::getSingleton();
$root->mLanguageManager->loadModuleMessageCatalog('legacy');
$xoopsConfig = $root->mContext->mXoopsConfig;
require_once XOOPS_ROOT_PATH . '/class/template.php';
$xoopsTpl = new XoopsTpl();
$xoopsTpl->assign(array('xoops_sitename' => htmlspecialchars($xoopsConfig['sitename']), 'xoops_themecss' => xoops_getcss(), 'xoops_imageurl' => XOOPS_THEME_URL . '/' . $xoopsConfig['theme_set'] . '/', 'lang_message_confirm' => XCube_Utils::formatMessage(_MD_LEGACY_MESSAGE_INSTALL_COMPLETE_CONFIRM, XOOPS_ROOT_PATH . "/install"), 'lang_message_warning' => XCube_Utils::formatMessage(_MD_LEGACY_MESSAGE_INSTALL_COMPLETE_WARNING, XOOPS_ROOT_PATH . "/install")));
$xoopsTpl->compile_check = true;
// @todo filebase template with absolute file path
$xoopsTpl->display(XOOPS_ROOT_PATH . '/modules/legacy/templates/legacy_install_completed.html');
exit;
}
}
示例4: validateBmodule
function validateBmodule()
{
$bmodule = $this->get('bmodule');
if (!count($bmodule)) {
$this->addErrorMessage(_AD_LEGACY_ERROR_BMODULE);
} else {
$handler =& xoops_gethandler('module');
foreach ($this->get('bmodule') as $mid) {
$module =& $handler->get($mid);
if ($mid != -1 && $mid != 0 && !is_object($module)) {
$this->addErrorMessage(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_OBJECTEXIST, _AD_LEGACY_LANG_BMODULE));
}
}
}
}
示例5: validate
function validate()
{
parent::validate();
//
// If htmlbanner is clicked, htmlbanner is requreid.
//
if ($this->get('htmlbanner')) {
if (strlen($this->get('htmlcode')) == 0) {
$this->addErrorMessage(XCube_Utils::formatMessage(_AD_LEGACYRENDER_ERROR_REQUIRED, _AD_LEGACYRENDER_LANG_HTMLCODE));
}
} else {
if (strlen($this->get('imageurl')) == 0) {
$this->addErrorMessage(XCube_Utils::formatMessage(_AD_LEGACYRENDER_ERROR_REQUIRED, _AD_LEGACYRENDER_LANG_IMAGEURL));
}
if (strlen($this->get('clickurl')) == 0) {
$this->addErrorMessage(XCube_Utils::formatMessage(_AD_LEGACYRENDER_ERROR_REQUIRED, _AD_LEGACYRENDER_LANG_CLICKURL));
}
}
}
示例6: validateSmile_url
function validateSmile_url()
{
if ($this->_mIsNew && $this->get('smile_url') == null) {
$this->addErrorMessage(XCube_Utils::formatMessage(_MD_LEGACY_ERROR_REQUIRED, _AD_LEGACY_LANG_SMILE_URL));
}
}
示例7: _processReport
function _processReport()
{
if (!$this->mLog->hasError()) {
$this->mLog->add(XCube_Utils::formatMessage(_AD_LEGACY_MESSAGE_UPDATING_MODULE_SUCCESSFUL, $this->_mCurrentXoopsModule->get('name')));
} else {
$this->mLog->addError(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_UPDATING_MODULE_FAILURE, $this->_mCurrentXoopsModule->get('name')));
}
}
示例8: _saveTargetImages
function _saveTargetImages(&$targetimages, $t_imgcat_id)
{
if (count($targetimages) == 0) {
return true;
}
$imgcathandler =& xoops_getmodulehandler('imagecategory', 'legacy');
$t_category =& $imgcathandler->get($t_imgcat_id);
$t_category_type = $t_category->get('imgcat_storetype');
$imagehandler =& xoops_getmodulehandler('image');
if (strtolower($t_category_type) == "file") {
for ($i = 0; $i < count($targetimages); $i++) {
$ext_pos = strrpos($targetimages[$i]['name'], '.');
if ($ext_pos === false) {
continue;
}
$ext = strtolower(substr($targetimages[$i]['name'], $ext_pos + 1));
if (empty($this->mAllowedExts[$ext])) {
continue;
}
$file_name = substr($targetimages[$i]['name'], 0, $ext_pos);
$save_file_name = uniqid('img') . '.' . $ext;
$filehandle = fopen(XOOPS_UPLOAD_PATH . '/' . $save_file_name, "w");
if (!$filehandle) {
$this->_addErrorMessage(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_COULD_NOT_SAVE_IMAGE_FILE, $file_name));
continue;
}
if (!@fwrite($filehandle, $targetimages[$i]['content'])) {
$this->_addErrorMessage(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_COULD_NOT_SAVE_IMAGE_FILE, $file_name));
@fclose($filehandle);
continue;
}
@fclose($filehandle);
$image =& $imagehandler->create();
$image->set('image_nicename', $file_name);
$image->set('image_name', $save_file_name);
$image->set('image_mimetype', $this->mAllowedExts[$ext]);
$image->set('image_display', 1);
$image->set('imgcat_id', $t_imgcat_id);
if (!$imagehandler->insert($image)) {
$this->_addErrorMessage(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_COULD_NOT_SAVE_IMAGE_FILE, $file_name));
}
unset($image);
}
//end of for
} elseif (strtolower($t_category_type) == "db") {
for ($i = 0; $i < count($targetimages); $i++) {
$ext_pos = strrpos($targetimages[$i]['name'], '.');
if ($ext_pos === false) {
continue;
}
$ext = strtolower(substr($targetimages[$i]['name'], $ext_pos + 1));
if (empty($this->mAllowedExts[$ext])) {
continue;
}
$file_name = substr($targetimages[$i]['name'], 0, $ext_pos);
$save_file_name = uniqid('img') . '.' . $ext;
//
$image =& $imagehandler->create();
$image->set('image_nicename', $file_name);
$image->set('image_name', $save_file_name);
$image->set('image_mimetype', $this->mAllowedExts[$ext]);
$image->set('image_display', 1);
$image->set('imgcat_id', $t_imgcat_id);
$image->loadImageBody();
if (!is_object($image->mImageBody)) {
$image->mImageBody =& $image->createImageBody();
}
$image->mImageBody->set('image_body', $targetimages[$i]['content']);
if (!$imagehandler->insert($image)) {
$this->_addErrorMessage(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_COULD_NOT_SAVE_IMAGE_FILE, $file_name));
}
unset($image);
}
//end of for
}
//end of elseif
return true;
}
示例9: uninstallPreferenceByOrder
function uninstallPreferenceByOrder($order, &$module, &$log)
{
$handler =& xoops_gethandler('config');
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('conf_modid', $module->get('mid')));
$criteria->add(new Criteria('conf_catid', 0));
$criteria->add(new Criteria('conf_order', $order));
$configArr =& $handler->getConfigs($criteria);
foreach (array_keys($configArr) as $idx) {
if ($handler->deleteConfig($configArr[$idx])) {
$log->addReport(XCube_Utils::formatMessage("Delete preference '{0}'.", $configArr[$idx]->get('conf_name')));
} else {
$log->addError(XCube_Utils::formatMessage("Could not delete preference '{0}'.", $configArr[$idx]->get('conf_name')));
}
}
}
示例10: _saveSmilesImages
function _saveSmilesImages(&$smilesimages)
{
if (count($smilesimages) == 0) {
return true;
}
$smileshandler =& xoops_getmodulehandler('smiles');
for ($i = 0; $i < count($smilesimages); $i++) {
$ext_pos = strrpos($smilesimages[$i]['name'], '.');
if ($ext_pos === false) {
continue;
}
$ext = strtolower(substr($smilesimages[$i]['name'], $ext_pos + 1));
if (empty($this->mAllowedExts[$ext])) {
continue;
}
$file_name = substr($smilesimages[$i]['name'], 0, $ext_pos);
$save_file_name = uniqid('smil') . '.' . $ext;
$filehandle = fopen(XOOPS_UPLOAD_PATH . '/' . $save_file_name, "w");
if (!$filehandle) {
$this->_addErrorMessage(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_COULD_NOT_SAVE_SMILES_FILE, $file_name));
continue;
}
if (!@fwrite($filehandle, $smilesimages[$i]['content'])) {
$this->_addErrorMessage(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_COULD_NOT_SAVE_SMILES_FILE, $file_name));
@fclose($filehandle);
continue;
}
@fclose($filehandle);
$smiles =& $smileshandler->create();
$smiles->set('code', $file_name);
$smiles->set('emotion', $file_name);
$smiles->set('smile_url', $save_file_name);
$smiles->set('display', 1);
if (!$smileshandler->insert($smiles)) {
$this->_addErrorMessage(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_COULD_NOT_SAVE_SMILES_FILE, $file_name));
}
unset($smiles);
}
return true;
}
示例11: checkLogin
/**
* Check the login request through delegates, and set XoopsObject to member
* property if the login is success.
*
* @access public
*/
function checkLogin()
{
if (!is_object($this->mRoot->mContext->mXoopsUser)) {
$this->mCheckLogin->call(new XCube_Ref($this->mRoot->mContext->mXoopsUser));
$this->mRoot->mLanguageManager->loadModuleMessageCatalog('legacy');
if (is_object($this->mRoot->mContext->mXoopsUser)) {
// If the current user doesn't bring to any groups, kick out him for XCL's security.
$t_groups =& $this->mRoot->mContext->mXoopsUser->getGroups();
if (!is_array($t_groups)) {
// exception
$this->logout();
return;
} else {
if (count($t_groups) == 0) {
// exception, too
$this->logout();
return;
}
}
// RMV-NOTIFY
// Perform some maintenance of notification records
$notification_handler =& xoops_gethandler('notification');
$notification_handler->doLoginMaintenance($this->mRoot->mContext->mXoopsUser->get('uid'));
XCube_DelegateUtils::call("Site.CheckLogin.Success", new XCube_Ref($this->mRoot->mContext->mXoopsUser));
//
// Fall back process for login success.
//
$url = XOOPS_URL;
if (!empty($_POST['xoops_redirect']) && !strpos(xoops_getrequest('xoops_redirect'), 'register')) {
$parsed = parse_url(XOOPS_URL);
$url = isset($parsed['scheme']) ? $parsed['scheme'] . '://' : 'http://';
if (isset($parsed['host'])) {
$url .= isset($parsed['port']) ? $parsed['host'] . ':' . $parsed['port'] . trim(xoops_getrequest('xoops_redirect')) : $parsed['host'] . trim(xoops_getrequest('xoops_redirect'));
} else {
$url .= xoops_getenv('HTTP_HOST') . trim(xoops_getrequest('xoops_redirect'));
}
}
$this->executeRedirect($url, 1, XCube_Utils::formatMessage(_MD_LEGACY_MESSAGE_LOGIN_SUCCESS, $this->mRoot->mContext->mXoopsUser->get('uname')));
} else {
XCube_DelegateUtils::call("Site.CheckLogin.Fail", new XCube_Ref($this->mRoot->mContext->mXoopsUser));
//
// Fall back process for login fail.
//
$this->executeRedirect(XOOPS_URL . "/user.php", 1, _MD_LEGACY_ERROR_INCORRECTLOGIN);
}
} else {
$this->executeForward(XOOPS_URL . '/');
}
}
示例12: _saveAvatarImages
function _saveAvatarImages(&$avatarimages)
{
if (count($avatarimages) == 0) {
return true;
}
$avatarhandler =& xoops_getmodulehandler('avatar');
for ($i = 0; $i < count($avatarimages); $i++) {
$ext_pos = strrpos( $avatarimages[$i]['name'] , '.' ) ;
if( $ext_pos === false ) continue ;
$ext = strtolower( substr( $avatarimages[$i]['name'] , $ext_pos + 1 ) ) ;
if( empty( $this->mAllowedExts[$ext] ) ) continue ;
$file_name = substr( $avatarimages[$i]['name'] , 0 , $ext_pos ) ;
$save_file_name = uniqid( 'savt' ) . '.' . $ext ;
$filehandle = fopen( XOOPS_UPLOAD_PATH.'/'.$save_file_name , "w" ) ;
if( ! $filehandle ) {
$this->_addErrorMessage(XCube_Utils::formatMessage(_AD_USER_ERROR_COULD_NOT_SAVE_AVATAR_FILE, $file_name));
continue ;
}
if ( !@fwrite($filehandle, $avatarimages[$i]['content']) ) {
$this->_addErrorMessage(XCube_Utils::formatMessage(_AD_USER_ERROR_COULD_NOT_SAVE_AVATAR_FILE, $file_name));
@fclose( $filehandle ) ;
continue;
};
@fclose( $filehandle ) ;
$avatar =& $avatarhandler->create();
$avatar->set('avatar_name', $file_name);
$avatar->set('avatar_file', $save_file_name);
$avatar->set('avatar_display', 1);
$avatar->set('avatar_weight', 0);
$avatar->set('avatar_type', 'S');
$avatar->set('avatar_mimetype', $this->mAllowedExts[$ext]);
if (!$avatarhandler->insert($avatar)) {
$this->_addErrorMessage(XCube_Utils::formatMessage(_AD_USER_ERROR_COULD_NOT_SAVE_AVATAR_FILE, $file_name));
}
unset($avatar);
}
return true;
}
示例13: validatePass
function validatePass()
{
// precondition check
if (strlen($this->get('pass')) > 0 && !preg_match('/^[\x21-\x7e]+$/', $this->get('pass'))) {
$this->addErrorMessage(XCube_Utils::formatMessage(_MD_USER_ERROR_INJURY, _MD_USER_LANG_PASSWORD));
$this->set('pass',null); // reset
$this->set('vpass',null);
}
if (strlen($this->get('pass'))>0||strlen($this->get('vpass'))>0) {
if($this->get('pass')!=$this->get('vpass')) {
$this->addErrorMessage(_MD_USER_ERROR_PASSWORD);
$this->set('pass',null); // reset
$this->set('vpass',null);
}
}
}
示例14: validatePasswd
function validatePasswd()
{
if (strlen($this->get('login')) > 0 && strlen($this->get('passwd')) == 0) {
$this->addErrorMessage(XCube_Utils::formatMessage(_AD_LEGACYRENDER_ERROR_REQUIRED, _AD_LEGACYRENDER_LANG_PASSWD));
}
}
示例15: validateRank
function validateRank()
{
$t_rank = $this->get('rank');
if ($t_rank > 0) {
$handler =& xoops_getmodulehandler('ranks', 'user');
$rank =& $handler->get($t_rank);
if (!is_object($rank)) {
$this->addErrorMessage(XCube_Utils::formatMessage(_MD_USER_ERROR_INJURY, _AD_USER_LANG_RANK));
} elseif ($rank->get('rank_special') != 1) {
$this->addErrorMessage(XCube_Utils::formatMessage(_MD_USER_ERROR_INJURY, _AD_USER_LANG_RANK));
}
}
}