Passed
Push — main ( cdfe2b...915a08 )
by Sammy
01:35
created
StorageManager/PictureManager.class.php 1 patch
Braces   +62 added lines, -43 removed lines patch added patch discarded remove patch
@@ -29,8 +29,9 @@  discard block
 block discarded – undo
29 29
   {
30 30
     $picture_directory = $this->build_path_to_directory();
31 31
     $thumbnail_directory = $picture_directory;
32
-		if(!file_exists($picture_directory) && mkdir($picture_directory) === false)
33
-			throw new PictureManagerException("directory '$picture_directory' does not exist");
32
+		if(!file_exists($picture_directory) && mkdir($picture_directory) === false) {
33
+					throw new PictureManagerException("directory '$picture_directory' does not exist");
34
+		}
34 35
 
35 36
     $filenames = self::preg_scandir($picture_directory, self::FILENAME_REGEX);
36 37
 
@@ -42,8 +43,9 @@  discard block
 block discarded – undo
42 43
   {
43 44
     $filenames = $this->filenames($replace_by_thumbs_if_exists);
44 45
     $filepathes = [];
45
-    foreach($filenames as $filename)
46
-      $filepathes[] = $this->locate_thumbnail($filename);
46
+    foreach($filenames as $filename) {
47
+          $filepathes[] = $this->locate_thumbnail($filename);
48
+    }
47 49
 
48 50
     return $filepathes;
49 51
   }
@@ -52,8 +54,10 @@  discard block
 block discarded – undo
52 54
   {
53 55
     $filenames = $this->filenames($replace_by_thumbs_if_exists);
54 56
     $uris = [];
55
-    foreach($filenames as $filename)
56
-      $uris[] = hopper::file_uri($this->locate_file($filename)); ;
57
+    foreach($filenames as $filename) {
58
+          $uris[] = hopper::file_uri($this->locate_file($filename));
59
+    }
60
+    ;
57 61
 
58 62
     return $uris;
59 63
   }
@@ -67,31 +71,37 @@  discard block
 block discarded – undo
67 71
       'image/gif' => 'imagecreatefromgif',
68 72
     );
69 73
     $mime = mime_content_type($filepath);
70
-    if(array_key_exists($mime, $picture_mime_to_gd_create_function))
71
-      return true;
74
+    if(array_key_exists($mime, $picture_mime_to_gd_create_function)) {
75
+          return true;
76
+    }
72 77
     return $mime;
73 78
   }
74 79
 
75 80
 
76 81
   public function upload()
77 82
   {
78
-    if(!array_key_exists($this->get_type(), $_FILES))
79
-      throw new PictureManagerException($this->get_type()." not found in _FILES");
83
+    if(!array_key_exists($this->get_type(), $_FILES)) {
84
+          throw new PictureManagerException($this->get_type()." not found in _FILES");
85
+    }
80 86
 
81
-    if(!array_key_exists('size', $_FILES[$this->get_type()]) || $_FILES[$this->get_type()]['size'] == 0)
82
-      throw new PictureManagerException('uploaded file has no size');
87
+    if(!array_key_exists('size', $_FILES[$this->get_type()]) || $_FILES[$this->get_type()]['size'] == 0) {
88
+          throw new PictureManagerException('uploaded file has no size');
89
+    }
83 90
 
84
-    if(($file_type = self::is_picture_file($_FILES[$this->get_type()]['tmp_name'])) !== true)
85
-      throw new PictureManagerException('data sent is not an image but a '.$file_type.'');
91
+    if(($file_type = self::is_picture_file($_FILES[$this->get_type()]['tmp_name'])) !== true) {
92
+          throw new PictureManagerException('data sent is not an image but a '.$file_type.'');
93
+    }
86 94
 
87 95
     $filepath = $this->build_filename() . '.' . self::file_ext($_FILES[$this->get_type()]['name']);
88 96
     $filepath = $this->locate_file($filepath);
89 97
 
90
-		if(file_exists($filepath))
91
-      throw new PictureManagerException($this->get_type()." new path '$filepath' already exists");
98
+		if(file_exists($filepath)) {
99
+		      throw new PictureManagerException($this->get_type()." new path '$filepath' already exists");
100
+		}
92 101
 
93
-		if(copy($_FILES[$this->get_type()]['tmp_name'], $filepath) === false)
94
-			throw new PictureManagerException(" cant copy ".$_FILES[$this->get_type()]['name']." to ($filepath)");
102
+		if(copy($_FILES[$this->get_type()]['tmp_name'], $filepath) === false) {
103
+					throw new PictureManagerException(" cant copy ".$_FILES[$this->get_type()]['name']." to ($filepath)");
104
+		}
95 105
 
96 106
     $this->make_thumbnail($filepath);
97 107
   }
