Skip to content

Commit

Permalink
Merge pull request #63 from s-nakajima/master
Browse files Browse the repository at this point in the history
typo
  • Loading branch information
s-nakajima committed May 22, 2016
2 parents 9fff28f + c1ff72b commit 8e3dee6
Showing 1 changed file with 18 additions and 33 deletions.
51 changes: 18 additions & 33 deletions Controller/BbsArticlesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

App::uses('BbsesAppController', 'Bbses.Controller');
App::uses('CakeText', 'Utility');
App::uses('Workflow', 'Workflow.Controller/Component');
App::uses('WorkflowComponent', 'Workflow.Controller/Component');
App::uses('MailSend', 'Mails.Utility');

/**
Expand Down Expand Up @@ -129,8 +129,7 @@ public function index() {
public function view() {
//参照権限チェック
if (! $this->BbsArticle->canReadWorkflowContent()) {
$this->throwBadRequest();
return false;
return $this->throwBadRequest();
}

$bbsArticleKey = null;
Expand All @@ -147,8 +146,7 @@ public function view() {
)
));
if (! $bbsArticle) {
$this->throwBadRequest();
return false;
return $this->throwBadRequest();
}
$this->set('currentBbsArticle', $bbsArticle);

Expand All @@ -163,8 +161,7 @@ public function view() {
)
));
if (! $rootBbsArticle) {
$this->throwBadRequest();
return false;
return $this->throwBadRequest();
}
$this->set('rootBbsArticle', $rootBbsArticle);
}
Expand All @@ -179,8 +176,7 @@ public function view() {
)
));
if (! $parentBbsArticle) {
$this->throwBadRequest();
return false;
return $this->throwBadRequest();
}
$this->set('parentBbsArticle', $parentBbsArticle);
} else {
Expand Down Expand Up @@ -275,8 +271,7 @@ public function reply() {
));

if (Hash::get($bbsArticle, 'BbsArticle.status') !== WorkflowComponent::STATUS_PUBLISHED) {
$this->throwBadRequest();
return;
return $this->throwBadRequest();
}

if ($this->request->is('post')) {
Expand All @@ -299,8 +294,7 @@ public function reply() {
'frame_id' => $this->data['Frame']['id'],
'key' => $bbsArticle['BbsArticle']['key']
));
$this->redirect($url);
return;
return $this->redirect($url);
}
$this->NetCommons->handleValidationError($this->BbsArticle->validationErrors);

Expand Down Expand Up @@ -358,8 +352,7 @@ public function edit() {

//掲示板の場合は、削除権限と同じ条件とする
if (! $this->BbsArticle->canDeleteWorkflowContent($bbsArticle)) {
$this->throwBadRequest();
return false;
return $this->throwBadRequest();
}

if ($this->request->is('put')) {
Expand All @@ -378,8 +371,7 @@ public function edit() {
'frame_id' => $this->data['Frame']['id'],
'key' => $bbsArticle['BbsArticle']['key']
));
$this->redirect($url);
return;
return $this->redirect($url);
}
$this->NetCommons->handleValidationError($this->BbsArticle->validationErrors);

Expand All @@ -402,8 +394,7 @@ public function edit() {
*/
public function delete() {
if (! $this->request->is('delete')) {
$this->throwBadRequest();
return;
return $this->throwBadRequest();
}

$bbsArticle = $this->BbsArticle->getWorkflowContents('first', array(
Expand All @@ -416,8 +407,7 @@ public function delete() {

//削除権限チェック
if (! $this->BbsArticle->canDeleteWorkflowContent($bbsArticle)) {
$this->throwBadRequest();
return false;
return $this->throwBadRequest();
}

//親記事の取得
Expand All @@ -429,14 +419,12 @@ public function delete() {
)
));
if (! $parentBbsArticle) {
$this->throwBadRequest();
return false;
return $this->throwBadRequest();
}
}

if (! $this->BbsArticle->deleteBbsArticle($this->data)) {
$this->throwBadRequest();
return;
return $this->throwBadRequest();
}

if (isset($parentBbsArticle)) {
Expand All @@ -450,7 +438,7 @@ public function delete() {
} else {
$url = NetCommonsUrl::backToPageUrl();
}
$this->redirect($url);
return $this->redirect($url);
}

/**
Expand All @@ -460,15 +448,13 @@ public function delete() {
*/
public function approve() {
if (! $this->request->is('put')) {
$this->throwBadRequest();
return;
return $this->throwBadRequest();
}

$data = $this->data;
$data['BbsArticle']['status'] = $this->Workflow->parseStatus();
if (! $data['BbsArticle']['status']) {
$this->throwBadRequest();
return;
return $this->throwBadRequest();
}

if ($this->BbsArticle->saveCommentAsPublish($data)) {
Expand All @@ -483,11 +469,10 @@ public function approve() {
'frame_id' => $this->data['Frame']['id'],
'key' => $this->data['BbsArticle']['key']
));
$this->redirect($url);
return;
return $this->redirect($url);
}
$this->NetCommons->handleValidationError($this->BbsArticle->validationErrors);

$this->throwBadRequest();
return $this->throwBadRequest();
}
}

0 comments on commit 8e3dee6

Please sign in to comment.