mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Removed else clauses after redirects and added return before redirect() and flash() calls
This commit is contained in:
parent
4590b7d553
commit
4c13a39f3e
6 changed files with 16 additions and 19 deletions
|
@ -56,7 +56,7 @@ class PagesController extends AppController {
|
||||||
|
|
||||||
$count = count($path);
|
$count = count($path);
|
||||||
if (!$count) {
|
if (!$count) {
|
||||||
$this->redirect('/');
|
return $this->redirect('/');
|
||||||
}
|
}
|
||||||
$page = $subpage = $title_for_layout = null;
|
$page = $subpage = $title_for_layout = null;
|
||||||
|
|
||||||
|
|
|
@ -58,13 +58,12 @@
|
||||||
$this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> has been saved'));
|
$this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> has been saved'));
|
||||||
return $this->redirect(array('action' => 'index'));
|
return $this->redirect(array('action' => 'index'));
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
$this->flash(__('<?php echo ucfirst(strtolower($currentModelName)); ?> saved.'), array('action' => 'index'));
|
return $this->flash(__('<?php echo ucfirst(strtolower($currentModelName)); ?> saved.'), array('action' => 'index'));
|
||||||
<?php endif; ?>
|
|
||||||
} else {
|
|
||||||
<?php if ($wannaUseSession): ?>
|
|
||||||
$this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> could not be saved. Please, try again.'));
|
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
}
|
}
|
||||||
|
<?php if ($wannaUseSession): ?>
|
||||||
|
$this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> could not be saved. Please, try again.'));
|
||||||
|
<?php endif; ?>
|
||||||
}
|
}
|
||||||
<?php
|
<?php
|
||||||
foreach (array('belongsTo', 'hasAndBelongsToMany') as $assoc):
|
foreach (array('belongsTo', 'hasAndBelongsToMany') as $assoc):
|
||||||
|
@ -101,13 +100,12 @@
|
||||||
$this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> has been saved'));
|
$this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> has been saved'));
|
||||||
return $this->redirect(array('action' => 'index'));
|
return $this->redirect(array('action' => 'index'));
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
$this->flash(__('The <?php echo strtolower($singularHumanName); ?> has been saved.'), array('action' => 'index'));
|
return $this->flash(__('The <?php echo strtolower($singularHumanName); ?> has been saved.'), array('action' => 'index'));
|
||||||
<?php endif; ?>
|
|
||||||
} else {
|
|
||||||
<?php if ($wannaUseSession): ?>
|
|
||||||
$this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> could not be saved. Please, try again.'));
|
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
}
|
}
|
||||||
|
<?php if ($wannaUseSession): ?>
|
||||||
|
$this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> could not be saved. Please, try again.'));
|
||||||
|
<?php endif; ?>
|
||||||
} else {
|
} else {
|
||||||
$options = array('conditions' => array('<?php echo $currentModelName; ?>.' . $this-><?php echo $currentModelName; ?>->primaryKey => $id));
|
$options = array('conditions' => array('<?php echo $currentModelName; ?>.' . $this-><?php echo $currentModelName; ?>->primaryKey => $id));
|
||||||
$this->request->data = $this-><?php echo $currentModelName; ?>->find('first', $options);
|
$this->request->data = $this-><?php echo $currentModelName; ?>->find('first', $options);
|
||||||
|
@ -147,13 +145,13 @@
|
||||||
$this->Session->setFlash(__('<?php echo ucfirst(strtolower($singularHumanName)); ?> deleted'));
|
$this->Session->setFlash(__('<?php echo ucfirst(strtolower($singularHumanName)); ?> deleted'));
|
||||||
return $this->redirect(array('action' => 'index'));
|
return $this->redirect(array('action' => 'index'));
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
$this->flash(__('<?php echo ucfirst(strtolower($singularHumanName)); ?> deleted'), array('action' => 'index'));
|
return $this->flash(__('<?php echo ucfirst(strtolower($singularHumanName)); ?> deleted'), array('action' => 'index'));
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
}
|
}
|
||||||
<?php if ($wannaUseSession): ?>
|
<?php if ($wannaUseSession): ?>
|
||||||
$this->Session->setFlash(__('<?php echo ucfirst(strtolower($singularHumanName)); ?> was not deleted'));
|
$this->Session->setFlash(__('<?php echo ucfirst(strtolower($singularHumanName)); ?> was not deleted'));
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
$this->flash(__('<?php echo ucfirst(strtolower($singularHumanName)); ?> was not deleted'), array('action' => 'index'));
|
return $this->flash(__('<?php echo ucfirst(strtolower($singularHumanName)); ?> was not deleted'), array('action' => 'index'));
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
return $this->redirect(array('action' => 'index'));
|
return $this->redirect(array('action' => 'index'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ class PagesController extends AppController {
|
||||||
|
|
||||||
$count = count($path);
|
$count = count($path);
|
||||||
if (!$count) {
|
if (!$count) {
|
||||||
$this->redirect('/');
|
return $this->redirect('/');
|
||||||
}
|
}
|
||||||
$page = $subpage = $title_for_layout = null;
|
$page = $subpage = $title_for_layout = null;
|
||||||
|
|
||||||
|
|
|
@ -329,10 +329,9 @@ class Scaffold {
|
||||||
protected function _sendMessage($message) {
|
protected function _sendMessage($message) {
|
||||||
if ($this->_validSession) {
|
if ($this->_validSession) {
|
||||||
$this->controller->Session->setFlash($message);
|
$this->controller->Session->setFlash($message);
|
||||||
$this->controller->redirect($this->redirect);
|
return $this->controller->redirect($this->redirect);
|
||||||
} else {
|
|
||||||
$this->controller->flash($message, $this->redirect);
|
|
||||||
}
|
}
|
||||||
|
$this->controller->flash($message, $this->redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -57,7 +57,7 @@ class PagesController extends AppController {
|
||||||
|
|
||||||
$count = count($path);
|
$count = count($path);
|
||||||
if (!$count) {
|
if (!$count) {
|
||||||
$this->redirect('/');
|
return $this->redirect('/');
|
||||||
}
|
}
|
||||||
$page = $subpage = $titleForLayout = null;
|
$page = $subpage = $titleForLayout = null;
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ class TestsAppsController extends AppController {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function redirect_to() {
|
public function redirect_to() {
|
||||||
$this->redirect('http://cakephp.org');
|
return $this->redirect('http://cakephp.org');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue