* Move die to return.

This commit is contained in:
zhujinyong
2022-02-22 09:02:00 +08:00
parent b17c3c8206
commit 002e215a3d
11 changed files with 122 additions and 124 deletions
+1 -1
View File
@@ -126,6 +126,6 @@ class index extends control
}
}
}
die($method);
echo $method;
}
}
+5 -5
View File
@@ -19,7 +19,7 @@ class install extends control
*/
public function __construct()
{
if(!defined('IN_INSTALL')) die();
if(!defined('IN_INSTALL')) helper::end();
parent::__construct();
$this->app->loadLang('user');
$this->app->loadLang('admin');
@@ -178,7 +178,7 @@ class install extends control
if(!empty($_POST))
{
$this->loadModel('setting')->setItem('system.common.global.mode', $this->post->mode); // Update mode.
die(js::locate(inlink('step5'), 'parent'));
return print(js::locate(inlink('step5'), 'parent'));
}
$this->app->loadLang('upgrade');
@@ -198,10 +198,10 @@ class install extends control
if(!empty($_POST))
{
$this->install->grantPriv();
if(dao::isError()) die(js::error(dao::getError()));
if(dao::isError()) return print(js::error(dao::getError()));
$this->install->updateLang();
if(dao::isError()) die(js::error(dao::getError()));
if(dao::isError()) return print(js::error(dao::getError()));
if($this->post->importDemoData) $this->install->importDemoData();
if(dao::isError()) echo js::alert($this->lang->install->errorImportDemoData);
@@ -212,7 +212,7 @@ class install extends control
$this->loadModel('setting')->setItem('system.common.safe.changeWeak', '1');
$this->loadModel('setting')->setItem('system.common.global.cron', 1);
$this->loadModel('api')->createDemoData($this->lang->api->zentaoAPI, 'http://' . $_SERVER['HTTP_HOST'] . $this->app->config->webRoot . 'api.php/v1', '16.0');
die(js::locate(inlink('step6'), 'parent'));
return print(js::locate(inlink('step6'), 'parent'));
}
$this->app->loadLang('upgrade');
+2 -2
View File
@@ -489,7 +489,7 @@ class installModel extends model
catch (PDOException $exception)
{
echo $exception->getMessage();
die();
helper::end();
}
return true;
}
@@ -502,7 +502,7 @@ class installModel extends model
*/
public function grantPriv()
{
if($this->post->password == '') die(js::error($this->lang->install->errorEmptyPassword));
if($this->post->password == '') return print(js::error($this->lang->install->errorEmptyPassword));
/* Insert a company. */
$company = new stdclass();
+5 -5
View File
@@ -109,13 +109,13 @@ class jenkins extends control
*/
public function delete($id, $confim = 'no')
{
if($confim != 'yes') die(js::confirm($this->lang->jenkins->confirmDelete, inlink('delete', "id=$id&confirm=yes")));
if($confim != 'yes') return print(js::confirm($this->lang->jenkins->confirmDelete, inlink('delete', "id=$id&confirm=yes")));
$jobs = $this->dao->select('*')->from(TABLE_JOB)->where('server')->eq($id)->andWhere('engine')->eq('jenkins')->andWhere('deleted')->eq('0')->fetchAll();
if($jobs) die(js::alert($this->lang->jenkins->error->linkedJob));
if($jobs) return print(js::alert($this->lang->jenkins->error->linkedJob));
$this->jenkins->delete(TABLE_PIPELINE, $id);
die(js::reload('parent'));
echo js::reload('parent');
}
/**
@@ -127,9 +127,9 @@ class jenkins extends control
*/
public function ajaxGetJenkinsTasks($id)
{
if(empty($id)) die(json_encode(array('' => '')));
if(empty($id)) return print(json_encode(array('' => '')));
$tasks = $this->jenkins->getTasks($id);
die(json_encode($tasks));
echo json_encode($tasks);
}
}
-1
View File
@@ -72,7 +72,6 @@ class jenkinsModel extends model
foreach($response->jobs as $job) $tasks[basename($job->url)] = $job->name;
}
return $tasks;
}
/**
+6 -7
View File
@@ -219,10 +219,10 @@ class job extends control
*/
public function delete($id, $confirm = 'no')
{
if($confirm != 'yes') die(js::confirm($this->lang->job->confirmDelete, inlink('delete', "jobID=$id&confirm=yes")));
if($confirm != 'yes') return print(js::confirm($this->lang->job->confirmDelete, inlink('delete', "jobID=$id&confirm=yes")));
$this->job->delete(TABLE_JOB, $id);
die(js::reload('parent'));
echo js::reload('parent');
}
/**
@@ -343,7 +343,7 @@ class job extends control
public function ajaxGetProductByRepo($repoID)
{
$repo = $this->loadModel('repo')->getRepoByID($repoID);
if(empty($repo)) die(json_encode(array(""=>"")));
if(empty($repo)) return print(json_encode(array(""=>"")));
$product = $repo->product;
if(strpos($product, ','))
@@ -359,11 +359,11 @@ class job extends control
if($productLeft == $productRight) $matchedProducts[$productName] = $productRight;
}
}
die(json_encode($matchedProducts));
return print(json_encode($matchedProducts));
}
$productName = $this->loadModel('product')->getByID($repo->product)->name;
die(json_encode(array($productName => $repo->product)));
ehco json_encode(array($productName => $repo->product));
}
/**
@@ -405,7 +405,6 @@ class job extends control
}
}
echo html::select('repo', $repoPairs, '', "class='form-control chosen'");
die();
}
/**
@@ -431,7 +430,7 @@ class job extends control
public function ajaxCheckSonarqubeLink($repoID, $jobID = 0)
{
$repo = $this->loadModel('job')->getSonarqubeByRepo(array($repoID), $jobID, true);
if(!empty($repo))
if(!empty($repo))
{
$message = $repo[$repoID]->deleted ? $this->lang->job->jobIsDeleted : sprintf($this->lang->job->repoExists, $repo[$repoID]->id . '-' . $repo[$repoID]->name);
$this->send(array('result' => 'fail', 'message' => $message));
+39 -39
View File
@@ -110,12 +110,12 @@ class kanban extends control
{
$changes = $this->kanban->closeSpace($spaceID);
if(dao::isError()) die(js::error(dao::getError()));
if(dao::isError()) return print(js::error(dao::getError()));
$actionID = $this->action->create('kanbanSpace', $spaceID, 'closed', $this->post->comment);
$this->action->logHistory($actionID, $changes);
die(js::reload('parent.parent'));
return print(js::reload('parent.parent'));
}
$this->view->space = $this->kanban->getSpaceById($spaceID);
@@ -137,12 +137,12 @@ class kanban extends control
{
if($confirm == 'no')
{
die(js::confirm($this->lang->kanban->confirmDelete, $this->createLink('kanban', 'deleteSpace', "spaceID=$spaceID&confirm=yes")));
return print(js::confirm($this->lang->kanban->confirmDelete, $this->createLink('kanban', 'deleteSpace', "spaceID=$spaceID&confirm=yes")));
}
else
{
$this->kanban->delete(TABLE_KANBANSPACE, $spaceID);
die(js::reload('parent'));
return print(js::reload('parent'));
}
}
@@ -235,12 +235,12 @@ class kanban extends control
{
$changes = $this->kanban->close($kanbanID);
if(dao::isError()) die(js::error(dao::getError()));
if(dao::isError()) return print(js::error(dao::getError()));
$actionID = $this->action->create('kanban', $kanbanID, 'closed', $this->post->comment);
$this->action->logHistory($actionID, $changes);
die(js::reload('parent.parent'));
return print(js::reload('parent.parent'));
}
$this->view->kanban = $this->kanban->getByID($kanbanID);
@@ -265,11 +265,11 @@ class kanban extends control
if(!$kanban)
{
if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'fail', 'code' => 404, 'message' => '404 Not found'));
die(js::error($this->lang->notFound) . js::locate($this->createLink('kanban', 'space')));
return print(js::error($this->lang->notFound) . js::locate($this->createLink('kanban', 'space')));
}
$kanbanIdList = $this->kanban->getCanViewObjects();
if(!$this->app->user->admin and !in_array($kanbanID, $kanbanIdList)) die(js::error($this->lang->kanban->accessDenied) . js::locate('back'));
if(!$this->app->user->admin and !in_array($kanbanID, $kanbanIdList)) return print(js::error($this->lang->kanban->accessDenied) . js::locate('back'));
$space = $this->kanban->getSpaceByID($kanban->space);
@@ -305,12 +305,12 @@ class kanban extends control
{
if($confirm == 'no')
{
die(js::confirm($this->lang->kanban->confirmDelete, $this->createLink('kanban', 'delete', "kanbanID=$kanbanID&confirm=yes")));
return print(js::confirm($this->lang->kanban->confirmDelete, $this->createLink('kanban', 'delete', "kanbanID=$kanbanID&confirm=yes")));
}
else
{
$this->kanban->delete(TABLE_KANBAN, $kanbanID);
die(js::locate($this->createLink('kanban', 'space'), 'parent'));
return print(js::locate($this->createLink('kanban', 'space'), 'parent'));
}
}
@@ -428,12 +428,12 @@ class kanban extends control
{
if($confirm == 'no')
{
die(js::confirm($this->lang->kanbanregion->confirmDelete, $this->createLink('kanban', 'deleteRegion', "regionID=$regionID&confirm=yes")));
return print(js::confirm($this->lang->kanbanregion->confirmDelete, $this->createLink('kanban', 'deleteRegion', "regionID=$regionID&confirm=yes")));
}
else
{
$this->kanban->delete(TABLE_KANBANREGION, $regionID);
die(js::reload('parent'));
return print(js::reload('parent'));
}
}
@@ -579,12 +579,12 @@ class kanban extends control
$laneType = $this->kanban->getLaneById($laneID)->type;
$confirmTip = in_array($laneType, array('story', 'task', 'bug')) ? sprintf($this->lang->kanbanlane->confirmDeleteTip, $this->lang->{$laneType}->common) : $this->lang->kanbanlane->confirmDelete;
die(js::confirm($confirmTip, $this->createLink('kanban', 'deleteLane', "laneID=$laneID&confirm=yes"), ''));
return print(js::confirm($confirmTip, $this->createLink('kanban', 'deleteLane', "laneID=$laneID&confirm=yes"), ''));
}
else
{
$this->kanban->delete(TABLE_KANBANLANE, $laneID);
die(js::reload('parent'));
return print(js::reload('parent'));
}
}
@@ -646,7 +646,7 @@ class kanban extends control
{
if($confirm == 'no')
{
die(js::confirm($this->lang->kanbancolumn->confirmArchive, $this->createLink('kanban', 'archiveColumn', "columnID=$columnID&confirm=yes")));
return print(js::confirm($this->lang->kanbancolumn->confirmArchive, $this->createLink('kanban', 'archiveColumn', "columnID=$columnID&confirm=yes")));
}
else
{
@@ -664,12 +664,12 @@ class kanban extends control
}
$this->kanban->archiveColumn($columnID);
if(dao::isError()) die(js::error(dao::getError()));
if(dao::isError()) return print(js::error(dao::getError()));
$this->loadModel('action')->create('kanbancolumn', $columnID, 'archived');
if(isonlybody()) die(js::reload('parent.parent'));
die(js::reload('parent'));
if(isonlybody()) return print(js::reload('parent.parent'));
return print(js::reload('parent'));
}
}
@@ -685,15 +685,15 @@ class kanban extends control
{
if($confirm == 'no')
{
die(js::confirm($this->lang->kanbancolumn->confirmRestore, $this->createLink('kanban', 'restoreColumn', "columnID=$columnID&confirm=yes"), ''));
return print(js::confirm($this->lang->kanbancolumn->confirmRestore, $this->createLink('kanban', 'restoreColumn', "columnID=$columnID&confirm=yes"), ''));
}
else
{
$this->kanban->restoreColumn($columnID);
if(dao::isError()) die(js::error(dao::getError()));
if(dao::isError()) return print(js::error(dao::getError()));
$this->loadModel('action')->create('kanbancolumn', $columnID, 'restore');
die(js::reload('parent'));
return print(js::reload('parent'));
}
}
@@ -741,7 +741,7 @@ class kanban extends control
if($confirm == 'no')
{
$confirmLang = $column->parent > 0 ? $this->lang->kanbancolumn->confirmDeleteChild : $this->lang->kanbancolumn->confirmDelete;
die(js::confirm($confirmLang, $this->createLink('kanban', 'deleteColumn', "columnID=$columnID&confirm=yes")));
return print(js::confirm($confirmLang, $this->createLink('kanban', 'deleteColumn', "columnID=$columnID&confirm=yes")));
}
else
{
@@ -749,7 +749,7 @@ class kanban extends control
$this->dao->delete()->from(TABLE_KANBANCOLUMN)->where('id')->eq($columnID)->exec();
die(js::reload('parent'));
return print(js::reload('parent'));
}
}
@@ -956,7 +956,7 @@ class kanban extends control
$this->kanban->moveCard($cardID, $fromColID, $toColID, $fromLaneID, $toLaneID, $kanbanID);
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$kanbanGroup = $this->kanban->getKanbanData($kanbanID);
die(json_encode($kanbanGroup));
echo json_encode($kanbanGroup);
}
/**
@@ -1239,7 +1239,7 @@ class kanban extends control
$this->kanban->updateCardColor($cardID, $color);
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$kanbanGroup = $this->kanban->getKanbanData($kanbanID);
die(json_encode($kanbanGroup));
echo json_encode($kanbanGroup);
}
/**
@@ -1274,7 +1274,7 @@ class kanban extends control
{
if($confirm == 'no')
{
die(js::confirm($this->lang->kanbancard->confirmArchive, $this->createLink('kanban', 'archiveCard', "cardID=$cardID&confirm=yes")));
return print(js::confirm($this->lang->kanbancard->confirmArchive, $this->createLink('kanban', 'archiveCard', "cardID=$cardID&confirm=yes")));
}
else
{
@@ -1284,8 +1284,8 @@ class kanban extends control
$actionID = $this->loadModel('action')->create('kanbancard', $cardID, 'archived');
$this->action->logHistory($actionID, $changes);
if(isonlybody()) die(js::reload('parent.parent'));
die(js::reload('parent'));
if(isonlybody()) return print(js::reload('parent.parent'));
echo js::reload('parent');
}
}
@@ -1320,21 +1320,21 @@ class kanban extends control
{
$card = $this->kanban->getCardByID($cardID);
$column = $this->dao->select('*')->from(TABLE_KANBANCOLUMN)->where('id')->eq($card->column)->fetch();
if($column->archived or $column->deleted) die(js::alert(sprintf($this->lang->kanbancard->confirmRestoreTip, $column->name)));
if($column->archived or $column->deleted) return print(js::alert(sprintf($this->lang->kanbancard->confirmRestoreTip, $column->name)));
die(js::confirm(sprintf($this->lang->kanbancard->confirmRestore, $column->name), $this->createLink('kanban', 'restoreCard', "cardID=$cardID&confirm=yes"), ''));
return print(js::confirm(sprintf($this->lang->kanbancard->confirmRestore, $column->name), $this->createLink('kanban', 'restoreCard', "cardID=$cardID&confirm=yes"), ''));
}
else
{
$this->kanban->restoreCard($cardID);
$changes = $this->kanban->restoreCard($cardID);
if(dao::isError()) die(js::error(dao::getError()));
if(dao::isError()) return print(js::error(dao::getError()));
$actionID = $this->loadModel('action')->create('kanbancard', $cardID, 'restore');
$this->action->logHistory($actionID, $changes);
die(js::reload('parent'));
return print(js::reload('parent'));
}
}
@@ -1350,14 +1350,14 @@ class kanban extends control
{
if($confirm == 'no')
{
die(js::confirm($this->lang->kanbancard->confirmDelete, $this->createLink('kanban', 'deleteCard', "cardID=$cardID&confirm=yes")));
return print(js::confirm($this->lang->kanbancard->confirmDelete, $this->createLink('kanban', 'deleteCard', "cardID=$cardID&confirm=yes")));
}
else
{
$this->kanban->delete(TABLE_KANBANCARD, $cardID);
if(isonlybody()) die(js::reload('parent.parent'));
die(js::reload('parent'));
if(isonlybody()) return print(js::reload('parent.parent'));
return print(js::reload('parent'));
}
}
@@ -1395,7 +1395,7 @@ class kanban extends control
$this->app->loadLang('story');
if(!$column) die(js::error($this->lang->notFound) . js::locate($this->createLink('execution', 'kanban', "executionID=$executionID")));
if(!$column) return print(js::error($this->lang->notFound) . js::locate($this->createLink('execution', 'kanban', "executionID=$executionID")));
$title = isset($column->parentName) ? $column->parentName . '/' . $column->name : $column->name;
@@ -1429,7 +1429,7 @@ class kanban extends control
}
$lane = $this->kanban->getLaneById($laneID);
if(!$lane) die(js::error($this->lang->notFound) . js::locate($this->createLink('execution', 'kanban', "executionID=$executionID")));
if(!$lane) return print(js::error($this->lang->notFound) . js::locate($this->createLink('execution', 'kanban', "executionID=$executionID")));
$this->view->title = $from == 'kanban' ? $this->lang->edit . '“' . $lane->name . '”' . $this->lang->kanbanlane->common : zget($this->lang->kanban->laneTypeList, $lane->type) . $this->lang->colon . $this->lang->kanban->setLane;
$this->view->lane = $lane;
@@ -1614,7 +1614,7 @@ class kanban extends control
->exec();
$kanbanGroup = $regionID == 0 ? $this->kanban->getExecutionKanban($executionID, $browseType, $groupBy) : $this->kanban->getRDKanban($executionID, $browseType, $orderBy, $regionID, $groupBy);
die(json_encode($kanbanGroup));
echo json_encode($kanbanGroup);
}
/**
@@ -1638,7 +1638,7 @@ class kanban extends control
$this->loadModel('action')->create('kanbanlane', $laneID, 'Moved');
}
die(js::locate($this->createLink('execution', 'kanban', 'executionID=' . $executionID . '&type=all'), 'parent'));
echo js::locate($this->createLink('execution', 'kanban', 'executionID=' . $executionID . '&type=all'), 'parent');
}
/**
+40 -40
View File
@@ -26,7 +26,7 @@ class mail extends control
if(isset($this->config->mail->mta) and $this->config->mail->mta != 'sendcloud' and !function_exists('fsockopen'))
{
echo js::alert($this->lang->mail->nofsocket);
die(js::locate('back'));
return print(js::locate('back'));
}
}
@@ -65,7 +65,7 @@ class mail extends control
if($this->post->fromAddress == false) $error = sprintf($this->lang->error->notempty, $this->lang->mail->fromAddress);
if(!validater::checkEmail($this->post->fromAddress)) $error .= '\n' . sprintf($this->lang->error->email, $this->lang->mail->fromAddress);
if($error) die(js::alert($error));
if($error) return print(js::alert($error));
echo "<script>setTimeout(function(){parent.location.href='" . inlink('edit') . "'}, 10000)</script>";
$mailConfig = $this->mail->autoDetect($this->post->fromAddress);
@@ -73,7 +73,7 @@ class mail extends control
$mailConfig->domain = common::getSysURL();
$this->session->set('mailConfig', $mailConfig);
die(js::locate(inlink('edit'), 'parent'));
return print(js::locate(inlink('edit'), 'parent'));
}
$this->view->title = $this->lang->mail->common . $this->lang->colon . $this->lang->mail->detect;
@@ -152,7 +152,7 @@ class mail extends control
if(empty($mailConfig->fromName))
{
echo js::alert(sprintf($this->lang->error->notempty, $this->lang->mail->fromName));
die(js::locate($this->server->http_referer));
return print(js::locate($this->server->http_referer));
}
/* The mail need openssl and curl extension when secure is tls. */
@@ -161,17 +161,17 @@ class mail extends control
if(!extension_loaded('openssl'))
{
echo js::alert($this->lang->mail->noOpenssl);
die(js::locate($this->server->http_referer));
return print(js::locate($this->server->http_referer));
}
if(!extension_loaded('curl'))
{
echo js::alert($this->lang->mail->noCurl);
die(js::locate($this->server->http_referer));
return print(js::locate($this->server->http_referer));
}
}
$this->loadModel('setting')->setItems('system.mail', $mailConfig);
if(dao::isError()) die(js::error(dao::getError()));
if(dao::isError()) return print(js::error(dao::getError()));
$this->session->set('mailConfig', '');
@@ -206,13 +206,13 @@ class mail extends control
$mailConfig->sendcloud->accessKey = trim($this->post->accessKey);
$mailConfig->sendcloud->secretKey = trim($this->post->secretKey);
if(empty($mailConfig->sendcloud->accessKey)) die(js::alert(sprintf($this->lang->error->notempty, $this->lang->mail->accessKey)));
if(empty($mailConfig->sendcloud->secretKey)) die(js::alert(sprintf($this->lang->error->notempty, $this->lang->mail->secretKey)));
if(empty($mailConfig->sendcloud->accessKey)) return print(js::alert(sprintf($this->lang->error->notempty, $this->lang->mail->accessKey)));
if(empty($mailConfig->sendcloud->secretKey)) return print(js::alert(sprintf($this->lang->error->notempty, $this->lang->mail->secretKey)));
$this->loadModel('setting')->setItems('system.mail', $mailConfig);
if(dao::isError()) die(js::error(dao::getError()));
if(dao::isError()) return print(js::error(dao::getError()));
die(js::reload('parent'));
return print(js::reload('parent'));
}
$mailConfig = new stdclass();
@@ -245,7 +245,7 @@ class mail extends control
{
if(!$this->config->mail->turnon)
{
die(js::alert($this->lang->mail->needConfigure) . js::locate('back'));
return print(js::alert($this->lang->mail->needConfigure) . js::locate('back'));
}
if($_POST)
@@ -257,12 +257,12 @@ class mail extends control
if(!extension_loaded('openssl'))
{
$this->view->error = array($this->lang->mail->noOpenssl);
die($this->display());
return print($this->display());
}
if(!extension_loaded('curl'))
{
$this->view->error = array($this->lang->mail->noCurl);
die($this->display());
return print($this->display());
}
}
@@ -270,9 +270,9 @@ class mail extends control
if($this->mail->isError())
{
$this->view->error = $this->mail->getError();
die($this->display());
return print($this->display());
}
die(js::alert($this->lang->mail->successSended) . js::locate(inlink('test'), 'parent'));
return print(js::alert($this->lang->mail->successSended) . js::locate(inlink('test'), 'parent'));
}
$this->view->title = $this->lang->mail->common . $this->lang->colon . $this->lang->mail->test;
@@ -359,7 +359,7 @@ class mail extends control
if($queue and $queue->status == 'sended')
{
echo js::alert($this->lang->mail->noticeResend);
die(js::reload('parent'));
return print(js::reload('parent'));
}
if(isset($this->config->mail->async)) $this->config->mail->async = 0;
@@ -376,9 +376,9 @@ class mail extends control
}
$this->dao->update(TABLE_NOTIFY)->data($data)->where('id')->in($queue->id)->exec();
if($data->status == 'fail') die(js::alert($data->failReason));
if($data->status == 'fail') return print(js::alert($data->failReason));
echo js::alert($this->lang->mail->noticeResend);
die(js::reload('parent'));
echo js::reload('parent');
}
/**
@@ -417,10 +417,10 @@ class mail extends control
*/
public function delete($id, $confirm = 'no')
{
if($confirm == 'no') die(js::confirm($this->lang->mail->confirmDelete, inlink('delete', "id=$id&confirm=yes")));
if($confirm == 'no') return print(js::confirm($this->lang->mail->confirmDelete, inlink('delete', "id=$id&confirm=yes")));
$this->dao->delete()->from(TABLE_NOTIFY)->where('id')->eq($id)->exec();
die(js::reload('parent'));
echo js::reload('parent');
}
/**
@@ -434,15 +434,15 @@ class mail extends control
{
if($confirm == 'no')
{
if(empty($_POST)) die(js::reload('parent'));
if(empty($_POST)) return print(js::reload('parent'));
$idList = join('|', $this->post->mailIDList);
die(js::confirm($this->lang->mail->confirmDelete, inlink('batchDelete', "confirm=yes") . ($this->config->requestType == 'GET' ? '&' : '?') . "idList=$idList"));
return print(js::confirm($this->lang->mail->confirmDelete, inlink('batchDelete', "confirm=yes") . ($this->config->requestType == 'GET' ? '&' : '?') . "idList=$idList"));
}
$idList = array();
if(isset($_GET['idList'])) $idList = explode('|', $_GET['idList']);
if($idList) $this->dao->delete()->from(TABLE_NOTIFY)->where('id')->in($idList)->exec();
die(js::reload('parent'));
echo js::reload('parent');
}
/**
@@ -453,7 +453,7 @@ class mail extends control
*/
public function sendcloudUser()
{
if($this->config->mail->mta != 'sendcloud') die(js::locate('back'));
if($this->config->mail->mta != 'sendcloud') return print(js::locate('back'));
$this->mta = $this->mail->setMTA();
if($_POST)
@@ -463,7 +463,7 @@ class mail extends control
$listName = $action == 'delete' ? 'syncedList' : 'unsyncList';
$users = array_unique($data->$listName);
if(empty($users)) die(js::reload('parent'));
if(empty($users)) return print(js::reload('parent'));
$realnameAndEmails = $this->loadModel('user')->getRealNameAndEmails($users);
$actionedEmail = array();
@@ -476,14 +476,14 @@ class mail extends control
if(!$result->result)
{
echo(js::alert($this->lang->mail->sendCloudFail . str_replace("'", '"', $result->message) . "(CODE: $result->statusCode)"));
die(js::reload('parent'));
return print(js::reload('parent'));
}
$actionedEmail[$email] = $email;
}
echo(js::alert($this->lang->mail->sendCloudSuccess));
die(js::reload('parent'));
return print(js::reload('parent'));
}
$this->view->title = $this->lang->mail->sendcloudUser;
@@ -515,10 +515,10 @@ class mail extends control
$mailConfig->fromName = $this->post->fromName;
$mailConfig->domain = trim($this->post->domain);
if(empty($mailConfig->fromName)) die(js::alert(sprintf($this->lang->error->notempty, $this->lang->mail->fromName)));
if(empty($mailConfig->fromName)) return print(js::alert(sprintf($this->lang->error->notempty, $this->lang->mail->fromName)));
$this->loadModel('setting')->setItems('system.mail', $mailConfig);
die(js::reload('parent'));
return print(js::reload('parent'));
}
$this->view->title = $this->lang->mail->ztCloud;
@@ -536,24 +536,24 @@ class mail extends control
$this->view->mailExist = $this->mail->mailExist();
$this->view->mailConfig = $mailConfig;
$this->view->step = 'config';
die($this->display());
return print($this->display());
}
if(empty($this->config->global->ztPrivateKey) or $this->config->global->community == 'na' or empty($this->config->global->community))
{
if(!empty($this->config->global->community) and $this->config->global->community != 'na') die(js::locate($this->createLink('admin', 'bind', 'from=mail')));
die(js::locate($this->createLink('admin', 'register', 'from=mail')));
if(!empty($this->config->global->community) and $this->config->global->community != 'na') return print(js::locate($this->createLink('admin', 'bind', 'from=mail')));
return print(js::locate($this->createLink('admin', 'register', 'from=mail')));
}
if($this->cookie->ztCloudLicense != 'yes')
{
$this->view->step = 'license';
die($this->display());
return print($this->display());
}
$result = $this->loadModel('admin')->getSecretKey();
if(empty($result))die(js::alert($this->lang->mail->connectFail) . js::locate($this->createLink('admin', 'register', "from=mail")));
if($result->result == 'fail' and empty($result->data)) die(js::alert($this->lang->mail->centifyFail) . js::locate($this->createLink('admin', 'register', "from=mail")));
if(empty($result))return print(js::alert($this->lang->mail->connectFail) . js::locate($this->createLink('admin', 'register', "from=mail")));
if($result->result == 'fail' and empty($result->data)) return print(js::alert($this->lang->mail->centifyFail) . js::locate($this->createLink('admin', 'register', "from=mail")));
$data = $result->data;
if((isset($data->qq) and empty($data->qq)) or (isset($data->company) and empty($data->company)))
@@ -561,15 +561,15 @@ class mail extends control
$params = '';
if(empty($data->qq)) $params .= 'qq,';
if(empty($data->company)) $params .= 'company,';
die(js::locate($this->createLink('admin', 'ztCompany', 'fields=' . trim($params, ','))));
return print(js::locate($this->createLink('admin', 'ztCompany', 'fields=' . trim($params, ','))));
}
if($result->result == 'fail' and empty($data->emailCertified))
{
die(js::locate($this->createLink('admin', 'certifyZtEmail', 'email=' . helper::safe64Encode($data->email))));
return print(js::locate($this->createLink('admin', 'certifyZtEmail', 'email=' . helper::safe64Encode($data->email))));
}
if($result->result == 'fail' and empty($data->mobileCertified))
{
die(js::locate($this->createLink('admin', 'certifyZtMobile', 'mobile=' . helper::safe64Encode($data->mobile))));
return print(js::locate($this->createLink('admin', 'certifyZtMobile', 'mobile=' . helper::safe64Encode($data->mobile))));
}
if($result->result == 'success')
{
@@ -584,7 +584,7 @@ class mail extends control
$this->view->mailConfig = $mailConfig;
$this->view->step = 'config';
die($this->display());
return print($this->display());
}
}
}
+2 -2
View File
@@ -114,11 +114,11 @@ class message extends control
*/
public function ajaxGetMessage($windowBlur = false)
{
if($this->config->message->browser->turnon == 0) die();
if($this->config->message->browser->turnon == 0) return;
$waitMessages = $this->message->getMessages('wait');
$todos = $this->message->getNoticeTodos();
if(empty($waitMessages) and empty($todos)) die();
if(empty($waitMessages) and empty($todos)) return;
$messages = '';
$newline = $windowBlur ? "\n" : '<br />';
+9 -9
View File
@@ -20,7 +20,7 @@ class misc extends control
public function ping()
{
if(mt_rand(0, 1) == 1) $this->loadModel('setting')->setSN();
die("<html><head><meta http-equiv=refresh' content='600' /></head><body></body></html>");
echo "<html><head><meta http-equiv=refresh' content='600' /></head><body></body></html>";
}
/**
@@ -31,7 +31,7 @@ class misc extends control
*/
public function phpinfo()
{
die(phpinfo());
phpinfo();
}
/**
@@ -42,7 +42,7 @@ class misc extends control
*/
public function about()
{
die($this->display());
$this->display();
}
/**
@@ -130,10 +130,10 @@ class misc extends control
/* remove the old config.json, add a new one. */
$archive = new pclzip($packageFile);
$result = $archive->delete(PCLZIP_OPT_BY_NAME, 'config.json');
if($result == 0) die("Error : " . $archive->errorInfo(true));
if($result == 0) return print("Error : " . $archive->errorInfo(true));
$result = $archive->add($loginFile, PCLZIP_OPT_REMOVE_ALL_PATH, PCLZIP_OPT_ADD_PATH, 'notify');
if($result == 0) die("Error : " . $archive->errorInfo(true));
if($result == 0) return print("Error : " . $archive->errorInfo(true));
$zipContent = file_get_contents($packageFile);
unlink($loginFile);
@@ -155,7 +155,7 @@ class misc extends control
if(!extension_loaded('gd'))
{
$this->view->noGDLib = sprintf($this->lang->misc->noGDLib, $loginAPI);
die($this->display());
return print($this->display());
}
$this->app->loadClass('qrcode');
@@ -214,7 +214,7 @@ class misc extends control
{
$this->app->loadConfig('extension');
$check = @fopen(dirname($this->config->extension->apiRoot), "r");
die($check ? 'success' : 'fail');
print($check ? 'success' : 'fail');
}
/**
@@ -262,7 +262,7 @@ class misc extends control
$this->loadModel('setting');
$setting = $this->setting->createDAO($this->setting->parseItemParam($condition), 'select')->fetch();
$newUnfoldID = $this->post->newUnfoldID;
if(empty($newUnfoldID)) die();
if(empty($newUnfoldID)) return;
$newUnfoldID = json_decode($newUnfoldID);
$unfoldIdList = $setting ? json_decode($setting->value, true) : array();
@@ -280,7 +280,7 @@ class misc extends control
{
$this->dao->update(TABLE_CONFIG)->set('value')->eq(json_encode($unfoldIdList))->where('id')->eq($setting->id)->exec();
}
die('success');
echo 'success';
}
/**
+13 -13
View File
@@ -209,7 +209,7 @@ class mr extends control
*/
public function delete($id, $confirm = 'no')
{
if($confirm != 'yes') die(js::confirm($this->lang->mr->confirmDelete, inlink('delete', "id=$id&confirm=yes")));
if($confirm != 'yes') return print(js::confirm($this->lang->mr->confirmDelete, inlink('delete', "id=$id&confirm=yes")));
$MR = $this->mr->getByID($id);
@@ -220,7 +220,7 @@ class mr extends control
}
$this->dao->delete()->from(TABLE_MR)->where('id')->eq($id)->exec();
die(js::locate(inlink('browse'), 'parent'));
echo js::locate(inlink('browse'), 'parent');
}
/**
@@ -233,7 +233,7 @@ class mr extends control
public function view($id)
{
$MR = $this->mr->getByID($id);
if(!$MR) die(js::error($this->lang->notFound) . js::locate($this->createLink('mr', 'browse')));
if(!$MR) return print(js::error($this->lang->notFound) . js::locate($this->createLink('mr', 'browse')));
if(isset($MR->gitlabID)) $rawMR = $this->mr->apiGetSingleMR($MR->gitlabID, $MR->targetProject, $MR->mriid);
if($MR->synced and (!isset($rawMR->id) or (isset($rawMR->message) and $rawMR->message == '404 Not found') or empty($rawMR))) return $this->display();
@@ -560,8 +560,8 @@ class mr extends control
{
$this->mr->link($MRID, $productID, 'story');
if(dao::isError()) die(js::error(dao::getError()));
die(js::locate(inlink('link', "MRID=$MRID&type=story&orderBy=$orderBy"), 'parent'));
if(dao::isError()) return print(js::error(dao::getError()));
return print(js::locate(inlink('link', "MRID=$MRID&type=story&orderBy=$orderBy"), 'parent'));
}
$this->loadModel('story');
@@ -648,8 +648,8 @@ class mr extends control
{
$this->mr->link($MRID, $productID, 'bug');
if(dao::isError()) die(js::error(dao::getError()));
die(js::locate(inlink('link', "MRID=$MRID&type=bug&orderBy=$orderBy"), 'parent'));
if(dao::isError()) return print(js::error(dao::getError()));
return print(js::locate(inlink('link', "MRID=$MRID&type=bug&orderBy=$orderBy"), 'parent'));
}
$this->loadModel('bug');
@@ -734,8 +734,8 @@ class mr extends control
{
$this->mr->link($MRID, $productID, 'task');
if(dao::isError()) die(js::error(dao::getError()));
die(js::locate(inlink('link', "MRID=$MRID&type=task&orderBy=$orderBy"), 'parent'));
if(dao::isError()) return print(js::error(dao::getError()));
return print(js::locate(inlink('link', "MRID=$MRID&type=task&orderBy=$orderBy"), 'parent'));
}
$this->loadModel('execution');
@@ -827,7 +827,7 @@ class mr extends control
if($confirm == 'no')
{
die(js::confirm($this->lang->productplan->confirmUnlinkStory, $this->createLink('mr', 'unlink', "MRID=$MRID&productID=$productID&linkID=$linkID&type=$type&confirm=yes")));
return print(js::confirm($this->lang->productplan->confirmUnlinkStory, $this->createLink('mr', 'unlink', "MRID=$MRID&productID=$productID&linkID=$linkID&type=$type&confirm=yes")));
}
else
{
@@ -848,7 +848,7 @@ class mr extends control
}
return $this->send($response);
}
die(js::reload('parent'));
return print(js::reload('parent'));
}
}
@@ -872,7 +872,7 @@ class mr extends control
{
if($this->post->reviewType == 'bug') $result = $this->mr->saveBug($repoID, $mr, $v1, $v2);
if($this->post->reviewType == 'task') $result = $this->mr->saveTask($repoID, $mr, $v1, $v2);
if($result['result'] == 'fail') die(json_encode($result));
if($result['result'] == 'fail') return print(json_encode($result));
$objectID = $result['id'];
$repo = $this->repo->getRepoById($repoID);
@@ -1004,6 +1004,6 @@ class mr extends control
$targetBranch = $this->post->targetBranch;
$result = $this->mr->checkSameOpened($gitlabID, $sourceProject, $sourceBranch, $targetProject, $targetBranch);
die(json_encode($result));
echo json_encode($result);
}
}