@@ -154,19 +164,23 @@  discard block
 block discarded – undo
154 164
   {
155 165
     $filenames = $this->filenames();
156 166
 
157
-    foreach($filenames as $filename)
158
-				$this->remove($filename);
167
+    foreach($filenames as $filename) {
168
+    				$this->remove($filename);
169
+    }
159 170
 
160 171
     $directory = $this->build_path_to_directory();
161 172
 		if(file_exists($directory) === true)
162 173
     {
163
-      if(is_dir($directory) === false)
164
-        throw new PictureManagerException($this->get_type()."' directory '$directory' is not a directory");
174
+      if(is_dir($directory) === false) {
175
+              throw new PictureManagerException($this->get_type()."' directory '$directory' is not a directory");
176
+      }
165 177
 
166
-   		if(rmdir($directory) === false)
167
-  			throw new PictureManagerException("rmdir($directory) failed like a bitch");
178
+   		if(rmdir($directory) === false) {
179
+   		  			throw new PictureManagerException("rmdir($directory) failed like a bitch");
180
+   		}
181
+    } else {
182
+      trigger_error($this->get_type()." $directory doesn't exist", E_USER_WARNING);
168 183
     }
169
-    else trigger_error($this->get_type()." $directory doesn't exist", E_USER_WARNING);
170 184
   }
171 185
 
172 186
   public function remove($picture_filename)
@@ -181,14 +195,15 @@  discard block
 block discarded – undo
181 195
     foreach($pathes as $what => $path)
