本文整理汇总了PHP中XCube_Utils类的典型用法代码示例。如果您正苦于以下问题:PHP XCube_Utils类的具体用法?PHP XCube_Utils怎么用?PHP XCube_Utils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XCube_Utils类的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: getNewMessage
public static function getNewMessage(&$arrays)
{
$root = XCube_Root::getSingleton();
if ($root->mContext->mUser->isInRole('Site.RegisteredUser')) {
$uid = $root->mContext->mXoopsUser->get('uid');
$modHand = xoops_getmodulehandler('inbox', 'message');
$num = $modHand->getCountUnreadByFromUid($uid);
if ($num > 0) {
$root->mLanguageManager->loadModuleMessageCatalog('message');
$arrays[] = array('url' => XOOPS_MODULE_URL . '/message/index.php', 'title' => XCube_Utils::formatString(_MD_MESSAGE_NEWMESSAGE, $num));
}
}
}
示例3: 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::formatString(_MD_LEGACY_MESSAGE_LOGIN_SUCCESS, $xoopsUser->get('uname')));
}
示例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: 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;
}
}
示例6: 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::formatString(_AD_LEGACYRENDER_ERROR_REQUIRED, _AD_LEGACYRENDER_LANG_HTMLCODE));
}
} else {
if (strlen($this->get('imageurl')) == 0) {
$this->addErrorMessage(XCube_Utils::formatString(_AD_LEGACYRENDER_ERROR_REQUIRED, _AD_LEGACYRENDER_LANG_IMAGEURL));
}
if (strlen($this->get('clickurl')) == 0) {
$this->addErrorMessage(XCube_Utils::formatString(_AD_LEGACYRENDER_ERROR_REQUIRED, _AD_LEGACYRENDER_LANG_CLICKURL));
}
}
}
示例7: 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')));
}
}
}
示例8: _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;
}
示例9: array
//-- for cache by group
$menu_cache_file = XOOPS_TRUST_PATH . '/cache/theme_' . $theme_name . '_menus_' . SITE_SALT;
// PM
if (is_object(@$xoopsUser)) {
if (defined('XOOPS_CUBE_LEGACY')) {
$url = null;
$root = XCube_Root::getSingleton();
$service =& $root->mServiceManager->getService('privateMessage');
if ($service != null) {
$client =& $root->mServiceManager->createClient($service);
$url = $client->call('getPmInboxUrl', array('uid' => $root->mContext->mXoopsUser->get('uid')));
if ($url != null) {
$xugj_pm_new_count = $client->call('getCountUnreadPM', array('uid' => $root->mContext->mXoopsUser->get('uid')));
if (intval($xugj_pm_new_count) > 0) {
$root->mLanguageManager->loadModuleMessageCatalog('message');
$xugj_pm_new_message = XCube_Utils::formatString(_MD_MESSAGE_NEWMESSAGE, $xugj_pm_new_count);
$this->assign('xugj_pm_new_message', $xugj_pm_new_message . "<br/><a href='" . $url . "'>" . _MD_MESSAGE_TEMPLATE15 . "</a>");
}
$this->assign('xugj_pm_new_count', intval($xugj_pm_new_count));
$this->assign('xugj_pm_inbox_url', $url);
}
} else {
$pm_handler =& xoops_gethandler('privmessage', true);
if (is_object($pm_handler)) {
$criteria = new CriteriaCompo(new Criteria('read_msg', 0));
$criteria->add(new Criteria('to_userid', $root->mContext->mXoopsUser->get('uid')));
$this->assign('pm', array(new_messages => $pm_handler->getCount($criteria)));
}
}
} else {
$pm_handler =& xoops_gethandler('privmessage');
示例10: 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 . '/');
}
}
示例11: formatMessage
/**
* @deprecated XCube 1.0 will remove this method.
* @see XCube_Utils::formatString()
*/
function formatMessage()
{
$arr = func_get_args();
if (count($arr) == 0) {
return null;
} else {
if (count($arr) == 1) {
return XCube_Utils::formatString($arr[0]);
} else {
if (count($arr) > 1) {
$vals = $arr;
array_shift($vals);
return XCube_Utils::formatString($arr[0], $vals);
}
}
}
}
示例12: validate
function validate()
{
parent::validate();
$handler =& xoops_getmodulehandler('imagecategory', 'legacy');
$category =& $handler->get($this->get('imgcat_id'));
$formFile = $this->get('image_name');
if ($formFile != null && is_object($category)) {
//
// Imagefile width & height check.
//
if ($formFile->getWidth() > $category->get('imgcat_maxwidth') || $formFile->getHeight() > $category->get('imgcat_maxheight')) {
$this->addErrorMessage(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_IMG_SIZE, $category->get('imgcat_maxwidth'), $category->get('imgcat_maxheight')));
}
//
// Check file size
//
if ($formFile->getFilesize() > $category->get('imgcat_maxsize')) {
$this->addErrorMessage(XCube_Utils::formatMessage(_AD_LEGACY_ERROR_IMG_FILESIZE, $category->get('imgcat_maxsize')));
}
}
}
示例13: 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));
}
}
示例14: _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')));
}
}
示例15: redirect
/**
* リダイレクトする
* @param XoopsUser $xoopsUser
*/
public function redirect(XoopsUser $xoopsUser)
{
$url = $this->_getRedirectURL();
$message = XCube_Utils::formatMessage(_MD_LEGACY_MESSAGE_LOGIN_SUCCESS, $xoopsUser->get('uname'));
$this->mRoot->mController->executeRedirect($url, 1, $message);
}