@@ -215,14 +215,20 @@ |
||
| 215 | 215 | $prefs->read_repository(false); |
| 216 | 216 | foreach(array('','addressbook', 'calendar', 'infolog', 'tracker', 'timesheet', 'projectmanager', 'filemanager') as $app) |
| 217 | 217 | { |
| 218 | - if ($app && !file_exists(EGW_SERVER_ROOT.'/'.$app)) continue; |
|
| 218 | + if ($app && !file_exists(EGW_SERVER_ROOT.'/'.$app)) |
|
| 219 | + { |
|
| 220 | + continue; |
|
| 221 | + } |
|
| 219 | 222 | |
| 220 | 223 | // create directory and set permissions: Admins writable and other readable |
| 221 | 224 | $dir = '/templates'.($app ? '/'.$app : ''); |
| 222 | 225 | Vfs::mkdir($dir, 075, STREAM_MKDIR_RECURSIVE); |
| 223 | 226 | Vfs::chgrp($dir, abs($admins)); |
| 224 | 227 | Vfs::chmod($dir, 075); |
| 225 | - if (!$app) continue; |
|
| 228 | + if (!$app) |
|
| 229 | + { |
|
| 230 | + continue; |
|
| 231 | + } |
|
| 226 | 232 | |
| 227 | 233 | // set default preference for app (preserving a maybe already set document-directory) |
| 228 | 234 | if ($prefs->default[$app]['document_dir']) |
@@ -21,4 +21,6 @@ |
||
| 21 | 21 | * |
| 22 | 22 | * @deprecated use Api\Db\Exception\InvalidSql |
| 23 | 23 | */ |
| 24 | -class egw_exception_db_invalid_sql extends Api\Db\Exception {} |
|
| 24 | +class egw_exception_db_invalid_sql extends Api\Db\Exception |
|
| 25 | +{ |
|
| 26 | +} |
|
@@ -21,4 +21,6 @@ |
||
| 21 | 21 | * |
| 22 | 22 | * @deprecated use Api\Exception\NoPermission |
| 23 | 23 | */ |
| 24 | -class egw_exception_no_permission extends Api\Exception {} |
|
| 24 | +class egw_exception_no_permission extends Api\Exception |
|
| 25 | +{ |
|
| 26 | +} |
|
@@ -21,4 +21,6 @@ |
||
| 21 | 21 | * |
| 22 | 22 | * @deprecated use Api\Db\Exception |
| 23 | 23 | */ |
| 24 | -class egw_exception_db extends Api\Exception {} |
|
| 24 | +class egw_exception_db extends Api\Exception |
|
| 25 | +{ |
|
| 26 | +} |
|
@@ -25,7 +25,8 @@ |
||
| 25 | 25 | * Test using any actual template |
| 26 | 26 | */ |
| 27 | 27 | $template = 'etemplate.et2_test_file_upload'; |
| 28 | - if($template) { |
|
| 28 | + if($template) |
|
| 29 | + { |
|
| 29 | 30 | $etemplate = new Api\Etemplate('etemplate.et2_test_file_upload'); |
| 30 | 31 | $etemplate->exec('',array()); |
| 31 | 32 | return; |
@@ -36,7 +36,10 @@ |
||
| 36 | 36 | |
| 37 | 37 | foreach($categories as $cat) |
| 38 | 38 | { |
| 39 | - if (!isset($cat['data'])) continue; |
|
| 39 | + if (!isset($cat['data'])) |
|
| 40 | + { |
|
| 41 | + continue; |
|
| 42 | + } |
|
| 40 | 43 | if (!empty($cat['data']['color'])) |
| 41 | 44 | { |
| 42 | 45 | // Use slightly more specific selector that just class, to allow defaults |
@@ -14,8 +14,14 @@ |
||
| 14 | 14 | use EGroupware\Api; |
| 15 | 15 | |
| 16 | 16 | // just to be sure, noone tries something nasty ... |
| 17 | -if (!preg_match('/^[a-z0-9_]+$/i', $_GET['app'])) die('No valid application-name given!'); |
|
| 18 | -if (!preg_match('/^[a-z]{2}(-[a-z]{2})?$/i', $_GET['lang'])) die('No valid lang-name given!'); |
|
| 17 | +if (!preg_match('/^[a-z0-9_]+$/i', $_GET['app'])) |
|
| 18 | +{ |
|
| 19 | + die('No valid application-name given!'); |
|
| 20 | +} |
|
| 21 | +if (!preg_match('/^[a-z]{2}(-[a-z]{2})?$/i', $_GET['lang'])) |
|
| 22 | +{ |
|
| 23 | + die('No valid lang-name given!'); |
|
| 24 | +} |
|
| 19 | 25 | |
| 20 | 26 | // switch evtl. set output-compression off, as we cant calculate a Content-Length header with transparent compression |
| 21 | 27 | ini_set('zlib.output_compression', 0); |
@@ -244,10 +244,13 @@ discard block |
||
| 244 | 244 | $scale = 1.0; |
| 245 | 245 | |
| 246 | 246 | //Select the constraining dimension |
| 247 | - if ($w > $h) // landscape image: constraining factor $minh or $maxw |
|
| 247 | + if ($w > $h) |
|
| 248 | + { |
|
| 249 | + // landscape image: constraining factor $minh or $maxw |
|
| 248 | 250 | { |
| 249 | 251 | $scale = $minh ? $minh / $h : $maxw / $w; |
| 250 | 252 | } |
| 253 | + } |
|
| 251 | 254 | else // portrail image: constraining factor $minw or $maxh |
| 252 | 255 | { |
| 253 | 256 | $scale = $minw ? $minw / $w : $maxh / $h; |
@@ -304,7 +307,10 @@ discard block |
||
| 304 | 307 | // Get mime type |
| 305 | 308 | list($type, $image_type) = explode('/', $mime = Vfs::mime_content_type($file)); |
| 306 | 309 | // if $file is not from vfs, use Api\MimeMagic::filename2mime to get mime-type from extension |
| 307 | - if (!$type) list($type, $image_type) = explode('/', $mime = Api\MimeMagic::filename2mime($file)); |
|
| 310 | + if (!$type) |
|
| 311 | + { |
|
| 312 | + list($type, $image_type) = explode('/', $mime = Api\MimeMagic::filename2mime($file)); |
|
| 313 | + } |
|
| 308 | 314 | |
| 309 | 315 | // Call the according gd constructor depending on the file type |
| 310 | 316 | if($type == 'image') |
@@ -442,7 +448,10 @@ discard block |
||
| 442 | 448 | */ |
| 443 | 449 | function get_pdf_thumbnail($file) |
| 444 | 450 | { |
| 445 | - if(!pdf_thumbnails_available()) return false; |
|
| 451 | + if(!pdf_thumbnails_available()) |
|
| 452 | + { |
|
| 453 | + return false; |
|
| 454 | + } |
|
| 446 | 455 | |
| 447 | 456 | // switch off max_excution_time, as some thumbnails take longer and |
| 448 | 457 | // will be startet over and over again, if they dont finish |
@@ -482,7 +491,10 @@ discard block |
||
| 482 | 491 | |
| 483 | 492 | // Find correct size - max 1/3 target |
| 484 | 493 | $tag_size = get_scaled_image_size(imagesx($tag_image), imagesy($tag_image), $target_width / 3, $target_height / 3); |
| 485 | - if(!$tag_size) return; |
|
| 494 | + if(!$tag_size) |
|
| 495 | + { |
|
| 496 | + return; |
|
| 497 | + } |
|
| 486 | 498 | list($tag_width,$tag_height) = $tag_size; |
| 487 | 499 | |
| 488 | 500 | // Put it in |
@@ -575,17 +587,24 @@ discard block |
||
| 575 | 587 | */ |
| 576 | 588 | function gdVersion($user_ver = 0) |
| 577 | 589 | { |
| 578 | - if (! extension_loaded('gd')) { return; } |
|
| 590 | + if (! extension_loaded('gd')) |
|
| 591 | + { |
|
| 592 | +return; } |
|
| 579 | 593 | static $gd_ver = 0; |
| 580 | 594 | |
| 581 | 595 | // Just accept the specified setting if it's 1. |
| 582 | - if ($user_ver == 1) { $gd_ver = 1; return 1; } |
|
| 596 | + if ($user_ver == 1) |
|
| 597 | + { |
|
| 598 | +$gd_ver = 1; return 1; } |
|
| 583 | 599 | |
| 584 | 600 | // Use the static variable if function was called previously. |
| 585 | - if ($user_ver !=2 && $gd_ver > 0 ) { return $gd_ver; } |
|
| 601 | + if ($user_ver !=2 && $gd_ver > 0 ) |
|
| 602 | + { |
|
| 603 | +return $gd_ver; } |
|
| 586 | 604 | |
| 587 | 605 | // Use the gd_info() function if possible. |
| 588 | - if (function_exists('gd_info')) { |
|
| 606 | + if (function_exists('gd_info')) |
|
| 607 | + { |
|
| 589 | 608 | $ver_info = gd_info(); |
| 590 | 609 | $match = null; |
| 591 | 610 | preg_match('/\d/', $ver_info['GD Version'], $match); |
@@ -594,11 +613,15 @@ discard block |
||
| 594 | 613 | } |
| 595 | 614 | |
| 596 | 615 | // If phpinfo() is disabled use a specified / fail-safe choice... |
| 597 | - if (preg_match('/phpinfo/', ini_get('disable_functions'))) { |
|
| 598 | - if ($user_ver == 2) { |
|
| 616 | + if (preg_match('/phpinfo/', ini_get('disable_functions'))) |
|
| 617 | + { |
|
| 618 | + if ($user_ver == 2) |
|
| 619 | + { |
|
| 599 | 620 | $gd_ver = 2; |
| 600 | 621 | return 2; |
| 601 | - } else { |
|
| 622 | + } |
|
| 623 | + else |
|
| 624 | + { |
|
| 602 | 625 | $gd_ver = 1; |
| 603 | 626 | return 1; |
| 604 | 627 | } |
@@ -607,6 +630,9 @@ discard block |
||
| 607 | 630 | ob_start(); |
| 608 | 631 | phpinfo(8); |
| 609 | 632 | $info = stristr(ob_get_clean(), 'gd version'); |
| 610 | - if (preg_match('/\d/', $info, $match)) $gd_ver = $match[0]; |
|
| 633 | + if (preg_match('/\d/', $info, $match)) |
|
| 634 | + { |
|
| 635 | + $gd_ver = $match[0]; |
|
| 636 | + } |
|
| 611 | 637 | return $match[0]; |
| 612 | 638 | } |
@@ -84,14 +84,21 @@ discard block |
||
| 84 | 84 | { |
| 85 | 85 | $GLOBALS['egw_info']['server']['server_root'] = EGW_SERVER_ROOT; |
| 86 | 86 | } |
| 87 | -if (isset($_POST['setting'])) // Post of the header-form |
|
| 87 | +if (isset($_POST['setting'])) |
|
| 88 | 88 | { |
| 89 | - $validation_errors = check_header_form(); // validate the submitted form |
|
| 89 | + // Post of the header-form |
|
| 90 | +{ |
|
| 91 | + $validation_errors = check_header_form(); |
|
| 92 | +} |
|
| 93 | +// validate the submitted form |
|
| 90 | 94 | } |
| 91 | -if (!isset($_POST['action']) || $validation_errors) // generate form to edit the header |
|
| 95 | +if (!isset($_POST['action']) || $validation_errors) |
|
| 96 | +{ |
|
| 97 | + // generate form to edit the header |
|
| 92 | 98 | { |
| 93 | 99 | show_header_form($validation_errors); |
| 94 | 100 | } |
| 101 | +} |
|
| 95 | 102 | else |
| 96 | 103 | { |
| 97 | 104 | $newheader = $GLOBALS['egw_setup']->header->generate($GLOBALS['egw_info'],$GLOBALS['egw_domain']); |
@@ -156,7 +163,10 @@ discard block |
||
| 156 | 163 | // setting the non-domain settings from the posted content |
| 157 | 164 | foreach($_POST['setting'] as $name => $value) |
| 158 | 165 | { |
| 159 | - if (get_magic_quotes_gpc()) $value = stripslashes($value); |
|
| 166 | + if (get_magic_quotes_gpc()) |
|
| 167 | + { |
|
| 168 | + $value = stripslashes($value); |
|
| 169 | + } |
|
| 160 | 170 | |
| 161 | 171 | switch($name) |
| 162 | 172 | { |
@@ -166,7 +176,10 @@ discard block |
||
| 166 | 176 | $GLOBALS['egw_info']['server'][$name] = $value == 'True'; |
| 167 | 177 | break; |
| 168 | 178 | case 'new_admin_password': |
| 169 | - if ($value) $GLOBALS['egw_info']['server']['header_admin_password'] = $value; |
|
| 179 | + if ($value) |
|
| 180 | + { |
|
| 181 | + $GLOBALS['egw_info']['server']['header_admin_password'] = $value; |
|
| 182 | + } |
|
| 170 | 183 | break; |
| 171 | 184 | default: |
| 172 | 185 | $GLOBALS['egw_info']['server'][$name] = $value; |
@@ -186,11 +199,17 @@ discard block |
||
| 186 | 199 | |
| 187 | 200 | foreach($_POST['setting_'.$key] as $name => $value) |
| 188 | 201 | { |
| 189 | - if (get_magic_quotes_gpc()) $value = stripslashes($value); |
|
| 202 | + if (get_magic_quotes_gpc()) |
|
| 203 | + { |
|
| 204 | + $value = stripslashes($value); |
|
| 205 | + } |
|
| 190 | 206 | |
| 191 | 207 | if ($name == 'new_config_passwd') |
| 192 | 208 | { |
| 193 | - if ($value) $GLOBALS['egw_domain'][$domain]['config_passwd'] = $value; |
|
| 209 | + if ($value) |
|
| 210 | + { |
|
| 211 | + $GLOBALS['egw_domain'][$domain]['config_passwd'] = $value; |
|
| 212 | + } |
|
| 194 | 213 | continue; |
| 195 | 214 | } |
| 196 | 215 | $GLOBALS['egw_domain'][$domain][$name] = $value; |
@@ -255,7 +274,10 @@ discard block |
||
| 255 | 274 | } |
| 256 | 275 | $setup_tpl->set_var('js_default_db_ports',$js_default_db_ports); |
| 257 | 276 | |
| 258 | - if ($validation_errors) $setup_tpl->set_var('detected','<ul><li>'.implode("</li>\n<li>",$validation_errors)."</li>\n</ul>\n"); |
|
| 277 | + if ($validation_errors) |
|
| 278 | + { |
|
| 279 | + $setup_tpl->set_var('detected','<ul><li>'.implode("</li>\n<li>",$validation_errors)."</li>\n</ul>\n"); |
|
| 280 | + } |
|
| 259 | 281 | |
| 260 | 282 | if ($_POST['adddomain']) |
| 261 | 283 | { |
@@ -275,7 +297,10 @@ discard block |
||
| 275 | 297 | $setup_tpl->set_var($name.($GLOBALS['egw_info']['server'][$name] ? '_yes' : '_no'),' selected="selected"'); |
| 276 | 298 | break; |
| 277 | 299 | default: |
| 278 | - if (!is_array($value)) $setup_tpl->set_var($name,htmlspecialchars($value)); |
|
| 300 | + if (!is_array($value)) |
|
| 301 | + { |
|
| 302 | + $setup_tpl->set_var($name,htmlspecialchars($value)); |
|
| 303 | + } |
|
| 279 | 304 | break; |
| 280 | 305 | } |
| 281 | 306 | } |
@@ -300,10 +325,13 @@ discard block |
||
| 300 | 325 | $setup_tpl->set_var('db_domain',htmlspecialchars($domain)); |
| 301 | 326 | foreach($data as $name => $value) |
| 302 | 327 | { |
| 303 | - if ($name == 'db_port' && !$value) // Set default here if the admin didn't set a port yet |
|
| 328 | + if ($name == 'db_port' && !$value) |
|
| 329 | + { |
|
| 330 | + // Set default here if the admin didn't set a port yet |
|
| 304 | 331 | { |
| 305 | 332 | $value = $GLOBALS['egw_setup']->header->default_db_ports[$data['db_type']]; |
| 306 | 333 | } |
| 334 | + } |
|
| 307 | 335 | $setup_tpl->set_var($name,htmlspecialchars($value)); |
| 308 | 336 | } |
| 309 | 337 | $dbtype_options = ''; |