182 196
     {
183 197
       $error = null;
184
-  		if(!file_exists($path))
185
-        $error = 'file does not exist';
186
-      elseif(unlink($path)===false)
187
-        $error = 'unlink() failed';
188
-
189
-      if(is_null($error))
190
-        $deleted[]= $what;
191
-      else
198
+  		if(!file_exists($path)) {
199
+  		        $error = 'file does not exist';
200
+  		} elseif(unlink($path)===false) {
201
+              $error = 'unlink() failed';
202
+      }
203
+
204
+      if(is_null($error)) {
205
+              $deleted[]= $what;
206
+      } else
192 207
       {
193 208
         trigger_error(__FUNCTION__." '$picture_filename' ($what @ $path) impossible because ", E_USER_NOTICE);
194 209
         $still_walking[]=$what;
@@ -238,13 +253,15 @@  discard block
 block discarded – undo
238 253
 		$pictures = $pi_manager->filenames();
239 254
 
240 255
     $item_model_type = get_class($item)::model_type();
241
-    if(count($pictures)===0)
242
-      return hopper::file_uri($settings[$item_model_type][$picture_type]['generic_picture']);
256
+    if(count($pictures)===0) {
257
+          return hopper::file_uri($settings[$item_model_type][$picture_type]['generic_picture']);
258
+    }
243 259
 
244
-		if($settings[$item_model_type][$picture_type]['cycle_on_load'])
245
-			$filename = $pictures[array_rand($pictures, 1)];
246
-		else
247
-			$filename = array_shift($pictures);
260
+		if($settings[$item_model_type][$picture_type]['cycle_on_load']) {
261
+					$filename = $pictures[array_rand($pictures, 1)];
262
+		} else {
263
+					$filename = array_shift($pictures);
264
+		}
248 265
 
249 266
     return hopper::file_uri( $thumbnail===true ? $pi_manager->locate_thumbnail($filename) : $pi_manager->locate_file($filename));
250 267
   }
@@ -255,8 +272,9 @@  discard block
 block discarded – undo
255 272
     if(count($filenames = $this->filenames()) > 0)
256 273
     {
257 274
       $last_filename = array_pop($filenames); // last cover name FIXME sort should be done here, check cost if sort already done
258
-      if(preg_match('/[0-9]+\_([0-9]+)\.[a-z]+/', $last_filename, $last_index) !== 1)
259
-        throw new PictureManagerException("FAILED_COMPUTING_NEW_INDEX_USING_REGEX");
275
+      if(preg_match('/[0-9]+\_([0-9]+)\.[a-z]+/', $last_filename, $last_index) !== 1) {
276
+              throw new PictureManagerException("FAILED_COMPUTING_NEW_INDEX_USING_REGEX");
277
+      }
260 278
 
261 279
       $last_index = $last_index[1];
262 280
     }
@@ -271,8 +289,9 @@  discard block
 block discarded – undo
271 289
 
272 290
   public function build_filename($index=null)
273 291
   {
274
-    if(is_null($index))
275
-      $index = $this->last_index()+1;
292
+    if(is_null($index)) {
293
+          $index = $this->last_index()+1;
294
+    }
276 295
 
277 296
     return $this->pmi->id.'_'.sprintf("%'.09d", $index); // prepend bean id
278 297
   }
Please login to merge, or discard this patch.
StateAgent.class.php 1 patch
Braces   +14 added lines, -10 removed lines patch added patch discarded remove patch
@@ -34,27 +34,31 @@
 block discarded – undo
34 34
 
35 35
   public function filters($filter_name=null, $value=null)
36 36
   {
37
-    if(is_null($filter_name))
38
-      return $_SESSION[$this->index_filter];
37
+    if(is_null($filter_name)) {
38
+          return $_SESSION[$this->index_filter];
39
+    }
39 40
 
40
-    if(!is_null($value))
41
-      $_SESSION[$this->index_filter][$filter_name] = $value;
41
+    if(!is_null($value)) {
42
+          $_SESSION[$this->index_filter][$filter_name] = $value;
43
+    }
42 44
 
43 45
     return $_SESSION[$this->index_filter][$filter_name] ?? null;
44 46
   }
45 47
 
46 48
   public function reset_filters($filter_name=null)
47 49
   {
48
-    if(is_null($filter_name))
49
-      $_SESSION[$this->index_filter]=[];
50
-    else
51
-      unset($_SESSION[$this->index_filter][$filter_name]);
50
+    if(is_null($filter_name)) {
51
+          $_SESSION[$this->index_filter]=[];
52
+    } else {
53
+          unset($_SESSION[$this->index_filter][$filter_name]);
54
+    }
52 55
   }
53 56
 
54 57
   public function operator_id($setter = null)
55 58
   {
56
-    if(!is_null($setter))
57
-      $_SESSION[$this->index_operator] = ['id' => $setter, 'set_on' => time()];
59
+    if(!is_null($setter)) {
60
+          $_SESSION[$this->index_operator] = ['id' => $setter, 'set_on' => time()];
61
+    }
58 62
 
59 63
     return $_SESSION[$this->index_operator]['id'] ?? null;
60 64
   }
Please login to merge, or discard this patch.
Auth/ACL.class.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -37,8 +37,9 @@  discard block
 block discarded – undo
37 37
     $res = self::any(['operator_id'=>$op->get_id()]);
38 38
 
39 39
     $permission_ids = [];
40
-    foreach($res as $r)
41
-      $permission_ids[]=$r->get('permission_id');
40
+    foreach($res as $r) {
41
+          $permission_ids[]=$r->get('permission_id');
42
+    }
42 43
 
43 44
     $ret = Permission::filter(['ids'=>$permission_ids]);
44 45
     return $ret;
@@ -47,8 +48,9 @@  discard block
 block discarded – undo
47 48
   {
48 49
     $operator_with_perms = get_class($op)::exists($op->operator_id());
49 50
     // $operator_with_perms = get_class($op)::retrieve($operator_with_perms);
50
-    if(is_null($operator_with_perms))
51
-      return [];
51
+    if(is_null($operator_with_perms)) {
52
+          return [];
53
+    }
52 54
 
53 55
     return explode(',',$operator_with_perms->get('permission_names'));
54 56
   }
Please login to merge, or discard this patch.
Auth/Permissionability.class.php 1 patch
Braces   +21 added lines, -27 removed lines patch added patch discarded remove patch
@@ -11,18 +11,16 @@  discard block
 block discarded – undo
11 11
     if(property_exists($this, 'permission_names'))
12 12
     {
13 13
       return explode(',', $this->permission_names);
14
-    }
15
-    elseif(property_exists($this, 'permission_ids'))
14
+    } elseif(property_exists($this, 'permission_ids'))
16 15
     {
17 16
       $ids = explode(',', $this->permission_ids);
18 17
       $ret = [];
19 18
       $permissions = Permission::get_many_by_AIPK($ids);
20
-      foreach($permissions as $id => $p)
21
-        $ret[]="$p";
19
+      foreach($permissions as $id => $p) {
20
+              $ret[]="$p";
21
+      }
22 22
       return $ret;
23
-    }
24
-    
25
-    else 
23
+    } else 
26 24
     {
27 25
       return ACL::permissions_names_for($this);
28 26
     }
