本文整理汇总了PHP中xoops_getHandler函数的典型用法代码示例。如果您正苦于以下问题:PHP xoops_getHandler函数的具体用法?PHP xoops_getHandler怎么用?PHP xoops_getHandler使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xoops_getHandler函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: eventBoot
function eventBoot()
{
$registry =& MymenusRegistry::getInstance();
$member_handler =& xoops_getHandler('member');
$user = $GLOBALS['xoopsUser'] ? $GLOBALS['xoopsUser'] : null;
if (!$user) {
$user = $member_handler->createUser();
$user->setVar('uid', 0);
$user->setVar('uname', $GLOBALS['xoopsConfig']['anonymous']);
}
$ownerid = isset($_GET['uid']) ? intval($_GET['uid']) : null;
$owner = $member_handler->getUser($ownerid);
//if uid > 0 but user does not exists
if (!is_object($owner)) {
//create new user
$owner = $member_handler->createUser();
}
if ($owner->isNew()) {
$owner->setVar('uid', 0);
$owner->setVar('uname', $GLOBALS['xoopsConfig']['anonymous']);
}
$registry->setEntry('user', $user->getValues());
$registry->setEntry('owner', $owner->getValues());
$registry->setEntry('user_groups', $GLOBALS['xoopsUser'] ? $GLOBALS['xoopsUser']->getGroups() : array(XOOPS_GROUP_ANONYMOUS));
$registry->setEntry('user_uid', $GLOBALS['xoopsUser'] ? $GLOBALS['xoopsUser']->getVar('uid') : 0);
$registry->setEntry('get_uid', isset($_GET['uid']) ? intval($_GET['uid']) : 0);
}
示例2: smarty_function_xoInboxCount
/**
* @param $params
* @param $smarty
* @return null
*/
function smarty_function_xoInboxCount($params, &$smarty)
{
global $xoopsUser;
if (!isset($xoopsUser) || !is_object($xoopsUser)) {
return null;
}
$time = time();
if (isset($_SESSION['xoops_inbox_count']) && @$_SESSION['xoops_inbox_count_expire'] > $time) {
$count = (int) $_SESSION['xoops_inbox_count'];
} else {
$pm_handler = xoops_getHandler('privmessage');
$xoopsPreload = XoopsPreload::getInstance();
$xoopsPreload->triggerEvent('core.class.smarty.xoops_plugins.xoinboxcount', array($pm_handler));
$criteria = new CriteriaCompo(new Criteria('read_msg', 0));
$criteria->add(new Criteria('to_userid', $xoopsUser->getVar('uid')));
$count = (int) $pm_handler->getCount($criteria);
$_SESSION['xoops_inbox_count'] = $count;
$_SESSION['xoops_inbox_count_expire'] = $time + 60;
}
if (!@empty($params['assign'])) {
$smarty->assign($params['assign'], $count);
} else {
echo $count;
}
}
示例3: __construct
/**
* Constructor
*
* @param XoopsTpl $tpl
* @param boolean $use_icons
* @param boolean $do_iconcheck
*
*/
public function __construct(XoopsTpl $tpl, $use_icons = true, $do_iconcheck = false)
{
$this->_tpl = $tpl;
$this->_useIcons = (bool) $use_icons;
$this->_doIconCheck = (bool) $do_iconcheck;
$this->_memberHandler = xoops_getHandler('member');
$this->_statusText = array(XOOPS_COMMENT_PENDING => '<span style="text-decoration: none; font-weight: bold; color: #00ff00;">' . _CM_PENDING . '</span>', XOOPS_COMMENT_ACTIVE => '<span style="text-decoration: none; font-weight: bold; color: #ff0000;">' . _CM_ACTIVE . '</span>', XOOPS_COMMENT_HIDDEN => '<span style="text-decoration: none; font-weight: bold; color: #0000ff;">' . _CM_HIDDEN . '</span>');
}
示例4: authenticate
/**
* Authenticate user
*
* @param string $uname
* @param string $pwd
* @return bool
*/
public function authenticate($uname, $pwd = null)
{
$member_handler = xoops_getHandler('member');
$user = $member_handler->loginUser($uname, $pwd);
if ($user == false) {
$this->setErrors(1, _US_INCORRECTLOGIN);
}
return $user;
}
示例5: check_profile
/**
* Check if user profile table already converted
*
*/
function check_profile()
{
$module_handler =& xoops_getHandler('module');
if (!$profile_module = $module_handler->getByDirname('profile')) return true;
$sql = "SHOW COLUMNS FROM " . $GLOBALS['xoopsDB']->prefix("users") . " LIKE 'posts'";
$result = $GLOBALS['xoopsDB']->queryF($sql);
if (!$result) return false;
if ($GLOBALS['xoopsDB']->getRowsNum($result) == 0) return false;
return true;
}
示例6: validate
/**
* @return bool
*/
public static function validate()
{
$module_handler = xoops_getHandler('module');
if ($admin_module = $module_handler->getByDirname('thadmin')) {
if ($admin_module->getVar('isactive')) {
return true;
}
}
return false;
}
示例7: __construct
/**
* Authentication Service constructor
* @param XoopsDatabase $dao
*/
public function __construct(XoopsDatabase $dao = null)
{
$this->_dao = $dao;
// The config handler object allows us to look at the configuration options that are stored in the database
$config_handler = xoops_getHandler('config');
$config = $config_handler->getConfigsByCat(XOOPS_CONF_AUTH);
$confcount = count($config);
foreach ($config as $key => $val) {
$this->{$key} = $val;
}
}
示例8: __construct
/**
* Constructor
*
* @param string $caption
* @param string $name
* @param mixed $value Pre-selected value (or array of them).
*/
public function __construct($caption, $name, $value = null)
{
/** @var XoopsMemberHandler $member_handler */
$member_handler = xoops_getHandler('member');
$userGroups = $member_handler->getGroupList();
parent::__construct($caption, $name, $value);
$this->columns = 3;
foreach ($userGroups as $group_id => $group_name) {
$this->addOption($group_id, $group_name);
}
}
示例9: __construct
/**
* @param $target
* @param int $subCatsCount
*/
public function __construct(&$target, $subCatsCount = 4)
{
$this->publisher =& PublisherPublisher::getInstance();
$this->targetObject =& $target;
$this->subCatsCount = $subCatsCount;
$memberHandler =& xoops_getHandler('member');
$this->userGroups = $memberHandler->getGroupList();
parent::__construct(_AM_PUBLISHER_CATEGORY, 'form', xoops_getenv('PHP_SELF'));
$this->setExtra('enctype="multipart/form-data"');
$this->createElements();
$this->createButtons();
}
示例10: protector_notify_base
/**
* @param $mydirname
* @param $category
* @param $item_id
*
* @return mixed
*/
function protector_notify_base($mydirname, $category, $item_id)
{
include_once __DIR__ . '/include/common_functions.php';
$db = XoopsDatabaseFactory::getDatabaseConnection();
$module_handler = xoops_getHandler('module');
$module = $module_handler->getByDirname($mydirname);
if ($category === 'global') {
$item['name'] = '';
$item['url'] = '';
return $item;
}
return null;
}
示例11: altsys_set_module_config
function altsys_set_module_config()
{
global $altsysModuleConfig, $altsysModuleId;
$module_handler = xoops_getHandler('module');
$module = $module_handler->getByDirname('altsys');
if (is_object($module)) {
$config_handler = xoops_getHandler('config');
$altsysModuleConfig = $config_handler->getConfigList($module->getVar('mid'));
$altsysModuleId = $module->getVar('mid');
} else {
$altsysModuleConfig = array();
$altsysModuleId = 0;
}
}
示例12: getForm
/**
* @return XoopsThemeForm
*/
public function getForm()
{
if ($this->isNew()) {
$blank_img = 'blank.gif';
} else {
$blank_img = str_replace('avatars/', '', $this->getVar('avatar_file', 'e'));
}
// Get User Config
$config_handler = xoops_getHandler('config');
$xoopsConfigUser = $config_handler->getConfigsByCat(XOOPS_CONF_USER);
// New and edit form
$form = new XoopsThemeForm(_AM_SYSTEM_AVATAR_ADD, 'avatar_form', 'admin.php', 'post', true);
$form->setExtra('enctype="multipart/form-data"');
// Name
$form->addElement(new XoopsFormText(_IMAGENAME, 'avatar_name', 50, 255, $this->getVar('avatar_name', 'e')), true);
// Name description
$maxpixel = '<div>' . _US_MAXPIXEL . ' : ' . $xoopsConfigUser['avatar_width'] . ' x ' . $xoopsConfigUser['avatar_height'] . '</div>';
$maxsize = '<div>' . _US_MAXIMGSZ . ' : ' . $xoopsConfigUser['avatar_maxsize'] . '</div>';
// Upload part
$imgtray_img = new XoopsFormElementTray(_IMAGEFILE, '<br>');
$imgtray_img->setDescription($maxpixel . $maxsize);
$imageselect_img = new XoopsFormSelect(sprintf(_AM_SYSTEM_AVATAR_USE_FILE, XOOPS_UPLOAD_PATH . '/avatars/'), 'avatar_file', $blank_img);
$image_array_img = XoopsLists::getImgListAsArray(XOOPS_UPLOAD_PATH . '/avatars');
$imageselect_img->addOption("{$blank_img}", $blank_img);
foreach ($image_array_img as $image_img) {
$imageselect_img->addOption("{$image_img}", $image_img);
}
$imageselect_img->setExtra("onchange='showImgSelected(\"xo-avatar-img\", \"avatar_file\", \"avatars\", \"\", \"" . XOOPS_UPLOAD_URL . "\")'");
$imgtray_img->addElement($imageselect_img, false);
$imgtray_img->addElement(new XoopsFormLabel('', "<br><img src='" . XOOPS_UPLOAD_URL . '/avatars/' . $blank_img . "' name='image_img' id='xo-avatar-img' alt='' />"));
$fileseltray_img = new XoopsFormElementTray('<br>', '<br><br>');
$fileseltray_img->addElement(new XoopsFormFile(_AM_SYSTEM_AVATAR_UPLOAD, 'avatar_file', 500000), false);
$imgtray_img->addElement($fileseltray_img);
$form->addElement($imgtray_img);
// Weight
$form->addElement(new XoopsFormText(_IMGWEIGHT, 'avatar_weight', 3, 4, $this->getVar('avatar_weight', 'e')));
// Display
$form->addElement(new XoopsFormRadioYN(_IMGDISPLAY, 'avatar_display', $this->getVar('avatar_display', 'e'), _YES, _NO));
// Hidden
if ($this->isNew()) {
$form->addElement(new XoopsFormHidden('avatar_type', 's'));
}
$form->addElement(new XoopsFormHidden('op', 'save'));
$form->addElement(new XoopsFormHidden('fct', 'avatars'));
$form->addElement(new XoopsFormHidden('avatar_id', $this->getVar('avatar_id', 'e')));
// Button
$form->addElement(new XoopsFormButton('', 'avt_button', _SUBMIT, 'submit'));
return $form;
}
示例13: user_index
function user_index($start = 0)
{
global $xoopsTpl, $xoopsUser, $xoopsConfig, $limit;
$myts =& MyTextSanitizer::getInstance();
include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
$this_handler =& xoops_getModuleHandler('user', 'subscribers');
$module_handler =& xoops_getHandler('module');
$query = isset($_POST['query']) ? $_POST['query'] : null;
$xoopsTpl->assign('query', $query);
$criteria = null;
if (!is_null($query)) {
$criteria = new Criteria('user_email', $myts->addSlashes($query) . '%', 'LIKE');
}
$count = $this_handler->getCount($criteria);
$xoopsTpl->assign('count', $count);
$mHandler =& xoops_getHandler('member');
$users_count = $mHandler->getUserCount(new Criteria('level', 0, '>'));
$xoopsTpl->assign('users_count', $users_count);
$xoopsTpl->assign('total_count', $users_count + $count);
$criteria = new CriteriaCompo($criteria);
$criteria->setSort('user_id');
$criteria->setOrder('DESC');
$criteria->setStart($start);
$criteria->setLimit($limit);
$objs = $this_handler->getObjects($criteria);
unset($criteria);
if ($count > 0) {
if ($count > $limit) {
include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
$nav = new XoopsPageNav($count, $limit, $start, 'start', 'op=list');
$xoopsTpl->assign('pag', '<div style="float:left; padding-top:2px;" align="center">' . $nav->renderNav() . '</div>');
} else {
$xoopsTpl->assign('pag', '');
}
} else {
$xoopsTpl->assign('pag', '');
}
include_once XOOPS_ROOT_PATH . '/class/xoopslists.php';
$countries = XoopsLists::getCountryList();
foreach ($objs as $obj) {
$objArray = $obj->toArray();
$objArray['user_country'] = $countries[$objArray['user_country']];
$xoopsTpl->append('objs', $objArray);
unset($objArray);
}
$xoopsTpl->assign('add_form', user_form());
return $xoopsTpl->fetch(XOOPS_ROOT_PATH . '/modules/subscribers/templates/static/subscribers_admin_user.html');
}
示例14: getOwner_uids
function getOwner_uids()
{
$member_handler = xoops_getHandler('member');
$sql = 'SELECT DISTINCT uid AS uid FROM ' . $this->table;
$result = $this->db->query($sql);
while ($uid = $this->db->fetchArray($result)) {
$owner_uidsArray[] = $uid['uid'];
}
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('uid', '(' . implode(', ', $owner_uidsArray) . ')', 'IN'));
$usersArray = $member_handler->getUserList($criteria);
$ret = array();
$ret['default'] = _XUUPS_ANY;
foreach ($usersArray as $k => $v) {
$ret[$k] = $v;
}
return $ret;
}
示例15: mod_fetchConfig
/**
* Fetch configs of a module from database
*
*
* @param string $dirname module dirname
* @return array
*/
function mod_fetchConfig($dirname = '')
{
if (empty($dirname)) {
return null;
}
$module_handler = xoops_getHandler('module');
if (!($module = $module_handler->getByDirname($dirname))) {
trigger_error("Module '{$dirname}' does not exist", E_USER_WARNING);
return null;
}
$config_handler = xoops_getHandler('config');
$criteria = new CriteriaCompo(new Criteria('conf_modid', $module->getVar('mid')));
$configs = $config_handler->getConfigs($criteria);
foreach (array_keys($configs) as $i) {
$moduleConfig[$configs[$i]->getVar('conf_name')] = $configs[$i]->getConfValueForOutput();
}
unset($module, $configs);
return $moduleConfig;
}