Public feed #727054

Anonymous

public php v1 · immutable
Raw Edit
·published 2007-10-05 18:37 UTC
rendered paste body
}function miniblog_create_archive_url($limit, $offset, $category) {   $current_url = $_SERVER['REQUEST_URI'];   $current_limit = intval($_GET['limit']);   $current_offset = intval($_GET['offset']);   $current_category = trim($_GET['category']); /* if(empty($current_category) && isset($category)) {    $category = $category;  } elseif(!empty($current_category) && empty($category)) {  	$category = $current_category;  } else {    $category = "all";  }*/  // $_SESSION['offset'] .= $offset."\n";   $miniblog_url = preg_replace('/limit=(\d+)/i', 'limit='.$limit, $current_url);   $miniblog_url = preg_replace('/offset=(\d+)/i', 'offset='.$offset, $current_url);    $miniblog_url = preg_replace('/category=(\w+)/s', 'category='.$category, $current_url);	$miniblog_url = str_replace("&empty=TRUE", "", $miniblog_url);    $_SESSION['debug'] .= $miniblog_url."\n";   if($current_limit == 0 && $current_offset == 0) {      if(strpos($current_url, '?') !== false) {         $miniblog_url = "$miniblog_url&amp;limit=$limit&amp;offset=$offset&amp;category=$category";      } else {         $miniblog_url = "$miniblog_url?limit=$limit&amp;offset=$offset&amp;category=$category";      }   }   $_SESSION['url'] .= $miniblog_url."\n";   return $miniblog_url; }   $limit = $_REQUEST['limit'];   $offset = $_GET['offset'];   $category = trim($_GET['category']);   $cnt = $_GET['cnt'];	if ($offset > 0) {					echo '<a href="' . miniblog_create_archive_url($limit, ((($offset-$limit) > 0) ? ($offset-$limit) : 0), $category) . '">Previous Page</a>';			echo '&nbsp;</td><td width="50%" align="right">&nbsp;'; // Not sure where this would go now			} elseif($cnt > ($offset+$limit)) {					echo '<a href="' . miniblog_create_archive_url($limit, ($offset+$limit), $category) . '">Next Page</a>';			}