@@ -318,6 +318,9 @@ discard block |
||
318 | 318 | return $permissions; |
319 | 319 | } |
320 | 320 | |
321 | + /** |
|
322 | + * @param string $val |
|
323 | + */ |
|
321 | 324 | public static function getFlag($val) |
322 | 325 | { |
323 | 326 | if ($val == 'On' || $val == 1 || stripos($val, 'On') !== false) { |
@@ -326,6 +329,9 @@ discard block |
||
326 | 329 | return 'Off'; |
327 | 330 | } |
328 | 331 | |
332 | + /** |
|
333 | + * @param string $value |
|
334 | + */ |
|
329 | 335 | public function error2string($value) |
330 | 336 | { |
331 | 337 | $level_names = array( |
@@ -340,7 +340,7 @@ |
||
340 | 340 | $levels = array(); |
341 | 341 | if (($value & E_ALL) == E_ALL) { |
342 | 342 | $levels[] = 'E_ALL'; |
343 | - $value&=~E_ALL; |
|
343 | + $value &= ~E_ALL; |
|
344 | 344 | } |
345 | 345 | foreach ($level_names as $level => $name) |
346 | 346 | if (($value & $level) == $level) |
@@ -119,113 +119,139 @@ discard block |
||
119 | 119 | $directiveValues['suhosin.post.max_value_length'] = array('prefer' => '1500000'); |
120 | 120 | } |
121 | 121 | |
122 | - if (ini_get('safe_mode') == '1' || stripos(ini_get('safe_mode'), 'On') !== false) |
|
123 | - $directiveValues['safe_mode']['status'] = true; |
|
122 | + if (ini_get('safe_mode') == '1' || stripos(ini_get('safe_mode'), 'On') !== false) { |
|
123 | + $directiveValues['safe_mode']['status'] = true; |
|
124 | + } |
|
124 | 125 | $directiveValues['safe_mode']['current'] = self::getFlag(ini_get('safe_mode')); |
125 | 126 | |
126 | - if (ini_get('display_errors') == '1' || stripos(ini_get('display_errors'), 'On') !== false) |
|
127 | - $directiveValues['display_errors']['status'] = true; |
|
127 | + if (ini_get('display_errors') == '1' || stripos(ini_get('display_errors'), 'On') !== false) { |
|
128 | + $directiveValues['display_errors']['status'] = true; |
|
129 | + } |
|
128 | 130 | $directiveValues['display_errors']['current'] = self::getFlag(ini_get('display_errors')); |
129 | 131 | |
130 | - if (ini_get('file_uploads') != '1' || stripos(ini_get('file_uploads'), 'Off') !== false) |
|
131 | - $directiveValues['file_uploads']['status'] = true; |
|
132 | + if (ini_get('file_uploads') != '1' || stripos(ini_get('file_uploads'), 'Off') !== false) { |
|
133 | + $directiveValues['file_uploads']['status'] = true; |
|
134 | + } |
|
132 | 135 | $directiveValues['file_uploads']['current'] = self::getFlag(ini_get('file_uploads')); |
133 | 136 | |
134 | - if ((ini_get('output_buffering') <= '4096' && ini_get('output_buffering') != '1') || stripos(ini_get('output_buffering'), 'Off') !== false) |
|
135 | - $directiveValues['output_buffering']['status'] = true; |
|
137 | + if ((ini_get('output_buffering') <= '4096' && ini_get('output_buffering') != '1') || stripos(ini_get('output_buffering'), 'Off') !== false) { |
|
138 | + $directiveValues['output_buffering']['status'] = true; |
|
139 | + } |
|
136 | 140 | if (!in_array(ini_get('output_buffering'), ['On', 1, 0, 'Off'])) { |
137 | 141 | $directiveValues['output_buffering']['current'] = ini_get('output_buffering'); |
138 | 142 | } else { |
139 | 143 | $directiveValues['output_buffering']['current'] = self::getFlag(ini_get('output_buffering')); |
140 | 144 | } |
141 | 145 | |
142 | - if (ini_get('max_execution_time') != 0 && ini_get('max_execution_time') < 600) |
|
143 | - $directiveValues['max_execution_time']['status'] = true; |
|
146 | + if (ini_get('max_execution_time') != 0 && ini_get('max_execution_time') < 600) { |
|
147 | + $directiveValues['max_execution_time']['status'] = true; |
|
148 | + } |
|
144 | 149 | $directiveValues['max_execution_time']['current'] = ini_get('max_execution_time'); |
145 | 150 | |
146 | - if (ini_get('max_input_time') != 0 && ini_get('max_input_time') < 600) |
|
147 | - $directiveValues['max_input_time']['status'] = true; |
|
151 | + if (ini_get('max_input_time') != 0 && ini_get('max_input_time') < 600) { |
|
152 | + $directiveValues['max_input_time']['status'] = true; |
|
153 | + } |
|
148 | 154 | $directiveValues['max_input_time']['current'] = ini_get('max_input_time'); |
149 | 155 | |
150 | - if (ini_get('default_socket_timeout') != 0 && ini_get('default_socket_timeout') < 600) |
|
151 | - $directiveValues['default_socket_timeout']['status'] = true; |
|
156 | + if (ini_get('default_socket_timeout') != 0 && ini_get('default_socket_timeout') < 600) { |
|
157 | + $directiveValues['default_socket_timeout']['status'] = true; |
|
158 | + } |
|
152 | 159 | $directiveValues['default_socket_timeout']['current'] = ini_get('default_socket_timeout'); |
153 | 160 | |
154 | - if (ini_get('mysql.connect_timeout') != 0 && ini_get('mysql.connect_timeout') < 600) |
|
155 | - $directiveValues['mysql.connect_timeout']['status'] = true; |
|
161 | + if (ini_get('mysql.connect_timeout') != 0 && ini_get('mysql.connect_timeout') < 600) { |
|
162 | + $directiveValues['mysql.connect_timeout']['status'] = true; |
|
163 | + } |
|
156 | 164 | $directiveValues['mysql.connect_timeout']['current'] = ini_get('mysql.connect_timeout'); |
157 | 165 | |
158 | - if (vtlib\Functions::parseBytes(ini_get('memory_limit')) < 33554432) |
|
159 | - $directiveValues['memory_limit']['status'] = true; |
|
166 | + if (vtlib\Functions::parseBytes(ini_get('memory_limit')) < 33554432) { |
|
167 | + $directiveValues['memory_limit']['status'] = true; |
|
168 | + } |
|
160 | 169 | $directiveValues['memory_limit']['current'] = vtlib\Functions::showBytes(ini_get('memory_limit')); |
161 | 170 | |
162 | - if (vtlib\Functions::parseBytes(ini_get('post_max_size')) < 10485760) |
|
163 | - $directiveValues['post_max_size']['status'] = true; |
|
171 | + if (vtlib\Functions::parseBytes(ini_get('post_max_size')) < 10485760) { |
|
172 | + $directiveValues['post_max_size']['status'] = true; |
|
173 | + } |
|
164 | 174 | $directiveValues['post_max_size']['current'] = vtlib\Functions::showBytes(ini_get('post_max_size')); |
165 | 175 | |
166 | - if (vtlib\Functions::parseBytes(ini_get('upload_max_filesize')) < 10485760) |
|
167 | - $directiveValues['upload_max_filesize']['status'] = true; |
|
176 | + if (vtlib\Functions::parseBytes(ini_get('upload_max_filesize')) < 10485760) { |
|
177 | + $directiveValues['upload_max_filesize']['status'] = true; |
|
178 | + } |
|
168 | 179 | $directiveValues['upload_max_filesize']['current'] = vtlib\Functions::showBytes(ini_get('upload_max_filesize')); |
169 | 180 | |
170 | - if (ini_get('magic_quotes_gpc') == '1' || stripos(ini_get('magic_quotes_gpc'), 'On') !== false) |
|
171 | - $directiveValues['magic_quotes_gpc']['status'] = true; |
|
181 | + if (ini_get('magic_quotes_gpc') == '1' || stripos(ini_get('magic_quotes_gpc'), 'On') !== false) { |
|
182 | + $directiveValues['magic_quotes_gpc']['status'] = true; |
|
183 | + } |
|
172 | 184 | $directiveValues['magic_quotes_gpc']['current'] = self::getFlag(ini_get('magic_quotes_gpc')); |
173 | 185 | |
174 | - if (ini_get('magic_quotes_runtime') == '1' || stripos(ini_get('magic_quotes_runtime'), 'On') !== false) |
|
175 | - $directiveValues['magic_quotes_runtime']['status'] = true; |
|
186 | + if (ini_get('magic_quotes_runtime') == '1' || stripos(ini_get('magic_quotes_runtime'), 'On') !== false) { |
|
187 | + $directiveValues['magic_quotes_runtime']['status'] = true; |
|
188 | + } |
|
176 | 189 | $directiveValues['magic_quotes_runtime']['current'] = self::getFlag((ini_get('magic_quotes_runtime'))); |
177 | 190 | |
178 | - if (ini_get('zlib.output_compression') == '1' || stripos(ini_get('zlib.output_compression'), 'On') !== false) |
|
179 | - $directiveValues['zlib.output_compression']['status'] = true; |
|
191 | + if (ini_get('zlib.output_compression') == '1' || stripos(ini_get('zlib.output_compression'), 'On') !== false) { |
|
192 | + $directiveValues['zlib.output_compression']['status'] = true; |
|
193 | + } |
|
180 | 194 | $directiveValues['zlib.output_compression']['current'] = self::getFlag((ini_get('zlib.output_compression'))); |
181 | 195 | |
182 | - if (ini_get('zend.ze1_compatibility_mode') == '1' || stripos(ini_get('zend.ze1_compatibility_mode'), 'On') !== false) |
|
183 | - $directiveValues['zend.ze1_compatibility_mode']['status'] = true; |
|
196 | + if (ini_get('zend.ze1_compatibility_mode') == '1' || stripos(ini_get('zend.ze1_compatibility_mode'), 'On') !== false) { |
|
197 | + $directiveValues['zend.ze1_compatibility_mode']['status'] = true; |
|
198 | + } |
|
184 | 199 | $directiveValues['zend.ze1_compatibility_mode']['current'] = self::getFlag(ini_get('zend.ze1_compatibility_mode')); |
185 | 200 | |
186 | 201 | if (extension_loaded('suhosin')) { |
187 | - if (ini_get('suhosin.session.encrypt') == '1' || stripos(ini_get('suhosin.session.encrypt'), 'On') !== false) |
|
188 | - $directiveValues['suhosin.session.encrypt']['status'] = true; |
|
202 | + if (ini_get('suhosin.session.encrypt') == '1' || stripos(ini_get('suhosin.session.encrypt'), 'On') !== false) { |
|
203 | + $directiveValues['suhosin.session.encrypt']['status'] = true; |
|
204 | + } |
|
189 | 205 | $directiveValues['suhosin.session.encrypt']['current'] = self::getFlag(ini_get('suhosin.session.encrypt')); |
190 | 206 | } |
191 | - if (ini_get('session.auto_start') == '1' || stripos(ini_get('session.auto_start'), 'On') !== false) |
|
192 | - $directiveValues['session.auto_start']['status'] = true; |
|
207 | + if (ini_get('session.auto_start') == '1' || stripos(ini_get('session.auto_start'), 'On') !== false) { |
|
208 | + $directiveValues['session.auto_start']['status'] = true; |
|
209 | + } |
|
193 | 210 | $directiveValues['session.auto_start']['current'] = self::getFlag(ini_get('session.auto_start')); |
194 | 211 | |
195 | - if (ini_get('mbstring.func_overload') == '1' || stripos(ini_get('mbstring.func_overload'), 'On') !== false) |
|
196 | - $directiveValues['mbstring.func_overload']['status'] = true; |
|
212 | + if (ini_get('mbstring.func_overload') == '1' || stripos(ini_get('mbstring.func_overload'), 'On') !== false) { |
|
213 | + $directiveValues['mbstring.func_overload']['status'] = true; |
|
214 | + } |
|
197 | 215 | $directiveValues['mbstring.func_overload']['current'] = self::getFlag(ini_get('mbstring.func_overload')); |
198 | 216 | |
199 | - if (ini_get('magic_quotes_sybase') == '1' || stripos(ini_get('magic_quotes_sybase'), 'On') !== false) |
|
200 | - $directiveValues['magic_quotes_sybase']['status'] = true; |
|
217 | + if (ini_get('magic_quotes_sybase') == '1' || stripos(ini_get('magic_quotes_sybase'), 'On') !== false) { |
|
218 | + $directiveValues['magic_quotes_sybase']['status'] = true; |
|
219 | + } |
|
201 | 220 | $directiveValues['magic_quotes_sybase']['current'] = self::getFlag(ini_get('magic_quotes_sybase')); |
202 | 221 | |
203 | - if (ini_get('log_errors') == '1' || stripos(ini_get('log_errors'), 'On') !== false) |
|
204 | - $directiveValues['log_errors']['status'] = true; |
|
222 | + if (ini_get('log_errors') == '1' || stripos(ini_get('log_errors'), 'On') !== false) { |
|
223 | + $directiveValues['log_errors']['status'] = true; |
|
224 | + } |
|
205 | 225 | $directiveValues['log_errors']['current'] = self::getFlag(ini_get('log_errors')); |
206 | 226 | |
207 | - if (ini_get('short_open_tag') != '1' || stripos(ini_get('short_open_tag'), 'Off') !== false) |
|
208 | - $directiveValues['short_open_tag']['status'] = true; |
|
227 | + if (ini_get('short_open_tag') != '1' || stripos(ini_get('short_open_tag'), 'Off') !== false) { |
|
228 | + $directiveValues['short_open_tag']['status'] = true; |
|
229 | + } |
|
209 | 230 | $directiveValues['short_open_tag']['current'] = self::getFlag(ini_get('short_open_tag')); |
210 | 231 | |
211 | - if (ini_get('session.gc_maxlifetime') < 21600) |
|
212 | - $directiveValues['session.gc_maxlifetime']['status'] = true; |
|
232 | + if (ini_get('session.gc_maxlifetime') < 21600) { |
|
233 | + $directiveValues['session.gc_maxlifetime']['status'] = true; |
|
234 | + } |
|
213 | 235 | $directiveValues['session.gc_maxlifetime']['current'] = ini_get('session.gc_maxlifetime'); |
214 | 236 | |
215 | - if (ini_get('session.gc_divisor') < 500) |
|
216 | - $directiveValues['session.gc_divisor']['status'] = true; |
|
237 | + if (ini_get('session.gc_divisor') < 500) { |
|
238 | + $directiveValues['session.gc_divisor']['status'] = true; |
|
239 | + } |
|
217 | 240 | $directiveValues['session.gc_divisor']['current'] = ini_get('session.gc_divisor'); |
218 | 241 | |
219 | - if (ini_get('session.gc_probability') < 1) |
|
220 | - $directiveValues['session.gc_probability']['status'] = true; |
|
242 | + if (ini_get('session.gc_probability') < 1) { |
|
243 | + $directiveValues['session.gc_probability']['status'] = true; |
|
244 | + } |
|
221 | 245 | $directiveValues['session.gc_probability']['current'] = ini_get('session.gc_probability'); |
222 | 246 | |
223 | - if (ini_get('max_input_vars') < 5000) |
|
224 | - $directiveValues['max_input_vars']['status'] = true; |
|
247 | + if (ini_get('max_input_vars') < 5000) { |
|
248 | + $directiveValues['max_input_vars']['status'] = true; |
|
249 | + } |
|
225 | 250 | $directiveValues['max_input_vars']['current'] = ini_get('max_input_vars'); |
226 | 251 | |
227 | - if (version_compare(PHP_VERSION, '5.4.0', '<')) |
|
228 | - $directiveValues['PHP']['status'] = true; |
|
252 | + if (version_compare(PHP_VERSION, '5.4.0', '<')) { |
|
253 | + $directiveValues['PHP']['status'] = true; |
|
254 | + } |
|
229 | 255 | $directiveValues['PHP']['current'] = PHP_VERSION; |
230 | 256 | |
231 | 257 | if (extension_loaded('suhosin')) { |
@@ -280,8 +306,9 @@ discard block |
||
280 | 306 | } |
281 | 307 | |
282 | 308 | $errorReporting = stripos(ini_get('error_reporting'), '_') === false ? self::error2string(ini_get('error_reporting')) : ini_get('error_reporting'); |
283 | - if (in_array('E_NOTICE', $errorReporting) || in_array('E_DEPRECATED', $errorReporting) || in_array('E_STRICT', $errorReporting)) |
|
284 | - $directiveValues['error_reporting']['status'] = true; |
|
309 | + if (in_array('E_NOTICE', $errorReporting) || in_array('E_DEPRECATED', $errorReporting) || in_array('E_STRICT', $errorReporting)) { |
|
310 | + $directiveValues['error_reporting']['status'] = true; |
|
311 | + } |
|
285 | 312 | $directiveValues['error_reporting']['current'] = implode(' | ', $errorReporting); |
286 | 313 | |
287 | 314 | return $directiveValues; |
@@ -335,16 +362,18 @@ discard block |
||
335 | 362 | E_COMPILE_ERROR => 'E_COMPILE_ERROR', E_COMPILE_WARNING => 'E_COMPILE_WARNING', |
336 | 363 | E_USER_ERROR => 'E_USER_ERROR', E_USER_WARNING => 'E_USER_WARNING', |
337 | 364 | E_USER_NOTICE => 'E_USER_NOTICE'); |
338 | - if (defined('E_STRICT')) |
|
339 | - $level_names[E_STRICT] = 'E_STRICT'; |
|
365 | + if (defined('E_STRICT')) { |
|
366 | + $level_names[E_STRICT] = 'E_STRICT'; |
|
367 | + } |
|
340 | 368 | $levels = array(); |
341 | 369 | if (($value & E_ALL) == E_ALL) { |
342 | 370 | $levels[] = 'E_ALL'; |
343 | 371 | $value&=~E_ALL; |
344 | 372 | } |
345 | - foreach ($level_names as $level => $name) |
|
346 | - if (($value & $level) == $level) |
|
373 | + foreach ($level_names as $level => $name) { |
|
374 | + if (($value & $level) == $level) |
|
347 | 375 | $levels[] = $name; |
376 | + } |
|
348 | 377 | return $levels; |
349 | 378 | } |
350 | 379 | } |
@@ -938,8 +938,8 @@ discard block |
||
938 | 938 | |
939 | 939 | /** Gives an array which contains the information for what all roles, groups and user's related module data that is to be shared for the specified parent module and shared module |
940 | 940 | |
941 | - * @param $par_mod -- parent module name:: Type varchar |
|
942 | - * @param $share_mod -- shared module name:: Type varchar |
|
941 | + * @param string $par_mod -- parent module name:: Type varchar |
|
942 | + * @param string $share_mod -- shared module name:: Type varchar |
|
943 | 943 | * @param $userid -- user id:: Type integer |
944 | 944 | * @param $def_org_share -- default organization sharing permission array:: Type array |
945 | 945 | * @param $mod_sharingrule_members -- Sharing Rule Members array:: Type array |
@@ -1355,9 +1355,9 @@ discard block |
||
1355 | 1355 | |
1356 | 1356 | /** Function to populate the read/wirte Sharing permissions data for the specified user into the database |
1357 | 1357 | * @param $userid -- user id:: Type integer |
1358 | - * @param $enttype -- can have the value of User or Group:: Type varchar |
|
1358 | + * @param string $enttype -- can have the value of User or Group:: Type varchar |
|
1359 | 1359 | * @param $module -- module name:: Type varchar |
1360 | - * @param $pertype -- can have the value of read or write:: Type varchar |
|
1360 | + * @param string $pertype -- can have the value of read or write:: Type varchar |
|
1361 | 1361 | * @param $var_name_arr - Variable to use instead of including the sharing access again |
1362 | 1362 | */ |
1363 | 1363 | function populateSharingPrivileges($enttype, $userid, $module, $pertype, $var_name_arr = false) |
@@ -1432,10 +1432,10 @@ discard block |
||
1432 | 1432 | |
1433 | 1433 | /** Function to populate the read/wirte Sharing permissions related module data for the specified user into the database |
1434 | 1434 | * @param $userid -- user id:: Type integer |
1435 | - * @param $enttype -- can have the value of User or Group:: Type varchar |
|
1435 | + * @param string $enttype -- can have the value of User or Group:: Type varchar |
|
1436 | 1436 | * @param $module -- module name:: Type varchar |
1437 | 1437 | * @param $relmodule -- related module name:: Type varchar |
1438 | - * @param $pertype -- can have the value of read or write:: Type varchar |
|
1438 | + * @param string $pertype -- can have the value of read or write:: Type varchar |
|
1439 | 1439 | * @param $var_name_arr - Variable to use instead of including the sharing access again |
1440 | 1440 | */ |
1441 | 1441 | function populateRelatedSharingPrivileges($enttype, $userid, $module, $relmodule, $pertype, $var_name_arr = false) |
@@ -154,7 +154,6 @@ discard block |
||
154 | 154 | } |
155 | 155 | |
156 | 156 | /** Gives an array which contains the information for what all roles, groups and user data is to be shared with the spcified user for the specified module |
157 | - |
|
158 | 157 | * @param $module -- module name:: Type varchar |
159 | 158 | * @param $userid -- user id:: Type integer |
160 | 159 | * @param $def_org_share -- default organization sharing permission array:: Type array |
@@ -937,7 +936,6 @@ discard block |
||
937 | 936 | } |
938 | 937 | |
939 | 938 | /** Gives an array which contains the information for what all roles, groups and user's related module data that is to be shared for the specified parent module and shared module |
940 | - |
|
941 | 939 | * @param $par_mod -- parent module name:: Type varchar |
942 | 940 | * @param $share_mod -- shared module name:: Type varchar |
943 | 941 | * @param $userid -- user id:: Type integer |
@@ -1097,7 +1095,6 @@ discard block |
||
1097 | 1095 | } |
1098 | 1096 | |
1099 | 1097 | /** Converts the input array to a single string to facilitate the writing of the input array in a flat file |
1100 | - |
|
1101 | 1098 | * @param $var -- input array:: Type array |
1102 | 1099 | * @returns $code -- contains the whole array in a single string:: Type array |
1103 | 1100 | */ |
@@ -1114,7 +1111,6 @@ discard block |
||
1114 | 1111 | } |
1115 | 1112 | |
1116 | 1113 | /** Converts the input array to a single string to facilitate the writing of the input array in a flat file |
1117 | - |
|
1118 | 1114 | * @param $var -- input array:: Type array |
1119 | 1115 | * @returns $code -- contains the whole array in a single string:: Type array |
1120 | 1116 | */ |
@@ -1139,7 +1135,6 @@ discard block |
||
1139 | 1135 | } |
1140 | 1136 | |
1141 | 1137 | /** Converts the input array to a single string to facilitate the writing of the input array in a flat file |
1142 | - |
|
1143 | 1138 | * @param $var -- input array:: Type array |
1144 | 1139 | * @returns $code -- contains the whole array in a single string:: Type array |
1145 | 1140 | */ |
@@ -1164,7 +1159,6 @@ discard block |
||
1164 | 1159 | } |
1165 | 1160 | |
1166 | 1161 | /** Converts the input array to a single string to facilitate the writing of the input array in a flat file |
1167 | - |
|
1168 | 1162 | * @param $var -- input array:: Type array |
1169 | 1163 | * @returns $code -- contains the whole array in a single string:: Type array |
1170 | 1164 | */ |
@@ -1191,7 +1185,6 @@ discard block |
||
1191 | 1185 | } |
1192 | 1186 | |
1193 | 1187 | /** Converts the input array to a single string to facilitate the writing of the input array in a flat file |
1194 | - |
|
1195 | 1188 | * @param $var -- input array:: Type array |
1196 | 1189 | * @returns $code -- contains the whole array in a single string:: Type array |
1197 | 1190 | */ |
@@ -1208,7 +1201,6 @@ discard block |
||
1208 | 1201 | } |
1209 | 1202 | |
1210 | 1203 | /** Converts the input array to a single string to facilitate the writing of the input array in a flat file |
1211 | - |
|
1212 | 1204 | * @param $var -- input array:: Type array |
1213 | 1205 | * @returns $code -- contains the whole array in a single string:: Type array |
1214 | 1206 | */ |
@@ -1225,7 +1217,6 @@ discard block |
||
1225 | 1217 | } |
1226 | 1218 | |
1227 | 1219 | /** Converts the input array to a single string to facilitate the writing of the input array in a flat file |
1228 | - |
|
1229 | 1220 | * @param $var -- input array:: Type array |
1230 | 1221 | * @returns $code -- contains the whole array in a single string:: Type array |
1231 | 1222 | */ |
@@ -1246,7 +1237,6 @@ discard block |
||
1246 | 1237 | } |
1247 | 1238 | |
1248 | 1239 | /** Converts the input array to a single string to facilitate the writing of the input array in a flat file |
1249 | - |
|
1250 | 1240 | * @param $var -- input array:: Type array |
1251 | 1241 | * @returns $code -- contains the whole array in a single string:: Type array |
1252 | 1242 | */ |
@@ -1267,7 +1257,6 @@ discard block |
||
1267 | 1257 | } |
1268 | 1258 | |
1269 | 1259 | /** Converts the input array to a single string to facilitate the writing of the input array in a flat file |
1270 | - |
|
1271 | 1260 | * @param $var -- input array:: Type array |
1272 | 1261 | * @returns $code -- contains the whole array in a single string:: Type array |
1273 | 1262 | */ |
@@ -1288,7 +1277,6 @@ discard block |
||
1288 | 1277 | } |
1289 | 1278 | |
1290 | 1279 | /** Converts the input array to a single string to facilitate the writing of the input array in a flat file |
1291 | - |
|
1292 | 1280 | * @param $var -- input array:: Type array |
1293 | 1281 | * @returns $code -- contains the whole array in a single string:: Type array |
1294 | 1282 | */ |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | if ($handle) { |
27 | 27 | $newbuf = ''; |
28 | - $newbuf .="<?php\n"; |
|
28 | + $newbuf .= "<?php\n"; |
|
29 | 29 | $user_focus = CRMEntity::getInstance('Users'); |
30 | 30 | $user_focus->retrieve_entity_info($userid, 'Users'); |
31 | 31 | $userInfo = []; |
@@ -1217,7 +1217,7 @@ discard block |
||
1217 | 1217 | if (is_array($var)) { |
1218 | 1218 | $code = '['; |
1219 | 1219 | foreach ($var as $value) { |
1220 | - $code .="'" . $value . "',"; |
|
1220 | + $code .= "'" . $value . "',"; |
|
1221 | 1221 | } |
1222 | 1222 | $code .= ']'; |
1223 | 1223 | return $code; |
@@ -257,8 +257,9 @@ discard block |
||
257 | 257 | |
258 | 258 | //Get roles from Role2Grp |
259 | 259 | $groupList = $current_user_groups; |
260 | - if (empty($groupList)) |
|
261 | - $groupList = array(0); |
|
260 | + if (empty($groupList)) { |
|
261 | + $groupList = array(0); |
|
262 | + } |
|
262 | 263 | |
263 | 264 | if (!empty($groupList)) { |
264 | 265 | $query = "select vtiger_datashare_role2group.* from vtiger_datashare_role2group inner join vtiger_datashare_module_rel on vtiger_datashare_module_rel.shareid=vtiger_datashare_role2group.shareid where vtiger_datashare_module_rel.tabid=?"; |
@@ -1379,8 +1380,9 @@ discard block |
||
1379 | 1380 | $var_name = $module . '_share_write_permission'; |
1380 | 1381 | } |
1381 | 1382 | // Lookup for the variable if not set through function argument |
1382 | - if (!$var_name_arr) |
|
1383 | - $var_name_arr = $$var_name; |
|
1383 | + if (!$var_name_arr) { |
|
1384 | + $var_name_arr = $$var_name; |
|
1385 | + } |
|
1384 | 1386 | $user_arr = []; |
1385 | 1387 | if (sizeof($var_name_arr['ROLE']) > 0) { |
1386 | 1388 | foreach ($var_name_arr['ROLE'] as $roleid => $roleusers) { |
@@ -1414,8 +1416,9 @@ discard block |
||
1414 | 1416 | $var_name = $module . '_share_write_permission'; |
1415 | 1417 | } |
1416 | 1418 | // Lookup for the variable if not set through function argument |
1417 | - if (!$var_name_arr) |
|
1418 | - $var_name_arr = $$var_name; |
|
1419 | + if (!$var_name_arr) { |
|
1420 | + $var_name_arr = $$var_name; |
|
1421 | + } |
|
1419 | 1422 | $grp_arr = []; |
1420 | 1423 | if (sizeof($var_name_arr['GROUP']) > 0) { |
1421 | 1424 | |
@@ -1458,8 +1461,9 @@ discard block |
||
1458 | 1461 | $var_name = $module . '_' . $relmodule . '_share_write_permission'; |
1459 | 1462 | } |
1460 | 1463 | // Lookup for the variable if not set through function argument |
1461 | - if (!$var_name_arr) |
|
1462 | - $var_name_arr = $$var_name; |
|
1464 | + if (!$var_name_arr) { |
|
1465 | + $var_name_arr = $$var_name; |
|
1466 | + } |
|
1463 | 1467 | $user_arr = []; |
1464 | 1468 | if (sizeof($var_name_arr['ROLE']) > 0) { |
1465 | 1469 | foreach ($var_name_arr['ROLE'] as $roleid => $roleusers) { |
@@ -1493,8 +1497,9 @@ discard block |
||
1493 | 1497 | $var_name = $module . '_' . $relmodule . '_share_write_permission'; |
1494 | 1498 | } |
1495 | 1499 | // Lookup for the variable if not set through function argument |
1496 | - if (!$var_name_arr) |
|
1497 | - $var_name_arr = $$var_name; |
|
1500 | + if (!$var_name_arr) { |
|
1501 | + $var_name_arr = $$var_name; |
|
1502 | + } |
|
1498 | 1503 | $grp_arr = []; |
1499 | 1504 | if (sizeof($var_name_arr['GROUP']) > 0) { |
1500 | 1505 |
@@ -17,6 +17,9 @@ |
||
17 | 17 | } |
18 | 18 | } |
19 | 19 | |
20 | + /** |
|
21 | + * @param Vtiger_Record_Model $recordModel |
|
22 | + */ |
|
20 | 23 | public function checkMandatoryFields($recordModel) |
21 | 24 | { |
22 | 25 | $mandatoryFields = $recordModel->getModule()->getMandatoryFieldModels(); |
@@ -221,7 +221,7 @@ |
||
221 | 221 | /** |
222 | 222 | * Checks if given record has valid pdf template |
223 | 223 | * @param Vtiger_Request $request |
224 | - * @return boolean true if valid template exists for this record |
|
224 | + * @return boolean|null true if valid template exists for this record |
|
225 | 225 | */ |
226 | 226 | public function hasValidTemplate(Vtiger_Request $request) |
227 | 227 | { |
@@ -72,7 +72,7 @@ |
||
72 | 72 | |
73 | 73 | /** |
74 | 74 | * Function to save record |
75 | - * @param <Vtiger_Request> $request - values of the record |
|
75 | + * @param Vtiger_Request $request - values of the record |
|
76 | 76 | * @return <RecordModel> - record Model of saved record |
77 | 77 | */ |
78 | 78 | public function saveRecord($request) |
@@ -87,8 +87,9 @@ discard block |
||
87 | 87 | $relatedRecordId = $recordModel->getId(); |
88 | 88 | |
89 | 89 | $relationModel = Vtiger_Relation_Model::getInstance($parentModuleModel, $relatedModule); |
90 | - if ($relationModel) |
|
91 | - $relationModel->addRelation($parentRecordId, $relatedRecordId); |
|
90 | + if ($relationModel) { |
|
91 | + $relationModel->addRelation($parentRecordId, $relatedRecordId); |
|
92 | + } |
|
92 | 93 | } |
93 | 94 | if ($request->get('imgDeleted')) { |
94 | 95 | $imageIds = $request->get('imageid'); |
@@ -144,8 +145,9 @@ discard block |
||
144 | 145 | $fieldValue = trim($fieldValue); |
145 | 146 | } |
146 | 147 | $recordModel->set($fieldName, $fieldValue); |
147 | - } else |
|
148 | - $recordModel->set($fieldName, null); |
|
148 | + } else { |
|
149 | + $recordModel->set($fieldName, null); |
|
150 | + } |
|
149 | 151 | } |
150 | 152 | return $recordModel; |
151 | 153 | } |
@@ -113,6 +113,9 @@ discard block |
||
113 | 113 | return []; |
114 | 114 | } |
115 | 115 | |
116 | + /** |
|
117 | + * @param Vtiger_Widget_Model $widgetModel |
|
118 | + */ |
|
116 | 119 | public function setWidgetModel($widgetModel) |
117 | 120 | { |
118 | 121 | $this->widgetModel = $widgetModel; |
@@ -127,6 +130,9 @@ discard block |
||
127 | 130 | } |
128 | 131 | } |
129 | 132 | |
133 | + /** |
|
134 | + * @return string |
|
135 | + */ |
|
130 | 136 | public function getType() |
131 | 137 | { |
132 | 138 | return $this->extraData['chartType']; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | if (!isset($groupData[$displayValue]['count'])) { |
113 | 113 | $groupData[$displayValue]['count'] = 1; |
114 | 114 | } else { |
115 | - $groupData[$displayValue]['count'] ++; |
|
115 | + $groupData[$displayValue]['count']++; |
|
116 | 116 | } |
117 | 117 | if (!isset($groupData[$displayValue]['link'])) { |
118 | 118 | $moduleModel = $this->getTargetModuleModel(); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $count = []; |
126 | 126 | while ($row = $db->getRow($result)) { |
127 | 127 | $sectorId = $this->getSector($sectors, $row[$groupField]); |
128 | - if($sectorId !== false){ |
|
128 | + if ($sectorId !== false) { |
|
129 | 129 | if (!isset($count[$sectorId])) { |
130 | 130 | $count[$sectorId] = 1; |
131 | 131 | } else { |
@@ -134,15 +134,15 @@ discard block |
||
134 | 134 | } |
135 | 135 | |
136 | 136 | } |
137 | - foreach($sectors as $sectorId => $sectorValue){ |
|
137 | + foreach ($sectors as $sectorId => $sectorValue) { |
|
138 | 138 | $moduleModel = $this->getTargetModuleModel(); |
139 | 139 | $displayValue = $groupFieldModel->getDisplayValue($sectorValue); |
140 | - $displayValue .= ' - (' . (int)$count[$sectorId] .')'; |
|
141 | - $groupData[$displayValue]['count'] = (int)$sectorValue ; |
|
142 | - if($sectorId == 0){ |
|
143 | - $groupData[$displayValue]['link'] = $moduleModel->getListViewUrl() . "&viewname=$filterId" . '&search_params=' . json_encode([[[$fieldName, 'm', $sectorValue]]]);; |
|
140 | + $displayValue .= ' - (' . (int) $count[$sectorId] . ')'; |
|
141 | + $groupData[$displayValue]['count'] = (int) $sectorValue; |
|
142 | + if ($sectorId == 0) { |
|
143 | + $groupData[$displayValue]['link'] = $moduleModel->getListViewUrl() . "&viewname=$filterId" . '&search_params=' . json_encode([[[$fieldName, 'm', $sectorValue]]]); ; |
|
144 | 144 | } else { |
145 | - $groupData[$displayValue]['link'] = $moduleModel->getListViewUrl() . "&viewname=$filterId" . '&search_params=' . json_encode([[[$fieldName, 'm', $sectorValue],[$fieldName, 'g', $sectors[$sectorId - 1]]]]);; |
|
145 | + $groupData[$displayValue]['link'] = $moduleModel->getListViewUrl() . "&viewname=$filterId" . '&search_params=' . json_encode([[[$fieldName, 'm', $sectorValue], [$fieldName, 'g', $sectors[$sectorId - 1]]]]); ; |
|
146 | 146 | } |
147 | 147 | } |
148 | 148 | } |
@@ -122,6 +122,9 @@ discard block |
||
122 | 122 | return html_entity_decode($value); |
123 | 123 | } |
124 | 124 | |
125 | + /** |
|
126 | + * @param string $fileName |
|
127 | + */ |
|
125 | 128 | public function outputFile($fileName) |
126 | 129 | { |
127 | 130 | header("Content-Disposition:attachment;filename=$fileName.xml"); |
@@ -133,6 +136,9 @@ discard block |
||
133 | 136 | readfile($this->tmpXmlPath); |
134 | 137 | } |
135 | 138 | |
139 | + /** |
|
140 | + * @param string $fileName |
|
141 | + */ |
|
136 | 142 | protected function outputZipFile($fileName) |
137 | 143 | { |
138 | 144 |
@@ -16,8 +16,6 @@ discard block |
||
16 | 16 | |
17 | 17 | /** |
18 | 18 | * Create the name of the Inventory data table |
19 | - * @param string $module Module name |
|
20 | - * @param string $prefix Prefix table |
|
21 | 19 | * @return string Table name |
22 | 20 | */ |
23 | 21 | public function getTableName($type = 'data') |
@@ -118,8 +116,6 @@ discard block |
||
118 | 116 | |
119 | 117 | /** |
120 | 118 | * Get inventory columns |
121 | - * @param string $module Module name |
|
122 | - * @param boolean $returnInBlock Should the result be divided into blocks |
|
123 | 119 | * @return array Inventory columns |
124 | 120 | */ |
125 | 121 | public function getColumns() |
@@ -164,7 +160,6 @@ discard block |
||
164 | 160 | |
165 | 161 | /** |
166 | 162 | * Retrieve list of all fields |
167 | - * @param string $moduleName Module name |
|
168 | 163 | * @return array Fields instance Vtiger_Basic_InventoryField |
169 | 164 | */ |
170 | 165 | public function getAllFields() |
@@ -497,9 +497,9 @@ |
||
497 | 497 | $db = PearDatabase::getInstance(); |
498 | 498 | $query = sprintf('UPDATE `%s` SET sequence = CASE id ', $this->getTableName('fields')); |
499 | 499 | foreach ($sequenceList as $sequence => $id) { |
500 | - $query .=' WHEN ' . $id . ' THEN ' . $sequence; |
|
500 | + $query .= ' WHEN ' . $id . ' THEN ' . $sequence; |
|
501 | 501 | } |
502 | - $query .=' END '; |
|
502 | + $query .= ' END '; |
|
503 | 503 | $query .= sprintf(' WHERE id IN (%s)', generateQuestionMarks($sequenceList)); |
504 | 504 | return $db->pquery($query, array_values($sequenceList)); |
505 | 505 | } |
@@ -133,8 +133,9 @@ discard block |
||
133 | 133 | $columns = []; |
134 | 134 | foreach ($this->getFields() as $key => $field) { |
135 | 135 | $column = $field->getColumnName(); |
136 | - if (!empty($column) && $column != '-') |
|
137 | - $columns[] = $column; |
|
136 | + if (!empty($column) && $column != '-') { |
|
137 | + $columns[] = $column; |
|
138 | + } |
|
138 | 139 | foreach ($field->getCustomColumn() as $name => $field) { |
139 | 140 | $columns[] = $name; |
140 | 141 | } |
@@ -187,8 +188,9 @@ discard block |
||
187 | 188 | } |
188 | 189 | $fields = []; |
189 | 190 | foreach ($fieldPaths as $fieldPath) { |
190 | - if (!is_dir($fieldPath)) |
|
191 | - continue; |
|
191 | + if (!is_dir($fieldPath)) { |
|
192 | + continue; |
|
193 | + } |
|
192 | 194 | foreach (new DirectoryIterator($fieldPath) as $fileinfo) { |
193 | 195 | if ($fileinfo->isFile() && $fileinfo->getFilename() != 'Basic.php') { |
194 | 196 | $fieldName = str_replace('.php', '', $fileinfo->getFilename()); |
@@ -332,7 +332,6 @@ |
||
332 | 332 | |
333 | 333 | /** |
334 | 334 | * Function to get the list view entries |
335 | - * @param Vtiger_Paging_Model $pagingModel |
|
336 | 335 | * @return <Array> - Associative array of record id mapped to Vtiger_Record_Model instance. |
337 | 336 | */ |
338 | 337 | public function getListViewCount() |
@@ -169,8 +169,9 @@ |
||
169 | 169 | $headerFieldModels = []; |
170 | 170 | $headerFields = $listViewContoller->getListViewHeaderFields(); |
171 | 171 | foreach ($headerFields as $fieldName => $webserviceField) { |
172 | - if ($webserviceField && !in_array($webserviceField->getPresence(), [0, 2])) |
|
173 | - continue; |
|
172 | + if ($webserviceField && !in_array($webserviceField->getPresence(), [0, 2])) { |
|
173 | + continue; |
|
174 | + } |
|
174 | 175 | $headerFieldModels[$fieldName] = Vtiger_Field_Model::getInstance($fieldName, $module); |
175 | 176 | } |
176 | 177 | return $headerFieldModels; |