本文整理汇总了PHP中XoopsUser类的典型用法代码示例。如果您正苦于以下问题:PHP XoopsUser类的具体用法?PHP XoopsUser怎么用?PHP XoopsUser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XoopsUser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: xoonips_change_uid
function xoonips_change_uid($su_uid)
{
$u = new XoopsUser($su_uid);
$groupids = $u->getGroups();
$_SESSION['xoopsUserId'] = $su_uid;
$_SESSION["xoopsUserGroups"] = $groupids;
}
示例2: mail_approved
/**
* @desc Envía correo de aprobación de publicación
* @param Object $res Publicación
**/
function mail_approved(RDResource &$res)
{
global $xoopsModuleConfig, $xoopsConfig;
$config_handler =& xoops_gethandler('config');
$mconfig = $config_handler->getConfigsByCat(XOOPS_CONF_MAILER);
$errors = '';
$user = new XoopsUser($res->getVar('owner'));
$member_handler =& xoops_gethandler('member');
$method = $user->getVar('notify_method');
$mailer = new RMMailer('text/plain');
$mailer->add_xoops_users($user);
$mailer->set_subject(sprintf(__('Publication <%s> approved!', 'docs'), $res->getVar('title')));
$mailer->assign('dear_user', $user->getVar('name') != '' ? $user->getVar('name') : $user->getVar('uname'));
$mailer->assign('link_to_resource', $res->permalink());
$mailer->assign('site_name', $xoopsConfig['sitename']);
$mailer->assign('resource_name', $res->getVar('title'));
$mailer->template(RMTemplate::get()->get_template('mail/resource_approved.php', 'module', 'docs'));
switch ($method) {
case '1':
$mailer->set_from_xuser($mconfig['fromuid']);
$ret = $mailer->send_pm();
break;
case '2':
$ret = $mailer->send();
break;
}
$page = rmc_server_var($_POST, 'page', 1);
return $ret;
}
示例3: cm_show_messages
/**
* Shows all messages sent by users and stored in database
*/
function cm_show_messages()
{
global $xoopsDB, $xoopsModuleConfig, $xoopsSecurity;
// Styles
RMTemplate::get()->add_style('admin.css', 'contact');
// Pagination
$page = rmc_server_var($_GET, 'page', 1);
$page = $page <= 0 ? 1 : $page;
$result = $xoopsDB->query("SELECT COUNT(*) FROM " . $xoopsDB->prefix("contactme"));
list($num) = $xoopsDB->fetchRow($result);
$limit = $xoopsModuleConfig['limit'];
$tpages = ceil($num / $limit);
$page = $page > $tpages ? $tpages : $page;
$start = $num <= 0 ? 0 : ($page - 1) * $limit;
$nav = new RMPageNav($num, $limit, $page, 5);
$nav->target_url('index.php?page={PAGE_NUM}');
// Get messages
$messages = array();
$result = $xoopsDB->query("SELECT * FROM " . $xoopsDB->prefix("contactme") . " ORDER BY id_msg DESC LIMIT {$start},{$limit}");
$time = new RMTimeFormatter(0, __('%M% %d%, %Y%', 'contact'));
while ($row = $xoopsDB->fetchArray($result)) {
$msg = new CTMessage();
$msg->assignVars($row);
if ($msg->getVar('xuid')) {
$user = new XoopsUser($msg->getVar('xuid'));
}
$messages[] = array('id' => $msg->id(), 'subject' => $msg->getVar('subject'), 'ip' => $msg->getVar('ip'), 'email' => $msg->getVar('email'), 'name' => $msg->getVar('name'), 'company' => $msg->getVar('org'), 'body' => $msg->getVar('body'), 'phone' => $msg->getVar('phone'), 'register' => $msg->getVar('register'), 'xuid' => $msg->getVar('xuid'), 'uname' => $msg->getVar('xuid') > 0 ? $user->uname() : '', 'date' => $time->format($msg->getVar('date')));
}
RMTemplate::get()->add_local_script('admin.js', 'contact');
RMTemplate::get()->add_local_script('jquery.checkboxes.js', 'rmcommon');
xoops_cp_header();
include RMTemplate::get()->get_template('admin/ct_dashboard.php', 'module', 'contact');
xoops_cp_footer();
}
示例4: eventCoreIncludeCommonLanguage
/**
* To prevent errors when upload images with closed site
*/
public function eventCoreIncludeCommonLanguage()
{
global $xoopsConfig;
if ($xoopsConfig['cpanel'] != 'redmexico') {
$db = XoopsDatabaseFactory::getDatabaseConnection();
$db->queryF("UPDATE " . $db->prefix("config") . " SET conf_value='redmexico' WHERE conf_modid=0 AND conf_catid=1 AND conf_name='cpanel'");
}
/**
* Check before to a rmcommon native module be installed
*/
$fct = RMHttpRequest::get('fct', 'string', '');
$op = RMHttpRequest::get('op', 'string', '');
if ('modulesadmin' == $fct && 'install' == $op) {
$dirname = RMHttpRequest::get('module', 'string', '');
if ('' != $dirname) {
$module = new XoopsModule();
$module->loadInfoAsVar($dirname);
if ($module->getInfo('rmnative')) {
RMUris::redirect_with_message(__('Please install %s using the modules manager from Common Utilities to prevent errors during install.', 'rmcommon'), RMCURL . '/modules.php?action=install&dir=' . $dirname, RMMSG_WARN);
}
}
}
if (RMUris::current_url() == RMCURL . '/include/upload.php' && $xoopsConfig['closesite']) {
$security = rmc_server_var($_POST, 'rmsecurity', 0);
$data = TextCleaner::getInstance()->decrypt($security, true);
$data = explode("|", $data);
// [0] = referer, [1] = session_id(), [2] = user, [3] = token
$xoopsUser = new XoopsUser($data[0]);
if ($xoopsUser->isAdmin()) {
$xoopsConfig['closesite'] = 0;
}
}
RMEvents::get()->run_event('rmcommon.include.common.language');
}
示例5: b_weblog_links_show
function b_weblog_links_show($options)
{
global $xoopsDB, $xoopsUser;
$mydirname = empty($options[0]) ? basename(dirname(dirname(__FILE__))) : $options[0];
$link_module = $options[1];
$link_num = $options[2];
$only_post = $options[3];
$showdsc = $options[4];
if ($only_post == "1") {
if (!preg_match("|weblog\\d*/post\\.php\$|", $_SERVER['SCRIPT_NAME'])) {
return false;
}
}
$currentuid = !empty($xoopsUser) ? $xoopsUser->getVar('uid', 'E') : 0;
$user_id = !empty($_GET['user_id']) ? intval($_GET['user_id']) : 0;
$submitter = empty($user_id) ? $currentuid : $user_id;
$block = array();
if (preg_match("/^mylinks\\d*\$/", $options[0])) {
// in case of mylinks module
$sql = sprintf('SELECT c.title as category, l.title as title, url, description as dsc FROM %s as c, %s as l, %s as d WHERE c.cid=l.cid and d.lid=l.lid and status=1 ', $xoopsDB->prefix($options[0] . '_cat'), $xoopsDB->prefix($options[0] . '_links'), $xoopsDB->prefix($options[0] . '_text'));
if ($submitter) {
$sql = sprintf('%s and submitter=%d', $sql, $submitter);
}
$sql .= " order by l.cid,l.date ";
} elseif (preg_match("/^weblinks\\d*\$/", $options[0])) {
// in case of weblink module
$sql = sprintf('select link.title as title, link.url as url, link.description as dsc, cat.title as category from %s as cat, %s as link, %s as clink where link.lid=clink.lid and clink.cid=cat.cid ', $xoopsDB->prefix($options[0] . '_category'), $xoopsDB->prefix($options[0] . '_link'), $xoopsDB->prefix($options[0] . '_catlink'));
if ($submitter) {
$sql = sprintf('%s and link.uid=%d', $sql, $submitter);
}
$sql .= " order by clink.cid,clink.lid ";
}
if (!isset($sql)) {
return array();
}
$result = $xoopsDB->query($sql, $link_num, 0);
while ($myrow = $xoopsDB->fetchArray($result)) {
$category = $myrow['category'];
if (!isset($block['links'][$category])) {
$block['links'][$category] = array();
}
$block['links'][$category][] = array("title" => $myrow['title'], "url" => $myrow['url'], "dsc" => $myrow['dsc']);
}
if ($submitter) {
$blogOwner = new XoopsUser($submitter);
$block['lang_whose'] = sprintf(_MB_WEBLOG_LANG_LINKS_FOR, $blogOwner->getVar('uname', 'E'));
} else {
$block['lang_whose'] = _MB_WEBLOG_LANG_LINKS_FOR_EVERYONE;
}
if ($showdsc) {
$block['showdsc'] = 1;
}
return $block;
}
示例6: user_allowed_toupload
/**
* Check if given user is allowed
* @param object XoopsUser object
* @return bool
*/
public function user_allowed_toupload(XoopsUser $user)
{
$groups = $user->getGroups();
$allowed = $this->getVar('groups');
foreach ($groups as $id) {
if (in_array($id, $allowed['write'])) {
return true;
}
}
return false;
}
示例7: getLastUser
/**
* @desc Obtiene el último usuario registrado
* @return objeto {@link XoopsUser}
*/
function getLastUser()
{
$db = XoopsDatabaseFactory::getDatabaseConnection();
$result = $db->query("SELECT * FROM " . $db->prefix("users") . " WHERE level>'0' ORDER BY uid DESC LIMIT 0,1");
if ($db->getRowsNum($result) > 0) {
$row = $db->fetchArray($result);
$user = new XoopsUser();
$user->assignVars($row);
return $user;
}
return false;
}
示例8: eventCoreIncludeCommonLanguage
/**
* To prevent errors when upload images with closed site
*/
public function eventCoreIncludeCommonLanguage()
{
global $xoopsConfig;
if (RMFunctions::current_url() == RMCURL . '/include/upload.php' && $xoopsConfig['closesite']) {
$security = rmc_server_var($_POST, 'rmsecurity', 0);
$data = TextCleaner::getInstance()->decrypt($security, true);
$data = explode("|", $data);
// [0] = referer, [1] = session_id(), [2] = user, [3] = token
$xoopsUser = new XoopsUser($data[0]);
if ($xoopsUser->isAdmin()) {
$xoopsConfig['closesite'] = 0;
}
}
}
示例9: yogurt_iteminfo
function yogurt_iteminfo($category, $item_id)
{
$module_handler =& xoops_gethandler('module');
$module =& $module_handler->getByDirname('yogurt');
if ($category == 'global') {
$item['name'] = '';
$item['url'] = '';
return $item;
}
global $xoopsDB;
if ($category == 'picture') {
$sql = 'SELECT title,uid_owner,url FROM ' . $xoopsDB->prefix('yogurt_images') . ' WHERE uid_owner = ' . $item_id . ' LIMIT 1';
$result = $xoopsDB->query($sql);
$result_array = $xoopsDB->fetchArray($result);
/**
* Let's get the user name of the owner of the album
*/
$owner = new XoopsUser();
$identifier = $owner->getUnameFromId($result_array['uid_owner']);
$item['name'] = $identifier . "'s Album";
$item['url'] = XOOPS_URL . '/modules/' . $module->getVar('dirname') . '/album.php?uid=' . $result_array['uid_owner'];
return $item;
}
if ($category == 'video') {
$sql = 'SELECT video_id,uid_owner,video_desc,youtube_code, mainvideo FROM ' . $xoopsDB->prefix('yogurt_images') . ' WHERE uid_owner = ' . $item_id . ' LIMIT 1';
$result = $xoopsDB->query($sql);
$result_array = $xoopsDB->fetchArray($result);
/**
* Let's get the user name of the owner of the album
*/
$owner = new XoopsUser();
$identifier = $owner->getUnameFromId($result_array['uid_owner']);
$item['name'] = $identifier . "'s Videos";
$item['url'] = XOOPS_URL . '/modules/' . $module->getVar('dirname') . '/seutubo.php?uid=' . $result_array['uid_owner'];
return $item;
}
if ($category == 'scrap') {
$sql = 'SELECT scrap_id, scrap_from, scrap_to, scrap_text FROM ' . $xoopsDB->prefix('yogurt_scraps') . ' WHERE scrap_from = ' . $item_id . ' LIMIT 1';
$result = $xoopsDB->query($sql);
$result_array = $xoopsDB->fetchArray($result);
/**
* Let's get the user name of the owner of the album
*/
$owner = new XoopsUser();
$identifier = $owner->getUnameFromId($result_array['scrap_from']);
$item['name'] = $identifier . "'s Scraps";
$item['url'] = XOOPS_URL . '/modules/' . $module->getVar('dirname') . '/scrapbook.php?uid=' . $result_array['scrap_from'];
return $item;
}
}
示例10: b_marquee_xfsection
function b_marquee_xfsection($limit, $dateformat, $itemssize)
{
$block = array();
global $xoopsDB;
if (!function_exists('xfblock_checkAccess')) {
include_once XOOPS_ROOT_PATH . "/modules/xfsection/include/xfblock_groupaccess.php";
}
$myts =& MyTextSanitizer::getInstance();
$sql = "SELECT articleid, title, published, expired, counter, groupid, uid FROM " . $xoopsDB->prefix("xfs_article") . " WHERE published < " . time() . " AND published > 0 AND (expired = 0 OR expired > " . time() . ") AND noshowart = 0 AND offline = 0 ORDER BY published DESC";
$result = $xoopsDB->query($sql, $limit, 0);
while ($myrow = $xoopsDB->fetchArray($result)) {
if (xfblock_checkAccess($myrow["groupid"])) {
$wfs = array();
$title = $myts->htmlSpecialChars($myrow["title"]);
if (!XOOPS_USE_MULTIBYTES) {
if ($itemssize > 0) {
$title = $myts->htmlSpecialChars(substr($myrow['title'], 0, $itemssize - 1));
} else {
$title = $myts->htmlSpecialChars($myrow['title']);
}
}
$block[] = array('date' => formatTimestamp($myrow['published'], $dateformat), 'category' => '', 'author' => XoopsUser::getUnameFromId($myrow['uid']), 'title' => $title, 'link' => "<a href='" . XOOPS_URL . '/modules/xfsection/article.php?articleid=' . $myrow['articleid'] . "'>" . $title . '</a>');
}
}
return $block;
}
示例11: tadgallery_show_re
function tadgallery_show_re($options)
{
global $xoopsDB;
$limit = empty($options[0]) ? 10 : intval($options[0]);
$userinfo = empty($options[1]) ? 0 : intval($options[1]);
$showall = empty($options[2]) ? 0 : intval($options[2]);
$modhandler =& xoops_gethandler('module');
$xoopsModule =& $modhandler->getByDirname("tadgallery");
$com_modid = $xoopsModule->getVar('mid');
$sql = "select a.com_id,a.com_text,a.com_itemid,a.com_uid,b.title,b.filename,b.uid from " . $xoopsDB->prefix("xoopscomments") . " as a left join " . $xoopsDB->prefix("tad_gallery") . " as b on a.com_itemid=b.sn where a.com_modid='{$com_modid}' order by a.com_modified desc limit 0,{$limit}";
$result = $xoopsDB->query($sql);
$block = $comment = "";
$i = 0;
while (list($com_id, $txt, $nsn, $uid, $title, $filename, $poster_uid) = $xoopsDB->fetchRow($result)) {
$uid_name = XoopsUser::getUnameFromId($uid, 1);
$poster_uid_name = XoopsUser::getUnameFromId($poster_uid, 1);
$comment[$i]['uid'] = $uid;
$comment[$i]['uid_name'] = empty($uid_name) ? XoopsUser::getUnameFromId($uid, 0) : $uid_name;
$comment[$i]['poster_uid'] = $poster_uid;
$comment[$i]['poster_uid_name'] = empty($poster_uid_name) ? XoopsUser::getUnameFromId($poster_uid, 0) : $poster_uid_name;
$comment[$i]['nsn'] = $nsn;
$comment[$i]['com_id'] = $com_id;
$comment[$i]['txt'] = $txt;
$comment[$i]['title'] = empty($title) ? $filename : $title;
$i++;
}
$block['showall'] = $showall;
$block['userinfo'] = $userinfo;
$block['comment'] = $comment;
return $block;
}
示例12: mypics_iteminfo
function mypics_iteminfo($category, $item_id)
{
$item['name'] = '';
$item['url'] = '';
if ($category == 'picture') {
global $xoopsDB;
$module_handler =& xoops_gethandler('module');
$module =& $module_handler->getByDirname('mypics');
$sql = 'SELECT title, uid, url FROM ' . $xoopsDB->prefix('yogurt_images') . ' WHERE uid = ' . $item_id . ' LIMIT 1';
$result = $xoopsDB->query($sql);
$result_array = $xoopsDB->fetchArray($result);
$owner = new XoopsUser();
$identifier = $owner->getUnameFromId($result_array['uid']);
$item['name'] = $identifier . "'s Album";
$item['url'] = XOOPS_URL . '/modules/' . $module->getVar('dirname') . '/index.php?uid=' . $result_array['uid'];
}
return $item;
}
示例13: b_mp_cont_show
function b_mp_cont_show($options)
{
global $xoopsDB, $xoopsUser, $xoopsModuleConfig, $HTTP_SERVER_VARS;
if (is_object($xoopsUser)) {
$uid = $xoopsUser->getVar('uid');
$uname = $xoopsUser->getVar('uname');
} else {
$uid = 0;
$uname = '';
}
$block = array();
if (!is_object($xoopsUser)) {
$block['lang_none'] = _MP_BL_YOUDONTHAVE;
} else {
$online = 0;
$offline = 0;
$user = '';
$cont_handler =& xoops_gethandler('priv_msgscont');
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('ct_userid', $xoopsUser->getVar('uid')));
$amount = $cont_handler->getCount($criteria);
$criteria->setSort('ct_uname');
$criteria->setOrder('desc');
$pm_cont =& $cont_handler->getObjects($criteria);
foreach (array_keys($pm_cont) as $i) {
$poster = new XoopsUser($pm_cont[$i]->getVar('ct_contact'));
/* Online poster */
if ($poster->isOnline()) {
$user .= "<a href='javascript:openWithSelfMain(\"" . XOOPS_URL . "/pmlite.php?send2=1&to_userid=" . $pm_cont[$i]->getVar('ct_contact') . "\",\"pmlite\", 450, 380)'>" . $poster->getVar('uname') . "</a>, ";
$online++;
} else {
$offline++;
}
}
$block['online_total'] = $amount;
$block['online'] = $online;
$block['offline'] = $offline;
$block['user'] = $user;
$block['lang_online'] = _MP_BLOCK_ONLINE;
$block['lang_offline'] = _MP_BLOCK_OFFLINE;
$block['lang_contact'] = _MP_BLOCK_CONTACT;
}
return $block;
}
示例14: get_submitter_info
function get_submitter_info($uid)
{
if ($uid <= 0) {
return _GUESTS;
}
$poster = new XoopsUser($uid);
// check if invalid uid
if ($poster->uname() == '') {
return '';
}
if ($this->nameoruname == 'uname') {
$name = $poster->uname();
} else {
$name = trim($poster->name());
if ($name == "") {
$name = $poster->uname();
}
}
return "<a href='" . XOOPS_URL . "/userinfo.php?uid={$uid}'>{$name}</a>";
}
示例15: getValues
public function getValues($keys = null, $format = null, $maxDepth = null)
{
$page = Page::getInstance();
$ret = parent::getValues($keys, $format, $maxDepth);
$ret['rating'] = number_format($this->getVar('content_rating'), 1);
// these next two lines are rather silly
$ret['content_authorid'] = $this->getVar('content_author');
$ret['content_author'] = XoopsUser::getUnameFromId($this->getVar('content_author'), true);
$ret['content_date'] = XoopsLocale::formatTimestamp($this->getVar('content_create'), $page->getConfig('page_dateformat'));
$ret['content_time'] = XoopsLocale::formatTimestamp($this->getVar('content_create'), $page->getConfig('page_timeformat'));
$ret['content_rating'] = number_format($this->getVar('content_rating'), 2);
return $ret;
}