本文整理汇总了PHP中helper::header301方法的典型用法代码示例。如果您正苦于以下问题:PHP helper::header301方法的具体用法?PHP helper::header301怎么用?PHP helper::header301使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类helper
的用法示例。
在下文中一共展示了helper::header301方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: board
/**
* The board page.
*
* @param int $boardID the board id
* @param int $pageID the current page id
* @access public
* @return void
*/
public function board($boardID = 0, $pageID = 1)
{
$board = $this->loadModel('tree')->getByID($boardID, 'forum');
if (!$board) {
die(js::locate('back'));
}
if ($board->link) {
helper::header301($board->link);
}
/* Get common threads. */
$recPerPage = !empty($this->config->site->forumRec) ? $this->config->site->forumRec : $this->config->forum->recPerPage;
$this->app->loadClass('pager', $static = true);
$pager = new pager(0, $recPerPage, $pageID);
$threads = $this->loadModel('thread')->getList($board->id, $orderBy = 'repliedDate_desc', $pager);
$this->view->title = $board->name;
$this->view->keywords = $board->keywords . '' . $this->config->site->keywords;
$this->view->desc = strip_tags($board->desc);
$this->view->board = $board;
$this->view->sticks = $this->thread->getSticks($board->id);
$this->view->threads = $threads;
$this->view->pager = $pager;
$this->view->mobileURL = helper::createLink('forum', 'board', "borderID={$boardID}&pageID={$pageID}", "category={$board->alias}", 'mhtml');
$this->view->desktopURL = helper::createLink('forum', 'board', "borderID={$boardID}&pageID={$pageID}", "category={$board->alias}", 'html');
$this->display();
}
示例2: view
/**
* View an article.
*
* @param int $articleID
* @param int $currentCategory
* @access public
* @return void
*/
public function view($articleID, $currentCategory = 0)
{
$article = $this->loadModel('article')->getByID($articleID);
if (!$article) {
die($this->fetch('error', 'index'));
}
if ($article->link) {
helper::header301($article->link);
}
/* fetch category for display. */
$category = array_slice($article->categories, 0, 1);
$category = $category[0]->id;
$currentCategory = $this->session->articleCategory;
if ($currentCategory > 0 && isset($article->categories[$currentCategory])) {
$category = $currentCategory;
}
$category = $this->loadModel('tree')->getByID($category);
$title = $article->title . ' - ' . $category->name;
$keywords = $article->keywords . ' ' . $category->keywords . ' ' . $this->config->site->keywords;
$desc = strip_tags($article->summary);
$this->view->title = $title;
$this->view->keywords = $keywords;
$this->view->desc = $desc;
$this->view->article = $article;
$this->view->prevAndNext = $this->loadModel('article')->getPrevAndNext($article->id, $category->id);
$this->view->category = $category;
$this->view->contact = $this->loadModel('company')->getContact();
$this->dao->update(TABLE_ARTICLE)->set('views = views + 1')->where('id')->eq($articleID)->exec(false);
$this->display();
}
示例3: browse
/**
* Browse product in front.
*
* @param int $categoryID the category id
* @param int $pageID current page id
* @access public
* @return void
*/
public function browse($categoryID = 0, $pageID = 1)
{
$category = $this->loadModel('tree')->getByID($categoryID, 'product');
if ($category && $category->link) {
helper::header301($category->link);
}
$this->app->loadClass('pager', $static = true);
$pager = new pager(0, $this->config->product->recPerPage, $pageID);
$categoryID = is_numeric($categoryID) ? $categoryID : $category->id;
$products = $this->product->getList($this->tree->getFamily($categoryID), '`order` desc', $pager);
if (!$category and $categoryID != 0) {
die($this->fetch('error', 'index'));
}
if ($categoryID == 0) {
$category = new stdclass();
$category->id = 0;
$category->name = $this->lang->product->home;
$category->alias = '';
$category->keywords = '';
$category->desc = '';
}
$title = $category->name;
$keywords = trim($category->keywords . ' ' . $this->config->site->keywords);
$desc = strip_tags($category->desc) . ' ';
$this->session->set('productCategory', $category->id);
$this->view->title = $title;
$this->view->keywords = $keywords;
$this->view->desc = $desc;
$this->view->category = $category;
$this->view->products = $products;
$this->view->pager = $pager;
$this->view->contact = $this->loadModel('company')->getContact();
$this->display();
}
示例4: view
/**
* View an page.
*
* @param int $pageID
* @access public
* @return void
*/
public function view($pageID)
{
$page = $this->loadModel('article')->getPageByID($pageID);
if ($page->link) {
$this->dao->update(TABLE_ARTICLE)->set('views = views + 1')->where('id')->eq($pageID)->exec();
helper::header301($page->link);
}
$title = $page->title;
$keywords = $page->keywords . ' ' . $this->config->site->keywords;
$desc = $page->summary;
$this->view->title = $title;
$this->view->keywords = $keywords;
$this->view->desc = $desc;
$this->view->page = $page;
$this->view->mobileURL = helper::createLink('page', 'view', "pageID={$pageID}", "name={$page->alias}", 'mhtml');
$this->view->desktopURL = helper::createLink('page', 'view', "pageID={$pageID}", "name={$page->alias}", 'html');
$this->dao->update(TABLE_ARTICLE)->set('views = views + 1')->where('id')->eq($page->id)->exec();
$this->display();
}
示例5: board
/**
* The board page.
*
* @param int $boardID the board id
* @param int $pageID the current page id
* @access public
* @return void
*/
public function board($boardID = 0, $pageID = 1)
{
$board = $this->loadModel('tree')->getByID($boardID, 'forum');
if (!$board) {
die(js::locate('back'));
}
if ($board->link) {
helper::header301($board->link);
}
/* Get common threads. */
$this->app->loadClass('pager', $static = true);
$pager = new pager(0, $this->config->forum->recPerPage, $pageID);
$threads = $this->loadModel('thread')->getList($board->id, $orderBy = 'repliedDate_desc', $pager);
$this->view->title = $board->name;
$this->view->keywords = $board->keywords . '' . $this->config->site->keywords;
$this->view->desc = strip_tags($board->desc);
$this->view->board = $board;
$this->view->sticks = $this->thread->getSticks($board->id);
$this->view->threads = $threads;
$this->view->pager = $pager;
$this->display();
}
示例6: view
/**
* View an article.
*
* @param int $articleID
* @param int $currentCategory
* @access public
* @return void
*/
public function view($articleID, $currentCategory = 0)
{
$article = $this->loadModel('article')->getByID($articleID);
if (!$article) {
die($this->fetch('error', 'index'));
}
if ($article->link) {
helper::header301($article->link);
}
/* fetch category for display. */
$category = array_slice($article->categories, 0, 1);
$category = $category[0]->id;
$currentCategory = $this->session->articleCategory;
if ($currentCategory > 0 && isset($article->categories[$currentCategory])) {
$category = $currentCategory;
}
$category = $this->loadModel('tree')->getByID($category);
$title = $article->title . ' - ' . $category->name;
$keywords = $article->keywords . ' ' . $category->keywords . ' ' . $this->config->site->keywords;
$desc = strip_tags($article->summary);
$this->view->title = $title;
$this->view->keywords = $keywords;
$this->view->desc = $desc;
$this->view->article = $article;
$this->view->prevAndNext = $this->loadModel('article')->getPrevAndNext($article->id, $category->id);
$this->view->category = $category;
$this->view->contact = $this->loadModel('company')->getContact();
$this->view->mobileURL = helper::createLink('blog', 'view', "articleID={$articleID}¤tCategory={$currentCategory}", "category={$category->alias}&name={$article->alias}", 'mhtml');
$this->view->desktopURL = helper::createLink('blog', 'view', "articleID={$articleID}¤tCategory={$currentCategory}", "category={$category->alias}&name={$article->alias}", 'html');
if ($article->source == 'article') {
$copyArticle = $this->article->getByID($article->copyURL);
$copyArticleCategory = current(array_slice($copyArticle->categories, 0, 1));
$this->view->sourceURL = helper::createLink('article', 'view', "articleID={$copyArticle->id}&categoryID={$copyArticleCategory->id}", "category={$copyArticleCategory->alias}&name={$copyArticle->alias}", 'html');
}
$this->dao->update(TABLE_ARTICLE)->set('views = views + 1')->where('id')->eq($articleID)->exec();
$this->display();
}
示例7: login
/**
* Login.
*
* @param string $referer
* @access public
* @return void
*/
public function login($referer = '')
{
$this->setReferer($referer);
/* Load mail config for reset password. */
$this->app->loadConfig('mail');
$loginLink = $this->createLink('user', 'login');
$denyLink = $this->createLink('user', 'deny');
$regLink = $this->createLink('user', 'register');
/* If the user logon already, goto the pre page. */
if ($this->user->isLogon()) {
if (helper::isAjaxRequest()) {
if ($this->referer and strpos($loginLink . $denyLink . $regLink, $this->referer) === false and strpos($this->referer, $loginLink) === false) {
$this->send(array('result' => 'success', 'locate' => $this->referer));
}
$this->send(array('result' => 'success', 'locate' => $this->createLink($this->config->default->module)));
}
if ($this->referer and strpos($loginLink . $denyLink . $regLink, $this->referer) === false and strpos($this->referer, $loginLink) === false) {
$this->locate($this->referer);
}
$this->locate($this->createLink($this->config->default->module));
exit;
}
/* If the user sumbit post, check the user and then authorize him. */
if (!empty($_POST)) {
$user = $this->user->getByAccount($this->post->account);
/* check client ip and location if login is admin. */
if (RUN_MODE == 'admin') {
$checkIP = $this->user->checkIP();
$checkLocation = $this->user->checkLocation();
if ($user and (!$checkIP or !$checkLocation)) {
$error = $checkIP ? '' : $this->lang->user->ipDenied;
$error .= $checkLocation ? '' : $this->lang->user->locationDenied;
$pass = $this->loadModel('mail')->checkVerify();
$captchaUrl = $this->createLink('mail', 'captcha', "url=&target=modal&account={$this->post->account}");
if (!$pass) {
$this->send(array('result' => 'fail', 'reason' => 'captcha', 'message' => $error, 'url' => $captchaUrl));
}
}
}
if (!$this->user->login($this->post->account, $this->post->password)) {
$this->send(array('result' => 'fail', 'message' => $this->lang->user->loginFailed));
}
if (RUN_MODE == 'front') {
if (isset($this->config->site->checkEmail) and $this->config->site->checkEmail == 'open' and $this->config->mail->turnon and !$user->emailCertified) {
$referer = helper::safe64Encode($this->post->referer);
if (!helper::isAjaxRequest()) {
helper::header301("http://" . $_SERVER['HTTP_HOST'] . inlink('checkEmail', "referer={$referer}"));
}
$this->send(array('result' => 'success', 'locate' => inlink('checkEmail', "referer={$referer}")));
}
}
/* Goto the referer or to the default module */
if ($this->post->referer != false and strpos($loginLink . $denyLink . $regLink, $this->post->referer) === false) {
if (!helper::isAjaxRequest()) {
helper::header301(urldecode($this->post->referer));
}
$this->send(array('result' => 'success', 'locate' => urldecode($this->post->referer)));
} else {
$default = $this->config->user->default;
if (!helper::isAjaxRequest()) {
helper::header301("http://" . $_SERVER['HTTP_HOST'] . $this->createLink($default->module, $default->method));
}
$this->send(array('result' => 'success', 'locate' => $this->createLink($default->module, $default->method)));
}
}
if (!$this->session->random) {
$this->session->set('random', md5(time() . mt_rand()));
}
$this->view->title = $this->lang->user->login->common;
$this->view->referer = $this->referer;
if (RUN_MODE == 'front') {
$this->view->mobileURL = helper::createLink('user', 'login', "referer={$referer}", '', 'mhtml');
$this->view->desktopURL = helper::createLink('user', 'login', "referer={$referer}", '', 'html');
}
$this->display();
}
示例8: view
/**
* View a thread.
*
* @param int $threadID
* @param int $pageID
* @access public
* @return void
*/
public function view($threadID, $pageID = 1)
{
$thread = $this->thread->getByID($threadID);
if (!$thread) {
die(js::locate('back'));
}
if ($thread->link) {
$this->thread->plusCounter($threadID);
helper::header301($thread->link);
}
/* Set editor for current user. */
$this->thread->setEditor($thread->board, 'view');
/* Get thread board. */
$board = $this->loadModel('tree')->getById($thread->board);
/* Get replies. */
$this->app->loadConfig('reply');
$this->app->loadClass('pager', $static = true);
$pager = new pager(0, $this->config->reply->recPerPage, $pageID);
$replies = $this->loadModel('reply')->getByThread($threadID, $pager);
/* Get all speakers. */
$speakers = $this->thread->getSpeakers($thread, $replies);
$speakers = $this->loadModel('user')->getBasicInfo($speakers);
foreach ($speakers as $account => $speaker) {
$speaker->isModerator = strpos(",{$board->moderators},", ",{$account},") !== false;
}
/* Set the views counter + 1; */
$this->thread->plusCounter($threadID);
$this->view->title = $thread->title . $this->lang->minus . $board->name;
$this->view->board = $board;
$this->view->thread = $thread;
$this->view->replies = $replies;
$this->view->pager = $pager;
$this->view->speakers = $speakers;
$this->display();
}
示例9: redirect
/**
* Redirect mall of product.
*
* @param int $productID
* @access public
* @return void
*/
public function redirect($productID)
{
$product = $this->product->getByID($productID);
helper::header301(htmlspecialchars_decode($product->mall));
}