@@ -19,4 +19,6 @@ |
||
| 19 | 19 | * New InvalidSql exception has to extend deprecated egw_exception_db_invalid_sql |
| 20 | 20 | * to allow legacy code to catch exceptions thrown by Api\Db! |
| 21 | 21 | */ |
| 22 | -class InvalidSql extends \egw_exception_db_invalid_sql {} |
|
| 22 | +class InvalidSql extends \egw_exception_db_invalid_sql |
|
| 23 | +{ |
|
| 24 | +} |
|
@@ -18,4 +18,6 @@ |
||
| 18 | 18 | /** |
| 19 | 19 | * EGroupware not (fully) installed, visit setup |
| 20 | 20 | */ |
| 21 | -class Setup extends Db\Exception { } |
|
| 21 | +class Setup extends Db\Exception |
|
| 22 | +{ |
|
| 23 | +} |
|
@@ -18,4 +18,6 @@ |
||
| 18 | 18 | /** |
| 19 | 19 | * PHP lacks support for configured database type |
| 20 | 20 | */ |
| 21 | -class Support extends Db\Exception { } |
|
| 21 | +class Support extends Db\Exception |
|
| 22 | +{ |
|
| 23 | +} |
|
@@ -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(); |
@@ -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"; |