本文整理汇总了PHP中xoops_gethandler函数的典型用法代码示例。如果您正苦于以下问题:PHP xoops_gethandler函数的具体用法?PHP xoops_gethandler怎么用?PHP xoops_gethandler使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xoops_gethandler函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: xoonips_session_regenerate
function xoonips_session_regenerate()
{
$old_sessid = session_id();
session_regenerate_id();
$new_sessid = session_id();
session_id($old_sessid);
session_destroy();
$old_session = $_SESSION;
session_id($new_sessid);
$sess_handler =& xoops_gethandler('session');
session_set_save_handler(array(&$sess_handler, 'open'), array(&$sess_handler, 'close'), array(&$sess_handler, 'read'), array(&$sess_handler, 'write'), array(&$sess_handler, 'destroy'), array(&$sess_handler, 'gc'));
session_start();
$_SESSION = array();
foreach (array_keys($old_session) as $key) {
$_SESSION[$key] = $old_session[$key];
}
// write and close session for xnp_is_valid_session_id()
session_write_close();
// restart session
session_set_save_handler(array(&$sess_handler, 'open'), array(&$sess_handler, 'close'), array(&$sess_handler, 'read'), array(&$sess_handler, 'write'), array(&$sess_handler, 'destroy'), array(&$sess_handler, 'gc'));
session_start();
$_SESSION = array();
foreach (array_keys($old_session) as $key) {
$_SESSION[$key] = $old_session[$key];
}
}
示例2: fetchSummary
function fetchSummary($external_link_id)
{
$db =& Database::getInstance();
$myts =& MyTextsanitizer::getInstance();
$module_handler =& xoops_gethandler('module');
$module =& $module_handler->getByDirname($this->mydirname);
$storyid = intval($external_link_id);
$mydirname = $this->mydirname;
if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) {
die('Invalid mydirname');
}
$mytrustdirpath = dirname(dirname(__FILE__));
require_once dirname(dirname(__FILE__)) . '/class/bulletin.php';
if (Bulletin::isPublishedExists($mydirname, $storyid)) {
$article = new Bulletin($mydirname, $storyid);
$subject4assign = $article->getVar('title');
$summary = $article->getVar('hometext');
if (function_exists('easiestml')) {
$summary = easiestml($summary);
}
$summary4assign = htmlspecialchars(xoops_substr($this->unhtmlspecialchars(strip_tags($summary)), 0, 255), ENT_QUOTES);
} else {
$subject4assign = '';
$summary4assign = '';
}
return array('dirname' => $mydirname, 'module_name' => $module->getVar('name'), 'subject' => $subject4assign, 'uri' => XOOPS_URL . '/modules/' . $mydirname . '/index.php?page=article&storyid=' . $storyid, 'summary' => $summary4assign);
}
示例3: XoopsFormSelectUser
/**
* Constructor
*
* @param string $caption
* @param string $name
* @param mixed $value Pre-selected value (or array of them).
* For an item with massive members, such as "Registered Users", "$value" should be used to store selected temporary users only instead of all members of that item
* @param bool $include_anon Include user "anonymous"?
* @param int $size Number or rows. "1" makes a drop-down-list.
* @param bool $multiple Allow multiple selections?
*/
function XoopsFormSelectUser($caption, $name, $include_anon = false, $value = null, $size = 1, $multiple = false)
{
$limit = 200;
$select_element = new XoopsFormSelect('', $name, $value, $size, $multiple);
if ($include_anon) {
$select_element->addOption(0, $GLOBALS['xoopsConfig']['anonymous']);
}
$member_handler =& xoops_gethandler('member');
$user_count = $member_handler->getUserCount();
$value = is_array($value) ? $value : (empty($value) ? array() : array($value));
if ($user_count > $limit && count($value) > 0) {
$criteria = new CriteriaCompo(new Criteria('uid', '(' . implode(',', $value) . ')', 'IN'));
} else {
$criteria = new CriteriaCompo();
$criteria->setLimit($limit);
}
$criteria->setSort('uname');
$criteria->setOrder('ASC');
$users = $member_handler->getUserList($criteria);
$select_element->addOptionArray($users);
if ($user_count <= $limit) {
$this->XoopsFormElementTray($caption, "", $name);
$this->addElement($select_element);
return;
}
xoops_loadLanguage('findusers');
$js_addusers = "<script type='text/javascript'>\r\n function addusers(opts){\r\n var num = opts.substring(0, opts.indexOf(':'));\r\n opts = opts.substring(opts.indexOf(':')+1, opts.length);\r\n var sel = xoopsGetElementById('" . $name . "');\r\n var arr = new Array(num);\r\n for (var n=0; n < num; n++) {\r\n var nm = opts.substring(0, opts.indexOf(':'));\r\n opts = opts.substring(opts.indexOf(':')+1, opts.length);\r\n var val = opts.substring(0, opts.indexOf(':'));\r\n opts = opts.substring(opts.indexOf(':')+1, opts.length);\r\n var txt = opts.substring(0, nm - val.length);\r\n opts = opts.substring(nm - val.length, opts.length);\r\n var added = false;\r\n for (var k = 0; k < sel.options.length; k++) {\r\n if(sel.options[k].value == val){\r\n added = true;\r\n break;\r\n }\r\n }\r\n if (added == false) {\r\n sel.options[k] = new Option(txt, val);\r\n sel.options[k].selected = true;\r\n }\r\n }\r\n return true;\r\n }\r\n </script>";
$token = $GLOBALS['xoopsSecurity']->createToken();
$action_tray = new XoopsFormElementTray("", " | ");
$action_tray->addElement(new XoopsFormLabel('', '<a href="#" onclick="var sel = xoopsGetElementById(\'' . $name . '\');for (var i = sel.options.length-1; i >= 0; i--) {if (!sel.options[i].selected) {sel.options[i] = null;}}; return false;">' . _MA_USER_REMOVE . "</a>"));
$action_tray->addElement(new XoopsFormLabel('', '<a href="#" onclick="openWithSelfMain(\'' . XOOPS_URL . '/include/findusers.php?target=' . $name . '&multiple=' . $multiple . '&token=' . $token . '\', \'userselect\', 800, 600, null); return false;" >' . _MA_USER_MORE . "</a>" . $js_addusers));
$this->XoopsFormElementTray($caption, '<br /><br />', $name);
$this->addElement($select_element);
$this->addElement($action_tray);
}
示例4: getDefaultView
function getDefaultView(&$controller, &$xoopsUser)
{
$dirname = xoops_getrequest('dirname');
if (!preg_match("/^[a-zA-Z_][a-zA-Z0-9_]*\$/", $dirname)) {
return LEGACY_FRAME_VIEW_ERROR;
}
if (!is_dir(XOOPS_MODULE_PATH . "/" . $dirname)) {
return LEGACY_FRAME_VIEW_ERROR;
}
$moduleHandler =& xoops_gethandler('module');
$this->mModuleObject =& $moduleHandler->getByDirname($dirname);
//
// If a module is installed, load modinfo and go to special displaying.
//
if (is_object($this->mModuleObject)) {
$this->mModuleObject->loadAdminMenu();
$this->mModuleObject->loadInfo($dirname);
$this->mInstalledFlag = true;
} else {
$this->mModuleObject =& $moduleHandler->create();
$this->mModuleObject->loadInfoAsVar($dirname);
$this->mInstalledFlag = false;
}
return LEGACY_FRAME_VIEW_SUCCESS;
}
示例5: get
/**
* @public
*/
public function get(&$userName, $uid)
{
$handler = xoops_gethandler('member');
$user = $handler->getUser($uid);
$name = $user->getShow('name');
$userName = $name ? $name : $user->getShow('uname');
}
示例6: search_album_set
function search_album_set()
{
global $ALBUM_SET_SEARCH, $xoopsDB, $xoopsUser;
if (is_object($xoopsUser)) {
$usergroups = $xoopsUser->getgroups();
$usergroup = implode(",", $usergroups);
$buid = $xoopsUser->uid();
} else {
$usergroup = XOOPS_GROUP_ANONYMOUS;
$buid = 0;
}
$user_cat = 10000;
$module_handler =& xoops_gethandler('module');
$xcgalModule = $module_handler->getByDirname('xcgal');
$config_handler =& xoops_gethandler('config');
$xcgalCon =& $config_handler->getConfigsByCat(0, $xcgalModule->mid());
if (is_object($xoopsUser) && $xoopsUser->isAdmin($xcgalModule->mid())) {
$ALBUM_SET_SEARCH = "";
} else {
$result = $xoopsDB->query("SELECT aid FROM " . $xoopsDB->prefix("xcgal_albums") . " WHERE visibility NOT IN ({$usergroup}, 0," . ($user_cat + $buid) . ")");
if ($xoopsDB->getRowsNum($result)) {
$set = '';
while ($album = $xoopsDB->fetchArray($result)) {
$set .= $album['aid'] . ',';
}
// while
$ALBUM_SET_SEARCH .= 'AND aid NOT IN (' . substr($set, 0, -1) . ') ';
}
$xoopsDB->freeRecordSet($result);
}
return $xcgalCon;
}
示例7: XooNIps_Amazon_ECS40
function XooNIps_Amazon_ECS40()
{
// get module config
$mydirname = basename(dirname(dirname(__FILE__)));
$mhandler =& xoops_gethandler('module');
$module =& $mhandler->getByDirname($mydirname);
$chandler =& xoops_gethandler('config');
$mconfig = $chandler->getConfigsByCat(false, $module->mid());
// call parent constructor
parent::XooNIpsXMLParser();
// set fetcher conditions
$this->_fetch_url = 'http://ecs.amazonaws.com/onca/xml';
$this->_fetch_arguments['Service'] = 'AWSECommerceService';
$this->_fetch_arguments['Version'] = '2007-07-16';
$this->_fetch_arguments['Operation'] = 'ItemLookup';
$this->_fetch_arguments['IdType'] = 'ISBN';
$this->_fetch_arguments['SearchIndex'] = 'Books';
$this->_fetch_arguments['ResponseGroup'] = 'Medium';
$this->_fetch_arguments['AWSAccessKeyId'] = $mconfig['AccessKey'];
$this->_fetch_arguments['Timestamp'] = gmdate('Y-m-d\\TH:i:s\\Z');
$this->_fetch_arguments['AssociateTag'] = $mconfig['AssociateTag'];
// secret access key for amazon API
$this->_secret_access_key = $mconfig['SecretAccessKey'];
// set parser conditions
$this->_parser_doctype = '';
$this->_parser_public_id = '';
}
示例8: multimenu_getmoduleoption
/**
* Returns a module's option
*
* Return's a module's option
*
* @package multimenu
* @author Hervé Thouzard
* @param string $option module option's name
* @param string $module module's name
*/
function multimenu_getmoduleoption($option, $repmodule = 'multiMenu')
{
global $xoopsModuleConfig, $xoopsModule;
static $tbloptions = array();
if (is_array($tbloptions) && array_key_exists($option, $tbloptions)) {
return $tbloptions[$option];
}
$retval = false;
if (isset($xoopsModuleConfig) && (is_object($xoopsModule) && $xoopsModule->getVar('dirname') == $repmodule && $xoopsModule->getVar('isactive'))) {
if (isset($xoopsModuleConfig[$option])) {
$retval = $xoopsModuleConfig[$option];
}
} else {
$module_handler =& xoops_gethandler('module');
$module =& $module_handler->getByDirname($repmodule);
$config_handler =& xoops_gethandler('config');
if ($module) {
$moduleConfig =& $config_handler->getConfigsByCat(0, $module->getVar('mid'));
if (isset($moduleConfig[$option])) {
$retval = $moduleConfig[$option];
}
}
}
$tbloptions[$option] = $retval;
return $retval;
}
示例9: smarty_function_pico_category_search
function smarty_function_pico_category_search($params, &$smarty)
{
$dir = @$params['dir'] . @$params['dirname'];
$cat_title = @$params['title'] . @$params['cat_title'];
$var_name = @$params['item'] . @$params['assign'];
if (empty($var_name)) {
echo 'error ' . __FUNCTION__ . ' [specify item]';
return;
}
if (empty($dir)) {
$dir = $smarty->get_template_vars('mydirname');
}
if (empty($dir)) {
echo 'error ' . __FUNCTION__ . ' [specify dirname]';
return;
}
$mydirnames = explode(',', $dir);
$db =& Database::getInstance();
$myts =& MyTextSanitizer::getInstance();
$module_handler =& xoops_gethandler('module');
$config_handler =& xoops_gethandler('config');
$categories4assign = array();
foreach ($mydirnames as $mydirname) {
$module =& $module_handler->getByDirname($mydirname);
$configs = $config_handler->getConfigList($module->getVar('mid'));
$sql = "SELECT * FROM " . $db->prefix($mydirname . "_categories") . " c WHERE c.cat_title='" . mysql_real_escape_string($cat_title) . "'";
$result = $db->query($sql);
while ($cat_row = $db->fetchArray($result)) {
$category4assign = array('mod_mid' => $module->getVar('mid'), 'mod_dirname' => $mydirname, 'mod_name' => $module->getVar('name'), 'id' => intval($cat_row['cat_id']), 'link' => pico_common_make_category_link4html($configs, $cat_row), 'title' => $myts->makeTboxData4Show($cat_row['cat_title']), 'desc' => $myts->displayTarea($cat_row['cat_desc'], 1), 'paths_raw' => pico_common_unserialize($cat_row['cat_path_in_tree']), 'paths_value' => array_values(pico_common_unserialize($cat_row['cat_path_in_tree'])), 'redundants' => pico_common_unserialize($cat_row['cat_redundants'])) + $cat_row;
$categories4assign[] = $category4assign;
}
}
$smarty->assign($var_name, $categories4assign);
}
示例10: prepare
public function prepare()
{
$root = XCube_Root::getSingleton();
$handler = xoops_gethandler('config');
$xoopsMailerConfig = $handler->getConfigsByCat(XOOPS_CONF_MAILER);
$this->reset();
if ($xoopsMailerConfig['from'] == '') {
$this->From = $root->mContext->mXoopsConfig['adminmail'];
} else {
$this->From = $xoopsMailerConfig['from'];
}
$this->Sender = $root->mContext->mXoopsConfig['adminmail'];
$this->SetLanguage(LEGACY_MAIL_LANG, XOOPS_ROOT_PATH . '/class/mail/phpmailer/language/');
$this->CharSet = LEGACY_MAIL_CHAR;
$this->Encoding = LEGACY_MAIL_ENCO;
switch ($xoopsMailerConfig['mailmethod']) {
case 'smtpauth':
$this->IsSMTP();
$this->SMTPAuth = true;
$this->Host = implode(';', $xoopsMailerConfig['smtphost']);
$this->Username = $xoopsMailerConfig['smtpuser'];
$this->Password = $xoopsMailerConfig['smtppass'];
break;
case 'smtp':
$this->IsSMTP();
$this->SMTPAuth = false;
$this->Host = implode(';', $xoopsMailerConfig['smtphost']);
break;
case 'sendmail':
$this->IsSendmail();
$this->Sendmail = $xoopsMailerConfig['sendmailpath'];
break;
}
return true;
}
示例11: render
public function render()
{
$module_handler =& xoops_gethandler('application');
$modules =& $module_handler->getObjects(new Criteria('hasmain', 1), true);
$options = array('0' => _NOCACHE, '30' => sprintf(_SECONDS, 30), '60' => _MINUTE, '300' => sprintf(_MINUTES, 5), '1800' => sprintf(_MINUTES, 30), '3600' => _HOUR, '18000' => sprintf(_HOURS, 5), '86400' => _DAY, '259200' => sprintf(_DAYS, 3), '604800' => _WEEK);
$rtn = "<table cellpadding='2' cellspacing='1' border='0'>";
if (count($modules) > 0) {
foreach ($modules as $mod) {
$rtn .= "<tr><td>" . $mod->getVar('name') . "</td><td>\n\t\t\t\t\t\t <select name='" . $this->getName() . "[" . $mod->getVar('mid') . "]' id='" . $this->getName() . "[" . $mod->getVar('mid') . "]'>";
foreach ($options as $k => $v) {
$rtn .= "<option value='{$k}'";
$rtn .= isset($this->selected[$mod->getVar('mid')]) && $this->selected[$mod->getVar('mid')] == $k ? " selected='selected'" : "";
$rtn .= ">{$v}</option>";
}
$rtn .= "</td></tr>";
/*$c_val = isset($currrent_val[$mid]) ? intval($currrent_val[$mid]) : null;
$selform = new XoopsFormSelect($modules[$mid]->getVar('name'), $config[$i]->getVar('conf_name')."[$mid]", $c_val);
$selform->addOptionArray($cache_options);
$ele->addElement($selform);
unset($selform);*/
}
} else {
$rtn .= "<tr><td>" . _AS_SYSPREF_NOMODS . "</td></tr>";
}
$rtn .= "</table>";
return $rtn;
}
示例12: execute
function execute(&$controller, &$xoopsUser)
{
if (XCube_Root::getSingleton()->mContext->mRequest->getRequest('_form_control_cancel') != null) {
return USER_FRAME_VIEW_CANCEL;
}
$memberHandler =& xoops_gethandler('member');
$this->mNewUser =& $memberHandler->createUser();
$this->mRegistForm->update($this->mNewUser);
$this->mNewUser->set('uorder', $controller->mRoot->mContext->getXoopsConfig('com_order'), true);
$this->mNewUser->set('umode', $controller->mRoot->mContext->getXoopsConfig('com_mode'), true);
if ($this->mConfig['activation_type'] == 1) {
$this->mNewUser->set('level', 1, true);
}
if (!$memberHandler->insertUser($this->mNewUser)) {
$this->mRedirectMessage = _MD_USER_LANG_REGISTERNG;
return USER_FRAME_VIEW_ERROR;
}
if (!$memberHandler->addUserToGroup(XOOPS_GROUP_USERS, $this->mNewUser->get('uid'))) {
$this->mRedirectMessage = _MD_USER_LANG_REGISTERNG;
return USER_FRAME_VIEW_ERROR;
}
$this->_clearRegistForm($controller);
$this->_processMail($controller);
$this->_eventNotifyMail($controller);
XCube_DelegateUtils::call('Legacy.Event.RegistUser.Success', new XCube_Ref($this->mNewUser));
return USER_FRAME_VIEW_SUCCESS;
}
示例13: fetchSummary
function fetchSummary($external_link_id)
{
$myts =& MyTextsanitizer::getInstance();
$module_handler =& xoops_gethandler('module');
$module =& $module_handler->getByDirname($this->mydirname);
$config_handler =& xoops_gethandler('config');
$configs = $config_handler->getConfigList($module->mid());
// external_link_id means $content_id
$content_id = intval($external_link_id);
$mydirname = $this->mydirname;
if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) {
die('Invalid mydirname');
}
// get categoryObject and contentObject
list($categoryObj, $contentObj) = pico_common_get_objects_from_content_id($mydirname, $content_id);
// existence check
if (!is_object($categoryObj) || !is_object($contentObj)) {
return '';
}
// permission check
$content_data = $contentObj->getData();
if (empty($content_data['can_read'])) {
return '';
}
// dare to convert it irregularly
$summary = str_replace('&', '&', htmlspecialchars(xoops_substr(strip_tags($content_data['body_cached']), 0, 255), ENT_QUOTES));
return array('dirname' => $mydirname, 'module_name' => $module->getVar('name'), 'subject' => $myts->makeTboxData4Show($content_data['subject_raw'], 1, 1), 'uri' => XOOPS_URL . '/modules/' . $mydirname . '/' . pico_common_make_content_link4html($configs, $content_data), 'summary' => $summary);
}
示例14: articles_notify_iteminfo
function articles_notify_iteminfo($category, $item_id)
{
global $xoopsModule, $xoopsModuleConfig, $xoopsConfig, $xoopsDB;
if (empty($xoopsModule) || $xoopsModule->getVar('dirname') != 'articles') {
$module_handler =& xoops_gethandler('module');
$module =& $module_handler->getByDirname('articles');
$config_handler =& xoops_gethandler('config');
$config =& $config_handler->getConfigsByCat(0, $module->getVar('mid'));
} else {
$module =& $xoopsModule;
$config =& $xoopsModuleConfig;
}
if ($category == 'global') {
$item['name'] = '';
$item['url'] = '';
return $item;
}
# if ($category=='story') {
# // Assume we have a valid story id
# $sql = 'SELECT title FROM '.$xoopsDB->prefix('stories') . ' WHERE storyid = ' . $item_id;
# $result = $xoopsDB->query($sql); // TODO: error check
# $result_array = $xoopsDB->fetchArray($result);
# $item['name'] = $result_array['title'];
# $item['url'] = XOOPS_URL . '/modules/' . $module->getVar('dirname') . '/article.php?storyid=' . $item_id;
# return $item;
# }
}
示例15: execute
function execute(&$controller, &$xoopsUser)
{
//
// Fetch request and validate.
//
$this->mActionForm->fetch();
$this->mActionForm->validate();
//
// If error, go to re-input.
//
if ($this->mActionForm->hasError()) {
return PM_FRAME_VIEW_ERROR;
}
//
// Delete PM
//
$handler =& xoops_gethandler('privmessage');
foreach ($this->mActionForm->getVar('msg_id') as $msg_id) {
$pm =& $handler->get($msg_id);
if (is_object($pm) && $pm->get('to_userid') == $xoopsUser->get('uid')) {
$handler->delete($pm);
}
unset($pm);
}
return PM_FRAME_VIEW_SUCCESS;
}