@@ -70,9 +70,9 @@ discard block |
||
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - if (!preg_match('/^[a-z0-9_-]+$/i',$app)) |
|
| 73 | + if (!preg_match('/^[a-z0-9_-]+$/i', $app)) |
|
| 74 | 74 | { |
| 75 | - die('Stop'); // just to prevent someone doing nasty things |
|
| 75 | + die('Stop'); // just to prevent someone doing nasty things |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | return $app; |
@@ -83,8 +83,7 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | function get_maxsize() |
| 85 | 85 | { |
| 86 | - $preset = !($GLOBALS['egw_info']['server']['link_list_thumbnail'] > 0) ? 64 : |
|
| 87 | - $GLOBALS['egw_info']['server']['link_list_thumbnail']; |
|
| 86 | + $preset = !($GLOBALS['egw_info']['server']['link_list_thumbnail'] > 0) ? 64 : $GLOBALS['egw_info']['server']['link_list_thumbnail']; |
|
| 88 | 87 | |
| 89 | 88 | // Another maximum size may be passed if thumbnails are turned on |
| 90 | 89 | if ($preset != 0 && isset($_GET['thsize']) && is_numeric($_GET['thsize'])) |
@@ -150,7 +149,7 @@ discard block |
||
| 150 | 149 | } |
| 151 | 150 | $dst = gen_dstfile($stat && !empty($stat['url']) ? $stat['url'] : $src, $maxsize, $height, $width, $minsize); |
| 152 | 151 | $dst_dir = dirname($dst); |
| 153 | - if(file_exists($dst_dir)) |
|
| 152 | + if (file_exists($dst_dir)) |
|
| 154 | 153 | { |
| 155 | 154 | // Check whether the destination file already exists and is newer than |
| 156 | 155 | // the source file. Assume the file doesn't exist if thumbnailing is turned off. |
@@ -190,7 +189,7 @@ discard block |
||
| 190 | 189 | { |
| 191 | 190 | // Allow client to cache these, makes scrolling in filemanager much nicer |
| 192 | 191 | // setting maximum allow caching time of one year, if url contains (non-empty) moditication time |
| 193 | - Api\Session::cache_control(empty($_GET['mtime']) ? 300 : 31536000, true); // true = private / browser only caching |
|
| 192 | + Api\Session::cache_control(empty($_GET['mtime']) ? 300 : 31536000, true); // true = private / browser only caching |
|
| 194 | 193 | header('Content-Type: '.$output_mime); |
| 195 | 194 | readfile($dst); |
| 196 | 195 | return true; |
@@ -212,7 +211,7 @@ discard block |
||
| 212 | 211 | * @param int $minsize =null |
| 213 | 212 | * @return string |
| 214 | 213 | */ |
| 215 | -function gen_dstfile($src, $maxsize, $height=null, $width=null, $minsize=null) |
|
| 214 | +function gen_dstfile($src, $maxsize, $height = null, $width = null, $minsize = null) |
|
| 216 | 215 | { |
| 217 | 216 | // Use the egroupware file cache to store the thumbnails on a per instance basis |
| 218 | 217 | $cachefile = new Api\Cache\Files(array()); |
@@ -238,7 +237,7 @@ discard block |
||
| 238 | 237 | * TODO: As this is a general purpose function, it might probably be moved |
| 239 | 238 | * to some other php file or an "image utils" class. |
| 240 | 239 | */ |
| 241 | -function get_scaled_image_size($w, $h, $maxw, $maxh, $minw=0, $minh=0) |
|
| 240 | +function get_scaled_image_size($w, $h, $maxw, $maxh, $minw = 0, $minh = 0) |
|
| 242 | 241 | { |
| 243 | 242 | //Scale will contain the factor by which the image has to be scaled down |
| 244 | 243 | $scale = 1.0; |
@@ -299,7 +298,7 @@ discard block |
||
| 299 | 298 | * @param int $maxh the maximum height of the thumbnail |
| 300 | 299 | * @returns boolean|resource false or a gd_image |
| 301 | 300 | */ |
| 302 | -function gd_image_load($file,$maxw,$maxh) |
|
| 301 | +function gd_image_load($file, $maxw, $maxh) |
|
| 303 | 302 | { |
| 304 | 303 | // Get mime type |
| 305 | 304 | list($type, $image_type) = explode('/', $mime = Vfs::mime_content_type($file)); |
@@ -307,9 +306,9 @@ discard block |
||
| 307 | 306 | if (!$type) list($type, $image_type) = explode('/', $mime = Api\MimeMagic::filename2mime($file)); |
| 308 | 307 | |
| 309 | 308 | // Call the according gd constructor depending on the file type |
| 310 | - if($type == 'image') |
|
| 309 | + if ($type == 'image') |
|
| 311 | 310 | { |
| 312 | - if (in_array($image_type, array('tiff','jpeg')) && ($image = exif_thumbnail_load($file))) |
|
| 311 | + if (in_array($image_type, array('tiff', 'jpeg')) && ($image = exif_thumbnail_load($file))) |
|
| 313 | 312 | { |
| 314 | 313 | return $image; |
| 315 | 314 | } |
@@ -332,12 +331,12 @@ discard block |
||
| 332 | 331 | else if ($type == 'application') |
| 333 | 332 | { |
| 334 | 333 | $thumb = false; |
| 335 | - if(strpos($image_type,'vnd.oasis.opendocument.') === 0) |
|
| 334 | + if (strpos($image_type, 'vnd.oasis.opendocument.') === 0) |
|
| 336 | 335 | { |
| 337 | 336 | // OpenDocuments have thumbnails inside already |
| 338 | 337 | $thumb = get_opendocument_thumbnail($file); |
| 339 | 338 | } |
| 340 | - else if($image_type == 'pdf') |
|
| 339 | + else if ($image_type == 'pdf') |
|
| 341 | 340 | { |
| 342 | 341 | $thumb = get_pdf_thumbnail($file); |
| 343 | 342 | } |
@@ -347,7 +346,7 @@ discard block |
||
| 347 | 346 | //$thumb = get_msoffice_thumbnail($file); |
| 348 | 347 | } |
| 349 | 348 | // Mark it with mime type icon |
| 350 | - if($thumb) |
|
| 349 | + if ($thumb) |
|
| 351 | 350 | { |
| 352 | 351 | // Need to scale first, or the mark will be wrong size |
| 353 | 352 | $scaled = get_scaled_image_size(imagesx($thumb), imagesy($thumb), $maxw, $maxh); |
@@ -387,8 +386,8 @@ discard block |
||
| 387 | 386 | |
| 388 | 387 | // Image is already there, but we can't access them directly through VFS |
| 389 | 388 | $ext = $mimetype == 'application/vnd.oasis.opendocument.text' ? '.odt' : '.ods'; |
| 390 | - $archive = tempnam($GLOBALS['egw_info']['server']['temp_dir'], basename($file,$ext).'-'); |
|
| 391 | - copy($file,$archive); |
|
| 389 | + $archive = tempnam($GLOBALS['egw_info']['server']['temp_dir'], basename($file, $ext).'-'); |
|
| 390 | + copy($file, $archive); |
|
| 392 | 391 | |
| 393 | 392 | $thumbnail_url = 'zip://'.$archive.'#Thumbnails/thumbnail.png'; |
| 394 | 393 | $image = imagecreatefromstring(file_get_contents($thumbnail_url)); |
@@ -442,7 +441,7 @@ discard block |
||
| 442 | 441 | */ |
| 443 | 442 | function get_pdf_thumbnail($file) |
| 444 | 443 | { |
| 445 | - if(!pdf_thumbnails_available()) return false; |
|
| 444 | + if (!pdf_thumbnails_available()) return false; |
|
| 446 | 445 | |
| 447 | 446 | // switch off max_excution_time, as some thumbnails take longer and |
| 448 | 447 | // will be startet over and over again, if they dont finish |
@@ -471,7 +470,7 @@ discard block |
||
| 471 | 470 | $target_height = imagesy($target_image); |
| 472 | 471 | |
| 473 | 472 | // Find mime image, if no tag image set |
| 474 | - if(!$tag_image && $mime) |
|
| 473 | + if (!$tag_image && $mime) |
|
| 475 | 474 | { |
| 476 | 475 | list($app, $icon) = explode('/', Vfs::mime_icon($mime), 2); |
| 477 | 476 | list(, $path) = explode($GLOBALS['egw_info']['server']['webserver_url'], |
@@ -482,16 +481,16 @@ discard block |
||
| 482 | 481 | |
| 483 | 482 | // Find correct size - max 1/3 target |
| 484 | 483 | $tag_size = get_scaled_image_size(imagesx($tag_image), imagesy($tag_image), $target_width / 3, $target_height / 3); |
| 485 | - if(!$tag_size) return; |
|
| 486 | - list($tag_width,$tag_height) = $tag_size; |
|
| 484 | + if (!$tag_size) return; |
|
| 485 | + list($tag_width, $tag_height) = $tag_size; |
|
| 487 | 486 | |
| 488 | 487 | // Put it in |
| 489 | - if($mime) |
|
| 488 | + if ($mime) |
|
| 490 | 489 | { |
| 491 | - imagecopyresampled($target_image,$tag_image, |
|
| 490 | + imagecopyresampled($target_image, $tag_image, |
|
| 492 | 491 | $target_width - $tag_width, |
| 493 | 492 | $target_height - $tag_height, |
| 494 | - 0,0, |
|
| 493 | + 0, 0, |
|
| 495 | 494 | $tag_width, |
| 496 | 495 | $tag_height, |
| 497 | 496 | imagesx($tag_image), |
@@ -545,7 +544,7 @@ discard block |
||
| 545 | 544 | function gd_image_thumbnail($file, $maxw, $maxh, $minw, $minh) |
| 546 | 545 | { |
| 547 | 546 | //Load the image |
| 548 | - if (($img_src = gd_image_load($file,$maxw,$maxh)) !== false) |
|
| 547 | + if (($img_src = gd_image_load($file, $maxw, $maxh)) !== false) |
|
| 549 | 548 | { |
| 550 | 549 | //Get the constraints of the image |
| 551 | 550 | $w = imagesx($img_src); |
@@ -575,14 +574,14 @@ discard block |
||
| 575 | 574 | */ |
| 576 | 575 | function gdVersion($user_ver = 0) |
| 577 | 576 | { |
| 578 | - if (! extension_loaded('gd')) { return; } |
|
| 577 | + if (!extension_loaded('gd')) { return; } |
|
| 579 | 578 | static $gd_ver = 0; |
| 580 | 579 | |
| 581 | 580 | // Just accept the specified setting if it's 1. |
| 582 | 581 | if ($user_ver == 1) { $gd_ver = 1; return 1; } |
| 583 | 582 | |
| 584 | 583 | // Use the static variable if function was called previously. |
| 585 | - if ($user_ver !=2 && $gd_ver > 0 ) { return $gd_ver; } |
|
| 584 | + if ($user_ver != 2 && $gd_ver > 0) { return $gd_ver; } |
|
| 586 | 585 | |
| 587 | 586 | // Use the gd_info() function if possible. |
| 588 | 587 | if (function_exists('gd_info')) { |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | $etag = '"'.md5($preferences.$ab_preferences.$user).'"'; |
| 34 | 34 | |
| 35 | 35 | // headers to allow caching, egw_framework specifies etag on url to force reload, even with Expires header |
| 36 | -Api\Session::cache_control(86400); // cache for 1 day |
|
| 36 | +Api\Session::cache_control(86400); // cache for 1 day |
|
| 37 | 37 | Header('Content-Type: text/javascript; charset=utf-8'); |
| 38 | 38 | Header('ETag: '.$etag); |
| 39 | 39 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | $content .= 'egw.set_user('.$user.", egw && egw.window !== window);\n"; |
| 50 | 50 | |
| 51 | 51 | // we run our own gzip compression, to set a correct Content-Length of the encoded content |
| 52 | -if (in_array('gzip', explode(',',$_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode')) |
|
| 52 | +if (in_array('gzip', explode(',', $_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode')) |
|
| 53 | 53 | { |
| 54 | 54 | $content = gzencode($content); |
| 55 | 55 | header('Content-Encoding: gzip'); |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * @param string $config_passwd=null pw of above user |
| 24 | 24 | * @param boolean $verbose=false if true, echos out some status information during the run |
| 25 | 25 | */ |
| 26 | - function __construct($domain,$config_user=null,$config_passwd=null) |
|
| 26 | + function __construct($domain, $config_user = null, $config_passwd = null) |
|
| 27 | 27 | { |
| 28 | 28 | if (!is_array($domain)) |
| 29 | 29 | { |
@@ -45,17 +45,17 @@ discard block |
||
| 45 | 45 | * @throws Exception(lang('Wrong credentials to access the header.inc.php file!'),2); |
| 46 | 46 | * @throws Exception('header.inc.php not found!'); |
| 47 | 47 | */ |
| 48 | - protected function exec($check_only=false) |
|
| 48 | + protected function exec($check_only = false) |
|
| 49 | 49 | { |
| 50 | - if ($check_only) return true; // nothing to check, no arguments ... |
|
| 50 | + if ($check_only) return true; // nothing to check, no arguments ... |
|
| 51 | 51 | |
| 52 | 52 | // instanciate setup object and check authorisation |
| 53 | - $this->check_setup_auth($this->config_user,$this->config_passwd,$this->domain); |
|
| 53 | + $this->check_setup_auth($this->config_user, $this->config_passwd, $this->domain); |
|
| 54 | 54 | |
| 55 | - $this->check_installed($this->domain,15,$this->verbose); |
|
| 55 | + $this->check_installed($this->domain, 15, $this->verbose); |
|
| 56 | 56 | |
| 57 | 57 | global $setup_info; |
| 58 | - foreach($setup_info as $appname => $info) |
|
| 58 | + foreach ($setup_info as $appname => $info) |
|
| 59 | 59 | { |
| 60 | 60 | if ($info['currentver']) self::$egw_setup->register_hooks($appname); |
| 61 | 61 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * false: the complete header vars, plus install_id and webserver_url from the config table, |
| 33 | 33 | * null: only the header vars |
| 34 | 34 | */ |
| 35 | - function __construct($data=true,$header_admin_user=null,$header_admin_password=null) |
|
| 35 | + function __construct($data = true, $header_admin_user = null, $header_admin_password = null) |
|
| 36 | 36 | { |
| 37 | 37 | if (!is_array($data)) |
| 38 | 38 | { |
@@ -54,16 +54,16 @@ discard block |
||
| 54 | 54 | * @throws Exception(lang('Wrong credentials to access the header.inc.php file!'),2); |
| 55 | 55 | * @throws Exception('header.inc.php not found!'); |
| 56 | 56 | */ |
| 57 | - function exec($check_only=false) |
|
| 57 | + function exec($check_only = false) |
|
| 58 | 58 | { |
| 59 | - if ($this->remote_id && $check_only) return true; // cant check for the remote site locally! |
|
| 59 | + if ($this->remote_id && $check_only) return true; // cant check for the remote site locally! |
|
| 60 | 60 | |
| 61 | 61 | $this->_check_header_access(); |
| 62 | 62 | |
| 63 | 63 | if ($check_only) return true; |
| 64 | 64 | |
| 65 | 65 | $egw_info_backup = $GLOBALS['egw_info']; |
| 66 | - $GLOBALS['egw_info'] = array ( |
|
| 66 | + $GLOBALS['egw_info'] = array( |
|
| 67 | 67 | 'flags' => array( |
| 68 | 68 | 'noapi' => true, |
| 69 | 69 | ), |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | { |
| 73 | 73 | throw new Exception('header.inc.php not found!'); |
| 74 | 74 | } |
| 75 | - eval(str_replace(array('<?php','perfgetmicrotime'),array('','perfgetmicrotime2'),$header)); |
|
| 75 | + eval(str_replace(array('<?php', 'perfgetmicrotime'), array('', 'perfgetmicrotime2'), $header)); |
|
| 76 | 76 | |
| 77 | 77 | // unset the flags, they are not part of the header |
| 78 | 78 | unset($GLOBALS['egw_info']['flags']); |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | $GLOBALS['egw_info']['server']['versions']['phpgwapi'] = $egw_info_backup['server']['versions']['phpgwapi']; |
| 82 | 82 | |
| 83 | 83 | // fetching the install id's stored in the database |
| 84 | - foreach($GLOBALS['egw_domain'] as &$data) |
|
| 84 | + foreach ($GLOBALS['egw_domain'] as &$data) |
|
| 85 | 85 | { |
| 86 | 86 | if (!is_null($this->hash_only)) |
| 87 | 87 | { |
@@ -89,9 +89,9 @@ discard block |
||
| 89 | 89 | } |
| 90 | 90 | try { |
| 91 | 91 | // it's saver to only send the remote_hash and not install_id and config_pw |
| 92 | - $data['remote_hash'] = admin_cmd::remote_hash($data['install_id'],$data['config_passwd']); |
|
| 92 | + $data['remote_hash'] = admin_cmd::remote_hash($data['install_id'], $data['config_passwd']); |
|
| 93 | 93 | } |
| 94 | - catch(Exception $e) { |
|
| 94 | + catch (Exception $e) { |
|
| 95 | 95 | if ($data['install_id']) $data['error'] .= $e->getMessage(); |
| 96 | 96 | } |
| 97 | 97 | if ($this->hash_only) |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | 'remote_hash' => $data['remote_hash'], |
| 101 | 101 | 'webserver_url' => $data['webserver_url'], |
| 102 | 102 | 'install_id' => $data['install_id'], |
| 103 | - )+($data['error'] ? array( |
|
| 103 | + ) + ($data['error'] ? array( |
|
| 104 | 104 | 'error' => $data['error'], |
| 105 | 105 | ) : array()); |
| 106 | 106 | } |
@@ -133,17 +133,17 @@ discard block |
||
| 133 | 133 | { |
| 134 | 134 | $db = new Api\Db(); |
| 135 | 135 | |
| 136 | - ob_start(); // not available db connection echos a lot grab ;-) |
|
| 136 | + ob_start(); // not available db connection echos a lot grab ;-) |
|
| 137 | 137 | $err_rep = error_reporting(0); |
| 138 | 138 | |
| 139 | 139 | $config = array(); |
| 140 | 140 | try { |
| 141 | - $db->connect($data['db_name'],$data['db_host'],$data['db_port'],$data['db_user'],$data['db_pass'],$data['db_type']); |
|
| 141 | + $db->connect($data['db_name'], $data['db_host'], $data['db_port'], $data['db_user'], $data['db_pass'], $data['db_type']); |
|
| 142 | 142 | $db->set_app('phpgwapi'); |
| 143 | - $db->select('egw_config','config_name,config_value',array( |
|
| 144 | - 'config_name'=>array('install_id','webserver_url','account_repository','allow_remote_admin','mail_suffix'), |
|
| 143 | + $db->select('egw_config', 'config_name,config_value', array( |
|
| 144 | + 'config_name'=>array('install_id', 'webserver_url', 'account_repository', 'allow_remote_admin', 'mail_suffix'), |
|
| 145 | 145 | 'config_app'=>'phpgwapi', |
| 146 | - ),__LINE__,__FILE__); |
|
| 146 | + ), __LINE__, __FILE__); |
|
| 147 | 147 | while (($row = $db->row(true))) |
| 148 | 148 | { |
| 149 | 149 | $config[$row['config_name']] = $row['config_value']; |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | * @param boolean $set_modifier =true set the current user as modifier or 0 (= run by the system) |
| 168 | 168 | * @return boolean true on success, false otherwise |
| 169 | 169 | */ |
| 170 | - function save($set_modifier=true) |
|
| 170 | + function save($set_modifier = true) |
|
| 171 | 171 | { |
| 172 | 172 | if ($this->remote_id) |
| 173 | 173 | { |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * @param boolean $verbose =false if true, echos out some status information during the run |
| 31 | 31 | * @param string $app =null single application to update or install |
| 32 | 32 | */ |
| 33 | - function __construct($domain,$config_user=null,$config_passwd=null,$backup=null,$verbose=false,$app=null) |
|
| 33 | + function __construct($domain, $config_user = null, $config_passwd = null, $backup = null, $verbose = false, $app = null) |
|
| 34 | 34 | { |
| 35 | 35 | if (!is_array($domain)) |
| 36 | 36 | { |
@@ -55,32 +55,32 @@ discard block |
||
| 55 | 55 | * @throws Exception(lang('Wrong credentials to access the header.inc.php file!'),2); |
| 56 | 56 | * @throws Exception('header.inc.php not found!'); |
| 57 | 57 | */ |
| 58 | - protected function exec($check_only=false) |
|
| 58 | + protected function exec($check_only = false) |
|
| 59 | 59 | { |
| 60 | 60 | global $setup_info; |
| 61 | 61 | |
| 62 | 62 | // instanciate setup object and check authorisation |
| 63 | - $this->check_setup_auth($this->config_user,$this->config_passwd,$this->domain); |
|
| 63 | + $this->check_setup_auth($this->config_user, $this->config_passwd, $this->domain); |
|
| 64 | 64 | |
| 65 | - $this->check_installed($this->domain,array(14),$this->verbose); |
|
| 65 | + $this->check_installed($this->domain, array(14), $this->verbose); |
|
| 66 | 66 | |
| 67 | 67 | if ($GLOBALS['egw_info']['setup']['stage']['db'] != 4 && |
| 68 | 68 | (!$this->app || !in_array($this->app, self::$apps_to_install) && !in_array($this->app, self::$apps_to_upgrade)) && |
| 69 | 69 | !self::check_autoinstall()) |
| 70 | 70 | { |
| 71 | - return lang('No update necessary, domain %1(%2) is up to date.',$this->domain,$GLOBALS['egw_domain'][$this->domain]['db_type']); |
|
| 71 | + return lang('No update necessary, domain %1(%2) is up to date.', $this->domain, $GLOBALS['egw_domain'][$this->domain]['db_type']); |
|
| 72 | 72 | } |
| 73 | 73 | if ($check_only) return lang('Update necessary.'); |
| 74 | 74 | |
| 75 | 75 | $setup_info = self::$egw_setup->detection->upgrade_exclude($setup_info); |
| 76 | 76 | |
| 77 | - self::$egw_setup->process->init_process(); // we need a new schema-proc instance for each new domain |
|
| 77 | + self::$egw_setup->process->init_process(); // we need a new schema-proc instance for each new domain |
|
| 78 | 78 | |
| 79 | 79 | // request to install a single app |
| 80 | 80 | if ($this->app && in_array($this->app, self::$apps_to_install)) |
| 81 | 81 | { |
| 82 | 82 | $app_title = $setup_info[$this->app]['title'] ? $setup_info[$this->app]['title'] : $setup_info[$this->app]['name']; |
| 83 | - self::_echo_message($this->verbose,lang('Start installing application %1 ...',$app_title)); |
|
| 83 | + self::_echo_message($this->verbose, lang('Start installing application %1 ...', $app_title)); |
|
| 84 | 84 | ob_start(); |
| 85 | 85 | $terror = array($this->app => $setup_info[$this->app]); |
| 86 | 86 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | { |
| 89 | 89 | $errors = self::$egw_setup->process->current($terror, $this->verbose); |
| 90 | 90 | $terror = self::$egw_setup->process->default_records($errors, $this->verbose); |
| 91 | - echo $app_title . ' ' . lang('tables installed, unless there are errors printed above') . '.'; |
|
| 91 | + echo $app_title.' '.lang('tables installed, unless there are errors printed above').'.'; |
|
| 92 | 92 | } |
| 93 | 93 | else |
| 94 | 94 | { |
@@ -102,20 +102,20 @@ discard block |
||
| 102 | 102 | { |
| 103 | 103 | self::$egw_setup->register_app($setup_info[$this->app]['name']); |
| 104 | 104 | } |
| 105 | - echo $app_title . ' ' . lang('registered') . '.'; |
|
| 105 | + echo $app_title.' '.lang('registered').'.'; |
|
| 106 | 106 | |
| 107 | 107 | if ($setup_info[$this->app]['hooks']) |
| 108 | 108 | { |
| 109 | 109 | self::$egw_setup->register_hooks($setup_info[$this->app]['name']); |
| 110 | - echo "\n".$app_title . ' ' . lang('hooks registered') . '.'; |
|
| 110 | + echo "\n".$app_title.' '.lang('hooks registered').'.'; |
|
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | 113 | } |
| 114 | 114 | else |
| 115 | 115 | { |
| 116 | - self::_echo_message($this->verbose,lang('Start updating the database ...')); |
|
| 116 | + self::_echo_message($this->verbose, lang('Start updating the database ...')); |
|
| 117 | 117 | ob_start(); |
| 118 | - self::$egw_setup->process->pass($setup_info,'upgrade',false); |
|
| 118 | + self::$egw_setup->process->pass($setup_info, 'upgrade', false); |
|
| 119 | 119 | } |
| 120 | 120 | $messages = ob_get_contents(); |
| 121 | 121 | ob_end_clean(); |
@@ -38,8 +38,8 @@ discard block |
||
| 38 | 38 | * @param array $config =array() extra config for the account object: account_repository, ldap_* |
| 39 | 39 | * @param string $lang ='en' |
| 40 | 40 | */ |
| 41 | - function __construct($domain,$config_user=null,$config_passwd=null,$admin_user=null,$admin_password=null, |
|
| 42 | - $admin_firstname=null,$admin_lastname=null,$admin_email=null,array $config=array(),$lang='en') |
|
| 41 | + function __construct($domain, $config_user = null, $config_passwd = null, $admin_user = null, $admin_password = null, |
|
| 42 | + $admin_firstname = null, $admin_lastname = null, $admin_email = null, array $config = array(), $lang = 'en') |
|
| 43 | 43 | { |
| 44 | 44 | if (!is_array($domain)) |
| 45 | 45 | { |
@@ -68,21 +68,21 @@ discard block |
||
| 68 | 68 | * @throws Exception(lang('Wrong credentials to access the header.inc.php file!'),2); |
| 69 | 69 | * @throws Exception('header.inc.php not found!'); |
| 70 | 70 | */ |
| 71 | - protected function exec($check_only=false) |
|
| 71 | + protected function exec($check_only = false) |
|
| 72 | 72 | { |
| 73 | 73 | if ($check_only && $this->remote_id) |
| 74 | 74 | { |
| 75 | - return true; // can only check locally |
|
| 75 | + return true; // can only check locally |
|
| 76 | 76 | } |
| 77 | - $this->check_installed($this->domain,15); |
|
| 77 | + $this->check_installed($this->domain, 15); |
|
| 78 | 78 | |
| 79 | 79 | if (!$this->admin_firstname) $this->set_defaults['admin_firstname'] = $this->admin_firstname = lang('Admin'); |
| 80 | 80 | if (!$this->admin_lastname) $this->set_defaults['admin_lastname'] = $this->admin_lastname = lang('User'); |
| 81 | - if (strpos($this->admin_email,'$') !== false) |
|
| 81 | + if (strpos($this->admin_email, '$') !== false) |
|
| 82 | 82 | { |
| 83 | 83 | $this->set_defaults['email'] = $this->admin_email = str_replace( |
| 84 | - array('$domain','$uid','$account_lid'), |
|
| 85 | - array($this->domain,$this->admin_user,$this->admin_user),$this->admin_email); |
|
| 84 | + array('$domain', '$uid', '$account_lid'), |
|
| 85 | + array($this->domain, $this->admin_user, $this->admin_user), $this->admin_email); |
|
| 86 | 86 | } |
| 87 | 87 | $_POST['username'] = $this->admin_user; |
| 88 | 88 | $_POST['passwd2'] = $_POST['passwd'] = $this->admin_password; |
@@ -99,9 +99,9 @@ discard block |
||
| 99 | 99 | switch ($error) |
| 100 | 100 | { |
| 101 | 101 | case 41: |
| 102 | - throw new Api\Exception\WrongUserinput(lang('Error in admin-creation !!!'),41); |
|
| 102 | + throw new Api\Exception\WrongUserinput(lang('Error in admin-creation !!!'), 41); |
|
| 103 | 103 | case 42: |
| 104 | - throw new Api\Exception\WrongUserinput(lang('Error in group-creation !!!'),42); |
|
| 104 | + throw new Api\Exception\WrongUserinput(lang('Error in group-creation !!!'), 42); |
|
| 105 | 105 | } |
| 106 | 106 | $this->restore_db(); |
| 107 | 107 | |
@@ -112,13 +112,13 @@ discard block |
||
| 112 | 112 | if (php_sapi_name() !== 'cli' || !file_exists(EGW_SERVER_ROOT.'/stylite') || file_exists(EGW_SERVER_ROOT.'/managementserver')) |
| 113 | 113 | { |
| 114 | 114 | $output = $ret = null; |
| 115 | - exec($cmd,$output,$ret); |
|
| 115 | + exec($cmd, $output, $ret); |
|
| 116 | 116 | } |
| 117 | - $output = implode("\n",$output); |
|
| 117 | + $output = implode("\n", $output); |
|
| 118 | 118 | //echo "ret=$ret\n".$output; |
| 119 | 119 | if ($ret) |
| 120 | 120 | { |
| 121 | - throw new Api\Exception ($output,$ret); |
|
| 121 | + throw new Api\Exception($output, $ret); |
|
| 122 | 122 | } |
| 123 | 123 | return lang('Admin account successful created.'); |
| 124 | 124 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * @version $Id$ |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -chdir(dirname(__FILE__)); // to enable our relative pathes to work |
|
| 14 | +chdir(dirname(__FILE__)); // to enable our relative pathes to work |
|
| 15 | 15 | |
| 16 | 16 | if (php_sapi_name() !== 'cli') // security precaution: forbit calling as web-page |
| 17 | 17 | { |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | } |
| 40 | 40 | $ids = explode(',', $_SERVER['argv'][0]); |
| 41 | 41 | $change = array(); |
| 42 | -while($ids) |
|
| 42 | +while ($ids) |
|
| 43 | 43 | { |
| 44 | 44 | $from = (int)array_shift($ids); |
| 45 | 45 | $to = (int)array_shift($ids); |
@@ -66,24 +66,24 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | chown_grp($path, null, $recursive); |
| 68 | 68 | |
| 69 | -function chown_grp($path, array $stat=null, $recursive=false) |
|
| 69 | +function chown_grp($path, array $stat = null, $recursive = false) |
|
| 70 | 70 | { |
| 71 | 71 | global $change; |
| 72 | 72 | |
| 73 | 73 | if (is_null($stat) && !($stat = stat($path))) return false; |
| 74 | 74 | |
| 75 | - if (isset($change[$stat['uid']]) && !chown($path, $uid=$change[$stat['uid']])) |
|
| 75 | + if (isset($change[$stat['uid']]) && !chown($path, $uid = $change[$stat['uid']])) |
|
| 76 | 76 | { |
| 77 | 77 | echo "Faild to set new owner #$uid for $path\n"; |
| 78 | 78 | } |
| 79 | - if (isset($change[-$stat['gid']]) && !chgrp($path, $gid=-$change[-$stat['gid']])) |
|
| 79 | + if (isset($change[-$stat['gid']]) && !chgrp($path, $gid = -$change[-$stat['gid']])) |
|
| 80 | 80 | { |
| 81 | 81 | echo "Faild to set new group #$gid for $path\n"; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | if ($recursive && is_dir($path)) |
| 85 | 85 | { |
| 86 | - foreach(new DirectoryIterator($path) as $child) |
|
| 86 | + foreach (new DirectoryIterator($path) as $child) |
|
| 87 | 87 | { |
| 88 | 88 | if (!$child->isDot()) |
| 89 | 89 | chown_grp($child->getPathname(), array( |
@@ -12,15 +12,15 @@ |
||
| 12 | 12 | $phpgw_baseline = array( |
| 13 | 13 | 'egw_importexport_definitions' => array( |
| 14 | 14 | 'fd' => array( |
| 15 | - 'definition_id' => array('type' => 'auto','nullable' => False), |
|
| 16 | - 'name' => array('type' => 'varchar','precision' => '255'), |
|
| 17 | - 'application' => array('type' => 'varchar','precision' => '50'), |
|
| 18 | - 'plugin' => array('type' => 'varchar','precision' => '100'), |
|
| 19 | - 'type' => array('type' => 'varchar','precision' => '20'), |
|
| 20 | - 'allowed_users' => array('type' => 'varchar','meta' => 'account-commasep','precision' => '255'), |
|
| 15 | + 'definition_id' => array('type' => 'auto', 'nullable' => False), |
|
| 16 | + 'name' => array('type' => 'varchar', 'precision' => '255'), |
|
| 17 | + 'application' => array('type' => 'varchar', 'precision' => '50'), |
|
| 18 | + 'plugin' => array('type' => 'varchar', 'precision' => '100'), |
|
| 19 | + 'type' => array('type' => 'varchar', 'precision' => '20'), |
|
| 20 | + 'allowed_users' => array('type' => 'varchar', 'meta' => 'account-commasep', 'precision' => '255'), |
|
| 21 | 21 | 'plugin_options' => array('type' => 'longtext'), |
| 22 | - 'owner' => array('type' => 'int','meta' => 'account','precision' => '4'), |
|
| 23 | - 'description' => array('type' => 'varchar','precision' => '255'), |
|
| 22 | + 'owner' => array('type' => 'int', 'meta' => 'account', 'precision' => '4'), |
|
| 23 | + 'description' => array('type' => 'varchar', 'precision' => '255'), |
|
| 24 | 24 | 'modified' => array('type' => 'timestamp'), |
| 25 | 25 | 'filter' => array('type' => 'longtext') |
| 26 | 26 | ), |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | function importexport_upgrade0_002() |
| 15 | 15 | { |
| 16 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_importexport_definitions','description',array( |
|
| 16 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_importexport_definitions', 'description', array( |
|
| 17 | 17 | 'type' => 'varchar', |
| 18 | 18 | 'precision' => '255' |
| 19 | 19 | )); |
@@ -44,11 +44,11 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | function importexport_upgrade1_8() |
| 46 | 46 | { |
| 47 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_importexport_definitions','definition_id',array( |
|
| 47 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_importexport_definitions', 'definition_id', array( |
|
| 48 | 48 | 'type' => 'auto', |
| 49 | 49 | 'nullable' => False |
| 50 | 50 | )); |
| 51 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_importexport_definitions','modified',array( |
|
| 51 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_importexport_definitions', 'modified', array( |
|
| 52 | 52 | 'type' => 'timestamp' |
| 53 | 53 | )); |
| 54 | 54 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | function importexport_upgrade1_9_002() |
| 65 | 65 | { |
| 66 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_importexport_definitions','filter',array( |
|
| 66 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_importexport_definitions', 'filter', array( |
|
| 67 | 67 | 'type' => 'longtext' |
| 68 | 68 | )); |
| 69 | 69 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | // import i/e defintions |
| 75 | 75 | if (extension_loaded('dom')) |
| 76 | 76 | { |
| 77 | - require_once(EGW_INCLUDE_ROOT. '/importexport/inc/class.importexport_definitions_bo.inc.php'); |
|
| 77 | + require_once(EGW_INCLUDE_ROOT.'/importexport/inc/class.importexport_definitions_bo.inc.php'); |
|
| 78 | 78 | |
| 79 | 79 | // This sets up $GLOBALS['egw']->accounts and $GLOBALS['egw']->db |
| 80 | 80 | $GLOBALS['egw_setup']->setup_account_object(); |
@@ -82,18 +82,18 @@ discard block |
||
| 82 | 82 | // step through every source code intstalled app |
| 83 | 83 | $egwdir = dir(EGW_INCLUDE_ROOT); |
| 84 | 84 | while (false !== ($appdir = $egwdir->read())) { |
| 85 | - $defdir = EGW_INCLUDE_ROOT. "/$appdir/setup/"; |
|
| 86 | - if ( !is_dir( $defdir ) ) continue; |
|
| 85 | + $defdir = EGW_INCLUDE_ROOT."/$appdir/setup/"; |
|
| 86 | + if (!is_dir($defdir)) continue; |
|
| 87 | 87 | |
| 88 | 88 | // step through each file in defdir of app |
| 89 | 89 | $d = dir($defdir); |
| 90 | 90 | while (false !== ($entry = $d->read())) { |
| 91 | 91 | try |
| 92 | 92 | { |
| 93 | - $file = $defdir. '/'. $entry; |
|
| 94 | - list( $filename, $extension) = explode('.',$entry); |
|
| 95 | - if ( $extension != 'xml' ) continue; |
|
| 96 | - importexport_definitions_bo::import( $file ); |
|
| 93 | + $file = $defdir.'/'.$entry; |
|
| 94 | + list($filename, $extension) = explode('.', $entry); |
|
| 95 | + if ($extension != 'xml') continue; |
|
| 96 | + importexport_definitions_bo::import($file); |
|
| 97 | 97 | } |
| 98 | 98 | catch (Exception $e) |
| 99 | 99 | { |
@@ -104,10 +104,10 @@ discard block |
||
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | // give Default and Admins group rights for ImportExport |
| 107 | - foreach(array('Default' => 'Default','Admins' => 'Admin') as $account_lid => $name) |
|
| 107 | + foreach (array('Default' => 'Default', 'Admins' => 'Admin') as $account_lid => $name) |
|
| 108 | 108 | { |
| 109 | - $account_id = $GLOBALS['egw_setup']->add_account($account_lid,$name,'Group',False,False); |
|
| 110 | - $GLOBALS['egw_setup']->add_acl('importexport','run',$account_id); |
|
| 109 | + $account_id = $GLOBALS['egw_setup']->add_account($account_lid, $name, 'Group', False, False); |
|
| 110 | + $GLOBALS['egw_setup']->add_acl('importexport', 'run', $account_id); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | return $GLOBALS['setup_info']['importexport']['currentver'] = '1.9.004'; |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | function importexport_upgrade1_9_003() |
| 117 | 117 | { |
| 118 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_importexport_definitions','filter',array( |
|
| 118 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_importexport_definitions', 'filter', array( |
|
| 119 | 119 | 'type' => 'longtext' |
| 120 | 120 | )); |
| 121 | 121 | |