@@ -31,21 +29,20 @@  discard block
 block discarded – undo
31 29
   public function permissions()
32 30
   {
33 31
     
34
-    if(!is_null($this->permissions))
35
-      return $this->permissions;
32
+    if(!is_null($this->permissions)) {
33
+          return $this->permissions;
34
+    }
36 35
     $permission_unique_keys = null;
37 36
     if(property_exists($this, 'permission_names'))
38 37
     {
39 38
       $permission_unique_keys = explode(',', $this->permission_names);
40 39
       // vd(Permission::table()->select());
41 40
       $this->permissions = Permission::retrieve(Permission::table()->select()->aw_string_in('name', $permission_unique_keys));
42
-    }
43
-    elseif(property_exists($this, 'permission_ids'))
41
+    } elseif(property_exists($this, 'permission_ids'))
44 42
     {
45 43
       $permission_unique_keys = explode(',', $this->permission_ids);
46 44
       $this->permissions = Permission::retrieve(Permission::table()->select()->aw_numeric_in('id', $permission_unique_keys));
47
-    }
48
-    else
45
+    } else
49 46
     {
50 47
       $this->permissions = ACL::permissions_for($this);
51 48
     }
@@ -56,40 +53,37 @@  discard block
 block discarded – undo
56 53
   public function has_permission($p) : bool
57 54
   {
58 55
     // new instances or inactive operators, none shall pass
59
-    if($this->is_new() === true || $this->is_active()  === false)
60
-      return false;
56
+    if($this->is_new() === true || $this->is_active()  === false) {
57
+          return false;
58
+    }
61 59
     
62 60
     $permission_name = $permission_id = null;
63 61
     if(is_subclass_of($p, '\HexMakina\kadro\Auth\Permission'))
64 62
     {
65 63
       $permission_name = $p->get('name');
66 64
       $permission_id = $p->get_id();
65
+    } elseif(preg_match('/[0-9]+/', $p)) {
66
+          $permission_id = $p;
67
+    } else {
68
+          $permission_name = $p;
67 69
     }
68
-    elseif(preg_match('/[0-9]+/', $p))
69
-      $permission_id = $p;
70
-    else
71
-      $permission_name = $p;
72 70
 
73 71
 
74 72
     if(!is_null($this->get('permission_names')) && !is_null($permission_name))
75 73
     {
76 74
       return strpos($this->get('permission_names'), $permission_name) !== false;
77
-    }
78
-    elseif(!is_null($this->get('permission_ids')) && !is_null($permission_id))
75
+    } elseif(!is_null($this->get('permission_ids')) && !is_null($permission_id))
79 76
     {
80 77
       return strpos($this->get('permission_ids'), $permission_id) !== false;
81
-    }
82
-    elseif(!is_null($permission_name))
78
+    } elseif(!is_null($permission_name))
83 79
     {
84 80
       if(method_exists($this, $permission_name) && $this->$permission_name() == true)
85 81
       {
86 82
         return true;
87
-      }
88
-      elseif(property_exists($this, $permission_name) && $this->$permission_name == true)
83
+      } elseif(property_exists($this, $permission_name) && $this->$permission_name == true)
89 84
       {
90 85
         return true;
91
-      }
92
-      elseif(ACL::match($this, $permission_name) === true)
86
+      } elseif(ACL::match($this, $permission_name) === true)
93 87
       {
94 88
         return true;
95 89
       }
