function renderError($errmsg) { $sm = sminit("error.tpl", null, "profiles", false, false); $sm->assign("errmsg", $errmsg); $sm->display("error.tpl", null); die; }
$offset = 0; } } $beginning = $count - 40 - $offset; if ($beginning < 0) { $beginning = 0; } //Beginning should never be greater than $count, for the reason that $offset is always >= 0 // Get the images $imgs = array(); $imgs = $db->getpics($offset, $boardid); // Get the boards array, to show a list for filtering $boards = array(); $boards = $db->getboard(); // No parameters means everything gets fetched $sm = sminit("adminrecentpics.tpl", null, "_admin", true); // Admin mode means NO caching. (and we provided a null id anyway) // These can be pretty big, so we're going to assign by reference. $sm->assign_by_ref("imgs", $imgs); $sm->assign_by_ref("boards", $boards); $sm->assign("board_folder", $board_folder); // name of the folder (for filtering) $sm->assign("boardlink", $boardlink); //some stuff to append for easy link creation $sm->assign("total_count", $count); // total number (for optionally showing the paging links) $sm->assign("offset", $offset); $sm->assign("offsetfwd", $offsetfwd); $sm->assign("offsetback", $offsetback); // Show it! $sm->display("adminrecentpics.tpl", null);
// Get ban history $banhistory = $db->getiphistory($longip); // Get current ban information, if any $banselect = $db->getban($longip, false); // don't clear bans (hence the 2nd parameter) // Get recent posts $posthistory = $db->recentpostsfromip($longip); // Set images for each post foreach ($posthistory as $post) { $post['images'] = $db->getimgs($post['imgidx']); } // Get the boards array to show folders $boards = $db->getboard(); // No parameters means everything gets fetched } } $sm = sminit("adminlookup.tpl", null, "_admin", true); // Admin mode means NO caching. (and we provided a null id anyway) // These can be pretty big, so we're going to assign by reference. $sm->assign_by_ref("posthistory", $posthistory); $sm->assign_by_ref("banhistory", $banhistory); $sm->assign_by_ref("banselect", $banselect); $sm->assign_by_ref("reports", $reports); $sm->assign_by_ref("boards", $boards); $sm->assign("single_ip", $single_ip); // IP string // Show it! $sm->display("adminlookup.tpl", null); die; } }
$targetid = $postarray['id']; // unique ID for post deletion if ($postarray['thread'] != 0) { $postdbi = new ThornPostDBI(); $fetched_thread = $postdbi->gettinfo($postarray['thread']); $thread = $fetched_thread['globalid']; $targetisthread = false; } smclearcache($board_folder, -1, $thread); // clear the associated cache for this thread smclearcache($board_folder, -1, -1); // AND the board delimgs($db->delpost($targetid, $targetisthread)); // Write to the log writelog("delete\tt:" . $postarray['globalid'] . "\tb:" . $postarray['board'], "moderator"); $message = $message . "<br />Post deletion"; } else { $message = $message . "<br /><i><b>Post deletion failed (insufficient access)</i></b>"; } } } } } $sm = sminit("popup.tpl"); $sm->assign("text", $message); $sm->assign("timeout", 5); // 5s $sm->assign("title", "Moderation action"); $sm->display("popup.tpl"); die; }
/** * Generate an error page for whatever reason. If $err is * equal to "ADbanned" or "PObanned" it looks up the ban data * and displays that. Otherwise it uses the standard error * Smarty template. * * @param string $err The kind of error that occurred */ function THdie($err) { //die($err); if ($err == "ADbanned" || $err == "PObanned") { $db = new ThornDBI(); // Get bans associated with an IP (there could be multiple bans) $bans = $db->getban(); $unbanned = 1; // boolean to indicate whether they've been unbanned or not, gets changed in the foreach loop if appropriate echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'; echo '<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">'; echo '<head>'; echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />'; echo '<meta http-equiv="Content-Style-Type" content="text/css" />'; echo '<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>'; echo '<link rel="stylesheet" type="text/css" href="href="' . THurl . 'tpl/' . THtplset . '" title="Stylesheet" />'; echo '<title>b&</title>'; echo '</head>'; echo '<body>'; echo '<div style="text-align: center;">You have been banned.<br /></div>'; foreach ($bans as $singleban) { // Display wildcards as appropriate. printf("Associated IP: %d.%d.%s.%s<br />\n", $singleban['ip_octet1'], $singleban['ip_octet2'], $singleban['ip_octet3'] == -1 ? "*" : $singleban['ip_octet3'], $singleban['ip_octet4'] == -1 ? "*" : $singleban['ip_octet4']); if ($singleban['postdata']) { $fixbody = str_replace(">", ">", $singleban['postdata']); $fixbody = str_replace("&gt;", ">", $fixbody); $fixbody = str_replace("<", "<", $fixbody); $fixbody = str_replace("&lt;", "<", $fixbody); echo 'Associated post:<br />' . nl2br($fixbody) . '<br /><br />'; } $reason = ""; if (!$singleban['privatereason']) { $reason = $singleban['publicreason']; } else { $reason = $singleban['privatereason']; } if (!$reason) { $reason = 'No reason given'; } else { echo 'Reason given: ' . $reason . '<br /><br />'; } if ($singleban['duration'] == 0) { echo 'This is only a warning and will be removed from the active bans list. Keep in mind however that if you are warned multiple times you may be permabanned.'; } else { if ($singleban['duration'] == -1) { echo 'This ban will not expire.<br /><br />'; $unbanned = 0; // still banned } else { //we'll need to know the difference between the ban time and the duration for actually expiring the bans $offset = THtimeoffset * 60; $now = time() + $offset; $banoffset = $singleban['duration'] * 3600; // convert to hours $expiremath = $banoffset + $singleban['bantime']; if ($now > $expiremath) { echo 'This ban has expired. Keep in mind that you may be rebanned at any time.<br /><br />'; } else { echo 'This ban duration was set to ' . $singleban['duration'] . ' hours. The ban will expire on ' . strftime(THdatetimestring, $expiremath) . '<br /><br />'; $unbanned = 0; // still banned } } } } if ($unbanned == 1) { echo '<div style="text-align: center;"><a href="' . THurl . '">Continue to the main index</a></div>'; } else { echo "If you feel this ban is in error, please email an administrator."; } echo '</body></html>'; } else { $sm = sminit("error.tpl", $err); $sm->assign_by_ref("error", $err); $sm->display("error.tpl", null); die; } }
$sm->display("bottombar.tpl", null); die; } if (isset($_GET['tlist']) == true) { // Caching ID format: t<board>-tlist-<template> $cid = "t" . $boardid . "-tlist"; $sm = sminit("threadlist.tpl", $cid, $template, false); $db = new ThornBoardDBI($boardid, $page, $on); $sm->register_object("it", $db, array("getallthreads", "binfo")); $sm->display("threadlist.tpl", $cid); $sm->display("bottombar.tpl", null); die; } elseif (isset($_GET['g']) == true) { //This page of the board... $page = abs((int) $_GET['g']); } else { $page = 0; } $tpl = "board.tpl"; // Caching ID format: b<board>-<page>-<template> $cid = "b" . $boardid . "-" . $page . "-" . $template; $modvar = is_in_csl($boardid, $_SESSION['mod_array']); // individual board moderator $sm = sminit($tpl, $cid, $template, false, $modvar); $sm->assign('modvar', $modvar); //var_dump($obj); $db = new ThornBoardDBI($boardid, $page, $on); $sm->register_object("it", $db, array("getallthreads", "getsthreads", "getindex", "binfo", "page", "allthreadscalmerge", "blotterentries")); $sm->assign('template', $template); //here we go with a bunch of retarded variables that later we can turn into an array (looks like i kopiped this) $sm->assign('username', $_SESSION['username']);
} $db = new ThornDBI(); $archivelink .= $db->getboardname(THnewsboard) . '">Full News Archive</a>'; //make our link ?> </div> </div> </div> <?php include "menu.php"; ?> <?php if ($archivelink) { echo '<div style="text-align: center;" style="font-family:verdana,century;font-size:10px;padding-bottom: 10px;">- ' . $archivelink . " -</div>\n"; } //Otherwise, we'll use static pages } else { $db = new ThornToolsDBI(); $pagedata = $db->getstaticpage("FrontPage"); if ($pagedata == null) { $pagedata = "<br />This site is powered by the drydock image board script."; } // Caching ID format: p<pageid> $cid = "p" . $pagedata['id']; // Initialize the Smarty object, display the object, and go $sm = sminit("staticpage.tpl", $cid, THtplset); $sm->assign_by_ref("page", $pagedata); $sm->display("staticpage.tpl", $cid); $sm->display("bottombar.tpl", null); }
THdie('Thread moved.<br /><a href="' . THurl . $destboard_name . '/thread/' . $newthreadspot . '">Return to thread</a>'); } else { THdie('Thread moved.<br /><a href="' . THurl . 'drydock.php?b=' . $destboard_name . '&i=' . $newthreadspot . '">Return to thread</a>'); } } else { THdie("Invalid move thread attempt!"); } } // Some stuff might have changed after all that, so let's refetch the data $postarray = $db->getsinglepost($postid, $board_id); $postarray['images'] = $db->getimgs($postarray['imgidx']); // Get the boards array, to possibly show a list for moving $boards = array(); $boards = $db->getboard(); // No parameters means everything gets fetched $sm = sminit("adminedit.tpl", null, "_admin", true); // Admin mode means NO caching. (and we provided a null id anyway) // $sm->debugging = true; // debug for now // $sm->debug_tpl = THpath."_Smarty/debug.tpl"; // These can be pretty big, so we're going to assign by reference. $sm->assign_by_ref("boards", $boards); $sm->assign_by_ref("postarray", $postarray); // Contains all the post data // Board information $sm->assign("boardname", $board_folder); $sm->assign("boardid", $board_id); // Specific post location information $sm->assign("threadid", $threadid); $sm->assign("postid", $postid); // Misc $sm->assign("adminpowers", $adminpowers);
if ($filetype == "png") { header("Content-type: image/png"); } else { if ($filetype == "gif") { header("Content-type: image/gif"); } else { die; } } } readfile('./unlinked/' . $_GET['filename']); } die; // we're done here } $sm = sminit(null, null, null, true); if (isset($_GET['a'])) { if ($_GET['a'] == "b") { // We have to assign these to be able to set disabled attributes for the checkboxes for file formats // (i.e., greying out the SVG file type box when THuseSVG is 0) $sm->assign("THuseSVG", THuseSVG); $sm->assign("THuseSWFmeta", THuseSWFmeta); $sm->assign("THSVGthumbnailer", THSVGthumbnailer); //Assign other template sets $sets = array(); //Read template sets $it = opendir(THpath . "tpl/"); while (($set = readdir($it)) !== false) { if (in_array($set, array(".", "..", "_admin", ".svn", "_compd", "profiles")) == false && is_dir(THpath . "tpl/" . $set)) { $sets[] = $set; }
// Basic post information $report['post'] = $db->getsinglepost($report['postid'], $report['board']); // Add in the thread location (globalid) if ($report['post']['thread'] == 0) { $report['post']['thread_globalid'] = $report['post']['globalid']; } else { // Get the thread globalid $loc_array = $db->getpostlocation($report['post']['thread']); $report['post']['thread_globalid'] = $loc_array['thread_loc']; } // Add in images $report['post']['images'] = $db->getimgs($report['post']['imgidx']); // Round off report information $report['category'] = round($report['avg_category']); $processed_reports[] = $report; } // Get the boards array, to show a list for filtering $boards = array(); $boards = $db->getboard(); // No parameters means everything gets fetched $sm = sminit("adminreports.tpl", null, "_admin", true); // Admin mode means NO caching. (and we provided a null id anyway) // These can be pretty big, so we're going to assign by reference. $sm->assign_by_ref("reports", $processed_reports); $sm->assign_by_ref("boards", $boards); $sm->assign("board_folder", $board_folder); // name of the folder (for filtering) // Show it! $sm->display("adminreports.tpl", null); die; }