Passed
Branchfeature/useWidgetsNamespaces (38e100)
by Robin
03:04
created
programs/functions.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
     if (null === $url) {
113 113
         $script = '<script type="text/javascript">';
114 114
         if (isset($message)) {
115
-            $script .= 'alert("' . bab_toHtml($message, BAB_HTML_JS) . '");';
115
+            $script .= 'alert("'.bab_toHtml($message, BAB_HTML_JS).'");';
116 116
         }
117 117
         $script .= 'history.back();';
118 118
         $script .= '</script>';
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         $url = $url->url();
125 125
     }
126 126
     if (!empty($babBody->msgerror)) {
127
-        $url .=  '&msgerror=' . urlencode($babBody->msgerror);
127
+        $url .= '&msgerror='.urlencode($babBody->msgerror);
128 128
     }
129 129
     if (isset($message)) {
130 130
         $lines = explode("\n", $message);
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
         }
134 134
     }
135 135
 
136
-    header('Location: ' . $url);
136
+    header('Location: '.$url);
137 137
     die;
138 138
 }
139 139
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
  */
166 166
 function app_fileUploadError($error)
167 167
 {
168
-    switch($error) {
168
+    switch ($error) {
169 169
         case UPLOAD_ERR_OK:
170 170
             return null;
171 171
 
Please login to merge, or discard this patch.
programs/init.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
 
26 26
 
27
-require_once dirname(__FILE__). '/functions.php';
27
+require_once dirname(__FILE__).'/functions.php';
28 28
 
29 29
 
30 30
 function LibApp_upgrade($sVersionBase, $sVersionIni)
@@ -80,13 +80,13 @@  discard block
 block discarded – undo
80 80
     
81 81
     $babBody = bab_getBody();
82 82
     $addon = bab_getAddonInfosInstance('libapp');
83
-    $babBody->addStyleSheet($addon->getStylePath() . '/styles.css');
84
-    $babBody->addJavascriptFile($addon->getTemplatePath() . 'libapp.js');
83
+    $babBody->addStyleSheet($addon->getStylePath().'/styles.css');
84
+    $babBody->addJavascriptFile($addon->getTemplatePath().'libapp.js');
85 85
     
86 86
     $App = app_App();
87
-    if($App->isSSEEnabled()){
88
-        $babBody->addJavascriptFile($addon->getTemplatePath() . 'notification.js');
89
-        if(bab_isUserLogged()){
87
+    if ($App->isSSEEnabled()) {
88
+        $babBody->addJavascriptFile($addon->getTemplatePath().'notification.js');
89
+        if (bab_isUserLogged()) {
90 90
             $babBody->babecho('<script>window.libapp={"sseServerUrl": "'.$App->Controller()->SSE()->server()->url().'"}</script>');
91 91
             $babBody->addJavascriptFile($addon->getTemplatePath().'sse.js');
92 92
         }
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
         $addonPhpPath = $addon->getPhpPath();
113 113
         
114 114
         require_once $GLOBALS['babInstallPath'].'utilit/functionalityincl.php';
115
-        require_once dirname(__FILE__) . '/portletbackend.class.php';
115
+        require_once dirname(__FILE__).'/portletbackend.class.php';
116 116
         $functionalities = new bab_functionalities();
117
-        $functionalities->registerClass('Func_PortletBackend_App', $addonPhpPath . 'portletbackend.class.php');
117
+        $functionalities->registerClass('Func_PortletBackend_App', $addonPhpPath.'portletbackend.class.php');
118 118
     }
119 119
 }
120 120
\ No newline at end of file
Please login to merge, or discard this patch.
programs/define.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@
 block discarded – undo
21 21
  * @copyright Copyright (c) 2006 by CANTICO ({@link http://www.cantico.fr})
22 22
  */
23 23
 
24
-define('APP_PHP_PATH', dirname(__FILE__) . '/');
25
-define('APP_SET_PATH', dirname(__FILE__) . '/');
26
-define('APP_UI_PATH', dirname(__FILE__) . '/ui/');
27
-define('APP_WIDGETS_PATH', APP_UI_PATH . 'widgets/');
28
-define('APP_CTRL_PATH', dirname(__FILE__) . '/');
29
-define('APP_PORTLET_PATH', APP_PHP_PATH . 'portlet/');
30 24
\ No newline at end of file
25
+define('APP_PHP_PATH', dirname(__FILE__).'/');
26
+define('APP_SET_PATH', dirname(__FILE__).'/');
27
+define('APP_UI_PATH', dirname(__FILE__).'/ui/');
28
+define('APP_WIDGETS_PATH', APP_UI_PATH.'widgets/');
29
+define('APP_CTRL_PATH', dirname(__FILE__).'/');
30
+define('APP_PORTLET_PATH', APP_PHP_PATH.'portlet/');
31 31
\ No newline at end of file
Please login to merge, or discard this patch.
programs/Set/AppTraceableRecordSet.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
      */
126 126
     protected function logSave(AppTraceableRecord $record, $noTrace)
127 127
     {
128
-        if(! $this->isLoggable()){
128
+        if (!$this->isLoggable()) {
129 129
             return;
130 130
         }
131 131
         $App = $this->App();
@@ -148,14 +148,14 @@  discard block
 block discarded – undo
148 148
      */
149 149
     protected function logDelete(\ORM_Criteria $criteria, $noTrace)
150 150
     {
151
-        if(! $this->isLoggable()){
151
+        if (!$this->isLoggable()) {
152 152
             return;
153 153
         }
154 154
         $App = $this->App();
155 155
         $userId = bab_getUserId();
156 156
         $logSet = $App->LogSet();
157 157
         $deletedRecords = $this->select($criteria);
158
-        foreach ($deletedRecords as $record){
158
+        foreach ($deletedRecords as $record) {
159 159
             $log = $logSet->newRecord();
160 160
             $log->noTrace = $noTrace;
161 161
             $log->objectClass = get_class($record);
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
      */
182 182
     public function select(\ORM_Criteria $criteria = null, $includeDeleted = false)
183 183
     {
184
-        if($includeDeleted){
184
+        if ($includeDeleted) {
185 185
             $this->setDefaultCriteria(null);
186 186
         }
187 187
         return parent::select($criteria);
@@ -224,25 +224,25 @@  discard block
 block discarded – undo
224 224
      */
225 225
     public function delete(\ORM_Criteria $criteria = null, $deletedStatus = AppTraceableRecord::DELETED_STATUS_DELETED)
226 226
     {
227
-        $definitive = ($deletedStatus === true) || ! $this->isTraceable();
227
+        $definitive = ($deletedStatus === true) || !$this->isTraceable();
228 228
         $this->logDelete($criteria, $definitive);
229
-        if($definitive){
229
+        if ($definitive) {
230 230
             return parent::delete($criteria);
231 231
         }
232 232
         
233
-        require_once $GLOBALS['babInstallPath'] . '/utilit/dateTime.php';
233
+        require_once $GLOBALS['babInstallPath'].'/utilit/dateTime.php';
234 234
         $now = \BAB_DateTime::now()->getIsoDateTime();
235 235
         
236 236
         $records = $this->select($criteria);
237 237
         
238
-        foreach ($records as $record){
238
+        foreach ($records as $record) {
239 239
             /* @var $record AppTraceableRecord */
240 240
             // Could be optimized at ORM level
241 241
             $record->deleted = $deletedStatus;
242 242
             $record->deletedOn = $now;
243 243
             $record->deletedBy = bab_getUserId();
244 244
             
245
-            if(! parent::save($record)){
245
+            if (!parent::save($record)) {
246 246
                 return false;
247 247
             }
248 248
         }
@@ -260,13 +260,13 @@  discard block
 block discarded – undo
260 260
      */
261 261
     public function save(\ORM_Record $record, $noTrace = false)
262 262
     {
263
-        $noTrace = $noTrace || ! $this->isTraceable();
263
+        $noTrace = $noTrace || !$this->isTraceable();
264 264
         $this->logSave($record, $noTrace);
265
-        if($noTrace){
265
+        if ($noTrace) {
266 266
             return parent::save($record);
267 267
         }
268 268
         
269
-        require_once $GLOBALS['babInstallPath'] . '/utilit/dateTime.php';
269
+        require_once $GLOBALS['babInstallPath'].'/utilit/dateTime.php';
270 270
         
271 271
         $now = \BAB_DateTime::now()->getIsoDateTime();
272 272
         
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
         $set = $record->getParentSet();
275 275
         $primaryKey = $set->getPrimaryKey();
276 276
         
277
-        if(empty($record->{$primaryKey})){
277
+        if (empty($record->{$primaryKey})) {
278 278
             $record->initValue('createdBy', bab_getUserId());
279 279
             $record->initValue('createdOn', $now);
280 280
             $record->initValue('uuid', $this->uuid());
@@ -305,21 +305,21 @@  discard block
 block discarded – undo
305 305
      */
306 306
     public function getRecordByUuid($uuid)
307 307
     {
308
-        if('' === (string) $uuid){
308
+        if ('' === (string) $uuid) {
309 309
             return null;
310 310
         }
311 311
         
312 312
         $record = $this->get($this->uuid->is($uuid));
313 313
         
314
-        if(! isset($record)){
314
+        if (!isset($record)) {
315 315
             return null;
316 316
         }
317 317
         
318
-        if(! ($record instanceof AppTraceableRecord)){
318
+        if (!($record instanceof AppTraceableRecord)) {
319 319
             return null;
320 320
         }
321 321
         
322
-        if($record->deleted){
322
+        if ($record->deleted) {
323 323
             return null;
324 324
         }
325 325
         
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
      */
336 336
     public function isOwn($userId = null)
337 337
     {
338
-        if(! isset($userId)){
338
+        if (!isset($userId)) {
339 339
             $userId = bab_getUserId();
340 340
         }
341 341
         return $this->createdBy->is($userId);
Please login to merge, or discard this patch.
programs/Set/AppCustomSectionSet.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -109,9 +109,9 @@
 block discarded – undo
109 109
     public function isUpdatable()
110 110
     {
111 111
         return $this->all();
112
-        if($this->App()
112
+        if ($this->App()
113 113
             ->Access()
114
-            ->administer()){
114
+            ->administer()) {
115 115
             return $this->all();
116 116
         }
117 117
         return $this->none();
Please login to merge, or discard this patch.
programs/Set/AppCustomSection.php 2 patches
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
         $App = app_App();
64 64
         static $fieldsLayouts = null;
65 65
         
66
-        if(! isset($fieldsLayouts)){
66
+        if (!isset($fieldsLayouts)) {
67 67
             $fieldsLayouts = array(
68 68
                 self::FIELDS_LAYOUT_VERTICAL_LABEL => $App->translate('Vertical label'),
69 69
                 self::FIELDS_LAYOUT_HORIZONTAL_LABEL => $App->translate('Horizontal label'),
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      */
81 81
     public function getRawFields()
82 82
     {
83
-        if(empty($this->fields)){
83
+        if (empty($this->fields)) {
84 84
             return array();
85 85
         }
86 86
         return explode(',', $this->fields);
@@ -105,29 +105,29 @@  discard block
 block discarded – undo
105 105
      */
106 106
     public function getFields()
107 107
     {
108
-        if(empty($this->fields)){
108
+        if (empty($this->fields)) {
109 109
             return array();
110 110
         }
111 111
         $fields = json_decode($this->fields, true);
112
-        if(json_last_error() === JSON_ERROR_NONE){
112
+        if (json_last_error() === JSON_ERROR_NONE) {
113 113
             return $fields;
114 114
         }
115 115
         
116 116
         $fields = array();
117 117
         $rawFields = $this->getRawFields();
118
-        foreach ($rawFields as $rawField){
119
-            if(empty($rawField)){
118
+        foreach ($rawFields as $rawField) {
119
+            if (empty($rawField)) {
120 120
                 continue;
121 121
             }
122 122
             $params = array();
123 123
             
124
-            if(strpos($rawField, ':') === false){
124
+            if (strpos($rawField, ':') === false) {
125 125
                 $fieldName = $rawField;
126 126
             }
127
-            else{
127
+            else {
128 128
                 list ($fieldName, $parameters) = explode(':', $rawField);
129 129
                 $parameters = explode(';', $parameters);
130
-                foreach ($parameters as $parameter){
130
+                foreach ($parameters as $parameter) {
131 131
                     list ($key, $value) = explode('=', $parameter);
132 132
                     $params[$key] = $value;
133 133
                 }
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
      */
161 161
     public function getField($searchedFieldName)
162 162
     {
163
-        if(empty($this->fields)){
163
+        if (empty($this->fields)) {
164 164
             return null;
165 165
         }
166 166
         
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
     public function addField($fieldName, $parameters = null)
178 178
     {
179 179
         $fields = $this->getFields();
180
-        if(! isset($parameters)){
180
+        if (!isset($parameters)) {
181 181
             $fields[$fieldName] = array(
182 182
                 'block' => ''
183 183
             );
@@ -211,24 +211,24 @@  discard block
 block discarded – undo
211 211
     {
212 212
         $isFieldsGroup = false;
213 213
         $fields = $this->getFields();
214
-        if(strpos($updatedFieldName, '_fieldsGroup') !== false){
214
+        if (strpos($updatedFieldName, '_fieldsGroup') !== false) {
215 215
             $isFieldsGroup = true;
216 216
             list (, $groupPos) = explode('_fieldsGroup', $updatedFieldName);
217
-            if(! isset($groupPos) || empty($groupPos)){
217
+            if (!isset($groupPos) || empty($groupPos)) {
218 218
                 $groupPos = 0;
219 219
             }
220 220
         }
221
-        if(! isset($fields[$updatedFieldName])){
222
-            if($isFieldsGroup){
223
-                while (isset($fields[$updatedFieldName . $groupPos])){
224
-                    $groupPos ++;
221
+        if (!isset($fields[$updatedFieldName])) {
222
+            if ($isFieldsGroup) {
223
+                while (isset($fields[$updatedFieldName.$groupPos])) {
224
+                    $groupPos++;
225 225
                 }
226 226
                 $updatedFieldName .= $groupPos;
227 227
             }
228 228
             $this->addField($updatedFieldName, $parameters);
229 229
             return $this;
230 230
         }
231
-        if(! isset($parameters)){
231
+        if (!isset($parameters)) {
232 232
             $fields[$updatedFieldName] = array(
233 233
                 'block' => ''
234 234
             );
@@ -243,11 +243,11 @@  discard block
 block discarded – undo
243 243
     public function addFieldToGroup($fieldGroupName, $fieldName, $parameters = null)
244 244
     {
245 245
         $fields = $this->getFields();
246
-        if(! isset($fields[$fieldGroupName])){
246
+        if (!isset($fields[$fieldGroupName])) {
247 247
             return $this;
248 248
         }
249 249
         $groupFields = isset($fields[$fieldGroupName]['fields']) ? $fields[$fieldGroupName]['fields'] : array();
250
-        if(! isset($parameters)){
250
+        if (!isset($parameters)) {
251 251
             $groupFields[$fieldName] = array(
252 252
                 'block' => ''
253 253
             );
@@ -281,15 +281,15 @@  discard block
 block discarded – undo
281 281
     public function updateFieldGroup($fieldGroupName, $updatedFieldName, $parameters = null)
282 282
     {
283 283
         $fields = $this->getFields();
284
-        if(! isset($fields[$fieldGroupName])){
284
+        if (!isset($fields[$fieldGroupName])) {
285 285
             return $this;
286 286
         }
287 287
         $groupFields = isset($fields[$fieldGroupName]['fields']) ? $fields[$fieldGroupName]['fields'] : array();
288
-        if(! isset($groupFields[$updatedFieldName])){
288
+        if (!isset($groupFields[$updatedFieldName])) {
289 289
             $this->addFieldToGroup($fieldGroupName, $updatedFieldName, $parameters);
290 290
             return $this;
291 291
         }
292
-        if(! isset($parameters)){
292
+        if (!isset($parameters)) {
293 293
             $groupFields[$updatedFieldName] = array(
294 294
                 'block' => ''
295 295
             );
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
      */
310 310
     public function isVisibleForRecord(AppRecord $record)
311 311
     {
312
-        if(empty($this->visibilityCriteria)){
312
+        if (empty($this->visibilityCriteria)) {
313 313
             return true;
314 314
         }
315 315
         
@@ -318,36 +318,36 @@  discard block
 block discarded – undo
318 318
         
319 319
         $arrCriteria = json_decode($this->visibilityCriteria, true);
320 320
         
321
-        foreach ($arrCriteria as $fieldName => $condition){
322
-            if(strpos($fieldName, '/') !== false){
321
+        foreach ($arrCriteria as $fieldName => $condition) {
322
+            if (strpos($fieldName, '/') !== false) {
323 323
                 list ($oneField, $foreignField) = explode('/', $fieldName);
324 324
                 $field = $recordSet->$oneField()->$foreignField;
325 325
             }
326
-            else{
326
+            else {
327 327
                 $field = $recordSet->$fieldName;
328 328
             }
329
-            foreach ($condition as $op => $value){
330
-                if(! is_array($value)){
329
+            foreach ($condition as $op => $value) {
330
+                if (!is_array($value)) {
331 331
                     $criteria = $field->$op($value);
332 332
                 }
333
-                else{
334
-                    foreach ($value as $foreignClassName => $foreignValues){
335
-                        $foreignClassName = str_replace($App->classPrefix, '', $foreignClassName) . 'Set';
333
+                else {
334
+                    foreach ($value as $foreignClassName => $foreignValues) {
335
+                        $foreignClassName = str_replace($App->classPrefix, '', $foreignClassName).'Set';
336 336
                         $foreignSet = $App->$foreignClassName();
337 337
                         $foreignField = '';
338 338
                         $foreignCondition = '';
339
-                        foreach ($foreignValues as $foreignFieldName => $foreignConditions){
340
-                            if($foreignFieldName === '_foreignField'){
339
+                        foreach ($foreignValues as $foreignFieldName => $foreignConditions) {
340
+                            if ($foreignFieldName === '_foreignField') {
341 341
                                 $foreignField = $foreignConditions;
342 342
                             }
343
-                            else{
344
-                                foreach ($foreignConditions as $key => $val){
343
+                            else {
344
+                                foreach ($foreignConditions as $key => $val) {
345 345
                                     $foreignCondition = $foreignSet->$foreignFieldName->$key($val);
346 346
                                 }
347 347
                             }
348 348
                         }
349 349
                     }
350
-                    if(method_exists($foreignSet, 'getDefaultCriteria')){
350
+                    if (method_exists($foreignSet, 'getDefaultCriteria')) {
351 351
                         $foreignCondition = $foreignCondition->_AND_($foreignSet->getDefaultCriteria());
352 352
                     }
353 353
                     $criteria = $field->in($foreignCondition, $foreignField);
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -123,8 +123,7 @@  discard block
 block discarded – undo
123 123
             
124 124
             if(strpos($rawField, ':') === false){
125 125
                 $fieldName = $rawField;
126
-            }
127
-            else{
126
+            } else{
128 127
                 list ($fieldName, $parameters) = explode(':', $rawField);
129 128
                 $parameters = explode(';', $parameters);
130 129
                 foreach ($parameters as $parameter){
@@ -322,15 +321,13 @@  discard block
 block discarded – undo
322 321
             if(strpos($fieldName, '/') !== false){
323 322
                 list ($oneField, $foreignField) = explode('/', $fieldName);
324 323
                 $field = $recordSet->$oneField()->$foreignField;
325
-            }
326
-            else{
324
+            } else{
327 325
                 $field = $recordSet->$fieldName;
328 326
             }
329 327
             foreach ($condition as $op => $value){
330 328
                 if(! is_array($value)){
331 329
                     $criteria = $field->$op($value);
332
-                }
333
-                else{
330
+                } else{
334 331
                     foreach ($value as $foreignClassName => $foreignValues){
335 332
                         $foreignClassName = str_replace($App->classPrefix, '', $foreignClassName) . 'Set';
336 333
                         $foreignSet = $App->$foreignClassName();
@@ -339,8 +336,7 @@  discard block
 block discarded – undo
339 336
                         foreach ($foreignValues as $foreignFieldName => $foreignConditions){
340 337
                             if($foreignFieldName === '_foreignField'){
341 338
                                 $foreignField = $foreignConditions;
342
-                            }
343
-                            else{
339
+                            } else{
344 340
                                 foreach ($foreignConditions as $key => $val){
345 341
                                     $foreignCondition = $foreignSet->$foreignFieldName->$key($val);
346 342
                                 }
Please login to merge, or discard this patch.
programs/Set/AppSSESet.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     
61 61
     public function selectUserSSE($user = null)
62 62
     {
63
-        if(!isset($user)){
63
+        if (!isset($user)) {
64 64
             $App = $this->App();
65 65
             $user = $App->getCurrentUser();
66 66
         }
@@ -82,29 +82,29 @@  discard block
 block discarded – undo
82 82
         $userSSEReloads = $this->select($this->user->is($user)->_AND_($this->type->is(AppSSE::TYPE_RELOAD_SELECTOR)));
83 83
         $reloadSelectors = array();
84 84
         $now = date('Y-m-d H:i:s');
85
-        foreach ($userSSEReloads as $sseMsg){
85
+        foreach ($userSSEReloads as $sseMsg) {
86 86
             $reloadSelectors[] = $sseMsg->data;
87
-            if($delete && $now > date($sseMsg->deleteOn)){
87
+            if ($delete && $now > date($sseMsg->deleteOn)) {
88 88
                 $sseMsg->delete();
89 89
             }
90 90
         }
91 91
         
92
-        if(!empty($reloadSelectors)){
92
+        if (!empty($reloadSelectors)) {
93 93
             $sseData .= '"reloadSelector":'.bab_json_encode($reloadSelectors);
94 94
             $hasData = true;
95 95
         }
96 96
         
97 97
         $userSSEBrowserNotifications = $this->select($this->user->is($user)->_AND_($this->type->is(AppSSE::TYPE_BROWSER_NOTIFICATION)));
98 98
         $browserNotifications = array();
99
-        foreach ($userSSEBrowserNotifications as $sseMsg){
99
+        foreach ($userSSEBrowserNotifications as $sseMsg) {
100 100
             $browserNotifications[] = $sseMsg->data;
101
-            if($delete){
101
+            if ($delete) {
102 102
                 $sseMsg->delete();
103 103
             }
104 104
         }
105 105
         
106
-        if(!empty($browserNotifications)){
107
-            if($hasData){
106
+        if (!empty($browserNotifications)) {
107
+            if ($hasData) {
108 108
                 $sseData .= ', ';
109 109
             }
110 110
             $sseData .= '"browserNotifications":'.bab_json_encode($browserNotifications);
@@ -125,20 +125,20 @@  discard block
 block discarded – undo
125 125
     {
126 126
         $App = $this->App();
127 127
         $users = array();
128
-        if(!isset($for)){
128
+        if (!isset($for)) {
129 129
             $users[] = $App->getCurrentUser();
130 130
         }
131
-        else if(!is_array($for)){
132
-            if($for === 'all'){
131
+        else if (!is_array($for)) {
132
+            if ($for === 'all') {
133 133
                 $users = $App->getLoggedUsers();
134 134
             }
135
-            else{
135
+            else {
136 136
                 $users[] = $for;
137 137
             }
138 138
         }
139 139
         
140 140
         $deleteOn = self::getDeleteOn();
141
-        foreach ($users as $user){
141
+        foreach ($users as $user) {
142 142
             $record = $this->newRecord();
143 143
             $record->user = $user;
144 144
             $record->data = $reloadSelector;
@@ -164,20 +164,20 @@  discard block
 block discarded – undo
164 164
     {
165 165
         $App = $this->App();
166 166
         $users = array();
167
-        if(!isset($for)){
167
+        if (!isset($for)) {
168 168
             $users[] = $App->getCurrentUser();
169 169
         }
170
-        else if(!is_array($for)){
171
-            if($for === 'all'){
170
+        else if (!is_array($for)) {
171
+            if ($for === 'all') {
172 172
                 $users = $App->getLoggedUsers();
173 173
             }
174
-            else{
174
+            else {
175 175
                 $users[] = $for;
176 176
             }
177 177
         }
178 178
         
179 179
         $deleteOn = self::getDeleteOn();
180
-        foreach ($users as $user){
180
+        foreach ($users as $user) {
181 181
             $record = $this->newRecord();
182 182
             $record->user = $user;
183 183
             $record->data = bab_json_encode($data);
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -127,12 +127,10 @@  discard block
 block discarded – undo
127 127
         $users = array();
128 128
         if(!isset($for)){
129 129
             $users[] = $App->getCurrentUser();
130
-        }
131
-        else if(!is_array($for)){
130
+        } else if(!is_array($for)){
132 131
             if($for === 'all'){
133 132
                 $users = $App->getLoggedUsers();
134
-            }
135
-            else{
133
+            } else{
136 134
                 $users[] = $for;
137 135
             }
138 136
         }
@@ -166,12 +164,10 @@  discard block
 block discarded – undo
166 164
         $users = array();
167 165
         if(!isset($for)){
168 166
             $users[] = $App->getCurrentUser();
169
-        }
170
-        else if(!is_array($for)){
167
+        } else if(!is_array($for)){
171 168
             if($for === 'all'){
172 169
                 $users = $App->getLoggedUsers();
173
-            }
174
-            else{
170
+            } else{
175 171
                 $users[] = $for;
176 172
             }
177 173
         }
Please login to merge, or discard this patch.
programs/Set/AppRecord.php 2 patches
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     {
56 56
         $value = $this->oParentSet->getBackend()->getRecordValue($this, $sFieldName);
57 57
         $field = $this->oParentSet->$sFieldName;
58
-        if(! is_null($value) && $field instanceof \ORM_FkField){
58
+        if (!is_null($value) && $field instanceof \ORM_FkField) {
59 59
             
60 60
             $sClassName = $field->getForeignSetName();
61 61
             
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      */
91 91
     public function App()
92 92
     {
93
-        if(! isset($this->app)){
93
+        if (!isset($this->app)) {
94 94
             // If the app object was not specified (through the setApp() method),
95 95
             // we set it as parent set's App.
96 96
             $this->setApp($this->getParentSet()
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
         $App = $this->App();
112 112
         $rClass = new \ReflectionClass(get_class($this));
113 113
         $component = $App->getComponentByName($rClass->getShortName());
114
-        if(isset($component)){
114
+        if (isset($component)) {
115 115
             return $component->getRecordClassName();
116 116
             // list(, $classname) = explode('_', $component->getRecordClassName());
117 117
             // return $classname;
@@ -127,11 +127,11 @@  discard block
 block discarded – undo
127 127
      */
128 128
     public function getRef()
129 129
     {
130
-        if(! isset($this->id)){
130
+        if (!isset($this->id)) {
131 131
             throw new AppException('Trying to get the reference string of a record without an id.');
132 132
         }
133 133
         $classname = $this->getClassName();
134
-        return $classname . ':' . $this->id;
134
+        return $classname.':'.$this->id;
135 135
     }
136 136
     
137 137
     /**
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
     {
159 159
         $App = $this->App();
160 160
         
161
-        if(! isset($deletedStatus)){
161
+        if (!isset($deletedStatus)) {
162 162
             $deletedStatus = AppTraceableRecord::DELETED_STATUS_DELETED;
163 163
         }
164 164
         
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
         // referenced elements.
171 171
         $manyRelations = $set->getHasManyRelations();
172 172
         
173
-        foreach ($manyRelations as $manyRelation){
173
+        foreach ($manyRelations as $manyRelation) {
174 174
             /* @var $manyRelation \ORM_ManyRelation */
175 175
             
176 176
             $foreignSetClassName = $manyRelation->getForeignSetClassName();
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
                     
185 185
                     $foreignRecords = $foreignSet->select($foreignSet->$foreignSetFieldName->is($recordId));
186 186
                     
187
-                    foreach ($foreignRecords as $foreignRecord){
187
+                    foreach ($foreignRecords as $foreignRecord) {
188 188
                         $foreignRecord->$foreignSetFieldName = 0;
189 189
                         $foreignRecord->save();
190 190
                     }
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
                     
196 196
                     $foreignRecords = $foreignSet->select($foreignSet->$foreignSetFieldName->is($recordId));
197 197
                     
198
-                    foreach ($foreignRecords as $foreignRecord){
198
+                    foreach ($foreignRecords as $foreignRecord) {
199 199
                         $foreignRecord->delete();
200 200
                     }
201 201
                     
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
         // referenced elements.
242 242
         $manyRelations = $set->getHasManyRelations();
243 243
         
244
-        foreach ($manyRelations as $manyRelation){
244
+        foreach ($manyRelations as $manyRelation) {
245 245
             /* @var $manyRelation \ORM_ManyRelation */
246 246
             
247 247
             $foreignSetClassName = $manyRelation->getForeignSetClassName();
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
             // $foreignSet = new $foreignSetClassName($App);
252 252
             $foreignRecords = $foreignSet->select($foreignSet->$foreignSetFieldName->is($recordId));
253 253
             
254
-            foreach ($foreignRecords as $foreignRecord){
254
+            foreach ($foreignRecords as $foreignRecord) {
255 255
                 $foreignRecord->$foreignSetFieldName = $id;
256 256
                 $foreignRecord->save();
257 257
             }
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
         $links = $linkSet->select($linkSet->sourceClass->is($recordClassName)
265 265
             ->_AND_($linkSet->sourceId->is($recordId)));
266 266
         
267
-        foreach ($links as $link){
267
+        foreach ($links as $link) {
268 268
             $link->sourceId = $id;
269 269
             $link->save();
270 270
         }
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
         $links = $linkSet->select($linkSet->targetClass->is($recordClassName)
273 273
             ->_AND_($linkSet->targetId->is($recordId)));
274 274
         
275
-        foreach ($links as $link){
275
+        foreach ($links as $link) {
276 276
             $link->targetId = $id;
277 277
             $link->save();
278 278
         }
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
         
298 298
         $relatedRecords = array();
299 299
         
300
-        foreach ($manyRelations as $manyRelation){
300
+        foreach ($manyRelations as $manyRelation) {
301 301
             /* @var $manyRelation \ORM_ManyRelation */
302 302
             
303 303
             $foreignSetClassName = $manyRelation->getForeignSetClassName();
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
             // $foreignSet = new $foreignSetClassName($App);
309 309
             $foreignRecords = $foreignSet->select($foreignSet->$foreignSetFieldName->is($recordId));
310 310
             
311
-            if($foreignRecords->count() > 0){
311
+            if ($foreignRecords->count() > 0) {
312 312
                 $relatedRecords[$foreignSetClassName] = $foreignRecords;
313 313
             }
314 314
         }
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
     {
326 326
         $path = $this->App()->uploadPath();
327 327
         
328
-        if(null === $path){
328
+        if (null === $path) {
329 329
             throw new \Exception('Missing upload path information');
330 330
             return null;
331 331
         }
@@ -348,11 +348,11 @@  discard block
 block discarded – undo
348 348
             ->_AND_($linkSet->sourceId->is($source->id))
349 349
             ->_AND_($linkSet->targetClass->is($this->getClassName()))
350 350
             ->_AND_($linkSet->targetId->is($this->id));
351
-        if(isset($linkType)){
352
-            if(is_array($linkType)){
351
+        if (isset($linkType)) {
352
+            if (is_array($linkType)) {
353 353
                 $criteria = $criteria->_AND_($linkSet->type->in($linkType));
354 354
             }
355
-            else{
355
+            else {
356 356
                 $criteria = $criteria->_AND_($linkSet->type->is($linkType));
357 357
             }
358 358
         }
@@ -376,11 +376,11 @@  discard block
 block discarded – undo
376 376
         
377 377
         $criteria = $linkSet->all($linkSet->targetClass->is($target->getClassName()), $linkSet->targetId->is($target->id), $linkSet->sourceClass->is($this->getClassName()), $linkSet->sourceId->is($this->id));
378 378
         
379
-        if(isset($linkType)){
380
-            if(is_array($linkType)){
379
+        if (isset($linkType)) {
380
+            if (is_array($linkType)) {
381 381
                 $criteria = $criteria->_AND_($linkSet->type->in($linkType));
382 382
             }
383
-            else{
383
+            else {
384 384
                 $criteria = $criteria->_AND_($linkSet->type->is($linkType));
385 385
             }
386 386
         }
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
      */
443 443
     protected function importProperty($name, $value)
444 444
     {
445
-        if(((string) $this->$name) !== ((string) $value)){
445
+        if (((string) $this->$name) !== ((string) $value)) {
446 446
             $this->$name = $value;
447 447
             return 1;
448 448
         }
@@ -462,13 +462,13 @@  discard block
 block discarded – undo
462 462
      */
463 463
     protected function importDate($name, $value)
464 464
     {
465
-        if(preg_match('/[0-9]{4}-[0-9]{2}-[0-9]{2}/', $value)){
465
+        if (preg_match('/[0-9]{4}-[0-9]{2}-[0-9]{2}/', $value)) {
466 466
             return $this->importProperty($name, $value);
467 467
         }
468 468
         
469 469
         // try in DD/MM/YYYY format
470 470
         
471
-        if(preg_match('/(?P<day>[0-9]+)\/(?P<month>[0-9]+)\/(?P<year>[0-9]{2,4})/', $value, $matches)){
471
+        if (preg_match('/(?P<day>[0-9]+)\/(?P<month>[0-9]+)\/(?P<year>[0-9]{2,4})/', $value, $matches)) {
472 472
             
473 473
             $value = sprintf('%04d-%02d-%02d', (int) $matches['year'], (int) $matches['month'], (int) $matches['day']);
474 474
             
@@ -488,11 +488,11 @@  discard block
 block discarded – undo
488 488
         $customContainers->groupBy($customContainerSet->view);
489 489
         
490 490
         $views = array();
491
-        foreach ($customContainers as $customContainer){
491
+        foreach ($customContainers as $customContainer) {
492 492
             $views[] = $customContainer->view;
493 493
         }
494 494
         
495
-        if(empty($views)){
495
+        if (empty($views)) {
496 496
             $views[] = '';
497 497
         }
498 498
         
@@ -576,9 +576,9 @@  discard block
 block discarded – undo
576 576
      */
577 577
     public function requireReadable($message = null)
578 578
     {
579
-        if(! $this->isReadable()){
579
+        if (!$this->isReadable()) {
580 580
             $App = $this->App();
581
-            if(! isset($message)){
581
+            if (!isset($message)) {
582 582
                 $message = $App->translate('Access denied');
583 583
             }
584 584
             throw new AppAccessException($message);
@@ -594,9 +594,9 @@  discard block
 block discarded – undo
594 594
      */
595 595
     public function requireUpdatable($message = null)
596 596
     {
597
-        if(! $this->isUpdatable()){
597
+        if (!$this->isUpdatable()) {
598 598
             $App = $this->App();
599
-            if(! isset($message)){
599
+            if (!isset($message)) {
600 600
                 $message = $App->translate('Access denied');
601 601
             }
602 602
             throw new AppAccessException($message);
@@ -612,9 +612,9 @@  discard block
 block discarded – undo
612 612
      */
613 613
     public function requireDeletable($message = null)
614 614
     {
615
-        if(! $this->isDeletable()){
615
+        if (!$this->isDeletable()) {
616 616
             $App = $this->App();
617
-            if(! isset($message)){
617
+            if (!isset($message)) {
618 618
                 $message = $App->translate('Access denied');
619 619
             }
620 620
             throw new AppAccessException($message);
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -351,8 +351,7 @@  discard block
 block discarded – undo
351 351
         if(isset($linkType)){
352 352
             if(is_array($linkType)){
353 353
                 $criteria = $criteria->_AND_($linkSet->type->in($linkType));
354
-            }
355
-            else{
354
+            } else{
356 355
                 $criteria = $criteria->_AND_($linkSet->type->is($linkType));
357 356
             }
358 357
         }
@@ -379,8 +378,7 @@  discard block
 block discarded – undo
379 378
         if(isset($linkType)){
380 379
             if(is_array($linkType)){
381 380
                 $criteria = $criteria->_AND_($linkSet->type->in($linkType));
382
-            }
383
-            else{
381
+            } else{
384 382
                 $criteria = $criteria->_AND_($linkSet->type->is($linkType));
385 383
             }
386 384
         }
Please login to merge, or discard this patch.
programs/Set/AppLink.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     public function getSource()
46 46
     {
47 47
         $App = $this->App();
48
-        return $App->getRecordByRef($this->sourceClass . ':' . $this->sourceId);
48
+        return $App->getRecordByRef($this->sourceClass.':'.$this->sourceId);
49 49
     }
50 50
     
51 51
     /**
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     public function getTarget()
55 55
     {
56 56
         $App = $this->App();
57
-        return $App->getRecordByRef($this->targetClass . ':' . $this->targetId);
57
+        return $App->getRecordByRef($this->targetClass.':'.$this->targetId);
58 58
     }
59 59
 }
60 60
 
Please login to merge, or discard this patch.