本文整理汇总了PHP中helper::isAjaxRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP helper::isAjaxRequest方法的具体用法?PHP helper::isAjaxRequest怎么用?PHP helper::isAjaxRequest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类helper
的用法示例。
在下文中一共展示了helper::isAjaxRequest方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildIndex
/**
* Build All index.
*
* @access public
* @return void
*/
public function buildIndex($type = 'article', $lastID = '')
{
if (helper::isAjaxRequest()) {
$result = $this->search->buildAllIndex($type, $lastID);
if (dao::isError()) {
$this->send(array('result' => 'fail', 'message' => dao::getError()));
}
if (isset($result['finished']) and $result['finished']) {
$this->send(array('result' => 'finished', 'message' => $this->lang->search->buildSuccessfully));
} else {
$this->send(array('result' => 'unfinished', 'message' => sprintf($this->lang->search->buildResult, $result['count']), 'next' => inlink('buildIndex', "type={$result['type']}&lastID={$result['lastID']}")));
}
}
$this->view->title = $this->lang->search->buildIndex;
$this->display();
}
示例2: 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();
}
示例3:
<?php
if (helper::isAjaxRequest()) {
$webRoot = $config->webRoot;
$jsRoot = $webRoot . "js/";
$templateName = $this->config->template->{$this->device}->name;
$themeName = $this->config->template->{$this->device}->theme;
$templateRoot = $webRoot . "template/{$templateName}/";
$templateThemeRoot = "{$templateRoot}theme/";
$templateCommonRoot = "{$templateThemeRoot}common/";
$thisModuleName = $this->app->getModuleName();
$thisMethodName = $this->app->getMethodName();
?>
<div class='modal-dialog'>
<div class='modal-content'>
<div class='modal-header'>
<button type='button' class='close' data-dismiss='modal'><span aria-hidden='true'>×</span></button>
<h5 class='modal-title'><?php
echo !empty($title) ? $title : '';
?>
</h5>
</div>
<div class='modal-body'>
<?php
} else {
if ($extView = $this->getExtViewFile(__FILE__)) {
include $extView;
return helper::cd();
}
include TPL_ROOT . 'common/header.lite.html.php';
?>
示例4: deny
/**
* Show the deny info.
*
* @param mixed $module the module
* @param mixed $method the method
* @access public
* @return void
*/
public function deny($module, $method)
{
if (helper::isAjaxRequest()) {
exit;
}
$vars = "module={$module}&method={$method}";
if (isset($_SERVER['HTTP_REFERER'])) {
$referer = helper::safe64Encode($_SERVER['HTTP_REFERER']);
$vars .= "&referer={$referer}";
}
if (RUN_MODE == 'admin') {
if (strpos($_SERVER['HTTP_REFERER'], "m=user&f=login") !== false) {
die(js::locate(helper::createLink('admin', 'index')));
}
}
$denyLink = helper::createLink('user', 'deny', $vars);
die(js::locate($denyLink));
}
示例5: deny
/**
* Show the deny info.
*
* @param mixed $module the module
* @param mixed $method the method
* @access public
* @return void
*/
public function deny($module, $method)
{
if (helper::isAjaxRequest()) {
exit;
}
$vars = "module={$module}&method={$method}";
if (isset($_SERVER['HTTP_REFERER'])) {
$referer = helper::safe64Encode($_SERVER['HTTP_REFERER']);
$vars .= "&referer={$referer}";
}
$denyLink = helper::createLink('user', 'deny', $vars);
die(js::locate($denyLink));
}
示例6:
<?php
/**
* The score view file of score module of ZenTaoPMS.
*
* @copyright Copyright 2009-2010 QingDao Nature Easy Soft Network Technology Co,LTD (www.cnezsoft.com)
* @license LGPL (http://www.gnu.org/licenses/lgpl.html)
* @author Yidong Wang <yidong@cnezsoft.com>
* @package score
* @version $Id$
* @link http://www.chanzhi.net
*/
$isRequestModal = helper::isAjaxRequest();
if ($isRequestModal) {
?>
<div class='modal-dialog'>
<div class='modal-content'>
<div class='modal-header'>
<button type='button' class='close' data-dismiss='modal'><span aria-hidden='true'>×</span></button>
<h5 class='modal-title'></i> <?php
echo $lang->user->buyScore;
?>
</h5>
</div>
<div class='modal-body'>
<?php
} else {
include TPL_ROOT . 'common/header.html.php';
?>
<div class='panel panel-section'>
<div class='panel-heading'><strong><?php
示例7: send
/**
* Send data directly, for ajax requests.
*
* @param misc $data
* @param string $type
* @access public
* @return void
*/
public function send($data, $type = 'json')
{
$data = (array) $data;
if ($type == 'json') {
if (!helper::isAjaxRequest()) {
if (isset($data['result']) and $data['result'] == 'success') {
if (!empty($data['message'])) {
echo js::alert($data['message']);
}
$locate = isset($data['locate']) ? $data['locate'] : (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '');
if (!empty($locate)) {
die(js::locate($locate));
}
die(isset($data['message']) ? $data['message'] : 'success');
}
if (isset($data['result']) and $data['result'] == 'fail') {
if (!empty($data['message'])) {
$message = json_decode(json_encode((array) $data['message']));
foreach ((array) $message as $item => $errors) {
$message->{$item} = implode(',', $errors);
}
echo js::alert(strip_tags(implode(" ", (array) $message)));
die(js::locate('back'));
}
}
}
echo json_encode($data);
}
die(helper::removeUTF8Bom(ob_get_clean()));
}
示例8: __construct
/**
* The construct function.
*
* Prepare all the paths, classes, super objects and so on.
* Notice:
* 1. You should use the createApp() method to get an instance of the router.
* 2. If the $appRoot is empty, the framework will comput the appRoot according the $appName
*
* @param string $appName the name of the app
* @param string $appRoot the root path of the app
* @access protected
* @return void
*/
protected function __construct($appName = 'demo', $appRoot = '')
{
$this->setPathFix();
$this->setBasePath();
$this->setFrameRoot();
$this->setCoreLibRoot();
$this->setAppRoot($appName, $appRoot);
$this->setTmpRoot();
$this->setLogRoot();
$this->setConfigRoot();
$this->setModuleRoot();
$this->setWwwRoot();
$this->setDataRoot();
$this->setTplRoot();
$this->filterSuperVars();
$this->setSuperVars();
$this->loadConfig('common');
$this->setDebug();
$this->setErrorHandler();
$this->fixRequestURI();
$this->setSuperVars();
$this->sendHeader();
$this->connectDB();
$this->setClientLang();
$this->fixLangConfig();
$this->loadLang('common');
$this->setTimezone();
$this->loadClass('front', $static = true);
$this->loadClass('filter', $static = true);
$this->loadClass('dao', $static = true);
if (RUN_MODE == 'admin' and helper::isAjaxRequest()) {
$this->config->debug = 1;
}
}