Bo-Blog 2 : The Blog Reloaded. <<A Bluview Technology Product>> 禁止使用Windows记事本修改文件,由此造成的一切使用不正常恕不解答! PHP+MySQL blog system. Code: Bob Shen Offical site: http://www.bo-blog.com Copyright (c) Bob Shen 中国-上海 In memory of my university life ------------------------------------------------------- */ if (!defined('VALIDREQUEST')) { die('Access Denied.'); } acceptrequest('pageid,pagealias'); $itemid = $pagealias ? safe_convert($pagealias) : floor($pageid); $m_b = new getblogs(); $records = $pagealias ? $m_b->getgroupbyquery("SELECT * FROM `{$db_prefix}pages` WHERE `pagealias`='{$itemid}'") : $m_b->getgroupbyquery("SELECT * FROM `{$db_prefix}pages` WHERE `pageid`='{$itemid}'"); if (is_array($records)) { $section_body_main = $m_b->output_page($records[0]); } else { catcherror($lnc[186]); } //Load plugins $section_body_main[0] = plugin_get('custompagebegin') . $section_body_main[0]; $section_body_main[] = plugin_get('custompageend'); $plugin_closesidebar = $records[0]['closesidebar'] == 1 ? 0 : 1; if ($plugin_closesidebar == 1) { $elements['mainpage'] = str_replace("class=\"content\"", "class=\"content-wide\"", $elements['mainpage']); } $ifannouncement = "none"; $bodymenu = $t->set('mainpage', array('pagebar' => '', 'iftoppage' => 'none', 'ifbottompage' => 'none', 'ifannouncement' => 'none', 'topannounce' => '', 'mainpart' => @implode('', $section_body_main), 'previouspageexists' => '', 'nextpageexists' => '')); $pagetitle = "{$records[0]['pagetitle']} × ";
} $records = $m_b->single_record($partialquery, $partialquery2); } if (is_array($records)) { $itemid = $records[0]['blogid']; if ($is_save && $mbcon['txtdown'] == '1') { $m_b->save_a_text($records[0]); } else { $section_body_main = $m_b->make_viewentry($records[0]); } } else { getHttp404($lnc[186]); } //Load plugins $section_body_main[0] = plugin_get('entrybegin') . $section_body_main[0]; $section_body_main[] = plugin_get('commentbegin'); if ($records[0]['replies'] != 0 || $records[0]['tbs'] != 0) { if ($mbcon['avatar'] == 1 || $mbcon['usergravatar'] == 1 || $mbcon['visitorgravatar'] == 1) { $replyarray = $m_b->getgroupbyquery("SELECT t1.*, t2.userid, t2.avatar FROM `{$db_prefix}replies` t1 LEFT JOIN `{$db_prefix}user` t2 ON t1.replierid=t2.userid WHERE t1.blogid='{$itemid}' AND (t1.reproperty<2 OR t1.reproperty=4) ORDER BY t1.reptime {$order} LIMIT {$start_id}, {$mbcon['replyperpage']}"); } else { $replyarray = $m_b->getgroupbyquery("SELECT * FROM `{$db_prefix}replies` WHERE blogid='{$itemid}' AND (reproperty<2 OR reproperty=4) ORDER BY reptime {$order} LIMIT {$start_id}, {$mbcon['replyperpage']}"); } if ($replyarray[0]['repid'] != '') { $section_body_main[] = $m_b->make_replies($replyarray); $outurl = getlink_entry($itemid, $records[0]['blogalias'], '%s', $part); $pageway = 1; $innerpages = $m_b->make_pagebar($page, $mbcon['pagebaritems'], $outurl, $records[0]['replies'] + $records[0]['tbs'], $mbcon['replyperpage'], $pageway); } else { checkPageValidity($page, 1); } } else {
function make_pagebar($page, $numperline, $returnurl, $totalvolume = 'auto', $perpagevolume, $pageway = 0) { global $lnc, $pageitems, $template; $conxer = strstr($returnurl, '?') ? '&' : '?'; $totalvolume = $totalvolume == 'auto' ? $this->total_rows : $totalvolume; $this->total_pages = floor(($totalvolume - 1) / $perpagevolume) + 1; if (empty($this->total_pages)) { return ''; } $firstpagededuct = floor($numperline / 2); $firstindexpage = min($page - $firstpagededuct, $page); if ($firstindexpage < 1) { $firstindexpage = 1; } $lastindexpage = min($firstindexpage + $numperline - 1, $this->total_pages); $pagebar .= " {$lnc[8]} {$page}/{$this->total_pages} "; $urlpattern = $pageway == 0 ? str_replace('%', '%%', $returnurl) . "{$conxer}page=%s" : $returnurl; $pagebar .= " <a href=\"" . sprintf($urlpattern, 1) . "\"><img src=\"{$template['moreimages']}/arrows/doubleleft.gif\" alt=\"{$lnc[9]}\" title=\"{$lnc[9]}\" border=\"0\"/></a> "; if ($page != 1) { $previouspageurl = sprintf($urlpattern, $page - 1); $pagebar .= " <a href=\"{$previouspageurl}\"><img src=\"{$template['moreimages']}/arrows/singleleft.gif\" alt=\"{$lnc[10]}\" title=\"{$lnc[10]}\" border=\"0\"/></a> "; $previouspageexists = 'inline'; } else { $previouspageexists = 'none'; } $turningpages = ''; for ($i = $firstindexpage; $i <= $lastindexpage; $i++) { if ($i != $page) { $turningpages .= " <a href=\"" . sprintf($urlpattern, $i) . "\">{$i}</a> "; } else { $turningpages .= " <span class=\"pagelink-current\">{$i}</span> "; } } $pagebar .= "<span class=\"pagebar-selections\">" . $turningpages . "</span>"; if ($page != $this->total_pages) { $nextpageurl = sprintf($urlpattern, $page + 1); $pagebar .= " <a href=\"{$nextpageurl}\"><img src=\"{$template['moreimages']}/arrows/singleright.gif\" alt=\"{$lnc[11]}\" title=\"{$lnc[11]}\" border=\"0\"/></a> "; $nextpageexists = 'inline'; } else { $nextpageexists = 'none'; } $pagebar .= " <a href=\"" . sprintf($urlpattern, $this->total_pages) . "\"><img src=\"{$template['moreimages']}/arrows/doubleright.gif\" alt=\"{$lnc[12]}\" title=\"{$lnc[12]}\" border=\"0\"/></a> "; $pageitems = array('currentpage' => $page, 'previouspageurl' => $previouspageurl, 'nextpageurl' => $nextpageurl, 'turningpages' => $turningpages, 'totalpages' => $this->total_pages, 'previouspageexists' => $previouspageexists, 'nextpageexists' => $nextpageexists); $pagebar = "<span class=\"pagebar-mainbody\">{$pagebar}</span>"; $pagebar .= plugin_get('afterpagebar'); return $pagebar; }
function make_pagebar($page, $numperline, $returnurl, $totalvolume = 'auto', $perpagevolume, $pageway = 0) { global $lnc, $pageitems, $template; $conxer = strstr($returnurl, '?') ? '&' : '?'; $totalvolume = $totalvolume == 'auto' ? $this->total_rows : $totalvolume; $this->total_pages = floor(($totalvolume - 1) / $perpagevolume) + 1; checkPageValidity($page, $this->total_pages); //2008/5/25 Block abnormal pages if (empty($this->total_pages)) { return ''; } $firstpagededuct = floor($numperline / 2); $firstindexpage = min($page - $firstpagededuct, $page); if ($firstindexpage < 1) { $firstindexpage = 1; } $lastindexpage = min($firstindexpage + $numperline - 1, $this->total_pages); $pagebar .= "<span class=\"page-total\">Page <b>{$page}</b> of <b>{$this->total_pages}</b> </span>"; $urlpattern = $pageway == 0 ? str_replace('%', '%%', $returnurl) . "{$conxer}page=%s" : $returnurl; $pagebar .= ""; if ($page != 1) { $previouspageurl = sprintf($urlpattern, $page - 1); $pagebar .= " <span class=\"sec-btn\"><a class=\"page-previous\" href=\"{$previouspageurl}\" title=\"也可以试试用键盘上的左右箭头来翻页哦~\" >« 上一页</a></span> "; $previouspageexists = 'inline'; } else { $previouspageexists = 'none'; } $turningpages = ''; for ($i = $firstindexpage; $i <= $lastindexpage; $i++) { if ($i != $page) { $turningpages .= " <a href=\"" . sprintf($urlpattern, $i) . "\">{$i}</a> "; } else { $turningpages .= " <span class=\"pagelink-current\">{$i}</span> "; } } $pagebar .= "<span class=\"pagebar-selections\">" . $turningpages . "</span>"; if ($page != $this->total_pages) { $nextpageurl = sprintf($urlpattern, $page + 1); $pagebar .= " <a class=\"page-next\" href=\"{$nextpageurl}\" title=\"也可以试试用键盘上的左右箭头来翻页哦~\">下一页 »</a> "; $nextpageexists = 'inline'; } else { $nextpageexists = 'none'; } $pagebar .= ""; $pageitems = array('currentpage' => $page, 'previouspageurl' => $previouspageurl, 'nextpageurl' => $nextpageurl, 'turningpages' => $turningpages, 'totalpages' => $this->total_pages, 'previouspageexists' => $previouspageexists, 'nextpageexists' => $nextpageexists); $pagebar = "<span class=\"pagebar-mainbody\">{$pagebar}</span>"; $pagebar .= plugin_get('afterpagebar'); return $pagebar; }
* @uses plugin_api.php */ require_once 'core.php'; require_api('config_api.php'); require_api('constant_inc.php'); require_api('gpc_api.php'); require_api('plugin_api.php'); $t_plugin_path = config_get('plugin_path'); $f_page = gpc_get_string('page'); if (!preg_match('/^([a-zA-Z0-9_-]+)\\/([a-zA-Z0-9_-]+[\\/a-zA-Z0-9_-]*)/', $f_page, $t_matches)) { error_parameters($f_page); trigger_error(ERROR_PLUGIN_INVALID_PAGE, ERROR); } $t_basename = $t_matches[1]; $t_action = $t_matches[2]; $t_plugin = plugin_get($t_basename); if (plugin_needs_upgrade($t_plugin)) { error_parameters($t_basename); trigger_error(ERROR_PLUGIN_UPGRADE_NEEDED, ERROR); } # Plugin can be registered but fail to load e.g. due to unmet dependencies if (!plugin_is_loaded($t_basename)) { error_parameters($t_basename); trigger_error(ERROR_PLUGIN_NOT_LOADED, ERROR); } $t_page = $t_plugin_path . $t_basename . '/pages/' . $t_action . '.php'; if (!is_file($t_page)) { error_parameters($t_basename, $t_action); trigger_error(ERROR_PLUGIN_PAGE_NOT_FOUND, ERROR); } plugin_push_current($t_basename);