<?php $viewableforums = ForumsWithPermission('forum.viewforum'); $tag = $_GET['tag']; $tagcode = '"[' . $tag . ']"'; $forum = $_GET['fid']; $cond = "WHERE MATCH (t.title) AGAINST ({0} IN BOOLEAN MODE)"; if ($forum) { $cond .= " AND t.forum = {1}"; } $total = Fetch(Query("SELECT count(*) from threads t {$cond} AND t.forum IN ({2c})", $tag, $forum, $viewableforums)); $total = $total[0]; $tpp = $loguser['threadsperpage']; if (isset($_GET['from'])) { $from = (int) $_GET['from']; } else { $from = 0; } if (!$tpp) { $tpp = 50; } $rThreads = Query("\tSELECT\n\t\t\t\t\t\tt.*,\n\t\t\t\t\t\tf.(title, id),\n\t\t\t\t\t\t" . ($loguserid ? "tr.date readdate," : '') . "\n\t\t\t\t\t\tsu.(_userfields),\n\t\t\t\t\t\tlu.(_userfields)\n\t\t\t\t\tFROM\n\t\t\t\t\t\tthreads t\n\t\t\t\t\t\t" . ($loguserid ? "LEFT JOIN threadsread tr ON tr.thread=t.id AND tr.id={2}" : '') . "\n\t\t\t\t\t\tLEFT JOIN users su ON su.id=t.user\n\t\t\t\t\t\tLEFT JOIN users lu ON lu.id=t.lastposter\n\t\t\t\t\t\tLEFT JOIN forums f ON f.id=t.forum\n\t\t\t\t\t{$cond} AND f.id IN ({5c})\n\t\t\t\t\tORDER BY sticky DESC, lastpostdate DESC LIMIT {3u}, {4u}", $tagcode, $forum, $loguserid, $from, $tpp, $viewableforums); $pagelinks = PageLinks(actionLink("tagsearch", "", "tag={$tag}&fid={$forum}&from="), $tpp, $from, $total); if (NumRows($rThreads)) { makeThreadListing($rThreads, $pagelinks, false, !$forum); } else { Alert(format(__("Tag {0} was not found in any thread."), htmlspecialchars($tag)), __("No threads found.")); }
$r['link'] = actionLinkTag($tags[0], "post", $result['pid']); $r['formattedDate'] = formatdate($result['date']); $rdata[] = $r; } } } if ($nres == 0) { $restext = __('No results found'); } else { if ($nres == 1) { $restext = __('1 result found'); } else { $restext = $nres . __(' results found'); } } $pagelinks = PageLinks(actionLink('search', '', 'q=' . urlencode($searchQuery) . '&inposts=' . $_GET['inposts'] . '&from='), $tpp, $from, $nres); RenderTemplate('searchresults', array('results' => $rdata, 'nresults' => $nres, 'resultstext' => $restext, 'pagelinks' => $pagelinks)); } function MakeSnippet($text, $terms, $title = false) { $text = strip_tags($text); if (!$title) { $text = preg_replace("/(\\[\\/?)(\\w+)([^\\]]*\\])/i", "", $text); } $lines = explode("\n", $text); $terms = implode("|", $terms); $contextlines = 3; $max = 50; $pat1 = "/(.*)(" . $terms . ")(.{0," . $max . "})/i"; $lineno = 0; $extract = "";
} $rRead = Query("insert into {threadsread} (id,thread,date) values ({0}, {1}, {2}) on duplicate key update date={2}", $loguserid, $tid, time()); $total = $thread['replies'] + 1; //+1 for the OP $ppp = $loguser['postsperpage']; if (!$ppp) { $ppp = 20; } if (isset($_GET['from'])) { $from = $_GET['from']; } else { $from = 0; } $rPosts = Query("\n\t\t\tSELECT\n\t\t\t\tp.*,\n\t\t\t\tpt.text, pt.revision, pt.user AS revuser, pt.date AS revdate,\n\t\t\t\tu.(_userfields), u.(rankset,title,picture,posts,postheader,signature,signsep,lastposttime,lastactivity,regdate,globalblock),\n\t\t\t\tru.(_userfields),\n\t\t\t\tdu.(_userfields)\n\t\t\tFROM\n\t\t\t\t{posts} p\n\t\t\t\tLEFT JOIN {posts_text} pt ON pt.pid = p.id AND pt.revision = p.currentrevision\n\t\t\t\tLEFT JOIN {users} u ON u.id = p.user\n\t\t\t\tLEFT JOIN {users} ru ON ru.id=pt.user\n\t\t\t\tLEFT JOIN {users} du ON du.id=p.deletedby\n\t\t\tWHERE thread={1}\n\t\t\tORDER BY date ASC LIMIT {2u}, {3u}", $loguserid, $tid, $from, $ppp); $numonpage = NumRows($rPosts); $pagelinks = PageLinks(actionLink("thread", $tid, "from="), $ppp, $from, $total); if ($pagelinks) { write("<div class=\"smallFonts pages\">" . __("Pages:") . " {0}</div>", $pagelinks); } if (NumRows($rPosts)) { while ($post = Fetch($rPosts)) { $post['closed'] = $thread['closed']; MakePost($post, POST_NORMAL, array('tid' => $tid, 'fid' => $fid)); } } if ($pagelinks) { write("<div class=\"smallFonts pages\">" . __("Pages:") . " {0}</div>", $pagelinks); } if ($loguserid && $loguser['powerlevel'] >= $forum['minpowerreply'] && (!$thread['closed'] || $loguser['powerlevel'] > 0) && !isset($replyWarning)) { $ninja = FetchResult("select id from {posts} where thread={0} order by date desc limit 0, 1", $tid); //Quick reply goes here
} else { Kill(__("Unknown user ID.")); } $title = __("Post list"); $total = FetchResult("\n\t\t\tSELECT\n\t\t\t\tcount(p.id)\n\t\t\tFROM\n\t\t\t\t{posts} p\n\t\t\t\tLEFT JOIN {threads} t ON t.id=p.thread{$extrashit}\n\t\t\tWHERE p.user={0} AND t.forum IN ({1c})", $id, ForumsWithPermission('forum.viewforum')); $ppp = $loguser['postsperpage']; if (isset($_GET['from'])) { $from = (int) $_GET['from']; } else { $from = 0; } if (!$ppp) { $ppp = 25; } $rPosts = Query("\tSELECT\n\t\t\t\tp.*,\n\t\t\t\tpt.text, pt.revision, pt.user AS revuser, pt.date AS revdate,\n\t\t\t\tu.(_userfields), u.(rankset,title,picture,posts,postheader,signature,signsep,lastposttime,lastactivity,regdate,globalblock,fulllayout),\n\t\t\t\tru.(_userfields),\n\t\t\t\tdu.(_userfields),\n\t\t\t\tt.id thread, t.title threadname,\n\t\t\t\tf.id fid\n\t\t\tFROM\n\t\t\t\t{posts} p\n\t\t\t\tLEFT JOIN {posts_text} pt ON pt.pid = p.id AND pt.revision = p.currentrevision\n\t\t\t\tLEFT JOIN {users} u ON u.id = p.user\n\t\t\t\tLEFT JOIN {users} ru ON ru.id=pt.user\n\t\t\t\tLEFT JOIN {users} du ON du.id=p.deletedby\n\t\t\t\tLEFT JOIN {threads} t ON t.id=p.thread\n\t\t\t\tLEFT JOIN {forums} f ON f.id=t.forum\n\t\t\t\tLEFT JOIN {categories} c ON c.id=f.catid\n\t\t\tWHERE u.id={1} AND f.id IN ({4c}){$extrashit}\n\t\t\tORDER BY date ASC LIMIT {2u}, {3u}", $loguserid, $id, $from, $ppp, ForumsWithPermission('forum.viewforum')); $numonpage = NumRows($rPosts); $uname = $user["name"]; if ($user["displayname"]) { $uname = $user["displayname"]; } MakeCrumbs(array(actionLink("profile", $id, "", $user["name"]) => htmlspecialchars($uname), '' => __("List of posts"))); $pagelinks = PageLinks(actionLink("listposts", $id, "from=", $user['name']), $ppp, $from, $total); RenderTemplate('pagelinks', array('pagelinks' => $pagelinks, 'position' => 'top')); if (NumRows($rPosts)) { while ($post = Fetch($rPosts)) { MakePost($post, POST_NORMAL, array('threadlink' => 1, 'tid' => $post['thread'], 'fid' => $post['fid'], 'noreplylinks' => 1)); } } else { Alert('This user has no posts.', 'Notice'); } RenderTemplate('pagelinks', array('pagelinks' => $pagelinks, 'position' => 'bottom'));
$from = 0; } if (!$ppp) { $ppp = 25; } $rPosts = Query("\n\tSELECT\n\t\tp.*,\n\t\tpt.text, pt.revision, pt.user AS revuser, pt.date AS revdate,\n\t\tu.(_userfields), u.(rankset,title,picture,posts,postheader,signature,signsep,lastposttime,lastactivity,regdate,globalblock),\n\t\tru.(_userfields),\n\t\tdu.(_userfields),\n\t\tt.id thread, t.title threadname,\n\t\tf.id fid\n\tFROM\n\t\t{posts} p\n\t\tLEFT JOIN {posts_text} pt ON pt.pid = p.id AND pt.revision = p.currentrevision\n\t\tLEFT JOIN {users} u ON u.id = p.user\n\t\tLEFT JOIN {users} ru ON ru.id=pt.user\n\t\tLEFT JOIN {users} du ON du.id=p.deletedby\n\t\tLEFT JOIN {threads} t ON t.id=p.thread\n\t\tLEFT JOIN {forums} f ON f.id=t.forum\n\tWHERE u.id={1} AND " . forumAccessControlSql() . "\n\tORDER BY date ASC LIMIT {2u}, {3u}", $loguserid, $id, $from, $ppp); $numonpage = NumRows($rPosts); $uname = $user["name"]; if ($user["displayname"]) { $uname = $user["displayname"]; } $crumbs = new PipeMenu(); $crumbs->add(new PipeMenuLinkEntry(__("Member list"), "memberlist")); $crumbs->add(new PipeMenuHtmlEntry(userLink($user))); $crumbs->add(new PipeMenuTextEntry(__("Posts"))); makeBreadcrumbs($crumbs); if ($total == 0) { Kill(__("This user hasn't made any posts yet.")); } $pagelinks = PageLinks(actionLink("listposts", $id, "from="), $ppp, $from, $total); if ($pagelinks) { write("<div class=\"smallFonts pages\">" . __("Pages:") . " {0}</div>", $pagelinks); } if (NumRows($rPosts)) { while ($post = Fetch($rPosts)) { MakePost($post, POST_NORMAL, array('threadlink' => 1, 'tid' => $post['thread'], 'fid' => $post['fid'], 'noreplylinks' => 1)); } } if ($pagelinks) { write("<div class=\"smallFonts pages\">" . __("Pages:") . " {0}</div>", $pagelinks); }
$from = 0; } $links = new PipeMenu(); $links->add(new PipeMenuLinkEntry(__("Show received"), "private", $userGet, "", "download-alt")); $links->add(new PipeMenuLinkEntry(__("Show sent"), "private", $userGet, "show=1", "upload-alt")); $links->add(new PipeMenuLinkEntry(__("Show drafts"), "private", $userGet, "show=2", "save")); $links->add(new PipeMenuLinkEntry(__("Send new PM"), "sendprivate", "", "", "plus")); makeLinks($links); $crumbs = new PipeMenu(); $crumbs->add(new PipeMenuLinkEntry(__("Member list"), "memberlist")); $crumbs->add(new PipeMenuHtmlEntry(userLinkById($user))); $crumbs->add(new PipeMenuLinkEntry(__("Private messages"), "private", $userGet)); makeBreadcrumbs($crumbs); $rPM = Query("select * from {pmsgs} left join {pmsgs_text} on pid = {pmsgs}.id where " . $whereFrom . " and deleted != {1} order by date desc limit {2u}, {3u}", $user, $deleted, $from, $ppp); $numonpage = NumRows($rPM); $pagelinks = PageLinks(actionLink("private", "", "{$show}{$userGet}&from="), $ppp, $from, $total); if ($pagelinks) { write("<div class=\"smallFonts pages\">" . __("Pages:") . " {0}</div>", $pagelinks); } if (NumRows($rPM)) { while ($pm = Fetch($rPM)) { $rUser = Query("select * from {users} where id = {0}", isset($_GET['show']) ? $pm['userto'] : $pm['userfrom']); if (NumRows($rUser)) { $user = Fetch($rUser); } $cellClass = ($cellClass + 1) % 2; if (!$pm['msgread']) { $img = "<img src=\"" . resourceLink("img/status/new.png") . "\" alt=\"New!\" />"; } else { $img = ""; }
function &GenericSearch($table, $files, $select_callback = null, $item_callback = null, $fields = null) { global $C, $DB, $BLIST_TYPES, $WLIST_TYPES, $ANN_LOCATIONS; $out = array('status' => JSON_SUCCESS, 'html' => '', 'pagination' => $GLOBALS['DEFAULT_PAGINATION'], 'pagelinks' => ''); $per_page = isset($_REQUEST['per_page']) && $_REQUEST['per_page'] > 0 ? $_REQUEST['per_page'] : 20; $page = isset($_REQUEST['page']) ? $_REQUEST['page'] : 1; $select = new SelectBuilder('*' . (empty($fields) ? '' : ', ' . $fields), $table); $override = FALSE; if (function_exists($select_callback)) { $override = $select_callback($select); } if (!$override) { $select->AddWhere($_REQUEST['field'], $_REQUEST['search_type'], $_REQUEST['search'], $_REQUEST['search_type'] != ST_EMPTY); } $select->AddOrder($_REQUEST['order'], $_REQUEST['direction']); if (!empty($_REQUEST['order_next'])) { $select->AddOrder($_REQUEST['order_next'], $_REQUEST['direction_next']); } $result = $DB->QueryWithPagination($select->Generate(), $select->binds, $page, $per_page); $out['pagination'] = $result; $out['pagelinks'] = PageLinks($result); if ($result['result']) { if (!is_array($files)) { $files = array($files); } $row_html = ''; foreach ($files as $file) { $row_html .= file_get_contents("includes/{$file}"); } while ($item = $DB->NextRow($result['result'])) { ArrayHSC($item); if (function_exists($item_callback)) { $item_callback($item); } ob_start(); eval('?>' . $row_html); $out['html'] .= ob_get_contents(); ob_end_clean(); } $DB->Free($result['result']); } return $out; }
if ($span == $time) { $options[] = $desc; } else { $options[] = actionLinkTag($desc, 'lastposts', '', 'time=' . $span . '&show=' . $show . $fparam); } } $options2 = array(); $options2[] = $show == 'threads' ? __('List threads') : actionLinkTag(__('Show threads'), 'lastposts', '', 'time=' . $time . '&show=threads' . $fparam); $options2[] = $show == 'posts' ? __('Show posts') : actionLinkTag(__('Show posts'), 'lastposts', '', 'time=' . $time . '&show=posts' . $fparam); RenderTemplate('lastposts_options', array('timelinks' => $options, 'misclinks' => $options2)); $mindate = $time == 'new' ? $loguserid ? 'IFNULL(tr.date,0)' : '{2}' : '{1}'; $total = FetchResult("SELECT COUNT(" . ($show == 'threads' ? 'DISTINCT p.thread' : '*') . ") FROM {posts} p LEFT JOIN {threads} t ON t.id=p.thread " . ($loguserid && $time == 'new' ? 'LEFT JOIN {threadsread} tr ON tr.thread=p.thread AND tr.id={0}' : '') . " WHERE p.date>{$mindate} AND t.forum IN ({3c})", $loguserid, time() - $time, time() - 900, $allowedforums); if (!$total) { Alert($time == 'new' ? __('No unread posts.') : __('No posts have been made during this timespan.'), __('Notice')); return; } $perpage = $show == 'posts' ? $loguser['postsperpage'] : $loguser['threadsperpage']; $pagelinks = PageLinks(actionLink("lastposts", '', "time={$time}&show={$show}&from="), $perpage, $from, $total); if ($show == 'threads') { $mindate = $time == 'new' ? $loguserid ? 'IFNULL(tr.date,0)' : '{2}' : '{1}'; $rThreads = Query("\tSELECT\n\t\t\t\t\t\t\tt.*,\n\t\t\t\t\t\t\tf.(id,title),\n\t\t\t\t\t\t\t" . ($loguserid ? "tr.date readdate," : '') . "\n\t\t\t\t\t\t\tsu.(_userfields),\n\t\t\t\t\t\t\tlu.(_userfields)\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t{threads} t\n\t\t\t\t\t\t\t" . ($loguserid ? "LEFT JOIN {threadsread} tr ON tr.thread=t.id AND tr.id={0}" : '') . "\n\t\t\t\t\t\t\tLEFT JOIN {forums} f ON f.id=t.forum\n\t\t\t\t\t\t\tLEFT JOIN {users} su ON su.id=t.user\n\t\t\t\t\t\t\tLEFT JOIN {users} lu ON lu.id=t.lastposter\n\t\t\t\t\t\tWHERE t.forum IN ({5c}) AND t.lastpostdate>{$mindate}\n\t\t\t\t\t\tORDER BY t.lastpostdate DESC LIMIT {3u}, {4u}", $loguserid, time() - $time, time() - 900, $from, $perpage, $allowedforums); makeThreadListing($rThreads, $pagelinks, false, true); } else { $mindate = $time == 'new' ? $loguserid ? 'IFNULL(tr.date,0)' : '{2}' : '{1}'; $rPosts = Query("\tSELECT\n\t\t\t\t\t\t\tp.*,\n\t\t\t\t\t\t\tpt.text, pt.revision, pt.user AS revuser, pt.date AS revdate,\n\t\t\t\t\t\t\tu.(_userfields), u.(rankset,title,picture,posts,postheader,signature,signsep,lastposttime,lastactivity,regdate,globalblock,fulllayout),\n\t\t\t\t\t\t\tru.(_userfields),\n\t\t\t\t\t\t\tdu.(_userfields),\n\t\t\t\t\t\t\tt.id thread, t.title threadname,\n\t\t\t\t\t\t\tf.id fid\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t{posts} p\n\t\t\t\t\t\t\tLEFT JOIN {posts_text} pt ON pt.pid = p.id AND pt.revision = p.currentrevision\n\t\t\t\t\t\t\tLEFT JOIN {users} u ON u.id = p.user\n\t\t\t\t\t\t\tLEFT JOIN {users} ru ON ru.id=pt.user\n\t\t\t\t\t\t\tLEFT JOIN {users} du ON du.id=p.deletedby\n\t\t\t\t\t\t\tLEFT JOIN {threads} t ON t.id=p.thread\n\t\t\t\t\t\t\t" . ($loguserid && $time == 'new' ? 'LEFT JOIN {threadsread} tr ON tr.thread=t.id AND tr.id={0}' : '') . "\n\t\t\t\t\t\t\tLEFT JOIN {forums} f ON f.id=t.forum\n\t\t\t\t\t\t\tLEFT JOIN {categories} c ON c.id=f.catid\n\t\t\t\t\t\tWHERE p.date>{$mindate} AND f.id IN ({5c})\n\t\t\t\t\t\tORDER BY date DESC LIMIT {3u}, {4u}", $loguserid, time() - $time, time() - 900, $from, $perpage, $allowedforums); RenderTemplate('pagelinks', array('pagelinks' => $pagelinks, 'position' => 'top')); while ($post = Fetch($rPosts)) { MakePost($post, POST_NORMAL, array('threadlink' => 1, 'tid' => $post['thread'], 'fid' => $post['fid'], 'noreplylinks' => 1)); } RenderTemplate('pagelinks', array('pagelinks' => $pagelinks, 'position' => 'bottom')); }
} if ($_GET['action'] == 'add') { Query("INSERT IGNORE INTO {favorites} (user,thread) VALUES ({0},{1})", $loguserid, $tid); } else { Query("DELETE FROM {favorites} WHERE user={0} AND thread={1}", $loguserid, $tid); } die(header('Location: ' . $_SERVER['HTTP_REFERER'])); } } $title = 'Favorites'; $links = array(actionLinkTag(__("Mark threads read"), 'favorites', 0, 'action=markasread')); MakeCrumbs(array(actionLink('favorites') => 'Favorites'), $links); $viewableforums = ForumsWithPermission('forum.viewforum'); $total = FetchResult("SELECT COUNT(*) FROM {threads} t INNER JOIN {favorites} fav ON fav.user={0} AND fav.thread=t.id WHERE t.forum IN ({1c})", $loguserid, $viewableforums); $tpp = $loguser['threadsperpage']; if (isset($_GET['from'])) { $from = (int) $_GET['from']; } else { $from = 0; } if (!$tpp) { $tpp = 50; } $rThreads = Query("\tSELECT\n\t\t\t\t\t\tt.*,\n\t\t\t\t\t\ttr.date readdate,\n\t\t\t\t\t\tsu.(_userfields),\n\t\t\t\t\t\tlu.(_userfields),\n\t\t\t\t\t\tf.(id,title)\n\t\t\t\t\tFROM\n\t\t\t\t\t\t{threads} t\n\t\t\t\t\t\tINNER JOIN {favorites} fav ON fav.user={0} AND fav.thread=t.id\n\t\t\t\t\t\tLEFT JOIN {threadsread} tr ON tr.thread=t.id AND tr.id={0}\n\t\t\t\t\t\tLEFT JOIN {users} su ON su.id=t.user\n\t\t\t\t\t\tLEFT JOIN {users} lu ON lu.id=t.lastposter\n\t\t\t\t\t\tLEFT JOIN {forums} f ON f.id=t.forum\n\t\t\t\t\tWHERE f.id IN ({3c})\n\t\t\t\t\tORDER BY sticky DESC, lastpostdate DESC LIMIT {1u}, {2u}", $loguserid, $from, $tpp, $viewableforums); $numonpage = NumRows($rThreads); $pagelinks = PageLinks(actionLink('favorites', '', 'from='), $tpp, $from, $total); if (NumRows($rThreads)) { makeThreadListing($rThreads, $pagelinks, true, true); } else { Alert(__("You do not have any favorite threads."), __("Notice")); }
$total = $forum['numthreads']; if (isset($_GET['from'])) { $from = (int) $_GET['from']; } else { $from = 0; } $tpp = 5; //echo '<br>'; $links = array('<a href="' . BOARD_ROOT . 'rss.php">' . __('RSS feed') . '</a>'); if (HasPermission('forum.postthreads', $forum['id'])) { $links[] = actionLinkTag(__('Post new'), 'newthread', $forum['id']); } MakeCrumbs(array(), $links); $rThreads = Query("\tSELECT \n\t\t\t\t\t\tt.id, t.title, t.closed, t.replies, t.lastpostid,\n\t\t\t\t\t\tp.id pid, p.date,\n\t\t\t\t\t\tpt.text,\n\t\t\t\t\t\tsu.(_userfields),\n\t\t\t\t\t\tlu.(_userfields)\n\t\t\t\t\tFROM \n\t\t\t\t\t\t{threads} t\n\t\t\t\t\t\tLEFT JOIN {posts} p ON p.thread=t.id AND p.id=t.firstpostid\n\t\t\t\t\t\tLEFT JOIN {posts_text} pt ON pt.pid=p.id AND pt.revision=p.currentrevision\n\t\t\t\t\t\tLEFT JOIN {users} su ON su.id=t.user\n\t\t\t\t\t\tLEFT JOIN {users} lu ON lu.id=t.lastposter\n\t\t\t\t\tWHERE t.forum={0} AND p.deleted=0\n\t\t\t\t\tORDER BY p.date DESC LIMIT {1u}, {2u}", $fid, $from, $tpp); $numonpage = NumRows($rThreads); $pagelinks = PageLinks(actionLink('home', '', 'from='), $tpp, $from, $total); RenderTemplate('pagelinks', array('pagelinks' => $pagelinks, 'position' => 'top')); while ($thread = Fetch($rThreads)) { $pdata = array(); $starter = getDataPrefix($thread, 'su_'); $last = getDataPrefix($thread, 'lu_'); $tags = ParseThreadTags($thread['title']); $pdata['title'] = $tags[0]; $pdata['formattedDate'] = formatdate($thread['date']); $pdata['userlink'] = UserLink($starter); $pdata['text'] = CleanUpPost($thread['text'], $starter['name'], false, false); if (!$thread['replies']) { $comments = 'No comments yet'; } else { if ($thread['replies'] < 2) { $comments = actionLinkTag('1 comment', 'post', $thread['lastpostid']) . ' (by ' . UserLink($last) . ')';
} else { Kill(__("Unknown user ID.")); } $title = __("Thread list"); $uname = $user["name"]; if ($user["displayname"]) { $uname = $user["displayname"]; } MakeCrumbs(array(actionLink("profile", $uid, "", $user["name"]) => htmlspecialchars($uname), '' => __("List of threads"))); $viewableforums = ForumsWithPermission('forum.viewforum'); $total = FetchResult("SELECT\n\t\t\t\t\t\tcount(*)\n\t\t\t\t\tFROM\n\t\t\t\t\t\t{threads} t\n\t\t\t\t\tWHERE t.user={0} AND t.forum IN ({1c})", $uid, $viewableforums); $tpp = $loguser['threadsperpage']; if (isset($_GET['from'])) { $from = (int) $_GET['from']; } else { $from = 0; } if (!$tpp) { $tpp = 50; } $rThreads = Query("\tSELECT\n\t\t\t\t\t\tt.*,\n\t\t\t\t\t\tf.(title, id),\n\t\t\t\t\t\t" . ($loguserid ? "tr.date readdate," : '') . "\n\t\t\t\t\t\tsu.(_userfields),\n\t\t\t\t\t\tlu.(_userfields)\n\t\t\t\t\tFROM\n\t\t\t\t\t\t{threads} t\n\t\t\t\t\t\t" . ($loguserid ? "LEFT JOIN {threadsread} tr ON tr.thread=t.id AND tr.id={4}" : '') . "\n\t\t\t\t\t\tLEFT JOIN {users} su ON su.id=t.user\n\t\t\t\t\t\tLEFT JOIN {users} lu ON lu.id=t.lastposter\n\t\t\t\t\t\tLEFT JOIN {forums} f ON f.id=t.forum\n\t\t\t\t\tWHERE t.user={0} AND f.id IN ({5c})\n\t\t\t\t\tORDER BY lastpostdate DESC LIMIT {2u}, {3u}", $uid, null, $from, $tpp, $loguserid, $viewableforums); $pagelinks = PageLinks(actionLink("listthreads", $uid, "from=", $user['name']), $tpp, $from, $total); $ppp = $loguser['postsperpage']; if (!$ppp) { $ppp = 20; } if (NumRows($rThreads)) { makeThreadListing($rThreads, $pagelinks, false, true); } else { Alert(__("No threads found."), __("Notice")); }
$fid = $forum['id']; $twoColumns = !$mobileLayout; if ($twoColumns) { write('<table><tr><td style="width: 50%; border: 0px none; vertical-align: top; padding-right: 1em; padding-bottom: 1em;">'); } $total = $forum['numthreads']; if (isset($_GET['from'])) { $from = (int) $_GET['from']; } else { $from = 0; } $tpp = 5; print "<h2 style='text-align:center;'>Latest News</h2>"; $rThreads = Query("\tSELECT\n\t\t\t\t\t\tt.id, t.title, t.closed, t.replies, t.lastpostid,\n\t\t\t\t\t\tp.date, p.options,\n\t\t\t\t\t\tpt.text,\n\t\t\t\t\t\tsu.(_userfields),\n\t\t\t\t\t\tlu.(_userfields)\n\t\t\t\t\tFROM\n\t\t\t\t\t\t{threads} t\n\t\t\t\t\t\tLEFT JOIN {posts} p ON p.id=t.firstpostid\n\t\t\t\t\t\tLEFT JOIN {posts_text} pt ON pt.pid = p.id AND pt.revision = p.currentrevision\n\t\t\t\t\t\tLEFT JOIN {users} su ON su.id=t.user\n\t\t\t\t\t\tLEFT JOIN {users} lu ON lu.id=t.lastposter\n\t\t\t\t\tWHERE forum={0}\n\t\t\t\t\tORDER BY sticky DESC, date DESC LIMIT {1u}, {2u}", $fid, $from, $tpp); $numonpage = NumRows($rThreads); $pagelinks = PageLinks(actionLink("blog", "", "from="), $tpp, $from, $total); if ($pagelinks && $_GET["from"]) { Write("<div class=\"smallFonts pages\">" . __("Pages:") . " {0}</div>", $pagelinks); } $haveStickies = 0; while ($thread = Fetch($rThreads)) { $starter = getDataPrefix($thread, "su_"); $last = getDataPrefix($thread, "lu_"); $tags = ParseThreadTags($thread['title']); if ($thread['sticky'] && $haveStickies == 0) { $haveStickies = 1; } $lastLink = ""; if ($thread['lastpostid']) { $lastLink = " " . actionLinkTag("»", "post", $thread['lastpostid']); }
if ($user['picture']) { $pic = str_replace('$root/', DATA_URL, $user['picture']); $udata['avatar'] = "<img src=\"" . htmlspecialchars($pic) . "\" alt=\"\" style=\"max-width: 60px;max-height:60px;\">"; } else { $udata['avatar'] = ''; } $udata['num'] = $i; $udata['link'] = UserLink($user); $udata['posts'] = $user['posts']; $udata['birthday'] = $user['birthday'] ? cdate('M jS', $user['birthday']) : ''; $udata['regdate'] = cdate('M jS Y', $user['regdate']); $users[] = $udata; $i++; } $getArgs[] = 'from='; $pagelinks = PageLinks(actionLink('memberlist', '', implode('&', $getArgs)), $tpp, $from, $numUsers); RenderTemplate('memberlist', array('pagelinks' => $pagelinks, 'numUsers' => $numUsers, 'users' => $users)); function makeSelect($name, $options) { $result = "<select name=\"" . $name . "\" id=\"" . $name . "\">"; $i = 0; $hasgroups = false; foreach ($options as $key => $value) { if ($value == null) { if ($hasgroups) { $result .= "\n\t</optgroup>"; } $result .= "\n\t<optgroup label=\"" . $key . "\">"; $hasgroups = true; continue; }
$OnlineUsersFid = $fid; MakeCrumbs(forumCrumbs($forum), $links); makeAnncBar(); makeForumListing($fid); $total = $forum['numthreads']; $tpp = $loguser['threadsperpage']; if (isset($_GET['from'])) { $from = (int) $_GET['from']; } else { $from = 0; } if (!$tpp) { $tpp = 50; } $rThreads = Query("\tSELECT\n\t\t\t\t\t\tt.*,\n\t\t\t\t\t\t" . ($loguserid ? "tr.date readdate," : '') . "\n\t\t\t\t\t\tsu.(_userfields),\n\t\t\t\t\t\tlu.(_userfields)\n\t\t\t\t\tFROM\n\t\t\t\t\t\t{threads} t\n\t\t\t\t\t\t" . ($loguserid ? "LEFT JOIN {threadsread} tr ON tr.thread=t.id AND tr.id={3}" : '') . "\n\t\t\t\t\t\tLEFT JOIN {users} su ON su.id=t.user\n\t\t\t\t\t\tLEFT JOIN {users} lu ON lu.id=t.lastposter\n\t\t\t\t\tWHERE forum={0}\n\t\t\t\t\tORDER BY sticky DESC, lastpostdate DESC LIMIT {1u}, {2u}", $fid, $from, $tpp, $loguserid); $pagelinks = PageLinks(actionLink("forum", $fid, "from=", $urlname), $tpp, $from, $total); $ppp = $loguser['postsperpage']; if (!$ppp) { $ppp = 20; } if (NumRows($rThreads)) { makeThreadListing($rThreads, $pagelinks); } else { if (!HasPermission('forum.postthreads', $fid)) { Alert(__("You cannot start any threads here."), __("Empty forum")); } elseif ($loguserid) { Alert(format(__("Would you like to {0}?"), actionLinkTag(__("post something"), "newthread", $fid)), __("Empty forum")); } else { Alert(format(__("{0} so you can post something."), actionLinkTag(__("Log in"), "login")), __("Empty forum")); } }