本文整理汇总了PHP中COM_printPageNavigation函数的典型用法代码示例。如果您正苦于以下问题:PHP COM_printPageNavigation函数的具体用法?PHP COM_printPageNavigation怎么用?PHP COM_printPageNavigation使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了COM_printPageNavigation函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: MG_selectUsers
function MG_selectUsers($page)
{
global $glversion, $_CONF, $_MG_CONF, $_TABLES, $_USER, $LANG_MG00, $LANG_MG01;
$retval = '';
$T = new Template($_MG_CONF['template_path']);
$T->set_file('admin', 'createmembers.thtml');
$T->set_var(array('site_admin_url' => $_CONF['site_admin_url'], 'site_url' => $_CONF['site_url'], 'xhtml' => XHTML));
$T->set_block('admin', 'UserRow', 'uRow');
$start = $page * 50;
$end = 50;
$sql = "SELECT COUNT(gl.uid) AS count " . "FROM {$_TABLES['users']} AS gl " . "LEFT JOIN {$_TABLES['mg_userprefs']} AS mg ON gl.uid=mg.uid " . "WHERE gl.status = 3 AND gl.uid > 2 AND (mg.member_gallery IS NULL OR mg.member_gallery < 1)";
$result = DB_query($sql);
list($total_records) = DB_fetchArray($result);
$sql = "SELECT gl.uid, gl.status, gl.username, gl.fullname, mg.member_gallery " . "FROM {$_TABLES['users']} AS gl " . "LEFT JOIN {$_TABLES['mg_userprefs']} AS mg ON gl.uid=mg.uid " . "WHERE gl.status = 3 AND gl.uid > 2 AND (mg.member_gallery IS NULL OR mg.member_gallery < 1) " . "ORDER BY gl.username ASC LIMIT {$start},{$end}";
$result = DB_query($sql);
while ($row = DB_fetchArray($result)) {
if ($glversion[1] < 4) {
$row['status'] = 3;
}
$uid = $row['uid'];
$remote = SEC_inGroup("Remote Users", $uid) ? '(r)' : '';
$username = $row['username'];
$member_gallery = $row['member_gallery'];
$T->set_var(array('uid' => $uid, 'username' => $username . ' ' . $remote . ' - ' . $row['fullname'], 'select' => '<input type="checkbox" name="user[]" value="' . $uid . '"' . XHTML . '>'));
$T->parse('uRow', 'UserRow', true);
}
$T->set_var(array('lang_userid' => $LANG_MG01['userid'], 'lang_username' => $LANG_MG01['username'], 'lang_select' => $LANG_MG01['select'], 'lang_checkall' => $LANG_MG01['check_all'], 'lang_uncheckall' => $LANG_MG01['uncheck_all'], 'lang_save' => $LANG_MG01['save'], 'lang_cancel' => $LANG_MG01['cancel'], 'lang_reset' => $LANG_MG01['reset'], 's_form_action' => $_MG_CONF['admin_url'] . 'createmembers.php', 'pagenav' => COM_printPageNavigation($_MG_CONF['admin_url'] . 'createmembers.php', $page + 1, ceil($total_records / 50))));
$retval .= $T->finish($T->parse('output', 'admin'));
return $retval;
}
示例2: PLG_showCenterblock
$articleCounter++;
}
// get plugin center blocks that follow articles
$pageBody .= PLG_showCenterblock(CENTERBLOCK_BOTTOM, $page, $topic);
// bottom blocks
// Print Google-like paging navigation
if (!isset($_CONF['hide_main_page_navigation']) || $_CONF['hide_main_page_navigation'] == 0) {
if (empty($topic)) {
$base_url = $_CONF['site_url'] . '/index.php';
if ($newstories) {
$base_url .= '?display=new';
}
} else {
$base_url = $_CONF['site_url'] . '/index.php?topic=' . $topic;
}
$pageBody .= '<div class="aligncenter">' . COM_printPageNavigation($base_url, $page, $num_pages) . '</div>';
}
} else {
// no stories to display
$cbDisplay = '';
$cbDisplay .= PLG_showCenterblock(CENTERBLOCK_AFTER_FEATURED, $page, $topic);
$cbDisplay .= PLG_showCenterblock(CENTERBLOCK_BOTTOM, $page, $topic);
// bottom blocks
if ((!isset($_CONF['hide_no_news_msg']) || $_CONF['hide_no_news_msg'] == 0) && $cbDisplay == '') {
// If there's still nothing to display, show any default centerblocks.
$cbDisplay .= PLG_showCenterblock(CENTERBLOCK_NONEWS, $page, $topic);
if ($cbDisplay == '') {
// If there's *still* nothing to show, show the stock message
$eMsg = $LANG05[2];
if (!empty($topic)) {
$topicname = DB_getItem($_TABLES['topics'], 'topic', "tid = '" . DB_escapeString($topic) . "'");
示例3: list
$p->set_var('LANG_deleteafter', $LANG_GF01['DELETEAFTER']);
$p->set_var('LANG_all', $LANG_GF01['ALL']);
$p->set_var('LANG_topic', $LANG_GF01['TOPIC']);
$p->set_var('LANG_title', $LANG_GF01['TITLE']);
$p->set_var('LANG_date', $LANG_GF01['DATE']);
$p->set_var('LANG_comments', $LANG_GF01['COMMENTS']);
if ($numrows > 0) {
$base_url = $_CONF['site_admin_url'] . '/plugins/forum/migrate.php?seltopic=' . $curtopic;
for ($i = 0; $i < $numrows; $i++) {
list($topic, $sid, $story, $date, $comments) = DB_fetchArray($result);
$p->set_var('sid', $sid);
$p->set_var('topic', $topic);
if (isset($_POST['seltopic']) && $_POST['seltopic'] == "submissions") {
$p->set_var('story_link', $_CONF['site_admin_url'] . '/story.php?moderate=x&sid=' . $sid);
} else {
$p->set_var('story_link', $_CONF['site_url'] . '/article.php?story=' . $sid);
}
$p->set_var('story_title', $story);
$p->set_var('date', $date);
$p->set_var('num_comments', $comments);
$p->set_var('cssid', $i % 2 + 1);
$p->parse('story_record', 'records', true);
}
$p->set_var('page_navigation', COM_printPageNavigation($base_url, $page, $numpages));
}
$p->parse('output', 'page');
$display .= $p->finish($p->get_var('output'));
$display .= COM_endBlock();
$display .= FF_adminfooter();
$display .= FF_siteFooter();
echo $display;
示例4: banner_list
//.........这里部分代码省略.........
$bannerlist->set_var('category_navigation', '');
}
} else {
$bannerlist->set_var('category_navigation', '');
}
if ($_BAN_CONF['bannercols'] == 0) {
$bannerlist->set_var('category_dropdown', '');
} else {
$bannerlist->parse('category_dropdown', 'catdrop', true);
}
$bannerlist->set_var('site_url', $_CONF['site_url']);
$bannerlist->set_var('cid', $cid);
$bannerlist->set_var('cid_plain', $cid);
$bannerlist->set_var('cid_encoded', urlencode($cid));
$bannerlist->set_var('lang_addabanner', $LANG_BANNER[116]);
// Build SQL for banner
$sql = 'SELECT bid,cid,url,description,title,hits,owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon';
$from_where = " FROM {$_TABLES['banner']}";
if ($_BAN_CONF['bannercols'] > 0) {
if (!empty($cid)) {
$from_where .= " WHERE cid='" . addslashes($cid) . "'";
} else {
$from_where .= " WHERE cid=''";
}
$from_where .= ' AND (publishstart IS NULL OR publishstart < NOW()) and (publishend IS NULL OR publishend > NOW())';
$from_where .= COM_getPermSQL('AND');
} else {
$from_where .= COM_getPermSQL();
}
$order = ' ORDER BY cid ASC,title';
$limit = '';
if ($_BAN_CONF['bannerperpage'] > 0) {
if ($page < 1) {
$start = 0;
} else {
$start = ($page - 1) * $_BAN_CONF['bannerperpage'];
}
$limit = ' LIMIT ' . $start . ',' . $_BAN_CONF['bannerperpage'];
}
$result = DB_query($sql . $from_where . $order . $limit);
$nrows = DB_numRows($result);
if ($nrows == 0) {
if ($cid == $_BAN_CONF['root'] && $page <= 1 && $_BAN_CONF['show_top10']) {
$result = DB_query("SELECT bid,url,title,description,hits,owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon FROM {$_TABLES['banner']} WHERE (hits > 0) AND (publishstart IS NULL OR publishstart < NOW()) and (publishend IS NULL OR publishend > NOW())" . COM_getPermSQL('AND') . " ORDER BY hits DESC LIMIT 10");
$nrows = DB_numRows($result);
if ($nrows > 0) {
$bannerlist->set_var('banner_details', '');
$bannerlist->set_var('banner_category', $LANG_BANNER_STATS['stats_headline']);
for ($i = 0; $i < $nrows; $i++) {
$A = DB_fetchArray($result);
prepare_banner_item($A, $bannerlist);
$bannerlist->parse('banner_details', 'banner', true);
}
$bannerlist->parse('category_banner', 'catbanner', true);
}
}
$bannerlist->set_var('page_navigation', '');
} else {
$currentcid = '';
for ($i = 0; $i < $nrows; $i++) {
$A = DB_fetchArray($result);
if (strcasecmp($A['cid'], $currentcid) != 0) {
// print the category and banner
if ($i > 0) {
$bannerlist->parse('category_banner', 'catbanner', true);
$bannerlist->set_var('banner_details', '');
}
$currentcid = $A['cid'];
$currentcategory = DB_getItem($_TABLES['bannercategories'], 'category', "cid = '" . addslashes($currentcid) . "'");
$bannerlist->set_var('banner_category', $currentcategory);
}
prepare_banner_item($A, $bannerlist);
$bannerlist->parse('banner_details', 'banner', true);
}
$bannerlist->parse('category_banner', 'catbanner', true);
$result = DB_query('SELECT COUNT(*) AS count ' . $from_where);
list($numbanner) = DB_fetchArray($result);
$pages = 0;
if ($_BAN_CONF['bannerperpage'] > 0) {
$pages = (int) ($numbanner / $_BAN_CONF['bannerperpage']);
if ($numbanner % $_BAN_CONF['bannerperpage'] > 0) {
$pages++;
}
}
if ($pages > 0) {
if ($_BAN_CONF['bannercols'] > 0 && !empty($currentcid)) {
$catbanner = '?category=' . urlencode($currentcid);
} else {
$catbanner = '';
}
$bannerlist->set_var('page_navigation', COM_printPageNavigation($_CONF['site_url'] . '/banner/index.php' . $catbanner, $page, $pages));
} else {
$bannerlist->set_var('page_navigation', '');
}
}
$bannerlist->set_var('blockfooter', COM_endBlock());
$bannerlist->parse('output', 'bannerlist');
$display .= $bannerlist->finish($bannerlist->get_var('output'));
return $display;
}
示例5: Date
$comments = 0;
$linksf = 0;
$days = Date('t', mktime(0, 0, 0, $month, 1, $year));
// special case for this month - don't show days in the future
$today = getdate();
if ($today['year'] == $year and $today['mon'] == $month) {
$days = min($days, $today['mday']);
}
$num_pages = ceil($days / $_GUS_days);
if (!isset($_GET['page']) or empty($_GET['page'])) {
$curpage = 1;
} else {
$curpage = (int) $_GET['page'];
}
$base_url = GUS_create_url('page');
$navlinks = COM_printPageNavigation($base_url, $curpage, $num_pages);
$temp_table = GUS_create_temp_userstats_table($year, $month);
for ($day = 1; $day <= $days; $day++) {
if ($day > ($curpage - 1) * $_GUS_days and $day <= $curpage * $_GUS_days) {
$day_of_week = date('l', mktime(0, 0, 0, $month, $day, $year));
$date_formatted = date('l d', mktime(0, 0, 0, $month, $day, $year));
$T->set_var('day_display', $date_formatted);
$T->set_var(array('day' => $day, 'mon' => $month, 'year' => $year));
if ($day % 2) {
$T->set_var('rowclass', 'row1');
} else {
$T->set_var('rowclass', 'row2');
}
$result = DB_query("SELECT COUNT( DISTINCT ip ) AS num_anon FROM {$temp_table['name']} WHERE uid = '1' AND DAYOFMONTH( date ) = {$day}");
$row = DB_fetchArray($result, FALSE);
$anon += $row['num_anon'];
示例6: _bb_listEntries
//.........这里部分代码省略.........
if ($start > $entries) {
$start = 1;
$page = 1;
}
$donate = $LANG_BAD_BEHAVIOR['description'];
if (DB_getItem($_TABLES['vars'], 'value', "name = 'bad_behavior2.donate'") == 1) {
$donate .= '<p>' . $LANG_BAD_BEHAVIOR['donate_msg'] . '</p>' . LB;
}
// writing the menu on top
$menu_arr = array(array('url' => $_CONF['site_admin_url'] . '/plugins/bad_behavior2/ban.php', 'text' => 'List Banned IPs'), array('url' => $_CONF['site_admin_url'] . '/plugins/bad_behavior2/ban.php?mode=add', 'text' => 'Ban IPs'), array('url' => $_CONF['site_admin_url'], 'text' => $LANG_ADMIN['admin_home']));
$retval .= COM_startBlock($LANG_BAD_BEHAVIOR['plugin_display_name'] . ' - ' . $LANG_BAD_BEHAVIOR['block_title_list'], '', COM_getBlockTemplate('_admin_block', 'header'));
$retval .= ADMIN_createMenu($menu_arr, $donate, $_CONF['site_url'] . '/bad_behavior2/images/bad_behavior2.png');
$retval .= '<br />';
if (!empty($msg)) {
$retval .= COM_showMessage($msg, 'bad_behavior2');
}
$templates = new Template($_CONF['path'] . 'plugins/' . BAD_BEHAVIOR_PLUGIN . '/templates');
$templates->set_file('list', 'log.thtml');
$templates->set_var(array('lang_ip' => $LANG_BAD_BEHAVIOR['row_ip'], 'lang_user_agent' => $LANG_BAD_BEHAVIOR['row_user_agent'], 'lang_referer' => $LANG_BAD_BEHAVIOR['row_referer'], 'lang_reason' => $LANG_BAD_BEHAVIOR['row_reason'], 'lang_response' => $LANG_BAD_BEHAVIOR['row_response'], 'lang_method' => $LANG_BAD_BEHAVIOR['row_method'], 'lang_protocol' => $LANG_BAD_BEHAVIOR['row_protocol'], 'lang_date' => $LANG_BAD_BEHAVIOR['row_date'], 'lang_search' => $LANG_BAD_BEHAVIOR['search'], 'lang_ip_date' => $LANG_BAD_BEHAVIOR['ip_date'], 'lang_headers' => $LANG_BAD_BEHAVIOR['headers'], 'lang_filter_select' => $LANG_BAD_BEHAVIOR['filter'], 'lang_go' => $LANG_BAD_BEHAVIOR['go']));
$filter_select = '<option value="all"';
if ($filter == '') {
$filter_select .= ' selected="selected" ';
}
$filter_select .= '>' . $LANG_BAD_BEHAVIOR['no_filter'] . '</option>';
foreach ($LANG_BB2_RESPONSE as $code => $text) {
$filter_select .= '<option value="' . $code . '"';
if ($filter == $code) {
$filter_select .= ' selected="selected" ';
}
$filter_select .= '>' . $text . '</option>';
}
$templates->set_var('filter_select', $filter_select);
$result = DB_query("SELECT id,ip,date,request_method,request_uri,server_protocol,http_headers,user_agent,request_entity,`key` FROM " . WP_BB_LOG . " " . $where . " ORDER BY date DESC LIMIT {$start},50");
$num = DB_numRows($result);
$templates->set_block('list', 'logrow', 'lrow');
for ($i = 0; $i < $num; $i++) {
$A = DB_fetchArray($result);
$lcount = 50 * ($page - 1) + $i + 1;
foreach ($A as $key => $val) {
$A[$key] = htmlspecialchars($val, ENT_QUOTES, COM_getEncodingt());
}
$dt = new Date($A['date'], $_USER['tzid']);
$headers = str_replace("\n", "<br/>\n", $A['http_headers']);
$headers = str_replace("User-Agent:", "<strong>User-Agent:</strong>", $headers);
$headers = str_replace("Host:", "<strong>Host:</strong>", $headers);
$headers = str_replace("POST ", "<strong>POST</strong> ", $headers);
$headers = str_replace("GET ", "<strong>GET</strong> ", $headers);
$headers = str_replace("Accept-Language:", "<strong>Accept-Language:</strong> ", $headers);
$headers = str_replace("Accept-Encoding:", "<strong>Accept-Encoding:</strong> ", $headers);
$headers = str_replace("Accept-Charset:", "<strong>Accept-Charset:</strong> ", $headers);
$headers = str_replace("X-Forwarded-For:", "<strong>X-Forwarded-For:</strong> ", $headers);
$headers = str_replace("Cookie:", "<strong>Cookie:</strong> ", $headers);
$headers = str_replace("Via:", "<strong>Via:</strong> ", $headers);
$headers = str_replace("Connection:", "<strong>Connection:</strong>", $headers);
$headers = str_replace("Accept:", "<strong>Accept:</strong>", $headers);
$headers = str_replace("Cache-Control:", "<strong>Cache-Control:</strong>", $headers);
$headers = str_replace("Referer:", "<strong>Referer:</strong>", $headers);
$headers = str_replace("Pragma:", "<strong>Pragma:</strong>", $headers);
$headers = str_replace("Proxy-", "<strong>Proxy-</strong>", $headers);
$headers = str_replace("Cf-Connecting-Ip", "<strong>Cf-Connecting-Ip</strong>", $headers);
$headers = str_replace("Cf-Ipcountry", "<strong>Cf-Ipcountry</strong>", $headers);
$headers = str_replace("X-Forwarded-Proto", "<strong>X-Forwarded-Proto</strong>", $headers);
$headers = str_replace("Cf-Visitor", "<strong>Cf-Visitor</strong>", $headers);
$headers = str_replace("X-Http-Proto", "<strong>X-Http-Proto</strong>", $headers);
$headers = str_replace("X-Real-Ip", "<strong>X-Real-Ip</strong>", $headers);
$headers = str_replace("Content-Length", "<strong>Content-Length</strong>", $headers);
$headers = str_replace("Content-Type", "<strong>Content-Type</strong>", $headers);
$headers = str_replace("Te:", "<strong>Te:</strong>", $headers);
$headers = str_replace("Expect:", "<strong>Expect:</strong>", $headers);
$headers = str_replace("Dnt:", "<strong>Dnt:</strong>", $headers);
$entity = str_replace("\n", "<br/>\n", $A["request_entity"]);
$templates->set_var(array('row_num' => $lcount, 'cssid' => $i % 2 + 1, 'id' => $A['id'], 'ip' => $A['ip'], 'request_method' => $A['request_method'], 'http_host' => $A['request_uri'], 'server_protocol' => $A['server_protocol'], 'http_referer' => $headers, 'reason' => $LANG_BB2_RESPONSE[$A['key']], 'http_user_agent' => $A['user_agent'], 'http_response' => $entity, 'date_and_time' => $dt->toRFC822(true)));
$url = $_CONF['site_admin_url'] . '/plugins/' . BAD_BEHAVIOR_PLUGIN . '/index.php?mode=view&id=' . $A['id'];
if ($page > 1) {
$url .= '&page=' . $page;
}
$templates->set_var('start_headers_anchortag', '<a href="' . $url . '" title="' . $LANG_BAD_BEHAVIOR['title_show_headers'] . '">');
$templates->set_var('end_headers_anchortag', '</a>');
if (!empty($_CONF['ip_lookup'])) {
$iplookup = str_replace('*', $A['ip'], $_CONF['ip_lookup']);
$templates->set_var('start_ip_lookup_anchortag', '<a href="' . $iplookup . '" title="' . $LANG_BAD_BEHAVIOR['title_lookup_ip'] . '" target="_new">');
$templates->set_var('end_ip_lookup_anchortag', '</a>');
} else {
$templates->set_var('start_ip_lookup_anchortag', '');
$templates->set_var('end_ip_lookup_anchortag', '');
}
$templates->parse('lrow', 'logrow', true);
}
if ($entries > 50) {
$baseurl = $_CONF['site_admin_url'] . '/plugins/' . BAD_BEHAVIOR_PLUGIN . '/index.php?mode=list&filter=' . $filter;
$numpages = ceil($entries / 50);
$templates->set_var('google_paging', COM_printPageNavigation($baseurl, $page, $numpages));
} else {
$templates->set_var('google_paging', '');
}
$templates->parse('output', 'list');
$retval .= $templates->finish($templates->get_var('output'));
$retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
return $retval;
}
示例7: MG_index
//.........这里部分代码省略.........
}
$saRows = 0;
$T->clear_var(array('lang_subalbums', 'subalbumcount', 'subalbumlist'));
if (!empty($MG_albums[$achild[$indexCounter]]->children)) {
$SAchildren = $MG_albums[$achild[$indexCounter]]->getChildren();
foreach ($SAchildren as $SAchild) {
if ($MG_albums[$SAchild]->access > 0) {
if ($MG_albums[$SAchild]->hidden) {
if ($MG_albums[$SAchild]->access == 3) {
$mediaCount = $MG_albums[$SAchild]->getMediaCount();
if ($_MG_CONF['subalbum_select'] == 1) {
if (strlen($MG_albums[$SAchild]->title) > 50) {
$aTitle = substr($MG_albums[$SAchild]->title, 0, 50) . '...';
} else {
$aTitle = $MG_albums[$SAchild]->title;
}
$subAlbumDisplay .= '<option value="' . $MG_albums[$SAchild]->id . '">' . $aTitle . ' (' . $mediaCount . ')</option>';
} else {
$subAlbumDisplay .= '<li><a href="' . $_MG_CONF['site_url'] . '/album.php?aid=' . $MG_albums[$SAchild]->id . '&page=1' . '">' . $MG_albums[$SAchild]->title . ' (' . $mediaCount . ')</a></li>';
}
$saRows++;
}
} else {
$mediaCount = $MG_albums[$SAchild]->getMediaCount();
if ($_MG_CONF['subalbum_select'] == 1) {
if (strlen($MG_albums[$SAchild]->title) > 50) {
$aTitle = substr($MG_albums[$SAchild]->title, 0, 50) . '...';
} else {
$aTitle = $MG_albums[$SAchild]->title;
}
$subAlbumDisplay .= '<option value="' . $MG_albums[$SAchild]->id . '">' . $aTitle . ' (' . $mediaCount . ')</option>';
} else {
$subAlbumDisplay .= '<li><a href="' . $_MG_CONF['site_url'] . '/album.php?aid=' . $MG_albums[$SAchild]->id . '&page=1' . '">' . $MG_albums[$SAchild]->title . ' (' . $mediaCount . ')</a></li>';
}
$saRows++;
}
}
}
if ($_MG_CONF['subalbum_select'] == 1) {
$subAlbumDisplay .= '</optgroup></select>';
$subAlbumDisplay .= ' <input type="submit" value="' . $LANG_MG03['go'] . '" />';
$subAlbumDisplay .= '<input type="hidden" name="page" value="1"/>';
$subAlbumDisplay .= '</form>';
}
if ($_MG_CONF['album_display_columns'] > 1 && $_MG_CONF['subalbum_select'] != 1) {
$T->set_var(array('subalbumlist' => '<span style="font-weight:bold;">' . $LANG_MG01['subalbums'] . '</span> (' . $saRows . ')'));
} else {
$T->set_var(array('lang_subalbums' => $LANG_MG01['subalbums'], 'subalbumcount' => '(' . $saRows . ')', 'subalbumlist' => $subAlbumDisplay));
}
}
if ($saRows == 0) {
$T->clear_var(array('lang_subalbums', 'subalbumcount', 'subalbumlist'));
}
$T->clear_var(array('saulstart', 'saulend'));
if ($saRows > 0 && $_MG_CONF['subalbum_select'] != 1) {
$T->set_var(array('saulstart' => '<ul>', 'saulend' => '</ul>'));
}
// now pull the total image count for all sub albums...
$total_images_subalbums = $MG_albums[$achild[$indexCounter]]->getMediaCount();
$owner_id = $MG_albums[$achild[$indexCounter]]->owner_id;
if ($owner_id == '' || !isset($MG_albums[$achild[$indexCounter]]->owner_id)) {
$owner_id = 0;
}
$ownername = DB_getItem($_TABLES['users'], 'username', "uid=" . intval($owner_id));
$F = new Template($_MG_CONF['template_path']);
$F->set_var('media_frame', $MG_albums[0]->albumFrameTemplate);
$F->set_var(array('border_width' => $newwidth + 20, 'border_height' => $newheight + 20, 'media_link_start' => '<a href="' . $_MG_CONF['site_url'] . '/album.php?aid=' . $MG_albums[$achild[$indexCounter]]->id . '&page=1' . '">', 'media_link_end' => '</a>', 'url_media_item' => $_MG_CONF['site_url'] . '/album.php?aid=' . $MG_albums[$achild[$indexCounter]]->id . '&page=1', 'media_thumbnail' => $album_last_image, 'media_size' => 'width="' . $newwidth . '" height="' . $newheight . '"', 'media_height' => $newheight, 'media_width' => $newwidth, 'media_tag' => strip_tags($MG_albums[$achild[$indexCounter]]->title), 'frWidth' => $newwidth - $MG_albums[0]->afrWidth, 'frHeight' => $newheight - $MG_albums[0]->afrHeight));
$F->parse('media', 'media_frame');
$media_item_thumbnail = $F->finish($F->get_var('media'));
$T->set_var(array('media_item_thumbnail' => $media_item_thumbnail, 'class' => $rowcounter % 2, 'table_column_width' => 'width="' . $width . '%"', 'album_id' => $MG_albums[$achild[$indexCounter]]->id, 'album_title' => PLG_replaceTags($MG_albums[$achild[$indexCounter]]->title, 'mediagallery', 'album_title'), 'album_desc' => $MG_albums[$achild[$indexCounter]]->description == '' ? '' : PLG_replaceTags($MG_albums[$achild[$indexCounter]]->description, 'mediagallery', 'album_description'), 'album_media_count' => $album_media_count, 'subalbum_media_count' => $total_images_subalbums, 'album_owner' => $ownername, 'album_last_update' => $album_last_update[0], 'column_width' => $albumColumnWidth, 'column_width2' => $tn_height + 35 . 'px', 'lang_album' => $LANG_MG00['album'], 'border_width' => $newwidth + 20, 'border_height' => $newheight + 20, 'media_link_start' => '<a href="' . $_MG_CONF['site_url'] . '/album.php?aid=' . $MG_albums[$achild[$indexCounter]]->id . '&page=1' . '">', 'media_link_end' => '</a>', 'url_media_item' => $_MG_CONF['site_url'] . '/album.php?aid=' . $MG_albums[$achild[$indexCounter]]->id . '&page=1', 'media_thumbnail' => $album_last_image, 'media_size' => 'width="' . $newwidth . '" height="' . $newheight . '"', 'media_height' => $newheight, 'media_width' => $newwidth, 'media_tag' => strip_tags($MG_albums[$achild[$indexCounter]]->title), 'frWidth' => $newwidth - $MG_albums[0]->afrWidth, 'frHeight' => $newheight - $MG_albums[0]->afrHeight));
$T->parse('AColumn', 'AlbumColumn', true);
$indexCounter++;
}
if ($noParse == 1) {
break;
} else {
$T->parse('ARow', 'AlbumRow', true);
$T->set_var('AColumn', '');
}
}
}
$T->set_var(array('bottom_pagination' => COM_printPageNavigation($_MG_CONF['site_url'] . '/index.php', $page + 1, ceil($aCount / $items_per_page)), 'table_columns' => $_MG_CONF['album_display_columns']));
if ($albumCount == 0) {
$T->set_var(array('noitems' => $LANG_MG03['no_album_objects']));
$T->parse('gallery_noitems', 'noitems');
} else {
$T->parse('gallery_body', 'body');
}
$T->parse('output', 'page');
$nCSS = $nFrame->getCSS();
if ($nCSS != '') {
$outputHandle = outputHandler::getInstance();
$outputHandle->addStyle($nCSS);
}
$display .= MG_siteHeader($LANG_MG00['plugin']);
$display .= $T->finish($T->get_var('output'));
$display .= MG_siteFooter();
echo $display;
exit;
}
示例8: MG_indexAll
//.........这里部分代码省略.........
}
if ($MG_albums[$album_id]->enable_sort == 1) {
$sort_box = '<form name="sortbox" id="sortbox" action="' . $_MG_CONF['site_url'] . '/album.php" method="get" style="margin:0;padding:0"><div>';
$sort_box .= '<input type="hidden" name="aid" value="' . $album_id . '"/>';
$sort_box .= '<input type="hidden" name="page" value="' . $page . '"/>';
$sort_box .= $LANG_MG03['sort_by'] . ' <select name="sort" onchange="forms[\'sortbox\'].submit()">';
$sort_box .= '<option value="0" ' . ($sortOrder == 0 ? ' selected="selected" ' : '') . '>' . $LANG_MG03['sort_default'] . '</option>';
$sort_box .= '<option value="1" ' . ($sortOrder == 1 ? ' selected="selected" ' : '') . '>' . $LANG_MG03['sort_default_asc'] . '</option>';
$sort_box .= '<option value="2" ' . ($sortOrder == 2 ? ' selected="selected" ' : '') . '>' . $LANG_MG03['sort_upload'] . '</option>';
$sort_box .= '<option value="3" ' . ($sortOrder == 3 ? ' selected="selected" ' : '') . '>' . $LANG_MG03['sort_upload_asc'] . '</option>';
$sort_box .= '<option value="4" ' . ($sortOrder == 4 ? ' selected="selected" ' : '') . '>' . $LANG_MG03['sort_capture'] . '</option>';
$sort_box .= '<option value="5" ' . ($sortOrder == 5 ? ' selected="selected" ' : '') . '>' . $LANG_MG03['sort_capture_asc'] . '</option>';
$sort_box .= '<option value="6" ' . ($sortOrder == 6 ? ' selected="selected" ' : '') . '>' . $LANG_MG03['sort_rating'] . '</option>';
$sort_box .= '<option value="7" ' . ($sortOrder == 7 ? ' selected="selected" ' : '') . '>' . $LANG_MG03['sort_rating_asc'] . '</option>';
$sort_box .= '<option value="8" ' . ($sortOrder == 8 ? ' selected="selected" ' : '') . '>' . $LANG_MG03['sort_views'] . '</option>';
$sort_box .= '<option value="9" ' . ($sortOrder == 9 ? ' selected="selected" ' : '') . '>' . $LANG_MG03['sort_views_asc'] . '</option>';
$sort_box .= '<option value="10" ' . ($sortOrder == 10 ? ' selected="selected" ' : '') . '>' . $LANG_MG03['sort_alpha'] . '</option>';
$sort_box .= '<option value="11" ' . ($sortOrder == 11 ? ' selected="selected" ' : '') . '>' . $LANG_MG03['sort_alpha_asc'] . '</option>';
$sort_box .= '</select>';
$sort_box .= ' <input type="submit" value="' . $LANG_MG03['go'] . '"/>';
$sort_box .= '</div></form>';
} else {
$sort_box = '';
}
$owner_id = $MG_albums[$album_id]->owner_id;
if ($owner_id == '' || !isset($MG_albums[$album_id]->owner_id)) {
$owner_id = 0;
}
$ownername = DB_getItem($_TABLES['users'], 'username', "uid=" . (int) $owner_id);
$album_last_update = MG_getUserDateTimeFormat($MG_albums[$album_id]->last_update);
$T = new Template($_MG_CONF['template_path']);
$T->set_file(array('page' => 'index-all.thtml'));
//@TODO fix language tag
$T->set_var(array('site_url' => $_MG_CONF['site_url'], 'album_title' => "All Photos - Sorted by Post Date", 'table_columns' => $columns_per_page, 'table_column_width' => intval(100 / $columns_per_page) . '%', 'top_pagination' => COM_printPageNavigation($_MG_CONF['site_url'] . '/index.php?aid=' . $album_id, $page + 1, ceil($total_items_in_album / $media_per_page)), 'bottom_pagination' => COM_printPageNavigation($_MG_CONF['site_url'] . '/index.php?aid=' . $album_id, $page + 1, ceil($total_items_in_album / $media_per_page)), 'page_number' => sprintf("%s %d %s %d", $LANG_MG03['page'], $current_print_page, $LANG_MG03['of'], $total_print_pages), 'jumpbox' => $album_jumpbox, 'album_id' => $album_id, 'lbslideshow' => $lbSlideShow, 'album_description' => $MG_albums[$album_id]->display_album_desc ? PLG_replaceTags($MG_albums[$album_id]->description) : '', 'album_id_display' => $MG_albums[0]->owner_id || $_MG_CONF['enable_media_id'] == 1 ? $LANG_MG03['album_id_display'] . $album_id : '', 'select_adminbox' => $admin_box, 'select_sortbox' => $sort_box, 'album_last_update' => $album_last_update[0], 'album_owner' => $ownername, 'media_count' => $MG_albums[$album_id]->getMediaCount(), 'lang_search' => $LANG_MG01['search'], 'table_columns' => $displayColumns));
$T->set_var('select_adminbox', $admin_box);
if ($_MG_CONF['rss_full_enabled']) {
$feedUrl = MG_getFeedUrl($_MG_CONF['rss_feed_name'] . '.rss');
$rsslink = '<a href="' . $feedUrl . '"' . ' type="application/rss+xml">';
$rsslink .= '<img src="' . MG_getImageFile('feed.png') . '" alt="" style="border:none;"/></a>';
$T->set_var('rsslink', $rsslink);
} else {
$T->set_var('rsslink', '');
}
// completed setting header / footer vars, parse them
PLG_templateSetVars('mediagallery', $T);
if ($total_media == 0) {
$T->set_var(array('lang_no_image' => $LANG_MG03['no_media_objects']));
}
//
// main processing of the album contents.
//
$noParse = 0;
$needFinalParse = 0;
if ($total_media > 0) {
$k = 0;
$T->set_block('page', 'ImageColumn', 'IColumn');
$T->set_block('page', 'ImageRow', 'IRow');
for ($i = 0; $i < $media_per_page; $i += $columns_per_page) {
for ($j = $i; $j < $i + $columns_per_page; $j++) {
if ($j >= $total_media) {
$k = $i + $columns_per_page - $j;
$m = $k % $columns_per_page;
for ($z = $m; $z > 0; $z--) {
$T->set_var(array('CELL_DISPLAY_IMAGE' => ''));
$T->parse('IColumn', 'ImageColumn', true);
$needFinalParse = 1;
示例9: COM_printPageNavigation
$topiclisting->set_var('subject', $subject);
$topiclisting->set_var('fullsubject', $record['subject']);
$topiclisting->set_var('gotomsg', $gotomsg);
$topiclisting->set_var('displaypageslink', $displaypageslink);
$topiclisting->set_var('showuserlink', $showuserlink);
$topiclisting->set_var('lastposter', $lastposter);
$topiclisting->set_var('LANG_lastpost', $LANG_GF02['msg188']);
$topiclisting->set_var('moved', $moved);
$topiclisting->set_var('views', $record['views']);
$topiclisting->set_var('replies', $record['replies']);
$topiclisting->set_var('lastdate', $lastdate);
$topiclisting->set_var('lastpostid', $lastreply['id']);
$topiclisting->set_var('LANG_BY', $LANG_GF01['BY']);
$topiclisting->parse('topic_record', 'topic_record', true);
}
$topiclisting->set_var('pagenavigation', COM_printPageNavigation($base_url, $page, $numpages));
if (empty($subscribelink)) {
$topiclisting->set_var('forummenu_link', '');
} else {
$topiclisting->parse('forummenu_link', 'forummenu_link');
}
$topiclisting->parse('output', 'topiclisting');
$display .= $topiclisting->finish($topiclisting->get_var('output'));
}
$title = $LANG_GF01['FORUM'];
$forum_id = COM_applyFilter($_REQUEST['forum'], true);
if (isset($_REQUEST['forum'])) {
$title = stripslashes(DB_getItem($_TABLES['forum_forums'], 'forum_name', "forum_id='{$forum_id}'"));
}
if (isset($_REQUEST['category'])) {
$title = $A['cat_name'];
示例10: getFormattedOutput2
//.........这里部分代码省略.........
$selected = ' selected="selected"';
}
// Write field
$list_templates->set_var('sort_text', $text);
$list_templates->set_var('sort_val', $field['name']);
$list_templates->set_var('sort_selected', $selected);
$list_templates->parse('page_sort', 'sort', true);
} else {
if ($this->_style == 'table') {
$direction = $this->_sort_arr['direction'] == 'asc' ? 'desc' : 'asc';
$href = $this->_page_url . "results={$this->_per_page}&" . "order={$field['name']}&direction={$direction}";
if ($show_sort && $field['sort'] != false) {
$text = "<a href=\"{$href}\">{$text}</a>";
if ($this->_sort_arr['field'] === $field['name']) {
$selected = $sort_selected;
}
}
// Write field
$list_templates->set_var('sort_text', $text);
$list_templates->set_var('sort_href', $href);
$list_templates->set_var('sort_val', $field['name']);
$list_templates->set_var('sort_selected', $selected);
$list_templates->parse('page_sort', 'sort', true);
}
}
}
}
// Draw the sort direction select box
if ($this->_style == 'inline' && $show_sort) {
foreach (array('desc', 'asc') as $direction) {
$direction_text = $direction == 'asc' ? $LANG09[71] : $LANG09[72];
$list_templates->set_var('direction_text', $direction_text);
$list_templates->set_var('direction_val', $direction);
$direction_selected = '';
if ($this->_sort_arr['direction'] == $direction) {
$direction_selected = ' selected="selected"';
}
$list_templates->set_var('direction_selected', $direction_selected);
$list_templates->parse('page_direction', 'direction', true);
}
}
$offset = ($this->_page - 1) * $this->_per_page;
$list_templates->set_var('show_message', 'display:none;');
// Run through all the results
$r = 1;
foreach ($rows_arr as $row) {
if (is_callable($this->_function)) {
$row = call_user_func_array($this->_function, array(false, $row));
}
foreach ($this->_fields as $field) {
if ($field['display'] == true) {
$fieldvalue = '';
if ($field['name'] == LF_ROW_NUMBER) {
$fieldvalue = $r + $offset;
} else {
if (!empty($row[$field['name']])) {
$fieldvalue = $row[$field['name']];
}
}
if ($fieldvalue != 'LF_NULL') {
$fieldvalue = sprintf($field['format'], $fieldvalue, $field['title']);
// Write field
$list_templates->set_var('field_text', $fieldvalue);
$list_templates->parse('item_field', 'field', true);
} else {
// Write an empty field
$list_templates->set_var('field_text', ' ');
$list_templates->parse('item_field', 'field', true);
}
}
}
// Write row
$r++;
$list_templates->set_var('cssid', $r % 2 + 1);
$list_templates->parse('item_row', 'row', true);
$list_templates->clear_var('item_field');
}
// Print page numbers
$page_url = $this->_page_url . 'order=' . $this->_sort_arr['field'] . '&direction=' . $this->_sort_arr['direction'] . '&results=' . $this->_per_page;
$num_pages = ceil($this->_total_found / $this->_per_page);
if ($num_pages > 1) {
$list_templates->set_var('google_paging', COM_printPageNavigation($page_url, $this->_page, $num_pages, 'page=', false, '', ''));
} else {
$list_templates->set_var('google_paging', '');
}
$list_top = sprintf($list_top, $offset + 1, $r + $offset - 1, $this->_total_found);
$list_templates->set_var('list_top', $list_top);
$list_templates->set_var('list_bottom', $list_bottom);
$list_templates->parse('output', 'list');
// Do the actual output
$retval = '';
if (!empty($title)) {
$retval .= COM_startBlock($title, '', COM_getBlockTemplate('_admin_block', 'header'));
}
$retval .= $list_templates->finish($list_templates->get_var('output'));
if (!empty($title)) {
$retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
}
return $retval;
}
示例11: COM_newTemplate
$order = 'DESC';
}
if ($page > 1) {
$offset = ($page - 1) * $show;
} else {
$offset = 0;
}
$base_url = "{$_CONF['site_url']}/forum/viewtopic.php?showtopic={$showtopic}&mode={$mode}&show={$show}";
$forum_outline_header = COM_newTemplate($CONF_FORUM['path_layout'] . 'forum/layout');
$forum_outline_header->set_file(array('forum_outline_header' => 'forum_outline_header.thtml'));
$forum_outline_header->set_var('imgset', $CONF_FORUM['imgset']);
$forum_outline_header->parse('output', 'forum_outline_header');
$display .= $forum_outline_header->finish($forum_outline_header->get_var('output'));
$pagenavigation = '';
if ($numpages > 1) {
$pagenavigation = COM_printPageNavigation($base_url, $page, $numpages);
}
// Stop timer and print elapsed time
//$intervalTime = $mytimer->stopTimer();
//COM_errorLog("Start Topic Display Time: $intervalTime");
if ($mode != 'preview') {
$topicnavbar = COM_newTemplate($CONF_FORUM['path_layout'] . 'forum/layout');
$topicnavbar->set_file(array('topicnavbar' => 'topic_navbar.thtml', 'subscribe' => 'links/subscribe.thtml', 'print' => 'links/print.thtml', 'prev' => 'links/prevtopic.thtml', 'next' => 'links/nexttopic.thtml', 'new' => 'links/newtopic.thtml', 'reply' => 'links/replytopic.thtml'));
$topicnavbar->set_var('layout_url', $CONF_FORUM['layout_url']);
if ($topic_pid > 0) {
$replytopic_id = $topic_pid;
} else {
$replytopic_id = $showtopic;
}
if ($viewtopic['is_readonly'] == 0 or forum_modPermission($viewtopic['forum'], $_USER['uid'], 'mod_edit')) {
$newtopiclink = "{$_CONF['site_url']}/forum/createtopic.php?method=newtopic&forum={$forum}";
示例12: links_list
//.........这里部分代码省略.........
$linklist->set_var('category_navigation', '');
}
if ($_LI_CONF['linkcols'] == 0) {
$linklist->set_var('category_dropdown', '');
} else {
$linklist->parse('category_dropdown', 'catdrop', true);
}
$linklist->set_var('cid', $cid);
$linklist->set_var('cid_plain', $cid);
$linklist->set_var('cid_encoded', rawurlencode($cid));
$linklist->set_var('lang_addalink', $LANG_LINKS[116]);
// Build SQL for links
$sql = 'SELECT lid,cid,url,description,title,hits,owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon';
$from_where = " FROM {$_TABLES['links']}";
if ($_LI_CONF['linkcols'] > 0) {
if (!empty($cid)) {
$from_where .= " WHERE cid='" . DB_escapeString($cid) . "'";
} else {
$from_where .= " WHERE cid=''";
}
$from_where .= COM_getPermSQL('AND');
} else {
$from_where .= COM_getPermSQL();
}
$order = ' ORDER BY cid ASC,title';
$limit = '';
if ($_LI_CONF['linksperpage'] > 0) {
if ($page < 1) {
$start = 0;
} else {
$start = ($page - 1) * $_LI_CONF['linksperpage'];
}
$limit = ' LIMIT ' . $start . ',' . $_LI_CONF['linksperpage'];
}
$result = DB_query($sql . $from_where . $order . $limit);
$nrows = DB_numRows($result);
if ($nrows == 0) {
if ($cid == $_LI_CONF['root'] && $page <= 1 && $_LI_CONF['show_top10']) {
$result = DB_query("SELECT lid,url,title,description,hits,owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon FROM {$_TABLES['links']} WHERE (hits > 0)" . COM_getPermSQL('AND') . LINKS_getCategorySQL('AND') . " ORDER BY hits DESC LIMIT 10");
$nrows = DB_numRows($result);
if ($nrows > 0) {
$linklist->set_var('link_details', '');
$linklist->set_var('link_category', $LANG_LINKS_STATS['stats_headline']);
for ($i = 0; $i < $nrows; $i++) {
$A = DB_fetchArray($result);
prepare_link_item($A, $linklist);
$linklist->parse('link_details', 'link', true);
}
$linklist->parse('category_links', 'catlinks', true);
}
}
$linklist->set_var('page_navigation', '');
} else {
$currentcid = '';
for ($i = 0; $i < $nrows; $i++) {
$A = DB_fetchArray($result);
if (strcasecmp($A['cid'], $currentcid) != 0) {
// print the category and link
if ($i > 0) {
$linklist->parse('category_links', 'catlinks', true);
$linklist->set_var('link_details', '');
}
$currentcid = $A['cid'];
$currentcategory = DB_getItem($_TABLES['linkcategories'], 'category', "cid = '" . DB_escapeString($currentcid) . "'");
if ($A['cid'] == $_LI_CONF['root']) {
$linklist->set_var('link_category', $LANG_LINKS['root']);
} else {
$linklist->set_var('link_category', $currentcategory);
}
}
prepare_link_item($A, $linklist);
$linklist->parse('link_details', 'link', true);
}
$linklist->parse('category_links', 'catlinks', true);
$result = DB_query('SELECT COUNT(*) AS count ' . $from_where);
list($numlinks) = DB_fetchArray($result);
$pages = 0;
if ($_LI_CONF['linksperpage'] > 0) {
$pages = (int) ($numlinks / $_LI_CONF['linksperpage']);
if ($numlinks % $_LI_CONF['linksperpage'] > 0) {
$pages++;
}
}
if ($pages > 0) {
if ($_LI_CONF['linkcols'] > 0 && !empty($currentcid)) {
$catlink = '?category=' . rawurlencode($currentcid);
} else {
$catlink = '';
}
$linklist->set_var('page_navigation', COM_printPageNavigation($_CONF['site_url'] . '/links/index.php' . $catlink, $page, $pages));
} else {
$linklist->set_var('page_navigation', '');
}
}
$linklist->set_var('blockfooter', COM_endBlock());
$linklist->parse('output', 'linklist');
$display .= $linklist->finish($linklist->get_var('output'));
$display = COM_createHTMLDocument($display, array('pagetitle' => $page_title));
return $display;
}
示例13: PAYPAL_ProductList
//.........这里部分代码省略.........
}
$product->set_var(array('id' => $A['id'], 'name' => $P->name, 'short_description' => PLG_replacetags($P->short_description), 'img_cell_width' => $_PP_CONF['max_thumb_size'] + 20, 'encrypted' => '', 'item_url' => COM_buildURL(PAYPAL_URL . '/detail.php?id=' . $A['id']), 'img_cell_width' => $_PP_CONF['max_thumb_size'] + 20, 'track_onhand' => $P->track_onhand ? 'true' : '', 'qty_onhand' => $P->onhand));
if ($P->price > 0) {
//$product->set_var('price', COM_numberFormat($P->price, 2));
$product->set_var('price', $P->currency->Format($P->price));
} else {
$product->clear_var('price');
}
if ($isAdmin) {
$product->set_var('is_admin', 'true');
$product->set_var('pi_admin_url', PAYPAL_ADMIN_URL);
$product->set_var('edit_icon', "{$_CONF['layout_url']}/images/edit.{$_IMAGE_TYPE}");
}
$pic_filename = DB_getItem($_TABLES['paypal.images'], 'filename', "product_id = '{$A['id']}'");
if ($pic_filename) {
$product->set_var('small_pic', PAYPAL_ImageUrl($pic_filename));
} else {
$product->set_var('small_pic', '');
}
// FIXME: If a user purchased once with no expiration, this query
// will not operate correctly
/*$time = DB_getItem($_TABLES['paypal.purchases'],
'MAX(UNIX_TIMESTAMP(expiration))',
"user_id = {$_USER['uid']} AND product_id ='{$A['id']}'");
*/
$product->set_block('product', 'BtnBlock', 'Btn');
if (!$P->hasAttributes()) {
// Buttons only show in the list if there are no options to select
$buttons = $P->PurchaseLinks();
foreach ($buttons as $name => $html) {
$product->set_var('button', $html);
$product->parse('Btn', 'BtnBlock', true);
}
} else {
if ($_PP_CONF['ena_cart']) {
// If the product has attributes, then the cart must be
// enabled to allow purchasing
$button = $product->parse('', 'btn_details') . ' ';
$product->set_var('button', $button);
$product->parse('Btn', 'BtnBlock', true);
}
}
$display .= $product->parse('', 'product');
$product->clear_var('Btn');
}
// Get products from plugins.
// For now, this hack shows plugins only on the first page, since
// they're not included in the page calculation.
if ($page == 1 && empty($cat_list)) {
// Get the currency class for formatting prices
USES_paypal_class_currency();
$Cur = new ppCurrency($_PP_CONF['currency']);
$product->clear_var('rating_bar');
// no ratings for plugins (yet)
foreach ($_PLUGINS as $pi_name) {
$status = LGLIB_invokeService($pi_name, 'getproducts', array(), $plugin_data, $svc_msg);
if ($status != PLG_RET_OK || empty($plugin_data)) {
continue;
}
foreach ($plugin_data as $A) {
// Reset button values
$buttons = '';
$product->set_var(array('id' => $A['id'], 'name' => $A['name'], 'short_description' => $A['short_description'], 'display' => '; display: none', 'small_pic' => '', 'encrypted' => '', 'item_url' => $A['url'], 'track_onhand' => ''));
if ($A['price'] > 0) {
$product->set_var('price', $Cur->Format($A['price']));
} else {
$product->clear_var('price');
}
if ($A['price'] > 0 && $_USER['uid'] == 1 && !$_PP_CONF['anon_buy']) {
$buttons .= $product->set_var('', 'login_req') . ' ';
} elseif ($A['prod_type'] > PP_PROD_PHYSICAL && $A['price'] == 0) {
// Free items or items purchases and not expired, download.
$buttons .= $product->set_var('', 'download') . ' ';
} elseif (is_array($A['buttons'])) {
// Buttons for everyone else
$product->set_block('product', 'BtnBlock', 'Btn');
foreach ($A['buttons'] as $type => $html) {
$product->set_var('button', $html);
$product->parse('Btn', 'BtnBlock', true);
}
}
//$product->set_var('buttons', $buttons);
$display .= $product->parse('', 'product');
$product->clear_var('Btn');
}
// foreach plugin_data
}
// foreach $_PLUGINS
}
// if page == 1
$pagenav_args = empty($pagenav_args) ? '' : '?' . implode('&', $pagenav_args);
// Display pagination
if (isset($_PP_CONF['prod_per_page']) && $_PP_CONF['prod_per_page'] > 0 && $count > $_PP_CONF['prod_per_page']) {
$product->set_var('pagination', COM_printPageNavigation(PAYPAL_URL . '/index.php' . $pagenav_args, $page, ceil($count / $_PP_CONF['prod_per_page'])));
} else {
$product->set_var('pagination', '');
}
$display .= $product->parse('', 'end');
return $display;
}
示例14: CMT_userComments
//.........这里部分代码省略.........
}
if (empty($limit)) {
$limit = $_CONF['comment_limit'];
}
if (!is_numeric($page) || $page < 1) {
$page = 1;
}
$start = $limit * ($page - 1);
$template = COM_newTemplate($_CONF['path_layout'] . 'comment');
$template->set_file(array('commentarea' => 'startcomment.thtml'));
$template->set_var('commentbar', CMT_commentBar($sid, $title, $type, $order, $mode, $ccode));
$template->set_var('sid', $sid);
$template->set_var('comment_type', $type);
$template->set_var('area_id', 'commentarea');
if ($mode == 'nested' || $mode == 'threaded' || $mode == 'flat') {
// build query
switch ($mode) {
case 'flat':
if ($cid) {
$count = 1;
$q = "SELECT c.*, u.username, u.fullname, u.photo, u.email, " . "UNIX_TIMESTAMP(c.date) AS nice_date " . "FROM {$_TABLES['comments']} AS c, {$_TABLES['users']} AS u " . "WHERE c.uid = u.uid AND c.cid = {$pid} AND type='{$type}'";
} else {
$count = DB_count($_TABLES['comments'], array('sid', 'type'), array($sid, $type));
$q = "SELECT c.*, u.username, u.fullname, u.photo, u.email, " . "UNIX_TIMESTAMP(c.date) AS nice_date " . "FROM {$_TABLES['comments']} AS c, {$_TABLES['users']} AS u " . "WHERE c.uid = u.uid AND c.sid = '{$sid}' AND type='{$type}' " . "ORDER BY date {$order} LIMIT {$start}, {$limit}";
}
break;
case 'nested':
case 'threaded':
default:
if ($order == 'DESC') {
$cOrder = 'c.rht DESC';
} else {
$cOrder = 'c.lft ASC';
}
// We can simplify the query, and hence increase performance
// when pid = 0 (when fetching all the comments for a given sid)
if ($cid) {
// pid refers to commentid rather than parentid
// count the total number of applicable comments
$q2 = "SELECT COUNT(*) " . "FROM {$_TABLES['comments']} AS c, {$_TABLES['comments']} AS c2 " . "WHERE c.sid = '{$sid}' AND (c.lft >= c2.lft AND c.lft <= c2.rht) " . "AND c2.cid = {$pid} AND c.type='{$type}'";
$result = DB_query($q2);
list($count) = DB_fetchArray($result);
$q = "SELECT c.*, u.username, u.fullname, u.photo, u.email, c2.indent AS pindent, " . "UNIX_TIMESTAMP(c.date) AS nice_date " . "FROM {$_TABLES['comments']} AS c, {$_TABLES['comments']} AS c2, " . "{$_TABLES['users']} AS u " . "WHERE c.sid = '{$sid}' AND (c.lft >= c2.lft AND c.lft <= c2.rht) " . "AND c2.cid = {$pid} AND c.uid = u.uid AND c.type='{$type}' " . "ORDER BY {$cOrder} LIMIT {$start}, {$limit}";
} else {
// pid refers to parentid rather than commentid
if ($pid == 0) {
// the simple, fast case
// count the total number of applicable comments
$count = DB_count($_TABLES['comments'], array('sid', 'type'), array($sid, $type));
$q = "SELECT c.*, u.username, u.fullname, u.photo, u.email, 0 AS pindent, " . "UNIX_TIMESTAMP(c.date) AS nice_date " . "FROM {$_TABLES['comments']} AS c, {$_TABLES['users']} AS u " . "WHERE c.sid = '{$sid}' AND c.uid = u.uid AND type='{$type}' " . "ORDER BY {$cOrder} LIMIT {$start}, {$limit}";
} else {
// count the total number of applicable comments
$q2 = "SELECT COUNT(*) " . "FROM {$_TABLES['comments']} AS c, {$_TABLES['comments']} AS c2 " . "WHERE c.sid = '{$sid}' AND (c.lft > c2.lft AND c.lft < c2.rht) " . "AND c2.cid = {$pid} AND c.type='{$type}'";
$result = DB_query($q2);
list($count) = DB_fetchArray($result);
$q = "SELECT c.*, u.username, u.fullname, u.photo, u.email, c2.indent + 1 AS pindent, " . "UNIX_TIMESTAMP(c.date) AS nice_date " . "FROM {$_TABLES['comments']} AS c, {$_TABLES['comments']} AS c2, " . "{$_TABLES['users']} AS u " . "WHERE c.sid = '{$sid}' AND (c.lft > c2.lft AND c.lft < c2.rht) " . "AND c2.cid = {$pid} AND c.uid = u.uid AND c.type='{$type}' " . "ORDER BY {$cOrder} LIMIT {$start}, {$limit}";
}
}
break;
}
$thecomments = '';
$result = DB_query($q);
if (DB_numRows($result) == 0) {
if ($page > 1) {
list($plgurl, $plgid) = CMT_getCommentUrlId($type);
$plglink = '';
if (!empty($plgurl)) {
$plglink = "{$plgurl}?{$plgid}={$sid}";
}
// Requested invalid page
COM_handle404($plglink);
}
}
$thecomments .= CMT_getComment($result, $mode, $type, $order, $delete_option, false, $ccode, $page);
// Pagination
$tot_pages = ceil($count / $limit);
$is_comment_page = CMT_isCommentPage();
if ($is_comment_page) {
$pLink[0] = "comment.php?sid={$sid}";
$pLink[0] .= "&" . CMT_TYPE . "={$type}&order={$order}&format={$mode}";
} else {
list($plgurl, $plgid) = CMT_getCommentUrlId($type);
$pLink[0] = "{$plgurl}?{$plgid}={$sid}";
$pLink[0] .= "&" . CMT_TYPE . "={$type}&order={$order}&mode={$mode}";
}
$pLink[1] = "#comments";
$page_str = "cpage=";
$template->set_var('pagenav', COM_printPageNavigation($pLink, $page, $tot_pages, $page_str, false));
$template->set_var('comments', $thecomments);
if (COMMENT_ON_SAME_PAGE) {
if ($ccode == 0) {
$cmode = COM_applyFilter(COM_getArgument(CMT_MODE));
$html = CMT_handleComment($cmode, $type, $title, $sid, $mode);
$template->set_var('commenteditor', $html);
}
}
$retval = $template->finish($template->parse('output', 'commentarea'));
}
return $retval;
}
示例15: MG_search
/**
* this searches for pages matching the user query and returns an array of
* for the header and table rows back to search.php where it will be formated and
* printed
*
* @query string Keywords user is looking for
* @datestart date/time Start date to get results for
* @dateend date/time End date to get results for
* @topic string The topic they were searching in
* @type string Type of items they are searching
* @author string Get all results by this author
*
*/
function MG_search($id, $page, $searchinfo = '')
{
global $_USER, $_TABLES, $_CONF, $_MG_CONF, $LANG_MG00, $LANG_MG01, $LANG_MG03;
$columns_per_page = $_MG_CONF['search_columns'];
$rows_per_page = $_MG_CONF['search_rows'];
if (!empty($searchinfo['numresults'])) {
$rows_per_page = intval($searchinfo['numresults'] / $columns_per_page);
}
$media_per_page = $columns_per_page * $rows_per_page;
$current_print_page = $page;
// $alertmsg = '<div class="pluginAlert">' . $LANG_MG03['no_search_found'] . '</div>';
// pull the query from the search database...
$result = DB_query("SELECT * FROM {$_TABLES['mg_sort']} WHERE sort_id='" . addslashes($id) . "'");
// $nrows = DB_numRows($result);
// if ($nrows < 1) {
// return $alertmsg;
// }
$S = DB_fetchArray($result);
if (!isset($_USER['uid']) || $_USER['uid'] < 2) {
$sort_user = 1;
} else {
$sort_user = $_USER['uid'];
}
// if ($sort_user != $S['sort_user'] && $S['sort_user'] != 1) {
// return $alertmsg;
// }
$page = $page - 1;
$begin = $media_per_page * $page;
$end = $media_per_page;
$root_album_owner_id = SEC_hasRights('mediagallery.admin');
$permsql = COM_getPermSQL('AND', $sort_user, 2, 'a');
$hiddensql = !$root_album_owner_id ? "AND a.hidden=0 " : '';
$sql = "SELECT DISTINCT count(*) AS c FROM {$_TABLES['mg_media']} AS m, " . $_TABLES['mg_media_albums'] . " AS ma, " . $_TABLES['mg_albums'] . " AS a " . $S['sort_query'] . " AND m.media_id=ma.media_id AND ma.album_id=a.album_id " . $hiddensql . $permsql;
$result = DB_query($sql);
$row = DB_fetchArray($result);
$total_media = $row['c'];
// if ($total_media < 1) {
// return $alertmsg;
// }
$sql = "SELECT DISTINCT m.*,a.album_id FROM {$_TABLES['mg_media']} AS m, " . $_TABLES['mg_media_albums'] . " AS ma, " . $_TABLES['mg_albums'] . " AS a " . $S['sort_query'] . " AND m.media_id=ma.media_id AND ma.album_id=a.album_id " . $hiddensql . $permsql . " ORDER BY m.media_time DESC" . " LIMIT " . $begin . "," . intval($begin + $end);
$result = DB_query($sql);
$media_array = array();
while ($row = DB_fetchArray($result)) {
$media_array[] = $row;
}
$total_print_pages = ceil($total_media / $media_per_page);
$pagination = COM_printPageNavigation($_MG_CONF['site_url'] . '/search.php?id=' . $id, $page + 1, $total_print_pages, 'page=');
$page_number = sprintf("%s %d %s %d", $LANG_MG03['page'], $current_print_page, $LANG_MG03['of'], $total_print_pages);
$return_url = $S['referer'] == '' ? $_MG_CONF['site_url'] : htmlentities($S['referer'], ENT_QUOTES, COM_getCharset());
// new stuff
$T = COM_newTemplate(MG_getTemplatePath_byName());
$T->set_file('page', 'search_page.thtml');
$T->set_var(array('site_url' => $_MG_CONF['site_url'], 'table_columns' => $columns_per_page, 'table_column_width' => intval(100 / $columns_per_page) . '%', 'top_pagination' => $pagination, 'bottom_pagination' => $pagination, 'page_number' => $page_number, 'lang_search_results' => $LANG_MG03['search_results'], 'lang_return_to_index' => $LANG_MG03['return_to_index'], 'return_url' => $return_url, 'search_keywords' => $searchinfo['keywords'] == '*' ? '*' : $S['keywords'], 'lang_search' => $LANG_MG01['search']));
MG_buildSearchBox($T, $searchinfo);
$howmany = $total_media - $page * $media_per_page;
if ($howmany > $total_media) {
$howmany = $total_media;
}
if ($howmany > 0) {
$k = 0;
$col = 0;
$opt = array('sortOrder' => 0, 'searchmode' => 1);
$T->set_block('page', 'ImageColumn', 'IColumn');
$T->set_block('page', 'ImageRow', 'IRow');
for ($i = 0; $i < $media_per_page; $i += $columns_per_page) {
$next_columns = $i + $columns_per_page;
for ($j = $i; $j < $next_columns; $j++) {
if ($j >= $total_media) {
$T->parse('IRow', 'ImageRow', true);
$T->set_var('IColumn', '');
break 2;
}
if ($j + $begin >= $total_media) {
continue;
}
$media = new Media($media_array[$j], $media_array[$j]['album_id']);
$celldisplay = $media->displayThumb($opt);
if ($media->type == 1) {
$PhotoURL = MG_getFileUrl('disp', $media->filename);
$T->set_var('URL', $PhotoURL);
}
$T->set_var('clear_float', '');
if ($col == $columns_per_page) {
$T->set_var('clear_float', ' clear:both;');
$col = 0;
}
$T->set_var('CELL_DISPLAY_IMAGE', $celldisplay);
//.........这里部分代码省略.........