public function test_getUnameFromId() { $value1 = XoopsUser::getUnameFromId(0); $this->assertSame(\Xoops::getInstance()->getConfig('anonymous'), $value1); $value = XoopsUser::getUnameFromId(1); $this->assertInternalType('string', $value); $this->assertNotSame($value, $value1); }
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; }
$res[$i]['image'] = $xoops->url('images/icons/posticon2.gif'); } if (!preg_match("/^http[s]*:\\/\\//i", $results[$i]['link'])) { $res[$i]['link'] = $xoops->url('modules/' . $module->getVar('dirname') . '/' . $results[$i]['link']); } else { $res[$i]['link'] = $results[$i]['link']; } $res[$i]['title'] = $myts->htmlSpecialChars($results[$i]['title']); if (isset($queries_pattern)) { $res[$i]['title_highligh'] = preg_replace($queries_pattern, "<span class='searchHighlight'>\$1</span>", $myts->htmlSpecialChars($results[$i]['title'])); } else { $res[$i]['title_highligh'] = $myts->htmlSpecialChars($results[$i]['title']); } if (!empty($results[$i]['uid'])) { $res[$i]['uid'] = @(int) $results[$i]['uid']; $res[$i]['uname'] = XoopsUser::getUnameFromId($results[$i]['uid'], true); } $res[$i]['time'] = !empty($results[$i]['time']) ? " (" . XoopsLocale::formatTimestamp((int) $results[$i]['time']) . ")" : ""; $res[$i]['content'] = empty($results[$i]['content']) ? "" : preg_replace($queries_pattern, "<span class='searchHighlight'>\$1</span>", $results[$i]['content']); } if (count($res) > 0) { $modules_result[$mid]['result'] = $res; } $search_url = $search->url('index.php?query=' . urlencode(stripslashes(implode(' ', $queries)))); $search_url .= "&mid={$mid}&action={$action}&andor={$andor}"; if ($action === 'showallbyuser') { $search_url .= "&uid={$uid}"; } if ($start > 0) { $prev = $start - 20; $search_url_prev = $search_url . "&start={$prev}";
} unset($pm); } $xoops->redirect("viewpmsg.php", 1, XoopsLocale::S_YOUR_MESSAGES_DELETED); } $xoops->header('module:system/system_viewpmsg.tpl'); $criteria = new Criteria('to_userid', $xoops->user->getVar('uid')); $criteria->setSort('msg_time'); $criteria->setOrder('DESC'); $pm_arr = $pm_handler->getObjects($criteria); $total_messages = count($pm_arr); $xoops->tpl()->assign('display', true); $xoops->tpl()->assign('anonymous', $xoops->getConfig('anonymous')); $xoops->tpl()->assign('uid', $xoops->user->getVar("uid")); $xoops->tpl()->assign('total_messages', $total_messages); $msg_no = 0; foreach (array_keys($pm_arr) as $i) { $messages['msg_id'] = $pm_arr[$i]->getVar("msg_id"); $messages['read_msg'] = $pm_arr[$i]->getVar("read_msg"); $messages['msg_image'] = $pm_arr[$i]->getVar("msg_image"); $messages['posteruid'] = $pm_arr[$i]->getVar('from_userid'); $messages['postername'] = XoopsUser::getUnameFromId($pm_arr[$i]->getVar('from_userid')); $messages['subject'] = $pm_arr[$i]->getVar("subject"); $messages['msg_time'] = XoopsLocale::formatTimestamp($pm_arr[$i]->getVar('msg_time')); $messages['msg_no'] = $msg_no; $xoops->tpl()->append('messages', $messages); ++$msg_no; } $xoops->tpl()->assign('token', $xoops->security()->getTokenHTML()); $xoops->footer(); }
if ($reply == 1) { $subject = $pm->getVar('subject', 'E'); if (!preg_match("/^" . XoopsLocale::C_RE . "/i", $subject)) { $subject = XoopsLocale::C_RE . ' ' . $subject; } $form->addElement(new Xoops\Form\Label(XoopsLocale::C_TO, $pm_uname)); $form->addElement(new Xoops\Form\Hidden('to_userid', $pm->getVar("from_userid"))); } else { if ($sendmod == 1) { $form->addElement(new Xoops\Form\Label(XoopsLocale::C_TO, XoopsUser::getUnameFromId($_POST["to_userid"]))); $form->addElement(new Xoops\Form\Hidden('to_userid', $_POST["to_userid"])); $subject = $myts->htmlSpecialChars($_POST['subject']); $message = $myts->htmlSpecialChars($_POST['message']); } else { if ($send2 == 1) { $form->addElement(new Xoops\Form\Label(XoopsLocale::C_TO, XoopsUser::getUnameFromId($to_userid, false))); $form->addElement(new Xoops\Form\Hidden('to_userid', $to_userid)); } else { $form->addElement(new Xoops\Form\SelectUser(XoopsLocale::C_TO, 'to_userid')); } $subject = ""; $message = ""; } } $form->addElement(new Xoops\Form\Text(XoopsLocale::SUBJECT, 'subject', 4, 100, $subject), true); $icons = new Xoops\Form\Radio(XoopsLocale::MESSAGE_ICON, 'msg_image', '', true); \Xoops\Core\Lists\SubjectIcon::setOptionsArray($icons); $form->addElement($icons, false); $form->addElement(new Xoops\Form\DhtmlTextArea(XoopsLocale::MESSAGE, 'message', $message, 8, 37), true); $form->addElement(new Xoops\Form\Hidden('op', 'submit')); $buttons = new Xoops\Form\ElementTray('');
public function renderHeader($title, $text, $uid, $timestamp) { $ret = '<table cellpadding="4" cellspacing="1" width="98%" class="outer"> <tr><td class="head">' . $title . '</td></tr><tr><td><br />'; if ($uid) { $ret .= _MD_COMMENTS_POSTER . ': <strong>' . XoopsUser::getUnameFromId($uid) . '</strong> '; } $ret .= _MD_COMMENTS_POSTED . ': <strong>' . XoopsLocale::formatTimestamp($timestamp) . '</strong><br /><br />' . $text . '<br /></td></tr>'; $ret .= '</table>'; return $ret; }
$xoops->theme()->addBaseScriptAssets(array('@jquery', 'media/xoops/xoops.js', 'modules/system/js/admin.js')); $admin_page = new \Xoops\Module\Admin(); $admin_page->renderNavigation('send_mails.php'); switch ($op) { case 'list': default: $display_criteria = 1; $form = new Xoops\Form\ThemeForm(_AM_MAILUSERS_LIST, "mailusers", "send_mails.php", 'post', true); //---------------------------------------- if (!empty($memberslist_id) && Request::getMethod() == 'POST') { $user_count = count($memberslist_id); $display_names = ""; for ($i = 0; $i < $user_count; ++$i) { $uid_hidden = new Xoops\Form\Hidden("mail_to_user[]", $memberslist_id[$i]); $form->addElement($uid_hidden); $display_names .= "<a href='" . \XoopsBaseConfig::get('url') . "/userinfo.php?uid=" . $memberslist_id[$i] . "' rel='external'>" . XoopsUser::getUnameFromId($memberslist_id[$i]) . "</a>, "; unset($uid_hidden); } $users_label = new Xoops\Form\Label(_AM_MAILUSERS_SENDTOUSERS2, substr($display_names, 0, -2)); $form->addElement($users_label); $form->addElement($users_label); $display_criteria = 0; } //---------------------------------------- if (!empty($display_criteria)) { $selected_groups = array(); $group_select = new Xoops\Form\SelectGroup('<div class="bold spacer">' . _AM_MAILUSERS_GROUPIS . '<span class="bold green">*</span></div>', "mail_to_group", false, $selected_groups, 5, true); $lastlog_min = new Xoops\Form\DateSelect(_AM_MAILUSERS_LASTLOGMIN . '<span class="bold green">*</span>', 'mail_lastlog_min'); $lastlog_min->setValue(''); $lastlog_max = new Xoops\Form\DateSelect(_AM_MAILUSERS_LASTLOGMAX . '<span class="bold green">*</span>', 'mail_lastlog_max'); $lastlog_max->setValue('');
// Criteria $content_count = $content_Handler->getCountPublished(); $content_arr = $content_Handler->getPagePublished($start, $nb_limit); // Assign Template variables $xoops->tpl()->assign('content_count', $content_count); $keywords = array(); if ($content_count > 0) { //Cleaning the content of $content, they are assign by blocks and mess the output $xoops->tpl()->assign('content', array()); foreach (array_keys($content_arr) as $i) { $content_id = $content_arr[$i]->getVar('content_id'); $content['id'] = $content_id; $content['title'] = $content_arr[$i]->getVar('content_title'); $content['shorttext'] = $content_arr[$i]->getVar('content_shorttext'); $content['authorid'] = $content_arr[$i]->getVar('content_author'); $content['author'] = XoopsUser::getUnameFromId($content_arr[$i]->getVar('content_author')); $content['date'] = XoopsLocale::formatTimestamp($content_arr[$i]->getVar('content_create'), $helper->getConfig('page_dateformat')); $content['time'] = XoopsLocale::formatTimestamp($content_arr[$i]->getVar('content_create'), $helper->getConfig('page_timeformat')); $xoops->tpl()->appendByRef('content', $content); $keywords[] = $content_arr[$i]->getVar('content_title'); unset($content); } // Display Page Navigation if ($content_count > $nb_limit) { $nav = new XoopsPageNav($content_count, $nb_limit, $start, 'start'); $xoops->tpl()->assign('nav_menu', $nav->renderNav(4)); } } else { $xoops->tpl()->assign('error_message', PageLocale::E_NO_CONTENT); } // Metas