/** * 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(); }
/** * 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(); }
/** * 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(); }
/** * 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(); }
/** * 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(); }
/** * 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')); }
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(); }
/** * 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(); }
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(); }
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(); }
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(); }
/** * 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(); }
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; } }
/** * 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(); }
/** * 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(); }
/** * Create batch todo * * @access public * @return void */ public function batchCreate() { $todos = fixer::input('post')->cleanInt('date')->get(); for ($i = 0; $i < $this->config->todo->batchCreate; $i++) { if ($todos->names[$i] != '' || isset($todos->bugs[$i + 1]) || isset($todos->tasks[$i + 1])) { $todo->account = $this->app->user->account; if ($this->post->date == false) { $todo->date = '2030-01-01'; } else { $todo->date = $this->post->date; } $todo->type = $todos->types[$i]; $todo->pri = $todos->pris[$i]; $todo->name = isset($todos->names[$i]) ? $todos->names[$i] : ''; $todo->desc = $todos->descs[$i]; $todo->begin = $todos->begins[$i]; $todo->end = $todos->ends[$i]; $todo->status = "wait"; $todo->private = 0; $todo->idvalue = 0; if ($todo->type == 'bug') { $todo->idvalue = isset($todos->bugs[$i + 1]) ? $todos->bugs[$i + 1] : 0; } if ($todo->type == 'task') { $todo->idvalue = isset($todos->tasks[$i + 1]) ? $todos->tasks[$i + 1] : 0; } $this->dao->insert(TABLE_TODO)->data($todo)->autoCheck()->exec(); if (dao::isError()) { echo js::error(dao::getError()); die(js::reload('parent')); } } else { unset($todos->types[$i]); unset($todos->pris[$i]); unset($todos->names[$i]); unset($todos->descs[$i]); unset($todos->begins[$i]); unset($todos->ends[$i]); } } }
/** * 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(); }
/** * Set menu. * * @param array $products * @param int $productID * @param string $extra * @access public * @return void */ public function setMenu($products, $productID, $extra = '') { /* Has access privilege?. */ if ($products and !isset($products[$productID]) and !$this->checkPriv($this->getById($productID))) { echo js::alert($this->lang->product->accessDenied); die(js::locate('back')); } $currentModule = $this->app->getModuleName(); $currentMethod = $this->app->getMethodName(); /* init currentModule and currentMethod for report*/ if ($currentModule == 'story') { $currentModule = 'product'; } if ($currentMethod == 'report') { $currentMethod = 'browse'; } $selectHtml = $this->select($products, $productID, $currentModule, $currentMethod, $extra); foreach ($this->lang->product->menu as $key => $menu) { $replace = $key == 'list' ? $selectHtml : $productID; common::setMenuVars($this->lang->product->menu, $key, $replace); } }
public function sync2db($config) { $ldapUsers = $this->getUsers($config); $user = new stdclass(); $account = ''; $i = 0; for (; $i < $ldapUsers['count']; $i++) { $user->account = $ldapUsers[$i][$config->uid][0]; $user->email = $ldapUsers[$i][$config->mail][0]; $user->realname = $ldapUsers[$i][$config->name][0]; $account = $this->dao->select('*')->from(TABLE_USER)->where('account')->eq($user->account)->fetch('account'); if ($account == $user->account) { $this->dao->update(TABLE_USER)->data($user)->where('account')->eq($user->account)->autoCheck()->exec(); } else { $this->dao->insert(TABLE_USER)->data($user)->autoCheck()->exec(); } if (dao::isError()) { echo js::error(dao::getError()); die(js::reload('parent')); } } return $i; }
/** * Create an announce. * * @param int $categoryID * @access public * @return void */ public function create($categoryID = '') { $this->loadModel('article'); $categories = $this->loadModel('tree')->getOptionMenu('announce', 0, $removeRoot = true); if (empty($categories)) { die(js::locate($this->createLink('tree', 'redirect', "type=announce"))); } if ($_POST) { $announceID = $this->article->create('announce'); $actionID = $this->loadModel('action')->create('announce', $announceID, 'created'); $users = $this->loadModel('user')->getPairs('nodeleted,noclosed,noempty'); $this->loadModel('action')->sendNotice($actionID, array_keys($users), true); if (dao::isError()) { $this->send(array('result' => 'fail', 'message' => dao::getError())); } $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('announce', 'browse'))); } unset($this->lang->announce->menu); $this->view->title = $this->lang->announce->create; $this->view->currentCategory = $categoryID; $this->view->categories = $this->loadModel('tree')->getOptionMenu('announce', 0, $removeRoot = true); $this->display(); }
public function updateDefaultPwd() { $data = fixer::input('post')->get(); $pwdList = $this->post->pwdList ? $this->post->pwdList : array(); if (!empty($pwdList)) { /* Initialize todos from the post data. */ foreach ($pwdList as $pwdID) { $pwd = $data->password[$pwdID]; if ('' === $pwd) { continue; } if ($pwdID > 0) { $this->updatePwd($pwdID, $pwd); } else { $this->setdefaultpwd($pwd); } } } if (dao::isError()) { echo js::error(dao::getError()); die(js::reload('parent')); } }
/** * Bind user. * * @access public * @return object */ public function bind() { $data = fixer::input('post')->get(); if ($data->bindType == 'bind') { if (empty($data->bindPassword)) { die(js::alert($this->lang->sso->bindNoPassword)); } $password = md5($data->bindPassword); $user = $this->dao->select('*')->from(TABLE_USER)->where('account')->eq($data->bindUser)->andWhere('password')->eq($password)->andWhere('deleted')->eq('0')->fetch(); if (empty($user)) { die(js::alert($this->lang->sso->bindNoUser)); } $user->ranzhi = $this->session->ssoData->account; $this->dao->update(TABLE_USER)->set('ranzhi')->eq($user->ranzhi)->where('id')->eq($user->id)->exec(); } elseif ($data->bindType == 'add') { if (!$this->loadModel('user')->checkPassword()) { return; } $user = $this->dao->select('*')->from(TABLE_USER)->where('account')->eq($data->account)->fetch(); if ($user) { die(js::alert($this->lang->sso->bindHasAccount)); } if (isset($this->config->safe->mode) and $this->user->computePasswordStrength($data->password1) < $this->config->safe->mode) { dao::$errors['password1'][] = $this->lang->user->weakPassword; return false; } $user = new stdclass(); $user->account = $data->account; $user->password = md5($data->password1); $user->realname = $data->realname; $user->gender = isset($data->gender) ? $data->gender : ''; $user->email = $data->email; $user->ranzhi = $this->session->ssoData->account; $this->dao->insert(TABLE_USER)->data($user)->autoCheck()->batchCheck($this->config->user->create->requiredFields, 'notempty')->check('account', 'unique')->check('account', 'account')->checkIF($user->email != false, 'email', 'email')->exec(); } return $user; }
<?php /** * The browse view file of product dept of ZenTaoPMS. * * @copyright Copyright 2009-2013 青岛易软天创网络科技有限公司 (QingDao Nature Easy Soft Network Technology Co,LTD www.cnezsoft.com) * @license LGPL (http://www.gnu.org/licenses/lgpl.html) * @author Chunsheng Wang <*****@*****.**> * @package product * @version $Id$ * @link http://www.zentao.net */ include '../../common/view/header.html.php'; include '../../common/view/treeview.html.php'; include '../../common/view/colorize.html.php'; js::set('deptID', $deptID); ?> <table class='cont-lt1'> <tr><td colspan='3'><div id='querybox'><?php echo $searchForm; ?> </div></td></tr> <tr valign='top'> <td class='side'> <div class='box-title'><?php echo $lang->dept->common; ?> </div> <div class='box-content'> <?php echo $deptTree;
/** * Undelete a record. * * @param int $actionID * @access public * @return void */ public function undelete($actionID) { $action = $this->getById($actionID); if ($action->action != 'deleted') { return; } if ($action->objectType == 'product') { $product = $this->dao->select('name,code')->from(TABLE_PRODUCT)->where('id')->eq($action->objectID)->fetch(); $count = $this->dao->select('COUNT(*) AS count')->from(TABLE_PRODUCT)->where('name')->eq($product->name)->orWhere('code')->eq($product->code)->fetch('count'); if ($count > 0) { echo js::alert(sprintf($this->lang->action->needEdit, $this->lang->action->objectTypes['product'])); die(js::locate(helper::createLink('product', 'edit', "productID={$action->objectID}&action=undelete&extra={$actionID}"), 'parent')); } } elseif ($action->objectType == 'project') { $project = $this->dao->select('name,code')->from(TABLE_PROJECT)->where('id')->eq($action->objectID)->fetch(); $count = $this->dao->select('COUNT(*) AS count')->from(TABLE_PROJECT)->where('name')->eq($project->name)->orWhere('code')->eq($project->code)->fetch('count'); if ($count > 0) { echo js::alert(sprintf($this->lang->action->needEdit, $this->lang->action->objectTypes['project'])); die(js::locate(helper::createLink('project', 'edit', "projectID={$action->objectID}&action=undelete&extra={$actionID}"), 'parent')); } } /* Update deleted field in object table. */ $table = $this->config->objectTables[$action->objectType]; $this->dao->update($table)->set('deleted')->eq(0)->where('id')->eq($action->objectID)->exec(); /* Update action record in action table. */ $this->dao->update(TABLE_ACTION)->set('extra')->eq(ACTIONMODEL::BE_UNDELETED)->where('id')->eq($actionID)->exec(); $this->create($action->objectType, $action->objectID, 'undeleted'); }
/** * batch unlink story. * * @param int $projectID * @access public * @return void */ public function batchUnlinkStory($projectID) { if (isset($_POST['storyIDList'])) { foreach ($this->post->storyIDList as $storyID) { $this->project->unlinkStory($projectID, $storyID); } } die(js::locate($this->createLink('project', 'story', "projectID={$projectID}"))); }
/** * Batch finish todos. * * @access public * @return void */ public function batchFinish() { if (!empty($_POST['todoIDList'])) { foreach ($_POST['todoIDList'] as $todoID) { $todo = $this->todo->getById($todoID); if ($todo->status != 'done') { $this->todo->finish($todoID); } } die(js::reload('parent')); } }
/** * The create view file of product module of chanzhiEPS. * * @copyright Copyright 2013-2013 青岛息壤网络信息有限公司 (QingDao XiRang Network Infomation Co,LTD www.xirangit.com) * @license http://api.chanzhi.org/goto.php?item=license * @author Xiying Guan <*****@*****.**> * @package product * @version $Id$ * @link http://www.chanzhi.org */ include '../../common/view/header.admin.html.php'; include '../../common/view/kindeditor.html.php'; include '../../common/view/chosen.html.php'; js::set('key', count($product->attributes)); js::set('currency', $lang->product->currency); ?> <div class='panel'> <div class='panel-heading'><?php echo $lang->product->edit; ?> </div> <div class='panel-body'> <form method='post' id='ajaxForm'> <table class='table table-form'> <tr> <th class='w-100px'><?php echo $lang->product->category; ?> </th> <td class='w-p40'><?php
/** * Batch change the stage of story. * * @param string $stage * @access public * @return void */ public function batchChangeStage($stage) { $storyIDList = $this->post->storyIDList ? $this->post->storyIDList : die(js::locate($this->session->storyList, 'parent')); $allChanges = $this->story->batchChangeStage($storyIDList, $stage); if (dao::isError()) { die(js::error(dao::getError())); } foreach ($allChanges as $storyID => $changes) { $actionID = $this->action->create('story', $storyID, 'Edited'); $this->action->logHistory($actionID, $changes); $this->sendmail($storyID, $actionID); } die(js::locate($this->session->storyList, 'parent')); }
/** * Batch unlink story. * * @param int $releaseID * @access public * @return void */ public function batchUnlinkBug($releaseID) { $this->release->batchUnlinkBug($releaseID); die(js::locate($this->createLink('release', 'view', "releaseID={$releaseID}&type=bug"), 'parent')); }
<?php /** * The browse view file of company module of chanzhiEPS. * * @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com) * @license ZPLV12 (http://zpl.pub/page/zplv12.html) * @author Xiying Guan <*****@*****.**> * @package company * @version $Id$ * @link http://www.chanzhi.org */ include '../../common/view/header.admin.html.php'; include '../../common/view/kindeditor.html.php'; js::set('score', commonModel::isAvailable('score')); js::set('setCounts', $lang->site->setCounts); $displayAll = $display === 'all'; ?> <div class='panel display-<?php echo $display; ?> '> <div class='panel-heading'><strong><i class='icon-building'></i> <?php echo $lang->company->setBasic; ?> </strong></div> <div class='panel-body'> <form method='post' id='ajaxForm' class='ve-form'> <table class='table table-form'> <tr data-row='name'> <th class='w-100px'><?php