From e0cd77995416afa94e54e80bfcb49c3b5603cc3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B2=81=E9=A3=9E?= Date: Thu, 3 Nov 2022 00:32:42 +0000 Subject: [PATCH] * Remove use exit for api. --- api/v1/entries/bug.php | 10 +++--- api/v1/entries/bugactive.php | 6 ++-- api/v1/entries/bugassign.php | 6 ++-- api/v1/entries/bugclose.php | 6 ++-- api/v1/entries/bugconfirm.php | 6 ++-- api/v1/entries/bugrecordestimate.php | 10 +++--- api/v1/entries/bugresolve.php | 6 ++-- api/v1/entries/bugs.php | 6 ++-- api/v1/entries/build.php | 10 +++--- api/v1/entries/builds.php | 6 ++-- api/v1/entries/ciresults.php | 4 +-- api/v1/entries/config.php | 4 +-- api/v1/entries/configs.php | 4 +-- api/v1/entries/department.php | 10 +++--- api/v1/entries/doc.php | 8 ++--- api/v1/entries/doclibs.php | 4 +-- api/v1/entries/docs.php | 4 +-- api/v1/entries/error.php | 6 ++-- api/v1/entries/execution.php | 10 +++--- api/v1/entries/executionbugs.php | 2 +- api/v1/entries/executionbuilds.php | 2 +- api/v1/entries/executioncases.php | 2 +- api/v1/entries/executions.php | 10 +++--- api/v1/entries/executionstories.php | 2 +- api/v1/entries/feedback.php | 10 +++--- api/v1/entries/feedbackassignto.php | 6 ++-- api/v1/entries/feedbackclose.php | 6 ++-- api/v1/entries/feedbacks.php | 8 ++--- api/v1/entries/file.php | 10 +++--- api/v1/entries/files.php | 6 ++-- api/v1/entries/gitlabwebhook.php | 2 +- api/v1/entries/groups.php | 2 +- api/v1/entries/issue.php | 10 +++--- api/v1/entries/issues.php | 8 ++--- api/v1/entries/jobs.php | 2 +- api/v1/entries/langs.php | 2 +- api/v1/entries/meetings.php | 6 ++-- api/v1/entries/modules.php | 4 +-- api/v1/entries/mr.php | 4 +-- api/v1/entries/options.php | 2 +- api/v1/entries/ping.php | 4 +-- api/v1/entries/pipelines.php | 2 +- api/v1/entries/product.php | 10 +++--- api/v1/entries/productissue.php | 4 +-- api/v1/entries/productissues.php | 4 +-- api/v1/entries/productplan.php | 10 +++--- api/v1/entries/productplanlinkbugs.php | 2 +- api/v1/entries/productplanlinkstories.php | 2 +- api/v1/entries/productplans.php | 4 +-- api/v1/entries/productplanunlinkbugs.php | 2 +- api/v1/entries/productplanunlinkstories.php | 2 +- api/v1/entries/productprojects.php | 10 +++--- api/v1/entries/products.php | 12 +++---- api/v1/entries/program.php | 12 +++---- api/v1/entries/programs.php | 12 +++---- api/v1/entries/project.php | 8 ++--- api/v1/entries/projectbugs.php | 2 +- api/v1/entries/projectcases.php | 2 +- api/v1/entries/projectreleases.php | 6 ++-- api/v1/entries/projects.php | 10 +++--- api/v1/entries/projectstories.php | 2 +- api/v1/entries/release.php | 8 ++--- api/v1/entries/releases.php | 2 +- api/v1/entries/reports.php | 2 +- api/v1/entries/reporules.php | 4 +-- api/v1/entries/repos.php | 2 +- api/v1/entries/risk.php | 10 +++--- api/v1/entries/risks.php | 6 ++-- api/v1/entries/stakeholders.php | 10 +++--- api/v1/entries/stories.php | 6 ++-- api/v1/entries/story.php | 12 +++---- api/v1/entries/storyactive.php | 6 ++-- api/v1/entries/storyassignto.php | 6 ++-- api/v1/entries/storychange.php | 6 ++-- api/v1/entries/storyclose.php | 6 ++-- api/v1/entries/storyrecall.php | 4 +-- api/v1/entries/storyrecordestimate.php | 10 +++--- api/v1/entries/storyreview.php | 6 ++-- api/v1/entries/tabs.php | 4 +-- api/v1/entries/task.php | 12 +++---- api/v1/entries/taskactive.php | 6 ++-- api/v1/entries/taskassignto.php | 6 ++-- api/v1/entries/taskbatchcreate.php | 4 +-- api/v1/entries/taskclose.php | 6 ++-- api/v1/entries/taskcomponent.php | 6 ++-- api/v1/entries/taskfinish.php | 6 ++-- api/v1/entries/taskpause.php | 6 ++-- api/v1/entries/taskrecordestimate.php | 10 +++--- api/v1/entries/tasks.php | 6 ++-- api/v1/entries/taskstart.php | 6 ++-- api/v1/entries/testcase.php | 10 +++--- api/v1/entries/testcases.php | 6 ++-- api/v1/entries/testresults.php | 6 ++-- api/v1/entries/testsuite.php | 6 ++-- api/v1/entries/testsuites.php | 6 ++-- api/v1/entries/testtask.php | 6 ++-- api/v1/entries/testtasks.php | 8 ++--- api/v1/entries/todo.php | 10 +++--- api/v1/entries/todoactivate.php | 6 ++-- api/v1/entries/todofinish.php | 6 ++-- api/v1/entries/todos.php | 6 ++-- api/v1/entries/tokens.php | 4 +-- api/v1/entries/user.php | 16 ++++----- api/v1/entries/users.php | 6 ++-- api/v1/entries/views.php | 2 +- api/v1/entries/zfile.php | 4 +-- api/v1/entries/zfilecontent.php | 2 +- api/v1/entries/zfolder.php | 4 +-- api/v1/entries/zfolders.php | 4 +-- framework/api/entry.class.php | 31 ++++++++-------- framework/api/router.class.php | 39 +++++++++++++++------ framework/base/router.class.php | 6 ++-- 112 files changed, 375 insertions(+), 357 deletions(-) diff --git a/api/v1/entries/bug.php b/api/v1/entries/bug.php index 94bf3dfe55..2c39a3348a 100644 --- a/api/v1/entries/bug.php +++ b/api/v1/entries/bug.php @@ -16,7 +16,7 @@ class bugEntry extends entry * * @param int $bugID * @access public - * @return void + * @return string */ public function get($bugID) { @@ -78,7 +78,7 @@ class bugEntry extends entry $bug->preAndNext['pre'] = $preAndNext->pre ? $preAndNext->pre->id : ''; $bug->preAndNext['next'] = $preAndNext->next ? $preAndNext->next->id : ''; - $this->send(200, $this->format($bug, 'activatedDate:time,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,mailto:userList,resolvedBy:user,resolvedDate:time,closedBy:user,closedDate:time,lastEditedBy:user,lastEditedDate:time,deadline:date,deleted:bool')); + return $this->send(200, $this->format($bug, 'activatedDate:time,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,mailto:userList,resolvedBy:user,resolvedDate:time,closedBy:user,closedDate:time,lastEditedBy:user,lastEditedDate:time,deadline:date,deleted:bool')); } /** @@ -86,7 +86,7 @@ class bugEntry extends entry * * @param int $bugID * @access public - * @return void + * @return string */ public function put($bugID) { @@ -106,7 +106,7 @@ class bugEntry extends entry if(!isset($data->status)) return $this->sendError(400, 'error'); $bug = $this->bug->getByID($bugID); - $this->send(200, $this->format($bug, 'activatedDate:time,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,mailto:userList,resolvedBy:user,resolvedDate:time,closedBy:user,closedDate:time,lastEditedBy:user,lastEditedDate:time,deadline:date,deleted:bool')); + return $this->send(200, $this->format($bug, 'activatedDate:time,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,mailto:userList,resolvedBy:user,resolvedDate:time,closedBy:user,closedDate:time,lastEditedBy:user,lastEditedDate:time,deadline:date,deleted:bool')); } /** @@ -114,7 +114,7 @@ class bugEntry extends entry * * @param int $bugID * @access public - * @return void + * @return string */ public function delete($bugID) { diff --git a/api/v1/entries/bugactive.php b/api/v1/entries/bugactive.php index 19ba5e51fc..ad9ec61335 100644 --- a/api/v1/entries/bugactive.php +++ b/api/v1/entries/bugactive.php @@ -9,14 +9,14 @@ * @version 1 * @link http://www.zentao.net **/ -class bugActiveEntry extends Entry +class bugActiveEntry extends entry { /** * POST method. * * @param int $bugID * @access public - * @return void + * @return string */ public function post($bugID) { @@ -32,7 +32,7 @@ class bugActiveEntry extends Entry $bug = $this->loadModel('bug')->getByID($bugID); - $this->send(200, $this->format($bug, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); + return $this->send(200, $this->format($bug, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); } } diff --git a/api/v1/entries/bugassign.php b/api/v1/entries/bugassign.php index bd5bcfb434..59bd8c8481 100644 --- a/api/v1/entries/bugassign.php +++ b/api/v1/entries/bugassign.php @@ -9,14 +9,14 @@ * @version 1 * @link http://www.zentao.net **/ -class bugAssignEntry extends Entry +class bugAssignEntry extends entry { /** * POST method. * * @param int $bugID * @access public - * @return void + * @return string */ public function post($bugID) { @@ -32,7 +32,7 @@ class bugAssignEntry extends Entry $bug = $this->loadModel('bug')->getByID($bugID); - $this->send(200, $this->format($bug, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); + return $this->send(200, $this->format($bug, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); } } diff --git a/api/v1/entries/bugclose.php b/api/v1/entries/bugclose.php index 58a595c184..9085bcb783 100644 --- a/api/v1/entries/bugclose.php +++ b/api/v1/entries/bugclose.php @@ -9,14 +9,14 @@ * @version 1 * @link http://www.zentao.net **/ -class bugCloseEntry extends Entry +class bugCloseEntry extends entry { /** * POST method. * * @param int $bugID * @access public - * @return void + * @return string */ public function post($bugID) { @@ -31,7 +31,7 @@ class bugCloseEntry extends Entry if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message); $bug = $this->loadModel('bug')->getByID($bugID); - $this->send(200, $this->format($bug, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); + return $this->send(200, $this->format($bug, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); } } diff --git a/api/v1/entries/bugconfirm.php b/api/v1/entries/bugconfirm.php index d677486156..940da0523e 100644 --- a/api/v1/entries/bugconfirm.php +++ b/api/v1/entries/bugconfirm.php @@ -9,14 +9,14 @@ * @version 1 * @link http://www.zentao.net */ -class bugConfirmEntry extends Entry +class bugConfirmEntry extends entry { /** * POST method. * * @param int $bugID * @access public - * @return void + * @return string **/ public function post($bugID) { @@ -32,7 +32,7 @@ class bugConfirmEntry extends Entry $bug = $this->loadModel('bug')->getById($bugID); - $this->send(200, $this->format($bug, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); + return $this->send(200, $this->format($bug, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); } } diff --git a/api/v1/entries/bugrecordestimate.php b/api/v1/entries/bugrecordestimate.php index 2debf19d08..4b471392f9 100644 --- a/api/v1/entries/bugrecordestimate.php +++ b/api/v1/entries/bugrecordestimate.php @@ -9,14 +9,14 @@ * @version 1 * @link http://www.zentao.net */ -class bugRecordEstimateEntry extends Entry +class bugRecordEstimateEntry extends entry { /** * GET method. * * @param int $bugID * @access public - * @return void + * @return string */ public function get($bugID) { @@ -31,7 +31,7 @@ class bugRecordEstimateEntry extends Entry $effort = $data->data->efforts; - $this->send(200, array('effort' => $effort)); + return $this->send(200, array('effort' => $effort)); } /** @@ -39,7 +39,7 @@ class bugRecordEstimateEntry extends Entry * * @param int $bugID * @access public - * @return void + * @return string */ public function post($bugID) { @@ -56,6 +56,6 @@ class bugRecordEstimateEntry extends Entry $bug = $this->loadModel('bug')->getByID($bugID); - $this->send(200, $this->format($bug, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); + return $this->send(200, $this->format($bug, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); } } diff --git a/api/v1/entries/bugresolve.php b/api/v1/entries/bugresolve.php index e6ede3c696..2811bc8489 100644 --- a/api/v1/entries/bugresolve.php +++ b/api/v1/entries/bugresolve.php @@ -9,14 +9,14 @@ * @version 1 * @link http://www.zentao.net **/ -class bugResolveEntry extends Entry +class bugResolveEntry extends entry { /** * POST method. * * @param int $bugID * @access public - * @return void + * @return string */ public function post($bugID) { @@ -32,7 +32,7 @@ class bugResolveEntry extends Entry $bug = $this->loadModel('bug')->getByID($bugID); - $this->send(200, $this->format($bug, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,resolvedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); + return $this->send(200, $this->format($bug, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,resolvedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); } } diff --git a/api/v1/entries/bugs.php b/api/v1/entries/bugs.php index c67a444682..658544aaf0 100644 --- a/api/v1/entries/bugs.php +++ b/api/v1/entries/bugs.php @@ -16,7 +16,7 @@ class bugsEntry extends entry * * @param int $productID * @access public - * @return void + * @return string */ public function get($productID = 0) { @@ -75,7 +75,7 @@ class bugsEntry extends entry * * @param int $productID * @access public - * @return void + * @return string */ public function post($productID = 0) { @@ -111,6 +111,6 @@ class bugsEntry extends entry $bug = $this->loadModel('bug')->getByID($data->id); - $this->send(200, $this->format($bug, 'activatedDate:time,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,mailto:userList,resolvedBy:user,resolvedDate:time,closedBy:user,closedDate:time,lastEditedBy:user,lastEditedDate:time,deadline:date,deleted:bool')); + return $this->send(200, $this->format($bug, 'activatedDate:time,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,mailto:userList,resolvedBy:user,resolvedDate:time,closedBy:user,closedDate:time,lastEditedBy:user,lastEditedDate:time,deadline:date,deleted:bool')); } } diff --git a/api/v1/entries/build.php b/api/v1/entries/build.php index 6d984a44be..c4b54c6fcf 100644 --- a/api/v1/entries/build.php +++ b/api/v1/entries/build.php @@ -9,14 +9,14 @@ * @version 1 * @link http://www.zentao.net */ -class buildEntry extends Entry +class buildEntry extends entry { /** * GET method. * * @param int $buildID * @access public - * @return void + * @return string */ public function get($buildID) { @@ -37,7 +37,7 @@ class buildEntry extends Entry * * @param int $buildID * @access public - * @return void + * @return string */ public function put($buildID) { @@ -55,7 +55,7 @@ class buildEntry extends Entry if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message); $build = $this->build->getByID($buildID); - $this->send(200, $this->format($build, 'builder:user,stories:idList,bugs:idList,deleted:bool')); + return $this->send(200, $this->format($build, 'builder:user,stories:idList,bugs:idList,deleted:bool')); } /** @@ -63,7 +63,7 @@ class buildEntry extends Entry * * @param int $buildID * @access public - * @return void + * @return string */ public function delete($buildID) { diff --git a/api/v1/entries/builds.php b/api/v1/entries/builds.php index 603d71e8ba..3a58e9138c 100644 --- a/api/v1/entries/builds.php +++ b/api/v1/entries/builds.php @@ -16,7 +16,7 @@ class buildsEntry extends entry * * @param int $projectID * @access public - * @return void + * @return string */ public function get($projectID = 0) { @@ -44,7 +44,7 @@ class buildsEntry extends entry * * @param int $projectID * @access public - * @return void + * @return string */ public function post($projectID = 0) { @@ -67,6 +67,6 @@ class buildsEntry extends entry $build = $this->loadModel('build')->getByID($data->id); - $this->send(201, $build); + return $this->send(201, $build); } } diff --git a/api/v1/entries/ciresults.php b/api/v1/entries/ciresults.php index dce88c8ec8..a608390374 100644 --- a/api/v1/entries/ciresults.php +++ b/api/v1/entries/ciresults.php @@ -15,7 +15,7 @@ class ciresultsEntry extends entry * POST method. * * @access public - * @return void + * @return string */ public function post() { @@ -25,6 +25,6 @@ class ciresultsEntry extends entry $data = $this->getData(); if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message); - $this->send(201, array()); + return $this->send(201, array()); } } diff --git a/api/v1/entries/config.php b/api/v1/entries/config.php index 88ae406ae2..aa34305993 100644 --- a/api/v1/entries/config.php +++ b/api/v1/entries/config.php @@ -16,7 +16,7 @@ class configEntry extends baseEntry * * @param int $name language,version,timezone etc. * @access public - * @return void + * @return string */ public function get($name) { @@ -44,6 +44,6 @@ class configEntry extends baseEntry return; } - $this->send(200, $config); + return $this->send(200, $config); } } diff --git a/api/v1/entries/configs.php b/api/v1/entries/configs.php index 923cc9ab74..6117af1734 100644 --- a/api/v1/entries/configs.php +++ b/api/v1/entries/configs.php @@ -15,7 +15,7 @@ class configsEntry extends baseEntry * GET method. * * @access public - * @return void + * @return string */ public function get() { @@ -30,6 +30,6 @@ class configsEntry extends baseEntry $configs[] = array('key' => 'CRProduct', 'value' => $this->config->CRProduct); $configs[] = array('key' => 'CRExecution', 'value' => $this->config->CRExecution); - $this->send(200, $configs); + return $this->send(200, $configs); } } diff --git a/api/v1/entries/department.php b/api/v1/entries/department.php index 3f9d9e68d8..6ea2f315e8 100644 --- a/api/v1/entries/department.php +++ b/api/v1/entries/department.php @@ -9,14 +9,14 @@ * @version 1 * @link http://www.zentao.net */ -class departmentEntry extends Entry +class departmentEntry extends entry { /** * GET method. * * @param int $departmentID * @access public - * @return void + * @return string */ public function get($departmentID) { @@ -31,7 +31,7 @@ class departmentEntry extends Entry * * @param int $departmentID * @access public - * @return void + * @return string */ public function put($departmentID) { @@ -47,7 +47,7 @@ class departmentEntry extends Entry $this->getData(); $department = $this->dept->getByID($departmentID); - $this->send(200, $department); + return $this->send(200, $department); } /** @@ -55,7 +55,7 @@ class departmentEntry extends Entry * * @param int $departmentID * @access public - * @return void + * @return string */ public function delete($departmentID) { diff --git a/api/v1/entries/doc.php b/api/v1/entries/doc.php index 5a45d03634..9b3393a64c 100644 --- a/api/v1/entries/doc.php +++ b/api/v1/entries/doc.php @@ -16,7 +16,7 @@ class docEntry extends entry * * @param int $docID * @access public - * @return void + * @return string */ public function get($docID) { @@ -43,7 +43,7 @@ class docEntry extends entry $doc->preAndNext['pre'] = $preAndNext->pre ? $preAndNext->pre->id : ''; $doc->preAndNext['next'] = $preAndNext->next ? $preAndNext->next->id : ''; - $this->send(200, $this->format($doc, 'addedBy:user,addedDate:time,assignedTo:user,assignedDate:date,editedBy:user,editedDate:time,mailto:userList')); + return $this->send(200, $this->format($doc, 'addedBy:user,addedDate:time,assignedTo:user,assignedDate:date,editedBy:user,editedDate:time,mailto:userList')); } /** @@ -51,7 +51,7 @@ class docEntry extends entry * * @param int $storyID * @access public - * @return void + * @return string */ public function put($storyID) { @@ -75,7 +75,7 @@ class docEntry extends entry * * @param int $storyID * @access public - * @return void + * @return string */ public function delete($storyID) { diff --git a/api/v1/entries/doclibs.php b/api/v1/entries/doclibs.php index 6598d6cb8e..99a4f0b6ed 100644 --- a/api/v1/entries/doclibs.php +++ b/api/v1/entries/doclibs.php @@ -9,13 +9,13 @@ * @version 1 * @link http://www.zentao.net */ -class doclibsEntry extends Entry +class doclibsEntry extends entry { /** * GET method. * * @access public - * @return void + * @return string */ public function get() { diff --git a/api/v1/entries/docs.php b/api/v1/entries/docs.php index ec0783d9ce..9301485a5a 100644 --- a/api/v1/entries/docs.php +++ b/api/v1/entries/docs.php @@ -9,13 +9,13 @@ * @version 1 * @link http://www.zentao.net */ -class docsEntry extends Entry +class docsEntry extends entry { /** * GET method. * * @access public - * @return void + * @return string */ public function get($libID = 0) { diff --git a/api/v1/entries/error.php b/api/v1/entries/error.php index dbe9c3c760..7b71f0bd79 100644 --- a/api/v1/entries/error.php +++ b/api/v1/entries/error.php @@ -9,16 +9,16 @@ * @version 1 * @link http://www.zentao.net */ -class errorEntry extends Entry +class errorEntry extends entry { /** * 404 Not Found. * * @access public - * @return void + * @return string */ public function notFound() { - $this->send(404, array('error' => 'not found')); + return $this->send(404, array('error' => 'not found')); } } diff --git a/api/v1/entries/execution.php b/api/v1/entries/execution.php index 3d66f624a0..3ba9d33009 100644 --- a/api/v1/entries/execution.php +++ b/api/v1/entries/execution.php @@ -9,14 +9,14 @@ * @version 1 * @link http://www.zentao.net */ -class executionEntry extends Entry +class executionEntry extends entry { /** * GET method. * * @param int $executionID * @access public - * @return void + * @return string */ public function get($executionID) { @@ -113,7 +113,7 @@ class executionEntry extends Entry * * @param int $executionID * @access public - * @return void + * @return string */ public function put($executionID) { @@ -136,7 +136,7 @@ class executionEntry extends Entry if(!isset($data->result)) return $this->sendError(400, 'error'); $execution = $this->execution->getByID($executionID); - $this->send(200, $this->format($execution, 'openedBy:user,openedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,PM:user,PO:user,RD:user,QD:user,whitelist:userList,begin:date,end:date,realBegan:date,realEnd:date,deleted:bool')); + return $this->send(200, $this->format($execution, 'openedBy:user,openedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,PM:user,PO:user,RD:user,QD:user,whitelist:userList,begin:date,end:date,realBegan:date,realEnd:date,deleted:bool')); } /** @@ -144,7 +144,7 @@ class executionEntry extends Entry * * @param int $executionID * @access public - * @return void + * @return string */ public function delete($executionID) { diff --git a/api/v1/entries/executionbugs.php b/api/v1/entries/executionbugs.php index 0dfe4d13e6..b844b1a28f 100644 --- a/api/v1/entries/executionbugs.php +++ b/api/v1/entries/executionbugs.php @@ -16,7 +16,7 @@ class executionBugsEntry extends entry * * @param int $executionID * @access public - * @return void + * @return string */ public function get($executionID = 0) { diff --git a/api/v1/entries/executionbuilds.php b/api/v1/entries/executionbuilds.php index 979983c172..05732d37c7 100644 --- a/api/v1/entries/executionbuilds.php +++ b/api/v1/entries/executionbuilds.php @@ -16,7 +16,7 @@ class executionBuildsEntry extends entry * * @param int $executionID * @access public - * @return void + * @return string */ public function get($executionID = 0) { diff --git a/api/v1/entries/executioncases.php b/api/v1/entries/executioncases.php index ed4b1a3bab..c1cc945bae 100644 --- a/api/v1/entries/executioncases.php +++ b/api/v1/entries/executioncases.php @@ -16,7 +16,7 @@ class executionCasesEntry extends entry * * @param int $executionID * @access public - * @return void + * @return string */ public function get($executionID = 0) { diff --git a/api/v1/entries/executions.php b/api/v1/entries/executions.php index 18570fbe92..9dc93ee351 100644 --- a/api/v1/entries/executions.php +++ b/api/v1/entries/executions.php @@ -16,7 +16,7 @@ class executionsEntry extends entry * * @param int $projectID * @access public - * @return void + * @return string */ public function get($projectID = 0) { @@ -76,7 +76,7 @@ class executionsEntry extends entry * * @param int $projectID * @access public - * @return void + * @return string */ public function post($projectID = 0) { @@ -102,14 +102,14 @@ class executionsEntry extends entry $execution = $this->loadModel('execution')->getByID($data->id); - $this->send(201, $this->format($execution, 'openedBy:user,openedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,PM:user,PO:user,RD:user,QD:user,whitelist:userList,begin:date,end:date,realBegan:date,realEnd:date,deleted:bool')); + return $this->send(201, $this->format($execution, 'openedBy:user,openedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,PM:user,PO:user,RD:user,QD:user,whitelist:userList,begin:date,end:date,realBegan:date,realEnd:date,deleted:bool')); } /** * Get drop menu. * * @access public - * @return void + * @return string */ public function getDropMenu() { @@ -148,6 +148,6 @@ class executionsEntry extends entry } } - $this->send(200, $dropMenu); + return $this->send(200, $dropMenu); } } diff --git a/api/v1/entries/executionstories.php b/api/v1/entries/executionstories.php index df57bf5cbc..d8c70cf45c 100644 --- a/api/v1/entries/executionstories.php +++ b/api/v1/entries/executionstories.php @@ -16,7 +16,7 @@ class executionStoriesEntry extends entry * * @param int $executionID * @access public - * @return void + * @return string */ public function get($executionID) { diff --git a/api/v1/entries/feedback.php b/api/v1/entries/feedback.php index 05daaa3624..39ba4523a2 100644 --- a/api/v1/entries/feedback.php +++ b/api/v1/entries/feedback.php @@ -9,14 +9,14 @@ * @version 1 * @link http://www.zentao.net */ -class feedbackEntry extends Entry +class feedbackEntry extends entry { /** * GET method. * * @param int $feedbackID * @access public - * @return void + * @return string */ public function get($feedbackID) { @@ -37,7 +37,7 @@ class feedbackEntry extends Entry if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message); $feedback->actions = $this->loadModel('action')->processActionForAPI($data->data->actions, $data->data->users, $this->lang->feedback); - $this->send(200, $this->format($feedback, 'activatedDate:time,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,mailto:userList,resolvedBy:user,resolvedDate:time,closedBy:user,closedDate:time,lastEditedBy:user,lastEditedDate:time,deadline:date,deleted:bool')); + return $this->send(200, $this->format($feedback, 'activatedDate:time,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,mailto:userList,resolvedBy:user,resolvedDate:time,closedBy:user,closedDate:time,lastEditedBy:user,lastEditedDate:time,deadline:date,deleted:bool')); } /** @@ -45,7 +45,7 @@ class feedbackEntry extends Entry * * @param int $feedbackID * @access public - * @return void + * @return string */ public function put($feedbackID) { @@ -71,7 +71,7 @@ class feedbackEntry extends Entry * * @param int $feedbackID * @access public - * @return void + * @return string */ public function delete($feedbackID) { diff --git a/api/v1/entries/feedbackassignto.php b/api/v1/entries/feedbackassignto.php index 2ec87bf1fd..19a8636ade 100644 --- a/api/v1/entries/feedbackassignto.php +++ b/api/v1/entries/feedbackassignto.php @@ -9,14 +9,14 @@ * @version 1 * @link http://www.zentao.net */ -class feedbackAssignToEntry extends Entry +class feedbackAssignToEntry extends entry { /** * POST method. * * @param int $feedbackID * @access public - * @return void + * @return string */ public function post($feedbackID) { @@ -34,6 +34,6 @@ class feedbackAssignToEntry extends Entry $feedback = $this->loadModel('feedback')->getById($feedbackID); - $this->send(200, $this->format($feedback, 'activatedDate:time,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,mailto:userList,resolvedBy:user,resolvedDate:time,closedBy:user,closedDate:time,lastEditedBy:user,lastEditedDate:time,deadline:date,deleted:bool')); + return $this->send(200, $this->format($feedback, 'activatedDate:time,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,mailto:userList,resolvedBy:user,resolvedDate:time,closedBy:user,closedDate:time,lastEditedBy:user,lastEditedDate:time,deadline:date,deleted:bool')); } } diff --git a/api/v1/entries/feedbackclose.php b/api/v1/entries/feedbackclose.php index 045d9dedc4..4e949a8ad0 100644 --- a/api/v1/entries/feedbackclose.php +++ b/api/v1/entries/feedbackclose.php @@ -9,14 +9,14 @@ * @version 1 * @link http://www.zentao.net */ -class feedbackCloseEntry extends Entry +class feedbackCloseEntry extends entry { /** * POST method. * * @param int $feedbackID * @access public - * @return void + * @return string */ public function post($feedbackID) { @@ -36,6 +36,6 @@ class feedbackCloseEntry extends Entry $feedback = $this->loadModel('feedback')->getById($feedbackID); - $this->send(200, $feedback); + return $this->send(200, $feedback); } } diff --git a/api/v1/entries/feedbacks.php b/api/v1/entries/feedbacks.php index 71d442bd30..7658689c3e 100644 --- a/api/v1/entries/feedbacks.php +++ b/api/v1/entries/feedbacks.php @@ -15,7 +15,7 @@ class feedbacksEntry extends entry * GET method. * * @access public - * @return void + * @return string */ public function get() { @@ -50,7 +50,7 @@ class feedbacksEntry extends entry * POST method. * * @access public - * @return void + * @return string */ public function post() { @@ -68,14 +68,14 @@ class feedbacksEntry extends entry $feedback = $this->loadModel('feedback')->getById($data->id); - $this->send(201, $this->format($feedback, 'openedBy:user,openedDate:time,reviewedBy:user,reviewedDate:time,processedBy:user,processedDate:time,closedBy:user,closedDate:time,editedBy:user,editedDate:time,assignedTo:user,assignedDate:time,feedbackBy:user,mailto:userList,deleted:bool')); + return $this->send(201, $this->format($feedback, 'openedBy:user,openedDate:time,reviewedBy:user,reviewedDate:time,processedBy:user,processedDate:time,closedBy:user,closedDate:time,editedBy:user,editedDate:time,assignedTo:user,assignedDate:time,feedbackBy:user,mailto:userList,deleted:bool')); } /** * GET method. * * @access public - * @return void + * @return string */ public function getModuleAndProduct() { diff --git a/api/v1/entries/file.php b/api/v1/entries/file.php index 6c1b27e370..56b26012a5 100644 --- a/api/v1/entries/file.php +++ b/api/v1/entries/file.php @@ -9,13 +9,13 @@ * @version 1 * @link http://www.zentao.net */ -class fileEntry extends Entry +class fileEntry extends entry { /** * GET method. * * @access public - * @return void + * @return string */ public function get($fileID) { @@ -26,13 +26,13 @@ class fileEntry extends Entry if(!$data or !isset($data->status)) return $this->send400('error'); if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message); - $this->send(200, $data); + return $this->send(200, $data); } /** * PUT method. * * @access public - * @return void + * @return string */ public function put($fileID) { @@ -40,6 +40,6 @@ class fileEntry extends Entry $action = $this->param('action', ''); if($action == 'remove') unset($_SESSION['album']['used'][$uid][$fileID]); - $this->send(200, array('id' => $fileID)); + return $this->send(200, array('id' => $fileID)); } } diff --git a/api/v1/entries/files.php b/api/v1/entries/files.php index 61ffcf16a0..144a0f400f 100644 --- a/api/v1/entries/files.php +++ b/api/v1/entries/files.php @@ -9,13 +9,13 @@ * @version 1 * @link http://www.zentao.net */ -class filesEntry extends Entry +class filesEntry extends entry { /** * POST method. * * @access public - * @return void + * @return string */ public function post() { @@ -29,6 +29,6 @@ class filesEntry extends Entry if(!$data or !isset($data->status)) return $this->send400('error'); if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message); - $this->send(200, array('id' => $data->id, 'url' => $data->url)); + return $this->send(200, array('id' => $data->id, 'url' => $data->url)); } } diff --git a/api/v1/entries/gitlabwebhook.php b/api/v1/entries/gitlabwebhook.php index bd016bbd07..a657995970 100644 --- a/api/v1/entries/gitlabwebhook.php +++ b/api/v1/entries/gitlabwebhook.php @@ -16,7 +16,7 @@ class gitlabWebhookEntry extends baseEntry * Repo webhook. * * @access public - * @return void + * @return string */ public function post() { diff --git a/api/v1/entries/groups.php b/api/v1/entries/groups.php index 556a853b48..353fbb20d2 100644 --- a/api/v1/entries/groups.php +++ b/api/v1/entries/groups.php @@ -15,7 +15,7 @@ class groupsEntry extends entry * GET method. * * @access public - * @return void + * @return string */ public function get() { diff --git a/api/v1/entries/issue.php b/api/v1/entries/issue.php index 9bf28b1fc1..86d4f8b48f 100644 --- a/api/v1/entries/issue.php +++ b/api/v1/entries/issue.php @@ -9,14 +9,14 @@ * @version 1 * @link http://www.zentao.net */ -class issueEntry extends Entry +class issueEntry extends entry { /** * GET method. * * @param int|string $issueID. Issues id for Gitlab has '-', such as task-1, bug-1. * @access public - * @return void + * @return string */ public function get($issueID) { @@ -40,7 +40,7 @@ class issueEntry extends Entry * * @param int $issueID * @access public - * @return void + * @return string */ public function put($issueID) { @@ -58,7 +58,7 @@ class issueEntry extends Entry if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message); $issue = $this->issue->getByID($issueID); - $this->send(200, $this->format($issue, 'createdDate:time,editedDate:time,assignedDate:time')); + return $this->send(200, $this->format($issue, 'createdDate:time,editedDate:time,assignedDate:time')); } /** @@ -66,7 +66,7 @@ class issueEntry extends Entry * * @param int $issueID * @access public - * @return void + * @return string */ public function delete($issueID) { diff --git a/api/v1/entries/issues.php b/api/v1/entries/issues.php index c8c8084917..9f3414fd7a 100644 --- a/api/v1/entries/issues.php +++ b/api/v1/entries/issues.php @@ -16,7 +16,7 @@ class issuesEntry extends entry * * @param int $projectID * @access public - * @return void + * @return string */ public function get($projectID = 0) { @@ -45,7 +45,7 @@ class issuesEntry extends entry * * @param int $projectID * @access public - * @return void + * @return string */ private function getProjectIssues($projectID) { @@ -74,7 +74,7 @@ class issuesEntry extends entry * * @param int $projectID * @access public - * @return void + * @return string */ public function post($projectID = 0) { @@ -95,6 +95,6 @@ class issuesEntry extends entry $issue = $this->loadModel('issue')->getByID($data->id); - $this->send(201, $this->format($issue, 'createdDate:time,editedDate:time,assignedDate:time')); + return $this->send(201, $this->format($issue, 'createdDate:time,editedDate:time,assignedDate:time')); } } diff --git a/api/v1/entries/jobs.php b/api/v1/entries/jobs.php index f7d0ac4037..6a39b4c2ee 100644 --- a/api/v1/entries/jobs.php +++ b/api/v1/entries/jobs.php @@ -15,7 +15,7 @@ class jobsEntry extends entry * GET method. * * @access public - * @return void + * @return string */ public function get() { diff --git a/api/v1/entries/langs.php b/api/v1/entries/langs.php index 74b6718d8b..1792ceeb9e 100644 --- a/api/v1/entries/langs.php +++ b/api/v1/entries/langs.php @@ -15,7 +15,7 @@ class langsEntry extends entry * GET method. * * @access public - * @return void + * @return string */ public function get() { diff --git a/api/v1/entries/meetings.php b/api/v1/entries/meetings.php index d1c3eabb35..970ca3522a 100644 --- a/api/v1/entries/meetings.php +++ b/api/v1/entries/meetings.php @@ -16,7 +16,7 @@ class meetingsEntry extends entry * * @param int $projectID * @access public - * @return void + * @return string */ public function get($projectID = 0) { @@ -49,7 +49,7 @@ class meetingsEntry extends entry * * @param int $projectID * @access public - * @return void + * @return string */ public function post($projectID = 0) { @@ -75,6 +75,6 @@ class meetingsEntry extends entry $risk = $this->loadModel('risk')->getByID($data->id); - $this->send(201, $this->format($risk, 'createdDate:time,editedDate:time')); + return $this->send(201, $this->format($risk, 'createdDate:time,editedDate:time')); } } diff --git a/api/v1/entries/modules.php b/api/v1/entries/modules.php index 7b28a00ed6..edf42b4081 100644 --- a/api/v1/entries/modules.php +++ b/api/v1/entries/modules.php @@ -9,13 +9,13 @@ * @version 1 * @link http://www.zentao.net */ -class modulesEntry extends Entry +class modulesEntry extends entry { /** * Get method. * * @access public - * @return void + * @return string */ public function get() { diff --git a/api/v1/entries/mr.php b/api/v1/entries/mr.php index 2b436fef96..66ca119737 100644 --- a/api/v1/entries/mr.php +++ b/api/v1/entries/mr.php @@ -15,7 +15,7 @@ class mrEntry extends baseEntry * Create mr. * * @access public - * @return void + * @return string */ public function post() { @@ -28,6 +28,6 @@ class mrEntry extends baseEntry if(dao::isError()) $this->sendError(400, dao::getError()); $MR = $this->mr->getByID($MRID); - $this->send(201, $MR); + return $this->send(201, $MR); } } diff --git a/api/v1/entries/options.php b/api/v1/entries/options.php index beafd6f5ed..b67a3df4dd 100644 --- a/api/v1/entries/options.php +++ b/api/v1/entries/options.php @@ -16,7 +16,7 @@ class optionsEntry extends entry * * @param string $type * @access public - * @return void + * @return string */ public function get($type = '') { diff --git a/api/v1/entries/ping.php b/api/v1/entries/ping.php index bf4bff6cb0..54726c6b53 100644 --- a/api/v1/entries/ping.php +++ b/api/v1/entries/ping.php @@ -15,10 +15,10 @@ class pingEntry extends entry * GET method. * * @access public - * @return void + * @return string */ public function get() { - $this->send(200, array('token' => session_id(), 'tokenLife' => ini_get('session.gc_maxlifetime'))); + return $this->send(200, array('token' => session_id(), 'tokenLife' => ini_get('session.gc_maxlifetime'))); } } diff --git a/api/v1/entries/pipelines.php b/api/v1/entries/pipelines.php index 10f96f9785..1ae503255f 100644 --- a/api/v1/entries/pipelines.php +++ b/api/v1/entries/pipelines.php @@ -16,7 +16,7 @@ class pipelinesEntry extends entry * GET method. * * @access public - * @return void + * @return string */ public function get() { diff --git a/api/v1/entries/product.php b/api/v1/entries/product.php index 0dedc42047..1c3c13a480 100644 --- a/api/v1/entries/product.php +++ b/api/v1/entries/product.php @@ -9,14 +9,14 @@ * @version 1 * @link http://www.zentao.net */ -class productEntry extends Entry +class productEntry extends entry { /** * GET method. * * @param int $productID * @access public - * @return void + * @return string */ public function get($productID) { @@ -103,7 +103,7 @@ class productEntry extends Entry * * @param int $productID * @access public - * @return void + * @return string */ public function put($productID) { @@ -120,7 +120,7 @@ class productEntry extends Entry if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message); $product = $this->product->getByID($productID); - $this->send(200, $this->format($product, 'createdDate:time,whitelist:userList,createdBy:user,PO:user,RD:user,QD:user')); + return $this->send(200, $this->format($product, 'createdDate:time,whitelist:userList,createdBy:user,PO:user,RD:user,QD:user')); } /** @@ -128,7 +128,7 @@ class productEntry extends Entry * * @param int $productID * @access public - * @return void + * @return string */ public function delete($productID) { diff --git a/api/v1/entries/productissue.php b/api/v1/entries/productissue.php index 42e9b8ff28..77ce297e90 100644 --- a/api/v1/entries/productissue.php +++ b/api/v1/entries/productissue.php @@ -17,7 +17,7 @@ class productIssueEntry extends entry * * @param string $issueID, such as task-1, story-1, bug-1 * @access public - * @return void + * @return string */ public function get($issueID) { @@ -142,7 +142,7 @@ class productIssueEntry extends entry } $issue->openedBy = $profileList[$issue->openedBy]; - $this->send(200, array('issue' => $this->format($issue, 'openedDate:time,lastEditedDate:time'))); + return $this->send(200, array('issue' => $this->format($issue, 'openedDate:time,lastEditedDate:time'))); } /** diff --git a/api/v1/entries/productissues.php b/api/v1/entries/productissues.php index 809e6ba0bf..1cca44456a 100644 --- a/api/v1/entries/productissues.php +++ b/api/v1/entries/productissues.php @@ -17,7 +17,7 @@ class productIssuesEntry extends entry * * @param int $productID * @access public - * @return void + * @return string */ public function get($productID) { @@ -166,7 +166,7 @@ class productIssuesEntry extends entry $issues = $page < 1 ? array() : array_slice($issues, ($page-1) * $limit, $limit); $result = $this->processIssues($issues); - $this->send(200, array('page' => $page, 'total' => $total, 'limit' => $limit, 'issues' => $result)); + return $this->send(200, array('page' => $page, 'total' => $total, 'limit' => $limit, 'issues' => $result)); } /** diff --git a/api/v1/entries/productplan.php b/api/v1/entries/productplan.php index 342006755f..c74030f3a1 100644 --- a/api/v1/entries/productplan.php +++ b/api/v1/entries/productplan.php @@ -9,14 +9,14 @@ * @version 1 * @link http://www.zentao.net */ -class productplanEntry extends Entry +class productplanEntry extends entry { /** * GET method. * * @param int $planID * @access public - * @return void + * @return string */ public function get($planID) { @@ -43,7 +43,7 @@ class productplanEntry extends Entry * * @param int $planID * @access public - * @return void + * @return string */ public function put($planID) { @@ -71,7 +71,7 @@ class productplanEntry extends Entry $plan->stories = $data->data->planStories; $plan->bugs = $data->data->planBugs; - $this->send(200, $this->format($plan, 'begin:date,end:date,deleted:bool,stories:array,bugs:array')); + return $this->send(200, $this->format($plan, 'begin:date,end:date,deleted:bool,stories:array,bugs:array')); } /** @@ -79,7 +79,7 @@ class productplanEntry extends Entry * * @param int $productID * @access public - * @return void + * @return string */ public function delete($planID) { diff --git a/api/v1/entries/productplanlinkbugs.php b/api/v1/entries/productplanlinkbugs.php index fe19ed92f2..f93ef49b8d 100644 --- a/api/v1/entries/productplanlinkbugs.php +++ b/api/v1/entries/productplanlinkbugs.php @@ -16,7 +16,7 @@ class productplanLinkBugsEntry extends entry * * @param int $planID * @access public - * @return void + * @return string */ public function post($planID) { diff --git a/api/v1/entries/productplanlinkstories.php b/api/v1/entries/productplanlinkstories.php index 2d82f4fb74..0be5e68a48 100644 --- a/api/v1/entries/productplanlinkstories.php +++ b/api/v1/entries/productplanlinkstories.php @@ -16,7 +16,7 @@ class productplanLinkStoriesEntry extends entry * * @param int $planID * @access public - * @return void + * @return string */ public function post($planID) { diff --git a/api/v1/entries/productplans.php b/api/v1/entries/productplans.php index 6fc0b0757e..cd5d7b5997 100644 --- a/api/v1/entries/productplans.php +++ b/api/v1/entries/productplans.php @@ -16,7 +16,7 @@ class productplansEntry extends entry * * @param int $productID * @access public - * @return void + * @return string */ public function get($productID = 0) { @@ -63,7 +63,7 @@ class productplansEntry extends entry * * @param int $productID * @access public - * @return void + * @return string */ public function post($productID = 0) { diff --git a/api/v1/entries/productplanunlinkbugs.php b/api/v1/entries/productplanunlinkbugs.php index 0bbbf4783c..0b1fbdc980 100644 --- a/api/v1/entries/productplanunlinkbugs.php +++ b/api/v1/entries/productplanunlinkbugs.php @@ -16,7 +16,7 @@ class productplanUnlinkBugsEntry extends entry * * @param int $planID * @access public - * @return void + * @return string */ public function post($planID) { diff --git a/api/v1/entries/productplanunlinkstories.php b/api/v1/entries/productplanunlinkstories.php index 47ec3f6719..1fd46d7dd6 100644 --- a/api/v1/entries/productplanunlinkstories.php +++ b/api/v1/entries/productplanunlinkstories.php @@ -16,7 +16,7 @@ class productplanUnlinkStoriesEntry extends entry * * @param int $planID * @access public - * @return void + * @return string */ public function post($planID) { diff --git a/api/v1/entries/productprojects.php b/api/v1/entries/productprojects.php index c6540ea7a4..a9172a4aac 100644 --- a/api/v1/entries/productprojects.php +++ b/api/v1/entries/productprojects.php @@ -16,7 +16,7 @@ class productProjectsEntry extends entry * * @param int $productID * @access public - * @return void + * @return string */ public function get($productID = 0) { @@ -59,7 +59,7 @@ class productProjectsEntry extends entry * POST method. * * @access public - * @return void + * @return string */ public function post() { @@ -84,14 +84,14 @@ class productProjectsEntry extends entry $project = $this->loadModel('project')->getByID($data->id); - $this->send(201, $this->format($project, 'openedDate:time,lastEditedDate:time,closedDate:time,canceledDate:time')); + return $this->send(201, $this->format($project, 'openedDate:time,lastEditedDate:time,closedDate:time,canceledDate:time')); } /** * Get drop menu. * * @access public - * @return void + * @return string */ public function getDropMenu() { @@ -123,6 +123,6 @@ class productProjectsEntry extends entry } } } - $this->send(200, $dropMenu); + return $this->send(200, $dropMenu); } } diff --git a/api/v1/entries/products.php b/api/v1/entries/products.php index 93d93b66b9..325a9b42eb 100644 --- a/api/v1/entries/products.php +++ b/api/v1/entries/products.php @@ -16,7 +16,7 @@ class productsEntry extends entry * * @param int $projectID * @access public - * @return void + * @return string */ public function get($programID = 0) { @@ -108,7 +108,7 @@ class productsEntry extends entry * POST method. * * @access public - * @return void + * @return string */ public function post() { @@ -130,14 +130,14 @@ class productsEntry extends entry $product = $this->loadModel('product')->getByID($data->id); $product = $this->format($product, 'createdDate:time,whitelist:userList,createdBy:user,PO:user,RD:user,QD:user'); - $this->send(200, $product); + return $this->send(200, $product); } /** * Get dropmenu. * * @access public - * @return void + * @return string */ public function getDropMenu() { @@ -168,7 +168,7 @@ class productsEntry extends entry } } } - $this->send(200, $dropMenu); + return $this->send(200, $dropMenu); } /** @@ -176,7 +176,7 @@ class productsEntry extends entry * * @param array $products * @access public - * @return void + * @return string */ public function mergeChildren($products) { diff --git a/api/v1/entries/program.php b/api/v1/entries/program.php index e7394f9d45..b051a13c2c 100644 --- a/api/v1/entries/program.php +++ b/api/v1/entries/program.php @@ -9,21 +9,21 @@ * @version 1 * @link http://www.zentao.net */ -class programEntry extends Entry +class programEntry extends entry { /** * GET method. * * @param int $programID * @access public - * @return void + * @return string */ public function get($programID) { $program = $this->loadModel('program')->getByID($programID); if(!$program) return $this->send404(); - $this->send(200, $this->format($program, 'begin:date,end:date,PO:user,PM:user,QD:user,RD:user,realBegan:date,realEnd:date,openedBy:user,openedDate:time,lastEditedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,deleted:bool,whitelist:userList')); + return $this->send(200, $this->format($program, 'begin:date,end:date,PO:user,PM:user,QD:user,RD:user,realBegan:date,realEnd:date,openedBy:user,openedDate:time,lastEditedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,deleted:bool,whitelist:userList')); } /** @@ -31,7 +31,7 @@ class programEntry extends Entry * * @param int $programID * @access public - * @return void + * @return string */ public function put($programID) { @@ -47,7 +47,7 @@ class programEntry extends Entry $this->getData(); $program = $this->program->getByID($programID); - $this->send(200, $this->format($program, 'begin:date,end:date,PO:user,PM:user,QD:user,RD:user,realBegan:date,realEnd:date,openedBy:user,openedDate:time,lastEditedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,deleted:bool,whitelist:userList')); + return $this->send(200, $this->format($program, 'begin:date,end:date,PO:user,PM:user,QD:user,RD:user,realBegan:date,realEnd:date,openedBy:user,openedDate:time,lastEditedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,deleted:bool,whitelist:userList')); } /** @@ -55,7 +55,7 @@ class programEntry extends Entry * * @param int $programID * @access public - * @return void + * @return string */ public function delete($programID) { diff --git a/api/v1/entries/programs.php b/api/v1/entries/programs.php index 1eccac99f3..3ca08a90f1 100644 --- a/api/v1/entries/programs.php +++ b/api/v1/entries/programs.php @@ -9,13 +9,13 @@ * @version 1 * @link http://www.zentao.net */ -class programsEntry extends Entry +class programsEntry extends entry { /** * GET method. * * @access public - * @return void + * @return string */ public function get() { @@ -71,7 +71,7 @@ class programsEntry extends Entry * POST method. * * @access public - * @return void + * @return string */ public function post() { @@ -89,14 +89,14 @@ class programsEntry extends Entry if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message); $program = $this->loadModel('program')->getByID($data->id); - $this->send(201, $this->format($program, 'begin:date,end:date,PO:user,PM:user,QD:user,RD:user,realBegan:date,realEnd:date,openedBy:user,openedDate:time,lastEditedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,deleted:bool,whitelist:userList')); + return $this->send(201, $this->format($program, 'begin:date,end:date,PO:user,PM:user,QD:user,RD:user,realBegan:date,realEnd:date,openedBy:user,openedDate:time,lastEditedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,deleted:bool,whitelist:userList')); } /** * Get drop menu. * * @access public - * @return void + * @return string */ public function getDropMenu() { @@ -122,6 +122,6 @@ class programsEntry extends Entry } } - $this->send(200, $dropMenu); + return $this->send(200, $dropMenu); } } diff --git a/api/v1/entries/project.php b/api/v1/entries/project.php index 309c0b7384..d64e4130e9 100644 --- a/api/v1/entries/project.php +++ b/api/v1/entries/project.php @@ -16,7 +16,7 @@ class projectEntry extends entry * * @param int $projectID * @access public - * @return void + * @return string */ public function get($projectID) { @@ -94,7 +94,7 @@ class projectEntry extends entry * * @param int $projectID * @access public - * @return void + * @return string */ public function put($projectID) { @@ -123,7 +123,7 @@ class projectEntry extends entry if(!isset($data->result)) return $this->sendError(400, 'error'); $project = $this->project->getByID($projectID); - $this->send(200, $this->format($project, 'openedBy:user,openedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,realBegan:date,realEnd:date,PM:user,whitelist:userList,deleted:bool')); + return $this->send(200, $this->format($project, 'openedBy:user,openedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,realBegan:date,realEnd:date,PM:user,whitelist:userList,deleted:bool')); } /** @@ -131,7 +131,7 @@ class projectEntry extends entry * * @param int $projectID * @access public - * @return void + * @return string */ public function delete($projectID) { diff --git a/api/v1/entries/projectbugs.php b/api/v1/entries/projectbugs.php index 4e03d77890..8d83ecb1ad 100644 --- a/api/v1/entries/projectbugs.php +++ b/api/v1/entries/projectbugs.php @@ -16,7 +16,7 @@ class projectBugsEntry extends entry * * @param int $projectID * @access public - * @return void + * @return string */ public function get($projectID = 0) { diff --git a/api/v1/entries/projectcases.php b/api/v1/entries/projectcases.php index 948300ff2a..f1e2532150 100644 --- a/api/v1/entries/projectcases.php +++ b/api/v1/entries/projectcases.php @@ -16,7 +16,7 @@ class projectCasesEntry extends entry * * @param int $projectID * @access public - * @return void + * @return string */ public function get($projectID = 0) { diff --git a/api/v1/entries/projectreleases.php b/api/v1/entries/projectreleases.php index c3ca3a0f9a..a4593ad508 100644 --- a/api/v1/entries/projectreleases.php +++ b/api/v1/entries/projectreleases.php @@ -16,7 +16,7 @@ class projectReleasesEntry extends entry * * @param int $projectID * @access public - * @return void + * @return string */ public function get($projectID = 0) { @@ -49,7 +49,7 @@ class projectReleasesEntry extends entry * * @param int $projectID * @access public - * @return void + * @return string */ public function post($projectID = 0) { @@ -72,6 +72,6 @@ class projectReleasesEntry extends entry $release = $this->loadModel('projectrelease')->getByID($data->id); - $this->send(201, $release); + return $this->send(201, $release); } } diff --git a/api/v1/entries/projects.php b/api/v1/entries/projects.php index 53a8658c86..d2e514136e 100644 --- a/api/v1/entries/projects.php +++ b/api/v1/entries/projects.php @@ -16,7 +16,7 @@ class projectsEntry extends entry * * @param int $programID * @access public - * @return void + * @return string */ public function get($programID = 0) { @@ -73,7 +73,7 @@ class projectsEntry extends entry * POST method. * * @access public - * @return void + * @return string */ public function post() { @@ -99,14 +99,14 @@ class projectsEntry extends entry $project = $this->loadModel('project')->getByID($data->id); - $this->send(201, $this->format($project, 'openedBy:user,openedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,realBegan:date,realEnd:date,PM:user,whitelist:userList,deleted:bool')); + return $this->send(201, $this->format($project, 'openedBy:user,openedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,realBegan:date,realEnd:date,PM:user,whitelist:userList,deleted:bool')); } /** * Get drop menu. * * @access public - * @return void + * @return string */ public function getDropMenu() { @@ -138,6 +138,6 @@ class projectsEntry extends entry } } } - $this->send(200, $dropMenu); + return $this->send(200, $dropMenu); } } diff --git a/api/v1/entries/projectstories.php b/api/v1/entries/projectstories.php index 893e059284..50cffeb077 100644 --- a/api/v1/entries/projectstories.php +++ b/api/v1/entries/projectstories.php @@ -16,7 +16,7 @@ class projectStoriesEntry extends entry * * @param int $projectID * @access public - * @return void + * @return string */ public function get($projectID) { diff --git a/api/v1/entries/release.php b/api/v1/entries/release.php index e2215ecc9e..fb881913fb 100644 --- a/api/v1/entries/release.php +++ b/api/v1/entries/release.php @@ -9,14 +9,14 @@ * @version 1 * @link http://www.zentao.net */ -class releaseEntry extends Entry +class releaseEntry extends entry { /** * GET method. * * @param int $planID * @access public - * @return void + * @return string */ public function get($releaseID) { @@ -37,7 +37,7 @@ class releaseEntry extends Entry * * @param int $releaseID * @access public - * @return void + * @return string */ public function put($releaseID) { @@ -62,7 +62,7 @@ class releaseEntry extends Entry * * @param int $releaseID * @access public - * @return void + * @return string */ public function delete($releaseID) { diff --git a/api/v1/entries/releases.php b/api/v1/entries/releases.php index 21167771cf..8775958f08 100644 --- a/api/v1/entries/releases.php +++ b/api/v1/entries/releases.php @@ -16,7 +16,7 @@ class releasesEntry extends entry * * @param int $productID * @access public - * @return void + * @return string */ public function get($productID = 0) { diff --git a/api/v1/entries/reports.php b/api/v1/entries/reports.php index 1f79dec801..9d39fc799b 100644 --- a/api/v1/entries/reports.php +++ b/api/v1/entries/reports.php @@ -15,7 +15,7 @@ class reportsEntry extends entry * GET method. * * @access public - * @return void + * @return string */ public function get() { diff --git a/api/v1/entries/reporules.php b/api/v1/entries/reporules.php index eb363c7ef2..1e2e47c784 100644 --- a/api/v1/entries/reporules.php +++ b/api/v1/entries/reporules.php @@ -15,7 +15,7 @@ class repoRulesEntry extends entry * GET method. * * @access public - * @return void + * @return string */ public function get() { @@ -27,6 +27,6 @@ class repoRulesEntry extends entry if(!$data or !isset($data->status)) return $this->send400('error'); if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message); - $this->send(200, $data->rules); + return $this->send(200, $data->rules); } } diff --git a/api/v1/entries/repos.php b/api/v1/entries/repos.php index 2b6a1b550d..da91d73481 100644 --- a/api/v1/entries/repos.php +++ b/api/v1/entries/repos.php @@ -15,7 +15,7 @@ class reposEntry extends entry * GET method. * * @access public - * @return void + * @return string */ public function get() { diff --git a/api/v1/entries/risk.php b/api/v1/entries/risk.php index d7148e7d60..9e08b47e66 100644 --- a/api/v1/entries/risk.php +++ b/api/v1/entries/risk.php @@ -9,14 +9,14 @@ * @version 1 * @link http://www.zentao.net */ -class riskEntry extends Entry +class riskEntry extends entry { /** * GET method. * * @param int $riskID * @access public - * @return void + * @return string */ public function get($riskID) { @@ -36,7 +36,7 @@ class riskEntry extends Entry * * @param int $riskID * @access public - * @return void + * @return string */ public function put($riskID) { @@ -54,7 +54,7 @@ class riskEntry extends Entry if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message); $risk = $this->risk->getByID($riskID); - $this->send(200, $this->format($risk, 'createdDate:time,editedDate:time')); + return $this->send(200, $this->format($risk, 'createdDate:time,editedDate:time')); } /** @@ -62,7 +62,7 @@ class riskEntry extends Entry * * @param int $riskID * @access public - * @return void + * @return string */ public function delete($riskID) { diff --git a/api/v1/entries/risks.php b/api/v1/entries/risks.php index c0fb7f455a..aabdeef46b 100644 --- a/api/v1/entries/risks.php +++ b/api/v1/entries/risks.php @@ -16,7 +16,7 @@ class risksEntry extends entry * * @param int $projectID * @access public - * @return void + * @return string */ public function get($projectID = 0) { @@ -56,7 +56,7 @@ class risksEntry extends entry * * @param int $projectID * @access public - * @return void + * @return string */ public function post($projectID = 0) { @@ -82,6 +82,6 @@ class risksEntry extends entry $risk = $this->loadModel('risk')->getByID($data->id); - $this->send(201, $this->format($risk, 'createdDate:time,editedDate:time')); + return $this->send(201, $this->format($risk, 'createdDate:time,editedDate:time')); } } diff --git a/api/v1/entries/stakeholders.php b/api/v1/entries/stakeholders.php index 75142bc510..b9a3ba2edf 100644 --- a/api/v1/entries/stakeholders.php +++ b/api/v1/entries/stakeholders.php @@ -16,7 +16,7 @@ class stakeholdersEntry extends entry * * @param int $programID * @access public - * @return void + * @return string */ public function get($programID = 0) { @@ -63,7 +63,7 @@ class stakeholdersEntry extends entry * POST method. * * @access public - * @return void + * @return string */ public function post() { @@ -88,14 +88,14 @@ class stakeholdersEntry extends entry $project = $this->loadModel('project')->getByID($data->id); - $this->send(201, $this->format($project, 'openedDate:time,lastEditedDate:time,closedDate:time,canceledDate:time')); + return $this->send(201, $this->format($project, 'openedDate:time,lastEditedDate:time,closedDate:time,canceledDate:time')); } /** * Get drop menu. * * @access public - * @return void + * @return string */ public function getDropMenu() { @@ -127,6 +127,6 @@ class stakeholdersEntry extends entry } } } - $this->send(200, $dropMenu); + return $this->send(200, $dropMenu); } } diff --git a/api/v1/entries/stories.php b/api/v1/entries/stories.php index ec46e039eb..c5eca2f63b 100644 --- a/api/v1/entries/stories.php +++ b/api/v1/entries/stories.php @@ -16,7 +16,7 @@ class storiesEntry extends entry * * @param int $productID * @access public - * @return void + * @return string */ public function get($productID = 0) { @@ -60,7 +60,7 @@ class storiesEntry extends entry * * @param int $productID * @access public - * @return void + * @return string */ public function post($productID = 0) { @@ -88,6 +88,6 @@ class storiesEntry extends entry if(isset($data->result) and !isset($data->id)) return $this->sendError(400, $data->message); $story = $this->loadModel('story')->getByID($data->id); - $this->send(200, $this->format($story, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); + return $this->send(200, $this->format($story, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); } } diff --git a/api/v1/entries/story.php b/api/v1/entries/story.php index b76c53c8d8..fb05989da0 100644 --- a/api/v1/entries/story.php +++ b/api/v1/entries/story.php @@ -9,14 +9,14 @@ * @version 1 * @link http://www.zentao.net */ -class storyEntry extends Entry +class storyEntry extends entry { /** * GET method. * * @param int $storyID * @access public - * @return void + * @return string */ public function get($storyID) { @@ -81,7 +81,7 @@ class storyEntry extends Entry $story->preAndNext['pre'] = $preAndNext->pre ? $preAndNext->pre->id : ''; $story->preAndNext['next'] = $preAndNext->next ? $preAndNext->next->id : ''; - $this->send(200, $this->format($story, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); + return $this->send(200, $this->format($story, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); } /** @@ -89,7 +89,7 @@ class storyEntry extends Entry * * @param int $storyID * @access public - * @return void + * @return string */ public function put($storyID) { @@ -108,7 +108,7 @@ class storyEntry extends Entry if(!isset($data->status)) return $this->sendError(400, 'error'); $story = $this->story->getByID($storyID); - $this->send(200, $this->format($story, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); + return $this->send(200, $this->format($story, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); } /** @@ -116,7 +116,7 @@ class storyEntry extends Entry * * @param int $storyID * @access public - * @return void + * @return string */ public function delete($storyID) { diff --git a/api/v1/entries/storyactive.php b/api/v1/entries/storyactive.php index ba2c1d7d7d..73032b7f98 100644 --- a/api/v1/entries/storyactive.php +++ b/api/v1/entries/storyactive.php @@ -10,14 +10,14 @@ * @link http://www.zentao.net **/ -class storyActiveEntry extends Entry +class storyActiveEntry extends entry { /** * POST method. * * @param int $storyID * @access public - * @return void + * @return string */ public function post($storyID) { @@ -34,7 +34,7 @@ class storyActiveEntry extends Entry $story = $this->loadModel('story')->getByID($storyID); - $this->send(200, $story); + return $this->send(200, $story); } } diff --git a/api/v1/entries/storyassignto.php b/api/v1/entries/storyassignto.php index e31a8d9353..44f85e4de6 100644 --- a/api/v1/entries/storyassignto.php +++ b/api/v1/entries/storyassignto.php @@ -9,14 +9,14 @@ * @version 1 * @link http://www.zentao.net */ -class storyAssignToEntry extends Entry +class storyAssignToEntry extends entry { /** * POST method. * * @param int $storyID * @access public - * @return void + * @return string */ public function post($storyID) { @@ -32,6 +32,6 @@ class storyAssignToEntry extends Entry $story = $this->loadModel('story')->getByID($storyID); - $this->send(200, $this->format($story, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); + return $this->send(200, $this->format($story, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); } } diff --git a/api/v1/entries/storychange.php b/api/v1/entries/storychange.php index 9e9b2fb7d8..f44fd2135a 100644 --- a/api/v1/entries/storychange.php +++ b/api/v1/entries/storychange.php @@ -9,14 +9,14 @@ * @version 1 * @link http://www.zentao.net */ -class storyChangeEntry extends Entry +class storyChangeEntry extends entry { /** * POST method. * * @param int $storyID * @access public - * @return void + * @return string */ public function post($storyID) { @@ -45,6 +45,6 @@ class storyChangeEntry extends Entry $story = $this->loadModel('story')->getByID($storyID); - $this->send(200, $this->format($story, 'openedDate:time,assignedDate:time,reviewedDate:time,lastEditedDate:time,closedDate:time')); + return $this->send(200, $this->format($story, 'openedDate:time,assignedDate:time,reviewedDate:time,lastEditedDate:time,closedDate:time')); } } diff --git a/api/v1/entries/storyclose.php b/api/v1/entries/storyclose.php index 7c81880bc8..a253d4d47b 100644 --- a/api/v1/entries/storyclose.php +++ b/api/v1/entries/storyclose.php @@ -9,14 +9,14 @@ * @version 1 * @link http://www.zentao.net */ -class storyCloseEntry extends Entry +class storyCloseEntry extends entry { /** * POST method. * * @param int $storyID * @access public - * @return void + * @return string */ public function post($storyID) { @@ -32,6 +32,6 @@ class storyCloseEntry extends Entry $story = $this->loadModel('story')->getByID($storyID); - $this->send(200, $this->format($story, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); + return $this->send(200, $this->format($story, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); } } diff --git a/api/v1/entries/storyrecall.php b/api/v1/entries/storyrecall.php index ae78775f91..e635a01f36 100644 --- a/api/v1/entries/storyrecall.php +++ b/api/v1/entries/storyrecall.php @@ -9,14 +9,14 @@ * @version 1 * @link http://www.zentao.net */ -class storyRecallEntry extends Entry +class storyRecallEntry extends entry { /** * Delete method. * * @param int $storyID * @access public - * @return void + * @return string */ public function delete($storyID) { diff --git a/api/v1/entries/storyrecordestimate.php b/api/v1/entries/storyrecordestimate.php index 42a65e75c2..78372b07de 100644 --- a/api/v1/entries/storyrecordestimate.php +++ b/api/v1/entries/storyrecordestimate.php @@ -9,14 +9,14 @@ * @version 1 * @link http://www.zentao.net */ -class storyRecordEstimateEntry extends Entry +class storyRecordEstimateEntry extends entry { /** * GET method. * * @param int $storyID * @access public - * @return void + * @return string */ public function get($storyID) { @@ -31,7 +31,7 @@ class storyRecordEstimateEntry extends Entry $effort = $data->data->efforts; - $this->send(200, array('effort' => $effort)); + return $this->send(200, array('effort' => $effort)); } /** @@ -39,7 +39,7 @@ class storyRecordEstimateEntry extends Entry * * @param int $storyID * @access public - * @return void + * @return string */ public function post($storyID) { @@ -56,6 +56,6 @@ class storyRecordEstimateEntry extends Entry $story = $this->loadModel('story')->getById($storyID); - $this->send(200, $this->format($story, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); + return $this->send(200, $this->format($story, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); } } diff --git a/api/v1/entries/storyreview.php b/api/v1/entries/storyreview.php index b1c8f5d3ff..e673cda141 100644 --- a/api/v1/entries/storyreview.php +++ b/api/v1/entries/storyreview.php @@ -10,14 +10,14 @@ * @link http://www.zentao.net **/ -class storyReviewEntry extends Entry +class storyReviewEntry extends entry { /** * POST method. * * @param int $storyID * @access public - * @return void + * @return string */ public function post($storyID) { @@ -34,7 +34,7 @@ class storyReviewEntry extends Entry $story = $this->loadModel('story')->getByID($storyID); - $this->send(200, $this->format($story, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); + return $this->send(200, $this->format($story, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); } } diff --git a/api/v1/entries/tabs.php b/api/v1/entries/tabs.php index af0c938f46..016ba906b3 100644 --- a/api/v1/entries/tabs.php +++ b/api/v1/entries/tabs.php @@ -16,7 +16,7 @@ class tabsEntry extends baseEntry * * @param string $moduleName work| * @access public - * @return void + * @return string */ public function get($moduleName) { @@ -76,6 +76,6 @@ class tabsEntry extends baseEntry } } - $this->send(200, array('tabs' => $menus)); + return $this->send(200, array('tabs' => $menus)); } } diff --git a/api/v1/entries/task.php b/api/v1/entries/task.php index 712041ace5..402a260102 100644 --- a/api/v1/entries/task.php +++ b/api/v1/entries/task.php @@ -9,14 +9,14 @@ * @version 1 * @link http://www.zentao.net */ -class taskEntry extends Entry +class taskEntry extends entry { /** * GET method. * * @param int $taskID * @access public - * @return void + * @return string */ public function get($taskID) { @@ -90,7 +90,7 @@ class taskEntry extends Entry $execution = $this->loadModel('project')->getByID($task->execution, 'execution'); $task->executionStatus = $execution->status; - $this->send(200, $this->format($task, 'deadline:date,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,realStarted:time,finishedBy:user,finishedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,lastEditedBy:user,lastEditedDate:time,deleted:bool,mailto:userList')); + return $this->send(200, $this->format($task, 'deadline:date,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,realStarted:time,finishedBy:user,finishedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,lastEditedBy:user,lastEditedDate:time,deleted:bool,mailto:userList')); } /** @@ -98,7 +98,7 @@ class taskEntry extends Entry * * @param int $taskID * @access public - * @return void + * @return string */ public function put($taskID) { @@ -114,7 +114,7 @@ class taskEntry extends Entry $data = $this->getData(); if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message); $task = $this->task->getByID($taskID); - $this->send(200, $this->format($task, 'deadline:date,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,realStarted:time,finishedBy:user,finishedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,lastEditedBy:user,lastEditedDate:time,deleted:bool,mailto:userList')); + return $this->send(200, $this->format($task, 'deadline:date,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,realStarted:time,finishedBy:user,finishedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,lastEditedBy:user,lastEditedDate:time,deleted:bool,mailto:userList')); } /** @@ -122,7 +122,7 @@ class taskEntry extends Entry * * @param int $taskID * @access public - * @return void + * @return string */ public function delete($taskID) { diff --git a/api/v1/entries/taskactive.php b/api/v1/entries/taskactive.php index 33701a4fa7..398785b3d7 100644 --- a/api/v1/entries/taskactive.php +++ b/api/v1/entries/taskactive.php @@ -9,14 +9,14 @@ * @version 1 * @link http://www.zentao.net **/ -class taskActiveEntry extends Entry +class taskActiveEntry extends entry { /** * POST method. * * @param int $taskID * @access public - * @return void + * @return string */ public function post($taskID) { @@ -32,7 +32,7 @@ class taskActiveEntry extends Entry $task = $this->loadModel('task')->getByID($taskID); - $this->send(200, $this->format($task, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); + return $this->send(200, $this->format($task, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); } } diff --git a/api/v1/entries/taskassignto.php b/api/v1/entries/taskassignto.php index 7dcb9245a3..f93abe5b8c 100644 --- a/api/v1/entries/taskassignto.php +++ b/api/v1/entries/taskassignto.php @@ -9,14 +9,14 @@ * @version 1 * @link http://www.zentao.net */ -class taskAssignToEntry extends Entry +class taskAssignToEntry extends entry { /** * POST method. * * @param int $taskID * @access public - * @return void + * @return string */ public function post($taskID) { @@ -36,6 +36,6 @@ class taskAssignToEntry extends Entry $task = $this->loadModel('task')->getByID($taskID); - $this->send(200, $this->format($task, 'openedDate:time,assignedDate:time,realStarted:time,finishedDate:time,canceledDate:time,closedDate:time,lastEditedDate:time')); + return $this->send(200, $this->format($task, 'openedDate:time,assignedDate:time,realStarted:time,finishedDate:time,canceledDate:time,closedDate:time,lastEditedDate:time')); } } diff --git a/api/v1/entries/taskbatchcreate.php b/api/v1/entries/taskbatchcreate.php index a0a5f37c66..b98f2c01b7 100644 --- a/api/v1/entries/taskbatchcreate.php +++ b/api/v1/entries/taskbatchcreate.php @@ -9,14 +9,14 @@ * @version 1 * @link http://www.zentao.net */ -class taskBatchCreateEntry extends Entry +class taskBatchCreateEntry extends entry { /** * POST method. * * @param int $executionID * @access public - * @return void + * @return string */ public function post($executionID = 0) { diff --git a/api/v1/entries/taskclose.php b/api/v1/entries/taskclose.php index 3767a36cb0..0fb7fcefdc 100644 --- a/api/v1/entries/taskclose.php +++ b/api/v1/entries/taskclose.php @@ -9,14 +9,14 @@ * @version 1 * @link http://www.zentao.net */ -class taskCloseEntry extends Entry +class taskCloseEntry extends entry { /** * POST method. * * @param int $taskID * @access public - * @return void + * @return string */ public function post($taskID) { @@ -34,6 +34,6 @@ class taskCloseEntry extends Entry $task = $this->loadModel('task')->getByID($taskID); - $this->send(200, $task); + return $this->send(200, $task); } } diff --git a/api/v1/entries/taskcomponent.php b/api/v1/entries/taskcomponent.php index c81876be29..778f7e3681 100644 --- a/api/v1/entries/taskcomponent.php +++ b/api/v1/entries/taskcomponent.php @@ -9,14 +9,14 @@ * @version 1 * @link http://www.zentao.net */ -class taskComponentEntry extends Entry +class taskComponentEntry extends entry { /** * POST method. * * @param int $taskID * @access public - * @return void + * @return string */ public function post($taskID) { @@ -35,7 +35,7 @@ class taskComponentEntry extends Entry if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message); $task = $this->task->getById($data->idList[0]); - $this->send(200, $this->format($task, 'deadline:date,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,realStarted:time,finishedBy:user,finishedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,lastEditedBy:user,lastEditedDate:time,deleted:bool,mailto:userList')); + return $this->send(200, $this->format($task, 'deadline:date,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,realStarted:time,finishedBy:user,finishedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,lastEditedBy:user,lastEditedDate:time,deleted:bool,mailto:userList')); } public function setArrayPost($field) diff --git a/api/v1/entries/taskfinish.php b/api/v1/entries/taskfinish.php index f51cdd7674..a28f086d80 100644 --- a/api/v1/entries/taskfinish.php +++ b/api/v1/entries/taskfinish.php @@ -9,14 +9,14 @@ * @version 1 * @link http://www.zentao.net */ -class taskFinishEntry extends Entry +class taskFinishEntry extends entry { /** * POST method. * * @param int $taskID * @access public - * @return void + * @return string */ public function post($taskID) { @@ -41,6 +41,6 @@ class taskFinishEntry extends Entry $task = $this->loadModel('task')->getByID($taskID); - $this->send(200, $this->format($task, 'openedDate:time,assignedDate:time,realStarted:time,finishedDate:time,canceledDate:time,closedDate:time,lastEditedDate:time')); + return $this->send(200, $this->format($task, 'openedDate:time,assignedDate:time,realStarted:time,finishedDate:time,canceledDate:time,closedDate:time,lastEditedDate:time')); } } diff --git a/api/v1/entries/taskpause.php b/api/v1/entries/taskpause.php index 00930ed195..21dc3c2034 100644 --- a/api/v1/entries/taskpause.php +++ b/api/v1/entries/taskpause.php @@ -9,14 +9,14 @@ * @version 1 * @link http://www.zentao.net */ -class taskPauseEntry extends Entry +class taskPauseEntry extends entry { /** * POST method. * * @param int $taskID * @access public - * @return void + * @return string */ public function post($taskID) { @@ -34,6 +34,6 @@ class taskPauseEntry extends Entry $task = $this->loadModel('task')->getByID($taskID); - $this->send(200, $task); + return $this->send(200, $task); } } diff --git a/api/v1/entries/taskrecordestimate.php b/api/v1/entries/taskrecordestimate.php index b88eabc005..22e816fe81 100644 --- a/api/v1/entries/taskrecordestimate.php +++ b/api/v1/entries/taskrecordestimate.php @@ -9,14 +9,14 @@ * @version 1 * @link http://www.zentao.net */ -class taskRecordEstimateEntry extends Entry +class taskRecordEstimateEntry extends entry { /** * GET method. * * @param int $taskID * @access public - * @return void + * @return string */ public function get($taskID) { @@ -39,7 +39,7 @@ class taskRecordEstimateEntry extends Entry $effort = new stdclass(); if($issetEffort and $data->data->efforts) $effort = $data->data->efforts; if(!$issetEffort and $data->data->estimates) $effort = $data->data->estimates; - $this->send(200, array('effort' => $effort)); + return $this->send(200, array('effort' => $effort)); } @@ -48,7 +48,7 @@ class taskRecordEstimateEntry extends Entry * * @param int $taskID * @access public - * @return void + * @return string */ public function post($taskID) { @@ -73,6 +73,6 @@ class taskRecordEstimateEntry extends Entry $task = $this->loadModel('task')->getById($taskID); - $this->send(200, $this->format($task, 'deadline:date,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,realStarted:time,finishedBy:user,finishedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,lastEditedBy:user,lastEditedDate:time,deleted:bool,mailto:userList')); + return $this->send(200, $this->format($task, 'deadline:date,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,realStarted:time,finishedBy:user,finishedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,lastEditedBy:user,lastEditedDate:time,deleted:bool,mailto:userList')); } } diff --git a/api/v1/entries/tasks.php b/api/v1/entries/tasks.php index d48cd6c074..63ed468957 100644 --- a/api/v1/entries/tasks.php +++ b/api/v1/entries/tasks.php @@ -16,7 +16,7 @@ class tasksEntry extends entry * * @param int $executionID * @access public - * @return void + * @return string */ public function get($executionID = 0) { @@ -57,7 +57,7 @@ class tasksEntry extends entry * * @param int $executionID * @access public - * @return void + * @return string */ public function post($executionID) { @@ -78,6 +78,6 @@ class tasksEntry extends entry $task = $this->loadModel('task')->getByID($data->id); - $this->send(201, $this->format($task, 'deadline:date,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,realStarted:time,finishedBy:user,finishedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,lastEditedBy:user,lastEditedDate:time,deleted:bool,mailto:userList')); + return $this->send(201, $this->format($task, 'deadline:date,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,realStarted:time,finishedBy:user,finishedDate:time,closedBy:user,closedDate:time,canceledBy:user,canceledDate:time,lastEditedBy:user,lastEditedDate:time,deleted:bool,mailto:userList')); } } diff --git a/api/v1/entries/taskstart.php b/api/v1/entries/taskstart.php index 8f7827d95c..99d007e1f2 100644 --- a/api/v1/entries/taskstart.php +++ b/api/v1/entries/taskstart.php @@ -9,14 +9,14 @@ * @version 1 * @link http://www.zentao.net */ -class taskStartEntry extends Entry +class taskStartEntry extends entry { /** * POST method. * * @param int $taskID * @access public - * @return void + * @return string */ public function post($taskID) { @@ -35,6 +35,6 @@ class taskStartEntry extends Entry $task = $this->loadModel('task')->getByID($taskID); - $this->send(200, $task); + return $this->send(200, $task); } } diff --git a/api/v1/entries/testcase.php b/api/v1/entries/testcase.php index e880ad7b8c..28f51a4d23 100644 --- a/api/v1/entries/testcase.php +++ b/api/v1/entries/testcase.php @@ -16,7 +16,7 @@ class testcaseEntry extends entry * * @param int $testcaseID * @access public - * @return void + * @return string */ public function get($testcaseID) { @@ -31,7 +31,7 @@ class testcaseEntry extends entry $case = $data->case; $case->steps = (isset($case->steps) and !empty($case->steps)) ? array_values(get_object_vars($case->steps)) : array(); - $this->send(200, $this->format($case, 'openedBy:user,openedDate:time,lastEditedBy:user,lastEditedDate:time,lastRunDate:time,scriptedDate:date,reviewedBy:user,reviewedDate:date,steps:array,deleted:bool')); + return $this->send(200, $this->format($case, 'openedBy:user,openedDate:time,lastEditedBy:user,lastEditedDate:time,lastRunDate:time,scriptedDate:date,reviewedBy:user,reviewedDate:date,steps:array,deleted:bool')); } /** @@ -39,7 +39,7 @@ class testcaseEntry extends entry * * @param int $caseID * @access public - * @return void + * @return string */ public function put($caseID) { @@ -71,7 +71,7 @@ class testcaseEntry extends entry $this->getData(); $case = $this->testcase->getByID($caseID); - $this->send(200, $this->format($case, 'openedBy:user,openedDate:time,lastEditedBy:user,lastEditedDate:time,lastRunDate:time,scriptedDate:date,reviewedBy:user,reviewedDate:date,steps:array,deleted:bool')); + return $this->send(200, $this->format($case, 'openedBy:user,openedDate:time,lastEditedBy:user,lastEditedDate:time,lastRunDate:time,scriptedDate:date,reviewedBy:user,reviewedDate:date,steps:array,deleted:bool')); } /** @@ -79,7 +79,7 @@ class testcaseEntry extends entry * * @param int $testcaseID * @access public - * @return void + * @return string */ public function delete($testcaseID) { diff --git a/api/v1/entries/testcases.php b/api/v1/entries/testcases.php index 5facb8ce38..6a841b3e40 100644 --- a/api/v1/entries/testcases.php +++ b/api/v1/entries/testcases.php @@ -16,7 +16,7 @@ class testcasesEntry extends entry * * @param int $productID * @access public - * @return void + * @return string */ public function get($productID = 0) { @@ -63,7 +63,7 @@ class testcasesEntry extends entry * * @param int $productID * @access public - * @return void + * @return string */ public function post($productID = 0) { @@ -106,6 +106,6 @@ class testcasesEntry extends entry $case = $this->loadModel('testcase')->getByID($data->id); $case->steps = (isset($case->steps) and !empty($case->steps)) ? array_values($case->steps) : array(); - $this->send(200, $this->format($case, 'openedBy:user,openedDate:time,lastEditedBy:user,lastEditedDate:time,lastRunDate:time,scriptedDate:date,reviewedBy:user,reviewedDate:date,deleted:bool')); + return $this->send(200, $this->format($case, 'openedBy:user,openedDate:time,lastEditedBy:user,lastEditedDate:time,lastRunDate:time,scriptedDate:date,reviewedBy:user,reviewedDate:date,deleted:bool')); } } diff --git a/api/v1/entries/testresults.php b/api/v1/entries/testresults.php index f2fc03c669..365e9f79c9 100644 --- a/api/v1/entries/testresults.php +++ b/api/v1/entries/testresults.php @@ -16,7 +16,7 @@ class testresultsEntry extends entry * * @param int $productID * @access public - * @return void + * @return string */ public function get($caseID = 0) { @@ -50,7 +50,7 @@ class testresultsEntry extends entry * * @param int $caseID * @access public - * @return void + * @return string */ public function post($caseID = 0) { @@ -83,6 +83,6 @@ class testresultsEntry extends entry $data = $this->getData(); if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message); - $this->send(200, array()); + return $this->send(200, array()); } } diff --git a/api/v1/entries/testsuite.php b/api/v1/entries/testsuite.php index e1a0ea31b4..58cca66be4 100644 --- a/api/v1/entries/testsuite.php +++ b/api/v1/entries/testsuite.php @@ -16,7 +16,7 @@ class testsuiteEntry extends entry * * @param int $testsuiteID * @access public - * @return void + * @return string */ public function get($testsuiteID) { @@ -36,7 +36,7 @@ class testsuiteEntry extends entry $suite->testcases[] = $this->format($case, 'openedBy:user,openedDate:time,lastEditedBy:user,lastEditedDate:time,lastRunDate:time,scriptedDate:date,reviewedBy:user,reviewedDate:date,deleted:bool'); } - $this->send(200, $suite); + return $this->send(200, $suite); } /** @@ -44,7 +44,7 @@ class testsuiteEntry extends entry * * @param int $testsuiteID * @access public - * @return void + * @return string */ public function delete($testsuiteID) { diff --git a/api/v1/entries/testsuites.php b/api/v1/entries/testsuites.php index da0799e2d2..b606feef55 100644 --- a/api/v1/entries/testsuites.php +++ b/api/v1/entries/testsuites.php @@ -16,7 +16,7 @@ class testsuitesEntry extends entry * * @param int $productID * @access public - * @return void + * @return string */ public function get($productID = 0) { @@ -49,7 +49,7 @@ class testsuitesEntry extends entry * * @param int $productID * @access public - * @return void + * @return string */ public function post($productID = 0) { @@ -74,6 +74,6 @@ class testsuitesEntry extends entry $suite = $this->loadModel('testsuite')->getByID($data->id); - $this->send(200, $this->format($suite, 'addedBy:user,addedDate:time,lastEditedBy:user,lastEditedDate:time,deleted:bool')); + return $this->send(200, $this->format($suite, 'addedBy:user,addedDate:time,lastEditedBy:user,lastEditedDate:time,deleted:bool')); } } diff --git a/api/v1/entries/testtask.php b/api/v1/entries/testtask.php index c4d80e76ea..6c7f27ca4e 100644 --- a/api/v1/entries/testtask.php +++ b/api/v1/entries/testtask.php @@ -16,7 +16,7 @@ class testtaskEntry extends entry * * @param int $testtaskID * @access public - * @return void + * @return string */ public function get($testtaskID) { @@ -34,7 +34,7 @@ class testtaskEntry extends entry $testtask->testcases[] = $this->format($run, 'openedBy:user,openedDate:time,reviewedBy:user,reviewedDate:date,lastEditedBy:user,lastEditedDate:time'); } - $this->send(200, $this->format($testtask, 'begin:date,end:date,mailto:userList,owner:user,realFinishedDate:time')); + return $this->send(200, $this->format($testtask, 'begin:date,end:date,mailto:userList,owner:user,realFinishedDate:time')); } /** @@ -42,7 +42,7 @@ class testtaskEntry extends entry * * @param int $testtaskID * @access public - * @return void + * @return string */ public function delete($testtaskID) { diff --git a/api/v1/entries/testtasks.php b/api/v1/entries/testtasks.php index b8230f0d13..a7c3130e49 100644 --- a/api/v1/entries/testtasks.php +++ b/api/v1/entries/testtasks.php @@ -16,7 +16,7 @@ class testtasksEntry extends entry * * @param int $projectID * @access public - * @return void + * @return string */ public function get($projectID = 0) { @@ -46,7 +46,7 @@ class testtasksEntry extends entry * * @param int $projectID * @access public - * @return void + * @return string */ private function getProjectTesttasks($projectID) { @@ -72,7 +72,7 @@ class testtasksEntry extends entry * * @access public * @param int $projectID - * @return void + * @return string */ public function post($projectID = 0) { @@ -103,6 +103,6 @@ class testtasksEntry extends entry $testtask = $this->loadModel('testtask')->getByID($data->id); - $this->send(201, $testtask); + return $this->send(201, $testtask); } } diff --git a/api/v1/entries/todo.php b/api/v1/entries/todo.php index 1564f14a12..4594fda30a 100644 --- a/api/v1/entries/todo.php +++ b/api/v1/entries/todo.php @@ -16,7 +16,7 @@ class todoEntry extends entry * * @param int $todoID * @access public - * @return void + * @return string */ public function get($todoID) { @@ -29,7 +29,7 @@ class todoEntry extends entry if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message); $todo = $data->data->todo; - $this->send(200, $this->format($todo, 'assignedDate:time,finishedDate:time,closedDate:time')); + return $this->send(200, $this->format($todo, 'assignedDate:time,finishedDate:time,closedDate:time')); } /** @@ -37,7 +37,7 @@ class todoEntry extends entry * * @param int $todoID * @access public - * @return void + * @return string */ public function put($todoID) { @@ -61,7 +61,7 @@ class todoEntry extends entry if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message); $todo = $this->todo->getByID($todoID); - $this->send(200, $this->format($todo, 'assignedDate:time,finishedDate:time,closedDate:time')); + return $this->send(200, $this->format($todo, 'assignedDate:time,finishedDate:time,closedDate:time')); } /** @@ -69,7 +69,7 @@ class todoEntry extends entry * * @param int $todoID * @access public - * @return void + * @return string */ public function delete($todoID) { diff --git a/api/v1/entries/todoactivate.php b/api/v1/entries/todoactivate.php index 6528650b15..6763bcd5c4 100644 --- a/api/v1/entries/todoactivate.php +++ b/api/v1/entries/todoactivate.php @@ -9,14 +9,14 @@ * @version 1 * @link http://www.zentao.net */ -class todoActivateEntry extends Entry +class todoActivateEntry extends entry { /** * GET method. * * @param int $taskID * @access public - * @return void + * @return string */ public function get($todoID) { @@ -28,6 +28,6 @@ class todoActivateEntry extends Entry if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message); $todo = $this->loadModel('todo')->getByID($todoID); - $this->send(200, $this->format($todo, 'assignedDate:time,finishedDate:time,closedDate:time')); + return $this->send(200, $this->format($todo, 'assignedDate:time,finishedDate:time,closedDate:time')); } } diff --git a/api/v1/entries/todofinish.php b/api/v1/entries/todofinish.php index d7ee7b9bad..97d911a0b3 100644 --- a/api/v1/entries/todofinish.php +++ b/api/v1/entries/todofinish.php @@ -9,14 +9,14 @@ * @version 1 * @link http://www.zentao.net */ -class todoFinishEntry extends Entry +class todoFinishEntry extends entry { /** * GET method. * * @param int $taskID * @access public - * @return void + * @return string */ public function get($todoID) { @@ -28,6 +28,6 @@ class todoFinishEntry extends Entry if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message); $todo = $this->loadModel('todo')->getByID($todoID); - $this->send(200, $this->format($todo, 'assignedDate:time,finishedDate:time,closedDate:time')); + return $this->send(200, $this->format($todo, 'assignedDate:time,finishedDate:time,closedDate:time')); } } diff --git a/api/v1/entries/todos.php b/api/v1/entries/todos.php index f4d3806fc2..0662d549a4 100644 --- a/api/v1/entries/todos.php +++ b/api/v1/entries/todos.php @@ -15,7 +15,7 @@ class todosEntry extends entry * GET method. * * @access public - * @return void + * @return string */ public function get() { @@ -39,7 +39,7 @@ class todosEntry extends entry * POST method. * * @access public - * @return void + * @return string */ public function post() { @@ -64,6 +64,6 @@ class todosEntry extends entry $todo = $this->loadModel('todo')->getByID($data->id); - $this->send(201, $this->format($todo, 'assignedDate:time,finishedDate:time,closedDate:time')); + return $this->send(201, $this->format($todo, 'assignedDate:time,finishedDate:time,closedDate:time')); } } diff --git a/api/v1/entries/tokens.php b/api/v1/entries/tokens.php index ac4e502974..e64c5e0254 100644 --- a/api/v1/entries/tokens.php +++ b/api/v1/entries/tokens.php @@ -15,7 +15,7 @@ class tokensEntry extends baseEntry * POST method. * * @access public - * @return void + * @return string */ public function post() { @@ -29,7 +29,7 @@ class tokensEntry extends baseEntry if($user) { $this->user->login($user, $addAction); - $this->send(201, array('token' => session_id())); + return $this->send(201, array('token' => session_id())); } else { diff --git a/api/v1/entries/user.php b/api/v1/entries/user.php index 74f6a1846a..f7c0e6c4d4 100644 --- a/api/v1/entries/user.php +++ b/api/v1/entries/user.php @@ -9,14 +9,14 @@ * @version 1 * @link http://www.zentao.net */ -class userEntry extends Entry +class userEntry extends entry { /** * GET method. * * @param int|string $userID * @access public - * @return void + * @return string */ public function get($userID = 0) { @@ -40,7 +40,7 @@ class userEntry extends Entry $user = $data->data->user; unset($user->password); - $this->send(200, $user); + return $this->send(200, $user); } /** @@ -49,7 +49,7 @@ class userEntry extends Entry * @param string $fields * * @access private - * @return void + * @return string */ private function getInfo($fields = '') { @@ -373,7 +373,7 @@ class userEntry extends Entry } } - $this->send(200, $info); + return $this->send(200, $info); } /** @@ -381,7 +381,7 @@ class userEntry extends Entry * * @param int|string $userID * @access public - * @return void + * @return string */ public function put($userID) { @@ -420,7 +420,7 @@ class userEntry extends Entry $user = $this->user->getByID($userID, 'id'); unset($user->password); - $this->send(200, $this->format($user, 'last:time,locked:time')); + return $this->send(200, $this->format($user, 'last:time,locked:time')); } /** @@ -428,7 +428,7 @@ class userEntry extends Entry * * @param int|string $userID * @access public - * @return void + * @return string */ public function delete($userID) { diff --git a/api/v1/entries/users.php b/api/v1/entries/users.php index b344dcba48..bc5f7fb2fb 100644 --- a/api/v1/entries/users.php +++ b/api/v1/entries/users.php @@ -15,7 +15,7 @@ class usersEntry extends entry * GET method. * * @access public - * @return void + * @return string */ public function get() { @@ -51,7 +51,7 @@ class usersEntry extends entry * POST method. * * @access public - * @return void + * @return string */ public function post() { @@ -85,6 +85,6 @@ class usersEntry extends entry $user = $this->loadModel('user')->getByID($data->id, 'id'); unset($user->password); - $this->send(201, $this->format($user, 'last:time,locked:time')); + return $this->send(201, $this->format($user, 'last:time,locked:time')); } } diff --git a/api/v1/entries/views.php b/api/v1/entries/views.php index 56d6c61643..3786a8f7de 100644 --- a/api/v1/entries/views.php +++ b/api/v1/entries/views.php @@ -15,7 +15,7 @@ class viewsEntry extends entry * GET method. * * @access public - * @return void + * @return string */ public function get() { diff --git a/api/v1/entries/zfile.php b/api/v1/entries/zfile.php index ddfb530149..930a9310cc 100644 --- a/api/v1/entries/zfile.php +++ b/api/v1/entries/zfile.php @@ -16,7 +16,7 @@ class zfileEntry extends entry * * @param string $fileID * @access public - * @return void + * @return string */ public function get($fileID) { @@ -33,6 +33,6 @@ class zfileEntry extends entry $info->editedTime = $now; $info->modifiedTime = $now; - $this->send(200, $info); + return $this->send(200, $info); } } diff --git a/api/v1/entries/zfilecontent.php b/api/v1/entries/zfilecontent.php index 64e6d4e7aa..884421b1c2 100644 --- a/api/v1/entries/zfilecontent.php +++ b/api/v1/entries/zfilecontent.php @@ -16,7 +16,7 @@ class zfileContentEntry extends entry * * @param string $fileID * @access public - * @return void + * @return string */ public function get($fileID) { diff --git a/api/v1/entries/zfolder.php b/api/v1/entries/zfolder.php index bd4afc1a4b..c59b677587 100644 --- a/api/v1/entries/zfolder.php +++ b/api/v1/entries/zfolder.php @@ -16,7 +16,7 @@ class zfolderEntry extends entry * * @param string $folderID * @access public - * @return void + * @return string */ public function get($folderID) { @@ -43,6 +43,6 @@ class zfolderEntry extends entry } } - $this->send(200, array('nodes' => $nodes)); + return $this->send(200, array('nodes' => $nodes)); } } diff --git a/api/v1/entries/zfolders.php b/api/v1/entries/zfolders.php index 920dc6c8c2..0ae895f218 100644 --- a/api/v1/entries/zfolders.php +++ b/api/v1/entries/zfolders.php @@ -15,7 +15,7 @@ class zfoldersEntry extends entry * GET method. * * @access public - * @return void + * @return string */ public function get() { @@ -39,6 +39,6 @@ class zfoldersEntry extends entry ); } - $this->send(200, array('nodes' => $nodes)); + return $this->send(200, array('nodes' => $nodes)); } } diff --git a/framework/api/entry.class.php b/framework/api/entry.class.php index 7ee48f9d13..076508c134 100644 --- a/framework/api/entry.class.php +++ b/framework/api/entry.class.php @@ -18,9 +18,9 @@ class entry extends baseEntry { parent::__construct(); - if($this->app->action == 'options') return $this->send(204); + if($this->app->action == 'options') throw EndResponseException::create($this->send(204)); - if(!isset($this->app->user) or $this->app->user->account == 'guest') $this->sendError(401, 'Unauthorized'); + if(!isset($this->app->user) or $this->app->user->account == 'guest') throw EndResponseException::create($this->sendError(401, 'Unauthorized')); $this->dao = $this->loadModel('common')->dao; } @@ -199,7 +199,7 @@ class baseEntry * @param int $code * @param mixed $data * @access public - * @return void + * @return string */ public function send($code, $data = '') { @@ -210,8 +210,7 @@ class baseEntry header("Content-type: application/json"); header("HTTP/1.1 {$this->statusCode[$code]}"); - if($data) echo json_encode($data, JSON_HEX_TAG); - exit; + return !empty($data) ? json_encode($data, JSON_HEX_TAG) : ''; } /** @@ -221,14 +220,14 @@ class baseEntry * @param int $code * @param string $msg * @access public - * @return void + * @return string */ public function sendError($code, $msg) { $response = new stdclass(); $response->error = $msg; - $this->send($code, $response); + return $this->send($code, $response); } /** @@ -238,14 +237,14 @@ class baseEntry * @param int $code * @param string $msg * @access public - * @return void + * @return string */ public function sendSuccess($code, $msg) { $response = new stdclass(); $response->message = $msg; - $this->send($code, $response); + return $this->send($code, $response); } /** @@ -253,22 +252,22 @@ class baseEntry * * @param string message * @access public - * @return void + * @return string */ public function send400($message = 'error') { - $this->sendError(400, $message); + return $this->sendError(400, $message); } /** * Send 404 response. * * @access public - * @return void + * @return string */ public function send404() { - $this->sendError(404, '404 Not found'); + return $this->sendError(404, '404 Not found'); } /** @@ -673,7 +672,7 @@ class baseEntry * @param string $method * @param array $params * @access public - * @return void + * @return mixed */ public function fetch($entry, $method, $params = array()) { @@ -688,7 +687,7 @@ class baseEntry * Check the user has permission to access this method, if not, return 403. * * @access public - * @return void + * @return void|string */ public function checkPriv() { @@ -696,7 +695,7 @@ class baseEntry $method = $this->app->getMethodName(); if($module and $method and !$this->loadModel('common')->isOpenMethod($module, $method) and !commonModel::hasPriv($module, $method)) { - $this->send(403, array('error' => 'Access not allowed')); + return $this->send(403, array('error' => 'Access not allowed')); } } diff --git a/framework/api/router.class.php b/framework/api/router.class.php index ef441d72c8..ba88468a31 100644 --- a/framework/api/router.class.php +++ b/framework/api/router.class.php @@ -190,17 +190,35 @@ class api extends router */ public function loadModule() { - /* If the version of api don't exists, call parent method. */ - if(!$this->version) return parent::loadModule(); + try + { + /* If the version of api don't exists, call parent method. */ + if(!$this->version) + { + global $app; + $app->setParams(); + return parent::loadModule(); + } - $entry = strtolower($this->entry); - include($this->appRoot . "api/$this->version/entries/$entry.php"); + $entry = strtolower($this->entry); + $filename = $this->appRoot . "api/$this->version/entries/$entry.php"; - $entryName = $this->entry . 'Entry'; - $entry = new $entryName(); + if(file_exists($filename)) include($filename); - if($this->action == 'options') return $entry->send(204); - call_user_func_array(array($entry, $this->action), array_values($this->params)); + $entryName = $this->entry . 'Entry'; + + if($entry == 'error' && !class_exists($entryName)) include($this->appRoot . "api/v1/entries/$entry.php"); + + $entry = new $entryName(); + + if($this->action == 'options') throw EndResponseException::create($entry->send(204)); + + echo call_user_func_array(array($entry, $this->action), array_values($this->params)); + } + catch(EndResponseException $endResponseException) + { + echo $endResponseException->getContent(); + } } /** @@ -208,7 +226,7 @@ class api extends router * * Load config file of api. * - * @param configPath + * @param string $configPath * @access public * @return void */ @@ -229,7 +247,8 @@ class api extends router public function loadApiLang() { global $lang; - if($this->version) include($this->appRoot . "api/$this->version/lang/$this->clientLang.php"); + $filename = $this->appRoot . "api/$this->version/lang/$this->clientLang.php"; + if($this->version && file_exists($filename)) include($filename); } /** diff --git a/framework/base/router.class.php b/framework/base/router.class.php index 30e00fb9cd..d99a03afde 100644 --- a/framework/base/router.class.php +++ b/framework/base/router.class.php @@ -1008,15 +1008,15 @@ class baseRouter } } - /* If request header has token, use it as session for authentication. */ - if(isset($_SERVER['HTTP_TOKEN'])) session_id($_SERVER['HTTP_TOKEN']); - $sessionName = $this->config->sessionVar; session_name($sessionName); session_set_cookie_params(0, $this->config->webRoot, '', $this->config->cookieSecure, true); if($this->config->customSession) session_save_path($this->getTmpRoot() . 'session'); if(!session_id()) session_start(); + /* If request header has token, use it as session for authentication. */ + if(isset($_SERVER['HTTP_TOKEN'])) session_id($_SERVER['HTTP_TOKEN']); + $this->sessionID = isset($ztSessionHandler) ? $ztSessionHandler->getSessionID() : session_id(); if(isset($_GET[$this->config->sessionVar]))