本文整理汇总了PHP中js::locate方法的典型用法代码示例。如果您正苦于以下问题:PHP js::locate方法的具体用法?PHP js::locate怎么用?PHP js::locate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类js
的用法示例。
在下文中一共展示了js::locate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: board
/**
* The board page.
*
* @param int $boardID the board id
* @param string $mode
* @param int $pageID the current page id
* @access public
* @return void
*/
public function board($boardID = 0, $mode = '', $pageID = 1)
{
$board = $this->loadModel('tree')->getByID($boardID, 'forum');
if (!$board) {
die(js::locate('back'));
}
/* Build search form. */
$this->loadModel('search', 'sys');
$this->config->forum->search['actionURL'] = $this->createLink('forum', 'board', "boardID={$boardID}&mode=bysearch");
$this->search->setSearchParams($this->config->forum->search);
/* Get common threads. */
$this->app->loadClass('pager', $static = true);
$pager = new pager(0, 10, $pageID);
if ($mode != 'bysearch') {
$threads = $this->loadModel('thread')->getList($board->id, $orderBy = 'repliedDate_desc', $pager);
}
if ($mode == 'bysearch') {
$threads = $this->loadModel('thread')->getBySearch($board->id, 'bysearch', $orderBy = 'repliedDate_desc', $pager);
}
$this->view->boardID = $boardID;
$this->view->title = $board->name;
$this->view->mode = $mode;
$this->view->keywords = $board->keywords;
$this->view->desc = strip_tags($board->desc);
$this->view->board = $board;
$this->view->boards = $this->forum->getBoards();
$this->view->sticks = $this->thread->getSticks($board->id);
$this->view->threads = $threads;
$this->view->pager = $pager;
$this->display();
}
示例2: edit
/**
* Edit a reply.
*
* @param string $replyID
* @access public
* @return void
*/
public function edit($replyID)
{
if ($this->app->user->account == 'guest') {
die(js::locate($this->createLink('user', 'login')));
}
/* Judge current user has priviledge to edit the reply or not. */
$reply = $this->reply->getByID($replyID);
if (!$reply) {
die(js::locate('back'));
}
$thread = $this->loadModel('thread')->getByID($reply->thread);
if (!$this->thread->canManage($thread->board, $reply->author)) {
die(js::locate('back'));
}
$this->thread->setEditor($thread->board, 'edit');
if ($_POST) {
$this->reply->update($replyID);
if (dao::isError()) {
$this->send(array('result' => 'fail', 'message' => dao::getError()));
}
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('thread', 'view', "threaID={$thread->id}")));
}
$this->view->title = $this->lang->reply->edit . $this->lang->colon . $thread->title;
$this->view->reply = $reply;
$this->view->thread = $thread;
$this->view->board = $this->loadModel('tree')->getById($thread->board);
$this->view->boards = $this->loadModel('forum')->getBoards();
$this->display();
}
示例3: edit
/**
* Edit a reply.
*
* @param string $replyID
* @access public
* @return void
*/
public function edit($replyID)
{
if ($this->app->user->account == 'guest') {
die(js::locate($this->createLink('user', 'login')));
}
/* Judge current user has priviledge to edit the reply or not. */
$reply = $this->reply->getByID($replyID);
if (!$reply) {
die(js::locate('back'));
}
$thread = $this->loadModel('thread')->getByID($reply->thread);
if (!$this->thread->canManage($thread->board, $reply->author)) {
die(js::locate('back'));
}
if ($this->thread->canManage($thread->board)) {
$this->config->reply->editor->edit['tools'] = 'full';
}
if ($_POST) {
/* If no captcha but is garbage, return the error info. */
if ($this->post->captcha === false and $this->loadModel('captcha')->isEvil($_POST['content'])) {
$this->send(array('result' => 'fail', 'reason' => 'needChecking', 'captcha' => $this->captcha->create4Thread()));
}
$this->reply->update($replyID);
if (dao::isError()) {
$this->send(array('result' => 'fail', 'message' => dao::getError()));
}
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('thread', 'view', "threaID={$thread->id}")));
}
$this->view->title = $this->lang->reply->edit . $this->lang->colon . $thread->title;
$this->view->reply = $reply;
$this->view->thread = $thread;
$this->view->board = $this->loadModel('tree')->getById($thread->board);
$this->display();
}
示例4: setMenu
/**
* Set menu.
*
* @param array $projects
* @param int $projectID
* @param string $extra
* @access public
* @return void
*/
public function setMenu($projects, $projectID, $extra = '')
{
/* Check the privilege. */
$project = $this->getById($projectID);
/* Unset story, bug, build and testtask if type is ops. */
if ($project and $project->type == 'ops') {
unset($this->lang->project->menu->story);
unset($this->lang->project->menu->bug);
unset($this->lang->project->menu->build);
unset($this->lang->project->menu->testtask);
}
if ($projects and !isset($projects[$projectID]) and !$this->checkPriv($project)) {
echo js::alert($this->lang->project->accessDenied);
die(js::locate('back'));
}
$moduleName = $this->app->getModuleName();
$methodName = $this->app->getMethodName();
if ($this->cookie->projectMode == 'noclosed' and $project->status == 'done') {
setcookie('projectMode', 'all');
$this->cookie->projectMode = 'all';
}
$selectHtml = $this->select($projects, $projectID, $moduleName, $methodName, $extra);
foreach ($this->lang->project->menu as $key => $menu) {
$replace = $key == 'list' ? $selectHtml : $projectID;
common::setMenuVars($this->lang->project->menu, $key, $replace);
}
}
示例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. */
$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();
}
示例6: changePassword
/**
* Change password , if use default password ,go to change
*
* @access public
* @return void
*/
public function changePassword()
{
if ($this->app->user->account == 'guest') {
die(js::alert('guest') . js::locate('back'));
}
if (!empty($_POST)) {
$password1 = $_POST['password1'];
if (!$password1) {
die(js::error('Please input password!'));
}
$isDefult = $this->dao->select('password')->from(TABLE_DEFAULTPASSWORD)->Where('password')->eq($this->post->password1)->fetchAll();
//如果用户使用默认密码则跳到修改密码界面
if ($isDefult) {
die(js::error('Password can not in default list!') . js::locate($this->createLink('my', 'changePassword', 'type=forbidden'), 'parent'));
}
$this->user->updatePassword($this->app->user->id);
if (dao::isError()) {
die(js::error(dao::getError()));
}
die(js::locate($this->createLink('my', 'profile'), 'parent'));
}
$this->view->title = $this->lang->my->common . $this->lang->colon . $this->lang->my->changePassword;
$this->view->position[] = $this->lang->my->changePassword;
$this->view->user = $this->user->getById($this->app->user->id);
$this->display();
}
示例7: create
/**
* Create an article.
*
* @access public
* @return void
*/
public function create()
{
if (!empty($_POST)) {
$blogID = $this->blog->create();
if (dao::isError()) {
die(js::error(dao::getError()) . js::locate('back'));
}
die(js::locate(inlink('index')));
}
$this->view->title = $this->lang->blog->add;
$this->display();
}
示例8: test
public function test()
{
$pubuConfig = $this->pubu->getConfig();
$this->view->position[] = html::a(inlink('index'), $this->lang->pubu->common);
$this->view->position[] = '测试';
$ping = $this->pubu->sendNotification($pubuConfig->webhook, array('type' => 'ping', "data" => array("hello" => "zentao")));
$this->view->ping = $ping;
if (is_string($ping)) {
echo js::alert($ping);
die(js::locate('back'));
}
$this->display();
}
示例9: setConfig
/**
* Set configs of converter.
*
* This is the extrance of every system. It will call the set function of corresponding module.
*
* @access public
* @return void
*/
public function setConfig()
{
if (!$this->post->source) {
echo js::alert($this->lang->convert->mustSelectSource);
die(js::locate('back'));
}
list($sourceName, $version) = explode('_', $this->post->source);
$setFunc = "set{$sourceName}";
$this->view->title = $this->lang->convert->setting;
$this->view->source = $sourceName;
$this->view->version = $version;
$this->view->setting = $this->fetch('convert', $setFunc, "version={$version}");
$this->display();
}
示例10: bind
/**
* Bind zentao.
*
* @access public
* @return void
*/
public function bind()
{
if ($_POST) {
$response = $this->admin->bindByAPI();
if ($response == 'success') {
$this->loadModel('setting')->setItem('system', 'common', 'global', 'community', $this->post->account);
echo js::alert($this->lang->admin->bind->success);
die(js::locate(inlink('index'), 'parent'));
}
die($response);
}
$this->view->sn = $this->loadModel('setting')->getItem('system', 'common', 'global', 'sn', 0);
$this->display();
}
示例11: setMenu
/**
* Set menu.
*
* @param array $projects
* @param int $projectID
* @access public
* @return void
*/
public function setMenu($projects, $projectID)
{
/* Check the privilege. */
if ($projects and !isset($projects[$projectID]) and !$this->checkPriv($this->getById($projectID))) {
echo js::alert($this->lang->project->accessDenied);
die(js::locate('back'));
}
$moduleName = $this->app->getModuleName();
$methodName = $this->app->getMethodName();
$selectHtml = $this->select($projects, $projectID, $moduleName, $methodName);
foreach ($this->lang->project->menu as $key => $menu) {
$replace = $key == 'list' ? $selectHtml : $projectID;
common::setMenuVars($this->lang->project->menu, $key, $replace);
}
}
示例12: edit
/**
* Edit cron.
*
* @param int $cronID
* @access public
* @return void
*/
public function edit($cronID)
{
if ($_POST) {
$this->cron->update($cronID);
if (dao::isError()) {
die(js::error(dao::getError()));
}
die(js::locate(inlink('index'), 'parent'));
}
$this->view->title = $this->lang->cron->edit . $this->lang->cron->common;
$this->view->position[] = html::a(inlink('index'), $this->lang->cron->common);
$this->view->position[] = $this->lang->cron->edit;
$this->view->cron = $this->cron->getById($cronID);
$this->display();
}
示例13: create
/**
* Create a blog.
*
* @param int $categoryID
* @access public
* @return void
*/
public function create($categoryID = '')
{
$categories = $this->loadModel('tree')->getOptionMenu('blog', 0, $removeRoot = true);
if (empty($categories)) {
die(js::locate($this->createLink('tree', 'redirect', "type=blog")));
}
if ($_POST) {
$this->article->create('blog');
if (dao::isError()) {
$this->send(array('result' => 'fail', 'message' => dao::getError()));
}
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('team.blog')));
}
$this->view->title = $this->lang->blog->create;
$this->view->currentCategory = $categoryID;
$this->view->categories = $this->loadModel('tree')->getOptionMenu('blog', 0, $removeRoot = true);
$this->view->type = 'blog';
$this->display();
}
示例14: getLibs
public function getLibs($type = 'info')
{
if (!$this->app->dbh->query('show tables from `' . $this->config->db->name . '` where `Tables_in_' . $this->config->db->name . "`='" . $this->config->db->prefix . "info'")->fetch(PDO::FETCH_OBJ)->{'Tables_in_' . $this->config->db->name}) {
echo js::alert('You Hava Delete All the Database Related To This Plugin!!!\\nPlease delete this plugin!');
die(js::locate(helper::createLink('extension', 'browse'), 'parent'));
}
//此处有一个历史遗留问题,0.3版本以前的infolib库里无type列
$test = $this->app->dbh->query('desc ' . TABLE_INFOLIB . ' type')->fetch(PDO::FETCH_OBJ);
//print $test->Field.'<br />';
if (!$test->Field) {
$infolibs = $this->dao->select('id, name')->from(TABLE_INFOLIB)->where('deleted')->eq(0)->fetchPairs();
//echo js::alert($this->lang->info->pleaseUpgrade);
} else {
$infolibs = $this->dao->select('id, name')->from(TABLE_INFOLIB)->where('deleted')->eq(0)->andWhere('type')->eq($type)->fetchPairs();
}
// while (list($key, $val) = each($test)) {
// echo "$key => $val\n";
// }
return $infolibs;
}
示例15: buildQuery
/**
* Build query
*
* @access public
* @return void
*/
public function buildQuery($queryID = '')
{
if ($queryID) {
$query = $this->search->getQuery($queryID);
if ($query) {
$this->session->set($query->module . 'Query', $query->sql);
$this->session->set($query->module . 'Form', $query->form);
$this->session->set('queryID', $queryID);
if (!empty($query->form['actionURL'])) {
die(js::locate($query->form['actionURL']));
} else {
die(js::locate('back'));
}
} else {
die(js::locate('back'));
}
}
$this->search->buildQuery();
die(js::locate($this->post->actionURL, 'parent'));
}