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; }
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; }
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; }
function addOptionUsers($gid = 0) { list($cuid) = $this->getValue(); $max = _CC_MAX_USERS; $start = isset($_REQUEST['start']) ? intval($_REQUEST['start']) : 0; $users = cc_group_users($gid, $max, $start); $opts = $this->getOptions(); // force insert current if none if ($cuid && !isset($users[$cuid]) && !isset($opts[$cuid])) { $users[$cuid] = XoopsUser::getUnameFromId($cuid); } $this->addOptionArray($users); $this->setPageNav($gid); }
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; } }
/** * Returns the user name for the current keyword (if the parameter is null) */ function uname($uid = 0) { global $xoopsConfig; static $tblusers = array(); $option = -1; if (empty($uid)) { $uid = $this->getVar('uid'); } if (is_array($tblusers) && array_key_exists($uid, $tblusers)) { return $tblusers[$uid]; } $tblusers[$uid] = XoopsUser::getUnameFromId($uid); return $tblusers[$uid]; }
function b_marquee_xfaq($limit, $dateformat, $itemssize) { include_once XOOPS_ROOT_PATH . '/modules/marquee/include/functions.php'; $block = array(); $myts =& MyTextSanitizer::getInstance(); $db =& Database::getInstance(); $result = $db->query("SELECT f.*, t.topic_title, t.topic_submitter FROM " . $db->prefix("xfaq_faq") . " f, " . $db->prefix("xfaq_topic") . " t WHERE f.faq_online>0 AND (f.faq_topic=t.topic_id) ORDER BY faq_date_created DESC", $limit, 0); while ($myrow = $db->fetchArray($result)) { $title = $myts->htmlSpecialChars($myrow["faq_question"]); if ($itemssize > 0) { $title = xoops_substr($title, 0, $itemssize + 3); } $block[] = array('date' => formatTimestamp($myrow['faq_date_created'], $dateformat), 'category' => $myts->htmlSpecialChars($myrow['topic_title']), 'author' => XoopsUser::getUnameFromId(intval($myrow['topic_submitter'])), 'title' => $title, 'link' => "<a href='" . XOOPS_URL . "/modules/xfaq/faq.php?faq_id=" . $myrow['faq_id'] . "'>{$title}</a>"); } return $block; }
function b_marquee_catads($limit, $dateformat, $itemssize) { global $xoopsModule, $xoopsModuleConfig, $xoopsDB; include_once XOOPS_ROOT_PATH . '/modules/catads/class/cat.php'; $block = array(); if (empty($xoopsModule) || $xoopsModule->getVar('dirname') != 'catads') { $module_handler =& xoops_gethandler('module'); $module =& $module_handler->getByDirname('catads'); $config_handler =& xoops_gethandler('config'); $config =& $config_handler->getConfigsByCat(0, $module->getVar('mid')); } else { $module =& $xoopsModule; $config =& $xoopsModuleConfig; } //echo '<br />ok'; $ads_hnd =& xoops_getmodulehandler('ads', 'catads'); $criteria = new CriteriaCompo(new Criteria('waiting', '0')); $criteria->add(new Criteria('published', time(), '<')); $criteria->add(new Criteria('expired', time(), '>')); $criteria->setSort('published'); $criteria->setOrder('DESC'); $criteria->setLimit($options[0]); $nbads = $ads_hnd->getCount($criteria); $a_item = array(); $cat_buffer = array(); if ($nbads > 0) { $ads = $ads_hnd->getObjects($criteria); $ts =& MyTextSanitizer::getInstance(); foreach ($ads as $oneads) { if ($itemssize > 0) { $title = xoops_substr($oneads->getVar('ads_title'), 0, $itemssize); } else { $title = $oneads->getVar('ads_title'); } if (!isset($cat_buffer[$oneads->getVar('cat_id')])) { $tmpcat = new AdsCategory($oneads->getVar('cat_id')); $cat_buffer[$oneads->getVar('cat_id')] = $tmpcat->title(); $cat_title = $tmpcat->title(); } else { $cat_title = $cat_buffer[$oneads->getVar('cat_id')]; } $block[] = array('date' => formatTimestamp($oneads->getVar('published'), $dateformat), 'category' => '', 'author' => XoopsUser::getUnameFromId($oneads->getVar('uid')), 'title' => $title, 'link' => "<a href='" . XOOPS_URL . '/modules/catads/adsitem.php?ads_id=' . $oneads->getVar('ads_id') . "'>" . $title . '</a>'); unset($a_item); } } return $block; }
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; }
function b_mp_new_show($options) { global $xoopsDB, $xoopsUser, $xoopsModule, $HTTP_SERVER_VARS; $module_handler =& xoops_gethandler('module'); $newbb = $module_handler->getByDirname('mpmanager'); if (!isset($xoopsModuleConfig)) { $config_handler =& xoops_gethandler('config'); $xoopsModuleConfig =& $config_handler->getConfigsByCat(0, $newbb->getVar('mid')); } if (is_object($xoopsUser)) { $uid = $xoopsUser->getVar('uid'); $uname = $xoopsUser->getVar('uname'); } else { $uid = 0; $uname = ''; } $block = array(); $news_messages = 0; $old_messages = 0; $myts =& MyTextSanitizer::getInstance(); $mp = array(); if (!is_object($xoopsUser)) { $block['lang_none'] = _MP_BL_YOUDONTHAVE; } else { $pm_handler =& xoops_gethandler('priv_msgs'); $criteria = new CriteriaCompo(); $criteria->add(new Criteria('to_userid', $xoopsUser->getVar('uid'))); $criteria->add(new Criteria('cat_msg', 1)); $criteria->setLimit($options[0]); $criteria->setSort("msg_time"); $criteria->setOrder("DESC"); $pm_arr =& $pm_handler->getObjects($criteria); $total_messages = count($pm_arr); $block['total'] = $total_messages; if ($total_messages == 0) { $block['lang_none'] = _MP_BL_YOUDONTHAVE; } else { $block['disp_mode'] = $options[2]; } foreach (array_keys($pm_arr) as $i) { if ($pm_arr[$i]->getVar('read_msg') == 1) { $mp['list'] = "<li>"; $mp['img'] = "<a href='" . XOOPS_URL . "/modules/mpmanager/viewbox.php?op=view&searchmsg=" . $pm_arr[$i]->getVar('msg_id') . "#" . $pm_arr[$i]->getVar('msg_id') . "'><img src='" . XOOPS_URL . "/modules/mpmanager/images/lus.png' width='20px' height='20px' alt='Lu' /></a>"; $old_messages++; } else { $mp['img'] = "<a href='" . XOOPS_URL . "/modules/mpmanager/viewbox.php?op=view&searchmsg=" . $pm_arr[$i]->getVar('msg_id') . "#" . $pm_arr[$i]->getVar('msg_id') . "'><img src='" . XOOPS_URL . "/modules/mpmanager/images/new.png' width='20px' height='20px' alt='Non Lu' /></a>"; $mp['list'] = '<li style="color: ' . $xoopsModuleConfig["cssbtext"] . ';>'; $news_messages++; } $postername = XoopsUser::getUnameFromId($pm_arr[$i]->getVar("from_userid")); // no need to show deleted users if ($postername) { $mp['from'] = "<a href=" . XOOPS_URL . "/userinfo.php?uid=" . $pm_arr[$i]->getVar("from_userid") . ">" . $postername . "</a>"; } else { $mp['from'] = $xoopsConfig['anonymous']; } if ($options[2] == 1) { $mp['date'] = formatTimestamp($pm_arr[$i]->getVar("msg_time"), "s"); } else { $mp['date'] = formatTimestamp($pm_arr[$i]->getVar("msg_time")); } if (strlen($pm_arr[$i]->getVar("subject")) >= $options[1]) { $mp['subject'] = "<a href='" . XOOPS_URL . "/modules/mpmanager/viewbox.php?op=view&searchmsg=" . $pm_arr[$i]->getVar('msg_id') . "#" . $pm_arr[$i]->getVar('msg_id') . "'>" . $myts->displayTarea(substr($pm_arr[$i]->getVar("subject"), 0, $options[1] - 1)) . "...</a>"; } else { $mp['subject'] = "<a href='" . XOOPS_URL . "/modules/mpmanager/viewbox.php?op=view&searchmsg=" . $pm_arr[$i]->getVar('msg_id') . "#" . $pm_arr[$i]->getVar('msg_id') . "'>" . $pm_arr[$i]->getVar("subject") . "</a>"; } if ($options[2] == 2) { $pm_handler =& xoops_gethandler('priv_msgs'); $newcriteria = new CriteriaCompo(); $newcriteria->add(new Criteria('to_userid', $xoopsUser->getVar('uid'))); $newcriteria->add(new Criteria('cat_msg', 1)); $newcriteria->add(new Criteria('read_msg', 0)); $block['news'] =& $pm_handler->getCount($newcriteria); $readcriteria = new CriteriaCompo(); $readcriteria->add(new Criteria('to_userid', $xoopsUser->getVar('uid'))); $readcriteria->add(new Criteria('cat_msg', 1)); $readcriteria->add(new Criteria('read_msg', 1)); $block['read'] =& $pm_handler->getCount($readcriteria); $allcriteria = new CriteriaCompo(); $allcriteria->add(new Criteria('to_userid', $xoopsUser->getVar('uid'))); $allcriteria->add(new Criteria('cat_msg', 1)); $block['all'] =& $pm_handler->getCount($allcriteria); return $block; } $block['manager'][] = $mp; } } return $block; }
printf(_SR_SHOWING, $start + 1, $start + $count); echo "<h5>" . $myts->makeTboxData4Show($module->getVar('name')) . "</h5>"; for ($i = 0; $i < $count; $i++) { if (isset($results[$i]['image']) && $results[$i]['image'] != '') { echo "<img src='modules/" . $module->getVar('dirname') . "/" . $results[$i]['image'] . "' alt='" . $myts->makeTboxData4Show($module->getVar('name')) . "' /> "; } else { echo "<img src='images/icons/posticon2.gif' alt='" . $myts->makeTboxData4Show($module->name()) . "' width='26' height='26' /> "; } if (!preg_match("/^http[s]*:\\/\\//i", $results[$i]['link'])) { $results[$i]['link'] = "modules/" . $module->getVar('dirname') . "/" . $results[$i]['link']; } echo "<b><a href='" . $results[$i]['link'] . "'>" . $myts->makeTboxData4Show($results[$i]['title']) . "</a></b><br />\n"; echo "<small>"; $results[$i]['uid'] = intval($results[$i]['uid']); if (!empty($results[$i]['uid'])) { $uname = XoopsUser::getUnameFromId($results[$i]['uid']); echo " <a href='" . XOOPS_URL . "/userinfo.php?uid=" . $results[$i]['uid'] . "'>" . $uname . "</a>\n"; } echo $results[$i]['time'] ? " (" . formatTimestamp(intval($results[$i]['time'])) . ")" : ""; echo "</small><br />\n"; } echo ' <table> <tr> '; $search_url = XOOPS_URL . '/search.php?query=' . urlencode(stripslashes(implode(' ', $queries))); $search_url .= "&mid={$mid}&action={$action}&andor={$andor}"; if ($action == 'showallbyuser') { $search_url .= "&uid={$uid}"; } if ($start > 0) {
} else { $com_mode = $xoopsConfig['com_mode']; } } if (!isset($_GET['com_order'])) { if (is_object($xoopsUser)) { $com_order = $xoopsUser->getVar('uorder'); } else { $com_order = $xoopsConfig['com_order']; } } else { $com_order = intval($_GET['com_order']); } $comment_handler =& xoops_gethandler('comment'); $comment =& $comment_handler->get($com_id); $r_name = XoopsUser::getUnameFromId($comment->getVar('com_uid')); $r_text = _CM_POSTER . ': <b>' . $r_name . '</b> ' . _CM_POSTED . ': <b>' . formatTimestamp($comment->getVar('com_created')) . '</b><br /><br />' . $comment->getVar('com_text'); $com_title = $comment->getVar('com_title', 'E'); if (!preg_match("/^re:/i", $com_title)) { $com_title = "Re: " . xoops_substr($com_title, 0, 56); } $com_pid = $com_id; $com_text = ''; $com_id = 0; $dosmiley = 1; $dohtml = 0; $doxcode = 1; $dobr = 1; $doimage = 1; $com_icon = ''; $com_rootid = $comment->getVar('com_rootid');
$accesserror = 1; } } elseif ($forumdata['forum_access'] == 1 && !$xoopsUser) { $accesserror = 1; } if ($accesserror == 1) { redirect_header("viewtopic.php?topic_id={$topic_id}&post_id={$post_id}&order={$order}&viewmode={$viewmode}&pid={$pid}&forum={$forum}", 2, _MD_NORIGHTTOPOST); exit; } } include XOOPS_ROOT_PATH . '/header.php'; include_once 'class/class.forumposts.php'; $forumpost = new ForumPosts($post_id); $r_message = $forumpost->text(); $r_date = formatTimestamp($forumpost->posttime()); $r_name = $forumpost->uid() != 0 ? XoopsUser::getUnameFromId($forumpost->uid()) : $xoopsConfig['anonymous']; $r_content = _MD_BY . " " . $r_name . " " . _MD_ON . " " . $r_date . "<br /><br />"; $r_content .= $r_message; $r_subject = $forumpost->subject(); if (!preg_match("/^Re:/i", $r_subject)) { $subject = 'Re: ' . $myts->htmlSpecialChars($r_subject); } else { $subject = $myts->htmlSpecialChars($r_subject); } $q_message = $forumpost->text("Quotes"); $hidden = "[quote]\n"; $hidden .= sprintf(_MD_USERWROTE, $r_name); $hidden .= "\n" . $q_message . "[/quote]"; $message = ""; themecenterposts($r_subject, $r_content); echo "<br />";
// 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
function edit_eventdata(&$data) { global $xoopsModuleConfig, $xoopsUser; $myts =& MyTextSanitizer::getInstance(); $str = $pat = array(); $pat[] = '{X_DATE}'; $str[] = $data['ldate'] = empty($data['exdate']) ? $data['edate'] : $data['exdate']; if (isset($data['closetime'])) { $data['closedate'] = $data['ldate'] - $data['closetime']; $data['dispclose'] = eventdate($data['closedate'], _MD_TIME_FMT); } $data['date'] = eventdate($data['ldate']); $pat[] = '{X_TIME}'; $str[] = $data['time'] = eventdate($data['ldate'], _MD_STIME_FMT); $post = isset($data['cdate']) ? $data['cdate'] : time(); $data['postdate'] = formatTimestamp($post, _MD_POSTED_FMT); $data['uname'] = isset($data['uid']) ? XoopsUser::getUnameFromId($data['uid']) : $xoopsUser->getVar('uname'); $data['hits'] = sprintf(_MD_REFER, $data['counter']); $br = 0; $html = 1; switch ($data['style']) { case 2: $html = 0; case 1: $br = 1; } $data['disp_summary'] = empty($data['summary']) ? '' : str_replace($pat, $str, xss_filter($myts->displayTarea($data['summary'], $html, 0, 1, 1, $br))); $data['disp_body'] = empty($data['body']) ? '' : str_replace($pat, $str, xss_filter($myts->displayTarea($data['body'], $html, 0, 1, 1, $br))); $data['title'] = $myts->htmlSpecialChars($data['title']); // fill of seat if (!empty($data['persons'])) { $data['reserv_num'] = sprintf(_MD_RESERV_NUM, $data['persons']); $data['reserv_reg'] = sprintf(_MD_RESERV_REG, $data['reserved']); $marker = preg_split('/,|[\\r\\n]+/', $xoopsModuleConfig['maker_set']); $fill = $data['fill'] = intval($data['reserved'] / $data['persons'] * 100); if ($data['closedate'] < time()) { $fill = -1; } while (list($k, $v) = array_splice($marker, 0, 2)) { if ($fill < $k) { $data['fill_mark'] = $v; break; } } } $catlist = get_eguide_category(); if (isset($data['topicid'])) { $cid = $data['topicid']; if (isset($catlist[$cid])) { $data['catid'] = $cid; $data['catname'] = $catlist[$cid]['name']; $data['catimg'] = $catlist[$cid]['image']; $data['catgory'] = $catlist[$cid]; } } return $data; }
function uname() { global $xoopsUser; return XoopsUser::getUnameFromId($this->uid); }
function modLink() { global $xoopsDB, $myts, $eh, $mytree, $xoopsConfig; $linkimg_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . "/modules/mylinks/images/shots/"); $lid = $_GET['lid']; xoops_cp_header(); echo "<h4>" . _MD_WEBLINKSCONF . "</h4>"; echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr class=\"odd\"><td>"; $result = $xoopsDB->query("select cid, title, url, logourl from " . $xoopsDB->prefix("mylinks_links") . " where lid={$lid}") or $eh->show("0013"); echo "<h4>" . _MD_MODLINK . "</h4><br />"; list($cid, $title, $url, $logourl) = $xoopsDB->fetchRow($result); $title = $myts->makeTboxData4Edit($title); $url = $myts->makeTboxData4Edit($url); // $url = urldecode($url); $logourl = $myts->makeTboxData4Edit($logourl); // $logourl = urldecode($logourl); $result2 = $xoopsDB->query("select description from " . $xoopsDB->prefix("mylinks_text") . " where lid={$lid}"); list($description) = $xoopsDB->fetchRow($result2); $GLOBALS['description'] = $myts->makeTareaData4Edit($description); echo "<table>"; echo "<form method='post' action='index.php'>"; echo "<tr><td>" . _MD_LINKID . "</td><td><b>{$lid}</b></td></tr>"; echo "<tr><td>" . _MD_SITETITLE . "</td><td><input type='text' name='title' value=\"{$title}\" size='50' maxlength='100' /></td></tr>\n"; echo "<tr><td>" . _MD_SITEURL . "</td><td><input type='text' name='url' value=\"{$url}\" size='50' maxlength='250' /></td></tr>\n"; echo "<tr><td valign=\"top\">" . _MD_DESCRIPTIONC . "</td><td>"; xoopsCodeTarea("description", 60, 8); xoopsSmilies("description"); //echo "<textarea name=description cols=60 rows=5>$description</textarea>"; echo "</td></tr>"; echo "<tr><td>" . _MD_CATEGORYC . "</td><td>"; $mytree->makeMySelBox("title", "title", $cid); echo "</td></tr>\n"; echo "<tr><td>" . _MD_SHOTIMAGE . "</td><td>"; //echo "<input type=text name=logourl value=\"$logourl\" size=\"50\" maxlength=\"60\"></input> echo "<select size='1' name='logourl'>"; echo "<option value=' '>------</option>"; foreach ($linkimg_array as $image) { if ($image == $logourl) { $opt_selected = "selected='selected'"; } else { $opt_selected = ""; } echo "<option value='" . $image . "' {$opt_selected}>" . $image . "</option>"; } echo "</select>"; echo "</td></tr>\n"; $shotdir = "<b>" . XOOPS_URL . "/modules/mylinks/images/shots/</b>"; echo "<tr><td></td><td>"; printf(_MD_SHOTMUST, $shotdir); echo "</td></tr>\n"; echo "</table>"; echo "<br /><br /><input type='hidden' name='lid' value='{$lid}' />\n"; echo "<input type='hidden' name='op' value='modLinkS' /><input type='submit' value='" . _MD_MODIFY . "' />"; echo "</form>\n"; echo "<table><tr><td>\n"; echo myTextForm("index.php?op=delLink&lid=" . $lid, _MD_DELETE); echo "</td><td>\n"; echo myTextForm("index.php?op=linksConfigMenu", _MD_CANCEL); echo "</td></tr></table>\n"; echo "<hr />"; $result5 = $xoopsDB->query("SELECT count(*) FROM " . $xoopsDB->prefix("mylinks_votedata") . " WHERE lid = {$lid}"); list($totalvotes) = $xoopsDB->fetchRow($result5); echo "<table width='100%'>\n"; echo "<tr><td colspan='7'><b>"; printf(_MD_TOTALVOTES, $totalvotes); echo "</b><br /><br /></td></tr>\n"; // Show Registered Users Votes $result5 = $xoopsDB->query("SELECT ratingid, ratinguser, rating, ratinghostname, ratingtimestamp FROM " . $xoopsDB->prefix("mylinks_votedata") . " WHERE lid = {$lid} AND ratinguser >0 ORDER BY ratingtimestamp DESC"); $votes = $xoopsDB->getRowsNum($result5); echo "<tr><td colspan='7'><br /><br /><b>"; printf(_MD_USERTOTALVOTES, $votes); echo "</b><br /><br /></td></tr>\n"; echo "<tr><td><b>" . _MD_USER . " </b></td><td><b>" . _MD_IP . " </b></td><td><b>" . _MD_RATING . " </b></td><td><b>" . _MD_USERAVG . " </b></td><td><b>" . _MD_TOTALRATE . " </b></td><td><b>" . _MD_DATE . " </b></td><td align=\"center\"><b>" . _MD_DELETE . "</b></td></tr>\n"; if ($votes == 0) { echo "<tr><td align=\"center\" colspan=\"7\">" . _MD_NOREGVOTES . "<br /></td></tr>\n"; } $x = 0; $colorswitch = "dddddd"; while (list($ratingid, $ratinguser, $rating, $ratinghostname, $ratingtimestamp) = $xoopsDB->fetchRow($result5)) { // $ratingtimestamp = formatTimestamp($ratingtimestamp); //Individual user information $result2 = $xoopsDB->query("SELECT rating FROM " . $xoopsDB->prefix("mylinks_votedata") . " WHERE ratinguser = '******'"); $uservotes = $xoopsDB->getRowsNum($result2); $useravgrating = 0; while (list($rating2) = $xoopsDB->fetchRow($result2)) { $useravgrating = $useravgrating + $rating2; } $useravgrating = $useravgrating / $uservotes; $useravgrating = number_format($useravgrating, 1); $ratingusername = XoopsUser::getUnameFromId($ratinguser); echo "<tr><td bgcolor=\"" . $colorswitch . "\">" . $ratingusername . "</td><td bgcolor=\"{$colorswitch}\">" . $ratinghostname . "</td><td bgcolor=\"{$colorswitch}\">{$rating}</td><td bgcolor=\"{$colorswitch}\">" . $useravgrating . "</td><td bgcolor=\"{$colorswitch}\">" . $uservotes . "</td><td bgcolor=\"{$colorswitch}\">" . $ratingtimestamp . "</td><td bgcolor=\"{$colorswitch}\" align=\"center\"><b>" . myTextForm("index.php?op=delVote&lid={$lid}&rid={$ratingid}", "X") . "</b></td></tr>\n"; $x++; if ($colorswitch == "dddddd") { $colorswitch = "ffffff"; } else { $colorswitch = "dddddd"; } } // Show Unregistered Users Votes $result5 = $xoopsDB->query("SELECT ratingid, rating, ratinghostname, ratingtimestamp FROM " . $xoopsDB->prefix("mylinks_votedata") . " WHERE lid = {$lid} AND ratinguser = 0 ORDER BY ratingtimestamp DESC"); $votes = $xoopsDB->getRowsNum($result5); echo "<tr><td colspan='7'><b><br /><br />"; printf(_MD_ANONTOTALVOTES, $votes); echo "</b><br /><br /></td></tr>\n"; echo "<tr><td colspan='2'><b>" . _MD_IP . " </b></td><td colspan='3'><b>" . _MD_RATING . " </b></td><td><b>" . _MD_DATE . " </b></b></td><td align=\"center\"><b>" . _MD_DELETE . "</b></td><br /></tr>"; if ($votes == 0) { echo "<tr><td colspan=\"7\" align=\"center\">" . _MD_NOUNREGVOTES . "<br /></td></tr>"; } $x = 0; $colorswitch = "dddddd"; while (list($ratingid, $rating, $ratinghostname, $ratingtimestamp) = $xoopsDB->fetchRow($result5)) { $formatted_date = formatTimestamp($ratingtimestamp); echo "<td colspan=\"2\" bgcolor=\"{$colorswitch}\">{$ratinghostname}</td><td colspan=\"3\" bgcolor=\"{$colorswitch}\">{$rating}</td><td bgcolor=\"{$colorswitch}\">{$formatted_date}</td><td bgcolor=\"{$colorswitch}\" aling=\"center\"><b>" . myTextForm("index.php?op=delVote&lid={$lid}&rid={$ratingid}", "X") . "</b></td></tr>"; $x++; if ($colorswitch == "dddddd") { $colorswitch = "ffffff"; } else { $colorswitch = "dddddd"; } } echo "<tr><td colspan=\"6\"> <br /></td></tr>\n"; echo "</table>\n"; echo "</td></tr></table>"; xoops_cp_footer(); }
function b_bulletin_new_show($options) { $mydirname = empty($options[0]) ? basename(dirname(dirname(__FILE__))) : $options[0]; if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) { die('Invalid mydirname'); } $selected_order = empty($options[1]) || !in_array($options[1], b_bulletin_new_allowed_order()) ? 'published DESC' : $options[1]; $display_count = empty($options[2]) ? 0 : intval($options[2]); //Number display for each category $Length_title = empty($options[3]) ? 255 : intval($options[3]); //Length of the title $show_body = empty($options[4]) ? 0 : intval($options[4]); //Number of articles showing body for each category if (!isset($options[5])) { $options[5] = 0; //(0=show all for d3pipes) } $categories = empty($options[5]) ? 0 : array_map('intval', explode(',', $options[5])); //(0=show all) require dirname(dirname(__FILE__)) . '/include/configs.inc.php'; require_once dirname(dirname(__FILE__)) . '/class/bulletingp.php'; $block = array(); //ver3.0 can_read access $gperm =& BulletinGP::getInstance($mydirname); $can_read_topic_ids = $gperm->makeOnTopics('can_read'); if (empty($can_read_topic_ids)) { return false; } $sql = "SELECT s.*, t.topic_pid, t.topic_imgurl, t.topic_title, t.topic_created, t.topic_modified"; $sql .= ' FROM ' . $xoopsDB->prefix($mydirname . '_stories') . ' s, ' . $xoopsDB->prefix($mydirname . '_topics') . ' t'; $sql .= ' WHERE s.published < ' . time() . ' AND s.published > 0 AND (s.expired = 0 OR s.expired > ' . time() . ') AND s.topicid = t.topic_id AND s.block = 1'; if (!$gperm->group_perm(2)) { $sql .= " AND s.type > 0"; } if (!empty($categories)) { $sql .= ' AND s.topicid IN (' . implode(',', $categories) . ')'; } $sql .= ' AND s.topicid IN (' . implode(',', $can_read_topic_ids) . ')'; $sql .= ' ORDER BY ' . $selected_order; // if ($show_body > 0) { //ver2.0$sql = sprintf('SELECT s.storyid, s.topicid, s.title, s.hometext, s.bodytext, s.published, s.expired, s.counter, s.comments, s.uid, s.topicimg, s.html, s.smiley, s.br, s.xcode, t.topic_title, t. topic_imgurl FROM %s s, %s t WHERE s.type > 0 AND s.published < %u AND s.published > 0 AND (s.expired = 0 OR s.expired > %3$u) AND s.topicid = t.topic_id AND s.block = 1 ORDER BY %s', $table_stories, $table_topics, time(), $selected_order); $result = $xoopsDB->query($sql, $show_body, 0); while ($myrow = $xoopsDB->fetchArray($result)) { $fullstory = array(); // GIJ $fullstory['id'] = $myrow['storyid']; $fullstory['posttime'] = formatTimestamp($myrow['published'], $bulletin_date_format); $fullstory['date'] = formatTimestamp($myrow['published'], $bulletin_date_format); $fullstory['published'] = intval($myrow['published']); $fullstory['topicid'] = $myrow['topicid']; $fullstory['topic'] = $myts->makeTboxData4Show($myrow['topic_title']); $fullstory['title'] = $myts->makeTboxData4Show($myrow['title']); $fullstory['text'] = $myts->displayTarea($myrow['hometext'], $myrow['html'], $myrow['smiley'], $myrow['xcode'], 1, $myrow['br']); $fullstory['hits'] = $myrow['counter']; $fullstory['title_link'] = true; // $fullstory['uid'] = $myrow['uid']; $fullstory['uname'] = XoopsUser::getUnameFromId($myrow['uid']); $fullstory['realname'] = XoopsUser::getUnameFromId($myrow['uid'], 1); $fullstory['morelink'] = ''; // if (myStrlenText($myrow['bodytext']) > 1) { $fullstory['bytes'] = sprintf(_MB_BULLETIN_BYTESMORE, myStrlenText($myrow['bodytext'])); $fullstory['readmore'] = true; } else { $fullstory['bytes'] = 0; $fullstory['readmore'] = false; } // $ccount = $myrow['comments']; if ($ccount == 0) { $fullstory['comentstotal'] = _MB_BULLETIN_COMMENTS; } elseif ($ccount == 1) { $fullstory['comentstotal'] = _MB_BULLETIN_ONECOMMENT; } else { $fullstory['comentstotal'] = sprintf(_MB_BULLETIN_NUMCOMMENTS, $ccount); } // $fullstory['adminlink'] = 0; // if ($myrow['topicimg']) { $fullstory['topic_url'] = makeTopicImgURL($bulletin_topicon_path, $myrow['topic_imgurl']); $fullstory['align'] = topicImgAlign($myrow['topicimg']); } //ver3.0 $topic_perm = $gperm->get_viewtopic_perm_of_current_user($myrow['topicid'], $myrow['uid']); $fullstory = array_merge($fullstory, $topic_perm); $fullstory['type'] = $myrow['type']; $fullstory['raw_data'] = $myrow; $block['fullstories'][] = $fullstory; } } if ($display_count - $show_body > 0) { //ver2.0$sql = sprintf('SELECT storyid, title, published, expired, counter, uid FROM %s WHERE type > 0 AND published < %u AND published > 0 AND (expired = 0 OR expired > %2$u) AND block = 1 ORDER BY %s', $table_stories, time(), $selected_order); $result = $xoopsDB->query($sql, $display_count - $show_body, $show_body); while ($myrow = $xoopsDB->fetchArray($result)) { $story = array(); // $story['title'] = $myts->makeTboxData4Show(xoops_substr($myrow['title'], 0, $Length_title + 3, '...')); $story['id'] = $myrow['storyid']; $story['date'] = formatTimestamp($myrow['published'], $bulletin_date_format); $story['published'] = intval($myrow['published']); $story['hits'] = $myrow['counter']; $story['uid'] = $myrow['uid']; $story['uname'] = XoopsUser::getUnameFromId($myrow['uid']); $story['realname'] = XoopsUser::getUnameFromId($myrow['uid'], 1); //ver3.0 $topic_perm = $gperm->get_viewtopic_perm_of_current_user($myrow['topicid'], $myrow['uid']); $story = array_merge($story, $topic_perm); $story['type'] = $myrow['type']; $story['raw_data'] = $myrow; $block['stories'][] = $story; } } if (!empty($block)) { $block['mod_config'] = @$bulletin_configs; $block['lang_postedby'] = _POSTEDBY; $block['lang_on'] = _ON; $block['lang_reads'] = _READS; $block['lang_readmore'] = _MB_BULLETIN_READMORE; $block['type'] = $selected_order; $block['mydirurl'] = XOOPS_URL . '/modules/' . $mydirname; $block['mydirname'] = $mydirname; } return $block; }
$answer = $myts->makeTareaData4Save($HTTP_POST_VARS['answer']); $summary = $myts->makeTareaData4Save($HTTP_POST_VARS['summary']); $uid = $xoopsUser->uid(); $datesub = time(); $submit = 0; $result = $xoopsDB->queryF("INSERT INTO " . $xoopsDB->prefix("faqtopics") . " (catID, question, answer, summary, uid, datesub, submit) VALUES ('{$cat}', '{$question}', '{$answer}', '{$summary}', '{$uid}', '{$datesub}', '{$submit}')"); if ($result) { $xoopsMailer =& getMailer(); $xoopsMailer->useMail(); $xoopsMailer->setToEmails($xoopsConfig['adminmail']); $xoopsMailer->setFromEmail($xoopsConfig['adminmail']); $xoopsMailer->setFromName($xoopsConfig['sitename']); $xoopsMailer->setSubject(_MD_NOTIFYSBJCT); $body = _MD_NOTIFYMSG; $body .= "\n\n" . _MD_TITLE . ": " . $question; $body .= "\n" . _MD_POSTEDBY . ": " . XoopsUser::getUnameFromId($uid); $body .= "\n" . _MD_DATE . ": " . formatTimestamp(time(), 'm', $xoopsConfig['default_TZ']); $body .= "\n\n" . XOOPS_URL . '/modules/wffaq/admin/submissions.php?op=allow&t=$topicID&c=$catID'; $xoopsMailer->setBody($body); $xoopsMailer->send(); } else { redirect_header("submit.php", 2, _MD_ERRORSAVINGDB); } redirect_header("index.php", 2, _MD_SUBMITUSER); exit; break; case 'form': default: include XOOPS_ROOT_PATH . '/header.php'; $result = $xoopsDB->query("SELECT catID, name FROM " . $xoopsDB->prefix("faqcategories") . " ORDER BY name"); $options = "";
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(_PM_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(_PM_TO, XoopsUser::getUnameFromId($_POST["to_userid"]))); $form->addElement(new Xoops\Form\Hidden('to_userid', $_POST["to_userid"])); $subject = $myts->htmlSpecialChars($myts->stripSlashesGPC($_POST['subject'])); $message = $myts->htmlSpecialChars($myts->stripSlashesGPC($_POST['message'])); } else { if ($send2 == 1) { $form->addElement(new Xoops\Form\Label(_PM_TO, XoopsUser::getUnameFromId($to_userid, false))); $form->addElement(new Xoops\Form\Hidden('to_userid', $to_userid)); } else { $form->addElement(new Xoops\Form\SelectUser(_PM_TO, 'to_userid')); } $subject = ""; $message = ""; } } $form->addElement(new Xoops\Form\Text(_PM_SUBJECTC, 'subject', 4, 100, $subject), true); $icons = new Xoops\Form\Radio(XoopsLocale::MESSAGE_ICON, 'msg_image', '', true); $subject_icons = XoopsLists::getSubjectsList(); foreach (array_keys($subject_icons) as $i) { $icons->addOption($i, "<img src='" . $xoops->url("images/subject/") . $i . "' alt='" . $i . "' />"); } $form->addElement($icons, false);
switch ($op) { case 'list': default: // Define Breadcrumb and tips $xoBreadCrumb->addLink(_AM_SYSTEM_MAILUSERS_MANAGER, system_adminVersion('mailusers', 'adminpath')); $xoBreadCrumb->addHelp(system_adminVersion('mailusers', 'help')); $xoBreadCrumb->render(); $display_criteria = 1; $form = new XoopsThemeForm(_AM_SYSTEM_MAILUSERS_LIST, 'mailusers', 'admin.php?fct=mailusers', 'post', true); if (!empty($_POST['memberslist_id'])) { $user_count = count($_POST['memberslist_id']); $display_names = ''; for ($i = 0; $i < $user_count; ++$i) { $uid_hidden = new XoopsFormHidden('mail_to_user[]', $_POST['memberslist_id'][$i]); $form->addElement($uid_hidden); $display_names .= "<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $_POST['memberslist_id'][$i] . "' rel='external'>" . XoopsUser::getUnameFromId($_POST['memberslist_id'][$i]) . '</a>, '; unset($uid_hidden); } $users_label = new XoopsFormLabel(_AM_SYSTEM_MAILUSERS_SENDTOUSERS2, substr($display_names, 0, -2)); $form->addElement($users_label); $display_criteria = 0; } if (!empty($display_criteria)) { $selected_groups = array(); $group_select = new XoopsFormSelectGroup('<div class="bold spacer">' . _AM_SYSTEM_MAILUSERS_GROUPIS . '<span class="bold green">*</span></div>', 'mail_to_group', false, $selected_groups, 5, true); $lastlog_min = new XoopsFormTextDateSelect(_AM_SYSTEM_MAILUSERS_LASTLOGMIN . '<span class="bold green">*</span>', 'mail_lastlog_min'); $lastlog_min->setValue(''); $lastlog_max = new XoopsFormTextDateSelect(_AM_SYSTEM_MAILUSERS_LASTLOGMAX . '<span class="bold green">*</span>', 'mail_lastlog_max'); $lastlog_max->setValue(''); $date = new XoopsFormElementTray('<div class="bold spacer">' . _AM_SYSTEM_MAILUSERS_DATE . '</div>', ''); $date->addElement($lastlog_min);
function showTreeItem($order, $mode, $color_num) { global $HTTP_SERVER_VARS; if ($color_num == 1) { $bg = 'even'; } else { $bg = 'odd'; } $prefix = str_replace(".", " ", $this->getVar("prefix")); $date = formatTimestamp($this->getVar("date"), "m"); if ($this->getVar("icon") != "") { $icon = "subject/" . $this->getVar("icon", "E"); } else { $icon = "icons/no_posticon.gif"; } echo "<tr class='{$bg}' align='left'><td>" . $prefix . "<img src='" . XOOPS_URL . "/images/" . $icon . "'> <a href='" . $HTTP_SERVER_VARS['PHP_SELF'] . "?item_id=" . $this->getVar("item_id") . "&comment_id=" . $this->getVar("comment_id") . "&mode=" . $mode . "&order=" . $order . "#" . $this->getVar("comment_id") . "'>" . $this->getVar("subject") . "</a></td><td><a href='" . XOOPS_URL . "/userinfo.php?uid=" . $this->getVar("user_id") . "'>" . XoopsUser::getUnameFromId($this->getVar("user_id")) . "</a></td><td>" . $date . "</td></tr>"; }
} if ($timgwidth > 0 && $timgheight > 0) { $setsize = "width=" . $timgwidth . " height=" . $timgheight; } else { $setsize = ""; } $show = str_replace("[image]", "<a href=\"" . $link_url . "\"" . $link_target . "><img src=\"" . $imgpath . "\" border=1 alt=\"{$tname}\" " . $setsize . "></a>", $show); $show = str_replace("[image left]", "<a href=\"" . $link_url . "\"" . $link_target . "><img src=\"" . $imgpath . "\" border=1 alt=\"{$tname}\" " . $setsize . " align=\"left\"></a>", $show); $show = str_replace("[image right]", "<a href=\"" . $link_url . "\"" . $link_target . "><img src=\"" . $imgpath . "\" border=1 alt=\"{$tname}\" " . $setsize . " align=\"right\"></a>", $show); } else { $show = str_replace("[image]", "", $show); } $newupdate = newgraphic($date, $status); $pop = popgraphic($hits, $popular); $show = str_replace("[title]", "<a href=\"" . $link_url . "\"" . $link_target . ">" . $tname . "</a>" . $newupdate . "" . $pop . "", $show); if ($tauthor != XoopsUser::getUnameFromId($submitter)) { $showt = str_replace("[author]", sprintf(_MD_WRITTENBY, $tauthor), $show); } else { $show = str_replace("[author]", sprintf(_MD_WRITTENBY, "<a href=\"" . XOOPS_URL . "/userinfo.php?uid=" . $submitter . "\">" . $tauthor . "</a>"), $show); } $show = str_replace("[author]", sprintf(_MD_AUTHOR, $tauthor), $show); $date = formatTimestamp($date, "m"); $show = str_replace("[date]", sprintf(_MD_CREATEDATE, $date), $show); $show = str_replace("[hits]", "(" . sprintf(_MD_TUTORIALREAD, $hits) . ")", $show); if ($rating != "0" || $rating != "0.0") { if ($votes == 1) { $votestring = _MD_ONEVOTE; } else { $votestring = sprintf(_MD_NUMVOTES, $votes); } $show = str_replace("[rating]", _MD_RATINGC . ": {$rating}", $show);
function modDownload() { global $xoopsDB, $myts, $eh, $mytree; $downimg_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . "/modules/mydownloads/images/shots/"); $lid = $_GET['lid']; xoops_cp_header(); echo "<h4>" . _MD_DLCONF . "</h4>"; echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr class=\"odd\"><td>"; $result = $xoopsDB->query("SELECT cid, title, url, homepage, version, size, platform, logourl FROM " . $xoopsDB->prefix("mydownloads_downloads") . " WHERE lid={$lid}") or $eh->show("0013"); echo "<h4>" . _MD_MODDL . "</h4><br />"; list($cid, $title, $url, $homepage, $version, $size, $platform, $logourl) = $xoopsDB->fetchRow($result); $title = $myts->makeTboxData4Edit($title); $url = $myts->makeTboxData4Edit($url); $homepage = $myts->makeTboxData4Edit($homepage); $version = $myts->makeTboxData4Edit($version); $size = $myts->makeTboxData4Edit($size); $platform = $myts->makeTboxData4Edit($platform); $logourl = $myts->makeTboxData4Edit($logourl); $result2 = $xoopsDB->query("SELECT description FROM " . $xoopsDB->prefix("mydownloads_text") . " WHERE lid={$lid}"); list($description) = $xoopsDB->fetchRow($result2); $GLOBALS['description'] = $myts->makeTareaData4Edit($description); echo "<table>"; echo "<form method='post' action='index.php'>"; echo "<tr><td>" . _MD_FILEID . "</td><td><b>{$lid}</b></td></tr>"; echo "<tr><td>" . _MD_FILETITLE . "</td><td><input type='text' name='title' value='{$title}' size='50' maxlength='100' /></input></td></tr>\n"; echo "<tr><td>" . _MD_DLURL . "</td><td><input type='text' name='url' value='{$url}' size='50' maxlength='250' /></td></tr>\n"; echo "<tr><td>" . _MD_HOMEPAGEC . "</td><td><input type='text' name='homepage' value='{$homepage}' size='50' maxlength='100' /></td></tr>\n"; echo "<tr><td>" . _MD_VERSIONC . "</td><td><input type='text' name='version' value='{$version}' size='10' maxlength='10' /></td></tr>\n"; echo "<tr><td>" . _MD_FILESIZEC . "</td><td><input type='text' name='size' value='{$size}' size='10' maxlength='100' />" . _MD_BYTES . "</td></tr>\n"; echo "<tr><td>" . _MD_PLATFORMC . "</td><td><input type='text' name='platform' value='{$platform}' size='45' maxlength='60' /></td></tr>\n"; echo "<tr><td valign=\"top\">" . _MD_DESCRIPTIONC . "</td><td>"; xoopsCodeTarea("description", 60, 8); xoopsSmilies("description"); echo "</td></tr>"; echo "<tr><td>" . _MD_CATEGORYC . "</td><td>"; $mytree->makeMySelBox("title", "title", $cid); echo "</td></tr>\n"; echo "<tr><td>" . _MD_SHOTIMAGE . "</td><td>"; //echo "<input type=text name=logourl value=\"$logourl\" size=\"50\" maxlength=\"60\"></input>"; echo "<select size='1' name='logourl'>"; echo "<option value=' '>------</option>"; foreach ($downimg_array as $image) { if ($image == $logourl) { $opt_selected = "selected='selected'"; } else { $opt_selected = ""; } echo "<option value='" . $image . "' {$opt_selected}>" . $image . "</option>"; } echo "</select>"; echo "</td></tr>\n"; echo "<tr><td></td><td>"; $directory = XOOPS_URL . "/modules/mydownloads/images/shots/"; printf(_MD_MUSTBEVALID, $directory); echo "</td></tr>\n"; echo "</table>"; echo "<br /><br /><input type='hidden' name='lid' value='{$lid}' />\n"; echo "<input type='hidden' name='op' value='modDownloadS' /><input type='submit' value='" . _MD_SUBMIT . "' />"; echo "</form>\n"; echo "<table><tr><td>\n"; echo myTextForm("index.php?op=delDownload&lid=" . $lid, _MD_DELETE); echo "</td><td>\n"; echo myTextForm("index.php?op=downloadsConfigMenu", _MD_CANCEL); echo "</td></tr></table>\n"; echo "<hr />"; $result5 = $xoopsDB->query("SELECT COUNT(*) FROM " . $xoopsDB->prefix("mydownloads_votedata") . ""); list($totalvotes) = $xoopsDB->getRowsNum($result5); echo "<table width='100%'>\n"; echo "<tr><td colspan='7'><b>"; printf(_MD_DLRATINGS, $totalvotes); echo "</b><br /><br /></td></tr>\n"; // Show Registered Users Votes $result5 = $xoopsDB->query("SELECT ratingid, ratinguser, rating, ratinghostname, ratingtimestamp FROM " . $xoopsDB->prefix("mydownloads_votedata") . " WHERE lid = {$lid} AND ratinguser != 0 ORDER BY ratingtimestamp DESC"); $votes = $xoopsDB->getRowsNum($result5); echo "<tr><td colspan='7'><br /><br /><b>"; printf(_MD_REGUSERVOTES, $votes); echo "</b><br /><br /></td></tr>\n"; echo "<tr><td><b>" . _MD_USER . " </b></td><td><b>" . _MD_IP . " </b></td><td><b>" . _MD_RATING . " </b></td><td><b>" . _MD_USERAVG . " </b></td><td><b>" . _MD_TOTALRATE . " </b></td><td><b>" . _MD_DATE . " </b></td><td align=\"center\"><b>" . _MD_DELETE . "</b></td></tr>\n"; if ($votes == 0) { echo "<tr><td align=\"center\" colspan=\"7\">" . _MD_NOREGVOTES . "<br /></td></tr>\n"; } $x = 0; $colorswitch = "dddddd"; while (list($ratingid, $ratinguser, $rating, $ratinghostname, $ratingtimestamp) = $xoopsDB->fetchRow($result5)) { $formatted_date = formatTimestamp($ratingtimestamp); //Individual user information $result2 = $xoopsDB->query("SELECT rating FROM " . $xoopsDB->prefix("mydownloads_votedata") . " WHERE ratinguser = {$ratinguser}"); $uservotes = $xoopsDB->getRowsNum($result2); $useravgrating = 0; while (list($rating2) = $xoopsDB->fetchRow($result2)) { $useravgrating = $useravgrating + $rating2; } $useravgrating = $useravgrating / $uservotes; $useravgrating = number_format($useravgrating, 1); $ratinguname = XoopsUser::getUnameFromId($ratinguser); // echo "<tr><td bgcolor=\"$colorswitch\">$ratinguname</td><td bgcolor=\"$colorswitch\">$ratinghostname</td><td bgcolor=\"$colorswitch\">$rating</td><td bgcolor=\"$colorswitch\">$useravgrating</td><td bgcolor=\"$colorswitch\">$uservotes</td><td bgcolor=\"$colorswitch\">$formatted_date</td><td bgcolor=\"$colorswitch\" align=\"center\"><b><a href=index.php?op=delVote&lid=$lid&rid=$ratingid>X</a></b></td></tr>\n"; // echo "<tr><td bgcolor=\"$colorswitch\">$ratinguname</td><td bgcolor=\"$colorswitch\">$ratinghostname</td><td bgcolor=\"$colorswitch\">$rating</td><td bgcolor=\"$colorswitch\">$useravgrating</td><td bgcolor=\"$colorswitch\">$uservotes</td><td bgcolor=\"$colorswitch\">$formatted_date</td><td bgcolor=\"$colorswitch\" align=\"center\">"; echo "<tr><td bgcolor=\"{$colorswitch}\">{$ratinguname}</td><td bgcolor=\"{$colorswitch}\">{$ratinghostname}</td><td bgcolor=\"{$colorswitch}\">{$rating}</td><td bgcolor=\"{$colorswitch}\">{$useravgrating}</td><td bgcolor=\"{$colorswitch}\">{$uservotes}</td><td bgcolor=\"{$colorswitch}\">{$formatted_date}</td><td bgcolor=\"{$colorswitch}\" align=\"center\">"; //echo "<table><tr><td>\n"; echo myTextForm("index.php?op=delVote&lid={$lid}&rid={$ratingid}", "X"); // echo "</td></tr></table>\n"; echo "</td></tr>\n"; $x++; if ($colorswitch == "dddddd") { $colorswitch = "ffffff"; } else { $colorswitch = "dddddd"; } } // Show Unregistered Users Votes $result5 = $xoopsDB->query("SELECT ratingid, rating, ratinghostname, ratingtimestamp FROM " . $xoopsDB->prefix("mydownloads_votedata") . " WHERE lid = {$lid} AND ratinguser = 0 ORDER BY ratingtimestamp DESC"); $votes = $xoopsDB->getRowsNum($result5); echo "<tr><td colspan='7'><b><br /><br />"; printf(_MD_ANONUSERVOTES, $votes); echo "</b><br /><br /></td></tr>\n"; echo "<tr><td colspan='2'><b>" . _MD_IP . " </b></td><td colspan='3'><b>" . _MD_RATING . " </b></td><td><b>" . _MD_DATE . " </b></b></td><td align=\"center\"><b>" . _MD_DELETE . "</b></td><br /></tr>"; if ($votes == 0) { echo "<tr><td colspan=\"7\" align=\"center\">" . _MD_NOUNREGVOTES . "<br /></td></tr>"; } $x = 0; $colorswitch = "dddddd"; while (list($ratingid, $rating, $ratinghostname, $ratingtimestamp) = $xoopsDB->fetchRow($result5)) { $formatted_date = formatTimestamp($ratingtimestamp); // echo "<td colspan=\"2\" bgcolor=\"$colorswitch\">$ratinghostname</td><td colspan=\"3\" bgcolor=\"$colorswitch\">$rating</td><td bgcolor=\"$colorswitch\">$formatted_date</td><td bgcolor=\"$colorswitch\" aling=\"center\"><b><a href=index.php?op=delVote&lid=$lid&rid=$ratingid>X</a></b></td></tr>"; echo "<td colspan=\"2\" bgcolor=\"{$colorswitch}\">{$ratinghostname}</td><td colspan=\"3\" bgcolor=\"{$colorswitch}\">{$rating}</td><td bgcolor=\"{$colorswitch}\">{$formatted_date}</td><td bgcolor=\"{$colorswitch}\" align=\"center\">"; //echo "<table><tr><td>\n"; //align=\"center\" echo myTextForm("index.php?op=delVote&lid={$lid}&rid={$ratingid}", "X"); //echo "</td></tr></table>\n"; echo "</td></tr>"; $x++; if ($colorswitch == "dddddd") { $colorswitch = "ffffff"; } else { $colorswitch = "dddddd"; } } echo "<tr><td colspan=\"6\"> <br /></td></tr>\n"; echo "</table>\n"; echo "</td></tr></table>"; xoops_cp_footer(); }
// check post permission if (empty($can_reply)) { die(_MD_D3FORUM_ERR_REPLYPOST); } // check reply permission if (!$isadminormod && ($post_row['invisible'] || !$post_row['approval'])) { die(_MD_D3FORUM_ERR_REPLYPOST); } // references to post reply $reference_message4html = $myts->displayTarea($post_row['post_text'], $post_row['html'], $post_row['smiley'], $post_row['xcode'], $xoopsModuleConfig['allow_textimg'], $post_row['br'], 0, $post_row['number_entity'], $post_row['special_entity']); $reference_time = intval($post_row['post_time']); if (!empty($post_row['guest_name'])) { $reference_name4html = htmlspecialchars($post_row['guest_name'], ENT_QUOTES); } else { if ($post_row['uid']) { $reference_name4html = XoopsUser::getUnameFromId($post_row['uid']); } else { $reference_name4html = $xoopsModuleConfig['anonymous_name']; } } $reference_subject4html = $myts->makeTboxData4Show($post_row['subject'], $post_row['number_entity'], $post_row['special_entity']); // specific variables for reply $pid = $post_row['post_id']; $post_id = 0; $subject4html = substr($reference_subject4html, 0, 3) == 'Re:' ? $reference_subject4html : 'Re: ' . $reference_subject4html; $message4html = ''; $topic_id = $topic_row['topic_id']; $u2t_marked = intval($topic_row['u2t_marked']); $solved = $isadminormod ? 1 : intval($topic_row['topic_solved']); $invisible = 0; $approval = 1;
function b_d3forum_list_posts_show($options) { global $xoopsUser; $mydirname = empty($options[0]) ? 'd3forum' : $options[0]; $max_posts = empty($options[1]) ? 10 : intval($options[1]); $now_order = empty($options[2]) ? 'time' : trim($options[2]); $categories = empty($options[3]) ? array() : explode(',', $options[3]); $forums = empty($options[5]) ? array() : explode(',', $options[5]); $this_template = empty($options[4]) ? 'db:' . $mydirname . '_block_list_posts.html' : trim($options[4]); if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) { die('Invalid mydirname'); } $db =& Database::getInstance(); $myts =& MyTextSanitizer::getInstance(); $uid = is_object(@$xoopsUser) ? $xoopsUser->getVar('uid') : 0; $module_handler =& xoops_gethandler('module'); $module =& $module_handler->getByDirname($mydirname); $config_handler =& xoops_gethandler('config'); $configs = $config_handler->getConfigList($module->mid()); // naao from // get all forums $sql = "SELECT forum_id, forum_external_link_format FROM " . $db->prefix($mydirname . "_forums"); $frs = $db->query($sql); $d3com = array(); while ($forum_row = $db->fetchArray($frs)) { // d3comment object $temp_forum_id = intval($forum_row['forum_id']); if (!empty($forum_row['forum_external_link_format'])) { $d3com[$temp_forum_id] =& d3forum_b_get_comment_object($mydirname, $forum_row['forum_external_link_format']); } else { $d3com[$temp_forum_id] = false; } } // naao to // order $whr_order = '1'; switch ($now_order) { case 'votes': $odr = 'p.votes_count DESC'; break; case 'points': $odr = 'p.votes_sum DESC'; break; case 'average': $odr = 'p.votes_sum/p.votes_count DESC, p.votes_count DESC'; $whr_order = 'p.votes_count>0'; break; case 'time': default: $odr = 'p.post_time DESC'; break; } // forums can be read by current viewer (check by forum_access) require_once dirname(dirname(__FILE__)) . '/include/common_functions.php'; $whr_forum = "t.forum_id IN (" . implode(",", d3forum_get_forums_can_read($mydirname)) . ")"; // categories $categories = array_map('intval', $categories); $categories4assign = implode(',', $categories); $whr_categories = empty($categories) ? '1' : 'f.cat_id IN (' . implode(',', $categories) . ')'; // forums $forums = array_map('intval', $forums); $forums4assign = implode(',', $forums); $whr_forums = empty($forums) ? '1' : 'f.forum_id IN (' . implode(',', $forums) . ')'; // naao $sql = "SELECT p.post_id, p.subject, p.votes_sum, p.votes_count, p.post_time, p.post_text, p.uid, \n\t\tp.guest_name, p.html, p.smiley, p.xcode, p.br, p.unique_path, \n\t\tf.forum_id, f.forum_title, t.topic_external_link_id FROM " . $db->prefix($mydirname . "_posts") . " p LEFT JOIN " . $db->prefix($mydirname . "_topics") . " t ON p.topic_id=t.topic_id LEFT JOIN " . $db->prefix($mydirname . "_forums") . " f ON f.forum_id=t.forum_id \n\t\tWHERE ! t.topic_invisible AND ({$whr_forum}) AND ({$whr_categories}) AND ({$whr_forums}) \n\t\tAND ({$whr_order}) ORDER BY {$odr}"; // var_dump( $sql ) ; if (!($result = $db->query($sql, $max_posts, 0))) { return array(); } $constpref = '_MB_' . strtoupper($mydirname); $block = array('mydirname' => $mydirname, 'mod_url' => XOOPS_URL . '/modules/' . $mydirname, 'mod_imageurl' => XOOPS_URL . '/modules/' . $mydirname . '/' . $configs['images_dir'], 'mod_config' => $configs, 'categories' => $categories4assign, 'forums' => $forums4assign, 'lang_forum' => constant($constpref . '_FORUM'), 'lang_topic' => constant($constpref . '_TOPIC'), 'lang_replies' => constant($constpref . '_REPLIES'), 'lang_views' => constant($constpref . '_VIEWS'), 'lang_votescount' => constant($constpref . '_VOTESCOUNT'), 'lang_votessum' => constant($constpref . '_VOTESSUM'), 'lang_lastpost' => constant($constpref . '_LASTPOST'), 'lang_linktosearch' => constant($constpref . '_LINKTOSEARCH'), 'lang_linktolistcategories' => constant($constpref . '_LINKTOLISTCATEGORIES'), 'lang_linktolistforums' => constant($constpref . '_LINKTOLISTFORUMS'), 'lang_linktolisttopics' => constant($constpref . '_LINKTOLISTTOPICS')); while ($post_row = $db->fetchArray($result)) { // naao from // d3comment overridings $can_display = true; //default if (is_object($d3com[intval($post_row['forum_id'])])) { $d3com_obj = $d3com[intval($post_row['forum_id'])]; $external_link_id = intval($post_row['topic_external_link_id']); if (($external_link_id = $d3com_obj->validate_id($external_link_id)) === false) { $can_display = false; } } // naao to if ($can_display == true) { // naao $post4assign = array('id' => intval($post_row['post_id']), 'subject' => $myts->makeTboxData4Show($post_row['subject']), 'forum_id' => intval($post_row['forum_id']), 'forum_title' => $myts->makeTboxData4Show($post_row['forum_title']), 'votes_count' => $post_row['votes_count'], 'votes_sum' => intval($post_row['votes_sum']), 'post_time' => intval($post_row['post_time']), 'post_time_formatted' => formatTimestamp($post_row['post_time'], 'm'), 'uid' => intval($post_row['uid']), 'uname' => XoopsUser::getUnameFromId($post_row['uid'], $configs['use_name']), 'external_link_id' => intval($post_row['topic_external_link_id']), 'post_text' => strip_tags($myts->displayTarea(strip_tags($post_row['post_text']), $post_row['html'], $post_row['smiley'], $post_row['xcode'], 1, $post_row['br'])), 'guest_name' => htmlspecialchars($post_row['guest_name'])); $block['posts'][] = $post4assign; } //naao } if (empty($options['disable_renderer'])) { require_once XOOPS_ROOT_PATH . '/class/template.php'; $tpl = new XoopsTpl(); $tpl->assign('block', $block); $ret['content'] = $tpl->fetch($this_template); return $ret; } else { return $block; } }
break; case 'pending': $lang_title = _MD_VIEWALLPOSTS . ' [' . _MD_TYPE_PENDING . ']'; break; case 'deleted': $lang_title = _MD_VIEWALLPOSTS . ' [' . _MD_TYPE_DELETED . ']'; break; case 'new': $lang_title = _MD_NEWPOSTS; break; default: $lang_title = _MD_VIEWALLPOSTS; break; } if ($uid > 0) { $lang_title .= ' (' . XoopsUser::getUnameFromId($uid) . ')'; } $xoopsTpl->assign('lang_title', $lang_title); $xoopsTpl->assign('up', newbb_displayImage('up', _MD_TOP)); $xoopsTpl->assign('groupbar_enable', $xoopsModuleConfig['groupbar_enabled']); $xoopsTpl->assign('anonymous_prefix', $xoopsModuleConfig['anonymous_prefix']); $xoopsTpl->assign('down', newbb_displayImage('down', _MD_BOTTOM)); $all_link = "viewall.php?forum=" . $forum_id . "&start={$start}"; $post_link = "viewpost.php?forum=" . $forum_id; $newpost_link = "viewpost.php?forum=" . $forum_id . "&status=new"; $digest_link = "viewall.php?forum=" . $forum_id . "&start={$start}&status=digest"; $unreplied_link = "viewall.php?forum=" . $forum_id . "&start={$start}&status=unreplied"; $unread_link = "viewall.php?forum=" . $forum_id . "&start={$start}&status=unread"; $xoopsTpl->assign('all_link', $all_link); $xoopsTpl->assign('post_link', $post_link); $xoopsTpl->assign('newpost_link', $newpost_link);
function modLink() { global $xoopsDB, $myts, $eh, $myCatTree, $xoopsModule; $linkimg_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . "/modules/" . $xoopsModule->getVar('dirname') . "/images/shots/"); $lid = mylinksUtility::mylinks_cleanVars($_GET, 'lid', 0, 'int', array('min' => 0)); //xoops_cp_header(); $result = $xoopsDB->query("SELECT cid, title, url, logourl FROM " . $xoopsDB->prefix("mylinks_links") . " WHERE lid={$lid}") or $eh->show('0013'); list($cid, $title, $url, $logourl) = $xoopsDB->fetchRow($result); if (!$title) { // all links have title so if there's no title this wasn't a vaild $lid redirect_header('index.php', 3, _MD_MYLINKS_NORECORDFOUND); exit; } $title = $myts->htmlSpecialChars($title); $url = $myts->htmlSpecialChars($url); //$url = urldecode($url); $logourl = $myts->htmlSpecialChars($logourl); //$logourl = urldecode($logourl); $result2 = $xoopsDB->query("SELECT description FROM " . $xoopsDB->prefix("mylinks_text") . " WHERE lid={$lid}"); list($description) = $xoopsDB->fetchRow($result2); $GLOBALS['description'] = $myts->htmlSpecialChars($description); echo "<h4>" . _MD_MYLINKS_WEBLINKSCONF . "</h4>" . "<table class='outer' style='width: 100%; border-width: 0px; margin: 1px;'>" . " <tr><th colspan='2'>" . _MD_MYLINKS_MODLINK . "</th></tr>\n" . " <tr class='odd'>\n" . " <td>\n" . " <form method='post' action='main.php' style='display: inline;'>\n" . " <table>\n" . " <tr><td>" . _MD_MYLINKS_LINKID . "</td><td style='font-weight: bold;'>{$lid}</td></tr>\n" . " <tr><td>" . _MD_MYLINKS_SITETITLE . "</td><td><input type='text' name='title' value='{$title}' size='50' maxlength='100' /></td></tr>\n" . "\t\t\t<tr><td>" . _MD_MYLINKS_SITEURL . "</td><td><input type='text' name='url' value='{$url}' size='50' maxlength='250' /></td></tr>\n" . " <tr><td style='vertical-align: top;'>" . _MD_MYLINKS_DESCRIPTIONC . "</td><td>"; xoopsCodeTarea("description", 60, 8); xoopsSmilies("description"); echo "</td></tr>\n" . "\t\t\t<tr><td>" . _MD_MYLINKS_CATEGORYC . "</td><td>" . "" . $myCatTree->makeSelBox("cid", "title", '- ', $cid) . "" . " </td></tr>\n" . "\t\t\t<tr><td>" . _MD_MYLINKS_SHOTIMAGE . "</td><td>" . "<select size='1' name='logourl'>" . "<option value=' '>------</option>"; foreach ($linkimg_array as $image) { $opt_selected = $image == $logourl ? " selected='selected'" : ''; echo "<option value='{$image}'{$opt_selected}>{$image}</option>"; } echo "</select>" . "</td></tr>\n"; $shotdir = "<strong>" . XOOPS_URL . "/modules/" . $xoopsModule->getVar('dirname') . "/images/shots/</strong>"; echo " <tr><td> </td><td>" . sprintf(_MD_MYLINKS_SHOTMUST, $shotdir) . "</td></tr>\n" . " </table>" . " <br /><br /><input type='hidden' name='lid' value='{$lid}' />\n" . " <input type='hidden' name='op' value='modLinkS' />\n" . " <input type='submit' value='" . _MD_MYLINKS_MODIFY . "' />" . " </form>\n" . "\t\t<form action='main.php?op=delLink&lid={$lid}' method='post' style='margin-left: 1em; display: inline;'><input type='submit' value='" . _DELETE . "' /></form>\n" . "\t\t<form action='main.php?op=linksConfigMenu' method='post' style='margin-left: 1em; display: inline;'><input type='submit' value='" . _CANCEL . "' /></form>\n" . " <hr />"; $result5 = $xoopsDB->query("SELECT COUNT(*) FROM " . $xoopsDB->prefix("mylinks_votedata") . " WHERE lid='{$lid}'"); list($totalvotes) = $xoopsDB->fetchRow($result5); echo " <table style='width: 100%;'>\n" . " <tr><td colspan='7' style='font-weight: bold;'>" . sprintf(_MD_MYLINKS_TOTALVOTES, $totalvotes) . "<br /><br /></td></tr>\n"; // Show Registered Users Votes $result5 = $xoopsDB->query("SELECT ratingid, ratinguser, rating, ratinghostname, ratingtimestamp FROM " . $xoopsDB->prefix("mylinks_votedata") . " WHERE lid='{$lid}' AND ratinguser >0 ORDER BY ratingtimestamp DESC"); $votes = $xoopsDB->getRowsNum($result5); echo " <tr><td colspan='7' style='font-weight: bold;'><br /><br />" . sprintf(_MD_MYLINKS_USERTOTALVOTES, $votes) . "<br /><br /></td></tr>\n"; echo " <tr>\n" . " <th>" . _MD_MYLINKS_USER . " </th>\n" . " <th>" . _MD_MYLINKS_IP . " </th>\n" . " <th>" . _MD_MYLINKS_RATING . " </th>\n" . "\t\t\t<th>" . _MD_MYLINKS_USERAVG . " </th>\n" . " <th>" . _MD_MYLINKS_TOTALRATE . " </th>\n" . " <th>" . _MD_MYLINKS_DATE . " </th>\n" . " <th>" . _DELETE . "</td>\n" . " </tr>\n"; if (0 == $votes) { echo " <tr><td style='text-align: center;' colspan='7'>" . _MD_MYLINKS_NOREGVOTES . "<br /></td></tr>\n"; } $x = 0; $colorswitch = "#DDDDDD"; while (list($ratingid, $ratinguser, $rating, $ratinghostname, $ratingtimestamp) = $xoopsDB->fetchRow($result5)) { // $ratingtimestamp = formatTimestamp($ratingtimestamp); //Individual user information //v3.11 changed to let SQL do calculations instead of PHP $result2 = $xoopsDB->query("SELECT COUNT(), FORMAT(AVG(rating),2) FROM " . $xoopsDB->prefix("mylinks_votedata") . " WHERE ratinguser = '******'"); list($uservotes, $useravgrating) = $xoopsDB->fetchRow($result2); // $useravgrating = ($rating2) ? sprintf("%01.2f", ($useravgrating / $uservotes)) : 0; /* $result2=$xoopsDB->query("SELECT rating FROM ".$xoopsDB->prefix("mylinks_votedata")." WHERE ratinguser = '******'"); $uservotes = $xoopsDB->getRowsNum($result2); $useravgrating = 0; while ( list($rating2) = $xoopsDB->fetchRow($result2) ) { $useravgrating = $useravgrating + $rating2; } $useravgrating = sprintf("%01.2f", ($useravgrating / $uservotes)); */ $ratingusername = XoopsUser::getUnameFromId($ratinguser); echo " <tr>\n" . " \t\t<td style='background-color: {$colorswitch};'>{$ratingusername}</td>\n" . " \t\t<td style='background-color: {$colorswitch};'>{$ratinghostname}</td>\n" . " \t\t<td style='background-color: {$colorswitch};'>{$rating}</td>\n" . " \t\t<td style='background-color: {$colorswitch};'>{$useravgrating}</td>\n" . " \t\t<td style='background-color: {$colorswitch};'>{$uservotes}</td>\n" . " \t\t<td style='background-color: {$colorswitch};'>{$ratingtimestamp}</td>\n" . " \t\t<td style='background-color: {$colorswitch}; text-align: center; font-weight: bold;'>\n" . " \t <form action='main.php?op=delVote&lid={$lid}&rid={$ratingid}' method='post'><input type='submit' value='X' /></form>\n" . " \t\t</td>\n" . " \t </tr>\n"; $x++; $colorswitch = $colorswitch == "#DDDDDD" ? "#FFFFFF" : "#DDDDDD"; } // Show Unregistered Users Votes $result5 = $xoopsDB->query("SELECT ratingid, rating, ratinghostname, ratingtimestamp FROM " . $xoopsDB->prefix("mylinks_votedata") . " WHERE lid ='{$lid}' AND ratinguser='******' ORDER BY ratingtimestamp DESC"); $votes = $xoopsDB->getRowsNum($result5); echo " <tr><td colspan='7' style='font-weight: bold;'><br /><br />" . sprintf(_MD_MYLINKS_ANONTOTALVOTES, $votes) . "<br /><br /></td></tr>\n" . " <tr>\n" . " <th colspan='2'>" . _MD_MYLINKS_IP . " </th>\n" . "\t\t <th colspan='3' style='font-weight: bold;'>" . _MD_MYLINKS_RATING . " </th>\n" . "\t\t\t<th style='font-weight: bold;'>" . _MD_MYLINKS_DATE . " </th>\n" . " <th style='text-align: center; font-weight: bold;'>" . _DELETE . "<br /></th>\n" . " </tr>\n"; if (0 == $votes) { echo " <tr><td colspan='7' style='text-align: center;'>" . _MD_MYLINKS_NOUNREGVOTES . "<br /></td></tr>\n"; } $x = 0; $colorswitch = "#DDDDDD"; while (list($ratingid, $rating, $ratinghostname, $ratingtimestamp) = $xoopsDB->fetchRow($result5)) { $formatted_date = formatTimestamp($ratingtimestamp); echo " <tr>\n" . " <td colspan='2' style='background-color: {$colorswitch}'>{$ratinghostname}</td>\n" . " <td colspan='3' style='background-color: {$colorswitch}'>{$rating}</td>\n" . " <td style='background-color: {$colorswitch}'>{$formatted_date}</td>\n" . " <td style='background-color: {$colorswitch} text-align: center; font-weight: bold;'>\n" . " <form action='main.php?op=delVote&lid={$lid}&rid={$ratingid}' method='post'><input type='submit' value='X' /></form>\n" . " </td>" . " </tr>"; $x++; $colorswitch = $colorswitch == "#DDDDDD" ? "#FFFFFF" : "#DDDDDD"; } echo " <tr><td colspan='7'> <br /></td></tr>\n" . " </table>\n" . " </td>\n" . " </tr>\n" . "</table>\n"; include 'footer.php'; }
function uname() { return XoopsUser::getUnameFromId($this->uid); }
if ($xoopsModuleConfig['use_name'] == 1 && $xoopsUser->getVar('name')) { $poster_uname4disp = $xoopsUser->getVar('name'); } else { $poster_uname4disp = $xoopsUser->getVar('uname'); } } else { $poster_uname4disp = ''; } $tree = array(); $topics_count = 0; if ($topic4assign['external_link_id'] > 0) { $sql = "SELECT p.*, t.topic_locked, t.topic_id, t.forum_id, t.topic_last_uid, t.topic_last_post_time\n\t\tFROM " . $db->prefix($mydirname . "_topics") . " t\n\t\tLEFT JOIN " . $db->prefix($mydirname . "_posts") . " p ON p.topic_id=t.topic_id\n\t\tWHERE t.forum_id='" . (int) $forum4assign['id'] . "' AND p.depth_in_tree='0'\n\t\t\tAND (t.topic_external_link_id='" . (int) $topic4assign['external_link_id'] . "'\n\t\t\tOR t.topic_id={$topic_id} )"; if (!($prs = $db->query($sql))) { die(_MD_D3FORUM_ERR_SQL . __LINE__); } while ($post_row = $db->fetchArray($prs)) { // topics array $topic_last_uid = intval($post_row['topic_last_uid']); $topic_last_post_time = intval($post_row['topic_last_post_time']); $topic_last_uname = XoopsUser::getUnameFromId($topic_last_uid, $xoopsModuleConfig['use_name']); //naao usereal=1 $topic_last_uname = $topic_last_uid > 0 ? $topic_last_uname : $myts->makeTboxData4Show($post_row['guest_name']); $tree[] = array('id' => intval($post_row['post_id']), 'subject' => $myts->makeTboxData4Show($post_row['subject'], $post_row['number_entity'], $post_row['special_entity']), 'post_time_formatted' => formatTimestamp($post_row['post_time'], 'm'), 'poster_uid' => $topic_last_uid, 'poster_uname' => $topic_last_uname, 'icon' => intval($post_row['icon']), 'depth_in_tree' => intval($post_row['depth_in_tree']), 'order_in_tree' => intval($post_row['order_in_tree']), 'topic_id' => intval($post_row['topic_id']), 'ul_in' => '<ul><li>', 'ul_out' => '</li></ul>'); } $topics_count = count($tree); } // naao to $xoopsOption['template_main'] = $mydirname . '_main_viewpost.html'; include XOOPS_ROOT_PATH . '/header.php'; unset($xoops_breadcrumbs[sizeof($xoops_breadcrumbs) - 1]['url']); $xoopsTpl->assign(array('category' => $category4assign, 'forum' => $forum4assign, 'topic' => $topic4assign, 'next_topic' => $next_topic4assign, 'prev_topic' => $prev_topic4assign, 'post' => $post4assign, 'posts' => $posts, 'tree' => $tree, 'tree_tp_count' => $topics_count, 'page' => 'viewpost', 'ret_name' => 'post_id', 'ret_val' => $post_id, 'uname' => $poster_uname4disp, 'xoops_pagetitle' => join(' - ', array($post4assign['subject'], $forum4assign['title'], $xoopsModule->getVar('name'))), 'xoops_meta_description' => $d3forum_meta_description, 'xoops_breadcrumbs' => $xoops_breadcrumbs));