All pastes #551690 Raw Edit

Mine

public php v1 · immutable
·published 2007-06-08 22:16 UTC
rendered paste body
// Pagination scripting follows				if ($user->isFriend() OR $user->isAdmin()) {					$count_posts = mysql_query("SELECT `id` FROM `".$sql->prefix."posts` WHERE `pinned` != 'on' AND `draft` != 'on' AND `type` != 'page'");				} else {					$count_posts = mysql_query("SELECT `id` FROM `".$sql->prefix."posts` WHERE `pinned` != 'on' AND `draft` != 'on' AND `type` != 'page' AND `status` = 'public'");				}				$total_results = mysql_num_rows($count_posts);				if ($req[0] != "page") {					$page = "1";				} else {					$page = $req[1];				}				$limit = $config->portal_posts; // Posts per page				$total_pages = ceil($total_results / $limit); // Pages required				$prevpage = $page - 1;				$nextpage = $page + 1;				$offset = ($page - 1) * $limit;				echo "<div id=\"normalposts\">";				 // Grab & display regular posts				if ($user->isFriend() OR $user->isAdmin()) {					$get_posts = mysql_query("SELECT * FROM `".$sql->prefix."posts` WHERE `pinned` != 'on' AND `draft` != 'on' AND `type` != 'page' ORDER BY `id` DESC LIMIT ".$offset.", ".$limit) or die(mysql_error());				} else {					$get_posts = mysql_query("SELECT * FROM `".$sql->prefix."posts` WHERE `pinned` != 'on' AND `draft` != 'on' AND `type` != 'page' AND `status` = 'public' ORDER BY `id` DESC LIMIT ".$offset.", ".$limit);				}-----------function prevPage() {				global $config, $theme, $user, $show, $text, $page, $total_results, $limit, $total_pages, $prevpage, $nextpage, $offset, $theme;				if ($page != 1) {					echo str_replace("{LINK}",$config->site_url."/page/".$prevpage."/",$theme->prev_link);				}			}			function nextPage() {				global $config, $theme, $user, $show, $text, $req;				if ($req[0] != "page") {					$page = "1";					$nextpage = "2";				} else {					global $page, $nextpage;				}				global $total_results, $limit, $total_pages, $prevpage, $offset, $theme;				if ($page != $total_pages AND $total_results > $limit) {					echo str_replace("{LINK}",$config->site_url."/page/".$nextpage."/",$theme->next_link);				}			}