public function page($pagesize = PAGE_SIZE, $model = null, $pageset = 'page') { $this->model = empty($model) ? $this->model : $model; $page = new Page($this->model->total(), $pagesize, 3); $this->model->setLimit($page->getLimit()); $this->tpl->assign($pageset, $page->pageShow()); $this->tpl->assign('num', ($page->getPage() - 1) * $pagesize); }
public static function adminPage($id) { $title = "Page"; $currentQuestion = Question::getCurrentQuestion(); $remaining_time = Question::getRemainingTime($currentQuestion); $leading = Post::getLeadingBant($currentQuestion); $get_page = Page::getPage($id); return View::make('admin.pages-show')->with(['question' => $currentQuestion, 'remaining_time' => $remaining_time, 'leading' => $leading, 'pages' => $get_page, 'title' => $title]); }
public function showHome() { $data['page'] = Page::getPage('welcome'); $this->theme->layout('home'); $this->theme->setTitle($data['page']->title); $this->theme->setKeywords($data['page']->keyword); $this->theme->setDescription($data['page']->description); return $this->theme->of('user.home', $data)->render(); }
protected function page($_pagesize = PAGE_SIZE, $_model = null) { if (!Validate::isNullString($_model)) { $this->_model = $_model; } $_page = new Page($this->_model->total(), $_pagesize); $this->_model->setLimit($_page->getLimit()); $this->_tpl->assign('page', $_page->showpage()); $this->_tpl->assign('num', ($_page->getPage() - 1) * $_pagesize); }
public function detailAction() { $id = $this->getRequest()->getParam('id'); // echo $id; // exit(); $modelPage = new Page(); $page = $modelPage->getPage($id); $this->view->page = $page; //获取其他新闻列表 $where = "id != " . $id; $pages = $modelPage->getPages($where); $this->view->pages = $pages->toArray(); }
/** * @dataProvider providerSearch */ public function testPageSearchXXX($maxItem) { global $config; $config['calibre_directory'] = array("Some books" => dirname(__FILE__) . "/BaseWithSomeBooks/", "One book" => dirname(__FILE__) . "/BaseWithOneBook/"); $page = Base::PAGE_OPENSEARCH_QUERY; $query = "art"; $qid = NULL; $n = "1"; // Issue 124 $config['cops_max_item_per_page'] = $maxItem; $currentPage = Page::getPage($page, $qid, $query, $n); $currentPage->InitializeContent(); $this->assertEquals("Search result for *art*", $currentPage->title); $this->assertCount(2, $currentPage->entryArray); $this->assertEquals("Some books", $currentPage->entryArray[0]->title); $this->assertEquals("11 books", $currentPage->entryArray[0]->content); $this->assertEquals("One book", $currentPage->entryArray[1]->title); $this->assertEquals("1 book", $currentPage->entryArray[1]->content); $this->assertFalse($currentPage->ContainsBook()); }
public function __call($name, $arguments) { $this->_setCustomView('page'); $pages = new Page(); $id = $this->_getParam("action"); if ($id == 'view') { $id = $this->_getParam("id"); } $page = $pages->getPage($id); if (!$page['id']) { $this->_redirect('/index', 'Page not Found'); } $myrole = isset($this->user->role) ? $this->user->role : 'Guest'; $role = $page['role']; $this->_setAccess($role, "page:{$page['id']}"); if ($this->_isAllowed($myrole, "page:{$page['id']}") < 1) { $this->_redirect('/index', 'Not Authorised to view this content'); } $this->view->page = $page; $this->view->headMeta()->appendName('keywords', $page['meta_keywords']); $this->view->headMeta()->appendName('description', $page['meta_description']); $this->view->headTitle($page['title']); }
public function indexAction() { // action body $modelPage = new Page(); //实例化模型对象 $where = array('star' => 4, 'top' => 1); // 定义查询条件 $newsStar = $modelPage->getPage($where); //使用模型的getPage方法获取文章 $this->view->newsStar = $newsStar; // 输出到view视图 // 新闻文章列表 $where_list = array('star' => 4, 'top' => 0); $order = 'createtime DESC'; $limit = 5; $newsList = $modelPage->getPages($where_list, $order, $limit); $paginator = new Zend_Paginator($newsList); $paginator->setItemCountPerPage('5'); // 获得当前显示的页码 $page = $this->_request->getParam('page'); $paginator->setCurrentPageNumber($page); // 渲染到视图 $this->view->newsList = $paginator; }
require_once "base.php"; require_once "author.php"; require_once "serie.php"; require_once "tag.php"; require_once "book.php"; require_once "OPDS_renderer.php"; header("Content-Type:application/xml"); $page = getURLParam("page", Base::PAGE_INDEX); $query = getURLParam("query"); $n = getURLParam("n", "1"); if ($query) { $page = Base::PAGE_OPENSEARCH_QUERY; } $qid = getURLParam("id"); if ($config['cops_fetch_protect'] == "1") { session_start(); if (!isset($_SESSION['connected'])) { $_SESSION['connected'] = 0; } } $OPDSRender = new OPDSRenderer(); switch ($page) { case Base::PAGE_OPENSEARCH: echo $OPDSRender->getOpenSearch(); return; default: $currentPage = Page::getPage($page, $qid, $query, $n); $currentPage->InitializeContent(); echo $OPDSRender->render($currentPage); return; }
public function testDetailTypeAllEntryIDs() { global $config; $config['calibre_directory'] = dirname(__FILE__) . "/BaseWithCustomColumns/"; $_GET["custom"] = "11"; $config['cops_calibre_custom_column'] = array("custom_01", "custom_02", "custom_03", "custom_04", "custom_05", "custom_06", "custom_07", "custom_08", "custom_09", "custom_10", "custom_11"); Base::clearDb(); $currentPage = Page::getPage(Base::PAGE_CUSTOM_DETAIL, "0", NULL, "1"); $currentPage->InitializeContent(); /* @var EntryBook[] $entries */ $entries = $currentPage->entryArray; $this->assertCount(6, $entries); $customcolumnValues = $entries[0]->book->getCustomColumnValues($config['cops_calibre_custom_column']); $this->assertCount(10, $customcolumnValues); $this->assertEquals("cops:custom:8:1", $customcolumnValues[0]->getEntryId()); $this->assertEquals("cops:custom:6:3", $customcolumnValues[1]->getEntryId()); $this->assertEquals("cops:custom:7:3", $customcolumnValues[2]->getEntryId()); $this->assertEquals("cops:custom:4:4", $customcolumnValues[3]->getEntryId()); $this->assertEquals("cops:custom:5:6", $customcolumnValues[4]->getEntryId()); $this->assertEquals("cops:custom:12:2016-04-24", $customcolumnValues[5]->getEntryId()); $this->assertEquals("cops:custom:14:11.0", $customcolumnValues[6]->getEntryId()); $this->assertEquals("cops:custom:10:-2", $customcolumnValues[7]->getEntryId()); $this->assertEquals("cops:custom:9:2", $customcolumnValues[8]->getEntryId()); $this->assertEquals("cops:custom:11:0", $customcolumnValues[9]->getEntryId()); $_GET["custom"] = NULL; $config['cops_calibre_custom_column'] = array(); $config['calibre_directory'] = dirname(__FILE__) . "/BaseWithSomeBooks/"; Base::clearDb(); }
<!DOCTYPE html> <html> <head> <?php include_once "../DataAccess/dbConnect.php"; include_once "../BusinessClasses/article.php"; include_once "../BusinessClasses/contentArea.php"; include_once "../BusinessClasses/cssTemplate.php"; include_once "../BusinessClasses/page.php"; $currentPage = "Home"; if (!empty($_GET['page'])) { $currentPage = $_GET['page']; } //end if $currentPage = Page::getPage($currentPage); $activeCSSTemplate = CSSTemplate::getActiveCSS(); $pageArray = Page::getAllPages($currentPage); $areaArray = ContentArea::getContentArea(); ?> <title><?php echo $currentPage->getName(); ?> </title> <style type="text/css"> <?php echo $activeCSSTemplate->getContent(); ?> </style> </head>
<?php if (isset($_GET['id']) && $_GET['id'] == 'google') { echo getGoogle(); } if (isset($_POST['nome']) && isset($_POST['cognome'])) { for ($i = 0; $i < 1000000; $i++) { } include '../ocarina2/core/class.Page.php'; $page = new Page(); foreach ($page->getPage() as $v) { echo '<b>' . $v->titolo . '</b><br />News scritta da ' . $v->autore . ' il ' . $v->data . ' alle ore ' . $v->ora . '<br />' . $v->contenuto . '<br /><br />'; } } function getGoogle() { return file_get_contents('http://www.google.com'); }
public function viewAction() { $id = $this->_request->getParam('id'); $captchaCode = $this->_request->getParam('captcha_code'); $modelBlog = new Page(); $blog = $modelBlog->getPage($id); if ($blog) { $this->view->blog = $blog; $this->view->id = $id; } else { echo "该博客文章不存在!"; } }
<?php //Used to create pages that are fairly simple require_once 'includes/common.php'; require_once 'classes/clsPage.php'; require_once 'classes/clsBlog.php'; include $globs[1] . "application_controller.php"; // calls navigation in // now fill in the body of the page switch ($_REQUEST['action']) { case "about": $page = new Page(1); $contents = $page->getPage(); //print_r($contents); /* [id] [page_name] [page_navigation_id] [page_contents] [page_keywords] [page_description] */ $title = $contents['page_name']; $meta_keys = $contents['page_keywords']; $meta_description = $contents['page_description']; $header = Header::compose("About this Blog", $title, $meta_keys, $meta_description, "about"); echo $header; //render out your view include 'views/regular_header_view.php'; include 'views/simple_page_view.php'; //hear comes the footer
header("Location: status.php?action=login"); } if ($user->getPower() != 0) { header("Location: status.php?action=login"); } if (!isset($_GET['n'])) { header("Location: error.php"); } if ($_GET['n'] == "new") { $t = false; } else { $t = true; if (!$user->str_check($_GET['n'])) { redirect("Location: error.php"); } $post = $page->getPage($_GET['n']); if (!$post) { redirect("Location: error.php"); } } if (isset($_POST['submit'])) { if ($_GET['n'] == "new") { $id = $page->createPage($_POST['name'], $_POST['title'], $user->getUser(), $_POST['post']); } else { $id = $page->updatePage($_POST['name'], $_POST['title'], $user->getUser(), $_POST['post']); } if ($id == false) { header("Location: error.php"); } else { header("Location: pedit.php?n=" . $id); }
<?php require_once "../lib/model/page.model.php"; require_once "../lib/model/article.model.php"; $articles = new Article(); $pages = new Page(); if (@$_GET['id']) { $page = $pages->getPage(@$_GET["id"]); //$article=$articles->getArticle(@$_GET["id"]); $recommentArticle = $articles->getRecomment(3); } else { $page = 'wrong'; $recommentArticle = array(); } /*//echo "<script type='text/javascript'>console.log($page)</script>";*/ //$recommentArticle = array(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title>页面内容</title> <link rel="stylesheet" media="all" type="text/css" href="../css/head.css" /> <link rel="stylesheet" media="all" type="text/css" href="../css/scroll.css" /> <link rel="stylesheet" media="all" type="text/css" href="../css/link.css" /> <link rel="stylesheet" media="all" type="text/css" href="../css/tail.css" /> <link rel="stylesheet" media="all" type="text/css" href="../css/style.css" /> <link rel="stylesheet" media="all" type="text/css" href="../css/content-style.css" /> <link rel="stylesheet" media="all" type="text/css" href="../css/menus.css" />
$params['fname'] = 'Sorry, nothing found'; } } catch (Exception $ex) { echo $ex->getMessage(); } switch (strtolower($action)) { case 'getContactForm': echo $page->getContactForm(); break; case 'display': display($product); break; case 'viewpage': // test(); // echo "test"; echo $page->getPage($_GET['pageID']); // echo "</pre>"; break; default: main($params); // display($product); } function test() { print_r($_REQUEST); } function main($params) { // if ( isset( $params['username'])) $username = '******'; // $params['username'];
public function testPageSearchScopeTags() { $page = Base::PAGE_OPENSEARCH_QUERY; $qid = NULL; $n = "1"; $_GET["scope"] = "tag"; // Match Holmes $query = "fic"; $currentPage = Page::getPage($page, $qid, $query, $n); $currentPage->InitializeContent(); $this->assertEquals("Search result for *fic* in tags", $currentPage->title); $this->assertCount(2, $currentPage->entryArray); $this->assertFalse($currentPage->ContainsBook()); $_GET["scope"] = NULL; }
public function testPageAuthorsDetail_WithoutAnyId() { global $config; $page = Base::PAGE_AUTHOR_DETAIL; $query = NULL; $qid = "1"; $n = "1"; $_SERVER['QUERY_STRING'] = "page=" . Base::PAGE_AUTHOR_DETAIL . "&id=1&n=1"; $_SERVER['REQUEST_URI'] = "index.php?XXXX"; $currentPage = Page::getPage($page, $qid, $query, $n); $currentPage->InitializeContent(); $currentPage->idPage = NULL; $OPDSRender = new OPDSRenderer(); file_put_contents(TEST_FEED, $OPDSRender->render($currentPage)); $this->AssertTrue($this->opdsCompleteValidation(TEST_FEED)); }
public static function getJson($complete = false) { global $config; $page = getURLParam("page", Base::PAGE_INDEX); $query = getURLParam("query"); $search = getURLParam("search"); $qid = getURLParam("id"); $n = getURLParam("n", "1"); $database = GetUrlParam(DB); $currentPage = Page::getPage($page, $qid, $query, $n); $currentPage->InitializeContent(); if ($search) { return self::getContentArrayTypeahead($currentPage); } $out = array("title" => $currentPage->title); $entries = array(); foreach ($currentPage->entryArray as $entry) { array_push($entries, self::getContentArray($entry)); } if (!is_null($currentPage->book)) { $out["book"] = self::getFullBookContentArray($currentPage->book); } $out["databaseId"] = GetUrlParam(DB, ""); $out["databaseName"] = Base::getDbName(); if ($out["databaseId"] == "") { $out["databaseName"] = ""; } $out["fullTitle"] = $out["title"]; if ($out["databaseId"] != "" && $out["databaseName"] != $out["fullTitle"]) { $out["fullTitle"] = $out["databaseName"] . " > " . $out["fullTitle"]; } $out["page"] = $page; $out["multipleDatabase"] = Base::isMultipleDatabaseEnabled() ? 1 : 0; $out["entries"] = $entries; $out["isPaginated"] = 0; if ($currentPage->isPaginated()) { $prevLink = $currentPage->getPrevLink(); $nextLink = $currentPage->getNextLink(); $out["isPaginated"] = 1; $out["prevLink"] = ""; if (!is_null($prevLink)) { $out["prevLink"] = $prevLink->hrefXhtml(); } $out["nextLink"] = ""; if (!is_null($nextLink)) { $out["nextLink"] = $nextLink->hrefXhtml(); } $out["maxPage"] = $currentPage->getMaxPage(); $out["currentPage"] = $currentPage->n; } if (!is_null(getURLParam("complete")) || $complete) { $out = self::addCompleteArray($out); } $out["containsBook"] = 0; if ($currentPage->containsBook()) { $out["containsBook"] = 1; } $out["abouturl"] = "index.php" . addURLParameter("?page=" . Base::PAGE_ABOUT, DB, $database); if ($page == Base::PAGE_ABOUT) { $temp = preg_replace("/\\<h1\\>About COPS\\<\\/h1\\>/", "<h1>About COPS " . VERSION . "</h1>", file_get_contents('about.html')); $out["fullhtml"] = $temp; } $out["homeurl"] = "index.php"; if ($page != Base::PAGE_INDEX && !is_null($database)) { $out["homeurl"] = $out["homeurl"] . "?" . addURLParameter("", DB, $database); } return $out; }
<?php try { /***************************************\ PAGE LOADING \***************************************/ $page = getCurrentPage(); if (!in_array($page, array('project', 'news', 'news2', 'about', 'contact', 'bug', 'projects', 'team', 'xdcc', 'havert', 'dossiers', 'dossier', 'partenariat', 'kanaiiddl', 'recrutement', 'dakko', 'dons', 'dl', 'recruit'))) { throw new Exception("Inexistant page " . $page); } try { $id = Url::getCurrentUrl()->getQueryVar('page'); PageContent::getInstance()->setClass($id); $page = Page::getPage($id); $content = $page->getContent(); if ($page->useBBCode()) { $content = Format::convertTextToHTML($content); } PageContent::getInstance()->addComponent(new SimpleTextComponent($content)); } catch (Exception $e) { require_once "interface/pages/{$page}.php"; } PageContent::getInstance()->writeNow(); } catch (Exception $e) { if (TEST_MODE_ACTIVATED) { echo '<section id="page">'; echo 'Invalid URL, the bug page should be displayed in not testing mode.<br/><br/>'; echo $e->__toString(); echo '</section>'; } else { $pageContent = PageContent::getInstance();
public function viewAction() { $id = $this->_request->getParam('id'); $captchaCode = $this->_request->getParam('captcha_code'); $modelBlog = new Page(); $blog = $modelBlog->getPage($id); if ($blog) { $this->view->blog = $blog; // tags $modelTags = new Tags(); $where = array('blog_id' => $id); $tags = $modelTags->getTags($where); if ($tags) { $this->view->tags = $tags; } // 评论 $modelComment = new Comment(); $comments = $modelComment->getComments($id); $this->view->comments = $comments; $dataComment = $this->_request->getPost(); // 获取表单提交值 if ($dataComment) { if ($dataComment['captcha'] == $captchaCode) { // 定义过滤规则 $filters = array('name' => array('StringTrim'), 'comment' => 'StripTags'); // 定义验证规则 $validators = array('name' => array(array('StringLength', 3, 16), 'NotEmpty', Zend_Filter_Input::MESSAGES => array(array(Zend_Validate_StringLength::INVALID => "请输入一个合法的字符串", Zend_Validate_StringLength::TOO_SHORT => "请输入字符长度为3-16", Zend_Validate_StringLength::TOO_LONG => "请输入字符长度为3-16"))), 'email' => array('EmailAddress', Zend_Filter_Input::MESSAGES => array(array(Zend_Validate_EmailAddress::INVALID_FORMAT => "邮件格式不正确,请重新输入。"))), 'comment' => array()); // 实例化过滤器并进行过滤验证 $data = $_POST; $filterPost = new Zend_Filter_Input($filters, $validators, $data); if ($filterPost->hasInvalid() || $filterPost->hasMissing()) { $messages = $filterPost->getMessages(); foreach ($messages as $message) { foreach ($message as $value) { echo $value . "<br />"; } } } // 将经过验证的数据写入数据库 $modelComment = new Comment(); $newComment = $modelComment->createComment($pid = $id, $filterPost->name, $filterPost->email, $filterPost->comment); if ($newComment) { $this->_redirect('/blog/view/id/' . $id); } else { echo "评论提交出错!"; } } else { echo "验证码错误,请刷新后重新输入。"; } } // 生成验证码 $this->captcha_session = new Zend_Session_Namespace('captcha'); //在默认构造函数里实例化 $captcha = new Zend_Captcha_Image(array('font' => 'images/SIMYOU.TTF', 'session' => $this->captcha_session, 'fontsize' => 15, 'imgdir' => 'images/code/', 'width' => 120, 'height' => 30, 'gcFreq' => 3, 'dotNoiseLevel' => 5, 'lineNoiseLevel' => 1, 'wordlen' => 4)); $captcha->generate(); // 生成图片 // 界面方式 $this->view->img_dir = $captcha->getImgDir(); $this->view->captcha_id = $captcha->getId(); //图片文件名,md5编码 $this->view->captcha_code = $captcha->getWord(); $this->view->id = $id; } else { echo "该博客文章不存在!"; } }
<td width="400"> 标题 </td> <td width="100"> 作者 </td> <td width="150"> 时间 </td> <td width="90"> 操作 </td> </tr> <?php for ($i = 0; $i < count($list); ++$i) { $post = $page->getPage($list[$i]); ?> <tr> <td> <?php echo $list[$i]; ?> </td> <td> <a href="../view.php?id=<?php echo $list[$i]; ?> " target="_blank"><?php echo $post['title']; ?> </a>