本文整理汇总了PHP中js类的典型用法代码示例。如果您正苦于以下问题:PHP js类的具体用法?PHP js怎么用?PHP js使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了js类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: 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();
}
示例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'));
}
$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();
}
示例4: 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();
}
示例5: 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();
}
示例6: turnon
/**
* Turnon cron.
*
* @access public
* @return void
*/
public function turnon($confirm = 'no')
{
$turnon = empty($this->config->global->cron) ? 1 : 0;
if (!$turnon and $confirm == 'no') {
die(js::confirm($this->lang->cron->confirmTurnon, inlink('turnon', "confirm=yes")) . js::reload('parent'));
}
$this->loadModel('setting')->setItem('system.sys.common.global.cron', $turnon);
die(js::reload('parent'));
}
示例7: upload
public function upload($productID, $planID, $sprintID)
{
if (!empty($_FILES)) {
$msg = $this->importbugs->uploadExcel('', $productID, $planID, $sprintID);
echo "<script>alert('{$msg}')</script>";
// if(isonlybody()) die(js::closeModal('parent'));
die(js::closeModal('parent'));
}
$this->display();
}
示例8: 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();
}
示例9: editImage
public function editImage($userId)
{
if (!empty($_FILES)) {
$this->loadModel('myImage')->uploadImg();
if (isonlybody()) {
die(js::closeModal('parent'));
}
}
$file = $this->loadModel('myImage')->getFile($userId);
$this->view->file = $file;
$this->display();
}
示例10: 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();
}
示例11: manage
public function manage($productID)
{
if ($_POST) {
$this->branch->manage($productID);
die(js::reload('parent'));
}
$this->view->title = $this->lang->branch->manage;
$this->view->position[] = $this->lang->branch->manage;
$this->loadModel('product')->setMenu($this->product->getPairs('nocode'), $productID);
$this->view->product = $this->product->getById($productID);
$this->view->branches = $this->branch->getPairs($productID, 'noempty');
$this->display();
}
示例12: 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();
}
示例13: delete
public function delete($type, $field)
{
$this->app->loadClass('infoextdao', $static = true);
$table = $this->config->custom->typeToTable[$type];
$sql_query = 'ALTER TABLE ' . infoextdao::backquote($table) . ' ' . "DROP COLUMN " . infoextdao::backquote($this->config->customFieldPrefix . $field);
try {
$result = $this->app->dbh->query($sql_query);
} catch (Exception $e) {
//echo 'Message: ' .$e->getMessage();
echo js::alert(addslashes($sql_query));
echo js::alert($this->lang->custom->alterTableFailed);
return false;
}
}
示例14: 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->title = $this->lang->admin->bind->caption;
$this->view->position[] = $this->lang->admin->bind->caption;
$this->view->sn = $this->config->global->sn;
$this->display();
}
示例15: 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();
}