Please login to merge, or discard this patch.
Auth/Operatorability.class.php 1 patch
Braces   +15 added lines, -9 removed lines patch added patch discarded remove patch
@@ -17,8 +17,10 @@  discard block
 block discarded – undo
17 17
 
18 18
   public function load_operator($id = null)
19 19
   {
20
-    if(!is_null($operator_id = $id ?? $this->get('operator_id'))) // extraction failed but we have an fk
20
+    if(!is_null($operator_id = $id ?? $this->get('operator_id'))) {
21
+      // extraction failed but we have an fk
21 22
       $this->operator = Operator::exists($operator_id);
23
+    }
22 24
   }
23 25
 
24 26
   public function operator() : ?OperatorInterface
@@ -28,9 +30,10 @@  discard block
 block discarded – undo
28 30
       $extract_attempt = $this->extract(new Operator(), true);
29 31
       if(!is_null($extract_attempt))
30 32
       {
31
-        foreach(['permission_names', 'permission_ids'] as $permission_marker)
32
-          if(property_exists($this, $permission_marker))
33
+        foreach(['permission_names', 'permission_ids'] as $permission_marker) {
34
+                  if(property_exists($this, $permission_marker))
33 35
             $extract_attempt->set($permission_marker, $this->$permission_marker);
36
+        }
34 37
 
35 38
         $this->operator = $extract_attempt;
36 39
       }
@@ -55,14 +58,17 @@  discard block
 block discarded – undo
55 58
 
56 59
     $Query->select_also(['operator.name as operator_name', 'operator.active as operator_active']);
57 60
 
58
-    if(isset($filters['username']))
59
-      $Query->aw_eq('username', $filters['username'], 'operator');
61
+    if(isset($filters['username'])) {
62
+          $Query->aw_eq('username', $filters['username'], 'operator');
63
+    }
60 64
 
61
-    if(isset($filters['email']))
62
-      $Query->aw_eq('email', $filters['email'], 'operator');
65
+    if(isset($filters['email'])) {
66
+          $Query->aw_eq('email', $filters['email'], 'operator');
67
+    }
63 68
 
64
-    if(isset($filters['active']))
65
-      $Query->aw_eq('active', $filters['active'], 'operator');
69
+    if(isset($filters['active'])) {
70
+          $Query->aw_eq('active', $filters['active'], 'operator');
71
+    }
66 72
 
67 73
     return $Query;
68 74
   }
Please login to merge, or discard this patch.
common.inc.php 1 patch
Braces   +19 added lines, -16 removed lines patch added patch discarded remove patch
@@ -91,8 +91,9 @@  discard block
 block discarded – undo
91 91
 	//---------------------------------------------------------------     ŝablonoj
92 92
 	require_once 'smarty/smarty/libs/Smarty.class.php';
93 93
 	// Load smarty template parser
94
-	if(is_null($box->get('settings.smarty.template_path')) || is_null($box->get('settings.smarty.compiled_path')))
95
-			throw new \Exception("SMARTY CONFIG ERROR: missing parameters");
94
+	if(is_null($box->get('settings.smarty.template_path')) || is_null($box->get('settings.smarty.compiled_path'))) {
95
+				throw new \Exception("SMARTY CONFIG ERROR: missing parameters");
96
+	}
96 97
 
97 98
 	$smarty=new \Smarty();
98 99
 	$box->register('template_engine', $smarty);
@@ -126,25 +127,27 @@  discard block
 block discarded – undo
126 127
 		if(isset($languages[$_GET['lang']]))
