@@ -18,4 +18,6 @@ |
||
| 18 | 18 | /** |
| 19 | 19 | * Can not connect to database: eg. database down, wrong host, name or credentials |
| 20 | 20 | */ |
| 21 | -class Connection extends Db\Exception { } |
|
| 21 | +class Connection extends Db\Exception |
|
| 22 | +{ |
|
| 23 | +} |
|
@@ -29,7 +29,10 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | function __construct($msg=null,$code=100) |
| 31 | 31 | { |
| 32 | - if (is_null($msg)) $msg = lang('Database error!'); |
|
| 32 | + if (is_null($msg)) |
|
| 33 | + { |
|
| 34 | + $msg = lang('Database error!'); |
|
| 35 | + } |
|
| 33 | 36 | |
| 34 | 37 | parent::__construct($msg,$code); |
| 35 | 38 | } |
@@ -121,10 +121,13 @@ discard block |
||
| 121 | 121 | { |
| 122 | 122 | throw new Exception('next_record called with no query pending.'); |
| 123 | 123 | } |
| 124 | - if ($this->Row) // first row is already fetched |
|
| 124 | + if ($this->Row) |
|
| 125 | + { |
|
| 126 | + // first row is already fetched |
|
| 125 | 127 | { |
| 126 | 128 | $this->Query_ID->MoveNext(); |
| 127 | 129 | } |
| 130 | + } |
|
| 128 | 131 | ++$this->Row; |
| 129 | 132 | |
| 130 | 133 | $this->Record = $this->Query_ID->fields; |
@@ -133,12 +136,15 @@ discard block |
||
| 133 | 136 | { |
| 134 | 137 | return False; |
| 135 | 138 | } |
| 136 | - if ($this->capabilities[self::CAPABILITY_NAME_CASE] == 'upper') // maxdb, oracle, ... |
|
| 139 | + if ($this->capabilities[self::CAPABILITY_NAME_CASE] == 'upper') |
|
| 140 | + { |
|
| 141 | + // maxdb, oracle, ... |
|
| 137 | 142 | { |
| 138 | 143 | switch($fetch_mode) |
| 139 | 144 | { |
| 140 | 145 | case self::FETCH_ASSOC: |
| 141 | 146 | $this->Record = array_change_key_case($this->Record); |
| 147 | + } |
|
| 142 | 148 | break; |
| 143 | 149 | case self::FETCH_NUM: |
| 144 | 150 | $this->Record = array_values($this->Record); |
@@ -199,7 +205,8 @@ discard block |
||
| 199 | 205 | * @return bool True if sucessful, False if fails |
| 200 | 206 | */ |
| 201 | 207 | function unlock() |
| 202 | - {} |
|
| 208 | + { |
|
| 209 | +} |
|
| 203 | 210 | |
| 204 | 211 | /** |
| 205 | 212 | * Number of rows in current result set |
@@ -289,7 +296,10 @@ discard block |
||
| 289 | 296 | { |
| 290 | 297 | if (!is_numeric($column)) |
| 291 | 298 | { |
| 292 | - if ($strip) $column = str_replace($strip,'',$column); |
|
| 299 | + if ($strip) |
|
| 300 | + { |
|
| 301 | + $column = str_replace($strip,'',$column); |
|
| 302 | + } |
|
| 293 | 303 | |
| 294 | 304 | $result[$column] = $value; |
| 295 | 305 | } |
@@ -301,4 +311,6 @@ discard block |
||
| 301 | 311 | /** |
| 302 | 312 | * @deprecated use EGroupware\Api\Db\CallbackIterator |
| 303 | 313 | */ |
| 304 | -class egw_db_callback_iterator extends Api\Db\CallbackIterator {} |
|
| 314 | +class egw_db_callback_iterator extends Api\Db\CallbackIterator |
|
| 315 | +{ |
|
| 316 | +} |
|
@@ -95,7 +95,11 @@ discard block |
||
| 95 | 95 | { |
| 96 | 96 | //error_log(__METHOD__."($name)".function_backtrace()); |
| 97 | 97 | |
| 98 | - if ($name == 'js') $name = 'framework'; // javascript class is integrated now into framework |
|
| 98 | + if ($name == 'js') |
|
| 99 | + { |
|
| 100 | + $name = 'framework'; |
|
| 101 | + } |
|
| 102 | + // javascript class is integrated now into framework |
|
| 99 | 103 | |
| 100 | 104 | if (isset($this->$name)) |
| 101 | 105 | { |
@@ -104,7 +108,10 @@ discard block |
||
| 104 | 108 | |
| 105 | 109 | if (!isset(self::$sub_objects[$name]) && !class_exists('EGroupware\\Api\\'.ucfirst($name)) && !class_exists($name)) |
| 106 | 110 | { |
| 107 | - if ($name != 'ADOdb') error_log(__METHOD__.": There's NO $name object! ".function_backtrace()); |
|
| 111 | + if ($name != 'ADOdb') |
|
| 112 | + { |
|
| 113 | + error_log(__METHOD__.": There's NO $name object! ".function_backtrace()); |
|
| 114 | + } |
|
| 108 | 115 | return null; |
| 109 | 116 | } |
| 110 | 117 | switch($name) |
@@ -121,7 +128,10 @@ discard block |
||
| 121 | 128 | return $this->ldap = Api\Ldap::factory(false); |
| 122 | 129 | default: |
| 123 | 130 | $class = isset(self::$sub_objects[$name]) ? self::$sub_objects[$name] : 'EGroupware\\Api\\'.ucfirst($name); |
| 124 | - if (!class_exists($class)) $class = $name; |
|
| 131 | + if (!class_exists($class)) |
|
| 132 | + { |
|
| 133 | + $class = $name; |
|
| 134 | + } |
|
| 125 | 135 | break; |
| 126 | 136 | } |
| 127 | 137 | return $this->$name = new $class(); |
@@ -116,7 +116,10 @@ discard block |
||
| 116 | 116 | if ($data['is_contactform']) |
| 117 | 117 | { |
| 118 | 118 | $copy = preg_split('/, ?/',$data['email_contactform']); |
| 119 | - if ($data['email_copytoreceiver']) $copy[] = $data['email']; |
|
| 119 | + if ($data['email_copytoreceiver']) |
|
| 120 | + { |
|
| 121 | + $copy[] = $data['email']; |
|
| 122 | + } |
|
| 120 | 123 | return $copy; |
| 121 | 124 | } |
| 122 | 125 | break; |
@@ -150,7 +153,10 @@ discard block |
||
| 150 | 153 | { |
| 151 | 154 | $changed_fields = self::changed_fields($data,$old); |
| 152 | 155 | } |
| 153 | - if (!$changed_fields) return 0; |
|
| 156 | + if (!$changed_fields) |
|
| 157 | + { |
|
| 158 | + return 0; |
|
| 159 | + } |
|
| 154 | 160 | |
| 155 | 161 | foreach(array('adr_one_countryname' => 'adr_one_countrycode', 'adr_two_countryname' => 'adr_two_countrycode') as $name => $code) |
| 156 | 162 | { |
@@ -231,7 +237,10 @@ discard block |
||
| 231 | 237 | |
| 232 | 238 | foreach($this->contacts->contact_fields as $name => $label) |
| 233 | 239 | { |
| 234 | - if (!$data[$name] && $name != 'owner') continue; |
|
| 240 | + if (!$data[$name] && $name != 'owner') |
|
| 241 | + { |
|
| 242 | + continue; |
|
| 243 | + } |
|
| 235 | 244 | |
| 236 | 245 | switch($name) |
| 237 | 246 | { |
@@ -84,7 +84,11 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | function __construct(array $ldap_config=null, $ds=null) |
| 86 | 86 | { |
| 87 | - if (false) parent::__construct (); // quiten IDE warning, we are explicitly NOT calling parrent constructor! |
|
| 87 | + if (false) |
|
| 88 | + { |
|
| 89 | + parent::__construct (); |
|
| 90 | + } |
|
| 91 | + // quiten IDE warning, we are explicitly NOT calling parrent constructor! |
|
| 88 | 92 | |
| 89 | 93 | $this->accountName = $GLOBALS['egw_info']['user']['account_lid']; |
| 90 | 94 | |
@@ -202,10 +206,16 @@ discard block |
||
| 202 | 206 | $contact['id'] = $contact['uid'] = $this->accounts_ads->objectguid2str($data['objectguid']); |
| 203 | 207 | |
| 204 | 208 | // ignore system accounts |
| 205 | - if ($contact['account_id'] < Api\Accounts\Ads::MIN_ACCOUNT_ID) return false; |
|
| 209 | + if ($contact['account_id'] < Api\Accounts\Ads::MIN_ACCOUNT_ID) |
|
| 210 | + { |
|
| 211 | + return false; |
|
| 212 | + } |
|
| 206 | 213 | |
| 207 | 214 | // ignore deactivated or expired accounts |
| 208 | - if (!$this->accounts_ads->user_active($data)) return false; |
|
| 215 | + if (!$this->accounts_ads->user_active($data)) |
|
| 216 | + { |
|
| 217 | + return false; |
|
| 218 | + } |
|
| 209 | 219 | |
| 210 | 220 | $this->_inetorgperson2egw($contact, $data, 'displayname'); |
| 211 | 221 | } |
@@ -84,7 +84,10 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | protected function calendar_replacements($id,$last_event_too=false) |
| 86 | 86 | { |
| 87 | - if (!class_exists('calendar_boupdate')) return array(); |
|
| 87 | + if (!class_exists('calendar_boupdate')) |
|
| 88 | + { |
|
| 89 | + return array(); |
|
| 90 | + } |
|
| 88 | 91 | |
| 89 | 92 | $calendar = new calendar_boupdate(); |
| 90 | 93 | |
@@ -118,11 +121,17 @@ discard block |
||
| 118 | 121 | foreach($events as $key => $event) |
| 119 | 122 | { |
| 120 | 123 | // Use -1 for previous key |
| 121 | - if($key < 0) $n = $key; |
|
| 124 | + if($key < 0) |
|
| 125 | + { |
|
| 126 | + $n = $key; |
|
| 127 | + } |
|
| 122 | 128 | |
| 123 | 129 | foreach($calendar->event2array($event) as $name => $data) |
| 124 | 130 | { |
| 125 | - if (substr($name,-4) == 'date') $name = substr($name,0,-4); |
|
| 131 | + if (substr($name,-4) == 'date') |
|
| 132 | + { |
|
| 133 | + $name = substr($name,0,-4); |
|
| 134 | + } |
|
| 126 | 135 | $replacements['$$calendar/'.$n.'/'.$name.'$$'] = is_array($data['data']) ? implode(', ',$data['data']) : $data['data']; |
| 127 | 136 | } |
| 128 | 137 | foreach(array('start','end') as $what) |
@@ -134,7 +143,10 @@ discard block |
||
| 134 | 143 | ) as $name => $format) |
| 135 | 144 | { |
| 136 | 145 | $value = $event[$what] ? date($format,$event[$what]) : ''; |
| 137 | - if ($format == 'l') $value = lang($value); |
|
| 146 | + if ($format == 'l') |
|
| 147 | + { |
|
| 148 | + $value = lang($value); |
|
| 149 | + } |
|
| 138 | 150 | $replacements['$$calendar/'.$n.'/'.$what.$name.'$$'] = $value; |
| 139 | 151 | } |
| 140 | 152 | } |
@@ -145,7 +157,8 @@ discard block |
||
| 145 | 157 | } |
| 146 | 158 | |
| 147 | 159 | // Need to set some keys if there is no previous event |
| 148 | - if($last_event_too && count($events['-1']) == 0) { |
|
| 160 | + if($last_event_too && count($events['-1']) == 0) |
|
| 161 | + { |
|
| 149 | 162 | $replacements['$$calendar/-1/start$$'] = ''; |
| 150 | 163 | $replacements['$$calendar/-1/end$$'] = ''; |
| 151 | 164 | $replacements['$$calendar/-1/owner$$'] = ''; |
@@ -170,22 +183,38 @@ discard block |
||
| 170 | 183 | $n = 0; |
| 171 | 184 | foreach($this->contacts->contact_fields as $name => $label) |
| 172 | 185 | { |
| 173 | - if (in_array($name,array('tid','label','geo'))) continue; // dont show them, as they are not used in the UI atm. |
|
| 186 | + if (in_array($name,array('tid','label','geo'))) |
|
| 187 | + { |
|
| 188 | + continue; |
|
| 189 | + } |
|
| 190 | + // dont show them, as they are not used in the UI atm. |
|
| 174 | 191 | |
| 175 | - if (in_array($name,array('email','org_name','tel_work','url')) && $n&1) // main values, which should be in the first column |
|
| 192 | + if (in_array($name,array('email','org_name','tel_work','url')) && $n&1) |
|
| 193 | + { |
|
| 194 | + // main values, which should be in the first column |
|
| 176 | 195 | { |
| 177 | 196 | echo "</tr>\n"; |
| 197 | + } |
|
| 178 | 198 | $n++; |
| 179 | 199 | } |
| 180 | - if (!($n&1)) echo '<tr>'; |
|
| 200 | + if (!($n&1)) |
|
| 201 | + { |
|
| 202 | + echo '<tr>'; |
|
| 203 | + } |
|
| 181 | 204 | echo '<td>{{'.$name.'}}</td><td>'.$label.'</td>'; |
| 182 | 205 | if($name == 'cat_id') |
| 183 | 206 | { |
| 184 | - if ($n&1) echo "</tr>\n"; |
|
| 207 | + if ($n&1) |
|
| 208 | + { |
|
| 209 | + echo "</tr>\n"; |
|
| 210 | + } |
|
| 185 | 211 | echo '<td>{{categories}}</td><td>'.lang('Category path').'</td>'; |
| 186 | 212 | $n++; |
| 187 | 213 | } |
| 188 | - if ($n&1) echo "</tr>\n"; |
|
| 214 | + if ($n&1) |
|
| 215 | + { |
|
| 216 | + echo "</tr>\n"; |
|
| 217 | + } |
|
| 189 | 218 | $n++; |
| 190 | 219 | } |
| 191 | 220 | |
@@ -242,14 +271,23 @@ discard block |
||
| 242 | 271 | 'owner' => lang('Owner'), |
| 243 | 272 | ) as $name => $label) |
| 244 | 273 | { |
| 245 | - if (in_array($name,array('start','end')) && $n&1) // main values, which should be in the first column |
|
| 274 | + if (in_array($name,array('start','end')) && $n&1) |
|
| 275 | + { |
|
| 276 | + // main values, which should be in the first column |
|
| 246 | 277 | { |
| 247 | 278 | echo "</tr>\n"; |
| 279 | + } |
|
| 248 | 280 | $n++; |
| 249 | 281 | } |
| 250 | - if (!($n&1)) echo '<tr>'; |
|
| 282 | + if (!($n&1)) |
|
| 283 | + { |
|
| 284 | + echo '<tr>'; |
|
| 285 | + } |
|
| 251 | 286 | echo '<td>{{calendar/#/'.$name.'}}</td><td>'.$label.'</td>'; |
| 252 | - if ($n&1) echo "</tr>\n"; |
|
| 287 | + if ($n&1) |
|
| 288 | + { |
|
| 289 | + echo "</tr>\n"; |
|
| 290 | + } |
|
| 253 | 291 | $n++; |
| 254 | 292 | } |
| 255 | 293 | echo "</table>\n"; |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | 'config_app' => 'phpgwapi', |
| 119 | 119 | 'config_name' => array('system_charset','install_id','temp_dir'), |
| 120 | 120 | ),__LINE__,__FILE__) as $row) |
| 121 | - { |
|
| 121 | + { |
|
| 122 | 122 | $GLOBALS['egw_info']['server'][$row['config_name']] = $row['config_value']; |
| 123 | 123 | } |
| 124 | 124 | if ($GLOBALS['egw_info']['server']['system_charset'] && $GLOBALS['egw_info']['server']['system_charset'] != 'utf-8') |
@@ -131,11 +131,14 @@ discard block |
||
| 131 | 131 | // if no server timezone set, use date_default_timezone_get() to determine it once |
| 132 | 132 | // it fills to log with deprecated warnings under 5.3 otherwise |
| 133 | 133 | if (empty($GLOBALS['egw_info']['server']['server_timezone']) || |
| 134 | - $GLOBALS['egw_info']['server']['server_timezone'] == 'System/Localtime') // treat invalid tz like empty! |
|
| 134 | + $GLOBALS['egw_info']['server']['server_timezone'] == 'System/Localtime') |
|
| 135 | + { |
|
| 136 | + // treat invalid tz like empty! |
|
| 135 | 137 | { |
| 136 | 138 | try |
| 137 | 139 | { |
| 138 | 140 | $tz = new \DateTimeZone(date_default_timezone_get()); |
| 141 | + } |
|
| 139 | 142 | Config::save_value('server_timezone',$GLOBALS['egw_info']['server']['server_timezone'] = $tz->getName(),'phpgwapi'); |
| 140 | 143 | error_log(__METHOD__."() stored server_timezone=".$GLOBALS['egw_info']['server']['server_timezone']); |
| 141 | 144 | } |
@@ -301,14 +304,20 @@ discard block |
||
| 301 | 304 | exit; |
| 302 | 305 | } |
| 303 | 306 | // check if we have a session, if not try to automatic create one |
| 304 | - if ($this->session->verify()) return true; |
|
| 307 | + if ($this->session->verify()) |
|
| 308 | + { |
|
| 309 | + return true; |
|
| 310 | + } |
|
| 305 | 311 | |
| 306 | 312 | $account = null; |
| 307 | 313 | if (($account_callback = $GLOBALS['egw_info']['flags']['autocreate_session_callback']) && is_callable($account_callback) && |
| 308 | - ($sessionid = call_user_func_array($account_callback,array(&$account))) === true) // $account_call_back returns true, false or a session-id |
|
| 314 | + ($sessionid = call_user_func_array($account_callback,array(&$account))) === true) |
|
| 315 | + { |
|
| 316 | + // $account_call_back returns true, false or a session-id |
|
| 309 | 317 | { |
| 310 | 318 | $sessionid = $this->session->create($account); |
| 311 | 319 | } |
| 320 | + } |
|
| 312 | 321 | if (!$sessionid) |
| 313 | 322 | { |
| 314 | 323 | //echo "<p>account_callback='$account_callback', account=".print_r($account,true).", sessionid=$sessionid</p>\n"; exit; |
@@ -337,9 +346,15 @@ discard block |
||
| 337 | 346 | { |
| 338 | 347 | $redirect = '/login.php?'; |
| 339 | 348 | // only add "your session could not be verified", if a sessionid is given (cookie or on url) |
| 340 | - if (Session::get_sessionid()) $redirect .= 'cd=10&'; |
|
| 349 | + if (Session::get_sessionid()) |
|
| 350 | + { |
|
| 351 | + $redirect .= 'cd=10&'; |
|
| 352 | + } |
|
| 353 | + } |
|
| 354 | + if ($relpath) |
|
| 355 | + { |
|
| 356 | + $redirect .= 'phpgw_forward='.urlencode($relpath.(!empty($query) ? '?'.$query : '')); |
|
| 341 | 357 | } |
| 342 | - if ($relpath) $redirect .= 'phpgw_forward='.urlencode($relpath.(!empty($query) ? '?'.$query : '')); |
|
| 343 | 358 | self::redirect_link($redirect); |
| 344 | 359 | } |
| 345 | 360 | } |
@@ -357,7 +372,9 @@ discard block |
||
| 357 | 372 | { |
| 358 | 373 | $this->currentapp = $GLOBALS['egw_info']['flags']['currentapp']; // some apps change it later |
| 359 | 374 | |
| 360 | - if (!in_array($GLOBALS['egw_info']['flags']['currentapp'], array('api','about'))) // give everyone implicit api rights |
|
| 375 | + if (!in_array($GLOBALS['egw_info']['flags']['currentapp'], array('api','about'))) |
|
| 376 | + { |
|
| 377 | + // give everyone implicit api rights |
|
| 361 | 378 | { |
| 362 | 379 | // This will need to use ACL in the future |
| 363 | 380 | if (!$GLOBALS['egw_info']['user']['apps'][$currentapp = $GLOBALS['egw_info']['flags']['currentapp']] || |
@@ -370,6 +387,7 @@ discard block |
||
| 370 | 387 | if (($sessionid = Session::get_sessionid(true))) |
| 371 | 388 | { |
| 372 | 389 | $GLOBALS['egw']->session->destroy($sessionid); |
| 390 | + } |
|
| 373 | 391 | } |
| 374 | 392 | throw new Exception\Redirect(self::link('/logout.php')); |
| 375 | 393 | } |
@@ -555,7 +573,10 @@ discard block |
||
| 555 | 573 | try { |
| 556 | 574 | //error_log(__METHOD__."() running ".array2string($data)); |
| 557 | 575 | $callback = array_shift($data); |
| 558 | - if (!is_array($callback) || strpos($callback[1], 'session') === false) continue; |
|
| 576 | + if (!is_array($callback) || strpos($callback[1], 'session') === false) |
|
| 577 | + { |
|
| 578 | + continue; |
|
| 579 | + } |
|
| 559 | 580 | call_user_func_array($callback, $data); |
| 560 | 581 | } |
| 561 | 582 | catch (\Exception $ex) { |
@@ -565,7 +586,10 @@ discard block |
||
| 565 | 586 | } |
| 566 | 587 | // now we can close the session |
| 567 | 588 | // without closing the session fastcgi_finish_request() will NOT send output to user |
| 568 | - if (isset($GLOBALS['egw']->session) && is_object($GLOBALS['egw']->session)) $GLOBALS['egw']->session->commit_session(); |
|
| 589 | + if (isset($GLOBALS['egw']->session) && is_object($GLOBALS['egw']->session)) |
|
| 590 | + { |
|
| 591 | + $GLOBALS['egw']->session->commit_session(); |
|
| 592 | + } |
|
| 569 | 593 | |
| 570 | 594 | // flush all output to user |
| 571 | 595 | /* does NOT work on Apache :-( |
@@ -593,9 +617,12 @@ discard block |
||
| 593 | 617 | } |
| 594 | 618 | } |
| 595 | 619 | // call the asyncservice check_run function if it is not explicitly set to cron-only |
| 596 | - if (!$GLOBALS['egw_info']['server']['asyncservice']) // is default |
|
| 620 | + if (!$GLOBALS['egw_info']['server']['asyncservice']) |
|
| 621 | + { |
|
| 622 | + // is default |
|
| 597 | 623 | { |
| 598 | 624 | $async = new Asyncservice(); |
| 625 | + } |
|
| 599 | 626 | $async->check_run('fallback'); |
| 600 | 627 | } |
| 601 | 628 | $this->db->disconnect(); |
@@ -69,7 +69,10 @@ |
||
| 69 | 69 | $path = $this->vfs_path . '/' . $name; |
| 70 | 70 | $vfs_path = $this->vfs_path . '/' . Vfs::encodePathComponent($name); |
| 71 | 71 | |
| 72 | - if (!Vfs::file_exists($vfs_path)) throw new DAV\Exception\NotFound('File with name ' . $path . ' could not be located'); |
|
| 72 | + if (!Vfs::file_exists($vfs_path)) |
|
| 73 | + { |
|
| 74 | + throw new DAV\Exception\NotFound('File with name ' . $path . ' could not be located'); |
|
| 75 | + } |
|
| 73 | 76 | |
| 74 | 77 | if (Vfs::is_dir($vfs_path)) |
| 75 | 78 | { |