本文整理汇总了PHP中page_limit函数的典型用法代码示例。如果您正苦于以下问题:PHP page_limit函数的具体用法?PHP page_limit怎么用?PHP page_limit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了page_limit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* 书籍管理主页
*
* @author frenlee <frenlee@163.com>
* @since 2015年5月13日 上午10:39:17
*/
function index($catid = '', $start = '', $end = '', $p = '0')
{
$m = D('Booklist');
$map = array();
$limit = page_limit($p);
$order = 'id desc';
$data = $m->where($map)->order($order)->limit($limit)->select();
$this->assign('info', $data);
//列表数据
$this->display();
}
示例2: showList
function showList($id = '', $p = '0')
{
if (empty($id)) {
return false;
}
$b = M('booklist');
$book = $b->field('isbn,title,today')->find($id);
$this->assign('book', $book);
$map = array('bookid' => $id);
$m = D('Annotations');
$limit = page_limit($p);
$data = $m->where($map)->limit($limit)->select();
$this->assign('info', $data);
$this->display();
}
示例3: index
/**
* 首页
* @param number $p
* @author frenlee <frenlee@163.com>
* @since 2015年5月14日 下午1:24:54
*/
function index($p = 0)
{
$m = D('Type');
if (IS_POST) {
//添加
$data = $m->create();
if ($data) {
$m->add();
$this->ajaxReturn(ajax_return_data());
} else {
$this->ajaxReturn(ajax_return_data(1, $m->getError()));
}
}
//显示
$limit = page_limit($p);
$data = $m->limit($limit)->select();
$this->assign('info', $data);
$this->display();
}
示例4: index
public function index()
{
$page = rintval(I('get.p', 1));
$start = null;
$limit = $this->limit;
list($start, $limit, $page) = page_limit($page, $limit);
$count = null;
$list = array();
$order = 'aid desc';
$search = I('get.');
$this->__proFilter($search);
$data = $this->objListServ->getAdminArticleList($search, $start, $limit, $order);
list($count, $list) = $data;
$this->_assignPage($count, $limit, $search);
$this->__assignCate();
$this->assign('count', $count);
$this->assign('list', $list);
$search['act_url'] = U('Home/Admin/Index/index');
$this->assign('search', $search);
$this->loadSystemView();
}
示例5: foreach
}
foreach ($TimelineIn as $Month) {
list($Label, $Amount) = $Month;
$Labels[] = $Label;
$InFlow[] = number_format($Amount / $Max * 100, 4);
}
foreach ($TimelineOut as $Month) {
list($Label, $Amount) = $Month;
$OutFlow[] = number_format($Amount / $Max * 100, 4);
}
$Cache->cache_value('users_timeline', array($Labels, $InFlow, $OutFlow, $Max), mktime(0, 0, 0, date('n') + 1, 2));
}
}
//End timeline generation
define('DAYS_PER_PAGE', 100);
list($Page, $Limit) = page_limit(DAYS_PER_PAGE);
$RS = $DB->query("SELECT\n\t\tSQL_CALC_FOUND_ROWS\n\t\tj.Date,\n\t\tDATE_FORMAT(j.Date,'%Y-%m') AS Month,\n\t\tCASE ISNULL(j.Flow)\n\t\t\tWHEN 0 THEN j.Flow\n\t\t\tELSE '0'\n\t\tEND AS Joined,\n\t\tCASE ISNULL(m.Flow)\n\t\t\tWHEN 0 THEN m.Flow\n\t\t\tELSE '0'\n\t\tEND AS Manual,\n\t\tCASE ISNULL(r.Flow)\n\t\t\tWHEN 0 THEN r.Flow\n\t\t\tELSE '0'\n\t\tEND AS Ratio,\n\t\tCASE ISNULL(i.Flow)\n\t\t\tWHEN 0 THEN i.Flow\n\t\t\tELSE '0'\n\t\tEND AS Inactivity\n\t\tFROM (\n\t\t\tSELECT\n\t\t\t\tDATE_FORMAT(JoinDate,'%Y-%m-%d') AS Date,\n\t\t\t\tCOUNT(UserID) AS Flow\n\t\t\t\tFROM users_info\n\t\t\t \tWHERE JoinDate != '0000-00-00 00:00:00'\n\t\t\t\tGROUP BY Date\n\t\t) AS j\n\t\tLEFT JOIN (\n\t\t\tSELECT\n\t\t\t\tDATE_FORMAT(BanDate,'%Y-%m-%d') AS Date,\n\t\t\t \tCOUNT(UserID) AS Flow\n\t\t\t \tFROM users_info\n\t\t\t \tWHERE BanDate != '0000-00-00 00:00:00'\n\t\t\t \tAND BanReason = '1'\n\t\t\t \tGROUP BY Date\n\t\t) AS m ON j.Date=m.Date\n\t\tLEFT JOIN (\n\t\t\tSELECT\n\t\t\t\tDATE_FORMAT(BanDate,'%Y-%m-%d') AS Date,\n\t\t\t \tCOUNT(UserID) AS Flow\n\t\t\t \tFROM users_info\n\t\t\t \tWHERE BanDate != '0000-00-00 00:00:00'\n\t\t\t \tAND BanReason = '2'\n\t\t\t \tGROUP BY Date\n\t\t) AS r ON j.Date=r.Date\n\t\tLEFT JOIN (\n\t\t\tSELECT\n\t\t\t\tDATE_FORMAT(BanDate,'%Y-%m-%d') AS Date,\n\t\t\t \tCOUNT(UserID) AS Flow\n\t\t\t \tFROM users_info\n\t\t\t \tWHERE BanDate != '0000-00-00 00:00:00'\n\t\t\t \tAND BanReason = '3'\n\t\t\t \tGROUP BY Date\n\t\t) AS i ON j.Date=i.Date\n\t\tORDER BY j.Date DESC\n\t\tLIMIT {$Limit}");
$DB->query("SELECT FOUND_ROWS()");
list($Results) = $DB->next_record();
$DB->set_query_id($RS);
show_header('User Flow');
?>
<div class="thin">
<?php
if (!isset($_GET['page'])) {
?>
<div class="box pad">
<img src="http://chart.apis.google.com/chart?cht=lc&chs=820x160&chco=000D99,99000D&chg=0,-1,1,1&chxt=y,x&chxs=0,h&chxl=1:|<?php
echo implode('|', $Labels);
?>
&chxr=0,0,<?php
示例6: create_footer
function create_footer(){
// Bottom pagination
?>
<div class="linkbox">
<?
//---------------------------------------------------
list($Page,$Limit) = page_limit(REQUESTS_PER_PAGE);
echo get_pages($Page,$this->Results,REQUESTS_PER_PAGE, 11);
//--------------------------------------------------------
?>
</div>
</div>
<?
} // create_footer
示例7: array
$Bans = $Cache->get_value('ip_bans');
$Cache->begin_transaction();
$Cache->update_row($_POST['id'], array($_POST['id'], $Start, $End));
$Cache->commit_transaction();
} else {
//Create
$DB->query("INSERT INTO ip_bans\n\t\t\t\t(FromIP, ToIP, Reason) VALUES\n\t\t\t\t('{$Start}','{$End}', '{$Notes}')");
$ID = $DB->inserted_id();
$Bans = $Cache->get_value('ip_bans');
$Bans[$ID] = array($ID, $Start, $End);
$Cache->cache_value('ip_bans', $Bans, 0);
}
}
}
define('BANS_PER_PAGE', '20');
list($Page, $Limit) = page_limit(BANS_PER_PAGE);
$sql = "SELECT SQL_CALC_FOUND_ROWS ID, FromIP, ToIP, Reason FROM ip_bans AS i ";
if (!empty($_REQUEST['notes'])) {
$sql .= "WHERE Reason LIKE '%" . db_string($_REQUEST['notes']) . "%' ";
}
if (!empty($_REQUEST['ip']) && preg_match('/\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}/', $_REQUEST['ip'])) {
if (!empty($_REQUEST['notes'])) {
$sql .= "AND '" . ip2unsigned($_REQUEST['ip']) . "' BETWEEN FromIP AND ToIP ";
} else {
$sql .= "WHERE '" . ip2unsigned($_REQUEST['ip']) . "' BETWEEN FromIP AND ToIP ";
}
}
$sql .= "ORDER BY FromIP ASC";
$sql .= " LIMIT " . $Limit;
$Bans = $DB->query($sql);
$DB->query('SELECT FOUND_ROWS()');
示例8: json_encode
/*
User topic subscription page
*/
if (!empty($LoggedUser['DisableForums'])) {
print json_encode(array('status' => 'failure'));
die;
}
include SERVER_ROOT . '/classes/class_text.php';
// Text formatting class
$Text = new TEXT();
if (isset($LoggedUser['PostsPerPage'])) {
$PerPage = $LoggedUser['PostsPerPage'];
} else {
$PerPage = POSTS_PER_PAGE;
}
list($Page, $Limit) = page_limit($PerPage);
if ($LoggedUser['CustomForums']) {
unset($LoggedUser['CustomForums']['']);
$RestrictedForums = implode("','", array_keys($LoggedUser['CustomForums'], 0));
$PermittedForums = implode("','", array_keys($LoggedUser['CustomForums'], 1));
}
$ShowUnread = !isset($_GET['showunread']) && !isset($HeavyInfo['SubscriptionsUnread']) || isset($HeavyInfo['SubscriptionsUnread']) && !!$HeavyInfo['SubscriptionsUnread'] || isset($_GET['showunread']) && !!$_GET['showunread'];
$ShowCollapsed = !isset($_GET['collapse']) && !isset($HeavyInfo['SubscriptionsCollapse']) || isset($HeavyInfo['SubscriptionsCollapse']) && !!$HeavyInfo['SubscriptionsCollapse'] || isset($_GET['collapse']) && !!$_GET['collapse'];
$sql = 'SELECT
SQL_CALC_FOUND_ROWS
MAX(p.ID) AS ID
FROM forums_posts AS p
LEFT JOIN forums_topics AS t ON t.ID = p.TopicID
JOIN users_subscriptions AS s ON s.TopicID = t.ID
LEFT JOIN forums AS f ON f.ID = t.ForumID
LEFT JOIN forums_last_read_topics AS l ON p.TopicID = l.TopicID AND l.UserID = s.UserID
示例9: define
define ("DB_PASSWORD", "' . DB_PASSWORD . '"); // пароль для доступа к БД
define ("SITE_NAME", "' . SITE_NAME . '"); // название сайта
define ("TEMPLATE", "' . TEMPLATE . '"); // тема оформления
define ("VERSION", "' . VERSION . '"); // текущая версия CMS
define ("LOG_LEVEL", "' . $_POST['log_level'] . '"); // уровень детализации журнала
?>';
$fop = fopen($_SERVER["DOCUMENT_ROOT"] . '/config.php', 'w');
if ($fwr = fwrite($fop, $w_string)) {
fclose($fop);
$message = 'Настройки журнала обновлены';
} else {
$error = 'Возникла ошибка при обновлении настроек журнала';
}
}
// Выводим журнал
if (($_GET['action'] == 'list' || $_GET['action'] == 'delete') && empty($error)) {
$limit = '10';
// количесвто результатов на страницу
page_limit($limit);
// считаем количество страниц
// поля разрешенные для сортировки
!in_array($_GET['order'], array('user', 'type', 'status', 'ip', 'date')) ? $order = 'date' : ($order = $_GET['order']);
$user_list = $db->getIndCol("id", "SELECT id, login FROM " . DB_PREFIX . "_users");
$log_list = $db->getAll("SELECT * FROM " . DB_PREFIX . "_logs ORDER BY ?n DESC LIMIT ?i, ?i", $order, $start, $end);
$tpl = 'logs_list_tpl.php';
}
// Выводим найстройки журнала
if ($_GET['action'] == 'settings' && empty($error)) {
$tpl = 'logs_settings_tpl.php';
}
include "logs_main_tpl.php";
示例10: list
//---------- Things to sort out before it can start printing/generating content
// Check for lame SQL injection attempts
$ForumID = $_GET['forumid'];
if(!is_number($ForumID)) {
error(0);
}
if (isset($LoggedUser['PostsPerPage'])) {
$PerPage = $LoggedUser['PostsPerPage'];
} else {
$PerPage = POSTS_PER_PAGE;
}
list($Page,$Limit) = page_limit(TOPICS_PER_PAGE);
//---------- Get some data to start processing
// Caching anything beyond the first page of any given forum is just wasting ram
// users are more likely to search then to browse to page 2
if($Page==1) {
list($Forum,,,$Stickies) = $Cache->get_value('forums_'.$ForumID);
}
if(!isset($Forum) || !is_array($Forum)) {
$DB->query("SELECT
t.ID,
t.Title,
t.AuthorID,
author.Username AS AuthorUsername,
t.IsLocked,
示例11: define
define('ASN_PER_PAGE', 100);
if (!check_perms('users_view_ips')) {
error(403);
}
$UserID = $_GET['userid'];
if (!is_number($UserID)) {
error(404);
}
$UsersOnly = $_GET['usersonly'];
$DB->query("SELECT UserName FROM users_main WHERE ID = {$UserID}");
list($Username) = $DB->next_record();
show_header("ASN history for {$Username}");
?>
<div class="thin">
<?php
list($Page, $Limit) = page_limit(ASN_PER_PAGE);
if ($UsersOnly == 1) {
$RS = $DB->query("SELECT SQL_CALC_FOUND_ROWS\n\t h1.ASN,\n\t \th1.StartTime,\n\t \th1.EndTime,\n\t GROUP_CONCAT(h2.UserID SEPARATOR '|'),\n\t GROUP_CONCAT(h2.StartTime SEPARATOR '|'),\n\t GROUP_CONCAT(h2.EndTime SEPARATOR '|'),\n\t GROUP_CONCAT(um2.Username SEPARATOR '|'),\n\t \tGROUP_CONCAT(um2.Enabled SEPARATOR '|'),\n\t GROUP_CONCAT(ui2.Donor SEPARATOR '|'),\n\t GROUP_CONCAT(ui2.Warned SEPARATOR '|')\n\t FROM users_history_asns AS h1\n\t LEFT JOIN users_history_asns AS h2 ON h2.ASN=h1.ASN AND h2.UserID!={$UserID}\n\t LEFT JOIN users_main AS um2 ON um2.ID=h2.UserID\n\t LEFT JOIN users_info AS ui2 ON ui2.UserID=h2.UserID\n\t\tWHERE h1.UserID='{$UserID}'\n\t\tAND h2.UserID>0\n\t GROUP BY h1.ASN, h1.StartTime\n\t\tORDER BY h1.StartTime DESC LIMIT {$Limit}");
} else {
$RS = $DB->query("SELECT SQL_CALC_FOUND_ROWS\n\t\th1.ASN, \n\t\th1.StartTime, \n\t\th1.EndTime,\n\t\tGROUP_CONCAT(h2.UserID SEPARATOR '|'),\n\t\tGROUP_CONCAT(h2.StartTime SEPARATOR '|'),\n\t\tGROUP_CONCAT(h2.EndTime SEPARATOR '|'),\n\t\tGROUP_CONCAT(um2.Username SEPARATOR '|'),\n\t\tGROUP_CONCAT(um2.Enabled SEPARATOR '|'),\n\t\tGROUP_CONCAT(ui2.Donor SEPARATOR '|'),\n\t\tGROUP_CONCAT(ui2.Warned SEPARATOR '|')\n\t\tFROM users_history_asns AS h1\n\t\tLEFT JOIN users_history_asns AS h2 ON h2.ASN=h1.ASN AND h2.UserID!={$UserID}\n\t\tLEFT JOIN users_main AS um2 ON um2.ID=h2.UserID\n\t\tLEFT JOIN users_info AS ui2 ON ui2.UserID=h2.UserID\n\t\tWHERE h1.UserID='{$UserID}'\n\t\tGROUP BY h1.ASN, h1.StartTime\n\t\tORDER BY h1.StartTime DESC LIMIT {$Limit}");
}
$DB->query("SELECT FOUND_ROWS()");
list($NumResults) = $DB->next_record();
$DB->set_query_id($RS);
$Pages = get_pages($Page, $NumResults, ASN_PER_PAGE, 9);
?>
<h2>ASN history for <a href="/user.php?id=<?php
echo $UserID;
?>
"><?php
echo $Username;
示例12: define
<?
define('COLLAGES_PER_PAGE', 25);
include(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
$Text = new TEXT;
list($Page,$Limit) = page_limit(COLLAGES_PER_PAGE);
$OrderVals = array('Time', 'Name', 'Torrents');
$WayVals = array('Ascending', 'Descending');
$OrderTable = array('Time'=>'ID', 'Name'=>'c.Name', 'Torrents'=>'NumTorrents');
$WayTable = array('Ascending'=>'ASC', 'Descending'=>'DESC');
// Are we searching in bodies, or just names?
if(!empty($_GET['type'])) {
$Type = $_GET['type'];
if(!in_array($Type, array('c.name', 'description'))) {
$Type = 'c.name';
}
} else {
$Type = 'c.name';
}
if(!empty($_GET['search'])) {
// What are we looking for? Let's make sure it isn't dangerous.
$Search = strtr(db_string(trim($_GET['search'])),$SpecialChars);
// Break search string down into individual words
$Words = explode(' ', $Search);
}
示例13: define
<?
if(!check_perms('site_torrents_notify')) { error(403); }
define('NOTIFICATIONS_PER_PAGE', 50);
list($Page,$Limit) = page_limit(NOTIFICATIONS_PER_PAGE);
$Results = $DB->query("SELECT SQL_CALC_FOUND_ROWS
t.ID,
g.ID,
g.Name,
g.CategoryID,
g.TagList,
t.Size,
t.FileCount,
t.Format,
t.Encoding,
t.Media,
t.Scene,
t.RemasterYear,
g.Year,
t.RemasterYear,
t.RemasterTitle,
t.Snatched,
t.Seeders,
t.Leechers,
t.Time,
unt.UnRead,
unt.FilterID,
unf.Label
FROM users_notify_torrents AS unt
JOIN torrents AS t ON t.ID=unt.TorrentID
示例14: time
parse_str($LoggedUser['DefaultSearch'],$_GET);
}
// If a user is hammering the search page (either via a <script type="text/javascript">, or just general zeal)
if($_SERVER['QUERY_STRING'] != '' && !check_perms('torrents_search_fast') && $_SERVER['QUERY_STRING'] != 'action=basic' && $_SERVER['QUERY_STRING'] != 'action=advanced') {
if($LoggedUser['last_browse']>time()-1) {
error('You can only search for torrents once every second.');
} else {
$_SESSION['logged_user']['last_browse'] = time();
}
}
$OrderBy="s3"; // We order by GroupTime by default
$OrderWay="DESC"; // We also order descending by default
list($Page,$Limit) = page_limit(TORRENTS_PER_PAGE);
if (preg_match('/^s[1-7]$/',$_GET['order_by'])) { $OrderBy=strtolower($_GET['order_by']); }
if (in_array(strtolower($_GET['order_way']),array('desc','asc'))) { $OrderWay=strtoupper($_GET['order_way']); }
// Uploaded, seeding, leeching, snatched lists
if($_GET['userid'] && is_number($_GET['userid'])) {
$UserID=ceil($_GET['userid']);
$DB->query("SELECT Paranoia FROM users_main WHERE ID='".$UserID."'");
list($Paranoia)=$DB->next_record();
$TorrentWhere='';
$TorrentJoin='';
if($_GET['type']=="uploaded") {
if(!check_perms('users_view_uploaded') && $UserID != $LoggedUser['ID'] && $Paranoia>=3) { error(403); }
示例15: get_catalog_list
function get_catalog_list($limit)
{
global $db;
global $start;
global $end;
page_limit($limit);
$result = $db->getAll('SELECT id, title, phone, city, street, build FROM ' . DB_PREFIX . '_catalog ORDER BY id LIMIT ?i, ?i', $start, $end);
return $result;
}