127 128
 		{
128 129
 			$language=$_GET['lang'];
129
-			if($cookies_enabled === true)
130
-				setcookie('lang', $language, time()+(365 * 24 * 60 * 60), "/", "");
131
-			else
132
-				trigger_error('KADRO_SYSTEM_ERR_COOKIES_ARE_DISABLED_LANGUAGE_CANNOT_BE_STORED', E_USER_WARNING);
130
+			if($cookies_enabled === true) {
131
+							setcookie('lang', $language, time()+(365 * 24 * 60 * 60), "/", "");
132
+			} else {
133
+							trigger_error('KADRO_SYSTEM_ERR_COOKIES_ARE_DISABLED_LANGUAGE_CANNOT_BE_STORED', E_USER_WARNING);
134
+			}
135
+		} else {
136
+					throw new \Exception('KADRO_SYSTEM_ERR_INVALID_PARAMETER');
133 137
 		}
134
-		else
135
-			throw new \Exception('KADRO_SYSTEM_ERR_INVALID_PARAMETER');
138
+	} else if($cookies_enabled === true && array_key_exists('lang', $_COOKIE) && array_key_exists($_COOKIE['lang'], $languages)) {
139
+			$language=$_COOKIE['lang'];
136 140
 	}
137
-	else if($cookies_enabled === true && array_key_exists('lang', $_COOKIE) && array_key_exists($_COOKIE['lang'], $languages))
138
-		$language=$_COOKIE['lang'];
139 141
 
140 142
 	if(is_null($language) && !empty($languages))
141 143
 	{
142
-		if(count($languages) === 1)
143
-			$language=key($languages);
144
-		elseif(array_key_exists($box->get('settings.default.language'), $languages))
145
-			$language=$box->get('settings.default.language');
146
-		else
147
-			throw new \Exception('FALLBACK_TO_DEFAULT_LANGUAGE_FAILED');
144
+		if(count($languages) === 1) {
145
+					$language=key($languages);
146
+		} elseif(array_key_exists($box->get('settings.default.language'), $languages)) {
147
+					$language=$box->get('settings.default.language');
148
+		} else {
149
+					throw new \Exception('FALLBACK_TO_DEFAULT_LANGUAGE_FAILED');
150
+		}
148 151
 		$i18n = new \HexMakina\Lezer\Lezer(APP_BASE.'locale/'.$language.'/user_interface.json', APP_BASE.'locale/cache/', $language);
149 152
 		$i18n->init();
150 153
 		$smarty->assign('language', $language);
Please login to merge, or discard this patch.
Router/AltoRouter.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -193,7 +193,9 @@  discard block
 block discarded – undo
193 193
 			$method_match = (stripos($methods, $requestMethod) !== false);
194 194
 
195 195
 			// Method did not match, continue to next route.
196
-			if (!$method_match) continue;
196
+			if (!$method_match) {
197
+			  continue;
198
+			}
197 199
 
198 200
 			if ($route === '*') {
199 201
 				// * wildcard (matches all)
@@ -218,7 +220,9 @@  discard block
 block discarded – undo
218 220
 
219 221
 				if ($params) {
220 222
 					foreach($params as $key => $value) {
221
-						if(is_numeric($key)) unset($params[$key]);
223
+						if(is_numeric($key)) {
224
+						  unset($params[$key]);
225
+						}
222 226
 					}
223 227
 				}
224 228
 
Please login to merge, or discard this patch.
Controllers/OperatorController.class.php 1 patch
Braces   +14 added lines, -12 removed lines patch added patch discarded remove patch
@@ -23,8 +23,9 @@  discard block
 block discarded – undo
23 23
     parent::edit();
24 24
 
25 25
     // do we create? or do we edit someone else ? must be admin
26
-    if(is_null($this->load_model) || $this->operator()->operator_id() !== $this->load_model->operator_id())
27
-      $this->authorize('group_admin');
26
+    if(is_null($this->load_model) || $this->operator()->operator_id() !== $this->load_model->operator_id()) {
27
+          $this->authorize('group_admin');
28
+    }
28 29
 
29 30
   }
30 31
 
@@ -35,8 +36,9 @@  discard block
 block discarded – undo
35 36
 
36 37
   public function save()
37 38
   {
38
-    if($this->operator()->operator_id() !== $this->form_model->operator_id())
39
-      $this->authorize('group_admin');
39
+    if($this->operator()->operator_id() !== $this->form_model->operator_id()) {
40
+          $this->authorize('group_admin');
41
+    }
40 42
 
41 43
     parent::save();
42 44
   }
@@ -71,15 +73,15 @@  discard block
 block discarded – undo
71 73
     parent::authorize('group_admin');
72 74
 
73 75
     $operator = Operator::one($this->router()->params());
74
-    if($operator->username() == $this->operator()->username())
75
-      throw new AccessRefusedException();
76
+    if($operator->username() == $this->operator()->username()) {
77
+          throw new AccessRefusedException();
78
+    }
76 79
 
77 80
     if(Operator::toggle_boolean(Operator::table_name(), 'active', $operator->operator_id()) === true)
78 81
     {
79 82
       $confirmation_message = $operator->is_active() ? 'KADRO_operator_DISABLED' : 'KADRO_operator_ENABLED';
80 83
       $this->logger()->nice($confirmation_message, [$operator->get('name')]);
81
-    }
82
-    else
84
+    } else
83 85
     {
84 86
       $this->logger()->warning('CRUDITES_ERR_QUERY_FAILED');
85 87
     }
