@@ -242,7 +242,8 @@ discard block |
||
| 242 | 242 | $this->_stop(); |
| 243 | 243 | } |
| 244 | 244 | // answering through POST request |
| 245 | - else : |
|
| 245 | + else { |
|
| 246 | + : |
|
| 246 | 247 | if ($this->localReferer('action') === 'mix') { |
| 247 | 248 | // answer request came from mix ansicht |
| 248 | 249 | $this->redirect( |
@@ -253,6 +254,7 @@ discard block |
||
| 253 | 254 | '#' => $this->Entry->id |
| 254 | 255 | ] |
| 255 | 256 | ); |
| 257 | + } |
|
| 256 | 258 | |
| 257 | 259 | } else { |
| 258 | 260 | // normal posting from entries/add or entries/view |
@@ -267,7 +269,8 @@ discard block |
||
| 267 | 269 | } |
| 268 | 270 | return; |
| 269 | 271 | endif; |
| 270 | - else : |
|
| 272 | + else { |
|
| 273 | + : |
|
| 271 | 274 | // Error while trying to save a post |
| 272 | 275 | if (count($this->Entry->validationErrors) === 0) { |
| 273 | 276 | $this->Session->setFlash( |
@@ -276,6 +279,7 @@ discard block |
||
| 276 | 279 | ), |
| 277 | 280 | 'flash/error' |
| 278 | 281 | ); |
| 282 | + } |
|
| 279 | 283 | } |
| 280 | 284 | endif; |
| 281 | 285 | |
@@ -584,10 +588,12 @@ discard block |
||
| 584 | 588 | ); |
| 585 | 589 | $entry = $this->dic->newInstance('\Saito\Posting\Posting', ['rawData' => $newEntry]); |
| 586 | 590 | $this->set('entry', $entry); |
| 587 | - else : |
|
| 591 | + else { |
|
| 592 | + : |
|
| 588 | 593 | // validation errors |
| 589 | 594 | foreach ($errors as $field => $error) { |
| 590 | 595 | $message = __d('nondynamic', $field) . ": " . __d( 'nondynamic', $error[0]); |
| 596 | + } |
|
| 591 | 597 | $this->JsData->addAppJsMessage( |
| 592 | 598 | $message, |
| 593 | 599 | [ |
@@ -89,8 +89,10 @@ discard block |
||
| 89 | 89 | $this->Session->setFlash(__('Error moving category.'), |
| 90 | 90 | 'flash/error'); |
| 91 | 91 | $failure = $failure || true; |
| 92 | - else: |
|
| 92 | + else { |
|
| 93 | + : |
|
| 93 | 94 | $this->Session->setFlash(__('Category moved.'), 'flash/notice'); |
| 95 | + } |
|
| 94 | 96 | endif; |
| 95 | 97 | endif; |
| 96 | 98 | |
@@ -99,8 +101,10 @@ discard block |
||
| 99 | 101 | $this->Session->setFlash(__("Error deleting category."), |
| 100 | 102 | 'flash/error'); |
| 101 | 103 | $failure = $failure || true; |
| 102 | - else: |
|
| 104 | + else { |
|
| 105 | + : |
|
| 103 | 106 | $this->Session->setFlash(__('Category deleted.'), 'flash/notice'); |
| 107 | + } |
|
| 104 | 108 | endif; |
| 105 | 109 | |
| 106 | 110 | if ($failure == false) : |
@@ -20,10 +20,10 @@ |
||
| 20 | 20 | // Leave in front to have it available in all Components |
| 21 | 21 | 'Detectors.Detectors', |
| 22 | 22 | /** |
| 23 | - * You have to have Cookie before CurrentUser to have the salt initialized. |
|
| 24 | - * Check by deleting Session cookie when persistent cookie is present. |
|
| 25 | - * @td maybe bug in Cake, because Cookies should be initialized in CurrentUser's $components |
|
| 26 | - */ |
|
| 23 | + * You have to have Cookie before CurrentUser to have the salt initialized. |
|
| 24 | + * Check by deleting Session cookie when persistent cookie is present. |
|
| 25 | + * @td maybe bug in Cake, because Cookies should be initialized in CurrentUser's $components |
|
| 26 | + */ |
|
| 27 | 27 | 'Cookie', |
| 28 | 28 | 'CurrentUser', |
| 29 | 29 | 'CacheSupport', |
@@ -305,8 +305,10 @@ |
||
| 305 | 305 | |
| 306 | 306 | if ($this->isLoggedIn()): |
| 307 | 307 | $this->_Controller->Auth->allow(); |
| 308 | - else: |
|
| 308 | + else { |
|
| 309 | + : |
|
| 309 | 310 | $this->_Controller->Auth->deny(); |
| 311 | + } |
|
| 310 | 312 | endif; |
| 311 | 313 | |
| 312 | 314 | $this->_Controller->Auth->autoRedirect = false; // don't redirect after Auth->login() |
@@ -56,12 +56,12 @@ discard block |
||
| 56 | 56 | $this->captcha_result = $numberOne - $numberTwo; |
| 57 | 57 | |
| 58 | 58 | # Session-Way (only one form at a time) - must be a component then |
| 59 | - //$this->Session->write('Captcha.result', $result); |
|
| 59 | + //$this->Session->write('Captcha.result', $result); |
|
| 60 | 60 | |
| 61 | - # DB-Way (several forms possible, high security via IP-Based max limits) |
|
| 62 | - // the following should be done in a component and passed to the view/helper |
|
| 63 | - // $Captcha = ClassRegistry::init('Captcha'); |
|
| 64 | - // $Captcha->new(); $Captcha->update(); etc |
|
| 61 | + # DB-Way (several forms possible, high security via IP-Based max limits) |
|
| 62 | + // the following should be done in a component and passed to the view/helper |
|
| 63 | + // $Captcha = ClassRegistry::init('Captcha'); |
|
| 64 | + // $Captcha->new(); $Captcha->update(); etc |
|
| 65 | 65 | |
| 66 | 66 | # Timestamp-SessionID-Hash-Way (several forms possible, not as secure) |
| 67 | 67 | $this->captcha_hash = SimpleCaptcha::buildHash(array('timestamp' => time(), 'result' => $this->captcha_result), $this->options); |
@@ -93,10 +93,10 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | # add passive part on active forms as well |
| 95 | 95 | $out = '<div style="display:none">'. |
| 96 | - $this->Form->input($field.'_hash', array('value'=>$this->captcha_hash)). |
|
| 97 | - $this->Form->input($field.'_time', array('value'=>time())). |
|
| 98 | - $this->Form->input((!empty($model)?$model.'.':'').$this->options['dummyField'], array('value'=>'')). |
|
| 99 | - '</div>'; |
|
| 96 | + $this->Form->input($field.'_hash', array('value'=>$this->captcha_hash)). |
|
| 97 | + $this->Form->input($field.'_time', array('value'=>time())). |
|
| 98 | + $this->Form->input((!empty($model)?$model.'.':'').$this->options['dummyField'], array('value'=>'')). |
|
| 99 | + '</div>'; |
|
| 100 | 100 | |
| 101 | 101 | return $out; |
| 102 | 102 | } |
@@ -133,8 +133,8 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | |
| 135 | 135 | if ($options['combined'] === true) { |
| 136 | - $options['between'] = $out.' = '; |
|
| 137 | - } |
|
| 136 | + $options['between'] = $out.' = '; |
|
| 137 | + } |
|
| 138 | 138 | unset($options['combined']); |
| 139 | 139 | |
| 140 | 140 | return $this->Form->input($this->__fieldName($model), $options); |
@@ -41,7 +41,9 @@ |
||
| 41 | 41 | * @return array |
| 42 | 42 | */ |
| 43 | 43 | protected function _generate() { |
| 44 | - if ($this->captcha_generated === TRUE) return; |
|
| 44 | + if ($this->captcha_generated === TRUE) { |
|
| 45 | + return; |
|
| 46 | + } |
|
| 45 | 47 | # Choose the first number randomly between 6 and 10. This is to stop the answer being negative. |
| 46 | 48 | $numberOne = mt_rand(6, 9); |
| 47 | 49 | # Choose the second number randomly between 0 and 5. |
@@ -208,8 +208,8 @@ |
||
| 208 | 208 | Configure::write('Saito.Globals.postingsPerThread', 10); |
| 209 | 209 | |
| 210 | 210 | /** |
| 211 | - * Check if the forum is installed |
|
| 212 | - */ |
|
| 211 | + * Check if the forum is installed |
|
| 212 | + */ |
|
| 213 | 213 | if ( file_exists(APP . 'Config' . DS . 'installed.txt') ) : |
| 214 | 214 | Configure::write('Saito.installed', TRUE); |
| 215 | 215 | else : |
@@ -212,8 +212,10 @@ |
||
| 212 | 212 | */ |
| 213 | 213 | if ( file_exists(APP . 'Config' . DS . 'installed.txt') ) : |
| 214 | 214 | Configure::write('Saito.installed', TRUE); |
| 215 | -else : |
|
| 215 | +else { |
|
| 216 | + : |
|
| 216 | 217 | Configure::write('Saito.installed', FALSE); |
| 218 | +} |
|
| 217 | 219 | endif; |
| 218 | 220 | |
| 219 | 221 | /** |
@@ -135,9 +135,9 @@ |
||
| 135 | 135 | */ |
| 136 | 136 | Configure::write('Routing.prefixes', array('admin')); |
| 137 | 137 | /** |
| 138 | - * Turn off all caching application-wide. |
|
| 139 | - * |
|
| 140 | - */ |
|
| 138 | + * Turn off all caching application-wide. |
|
| 139 | + * |
|
| 140 | + */ |
|
| 141 | 141 | //Configure::write('Cache.disable', true); |
| 142 | 142 | |
| 143 | 143 | /** |
@@ -46,14 +46,14 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * Add additional buttons to editor |
| 49 | - * |
|
| 50 | - * You can theme them with |
|
| 51 | - * |
|
| 52 | - * <code> |
|
| 53 | - * .markItUp .markItUpButton<Id> a { |
|
| 54 | - * … |
|
| 55 | - * } |
|
| 56 | - * </code> |
|
| 49 | + * |
|
| 50 | + * You can theme them with |
|
| 51 | + * |
|
| 52 | + * <code> |
|
| 53 | + * .markItUp .markItUpButton<Id> a { |
|
| 54 | + * … |
|
| 55 | + * } |
|
| 56 | + * </code> |
|
| 57 | 57 | * |
| 58 | 58 | /* |
| 59 | 59 | Configure::write( |
@@ -75,22 +75,22 @@ discard block |
||
| 75 | 75 | // image in img/markitup/<replacement> |
| 76 | 76 | 'replacement' => 'resultofbutton1.png' |
| 77 | 77 | ), |
| 78 | - * // … |
|
| 78 | + * // … |
|
| 79 | 79 | ) |
| 80 | 80 | ); |
| 81 | - * |
|
| 82 | - */ |
|
| 81 | + * |
|
| 82 | + */ |
|
| 83 | 83 | |
| 84 | 84 | /** |
| 85 | 85 | * Users to notify via email if a new users registers successfully |
| 86 | - * |
|
| 87 | - * Provide an array with user IDs. To notify the admin (usually user-id 1): |
|
| 88 | - * |
|
| 89 | - * [1] |
|
| 90 | - * |
|
| 91 | - * To notify the admin with id 1 and the user with the id 5: |
|
| 92 | - * |
|
| 93 | - * [1, 5] |
|
| 86 | + * |
|
| 87 | + * Provide an array with user IDs. To notify the admin (usually user-id 1): |
|
| 88 | + * |
|
| 89 | + * [1] |
|
| 90 | + * |
|
| 91 | + * To notify the admin with id 1 and the user with the id 5: |
|
| 92 | + * |
|
| 93 | + * [1, 5] |
|
| 94 | 94 | */ |
| 95 | 95 | /* |
| 96 | 96 | Configure::write('Saito.Notification.userActivatedAdminNoticeToUserWithID', [1]); |
@@ -2,54 +2,54 @@ discard block |
||
| 2 | 2 | // @codingStandardsIgnoreFile |
| 3 | 3 | App::uses('AppHelper', 'View/Helper'); |
| 4 | 4 | /** |
| 5 | - * Farbtastic helper |
|
| 6 | - * @author Curtis Gibby |
|
| 7 | - * @author Sebastian Siedentopf |
|
| 8 | - * @desc This helper does everything you need related to Farbtastic within CakePHP |
|
| 9 | - * |
|
| 10 | - * Like Farbtastic, requires jQuery to function properly. |
|
| 11 | - * jQuery: http://jquery.com |
|
| 12 | - * |
|
| 13 | - * Also requires a Color Wheel icon (color.png in this example) |
|
| 14 | - * like the one from Mark James' Silk set |
|
| 15 | - * http://www.iconfinder.net/icondetails/5185/16/ |
|
| 16 | - * |
|
| 17 | - * @version 2010-07-18 |
|
| 18 | - * @td make plugin, fork from http://bakery.cakephp.org/articles/view/helper-for-farbtastic-jquery-color-picker to githup |
|
| 19 | - */ |
|
| 5 | + * Farbtastic helper |
|
| 6 | + * @author Curtis Gibby |
|
| 7 | + * @author Sebastian Siedentopf |
|
| 8 | + * @desc This helper does everything you need related to Farbtastic within CakePHP |
|
| 9 | + * |
|
| 10 | + * Like Farbtastic, requires jQuery to function properly. |
|
| 11 | + * jQuery: http://jquery.com |
|
| 12 | + * |
|
| 13 | + * Also requires a Color Wheel icon (color.png in this example) |
|
| 14 | + * like the one from Mark James' Silk set |
|
| 15 | + * http://www.iconfinder.net/icondetails/5185/16/ |
|
| 16 | + * |
|
| 17 | + * @version 2010-07-18 |
|
| 18 | + * @td make plugin, fork from http://bakery.cakephp.org/articles/view/helper-for-farbtastic-jquery-color-picker to githup |
|
| 19 | + */ |
|
| 20 | 20 | class FarbtasticHelper extends Helper { |
| 21 | 21 | |
| 22 | - public $helpers = ['Form', 'Html']; |
|
| 22 | + public $helpers = ['Form', 'Html']; |
|
| 23 | 23 | |
| 24 | 24 | protected $output_files = true; |
| 25 | 25 | |
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * Generate a form input and related div and icon |
|
| 29 | - * |
|
| 30 | - * may need to customize $icon_file (relative to webroot) |
|
| 31 | - * |
|
| 32 | - * Adapted from April Hodge Silver's "Simple Colorpicker" input function |
|
| 33 | - * http://bakery.cakephp.org/articles/view/simple-colorpicker |
|
| 34 | - */ |
|
| 35 | - function input($name, $label='') { |
|
| 27 | + /** |
|
| 28 | + * Generate a form input and related div and icon |
|
| 29 | + * |
|
| 30 | + * may need to customize $icon_file (relative to webroot) |
|
| 31 | + * |
|
| 32 | + * Adapted from April Hodge Silver's "Simple Colorpicker" input function |
|
| 33 | + * http://bakery.cakephp.org/articles/view/simple-colorpicker |
|
| 34 | + */ |
|
| 35 | + function input($name, $label='') { |
|
| 36 | 36 | |
| 37 | - $icon_file = '../../js/farbtastic/color.png'; // update to wherever your icon is. |
|
| 37 | + $icon_file = '../../js/farbtastic/color.png'; // update to wherever your icon is. |
|
| 38 | 38 | |
| 39 | - list($model, $fieldname) = explode('.', $name); |
|
| 40 | - if (empty($label)) { |
|
| 41 | - $label = Inflector::Humanize($fieldname); |
|
| 42 | - } |
|
| 39 | + list($model, $fieldname) = explode('.', $name); |
|
| 40 | + if (empty($label)) { |
|
| 41 | + $label = Inflector::Humanize($fieldname); |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - if(isset($this->request->data[$model][$fieldname])) { |
|
| 45 | - $color_value = str_replace("#", "", $this->request->data[$model][$fieldname]); // expects an RGB string, strips any incoming '#' character |
|
| 46 | - } |
|
| 47 | - else { |
|
| 48 | - $color_value = "000000"; // black |
|
| 49 | - } |
|
| 44 | + if(isset($this->request->data[$model][$fieldname])) { |
|
| 45 | + $color_value = str_replace("#", "", $this->request->data[$model][$fieldname]); // expects an RGB string, strips any incoming '#' character |
|
| 46 | + } |
|
| 47 | + else { |
|
| 48 | + $color_value = "000000"; // black |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - $str = ''; |
|
| 52 | - $str .= '<div class="input text colorpicker">'; |
|
| 51 | + $str = ''; |
|
| 52 | + $str .= '<div class="input text colorpicker">'; |
|
| 53 | 53 | $str .= $this->Form->input($fieldname, [ |
| 54 | 54 | 'id' => $model . Inflector::Camelize($fieldname), |
| 55 | 55 | 'class' => 'farbtastic-input', |
@@ -57,9 +57,9 @@ discard block |
||
| 57 | 57 | 'label' => $label, |
| 58 | 58 | 'value' => "#$color_value" |
| 59 | 59 | ]); |
| 60 | - $str .= '<img id="farbtastic-picker-icon-'.Inflector::Camelize($fieldname).'" src="'.$icon_file.'" alt="Color Picker" title="Color Picker" class="farbtastic-picker-icon">'; |
|
| 61 | - $str .= '<div style="display:none;" class="farbtastic-picker" id="farbtastic-picker-'.Inflector::Camelize($fieldname).'"></div>'; |
|
| 62 | - $str .= '</div>'; |
|
| 60 | + $str .= '<img id="farbtastic-picker-icon-'.Inflector::Camelize($fieldname).'" src="'.$icon_file.'" alt="Color Picker" title="Color Picker" class="farbtastic-picker-icon">'; |
|
| 61 | + $str .= '<div style="display:none;" class="farbtastic-picker" id="farbtastic-picker-'.Inflector::Camelize($fieldname).'"></div>'; |
|
| 62 | + $str .= '</div>'; |
|
| 63 | 63 | |
| 64 | 64 | $this->readyJS($name); |
| 65 | 65 | |
@@ -70,21 +70,21 @@ discard block |
||
| 70 | 70 | } |
| 71 | 71 | $this->output_files = false; |
| 72 | 72 | |
| 73 | - return $str; |
|
| 74 | - } |
|
| 73 | + return $str; |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | 76 | |
| 77 | 77 | |
| 78 | - /** |
|
| 79 | - * Add the jQuery magic to the $(document).ready function |
|
| 80 | - * Farbtastic-ize the input, make the button show/hide the color picker div |
|
| 81 | - */ |
|
| 82 | - function readyJS($name) { |
|
| 83 | - list($model,$fieldname) = explode('.',$name); |
|
| 84 | - $str = '$(document).ready(function() { '; |
|
| 85 | - $str .= ' $("#farbtastic-picker-'.Inflector::Camelize($fieldname).'").farbtastic("#'.$model.Inflector::Camelize($fieldname).'"); '; |
|
| 86 | - $str .= ' $("#farbtastic-picker-icon-'.Inflector::Camelize($fieldname).'").click( function() { $("#farbtastic-picker-'.Inflector::Camelize($fieldname).'").toggle("slow"); }); '; |
|
| 87 | - $str .= '})'; |
|
| 78 | + /** |
|
| 79 | + * Add the jQuery magic to the $(document).ready function |
|
| 80 | + * Farbtastic-ize the input, make the button show/hide the color picker div |
|
| 81 | + */ |
|
| 82 | + function readyJS($name) { |
|
| 83 | + list($model,$fieldname) = explode('.',$name); |
|
| 84 | + $str = '$(document).ready(function() { '; |
|
| 85 | + $str .= ' $("#farbtastic-picker-'.Inflector::Camelize($fieldname).'").farbtastic("#'.$model.Inflector::Camelize($fieldname).'"); '; |
|
| 86 | + $str .= ' $("#farbtastic-picker-icon-'.Inflector::Camelize($fieldname).'").click( function() { $("#farbtastic-picker-'.Inflector::Camelize($fieldname).'").toggle("slow"); }); '; |
|
| 87 | + $str .= '})'; |
|
| 88 | 88 | $this->Html->scriptBlock($str, array('inline'=>false)); |
| 89 | - } |
|
| 89 | + } |
|
| 90 | 90 | }?> |
| 91 | 91 | \ No newline at end of file |
@@ -43,8 +43,7 @@ |
||
| 43 | 43 | |
| 44 | 44 | if(isset($this->request->data[$model][$fieldname])) { |
| 45 | 45 | $color_value = str_replace("#", "", $this->request->data[$model][$fieldname]); // expects an RGB string, strips any incoming '#' character |
| 46 | - } |
|
| 47 | - else { |
|
| 46 | + } else { |
|
| 48 | 47 | $color_value = "000000"; // black |
| 49 | 48 | } |
| 50 | 49 | |