@@ -13,13 +13,13 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | if (!defined('TIMESHEET_APP')) |
| 15 | 15 | { |
| 16 | - define('TIMESHEET_APP','timesheet'); |
|
| 16 | + define('TIMESHEET_APP', 'timesheet'); |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | $setup_info[TIMESHEET_APP]['name'] = TIMESHEET_APP; |
| 20 | 20 | $setup_info[TIMESHEET_APP]['version'] = '17.1.001'; |
| 21 | 21 | $setup_info[TIMESHEET_APP]['app_order'] = 5; |
| 22 | -$setup_info[TIMESHEET_APP]['tables'] = array('egw_timesheet','egw_timesheet_extra'); |
|
| 22 | +$setup_info[TIMESHEET_APP]['tables'] = array('egw_timesheet', 'egw_timesheet_extra'); |
|
| 23 | 23 | $setup_info[TIMESHEET_APP]['enable'] = 1; |
| 24 | 24 | $setup_info[TIMESHEET_APP]['index'] = 'timesheet.timesheet_ui.index&ajax=true'; |
| 25 | 25 | |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | 'name' => 'Ralf Becker', |
| 29 | 29 | 'email' => '[email protected]' |
| 30 | 30 | ); |
| 31 | -$setup_info[TIMESHEET_APP]['license'] = 'GPL'; |
|
| 31 | +$setup_info[TIMESHEET_APP]['license'] = 'GPL'; |
|
| 32 | 32 | $setup_info[TIMESHEET_APP]['description'] = |
| 33 | 33 | 'Tracking times and other activities for the Projectmanager.'; |
| 34 | 34 | $setup_info[TIMESHEET_APP]['note'] = |
@@ -49,5 +49,5 @@ |
||
| 49 | 49 | /* Dependencies for this app to work */ |
| 50 | 50 | $setup_info[TIMESHEET_APP]['depends'][] = array( |
| 51 | 51 | 'appname' => 'api', |
| 52 | - 'versions' => Array('17.1') |
|
| 52 | + 'versions' => array('17.1') |
|
| 53 | 53 | ); |
@@ -169,7 +169,10 @@ discard block |
||
| 169 | 169 | $files[] = Vfs::concat($content['path'],$name); |
| 170 | 170 | } |
| 171 | 171 | //Add an uploaded file to the files result array2string |
| 172 | - if ($copy_result === true) $files[] = $to_path; |
|
| 172 | + if ($copy_result === true) |
|
| 173 | + { |
|
| 174 | + $files[] = $to_path; |
|
| 175 | + } |
|
| 173 | 176 | break; |
| 174 | 177 | |
| 175 | 178 | case 'select-dir': |
@@ -193,7 +196,10 @@ discard block |
||
| 193 | 196 | else if ($content['method'] == 'ckeditor_return') |
| 194 | 197 | { |
| 195 | 198 | $download_url = Vfs::download_url(Vfs::concat($content['path'],$content['name'])); |
| 196 | - if ($download_url[0] == '/') $download_url = Egw::link($download_url); |
|
| 199 | + if ($download_url[0] == '/') |
|
| 200 | + { |
|
| 201 | + $download_url = Egw::link($download_url); |
|
| 202 | + } |
|
| 197 | 203 | |
| 198 | 204 | $response = Api\Json\Response::get(); |
| 199 | 205 | $response->apply('window.opener.CKEDITOR.tools.callFunction', array( |
@@ -228,7 +234,10 @@ discard block |
||
| 228 | 234 | elseif(isset($content['apps'])) |
| 229 | 235 | { |
| 230 | 236 | list($app) = each($content['apps']); |
| 231 | - if ($app == 'home') $content['path'] = filemanager_ui::get_home_dir(); |
|
| 237 | + if ($app == 'home') |
|
| 238 | + { |
|
| 239 | + $content['path'] = filemanager_ui::get_home_dir(); |
|
| 240 | + } |
|
| 232 | 241 | } |
| 233 | 242 | |
| 234 | 243 | //Deactivate the opload field if the current directory is not writeable or |
@@ -262,8 +271,15 @@ discard block |
||
| 262 | 271 | { |
| 263 | 272 | $path = $favorite['state']['path']; |
| 264 | 273 | // Just directories |
| 265 | - if(!$path) continue; |
|
| 266 | - if ($path == $content['path']) continue; // remove directory itself |
|
| 274 | + if(!$path) |
|
| 275 | + { |
|
| 276 | + continue; |
|
| 277 | + } |
|
| 278 | + if ($path == $content['path']) |
|
| 279 | + { |
|
| 280 | + continue; |
|
| 281 | + } |
|
| 282 | + // remove directory itself |
|
| 267 | 283 | |
| 268 | 284 | $mime = Vfs::mime_content_type($path); |
| 269 | 285 | $content['dir'][$n] = array( |
@@ -294,7 +310,11 @@ discard block |
||
| 294 | 310 | $content['dir'] = array('mode' => $content['mode']); |
| 295 | 311 | foreach($files as $path) |
| 296 | 312 | { |
| 297 | - if ($path == $content['path']) continue; // remove directory itself |
|
| 313 | + if ($path == $content['path']) |
|
| 314 | + { |
|
| 315 | + continue; |
|
| 316 | + } |
|
| 317 | + // remove directory itself |
|
| 298 | 318 | |
| 299 | 319 | $name = Vfs::basename($path); |
| 300 | 320 | $is_dir = Vfs::is_dir($path); |
@@ -315,7 +335,11 @@ discard block |
||
| 315 | 335 | } |
| 316 | 336 | ++$n; |
| 317 | 337 | } |
| 318 | - if (!$n) $readonlys['selected[]'] = true; // remove checkbox from empty line |
|
| 338 | + if (!$n) |
|
| 339 | + { |
|
| 340 | + $readonlys['selected[]'] = true; |
|
| 341 | + } |
|
| 342 | + // remove checkbox from empty line |
|
| 319 | 343 | } |
| 320 | 344 | $readonlys['button[createdir]'] = !Vfs::is_writable($content['path']); |
| 321 | 345 | |
@@ -353,7 +377,10 @@ discard block |
||
| 353 | 377 | static function get_apps() |
| 354 | 378 | { |
| 355 | 379 | $apps = array(false); // index starting from 1 |
| 356 | - if (isset($GLOBALS['egw_info']['apps']['stylite'])) $apps = array('favorites' => lang('Favorites')); |
|
| 380 | + if (isset($GLOBALS['egw_info']['apps']['stylite'])) |
|
| 381 | + { |
|
| 382 | + $apps = array('favorites' => lang('Favorites')); |
|
| 383 | + } |
|
| 357 | 384 | $apps += Link::app_list('query'); |
| 358 | 385 | |
| 359 | 386 | unset($apps['mydms']); // they do NOT support adding files to VFS |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | * |
| 73 | 73 | * @deprecated Please use et2_vfsSelect widget in client side instead |
| 74 | 74 | */ |
| 75 | - function select(array $content=null) |
|
| 75 | + function select(array $content = null) |
|
| 76 | 76 | { |
| 77 | 77 | if (!is_array($content)) |
| 78 | 78 | { |
@@ -83,10 +83,10 @@ discard block |
||
| 83 | 83 | $content['msg'] = $_GET['msg']; |
| 84 | 84 | $_GET['mode'] = 'open'; |
| 85 | 85 | $_GET['method'] = 'ckeditor_return'; |
| 86 | - $_GET['CKEditorFuncNum'] = Api\Cache::getSession('filemanager','ckeditorfuncnum'); |
|
| 86 | + $_GET['CKEditorFuncNum'] = Api\Cache::getSession('filemanager', 'ckeditorfuncnum'); |
|
| 87 | 87 | } |
| 88 | 88 | $content['mode'] = $_GET['mode']; |
| 89 | - if (!in_array($content['mode'],array('open','open-multiple','saveas','select-dir'))) |
|
| 89 | + if (!in_array($content['mode'], array('open', 'open-multiple', 'saveas', 'select-dir'))) |
|
| 90 | 90 | { |
| 91 | 91 | throw new Api\Exception\WrongParameter("Wrong or unset required mode parameter!"); |
| 92 | 92 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | { |
| 102 | 102 | if (isset($_GET['CKEditorFuncNum']) && is_numeric($_GET['CKEditorFuncNum'])) |
| 103 | 103 | { |
| 104 | - Api\Cache::setSession('filemanager','ckeditorfuncnum', |
|
| 104 | + Api\Cache::setSession('filemanager', 'ckeditorfuncnum', |
|
| 105 | 105 | $content['ckeditorfuncnum'] = $_GET['CKEditorFuncNum']); |
| 106 | 106 | } |
| 107 | 107 | else |
@@ -109,20 +109,20 @@ discard block |
||
| 109 | 109 | throw new Api\Exception\WrongParameter("chkeditor_return has been specified as a method but some parameters are missing or invalid."); |
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | - $content['id'] = $_GET['id']; |
|
| 112 | + $content['id'] = $_GET['id']; |
|
| 113 | 113 | $content['label'] = isset($_GET['label']) ? $_GET['label'] : lang('Open'); |
| 114 | 114 | if (($content['options-mime'] = isset($_GET['mime']))) |
| 115 | 115 | { |
| 116 | 116 | $sel_options['mime'] = array(); |
| 117 | - foreach((array)$_GET['mime'] as $key => $value) |
|
| 117 | + foreach ((array)$_GET['mime'] as $key => $value) |
|
| 118 | 118 | { |
| 119 | 119 | if (is_numeric($key)) |
| 120 | 120 | { |
| 121 | - $sel_options['mime'][$value] = lang('%1 files',strtoupper(Api\MimeMagic::mime2ext($value))).' ('.$value.')'; |
|
| 121 | + $sel_options['mime'][$value] = lang('%1 files', strtoupper(Api\MimeMagic::mime2ext($value))).' ('.$value.')'; |
|
| 122 | 122 | } |
| 123 | 123 | else |
| 124 | 124 | { |
| 125 | - $sel_options['mime'][$key] = lang('%1 files',strtoupper($value)).' ('.$key.')'; |
|
| 125 | + $sel_options['mime'][$key] = lang('%1 files', strtoupper($value)).' ('.$key.')'; |
|
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 128 | |
@@ -130,11 +130,11 @@ discard block |
||
| 130 | 130 | error_log(array2string($content['options-mime'])); |
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | - elseif(isset($content['button'])) |
|
| 133 | + elseif (isset($content['button'])) |
|
| 134 | 134 | { |
| 135 | 135 | list($button) = each($content['button']); |
| 136 | 136 | unset($content['button']); |
| 137 | - switch($button) |
|
| 137 | + switch ($button) |
|
| 138 | 138 | { |
| 139 | 139 | case 'home': |
| 140 | 140 | $content['path'] = filemanager_ui::get_home_dir(); |
@@ -146,10 +146,10 @@ discard block |
||
| 146 | 146 | //Set the "content" name filed accordingly to the uploaded file |
| 147 | 147 | // encode chars which special meaning in url/vfs (some like / get removed!) |
| 148 | 148 | $content['name'] = Vfs::encodePathComponent($content['file_upload']['name']); |
| 149 | - $to_path = Vfs::concat($content['path'],$content['name']); |
|
| 149 | + $to_path = Vfs::concat($content['path'], $content['name']); |
|
| 150 | 150 | |
| 151 | 151 | $copy_result = (Vfs::is_writable($content['path']) || Vfs::is_writable($to_path)) && |
| 152 | - copy($content['file_upload']['tmp_name'],Vfs::PREFIX.$to_path); |
|
| 152 | + copy($content['file_upload']['tmp_name'], Vfs::PREFIX.$to_path); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | //Break on an error condition |
@@ -168,12 +168,12 @@ discard block |
||
| 168 | 168 | break; |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - switch($content['mode']) |
|
| 171 | + switch ($content['mode']) |
|
| 172 | 172 | { |
| 173 | 173 | case 'open-multiple': |
| 174 | - foreach((array)$content['dir']['selected'] as $name) |
|
| 174 | + foreach ((array)$content['dir']['selected'] as $name) |
|
| 175 | 175 | { |
| 176 | - $files[] = Vfs::concat($content['path'],$name); |
|
| 176 | + $files[] = Vfs::concat($content['path'], $name); |
|
| 177 | 177 | } |
| 178 | 178 | //Add an uploaded file to the files result array2string |
| 179 | 179 | if ($copy_result === true) $files[] = $to_path; |
@@ -189,17 +189,17 @@ discard block |
||
| 189 | 189 | // Fall through |
| 190 | 190 | |
| 191 | 191 | default: |
| 192 | - $files = Vfs::concat($content['path'],$content['name']); |
|
| 192 | + $files = Vfs::concat($content['path'], $content['name']); |
|
| 193 | 193 | break; |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | if ($content['method'] && $content['method'] != 'ckeditor_return') |
| 197 | 197 | { |
| 198 | - $js = ExecMethod2($content['method'],$content['id'],$files); |
|
| 198 | + $js = ExecMethod2($content['method'], $content['id'], $files); |
|
| 199 | 199 | } |
| 200 | 200 | else if ($content['method'] == 'ckeditor_return') |
| 201 | 201 | { |
| 202 | - $download_url = Vfs::download_url(Vfs::concat($content['path'],$content['name'])); |
|
| 202 | + $download_url = Vfs::download_url(Vfs::concat($content['path'], $content['name'])); |
|
| 203 | 203 | if ($download_url[0] == '/') $download_url = Egw::link($download_url); |
| 204 | 204 | |
| 205 | 205 | $response = Api\Json\Response::get(); |
@@ -210,16 +210,16 @@ discard block |
||
| 210 | 210 | Framework::window_close(); |
| 211 | 211 | exit(); |
| 212 | 212 | } |
| 213 | - if(Api\Json\Response::isJSONResponse()) |
|
| 213 | + if (Api\Json\Response::isJSONResponse()) |
|
| 214 | 214 | { |
| 215 | 215 | $response = Api\Json\Response::get(); |
| 216 | - if($js) |
|
| 216 | + if ($js) |
|
| 217 | 217 | { |
| 218 | 218 | $response->script($js); |
| 219 | 219 | } |
| 220 | 220 | // Ahh! |
| 221 | 221 | // The vfs-select widget looks for this |
| 222 | - $response->script('this.selected_files = '.json_encode($files) . ';'); |
|
| 222 | + $response->script('this.selected_files = '.json_encode($files).';'); |
|
| 223 | 223 | Framework::window_close(); |
| 224 | 224 | } |
| 225 | 225 | else |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | |
| 233 | 233 | $sel_options['mime'] = $content['options-mime']; |
| 234 | 234 | } |
| 235 | - elseif(isset($content['apps'])) |
|
| 235 | + elseif (isset($content['apps'])) |
|
| 236 | 236 | { |
| 237 | 237 | list($app) = each($content['apps']); |
| 238 | 238 | if ($app == 'home') $content['path'] = filemanager_ui::get_home_dir(); |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | //Deactivate the opload field if the current directory is not writeable or |
| 242 | 242 | //we're currently not in the single file open mode. |
| 243 | 243 | $content['no_upload'] = !Vfs::is_writable($content['path']) || |
| 244 | - !in_array($content['mode'],array('open')); |
|
| 244 | + !in_array($content['mode'], array('open')); |
|
| 245 | 245 | |
| 246 | 246 | $content['apps'] = array_keys(self::get_apps()); |
| 247 | 247 | |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | // Set a flag for easy detection as we go |
| 254 | - $favorites_flag = substr($content['path'],0,strlen('/apps/favorites')) == '/apps/favorites'; |
|
| 254 | + $favorites_flag = substr($content['path'], 0, strlen('/apps/favorites')) == '/apps/favorites'; |
|
| 255 | 255 | |
| 256 | 256 | if (!$favorites_flag && (!$content['path'] || !Vfs::is_dir($content['path']))) |
| 257 | 257 | { |
@@ -265,12 +265,12 @@ discard block |
||
| 265 | 265 | $files = array(); |
| 266 | 266 | $favorites = Framework\Favorites::get_favorites('filemanager'); |
| 267 | 267 | $n = 0; |
| 268 | - foreach($favorites as $favorite) |
|
| 268 | + foreach ($favorites as $favorite) |
|
| 269 | 269 | { |
| 270 | 270 | $path = $favorite['state']['path']; |
| 271 | 271 | // Just directories |
| 272 | - if(!$path) continue; |
|
| 273 | - if ($path == $content['path']) continue; // remove directory itself |
|
| 272 | + if (!$path) continue; |
|
| 273 | + if ($path == $content['path']) continue; // remove directory itself |
|
| 274 | 274 | |
| 275 | 275 | $mime = Vfs::mime_content_type($path); |
| 276 | 276 | $content['dir'][$n] = array( |
@@ -286,29 +286,29 @@ discard block |
||
| 286 | 286 | ++$n; |
| 287 | 287 | } |
| 288 | 288 | } |
| 289 | - else if (!($files = Vfs::find($content['path'],array( |
|
| 289 | + else if (!($files = Vfs::find($content['path'], array( |
|
| 290 | 290 | 'dirsontop' => true, |
| 291 | 291 | 'order' => 'name', |
| 292 | 292 | 'sort' => 'ASC', |
| 293 | 293 | 'maxdepth' => 1, |
| 294 | 294 | )))) |
| 295 | 295 | { |
| 296 | - $content['msg'] = lang("Can't open directory %1!",$content['path']); |
|
| 296 | + $content['msg'] = lang("Can't open directory %1!", $content['path']); |
|
| 297 | 297 | } |
| 298 | 298 | else |
| 299 | 299 | { |
| 300 | 300 | $n = 0; |
| 301 | 301 | $content['dir'] = array('mode' => $content['mode']); |
| 302 | - foreach($files as $path) |
|
| 302 | + foreach ($files as $path) |
|
| 303 | 303 | { |
| 304 | - if ($path == $content['path']) continue; // remove directory itself |
|
| 304 | + if ($path == $content['path']) continue; // remove directory itself |
|
| 305 | 305 | |
| 306 | 306 | $name = Vfs::basename($path); |
| 307 | 307 | $is_dir = Vfs::is_dir($path); |
| 308 | 308 | $mime = Vfs::mime_content_type($path); |
| 309 | 309 | if ($content['mime'] && !$is_dir && $mime != $content['mime']) |
| 310 | 310 | { |
| 311 | - continue; // does not match mime-filter --> ignore |
|
| 311 | + continue; // does not match mime-filter --> ignore |
|
| 312 | 312 | } |
| 313 | 313 | $content['dir'][$n] = array( |
| 314 | 314 | 'name' => $name, |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | } |
| 323 | 323 | ++$n; |
| 324 | 324 | } |
| 325 | - if (!$n) $readonlys['selected[]'] = true; // remove checkbox from empty line |
|
| 325 | + if (!$n) $readonlys['selected[]'] = true; // remove checkbox from empty line |
|
| 326 | 326 | } |
| 327 | 327 | $readonlys['button[createdir]'] = !Vfs::is_writable($content['path']); |
| 328 | 328 | |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | { |
| 350 | 350 | Api\Header\ContentSecurityPolicy::add('script-src', 'unsafe-inline'); |
| 351 | 351 | } |
| 352 | - $tpl->exec('filemanager.filemanager_select.select',$content,$sel_options,$readonlys,$preserve,2); |
|
| 352 | + $tpl->exec('filemanager.filemanager_select.select', $content, $sel_options, $readonlys, $preserve, 2); |
|
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | /** |
@@ -359,11 +359,11 @@ discard block |
||
| 359 | 359 | */ |
| 360 | 360 | static function get_apps() |
| 361 | 361 | { |
| 362 | - $apps = array(false); // index starting from 1 |
|
| 362 | + $apps = array(false); // index starting from 1 |
|
| 363 | 363 | if (isset($GLOBALS['egw_info']['apps']['stylite'])) $apps = array('favorites' => lang('Favorites')); |
| 364 | 364 | $apps += Link::app_list('query'); |
| 365 | 365 | |
| 366 | - unset($apps['mydms']); // they do NOT support adding files to VFS |
|
| 366 | + unset($apps['mydms']); // they do NOT support adding files to VFS |
|
| 367 | 367 | unset($apps['wiki']); |
| 368 | 368 | unset($apps['api-accounts']); |
| 369 | 369 | unset($apps['addressbook-email']); |
@@ -95,7 +95,11 @@ |
||
| 95 | 95 | { |
| 96 | 96 | throw new Api\Exception\WrongUserinput(lang("'%1' is no valid domain name!",$this->domain)); |
| 97 | 97 | } |
| 98 | - if ($this->remote_id && $check_only) return true; // further checks can only done locally |
|
| 98 | + if ($this->remote_id && $check_only) |
|
| 99 | + { |
|
| 100 | + return true; |
|
| 101 | + } |
|
| 102 | + // further checks can only done locally |
|
| 99 | 103 | |
| 100 | 104 | $this->_merge_defaults(); |
| 101 | 105 | //_debug_array($this->as_array()); |
@@ -53,8 +53,8 @@ discard block |
||
| 53 | 53 | * @param boolean $make_db_name_unique =false true: if create fails because db exists, |
| 54 | 54 | * try creating a unique name by shortening the name and adding a number to it |
| 55 | 55 | */ |
| 56 | - function __construct($domain,$db_type=null,$db_host=null,$db_port=null,$db_name=null,$db_user=null,$db_pass=null, |
|
| 57 | - $db_root=null,$db_root_pw=null,$sub_command='create_db',$db_grant_host='localhost',$make_db_name_unique=false) |
|
| 56 | + function __construct($domain, $db_type = null, $db_host = null, $db_port = null, $db_name = null, $db_user = null, $db_pass = null, |
|
| 57 | + $db_root = null, $db_root_pw = null, $sub_command = 'create_db', $db_grant_host = 'localhost', $make_db_name_unique = false) |
|
| 58 | 58 | { |
| 59 | 59 | if (!is_array($domain)) |
| 60 | 60 | { |
@@ -89,22 +89,22 @@ discard block |
||
| 89 | 89 | * @throws Exception(lang('Wrong credentials to access the header.inc.php file!'),2); |
| 90 | 90 | * @throws Exception('header.inc.php not found!'); |
| 91 | 91 | */ |
| 92 | - protected function exec($check_only=false) |
|
| 92 | + protected function exec($check_only = false) |
|
| 93 | 93 | { |
| 94 | - if (!empty($this->domain) && !preg_match('/^([a-z0-9_-]+\.)*[a-z0-9]+/i',$this->domain)) |
|
| 94 | + if (!empty($this->domain) && !preg_match('/^([a-z0-9_-]+\.)*[a-z0-9]+/i', $this->domain)) |
|
| 95 | 95 | { |
| 96 | - throw new Api\Exception\WrongUserinput(lang("'%1' is no valid domain name!",$this->domain)); |
|
| 96 | + throw new Api\Exception\WrongUserinput(lang("'%1' is no valid domain name!", $this->domain)); |
|
| 97 | 97 | } |
| 98 | - if ($this->remote_id && $check_only) return true; // further checks can only done locally |
|
| 98 | + if ($this->remote_id && $check_only) return true; // further checks can only done locally |
|
| 99 | 99 | |
| 100 | 100 | $this->_merge_defaults(); |
| 101 | 101 | //_debug_array($this->as_array()); |
| 102 | 102 | |
| 103 | 103 | try { |
| 104 | - switch($this->sub_command) |
|
| 104 | + switch ($this->sub_command) |
|
| 105 | 105 | { |
| 106 | 106 | case 'test_db_root': |
| 107 | - $msg = $this->connect($this->db_root,$this->db_root_pw,$this->db_meta); |
|
| 107 | + $msg = $this->connect($this->db_root, $this->db_root_pw, $this->db_meta); |
|
| 108 | 108 | break; |
| 109 | 109 | case 'test_db': |
| 110 | 110 | $msg = $this->connect(); |
@@ -138,13 +138,13 @@ discard block |
||
| 138 | 138 | * @param string $name =null default $this->db_name |
| 139 | 139 | * @throws Api\Exception\WrongUserinput Can not connect to database ... |
| 140 | 140 | */ |
| 141 | - private function connect($user=null,$pass=null,$name=null) |
|
| 141 | + private function connect($user = null, $pass = null, $name = null) |
|
| 142 | 142 | { |
| 143 | 143 | // propagate all db_* vars |
| 144 | 144 | $this->test_db = new Api\Db($this->data); |
| 145 | 145 | |
| 146 | 146 | $error_rep = error_reporting(); |
| 147 | - error_reporting($error_rep & ~E_WARNING); // switch warnings off, in case they are on |
|
| 147 | + error_reporting($error_rep&~E_WARNING); // switch warnings off, in case they are on |
|
| 148 | 148 | try { |
| 149 | 149 | $this->test_db->connect($name, null, null, $user, $pass); |
| 150 | 150 | } |
@@ -156,10 +156,10 @@ discard block |
||
| 156 | 156 | if ($e) |
| 157 | 157 | { |
| 158 | 158 | throw new Api\Exception\WrongUserinput(lang('Can not connect to %1 database %2 on host %3 using user %4!', |
| 159 | - $this->db_type,$name,$this->db_host.($this->db_port?':'.$this->db_port:''),$user).' ('.$e->getMessage().')'); |
|
| 159 | + $this->db_type, $name, $this->db_host.($this->db_port ? ':'.$this->db_port : ''), $user).' ('.$e->getMessage().')'); |
|
| 160 | 160 | } |
| 161 | 161 | return lang('Successful connected to %1 database %2 on %3 using user %4.', |
| 162 | - $this->db_type,$name,$this->db_host.($this->db_port?':'.$this->db_port:''),$user); |
|
| 162 | + $this->db_type, $name, $this->db_host.($this->db_port ? ':'.$this->db_port : ''), $user); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /** |
@@ -175,14 +175,14 @@ discard block |
||
| 175 | 175 | */ |
| 176 | 176 | private function create() |
| 177 | 177 | { |
| 178 | - static $try_make_unique = 0; // to limit trials to create a unique name |
|
| 178 | + static $try_make_unique = 0; // to limit trials to create a unique name |
|
| 179 | 179 | |
| 180 | 180 | // shorten db-name/-user to self::MAX_DB_NAME_LEN chars |
| 181 | 181 | if ($this->make_db_name_unique && strlen($this->db_name) > self::MAX_DB_NAME_LEN) |
| 182 | 182 | { |
| 183 | 183 | $this->set_defaults['db_name'] = $this->db_name = |
| 184 | 184 | $this->set_defaults['db_user'] = $this->db_user = // change user too (otherwise existing user/db could not connect any more!) |
| 185 | - substr(str_replace(array('.', '-'), '_', $this->db_name),0,self::MAX_DB_NAME_LEN); |
|
| 185 | + substr(str_replace(array('.', '-'), '_', $this->db_name), 0, self::MAX_DB_NAME_LEN); |
|
| 186 | 186 | } |
| 187 | 187 | try { |
| 188 | 188 | $msg = $this->connect(); |
@@ -190,22 +190,22 @@ discard block |
||
| 190 | 190 | catch (Api\Exception\WrongUserinput $e) { |
| 191 | 191 | // db or user not working --> connect as root and create it |
| 192 | 192 | try { |
| 193 | - $this->test_db->create_database($this->db_root,$this->db_root_pw,$this->db_charset,$this->db_grant_host); |
|
| 193 | + $this->test_db->create_database($this->db_root, $this->db_root_pw, $this->db_charset, $this->db_grant_host); |
|
| 194 | 194 | $this->connect(); |
| 195 | 195 | } |
| 196 | - catch(Api\Db\Exception $e) { // catches failed to create database |
|
| 196 | + catch (Api\Db\Exception $e) { // catches failed to create database |
|
| 197 | 197 | // try connect as root to check if wrong root/root_pw is the problem |
| 198 | - $this->connect($this->db_root,$this->db_root_pw,$this->db_meta); |
|
| 198 | + $this->connect($this->db_root, $this->db_root_pw, $this->db_meta); |
|
| 199 | 199 | |
| 200 | 200 | // if we should create a db with a unique name (try it only N times, not endless!) |
| 201 | 201 | if ($this->make_db_name_unique && $try_make_unique++ < 20) |
| 202 | 202 | { |
| 203 | 203 | // check if we can connect as root to the db to create --> db exists already |
| 204 | 204 | try { |
| 205 | - $this->connect($this->db_root,$this->db_root_pw); |
|
| 205 | + $this->connect($this->db_root, $this->db_root_pw); |
|
| 206 | 206 | // create new db_name by incrementing an existing numeric postfix |
| 207 | 207 | $matches = null; |
| 208 | - if (preg_match('/([0-9]+)$/',$this->db_name,$matches)) |
|
| 208 | + if (preg_match('/([0-9]+)$/', $this->db_name, $matches)) |
|
| 209 | 209 | { |
| 210 | 210 | $num = (string)(++$matches[1]); |
| 211 | 211 | } |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | } |
| 216 | 216 | $this->set_defaults['db_name'] = $this->db_name = |
| 217 | 217 | $this->set_defaults['db_user'] = $this->db_user = // change user too (otherwise existing user/db could not connect any more!) |
| 218 | - substr($this->db_name,0,self::MAX_DB_NAME_LEN-strlen($num)).$num; |
|
| 218 | + substr($this->db_name, 0, self::MAX_DB_NAME_LEN - strlen($num)).$num; |
|
| 219 | 219 | |
| 220 | 220 | return $this->create(); |
| 221 | 221 | } |
@@ -226,21 +226,21 @@ discard block |
||
| 226 | 226 | } |
| 227 | 227 | // if not give general error |
| 228 | 228 | throw new Api\Exception\WrongUserinput(lang('Can not create %1 database %2 on %3 for user %4!', |
| 229 | - $this->db_type,$this->db_name,$this->db_host.($this->db_port?':'.$this->db_port:''),$this->db_user)); |
|
| 229 | + $this->db_type, $this->db_name, $this->db_host.($this->db_port ? ':'.$this->db_port : ''), $this->db_user)); |
|
| 230 | 230 | } |
| 231 | 231 | $msg = lang('Successful connected to %1 on %3 and created database %2 for user %4.', |
| 232 | - $this->db_type,$this->db_name,$this->db_host.($this->db_port?':'.$this->db_port:''),$this->db_user); |
|
| 232 | + $this->db_type, $this->db_name, $this->db_host.($this->db_port ? ':'.$this->db_port : ''), $this->db_user); |
|
| 233 | 233 | } |
| 234 | 234 | // check if it already contains tables |
| 235 | 235 | if (($tables = $this->test_db->table_names())) |
| 236 | 236 | { |
| 237 | - foreach($tables as &$table) |
|
| 237 | + foreach ($tables as &$table) |
|
| 238 | 238 | { |
| 239 | 239 | $table = $table['table_name']; |
| 240 | 240 | } |
| 241 | 241 | throw new Api\Exception\WrongUserinput(lang('%1 database %2 on %3 already contains the following tables:', |
| 242 | - $this->db_type,$this->db_name,$this->db_host.($this->db_port?':'.$this->db_port:'')).' '. |
|
| 243 | - implode(', ',$tables)); |
|
| 242 | + $this->db_type, $this->db_name, $this->db_host.($this->db_port ? ':'.$this->db_port : '')).' '. |
|
| 243 | + implode(', ', $tables)); |
|
| 244 | 244 | } |
| 245 | 245 | return $msg; |
| 246 | 246 | } |
@@ -254,12 +254,12 @@ discard block |
||
| 254 | 254 | */ |
| 255 | 255 | private function drop() |
| 256 | 256 | { |
| 257 | - $this->connect($this->db_root,$this->db_root_pw,$this->db_meta); |
|
| 258 | - $this->test_db->query('DROP DATABASE '.$this->test_db->name_quote($this->db_name),__LINE__,__FILE__); |
|
| 259 | - $msg = lang('Datebase %1 droped.',$this->db_name); |
|
| 257 | + $this->connect($this->db_root, $this->db_root_pw, $this->db_meta); |
|
| 258 | + $this->test_db->query('DROP DATABASE '.$this->test_db->name_quote($this->db_name), __LINE__, __FILE__); |
|
| 259 | + $msg = lang('Datebase %1 droped.', $this->db_name); |
|
| 260 | 260 | try { |
| 261 | 261 | $this->test_db->query('DROP USER '.$this->test_db->quote($this->db_user).'@'. |
| 262 | - $this->test_db->quote($this->db_grant_host?$this->db_grant_host:'%'),__LINE__,__FILE__); |
|
| 262 | + $this->test_db->quote($this->db_grant_host ? $this->db_grant_host : '%'), __LINE__, __FILE__); |
|
| 263 | 263 | } |
| 264 | 264 | catch (Api\Db\Exception $e) { |
| 265 | 265 | unset($e); |
@@ -275,9 +275,9 @@ discard block |
||
| 275 | 275 | * @param string $db_type ='mysqli' |
| 276 | 276 | * @return array |
| 277 | 277 | */ |
| 278 | - static function defaults($db_type='mysqli') |
|
| 278 | + static function defaults($db_type = 'mysqli') |
|
| 279 | 279 | { |
| 280 | - switch($db_type) |
|
| 280 | + switch ($db_type) |
|
| 281 | 281 | { |
| 282 | 282 | case 'mysql': |
| 283 | 283 | default: |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | 'db_user' => 'egw_$domain', |
| 296 | 296 | 'db_pass' => self::randomstring(), |
| 297 | 297 | 'db_root' => 'root', |
| 298 | - 'db_root_pw' => '', // not really a default |
|
| 298 | + 'db_root_pw' => '', // not really a default |
|
| 299 | 299 | 'db_meta' => $meta_db, |
| 300 | 300 | 'db_charset' => 'utf-8', |
| 301 | 301 | 'db_grant_host' => 'localhost', |
@@ -307,19 +307,19 @@ discard block |
||
| 307 | 307 | */ |
| 308 | 308 | private function _merge_defaults() |
| 309 | 309 | { |
| 310 | - foreach(self::defaults() as $name => $default) |
|
| 310 | + foreach (self::defaults() as $name => $default) |
|
| 311 | 311 | { |
| 312 | 312 | if (!$this->$name) |
| 313 | 313 | { |
| 314 | 314 | //echo "<p>setting $name='{$this->$name}' to it's default='$default'</p>\n"; |
| 315 | 315 | $this->set_defaults[$name] = $this->$name = $default; |
| 316 | 316 | } |
| 317 | - if (strpos($this->$name,'$domain') !== false) |
|
| 317 | + if (strpos($this->$name, '$domain') !== false) |
|
| 318 | 318 | { |
| 319 | 319 | // limit names to 16 chars (16 char is user-name limit in MySQL) |
| 320 | 320 | $this->set_defaults[$name] = $this->$name = |
| 321 | - substr(str_replace(array('$domain','.','-'),array($this->domain,'_','_'),$this->$name), |
|
| 322 | - 0,self::MAX_DB_NAME_LEN); |
|
| 321 | + substr(str_replace(array('$domain', '.', '-'), array($this->domain, '_', '_'), $this->$name), |
|
| 322 | + 0, self::MAX_DB_NAME_LEN); |
|
| 323 | 323 | } |
| 324 | 324 | } |
| 325 | 325 | } |
@@ -58,11 +58,11 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | function read_repository() |
| 60 | 60 | { |
| 61 | - if (!isset($GLOBALS['egw_info']['apps']) || !is_array($GLOBALS['egw_info']['apps'])) |
|
| 61 | + if (!isset($GLOBALS['egw_info']['apps']) || !is_array($GLOBALS['egw_info']['apps'])) |
|
| 62 | 62 | { |
| 63 | 63 | $this->read_installed_apps(); |
| 64 | 64 | } |
| 65 | - if(!$this->account_id) |
|
| 65 | + if (!$this->account_id) |
|
| 66 | 66 | { |
| 67 | 67 | return False; |
| 68 | 68 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | $GLOBALS['egw_info']['apps'] = Api\Cache::getInstance(__CLASS__, 'apps', function() |
| 80 | 80 | { |
| 81 | 81 | $apps = array(); |
| 82 | - foreach($this->db->select($this->table_name,'*',false,__LINE__,__FILE__,false,'ORDER BY app_order ASC') as $row) |
|
| 82 | + foreach ($this->db->select($this->table_name, '*', false, __LINE__, __FILE__, false, 'ORDER BY app_order ASC') as $row) |
|
| 83 | 83 | { |
| 84 | 84 | $apps[$row['app_name']] = Array( |
| 85 | 85 | 'title' => $row['app_name'], |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | if (!empty($GLOBALS['egw_info']['user']['preferences']['common']['lang'])) |
| 101 | 101 | { |
| 102 | - foreach($GLOBALS['egw_info']['apps'] as &$app) |
|
| 102 | + foreach ($GLOBALS['egw_info']['apps'] as &$app) |
|
| 103 | 103 | { |
| 104 | 104 | $app['title'] = lang($app['title']); |
| 105 | 105 | } |
@@ -81,7 +81,7 @@ |
||
| 81 | 81 | $apps = array(); |
| 82 | 82 | foreach($this->db->select($this->table_name,'*',false,__LINE__,__FILE__,false,'ORDER BY app_order ASC') as $row) |
| 83 | 83 | { |
| 84 | - $apps[$row['app_name']] = Array( |
|
| 84 | + $apps[$row['app_name']] = array( |
|
| 85 | 85 | 'title' => $row['app_name'], |
| 86 | 86 | 'name' => $row['app_name'], |
| 87 | 87 | 'enabled' => True, |
@@ -249,6 +249,7 @@ |
||
| 249 | 249 | * If the entry is not yet created, the file information is stored into the widget's value. |
| 250 | 250 | * When the form is submitted, the information for all files uploaded is available in the returned |
| 251 | 251 | * $content array and the application should deal with the file. |
| 252 | + * @return string |
|
| 252 | 253 | */ |
| 253 | 254 | public static function store_file($path, &$file) |
| 254 | 255 | { |
@@ -243,13 +243,13 @@ |
||
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | /** |
| 246 | - * Ajax callback to receive an incoming file |
|
| 247 | - * |
|
| 248 | - * The incoming file is automatically placed into the appropriate VFS location. |
|
| 249 | - * If the entry is not yet created, the file information is stored into the widget's value. |
|
| 250 | - * When the form is submitted, the information for all files uploaded is available in the returned |
|
| 251 | - * $content array and the application should deal with the file. |
|
| 252 | - */ |
|
| 246 | + * Ajax callback to receive an incoming file |
|
| 247 | + * |
|
| 248 | + * The incoming file is automatically placed into the appropriate VFS location. |
|
| 249 | + * If the entry is not yet created, the file information is stored into the widget's value. |
|
| 250 | + * When the form is submitted, the information for all files uploaded is available in the returned |
|
| 251 | + * $content array and the application should deal with the file. |
|
| 252 | + */ |
|
| 253 | 253 | public static function store_file($path, &$file) |
| 254 | 254 | { |
| 255 | 255 | $name = $_REQUEST['widget_id']; |
@@ -124,7 +124,7 @@ |
||
| 124 | 124 | * |
| 125 | 125 | * Overriden from the parent to see if we can safely show the thumbnail immediately |
| 126 | 126 | */ |
| 127 | - protected static function process_uploaded_file($field, Array &$file, $mime, Array &$file_data) |
|
| 127 | + protected static function process_uploaded_file($field, array &$file, $mime, array &$file_data) |
|
| 128 | 128 | { |
| 129 | 129 | parent::process_uploaded_file($field, $file, $mime, $file_data); |
| 130 | 130 | $path = self::store_file($_REQUEST['path'] ? $_REQUEST['path'] : $_REQUEST['widget_id'], $file); |
@@ -29,7 +29,10 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | public function __construct($xml='') |
| 31 | 31 | { |
| 32 | - if($xml) parent::__construct($xml); |
|
| 32 | + if($xml) |
|
| 33 | + { |
|
| 34 | + parent::__construct($xml); |
|
| 35 | + } |
|
| 33 | 36 | } |
| 34 | 37 | |
| 35 | 38 | /** |
@@ -70,9 +73,15 @@ discard block |
||
| 70 | 73 | } |
| 71 | 74 | $value =& self::get_array(self::$request->content, $form_name, true); |
| 72 | 75 | $path = Api\Link::vfs_path($app,$id,'',true); |
| 73 | - if (!empty($relpath)) $path .= '/'.$relpath; |
|
| 76 | + if (!empty($relpath)) |
|
| 77 | + { |
|
| 78 | + $path .= '/'.$relpath; |
|
| 79 | + } |
|
| 74 | 80 | |
| 75 | - if (true) $value = array(); |
|
| 81 | + if (true) |
|
| 82 | + { |
|
| 83 | + $value = array(); |
|
| 84 | + } |
|
| 76 | 85 | |
| 77 | 86 | // Single file, already existing |
| 78 | 87 | if (substr($path,-1) != '/' && Api\Vfs::file_exists($path) && !Api\Vfs::is_dir($path)) |
@@ -215,7 +224,10 @@ discard block |
||
| 215 | 224 | $replace[substr($link['id']['tmp_name'], strlen(Api\Vfs::PREFIX))] = |
| 216 | 225 | Api\Link::vfs_path($app, $id, Api\Vfs::basename($link['id']['tmp_name']), true); |
| 217 | 226 | |
| 218 | - if (!in_array($matches[1], $remove_dir)) $remove_dir[] = $matches[1]; |
|
| 227 | + if (!in_array($matches[1], $remove_dir)) |
|
| 228 | + { |
|
| 229 | + $remove_dir[] = $matches[1]; |
|
| 230 | + } |
|
| 219 | 231 | } |
| 220 | 232 | } |
| 221 | 233 | if ($replace) |
@@ -239,7 +251,10 @@ discard block |
||
| 239 | 251 | */ |
| 240 | 252 | static function get_temp_dir($app, $postfix=null) |
| 241 | 253 | { |
| 242 | - if (!isset($postfix)) $postfix = md5(time().session_id()); |
|
| 254 | + if (!isset($postfix)) |
|
| 255 | + { |
|
| 256 | + $postfix = md5(time().session_id()); |
|
| 257 | + } |
|
| 243 | 258 | |
| 244 | 259 | return '/home/'.$GLOBALS['egw_info']['user']['account_lid'].'/.tmp/'.$app.'_'.$postfix; |
| 245 | 260 | } |
@@ -269,16 +284,22 @@ discard block |
||
| 269 | 284 | // check if path already contains a valid extension --> dont add an other one |
| 270 | 285 | $path_parts = explode('.', $path); |
| 271 | 286 | if (count($path_parts) > 2 && (!($extension = array_pop($path_parts)) || !Api\MimeMagic::ext2mime($extension)) && |
| 272 | - ($extension = array_pop($parts)) && Api\MimeMagic::ext2mime($extension)) // really an extension --> add it to path |
|
| 287 | + ($extension = array_pop($parts)) && Api\MimeMagic::ext2mime($extension)) |
|
| 288 | + { |
|
| 289 | + // really an extension --> add it to path |
|
| 273 | 290 | { |
| 274 | 291 | $path .= '.'.$extension; |
| 275 | 292 | } |
| 293 | + } |
|
| 276 | 294 | $file['name'] = Api\Vfs::basename($path); |
| 277 | 295 | } |
| 278 | - else if ($path) // multiple upload with dir given (trailing slash) |
|
| 296 | + else if ($path) |
|
| 297 | + { |
|
| 298 | + // multiple upload with dir given (trailing slash) |
|
| 279 | 299 | { |
| 280 | 300 | $path .= Api\Vfs::encodePathComponent($filename); |
| 281 | 301 | } |
| 302 | + } |
|
| 282 | 303 | if (!($dir = Api\Vfs::dirname($path))) |
| 283 | 304 | { |
| 284 | 305 | self::set_validation_error($name,lang('Error create parent directory %1!', "dirname('$path') === false")); |
@@ -324,7 +345,10 @@ discard block |
||
| 324 | 345 | switch($this->type) |
| 325 | 346 | { |
| 326 | 347 | case 'vfs-upload': |
| 327 | - if(!is_array($value)) $value = array(); |
|
| 348 | + if(!is_array($value)) |
|
| 349 | + { |
|
| 350 | + $value = array(); |
|
| 351 | + } |
|
| 328 | 352 | /* Check & skip files that made it asyncronously |
| 329 | 353 | list($app,$id,$relpath) = explode(':',$this->id,3); |
| 330 | 354 | //... |
@@ -335,7 +359,10 @@ discard block |
||
| 335 | 359 | parent::validate($cname, $content, $validated); |
| 336 | 360 | break; |
| 337 | 361 | } |
| 338 | - if (true) $valid = $value; |
|
| 362 | + if (true) |
|
| 363 | + { |
|
| 364 | + $valid = $value; |
|
| 365 | + } |
|
| 339 | 366 | } |
| 340 | 367 | |
| 341 | 368 | /** |
@@ -347,7 +374,10 @@ discard block |
||
| 347 | 374 | if (empty($id) || $id == 'undefined') |
| 348 | 375 | { |
| 349 | 376 | static $tmppath = array(); // static var, so all vfs-uploads get created in the same temporary dir |
| 350 | - if (!isset($tmppath[$app])) $tmppath[$app] = self::get_temp_dir ($app); |
|
| 377 | + if (!isset($tmppath[$app])) |
|
| 378 | + { |
|
| 379 | + $tmppath[$app] = self::get_temp_dir ($app); |
|
| 380 | + } |
|
| 351 | 381 | $path = $tmppath[$app]; |
| 352 | 382 | } |
| 353 | 383 | else |
@@ -367,7 +397,10 @@ discard block |
||
| 367 | 397 | } |
| 368 | 398 | $path = Api\Link::vfs_path($app,$id,'',true); |
| 369 | 399 | } |
| 370 | - if (!empty($relpath)) $path .= '/'.$relpath; |
|
| 400 | + if (!empty($relpath)) |
|
| 401 | + { |
|
| 402 | + $path .= '/'.$relpath; |
|
| 403 | + } |
|
| 371 | 404 | return $path; |
| 372 | 405 | } |
| 373 | 406 | |
@@ -459,8 +492,15 @@ discard block |
||
| 459 | 492 | { |
| 460 | 493 | $path = $favorite['state']['path']; |
| 461 | 494 | // Just directories |
| 462 | - if(!$path) continue; |
|
| 463 | - if ($path == $content['path']) continue; // remove directory itself |
|
| 495 | + if(!$path) |
|
| 496 | + { |
|
| 497 | + continue; |
|
| 498 | + } |
|
| 499 | + if ($path == $content['path']) |
|
| 500 | + { |
|
| 501 | + continue; |
|
| 502 | + } |
|
| 503 | + // remove directory itself |
|
| 464 | 504 | |
| 465 | 505 | $mime = \EGroupware\Api\Vfs::mime_content_type($path); |
| 466 | 506 | $content['dir'][$n] = array( |
@@ -491,7 +531,11 @@ discard block |
||
| 491 | 531 | $content['dir'] = array('mode' => $content['mode']); |
| 492 | 532 | foreach($files as $path) |
| 493 | 533 | { |
| 494 | - if ($path == $content['path']) continue; // remove directory itself |
|
| 534 | + if ($path == $content['path']) |
|
| 535 | + { |
|
| 536 | + continue; |
|
| 537 | + } |
|
| 538 | + // remove directory itself |
|
| 495 | 539 | |
| 496 | 540 | $name = \EGroupware\Api\Vfs::basename($path); |
| 497 | 541 | $is_dir = \EGroupware\Api\Vfs::is_dir($path); |
@@ -512,7 +556,11 @@ discard block |
||
| 512 | 556 | } |
| 513 | 557 | ++$n; |
| 514 | 558 | } |
| 515 | - if (!$n) $readonlys['selected[]'] = true; // remove checkbox from empty line |
|
| 559 | + if (!$n) |
|
| 560 | + { |
|
| 561 | + $readonlys['selected[]'] = true; |
|
| 562 | + } |
|
| 563 | + // remove checkbox from empty line |
|
| 516 | 564 | } |
| 517 | 565 | $readonlys = array_merge($readonlys, array( |
| 518 | 566 | 'createdir' => !\EGroupware\Api\Vfs::is_writable($content['path']), |
@@ -528,7 +576,10 @@ discard block |
||
| 528 | 576 | if ($content['method'] === 'ckeditor') |
| 529 | 577 | { |
| 530 | 578 | $download_baseUrl = \EGroupware\Api\Vfs::download_url($content['path']); |
| 531 | - if ($download_baseUrl[0] == '/') $download_baseUrl = \EGroupware\Api\Egw::link($download_baseUrl); |
|
| 579 | + if ($download_baseUrl[0] == '/') |
|
| 580 | + { |
|
| 581 | + $download_baseUrl = \EGroupware\Api\Egw::link($download_baseUrl); |
|
| 582 | + } |
|
| 532 | 583 | $content['download_baseUrl'] = $download_baseUrl; |
| 533 | 584 | } |
| 534 | 585 | |
@@ -27,9 +27,9 @@ discard block |
||
| 27 | 27 | // Legacy option for vfs-upload |
| 28 | 28 | protected $legacy_options = "mime"; |
| 29 | 29 | |
| 30 | - public function __construct($xml='') |
|
| 30 | + public function __construct($xml = '') |
|
| 31 | 31 | { |
| 32 | - if($xml) parent::__construct($xml); |
|
| 32 | + if ($xml) parent::__construct($xml); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
@@ -38,10 +38,10 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | public function beforeSendToClient($cname, $expand = array()) |
| 40 | 40 | { |
| 41 | - if($this->type == 'vfs-upload' || $this->attrs['type'] == 'vfs-upload') |
|
| 41 | + if ($this->type == 'vfs-upload' || $this->attrs['type'] == 'vfs-upload') |
|
| 42 | 42 | { |
| 43 | 43 | $form_name = self::form_name($cname, $this->id, $expand ? $expand : array('cont'=>self::$request->content)); |
| 44 | - if($this->attrs['path']) |
|
| 44 | + if ($this->attrs['path']) |
|
| 45 | 45 | { |
| 46 | 46 | $path = $this->attrs['path']; |
| 47 | 47 | } |
@@ -52,13 +52,13 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | $this->setElementAttribute($form_name, 'path', $path); |
| 54 | 54 | // ID maps to path - check there for any existing files |
| 55 | - list($app,$id,$relpath) = explode(':',$path,3); |
|
| 56 | - if($app && $id) |
|
| 55 | + list($app, $id, $relpath) = explode(':', $path, 3); |
|
| 56 | + if ($app && $id) |
|
| 57 | 57 | { |
| 58 | - if(!is_numeric($id)) |
|
| 58 | + if (!is_numeric($id)) |
|
| 59 | 59 | { |
| 60 | - $_id = self::expand_name($id,0,0,0,0,self::$request->content); |
|
| 61 | - if($_id != $id && $_id) |
|
| 60 | + $_id = self::expand_name($id, 0, 0, 0, 0, self::$request->content); |
|
| 61 | + if ($_id != $id && $_id) |
|
| 62 | 62 | { |
| 63 | 63 | $id = $_id; |
| 64 | 64 | $form_name = "$app:$id:$relpath"; |
@@ -68,14 +68,14 @@ discard block |
||
| 68 | 68 | return; |
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | - $value =& self::get_array(self::$request->content, $form_name, true); |
|
| 72 | - $path = Api\Link::vfs_path($app,$id,'',true); |
|
| 71 | + $value = & self::get_array(self::$request->content, $form_name, true); |
|
| 72 | + $path = Api\Link::vfs_path($app, $id, '', true); |
|
| 73 | 73 | if (!empty($relpath)) $path .= '/'.$relpath; |
| 74 | 74 | |
| 75 | 75 | if (true) $value = array(); |
| 76 | 76 | |
| 77 | 77 | // Single file, already existing |
| 78 | - if (substr($path,-1) != '/' && Api\Vfs::file_exists($path) && !Api\Vfs::is_dir($path)) |
|
| 78 | + if (substr($path, -1) != '/' && Api\Vfs::file_exists($path) && !Api\Vfs::is_dir($path)) |
|
| 79 | 79 | { |
| 80 | 80 | $file = Api\Vfs::stat($path); |
| 81 | 81 | $file['path'] = $path; |
@@ -84,14 +84,14 @@ discard block |
||
| 84 | 84 | $value = array($file); |
| 85 | 85 | } |
| 86 | 86 | // Single file, missing extension in path |
| 87 | - else if (substr($path, -1) != '/' && !Api\Vfs::file_exists($path) && $relpath && substr($relpath,-4,1) !== '.') |
|
| 87 | + else if (substr($path, -1) != '/' && !Api\Vfs::file_exists($path) && $relpath && substr($relpath, -4, 1) !== '.') |
|
| 88 | 88 | { |
| 89 | 89 | $find = Api\Vfs::find(Api\Vfs::dirname($path), array( |
| 90 | 90 | 'type' => 'f', |
| 91 | 91 | 'maxdepth' => 1, |
| 92 | 92 | 'name' => Api\Vfs::basename($path).'.*', |
| 93 | 93 | )); |
| 94 | - foreach($find as $file) |
|
| 94 | + foreach ($find as $file) |
|
| 95 | 95 | { |
| 96 | 96 | $file_info = Api\Vfs::stat($file); |
| 97 | 97 | $file_info['path'] = $file; |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | else if (substr($path, -1) == '/' && Api\Vfs::is_dir($path)) |
| 104 | 104 | { |
| 105 | 105 | $scan = Api\Vfs::scandir($path); |
| 106 | - foreach($scan as $file) |
|
| 106 | + foreach ($scan as $file) |
|
| 107 | 107 | { |
| 108 | 108 | $file_info = Api\Vfs::stat("$path$file"); |
| 109 | 109 | $file_info['path'] = "$path$file"; |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | { |
| 131 | 131 | parent::process_uploaded_file($field, $file, $mime, $file_data); |
| 132 | 132 | $path = self::store_file($_REQUEST['path'] ? $_REQUEST['path'] : $_REQUEST['widget_id'], $file); |
| 133 | - if($path) |
|
| 133 | + if ($path) |
|
| 134 | 134 | { |
| 135 | 135 | $file_data[basename($file['tmp_name'])]['name'] = $file['name']; |
| 136 | 136 | $file_data[basename($file['tmp_name'])]['path'] = $path; |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | { |
| 147 | 147 | $request_id = urldecode($_REQUEST['request_id']); |
| 148 | 148 | $widget_id = $_REQUEST['widget_id']; |
| 149 | - if(!self::$request = Etemplate\Request::read($request_id)) |
|
| 149 | + if (!self::$request = Etemplate\Request::read($request_id)) |
|
| 150 | 150 | { |
| 151 | 151 | $error = lang("Could not read session"); |
| 152 | 152 | } |
@@ -163,8 +163,7 @@ discard block |
||
| 163 | 163 | else |
| 164 | 164 | { |
| 165 | 165 | $data = self::$request->content[$widget_id]; |
| 166 | - $path = self::store_file($path = (!is_array($data) && $data[0] == '/' ? $data : |
|
| 167 | - self::get_vfs_path($data['to_app'].':'.$data['to_id'])).'/', $_FILES['upload']); |
|
| 166 | + $path = self::store_file($path = (!is_array($data) && $data[0] == '/' ? $data : self::get_vfs_path($data['to_app'].':'.$data['to_id'])).'/', $_FILES['upload']); |
|
| 168 | 167 | |
| 169 | 168 | // store temp. vfs-path like links to be able to move it to correct location after entry is stored |
| 170 | 169 | if (!$data['to_id'] || is_array($data['to_id'])) |
@@ -207,10 +206,10 @@ discard block |
||
| 207 | 206 | static function fix_html_dragins($app, $id, array $links, &$html) |
| 208 | 207 | { |
| 209 | 208 | $replace = $remove_dir = array(); |
| 210 | - foreach($links as $link) |
|
| 209 | + foreach ($links as $link) |
|
| 211 | 210 | { |
| 212 | 211 | $matches = null; |
| 213 | - if (is_array($link) && preg_match('|^'.preg_quote(Api\Vfs::PREFIX,'|').'('.preg_quote(self::get_temp_dir($app, ''), '|').'[^/]+)/|', $link['id']['tmp_name'], $matches)) |
|
| 212 | + if (is_array($link) && preg_match('|^'.preg_quote(Api\Vfs::PREFIX, '|').'('.preg_quote(self::get_temp_dir($app, ''), '|').'[^/]+)/|', $link['id']['tmp_name'], $matches)) |
|
| 214 | 213 | { |
| 215 | 214 | $replace[substr($link['id']['tmp_name'], strlen(Api\Vfs::PREFIX))] = |
| 216 | 215 | Api\Link::vfs_path($app, $id, Api\Vfs::basename($link['id']['tmp_name']), true); |
@@ -222,7 +221,7 @@ discard block |
||
| 222 | 221 | { |
| 223 | 222 | $html = strtr($old = $html, $replace); |
| 224 | 223 | // remove all dirs |
| 225 | - foreach($remove_dir as $dir) |
|
| 224 | + foreach ($remove_dir as $dir) |
|
| 226 | 225 | { |
| 227 | 226 | Api\Vfs::remove($dir); |
| 228 | 227 | } |
@@ -237,7 +236,7 @@ discard block |
||
| 237 | 236 | * @param string $postfix =null default random id |
| 238 | 237 | * @return string vfs path |
| 239 | 238 | */ |
| 240 | - static function get_temp_dir($app, $postfix=null) |
|
| 239 | + static function get_temp_dir($app, $postfix = null) |
|
| 241 | 240 | { |
| 242 | 241 | if (!isset($postfix)) $postfix = md5(time().session_id()); |
| 243 | 242 | |
@@ -257,15 +256,15 @@ discard block |
||
| 257 | 256 | $name = $_REQUEST['widget_id']; |
| 258 | 257 | |
| 259 | 258 | // Find real path |
| 260 | - if($path[0] != '/') |
|
| 259 | + if ($path[0] != '/') |
|
| 261 | 260 | { |
| 262 | 261 | $path = self::get_vfs_path($path); |
| 263 | 262 | } |
| 264 | 263 | $filename = $file['name']; |
| 265 | - if ($path && substr($path,-1) != '/') |
|
| 264 | + if ($path && substr($path, -1) != '/') |
|
| 266 | 265 | { |
| 267 | 266 | // add extension to path |
| 268 | - $parts = explode('.',$filename); |
|
| 267 | + $parts = explode('.', $filename); |
|
| 269 | 268 | // check if path already contains a valid extension --> dont add an other one |
| 270 | 269 | $path_parts = explode('.', $path); |
| 271 | 270 | if (count($path_parts) > 2 && (!($extension = array_pop($path_parts)) || !Api\MimeMagic::ext2mime($extension)) && |
@@ -281,17 +280,17 @@ discard block |
||
| 281 | 280 | } |
| 282 | 281 | if (!($dir = Api\Vfs::dirname($path))) |
| 283 | 282 | { |
| 284 | - self::set_validation_error($name,lang('Error create parent directory %1!', "dirname('$path') === false")); |
|
| 283 | + self::set_validation_error($name, lang('Error create parent directory %1!', "dirname('$path') === false")); |
|
| 285 | 284 | return false; |
| 286 | 285 | } |
| 287 | - if (!Api\Vfs::file_exists($dir) && !Api\Vfs::mkdir($dir,null,STREAM_MKDIR_RECURSIVE)) |
|
| 286 | + if (!Api\Vfs::file_exists($dir) && !Api\Vfs::mkdir($dir, null, STREAM_MKDIR_RECURSIVE)) |
|
| 288 | 287 | { |
| 289 | - self::set_validation_error($name,lang('Error create parent directory %1!',Api\Vfs::decodePath($dir))); |
|
| 288 | + self::set_validation_error($name, lang('Error create parent directory %1!', Api\Vfs::decodePath($dir))); |
|
| 290 | 289 | return false; |
| 291 | 290 | } |
| 292 | - if (!copy($file['tmp_name'],Api\Vfs::PREFIX.$path)) |
|
| 291 | + if (!copy($file['tmp_name'], Api\Vfs::PREFIX.$path)) |
|
| 293 | 292 | { |
| 294 | - self::set_validation_error($name,lang('Error copying uploaded file to vfs!')); |
|
| 293 | + self::set_validation_error($name, lang('Error copying uploaded file to vfs!')); |
|
| 295 | 294 | return false; |
| 296 | 295 | } |
| 297 | 296 | |
@@ -310,7 +309,7 @@ discard block |
||
| 310 | 309 | * @param array $content |
| 311 | 310 | * @param array &$validated=array() validated content |
| 312 | 311 | */ |
| 313 | - public function validate($cname, array $expand, array $content, &$validated=array()) |
|
| 312 | + public function validate($cname, array $expand, array $content, &$validated = array()) |
|
| 314 | 313 | { |
| 315 | 314 | // do not validate, as it would overwrite preserved values with null! |
| 316 | 315 | if (in_array($this->type, array('vfs-size', 'vfs-uid', 'vfs-gid', 'vfs', 'vfs-mime'))) |
@@ -319,12 +318,12 @@ discard block |
||
| 319 | 318 | } |
| 320 | 319 | $form_name = self::form_name($cname, $this->id, $expand); |
| 321 | 320 | $value = $value_in = self::get_array($content, $form_name); |
| 322 | - $valid =& self::get_array($validated, $form_name, true); |
|
| 321 | + $valid = & self::get_array($validated, $form_name, true); |
|
| 323 | 322 | |
| 324 | - switch($this->type) |
|
| 323 | + switch ($this->type) |
|
| 325 | 324 | { |
| 326 | 325 | case 'vfs-upload': |
| 327 | - if(!is_array($value)) $value = array(); |
|
| 326 | + if (!is_array($value)) $value = array(); |
|
| 328 | 327 | /* Check & skip files that made it asyncronously |
| 329 | 328 | list($app,$id,$relpath) = explode(':',$this->id,3); |
| 330 | 329 | //... |
@@ -343,19 +342,19 @@ discard block |
||
| 343 | 342 | */ |
| 344 | 343 | public static function get_vfs_path($path) |
| 345 | 344 | { |
| 346 | - list($app,$id,$relpath) = explode(':',$path,3); |
|
| 345 | + list($app, $id, $relpath) = explode(':', $path, 3); |
|
| 347 | 346 | if (empty($id) || $id == 'undefined') |
| 348 | 347 | { |
| 349 | - static $tmppath = array(); // static var, so all vfs-uploads get created in the same temporary dir |
|
| 350 | - if (!isset($tmppath[$app])) $tmppath[$app] = self::get_temp_dir ($app); |
|
| 348 | + static $tmppath = array(); // static var, so all vfs-uploads get created in the same temporary dir |
|
| 349 | + if (!isset($tmppath[$app])) $tmppath[$app] = self::get_temp_dir($app); |
|
| 351 | 350 | $path = $tmppath[$app]; |
| 352 | 351 | } |
| 353 | 352 | else |
| 354 | 353 | { |
| 355 | - if(!is_numeric($id)) |
|
| 354 | + if (!is_numeric($id)) |
|
| 356 | 355 | { |
| 357 | - $_id = self::expand_name($id,0,0,0,0,self::$request->content); |
|
| 358 | - if($_id != $id && $_id) |
|
| 356 | + $_id = self::expand_name($id, 0, 0, 0, 0, self::$request->content); |
|
| 357 | + if ($_id != $id && $_id) |
|
| 359 | 358 | { |
| 360 | 359 | $id = $_id; |
| 361 | 360 | } |
@@ -365,7 +364,7 @@ discard block |
||
| 365 | 364 | return static::get_vfs_path("$app::$relpath"); |
| 366 | 365 | } |
| 367 | 366 | } |
| 368 | - $path = Api\Link::vfs_path($app,$id,'',true); |
|
| 367 | + $path = Api\Link::vfs_path($app, $id, '', true); |
|
| 369 | 368 | } |
| 370 | 369 | if (!empty($relpath)) $path .= '/'.$relpath; |
| 371 | 370 | return $path; |
@@ -388,22 +387,22 @@ discard block |
||
| 388 | 387 | * @param array $params |
| 389 | 388 | * @throws Api\Exception\WrongParameter |
| 390 | 389 | */ |
| 391 | - public static function ajax_vfsSelect_content (array $content=null, $params = null) |
|
| 390 | + public static function ajax_vfsSelect_content(array $content = null, $params = null) |
|
| 392 | 391 | { |
| 393 | 392 | $response = Json\Response::get(); |
| 394 | 393 | $readonlys = $sel_options = array(); |
| 395 | 394 | |
| 396 | 395 | if (isset($params['mime'])) |
| 397 | 396 | { |
| 398 | - foreach((array)$params['mime'] as $key => $value) |
|
| 397 | + foreach ((array)$params['mime'] as $key => $value) |
|
| 399 | 398 | { |
| 400 | 399 | if (is_numeric($key)) |
| 401 | 400 | { |
| 402 | - $sel_options['mime'][$value] = lang('%1 files',strtoupper(Api\MimeMagic::mime2ext($value))).' ('.$value.')'; |
|
| 401 | + $sel_options['mime'][$value] = lang('%1 files', strtoupper(Api\MimeMagic::mime2ext($value))).' ('.$value.')'; |
|
| 403 | 402 | } |
| 404 | 403 | else |
| 405 | 404 | { |
| 406 | - $sel_options['mime'][$key] = lang('%1 files',strtoupper($value)).' ('.$key.')'; |
|
| 405 | + $sel_options['mime'][$key] = lang('%1 files', strtoupper($value)).' ('.$key.')'; |
|
| 407 | 406 | } |
| 408 | 407 | } |
| 409 | 408 | } |
@@ -413,10 +412,10 @@ discard block |
||
| 413 | 412 | $content = array_merge($params, array( |
| 414 | 413 | 'name' => (string)$params['name'], |
| 415 | 414 | 'path' => empty($params['path']) ? |
| 416 | - Api\Cache::getSession('filemanger', 'select_path'): $params['path'] |
|
| 415 | + Api\Cache::getSession('filemanger', 'select_path') : $params['path'] |
|
| 417 | 416 | )); |
| 418 | 417 | unset($content['mime']); |
| 419 | - if (!in_array($content['mode'],array('open','open-multiple','saveas','select-dir'))) |
|
| 418 | + if (!in_array($content['mode'], array('open', 'open-multiple', 'saveas', 'select-dir'))) |
|
| 420 | 419 | { |
| 421 | 420 | throw new Api\Exception\WrongParameter("Wrong or unset required mode parameter!"); |
| 422 | 421 | } |
@@ -426,11 +425,11 @@ discard block |
||
| 426 | 425 | list($content['mime']) = each($sel_options['mime']); |
| 427 | 426 | } |
| 428 | 427 | } |
| 429 | - elseif(isset($content['action'])) |
|
| 428 | + elseif (isset($content['action'])) |
|
| 430 | 429 | { |
| 431 | 430 | $action = $content['action']; |
| 432 | 431 | unset($content['action']); |
| 433 | - switch($action) |
|
| 432 | + switch ($action) |
|
| 434 | 433 | { |
| 435 | 434 | case 'home': |
| 436 | 435 | $content['path'] = \EGroupware\Api\Vfs::get_home_dir(); |
@@ -439,11 +438,10 @@ discard block |
||
| 439 | 438 | } |
| 440 | 439 | if (!empty($content['app']) && $content['old_app'] != $content['app']) |
| 441 | 440 | { |
| 442 | - $content['path'] = $content['app'] == 'home'? \EGroupware\Api\Vfs::get_home_dir(): |
|
| 443 | - '/apps/'.$content['app']; |
|
| 441 | + $content['path'] = $content['app'] == 'home' ? \EGroupware\Api\Vfs::get_home_dir() : '/apps/'.$content['app']; |
|
| 444 | 442 | } |
| 445 | 443 | |
| 446 | - $favorites_flag = substr($content['path'],0,strlen('/apps/favorites')) == '/apps/favorites'; |
|
| 444 | + $favorites_flag = substr($content['path'], 0, strlen('/apps/favorites')) == '/apps/favorites'; |
|
| 447 | 445 | if (!$favorites_flag && (!$content['path'] || !\EGroupware\Api\Vfs::is_dir($content['path']))) |
| 448 | 446 | { |
| 449 | 447 | $content['path'] = \EGroupware\Api\Vfs::get_home_dir(); |
@@ -456,12 +454,12 @@ discard block |
||
| 456 | 454 | $favorites = \EGroupware\Api\Framework\Favorites::get_favorites('filemanager'); |
| 457 | 455 | $n = 0; |
| 458 | 456 | $content['dir'] = array(); |
| 459 | - foreach($favorites as $favorite) |
|
| 457 | + foreach ($favorites as $favorite) |
|
| 460 | 458 | { |
| 461 | 459 | $path = $favorite['state']['path']; |
| 462 | 460 | // Just directories |
| 463 | - if(!$path) continue; |
|
| 464 | - if ($path == $content['path']) continue; // remove directory itself |
|
| 461 | + if (!$path) continue; |
|
| 462 | + if ($path == $content['path']) continue; // remove directory itself |
|
| 465 | 463 | |
| 466 | 464 | $mime = \EGroupware\Api\Vfs::mime_content_type($path); |
| 467 | 465 | $content['dir'][$n] = array( |
@@ -477,29 +475,29 @@ discard block |
||
| 477 | 475 | ++$n; |
| 478 | 476 | } |
| 479 | 477 | } |
| 480 | - else if (!($files = \EGroupware\Api\Vfs::find($content['path'],array( |
|
| 478 | + else if (!($files = \EGroupware\Api\Vfs::find($content['path'], array( |
|
| 481 | 479 | 'dirsontop' => true, |
| 482 | 480 | 'order' => 'name', |
| 483 | 481 | 'sort' => 'ASC', |
| 484 | 482 | 'maxdepth' => 1, |
| 485 | 483 | )))) |
| 486 | 484 | { |
| 487 | - $content['msg'] = lang("Can't open directory %1!",$content['path']); |
|
| 485 | + $content['msg'] = lang("Can't open directory %1!", $content['path']); |
|
| 488 | 486 | } |
| 489 | 487 | else |
| 490 | 488 | { |
| 491 | 489 | $n = 0; |
| 492 | 490 | $content['dir'] = array('mode' => $content['mode']); |
| 493 | - foreach($files as $path) |
|
| 491 | + foreach ($files as $path) |
|
| 494 | 492 | { |
| 495 | - if ($path == $content['path']) continue; // remove directory itself |
|
| 493 | + if ($path == $content['path']) continue; // remove directory itself |
|
| 496 | 494 | |
| 497 | 495 | $name = \EGroupware\Api\Vfs::basename($path); |
| 498 | 496 | $is_dir = \EGroupware\Api\Vfs::is_dir($path); |
| 499 | 497 | $mime = \EGroupware\Api\Vfs::mime_content_type($path); |
| 500 | 498 | if ($content['mime'] && !$is_dir && $mime != $content['mime']) |
| 501 | 499 | { |
| 502 | - continue; // does not match mime-filter --> ignore |
|
| 500 | + continue; // does not match mime-filter --> ignore |
|
| 503 | 501 | } |
| 504 | 502 | $content['dir'][$n] = array( |
| 505 | 503 | 'name' => $name, |
@@ -513,12 +511,12 @@ discard block |
||
| 513 | 511 | } |
| 514 | 512 | ++$n; |
| 515 | 513 | } |
| 516 | - if (!$n) $readonlys['selected[]'] = true; // remove checkbox from empty line |
|
| 514 | + if (!$n) $readonlys['selected[]'] = true; // remove checkbox from empty line |
|
| 517 | 515 | } |
| 518 | 516 | $readonlys = array_merge($readonlys, array( |
| 519 | 517 | 'createdir' => !\EGroupware\Api\Vfs::is_writable($content['path']), |
| 520 | 518 | 'upload_file' => !\EGroupware\Api\Vfs::is_writable($content['path']) || |
| 521 | - !in_array($content['mode'],array('open', 'open-multiple')), |
|
| 519 | + !in_array($content['mode'], array('open', 'open-multiple')), |
|
| 522 | 520 | 'favorites' => !isset($GLOBALS['egw_info']['apps']['stylite']) |
| 523 | 521 | )); |
| 524 | 522 | |
@@ -539,7 +537,7 @@ discard block |
||
| 539 | 537 | 'content' => $content, |
| 540 | 538 | 'sel_options' => $sel_options, |
| 541 | 539 | 'readonlys' => $readonlys, |
| 542 | - 'modifications' => array ( |
|
| 540 | + 'modifications' => array( |
|
| 543 | 541 | 'mode' => $content['mode'], |
| 544 | 542 | 'method' => $content['method'], |
| 545 | 543 | 'id' => $content['id'], |
@@ -557,7 +555,7 @@ discard block |
||
| 557 | 555 | * @param type $dir name of the directory |
| 558 | 556 | * @param type $path path to create directory in it |
| 559 | 557 | */ |
| 560 | - public static function ajax_create_dir ($dir, $path) |
|
| 558 | + public static function ajax_create_dir($dir, $path) |
|
| 561 | 559 | { |
| 562 | 560 | $response = Json\Response::get(); |
| 563 | 561 | $msg = ''; |
@@ -579,20 +577,20 @@ discard block |
||
| 579 | 577 | * @param array $files temp files |
| 580 | 578 | * @param string $dir vfs path to store the file |
| 581 | 579 | */ |
| 582 | - static function ajax_vfsSelect_storeFile ($files, $dir) |
|
| 580 | + static function ajax_vfsSelect_storeFile($files, $dir) |
|
| 583 | 581 | { |
| 584 | 582 | $response = Api\Json\Response::get(); |
| 585 | - $result = array ( |
|
| 583 | + $result = array( |
|
| 586 | 584 | 'errs' => 0, |
| 587 | 585 | 'msg' => '', |
| 588 | 586 | 'files' => 0, |
| 589 | 587 | ); |
| 590 | 588 | $script_error = 0; |
| 591 | - foreach($files as $tmp_name => &$data) |
|
| 589 | + foreach ($files as $tmp_name => &$data) |
|
| 592 | 590 | { |
| 593 | 591 | $path = \EGroupware\Api\Vfs::concat($dir, \EGroupware\Api\Vfs::encodePathComponent($data['name'])); |
| 594 | 592 | |
| 595 | - if(\EGroupware\Api\Vfs::deny_script($path)) |
|
| 593 | + if (\EGroupware\Api\Vfs::deny_script($path)) |
|
| 596 | 594 | { |
| 597 | 595 | if (!isset($script_error)) |
| 598 | 596 | { |
@@ -614,7 +612,7 @@ discard block |
||
| 614 | 612 | { |
| 615 | 613 | if (is_dir($GLOBALS['egw_info']['server']['temp_dir']) && is_writable($GLOBALS['egw_info']['server']['temp_dir'])) |
| 616 | 614 | { |
| 617 | - $tmp_path = $GLOBALS['egw_info']['server']['temp_dir'] . '/' . basename($tmp_name); |
|
| 615 | + $tmp_path = $GLOBALS['egw_info']['server']['temp_dir'].'/'.basename($tmp_name); |
|
| 618 | 616 | } |
| 619 | 617 | else |
| 620 | 618 | { |
@@ -44,7 +44,8 @@ discard block |
||
| 44 | 44 | { |
| 45 | 45 | $this->attrs['allowFreeEntries'] = true; |
| 46 | 46 | |
| 47 | - if($xml) { |
|
| 47 | + if($xml) |
|
| 48 | + { |
|
| 48 | 49 | parent::__construct($xml); |
| 49 | 50 | } |
| 50 | 51 | } |
@@ -142,8 +143,7 @@ discard block |
||
| 142 | 143 | !($this->attrs['domainOptional'] && preg_match (Taglist::EMAIL_PREG_NO_DOMAIN, $val)) && |
| 143 | 144 | // Allow merge placeholders. Might be a better way to do this though. |
| 144 | 145 | !preg_match('/{{.+}}|\$\$.+\$\$/',$val) |
| 145 | - ) |
|
| 146 | - { |
|
| 146 | + ) { |
|
| 147 | 147 | self::set_validation_error($form_name,lang("'%1' has an invalid format",$val),''); |
| 148 | 148 | } |
| 149 | 149 | } |
@@ -158,7 +158,10 @@ discard block |
||
| 158 | 158 | $valid =& self::get_array($validated, $form_name, true); |
| 159 | 159 | // returning null instead of array(), as array() will be overwritten by etemplate_new::complete_array_merge() |
| 160 | 160 | // with preserved old content and therefore user can not empty a taglist |
| 161 | - if (true) $valid = $value ? $value : null; |
|
| 161 | + if (true) |
|
| 162 | + { |
|
| 163 | + $valid = $value ? $value : null; |
|
| 164 | + } |
|
| 162 | 165 | //error_log(__METHOD__."() $form_name: ".array2string($value_in).' --> '.array2string($value).', allowed='.array2string($allowed)); |
| 163 | 166 | } |
| 164 | 167 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | { |
| 45 | 45 | $this->attrs['allowFreeEntries'] = true; |
| 46 | 46 | |
| 47 | - if($xml) { |
|
| 47 | + if ($xml) { |
|
| 48 | 48 | parent::__construct($xml); |
| 49 | 49 | } |
| 50 | 50 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | if ($type == "account") |
| 65 | 65 | { |
| 66 | 66 | // Only search if a query was provided - don't search for all accounts |
| 67 | - if($query) |
|
| 67 | + if ($query) |
|
| 68 | 68 | { |
| 69 | 69 | $options['account_type'] = $_REQUEST['account_type']; |
| 70 | 70 | $links = Api\Accounts::link_query($query, $options); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | $links = Api\Link::query($app, $query, $options); |
| 76 | 76 | } |
| 77 | 77 | $results = array(); |
| 78 | - foreach($links as $id => $name) |
|
| 78 | + foreach ($links as $id => $name) |
|
| 79 | 79 | { |
| 80 | 80 | $results[] = array('id' => $id, 'label' => $name); |
| 81 | 81 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | public static function ajax_email() |
| 96 | 96 | { |
| 97 | 97 | // If no mail app access, use link system -> addressbook |
| 98 | - if(!$GLOBALS['egw_info']['apps']['mail']) |
|
| 98 | + if (!$GLOBALS['egw_info']['apps']['mail']) |
|
| 99 | 99 | { |
| 100 | 100 | $_REQUEST['app'] = 'addressbook-email'; |
| 101 | 101 | return self::ajax_search(); |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | * @param array $content |
| 114 | 114 | * @param array &$validated=array() validated content |
| 115 | 115 | */ |
| 116 | - public function validate($cname, array $expand, array $content, &$validated=array()) |
|
| 116 | + public function validate($cname, array $expand, array $content, &$validated = array()) |
|
| 117 | 117 | { |
| 118 | 118 | $form_name = self::form_name($cname, $this->id, $expand); |
| 119 | 119 | |
@@ -123,39 +123,39 @@ discard block |
||
| 123 | 123 | $value = $value_in = self::get_array($content, $form_name); |
| 124 | 124 | $allowed = Select::selOptions($form_name); |
| 125 | 125 | |
| 126 | - foreach((array) $value as $key => $val) |
|
| 126 | + foreach ((array)$value as $key => $val) |
|
| 127 | 127 | { |
| 128 | - if(count($allowed) && !$this->attrs['allowFreeEntries'] && !array_key_exists($val,$allowed)) |
|
| 128 | + if (count($allowed) && !$this->attrs['allowFreeEntries'] && !array_key_exists($val, $allowed)) |
|
| 129 | 129 | { |
| 130 | - self::set_validation_error($form_name,lang("'%1' is NOT allowed ('%2')!",$val,implode("','",array_keys($allowed))),''); |
|
| 130 | + self::set_validation_error($form_name, lang("'%1' is NOT allowed ('%2')!", $val, implode("','", array_keys($allowed))), ''); |
|
| 131 | 131 | unset($value[$key]); |
| 132 | 132 | } |
| 133 | - if($this->type == 'taglist-email' && $this->attrs['include_lists'] && is_numeric($val)) |
|
| 133 | + if ($this->type == 'taglist-email' && $this->attrs['include_lists'] && is_numeric($val)) |
|
| 134 | 134 | { |
| 135 | 135 | $lists = $GLOBALS['egw']->contacts->get_lists(Api\Acl::READ); |
| 136 | - if(!array_key_exists($val, $lists)) |
|
| 136 | + if (!array_key_exists($val, $lists)) |
|
| 137 | 137 | { |
| 138 | - self::set_validation_error($form_name,lang("'%1' is NOT allowed ('%2')!",$val,implode("','",array_keys($lists))),''); |
|
| 138 | + self::set_validation_error($form_name, lang("'%1' is NOT allowed ('%2')!", $val, implode("','", array_keys($lists))), ''); |
|
| 139 | 139 | } |
| 140 | 140 | } |
| 141 | - else if($this->type == 'taglist-email' && !preg_match(Url::EMAIL_PREG, $val) && |
|
| 142 | - !($this->attrs['domainOptional'] && preg_match (Taglist::EMAIL_PREG_NO_DOMAIN, $val)) && |
|
| 141 | + else if ($this->type == 'taglist-email' && !preg_match(Url::EMAIL_PREG, $val) && |
|
| 142 | + !($this->attrs['domainOptional'] && preg_match(Taglist::EMAIL_PREG_NO_DOMAIN, $val)) && |
|
| 143 | 143 | // Allow merge placeholders. Might be a better way to do this though. |
| 144 | - !preg_match('/{{.+}}|\$\$.+\$\$/',$val) |
|
| 144 | + !preg_match('/{{.+}}|\$\$.+\$\$/', $val) |
|
| 145 | 145 | ) |
| 146 | 146 | { |
| 147 | - self::set_validation_error($form_name,lang("'%1' has an invalid format",$val),''); |
|
| 147 | + self::set_validation_error($form_name, lang("'%1' has an invalid format", $val), ''); |
|
| 148 | 148 | } |
| 149 | 149 | } |
| 150 | 150 | if ($ok && $value === '' && $this->attrs['needed']) |
| 151 | 151 | { |
| 152 | - self::set_validation_error($form_name,lang('Field must not be empty !!!',$value),''); |
|
| 152 | + self::set_validation_error($form_name, lang('Field must not be empty !!!', $value), ''); |
|
| 153 | 153 | } |
| 154 | 154 | if (array_key_exists('multiple', $this->attrs) && (!$this->attrs['multiple'] || $this->attrs['multiple'] === 'false') && is_array($value)) |
| 155 | 155 | { |
| 156 | 156 | $value = array_shift($value); |
| 157 | 157 | } |
| 158 | - $valid =& self::get_array($validated, $form_name, true); |
|
| 158 | + $valid = & self::get_array($validated, $form_name, true); |
|
| 159 | 159 | // returning null instead of array(), as array() will be overwritten by etemplate_new::complete_array_merge() |
| 160 | 160 | // with preserved old content and therefore user can not empty a taglist |
| 161 | 161 | if (true) $valid = $value ? $value : null; |
@@ -24,8 +24,8 @@ discard block |
||
| 24 | 24 | $path = $GLOBALS['egw_info']['server']['files_dir'].'/anon-images'; |
| 25 | 25 | |
| 26 | 26 | if (!file_exists($path) || empty($_GET['src']) || |
| 27 | - basename($_GET['src']) !== $_GET['src'] || // make sure no directory traversal |
|
| 28 | - !preg_match('/^[a-z 0-9._-]+\.(jpe?g|png|gif|svg|ico)$/i', $_GET['src']) || // only allow images, not eg. Javascript! |
|
| 27 | + basename($_GET['src']) !== $_GET['src'] || // make sure no directory traversal |
|
| 28 | + !preg_match('/^[a-z 0-9._-]+\.(jpe?g|png|gif|svg|ico)$/i', $_GET['src']) || // only allow images, not eg. Javascript! |
|
| 29 | 29 | !file_exists($path .= '/'.$_GET['src']) || |
| 30 | 30 | !($fp = fopen($path, 'r'))) |
| 31 | 31 | { |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | } |
| 35 | 35 | else |
| 36 | 36 | { |
| 37 | - Api\Session::cache_control(864000); // 10 days |
|
| 37 | + Api\Session::cache_control(864000); // 10 days |
|
| 38 | 38 | $size = filesize($path); |
| 39 | 39 | header('ETag: "'.md5($_GET['src'].$size.filemtime($path)).'"'); |
| 40 | 40 | header('Content-Type: '.Api\MimeMagic::filename2mime($_GET['src'])); |
@@ -108,7 +108,7 @@ |
||
| 108 | 108 | |
| 109 | 109 | if ($GLOBALS['egw_info']['user']['apps']['admin'] && !Api\Header\UserAgent::mobile()) |
| 110 | 110 | { |
| 111 | - $file = Array( |
|
| 111 | + $file = array( |
|
| 112 | 112 | 'Site configuration' => Egw::link('/index.php',array( |
| 113 | 113 | 'menuaction' => 'infolog.infolog_ui.admin', |
| 114 | 114 | // As long as CKEditor needs CSP exceptions, this needs to |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | static function not_enum_group_acls($location) |
| 31 | 31 | { |
| 32 | - unset($location); // not used, but part of hook signature |
|
| 32 | + unset($location); // not used, but part of hook signature |
|
| 33 | 33 | $config = Api\Config::read('infolog'); |
| 34 | 34 | |
| 35 | 35 | return $config['group_owners']; |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | static function search_link($location) |
| 45 | 45 | { |
| 46 | - unset($location); // not used, but part of hook signature |
|
| 46 | + unset($location); // not used, but part of hook signature |
|
| 47 | 47 | |
| 48 | 48 | return array( |
| 49 | 49 | 'query' => 'infolog.infolog_bo.link_query', |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | 'add_id' => 'action_id', |
| 67 | 67 | 'add_popup' => '760x570', |
| 68 | 68 | 'file_access'=> 'infolog.infolog_bo.file_access', |
| 69 | - 'file_access_user' => true, // file_access supports 4th parameter $user |
|
| 69 | + 'file_access_user' => true, // file_access supports 4th parameter $user |
|
| 70 | 70 | 'edit' => array( |
| 71 | 71 | 'menuaction' => 'infolog.infolog_ui.edit', |
| 72 | 72 | ), |
@@ -93,46 +93,46 @@ discard block |
||
| 93 | 93 | display_sidebox($appname, lang('Favorites'), Framework\Favorites::list_favorites($appname)); |
| 94 | 94 | |
| 95 | 95 | $file = array( |
| 96 | - 'infolog list' => Egw::link('/index.php',array( |
|
| 96 | + 'infolog list' => Egw::link('/index.php', array( |
|
| 97 | 97 | 'menuaction' => 'infolog.infolog_ui.index', |
| 98 | 98 | 'ajax' => 'true')), |
| 99 | 99 | array( |
| 100 | - 'text' => lang('Add %1',lang(Link::get_registry($appname, 'entry'))), |
|
| 100 | + 'text' => lang('Add %1', lang(Link::get_registry($appname, 'entry'))), |
|
| 101 | 101 | 'no_lang' => true, |
| 102 | 102 | 'link' => "javascript:app.infolog.add_link_sidemenu();" |
| 103 | 103 | ), |
| 104 | - 'Placeholders' => Egw::link('/index.php','menuaction=infolog.infolog_merge.show_replacements') |
|
| 104 | + 'Placeholders' => Egw::link('/index.php', 'menuaction=infolog.infolog_merge.show_replacements') |
|
| 105 | 105 | ); |
| 106 | - display_sidebox($appname,$GLOBALS['egw_info']['apps']['infolog']['title'].' '.lang('Menu'),$file); |
|
| 106 | + display_sidebox($appname, $GLOBALS['egw_info']['apps']['infolog']['title'].' '.lang('Menu'), $file); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | if ($GLOBALS['egw_info']['user']['apps']['admin'] && !Api\Header\UserAgent::mobile()) |
| 110 | 110 | { |
| 111 | 111 | $file = Array( |
| 112 | - 'Site configuration' => Egw::link('/index.php',array( |
|
| 112 | + 'Site configuration' => Egw::link('/index.php', array( |
|
| 113 | 113 | 'menuaction' => 'infolog.infolog_ui.admin', |
| 114 | 114 | // As long as CKEditor needs CSP exceptions, this needs to |
| 115 | 115 | // load in an iframe |
| 116 | 116 | 'ajax' => 'false', |
| 117 | 117 | )), |
| 118 | - 'Global Categories' => Egw::link('/index.php',array( |
|
| 118 | + 'Global Categories' => Egw::link('/index.php', array( |
|
| 119 | 119 | 'menuaction' => 'admin.admin_categories.index', |
| 120 | 120 | 'appname' => $appname, |
| 121 | 121 | 'global_cats'=> True, |
| 122 | 122 | 'ajax' => 'true', |
| 123 | 123 | )), |
| 124 | - 'Custom fields, type and status' => Egw::link('/index.php',array( |
|
| 124 | + 'Custom fields, type and status' => Egw::link('/index.php', array( |
|
| 125 | 125 | 'menuaction' => 'infolog.infolog_customfields.index', |
| 126 | 126 | 'ajax' => 'true', |
| 127 | 127 | )), |
| 128 | 128 | ); |
| 129 | 129 | if ($location == 'admin') |
| 130 | 130 | { |
| 131 | - display_section($appname,$file); |
|
| 131 | + display_section($appname, $file); |
|
| 132 | 132 | } |
| 133 | 133 | else |
| 134 | 134 | { |
| 135 | - display_sidebox($appname,lang('Admin'),$file); |
|
| 135 | + display_sidebox($appname, lang('Admin'), $file); |
|
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | 138 | } |
@@ -145,19 +145,19 @@ discard block |
||
| 145 | 145 | static function settings() |
| 146 | 146 | { |
| 147 | 147 | /* Setup some values to fill the array of this app's settings below */ |
| 148 | - $info = new infolog_bo(); // need some labels from |
|
| 148 | + $info = new infolog_bo(); // need some labels from |
|
| 149 | 149 | $filters = $show_home = array(); |
| 150 | 150 | $show_home[] = lang("DON'T show InfoLog"); |
| 151 | 151 | $filters['none'] = $info->filters['']; |
| 152 | - foreach($info->filters as $key => $label) |
|
| 152 | + foreach ($info->filters as $key => $label) |
|
| 153 | 153 | { |
| 154 | 154 | $show_home[$key] = $filters[$key] = lang($label); |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | // migrage old filter-pref 1,2 to the filter one 'own-open-today' |
| 158 | - if (isset($GLOBALS['type']) && in_array($GLOBALS['egw']->preferences->{$GLOBALS['type']}['homeShowEvents'],array('1','2'))) |
|
| 158 | + if (isset($GLOBALS['type']) && in_array($GLOBALS['egw']->preferences->{$GLOBALS['type']}['homeShowEvents'], array('1', '2'))) |
|
| 159 | 159 | { |
| 160 | - $GLOBALS['egw']->preferences->add('infolog','homeShowEvents','own-open-today',$GLOBALS['type']); |
|
| 160 | + $GLOBALS['egw']->preferences->add('infolog', 'homeShowEvents', 'own-open-today', $GLOBALS['type']); |
|
| 161 | 161 | $GLOBALS['egw']->preferences->save_repository(); |
| 162 | 162 | } |
| 163 | 163 | $show_links = array( |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | 'help' => 'Should the Infolog list show a unique numerical Id, which can be used eg. as ticket Id.', |
| 235 | 235 | 'xmlrpc' => True, |
| 236 | 236 | 'admin' => False, |
| 237 | - 'default'=> '1', // Yes |
|
| 237 | + 'default'=> '1', // Yes |
|
| 238 | 238 | ), |
| 239 | 239 | 'listNoSubs' => array( |
| 240 | 240 | 'type' => 'select', |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | 'help' => 'Should InfoLog show Subtasks, -calls or -notes in the normal view or not. You can always view the Subs via there parent.', |
| 249 | 249 | 'xmlrpc' => True, |
| 250 | 250 | 'admin' => False, |
| 251 | - 'default'=> '0', // Allways show them |
|
| 251 | + 'default'=> '0', // Allways show them |
|
| 252 | 252 | ), |
| 253 | 253 | 'show_links' => array( |
| 254 | 254 | 'type' => 'select', |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | 'help' => 'Should the Infolog list show the percent done only for status ongoing or two separate icons.', |
| 269 | 269 | 'xmlrpc' => True, |
| 270 | 270 | 'admin' => False, |
| 271 | - 'default'=> 1, // Yes |
|
| 271 | + 'default'=> 1, // Yes |
|
| 272 | 272 | ), |
| 273 | 273 | 'limit_des_lines' => array( |
| 274 | 274 | 'type' => 'input', |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | 'help' => 'Do you want a notification, if items you created get updated?', |
| 298 | 298 | 'xmlrpc' => True, |
| 299 | 299 | 'admin' => False, |
| 300 | - 'default'=> '1', // Yes |
|
| 300 | + 'default'=> '1', // Yes |
|
| 301 | 301 | ); |
| 302 | 302 | $settings['notify_assigned'] = array( |
| 303 | 303 | 'type' => 'select', |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | ), |
| 312 | 312 | 'xmlrpc' => True, |
| 313 | 313 | 'admin' => False, |
| 314 | - 'default'=> '1', // Yes |
|
| 314 | + 'default'=> '1', // Yes |
|
| 315 | 315 | ); |
| 316 | 316 | |
| 317 | 317 | // to add options for more then 3 days back or in advance, you need to update soinfolog::users_with_open_entries()! |
@@ -320,8 +320,8 @@ discard block |
||
| 320 | 320 | '-1d' => lang('one day after'), |
| 321 | 321 | '0d' => lang('same day'), |
| 322 | 322 | '1d' => lang('one day in advance'), |
| 323 | - '2d' => lang('%1 days in advance',2), |
|
| 324 | - '3d' => lang('%1 days in advance',3), |
|
| 323 | + '2d' => lang('%1 days in advance', 2), |
|
| 324 | + '3d' => lang('%1 days in advance', 3), |
|
| 325 | 325 | ); |
| 326 | 326 | $settings['notify_due_delegated'] = array( |
| 327 | 327 | 'type' => 'select', |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | 'values' => $options, |
| 332 | 332 | 'xmlrpc' => True, |
| 333 | 333 | 'admin' => False, |
| 334 | - 'default'=> '0', // No |
|
| 334 | + 'default'=> '0', // No |
|
| 335 | 335 | ); |
| 336 | 336 | $settings['notify_due_responsible'] = array( |
| 337 | 337 | 'type' => 'select', |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | 'values' => $options, |
| 342 | 342 | 'xmlrpc' => True, |
| 343 | 343 | 'admin' => False, |
| 344 | - 'default'=> '0d', // Same day |
|
| 344 | + 'default'=> '0d', // Same day |
|
| 345 | 345 | ); |
| 346 | 346 | $settings['notify_start_delegated'] = array( |
| 347 | 347 | 'type' => 'select', |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | 'values' => $options, |
| 352 | 352 | 'xmlrpc' => True, |
| 353 | 353 | 'admin' => False, |
| 354 | - 'default'=> '0', // No |
|
| 354 | + 'default'=> '0', // No |
|
| 355 | 355 | ); |
| 356 | 356 | $settings['notify_start_responsible'] = array( |
| 357 | 357 | 'type' => 'select', |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | 'values' => $options, |
| 362 | 362 | 'xmlrpc' => True, |
| 363 | 363 | 'admin' => False, |
| 364 | - 'default'=> '0d', // Same day |
|
| 364 | + 'default'=> '0d', // Same day |
|
| 365 | 365 | ); |
| 366 | 366 | |
| 367 | 367 | // receive notification for items owned by groups you are part of |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | 'help' => 'Do you want a notification if items owned by groups you are part of get updated ?', |
| 373 | 373 | 'xmlrpc' => True, |
| 374 | 374 | 'admin' => False, |
| 375 | - 'default'=> '0', // No |
|
| 375 | + 'default'=> '0', // No |
|
| 376 | 376 | ); |
| 377 | 377 | // Notify for types (default) |
| 378 | 378 | $settings['no_notification_types'] = array( |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | 'name' => 'no_notification_types', |
| 382 | 382 | 'help' => "Automatically check 'Do not notify' for these types", |
| 383 | 383 | 'values' => $info->enums['type'], |
| 384 | - 'default'=> array(), // None |
|
| 384 | + 'default'=> array(), // None |
|
| 385 | 385 | ); |
| 386 | 386 | |
| 387 | 387 | $settings[] = array( |
@@ -400,8 +400,8 @@ discard block |
||
| 400 | 400 | 'size' => 60, |
| 401 | 401 | 'label' => 'Default document to insert entries', |
| 402 | 402 | 'name' => 'default_document', |
| 403 | - 'help' => lang('If you specify a document (full vfs path) here, %1 displays an extra document icon for each entry. That icon allows to download the specified document with the data inserted.',lang('infolog')).' '. |
|
| 404 | - lang('The document can contain placeholder like {{%1}}, to be replaced with the data.','info_subject').' '. |
|
| 403 | + 'help' => lang('If you specify a document (full vfs path) here, %1 displays an extra document icon for each entry. That icon allows to download the specified document with the data inserted.', lang('infolog')).' '. |
|
| 404 | + lang('The document can contain placeholder like {{%1}}, to be replaced with the data.', 'info_subject').' '. |
|
| 405 | 405 | lang('The following document-types are supported:').'*.rtf, *.txt', |
| 406 | 406 | 'run_lang' => false, |
| 407 | 407 | 'xmlrpc' => True, |
@@ -412,8 +412,8 @@ discard block |
||
| 412 | 412 | 'size' => 60, |
| 413 | 413 | 'label' => 'Directory with documents to insert entries', |
| 414 | 414 | 'name' => 'document_dir', |
| 415 | - 'help' => lang('If you specify a directory (full vfs path) here, %1 displays an action for each document. That action allows to download the specified document with the data inserted.',lang('infolog')).' '. |
|
| 416 | - lang('The document can contain placeholder like {{%1}}, to be replaced with the data.','info_subject').' '. |
|
| 415 | + 'help' => lang('If you specify a directory (full vfs path) here, %1 displays an action for each document. That action allows to download the specified document with the data inserted.', lang('infolog')).' '. |
|
| 416 | + lang('The document can contain placeholder like {{%1}}, to be replaced with the data.', 'info_subject').' '. |
|
| 417 | 417 | lang('The following document-types are supported:').'*.rtf, *.txt', |
| 418 | 418 | 'run_lang' => false, |
| 419 | 419 | 'xmlrpc' => True, |
@@ -502,12 +502,12 @@ discard block |
||
| 502 | 502 | */ |
| 503 | 503 | private static function all_cats() |
| 504 | 504 | { |
| 505 | - $categories = new Api\Categories('','infolog'); |
|
| 505 | + $categories = new Api\Categories('', 'infolog'); |
|
| 506 | 506 | $accountId = $GLOBALS['egw_info']['user']['account_id']; |
| 507 | 507 | |
| 508 | - foreach((array)$categories->return_sorted_array(0,False,'','','',true) as $cat) |
|
| 508 | + foreach ((array)$categories->return_sorted_array(0, False, '', '', '', true) as $cat) |
|
| 509 | 509 | { |
| 510 | - $s = str_repeat(' ',$cat['level']) . stripslashes($cat['name']); |
|
| 510 | + $s = str_repeat(' ', $cat['level']).stripslashes($cat['name']); |
|
| 511 | 511 | |
| 512 | 512 | if ($cat['app_name'] == 'phpgw' || $cat['owner'] == '-1') |
| 513 | 513 | { |
@@ -515,13 +515,13 @@ discard block |
||
| 515 | 515 | } |
| 516 | 516 | elseif ($cat['owner'] != $accountId) |
| 517 | 517 | { |
| 518 | - $s .= '<' . $GLOBALS['egw']->accounts->id2name($cat['owner'], 'account_fullname') . '>'; |
|
| 518 | + $s .= '<'.$GLOBALS['egw']->accounts->id2name($cat['owner'], 'account_fullname').'>'; |
|
| 519 | 519 | } |
| 520 | 520 | elseif ($cat['access'] == 'private') |
| 521 | 521 | { |
| 522 | 522 | $s .= ' ♥'; |
| 523 | 523 | } |
| 524 | - $sel_options[$cat['id']] = $s; // 0.9.14 only |
|
| 524 | + $sel_options[$cat['id']] = $s; // 0.9.14 only |
|
| 525 | 525 | } |
| 526 | 526 | return $sel_options; |
| 527 | 527 | } |
@@ -542,7 +542,7 @@ discard block |
||
| 542 | 542 | |
| 543 | 543 | if (!$async->read('infolog-async-notification')) |
| 544 | 544 | { |
| 545 | - $async->set_timer(array('hour' => 2),'infolog-async-notification','infolog.infolog_bo.async_notification',null); |
|
| 545 | + $async->set_timer(array('hour' => 2), 'infolog-async-notification', 'infolog.infolog_bo.async_notification', null); |
|
| 546 | 546 | } |
| 547 | 547 | } |
| 548 | 548 | } |
@@ -555,7 +555,7 @@ discard block |
||
| 555 | 555 | */ |
| 556 | 556 | public static function acl_rights($params) |
| 557 | 557 | { |
| 558 | - unset($params); // not used, but default function signature for hooks |
|
| 558 | + unset($params); // not used, but default function signature for hooks |
|
| 559 | 559 | return array( |
| 560 | 560 | Acl::READ => 'read', |
| 561 | 561 | Acl::ADD => 'add', |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | */ |
| 574 | 574 | public static function categories($location) |
| 575 | 575 | { |
| 576 | - unset($location); // not used, but part of hook signature |
|
| 576 | + unset($location); // not used, but part of hook signature |
|
| 577 | 577 | return true; |
| 578 | 578 | } |
| 579 | 579 | |
@@ -584,9 +584,9 @@ discard block |
||
| 584 | 584 | */ |
| 585 | 585 | public static function mail_import($args) |
| 586 | 586 | { |
| 587 | - unset($args); // not used, but required by function signature |
|
| 587 | + unset($args); // not used, but required by function signature |
|
| 588 | 588 | |
| 589 | - return array ( |
|
| 589 | + return array( |
|
| 590 | 590 | 'menuaction' => 'infolog.infolog_ui.mail_import', |
| 591 | 591 | 'popup' => Link::get_registry('infolog', 'edit_popup') |
| 592 | 592 | ); |
@@ -40,12 +40,12 @@ |
||
| 40 | 40 | * @param string $cname |
| 41 | 41 | * @param array $expand values for keys 'c', 'row', 'c_', 'row_', 'cont' |
| 42 | 42 | */ |
| 43 | - public function beforeSendToClient($cname, array $expand=null) |
|
| 43 | + public function beforeSendToClient($cname, array $expand = null) |
|
| 44 | 44 | { |
| 45 | 45 | if ($this->attrs['activate_links']) |
| 46 | 46 | { |
| 47 | 47 | $form_name = self::form_name($cname, $this->id, $expand); |
| 48 | - $value =& self::get_array(self::$request->content, $form_name); |
|
| 48 | + $value = & self::get_array(self::$request->content, $form_name); |
|
| 49 | 49 | if (!empty($value)) |
| 50 | 50 | { |
| 51 | 51 | $value = htmlspecialchars($value); |