@@ -92,8 +94,9 @@  discard block
 block discarded – undo
92 94
     parent::authorize('group_admin');
93 95
 
94 96
     $operator = Operator::one(['username' => $this->router()->params('username')]);
95
-    if($operator->username() == $this->operator()->username())
96
-      throw new AccessRefusedException();
97
+    if($operator->username() == $this->operator()->username()) {
98
+          throw new AccessRefusedException();
99
+    }
97 100
 
98 101
     $permission_id = $this->router()->params('permission_id');
99 102
 
@@ -103,8 +106,7 @@  discard block
 block discarded – undo
103 106
     {
104 107
       $row = ACL::table()->produce($row_data);
105 108
       $res = $row->persist();
106
-    }
107
-    else
109
+    } else
108 110
     {
109 111
       $row->wipe();
110 112
     }
Please login to merge, or discard this patch.
Controllers/TradukoController.class.php 1 patch
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -34,10 +34,12 @@  discard block
 block discarded – undo
34 34
     $assoc = [];
35 35
     foreach($res as $id => $trad)
36 36
     {
37
-      if(!isset($assoc[$trad->kategorio]))
38
-        $assoc[$trad->kategorio] = [];
39
-      if(!isset($assoc[$trad->kategorio][$trad->sekcio]))
40
-        $assoc[$trad->kategorio][$trad->sekcio] = [];
37
+      if(!isset($assoc[$trad->kategorio])) {
38
+              $assoc[$trad->kategorio] = [];
39
+      }
40
+      if(!isset($assoc[$trad->kategorio][$trad->sekcio])) {
41
+              $assoc[$trad->kategorio][$trad->sekcio] = [];
42
+      }
41 43
 
42 44
       $assoc[$trad->kategorio][$trad->sekcio][$trad->referenco] = $trad->$lang;
43 45
     }
@@ -46,8 +48,9 @@  discard block
 block discarded – undo
46 48
     // {
47 49
     $path_to_file = $locale_path.'/'.$lang;
48 50
     // test directory access & creation
49
-    if(!JSON::exists($path_to_file))
50
-      JSON::make_dir($path_to_file);
51
+    if(!JSON::exists($path_to_file)) {
52
+          JSON::make_dir($path_to_file);
53
+    }
51 54
 
52 55
     $file = new JSON($path_to_file.'/'.self::JSON_FILENAME, 'w+');
53 56
     $file->set_content(JSON::from_php($assoc));
@@ -61,8 +64,9 @@  discard block
 block discarded – undo
61 64
   public static function init($locale_path)
62 65
   {
63 66
     $languages = array_keys(array_slice(Traduko::inspect(Traduko::table_name())->columns(), 4));
64
-    foreach($languages as $l)
65
-      self::create_file($locale_path, $l);
67
+    foreach($languages as $l) {
68
+          self::create_file($locale_path, $l);
69
+    }
66 70
 
67 71
     return $languages;
68 72
   }
Please login to merge, or discard this patch.