@@ -24,8 +24,8 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | public static $types = array( |
| 26 | 26 | 'select-cat' => array('category'), |
| 27 | - 'select-account'=> array('owner','creator', 'modifier'), |
|
| 28 | - 'date-time' => array('modified', 'created','start','end','recur_date'), |
|
| 27 | + 'select-account'=> array('owner', 'creator', 'modifier'), |
|
| 28 | + 'date-time' => array('modified', 'created', 'start', 'end', 'recur_date'), |
|
| 29 | 29 | 'date' => array('recur_enddate'), |
| 30 | 30 | 'select-bool' => array('public', 'non_blocking'), |
| 31 | 31 | 'select' => array('priority'), |
@@ -37,12 +37,12 @@ discard block |
||
| 37 | 37 | * |
| 38 | 38 | * @param string $_identifier |
| 39 | 39 | */ |
| 40 | - public function __construct( $_identifier='' ){ |
|
| 40 | + public function __construct($_identifier = '') { |
|
| 41 | 41 | $this->identifier = $_identifier; |
| 42 | - if(!is_object($this->bo)) { |
|
| 42 | + if (!is_object($this->bo)) { |
|
| 43 | 43 | $this->bo = new calendar_bo(); |
| 44 | 44 | } |
| 45 | - if($this->identifier) { |
|
| 45 | + if ($this->identifier) { |
|
| 46 | 46 | $this->record = $this->bo->read($this->identifier); |
| 47 | 47 | } |
| 48 | 48 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * @todo add some checks |
| 97 | 97 | * @return void |
| 98 | 98 | */ |
| 99 | - public function set_record(array $_record){ |
|
| 99 | + public function set_record(array $_record) { |
|
| 100 | 100 | $this->record = $_record; |
| 101 | 101 | } |
| 102 | 102 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * |
| 125 | 125 | * @return string identifier |
| 126 | 126 | */ |
| 127 | - public function save ( $_dst_identifier ) { |
|
| 127 | + public function save($_dst_identifier) { |
|
| 128 | 128 | // Not yet implemeted |
| 129 | 129 | $this->identifier = $_dst_identifier; |
| 130 | 130 | } |
@@ -135,8 +135,8 @@ discard block |
||
| 135 | 135 | * @param string $_dst_identifier |
| 136 | 136 | * @return string dst_identifier |
| 137 | 137 | */ |
| 138 | - public function copy ( $_dst_identifier ) { |
|
| 139 | - unset($_dst_identifier); // not used |
|
| 138 | + public function copy($_dst_identifier) { |
|
| 139 | + unset($_dst_identifier); // not used |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |
@@ -146,15 +146,15 @@ discard block |
||
| 146 | 146 | * @param string $_dst_identifier |
| 147 | 147 | * @return string dst_identifier |
| 148 | 148 | */ |
| 149 | - public function move ( $_dst_identifier ) { |
|
| 150 | - unset($_dst_identifier); // not used |
|
| 149 | + public function move($_dst_identifier) { |
|
| 150 | + unset($_dst_identifier); // not used |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | /** |
| 154 | 154 | * delets current record from backend |
| 155 | 155 | * |
| 156 | 156 | */ |
| 157 | - public function delete () { |
|
| 157 | + public function delete() { |
|
| 158 | 158 | |
| 159 | 159 | } |
| 160 | 160 | |
@@ -29,24 +29,24 @@ |
||
| 29 | 29 | * @param string $cname |
| 30 | 30 | * @param array $expand values for keys 'c', 'row', 'c_', 'row_', 'cont' |
| 31 | 31 | */ |
| 32 | - public function beforeSendToClient($cname, array $expand=null) |
|
| 32 | + public function beforeSendToClient($cname, array $expand = null) |
|
| 33 | 33 | { |
| 34 | 34 | $form_name = self::form_name($cname, $this->id, $expand); |
| 35 | - $value =& self::get_array(self::$request->content, $form_name, true); |
|
| 36 | - if(!is_array($value)) $value = array(); |
|
| 35 | + $value = & self::get_array(self::$request->content, $form_name, true); |
|
| 36 | + if (!is_array($value)) $value = array(); |
|
| 37 | 37 | |
| 38 | - foreach($value as &$events) |
|
| 38 | + foreach ($value as &$events) |
|
| 39 | 39 | { |
| 40 | - if(!is_array($events)) |
|
| 40 | + if (!is_array($events)) |
|
| 41 | 41 | { |
| 42 | 42 | continue; |
| 43 | 43 | } |
| 44 | - foreach($events as &$event) |
|
| 44 | + foreach ($events as &$event) |
|
| 45 | 45 | { |
| 46 | - if(!is_array($event)) continue; |
|
| 47 | - foreach(array('start','end') as $date) |
|
| 46 | + if (!is_array($event)) continue; |
|
| 47 | + foreach (array('start', 'end') as $date) |
|
| 48 | 48 | { |
| 49 | - $event[$date] = Api\DateTime::to($event[$date],'Y-m-d\TH:i:s\Z'); |
|
| 49 | + $event[$date] = Api\DateTime::to($event[$date], 'Y-m-d\TH:i:s\Z'); |
|
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | public static function DateTimeZone($tzid) |
| 73 | 73 | { |
| 74 | - if (($id = self::tz2id($tzid,'alias'))) |
|
| 74 | + if (($id = self::tz2id($tzid, 'alias'))) |
|
| 75 | 75 | { |
| 76 | 76 | $tzid = self::id2tz($id); |
| 77 | 77 | } |
@@ -89,34 +89,34 @@ discard block |
||
| 89 | 89 | * @param string $what ='id' what to return, default id, null for whole array |
| 90 | 90 | * @return int tz_id or null if not found |
| 91 | 91 | */ |
| 92 | - public static function tz2id($tzid,$what='id') |
|
| 92 | + public static function tz2id($tzid, $what = 'id') |
|
| 93 | 93 | { |
| 94 | - $id =& self::$tz2id[$tzid]; |
|
| 94 | + $id = & self::$tz2id[$tzid]; |
|
| 95 | 95 | |
| 96 | 96 | if (!isset($id)) |
| 97 | 97 | { |
| 98 | - if (($data = $GLOBALS['egw']->db->select(self::TABLE,'*',array( |
|
| 98 | + if (($data = $GLOBALS['egw']->db->select(self::TABLE, '*', array( |
|
| 99 | 99 | 'tz_tzid' => $tzid, |
| 100 | - ),__LINE__,__FILE__,false,'','calendar')->fetch())) |
|
| 100 | + ), __LINE__, __FILE__, false, '', 'calendar')->fetch())) |
|
| 101 | 101 | { |
| 102 | 102 | $id = $data['tz_id']; |
| 103 | - self::$tz_cache[$id] = Api\Db::strip_array_keys($data,'tz_'); |
|
| 103 | + self::$tz_cache[$id] = Api\Db::strip_array_keys($data, 'tz_'); |
|
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | // check if we can find a 3-part America timezone eg. check 'America/Argentina/Buenos_Aires' for 'America/Buenos_Aires' |
| 107 | 107 | if (!isset($id) && stripos($tzid, 'America/') === 0 && count($parts = explode('/', $tzid)) == 2) |
| 108 | 108 | { |
| 109 | - if (($data = $GLOBALS['egw']->db->select(self::TABLE,'*',array( |
|
| 109 | + if (($data = $GLOBALS['egw']->db->select(self::TABLE, '*', array( |
|
| 110 | 110 | 'tz_tzid LIKE '.$GLOBALS['egw']->db->quote($parts[0].'/%/'.$parts[1]), |
| 111 | - ),__LINE__,__FILE__,false,'','calendar')->fetch())) |
|
| 111 | + ), __LINE__, __FILE__, false, '', 'calendar')->fetch())) |
|
| 112 | 112 | { |
| 113 | 113 | $id = $data['tz_id']; |
| 114 | - self::$tz_cache[$id] = Api\Db::strip_array_keys($data,'tz_'); |
|
| 114 | + self::$tz_cache[$id] = Api\Db::strip_array_keys($data, 'tz_'); |
|
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | if (isset($id) && $what != 'id') |
| 118 | 118 | { |
| 119 | - return self::id2tz($id,$what); |
|
| 119 | + return self::id2tz($id, $what); |
|
| 120 | 120 | } |
| 121 | 121 | return $id; |
| 122 | 122 | } |
@@ -134,24 +134,24 @@ discard block |
||
| 134 | 134 | * @param string $what ='tzid' what data to return or null for whole data array, with keys 'id', 'tzid', 'component', 'alias', 'latitude', 'longitude' |
| 135 | 135 | * @return mixed false: if not found |
| 136 | 136 | */ |
| 137 | - public static function id2tz($id,$what='tzid') |
|
| 137 | + public static function id2tz($id, $what = 'tzid') |
|
| 138 | 138 | { |
| 139 | - $data =& self::$tz_cache[$id]; |
|
| 139 | + $data = & self::$tz_cache[$id]; |
|
| 140 | 140 | |
| 141 | 141 | if (!isset($data)) |
| 142 | 142 | { |
| 143 | - if (($data = $GLOBALS['egw']->db->select(self::TABLE,'*',array( |
|
| 143 | + if (($data = $GLOBALS['egw']->db->select(self::TABLE, '*', array( |
|
| 144 | 144 | 'tz_id' => $id, |
| 145 | - ),__LINE__,__FILE__,false,'','calendar')->fetch())) |
|
| 145 | + ), __LINE__, __FILE__, false, '', 'calendar')->fetch())) |
|
| 146 | 146 | { |
| 147 | - $data = Api\Db::strip_array_keys($data,'tz_'); |
|
| 147 | + $data = Api\Db::strip_array_keys($data, 'tz_'); |
|
| 148 | 148 | self::$tz2id[$data['tzid']] = $id; |
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | // if not tzid queried, resolve aliases automatically |
| 152 | 152 | if ($data && $data['alias'] && $what != 'tzid' && $what != 'alias') |
| 153 | 153 | { |
| 154 | - $data = self::id2tz($data['alias'],null); |
|
| 154 | + $data = self::id2tz($data['alias'], null); |
|
| 155 | 155 | } |
| 156 | 156 | return !$data ? $data : ($what ? $data[$what] : $data); |
| 157 | 157 | } |
@@ -170,8 +170,8 @@ discard block |
||
| 170 | 170 | */ |
| 171 | 171 | public static function init_static() |
| 172 | 172 | { |
| 173 | - self::$tz_cache =& Api\Cache::getSession(__CLASS__,'tz_cache'); |
|
| 174 | - self::$tz2id =& Api\Cache::getSession(__CLASS__,'tz2id'); |
|
| 173 | + self::$tz_cache = & Api\Cache::getSession(__CLASS__, 'tz_cache'); |
|
| 174 | + self::$tz2id = & Api\Cache::getSession(__CLASS__, 'tz2id'); |
|
| 175 | 175 | |
| 176 | 176 | // init cache with mapping UTC <--> -1, as UTC is no real timezone, but we need to be able to use it in calendar |
| 177 | 177 | if (!is_array(self::$tz2id)) |
@@ -188,10 +188,10 @@ discard block |
||
| 188 | 188 | { |
| 189 | 189 | $updated = false; |
| 190 | 190 | $msg = self::import_zones($updated); |
| 191 | - if ($updated) error_log($msg); // log that timezones have been updated |
|
| 191 | + if ($updated) error_log($msg); // log that timezones have been updated |
|
| 192 | 192 | |
| 193 | 193 | $alias_msg = self::import_tz_aliases($updated); |
| 194 | - if ($updated) error_log($alias_msg); // log that timezone aliases have been updated |
|
| 194 | + if ($updated) error_log($alias_msg); // log that timezone aliases have been updated |
|
| 195 | 195 | |
| 196 | 196 | self::$import_msg = $msg.'<br/>'.$alias_msg; |
| 197 | 197 | |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | * @throws Api\Exception\WrongUserinput for broken sqlite extension |
| 211 | 211 | * @link https://hg.mozilla.org/comm-central/raw-file/tip/calendar/timezones/zones.json |
| 212 | 212 | */ |
| 213 | - public static function import_zones(&$updated=null, $file='calendar/setup/zones.json') |
|
| 213 | + public static function import_zones(&$updated = null, $file = 'calendar/setup/zones.json') |
|
| 214 | 214 | { |
| 215 | 215 | $path = EGW_SERVER_ROOT.'/'.$file; |
| 216 | 216 | |
@@ -232,9 +232,9 @@ discard block |
||
| 232 | 232 | { |
| 233 | 233 | $updated = false; |
| 234 | 234 | fclose($fp); |
| 235 | - return lang('Nothing to update, version is already %1.',$config['tz_version']); // we already have the right |
|
| 235 | + return lang('Nothing to update, version is already %1.', $config['tz_version']); // we already have the right |
|
| 236 | 236 | } |
| 237 | - $json .= fread($fp, 1024*1024); |
|
| 237 | + $json .= fread($fp, 1024 * 1024); |
|
| 238 | 238 | fclose($fp); |
| 239 | 239 | if (!($zones = json_decode($json, true)) || !isset($zones['aliases']) || !isset($zones['zones'])) |
| 240 | 240 | { |
@@ -242,38 +242,38 @@ discard block |
||
| 242 | 242 | } |
| 243 | 243 | // import zones first and then aliases |
| 244 | 244 | $tz2id = array(); |
| 245 | - foreach(array('zones', 'aliases') as $type) |
|
| 245 | + foreach (array('zones', 'aliases') as $type) |
|
| 246 | 246 | { |
| 247 | - foreach($zones[$type] as $tzid => $data) |
|
| 247 | + foreach ($zones[$type] as $tzid => $data) |
|
| 248 | 248 | { |
| 249 | 249 | if ($type == 'aliases') |
| 250 | 250 | { |
| 251 | 251 | $data = array('alias' => $tz2id[$data['aliasTo']]); |
| 252 | - if (!$data['alias']) continue; // there's no such tzid |
|
| 252 | + if (!$data['alias']) continue; // there's no such tzid |
|
| 253 | 253 | } |
| 254 | 254 | // check if already in database |
| 255 | - $tz2id[$tzid] = $GLOBALS['egw']->db->select('egw_cal_timezones','tz_id',array( |
|
| 255 | + $tz2id[$tzid] = $GLOBALS['egw']->db->select('egw_cal_timezones', 'tz_id', array( |
|
| 256 | 256 | 'tz_tzid' => $tzid, |
| 257 | - ),__LINE__,__FILE__,false,'','calendar')->fetchColumn(); |
|
| 257 | + ), __LINE__, __FILE__, false, '', 'calendar')->fetchColumn(); |
|
| 258 | 258 | |
| 259 | - $GLOBALS['egw']->db->insert('egw_cal_timezones',array( |
|
| 259 | + $GLOBALS['egw']->db->insert('egw_cal_timezones', array( |
|
| 260 | 260 | 'tz_alias' => $data['alias'], |
| 261 | 261 | 'tz_latitude' => $data['latitude'], |
| 262 | 262 | 'tz_longitude' => $data['longitude'], |
| 263 | 263 | 'tz_component' => $data['ics'], |
| 264 | - ),array( |
|
| 264 | + ), array( |
|
| 265 | 265 | 'tz_tzid' => $tzid, |
| 266 | - ),__LINE__,__FILE__,'calendar'); |
|
| 266 | + ), __LINE__, __FILE__, 'calendar'); |
|
| 267 | 267 | |
| 268 | 268 | // only query last insert id, if not already in database (gives warning for PostgreSQL) |
| 269 | - if (!$tz2id[$tzid]) $tz2id[$tzid] = $GLOBALS['egw']->db->get_last_insert_id('egw_cal_timezones','tz_id'); |
|
| 269 | + if (!$tz2id[$tzid]) $tz2id[$tzid] = $GLOBALS['egw']->db->get_last_insert_id('egw_cal_timezones', 'tz_id'); |
|
| 270 | 270 | } |
| 271 | 271 | } |
| 272 | 272 | Api\Config::save_value('tz_version', $tz_version, 'phpgwapi'); |
| 273 | 273 | |
| 274 | 274 | //_debug_array($tz2id); |
| 275 | 275 | $updated = true; |
| 276 | - return lang('Timezones updated to version %1 (%2 records updated).',$tz_version,count($tz2id)); |
|
| 276 | + return lang('Timezones updated to version %1 (%2 records updated).', $tz_version, count($tz2id)); |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | /** |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | * @return string message about update |
| 285 | 285 | * @throws Api\Exception\WrongParameter if $file is not readable or wrong format/version |
| 286 | 286 | */ |
| 287 | - public static function import_tz_aliases(&$updated=null,$file='calendar/setup/tz_aliases.inc.php') |
|
| 287 | + public static function import_tz_aliases(&$updated = null, $file = 'calendar/setup/tz_aliases.inc.php') |
|
| 288 | 288 | { |
| 289 | 289 | $path = EGW_SERVER_ROOT.'/'.$file; |
| 290 | 290 | |
@@ -297,27 +297,27 @@ discard block |
||
| 297 | 297 | if ($tz_aliases_mtime === $config['tz_aliases_mtime']) |
| 298 | 298 | { |
| 299 | 299 | $updated = false; |
| 300 | - return lang('Nothing to update, version is already %1.',$tz_aliases_mtime); |
|
| 300 | + return lang('Nothing to update, version is already %1.', $tz_aliases_mtime); |
|
| 301 | 301 | } |
| 302 | 302 | $tz_aliases = array(); |
| 303 | - include($path); // sets $tz_aliases |
|
| 303 | + include($path); // sets $tz_aliases |
|
| 304 | 304 | |
| 305 | 305 | $updates = 0; |
| 306 | - foreach($tz_aliases as $alias => $tzid) |
|
| 306 | + foreach ($tz_aliases as $alias => $tzid) |
|
| 307 | 307 | { |
| 308 | - if ((!($alias_id=self::tz2id($alias, 'alias')) || self::id2tz($alias_id, 'tzid') !== $tzid) && // not in DB or different |
|
| 308 | + if ((!($alias_id = self::tz2id($alias, 'alias')) || self::id2tz($alias_id, 'tzid') !== $tzid) && // not in DB or different |
|
| 309 | 309 | ($tz_id = self::tz2id($tzid))) // given tzid for alias exists in DB |
| 310 | 310 | { |
| 311 | - $GLOBALS['egw']->db->insert('egw_cal_timezones',array( |
|
| 311 | + $GLOBALS['egw']->db->insert('egw_cal_timezones', array( |
|
| 312 | 312 | 'tz_alias' => $tz_id, |
| 313 | - ),array( |
|
| 313 | + ), array( |
|
| 314 | 314 | 'tz_tzid' => $alias, |
| 315 | - ),__LINE__,__FILE__,'calendar'); |
|
| 315 | + ), __LINE__, __FILE__, 'calendar'); |
|
| 316 | 316 | ++$updates; |
| 317 | 317 | } |
| 318 | 318 | //error_log(__METHOD__."() alias=$alias, tzid=$tzid --> self::tz2id('$alias', 'alias') = ".array2string($alias_id).", self::tz2id('$tzid')=".array2string($tz_id)); |
| 319 | 319 | } |
| 320 | - Api\Config::save_value('tz_aliases_mtime',$tz_aliases_mtime,$app='phpgwapi'); |
|
| 320 | + Api\Config::save_value('tz_aliases_mtime', $tz_aliases_mtime, $app = 'phpgwapi'); |
|
| 321 | 321 | |
| 322 | 322 | //_debug_array($tz2id); |
| 323 | 323 | $updated = true; |
@@ -358,8 +358,8 @@ discard block |
||
| 358 | 358 | } |
| 359 | 359 | // $vtimezone is a string with a single VTIMEZONE component, afaik Horde_Icalendar can not add it directly |
| 360 | 360 | // --> we have to parse it and let Horde_Icalendar add it again |
| 361 | - $horde_vtimezone = Horde_Icalendar::newComponent('VTIMEZONE',$container=false); |
|
| 362 | - $horde_vtimezone->parsevCalendar($vtimezone,'VTIMEZONE'); |
|
| 361 | + $horde_vtimezone = Horde_Icalendar::newComponent('VTIMEZONE', $container = false); |
|
| 362 | + $horde_vtimezone->parsevCalendar($vtimezone, 'VTIMEZONE'); |
|
| 363 | 363 | // DTSTART is in UTC time, Horde_Icalendar parses it in server timezone, which we need to set again for printing |
| 364 | 364 | $standard = $horde_vtimezone->findComponent('STANDARD'); |
| 365 | 365 | if (is_a($standard, 'Horde_Icalendar')) |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | * @param string $type ='vcalendar' 'tzid' or everything tz2id supports, default 'vcalendar' = full vcalendar component |
| 391 | 391 | * @return string |
| 392 | 392 | */ |
| 393 | - public static function user_timezone($user=null, $type='vcalendar') |
|
| 393 | + public static function user_timezone($user = null, $type = 'vcalendar') |
|
| 394 | 394 | { |
| 395 | 395 | if (!$user || $user == $GLOBALS['egw_info']['user']['account_id']) |
| 396 | 396 | { |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | case 'vcalendar': |
| 410 | 410 | // checking type of $val, now we included the object definition (no need to always include it!) |
| 411 | 411 | $vcal = new Horde_Icalendar; |
| 412 | - $vcal->setAttribute('PRODID','-//EGroupware//NONSGML EGroupware Calendar '.$GLOBALS['egw_info']['apps']['calendar']['version'].'//'. |
|
| 412 | + $vcal->setAttribute('PRODID', '-//EGroupware//NONSGML EGroupware Calendar '.$GLOBALS['egw_info']['apps']['calendar']['version'].'//'. |
|
| 413 | 413 | strtoupper($GLOBALS['egw_info']['user']['preferences']['common']['lang'])); |
| 414 | 414 | self::add_vtimezone($vcal, $tzid); |
| 415 | 415 | $tzid = $vcal->exportvCalendar('utf-8'); |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | case 'tzid': |
| 418 | 418 | break; |
| 419 | 419 | default: |
| 420 | - $tzid = self::tz2id($tzid,$type == 'vcalendar' ? 'component' : $type); |
|
| 420 | + $tzid = self::tz2id($tzid, $type == 'vcalendar' ? 'component' : $type); |
|
| 421 | 421 | break; |
| 422 | 422 | } |
| 423 | 423 | return $tzid; |
@@ -114,18 +114,18 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | public function __construct() |
| 116 | 116 | { |
| 117 | - parent::__construct('calendar'); // adds custom fields |
|
| 117 | + parent::__construct('calendar'); // adds custom fields |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | /** |
| 121 | 121 | * Tracks the changes in one entry $data, by comparing it with the last version in $old |
| 122 | 122 | * Overrides parent to reformat participants into a format parent can handle |
| 123 | 123 | */ |
| 124 | - public function track(array $data,array $old=null,$user=null,$deleted=null,array $changed_fields=null) |
|
| 124 | + public function track(array $data, array $old = null, $user = null, $deleted = null, array $changed_fields = null) |
|
| 125 | 125 | { |
| 126 | 126 | // Don't try to track dates on recurring events. |
| 127 | 127 | // It won't change for the base event, and any change to the time creates an exception |
| 128 | - if($data['recur_type']) |
|
| 128 | + if ($data['recur_type']) |
|
| 129 | 129 | { |
| 130 | 130 | unset($data['start']); unset($data['end']); |
| 131 | 131 | unset($old['start']); unset($old['end']); |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | * If this is one of a recurring event, append the recur_date to the participant field so we can |
| 137 | 137 | * filter by it later. |
| 138 | 138 | */ |
| 139 | - if(is_array($data['participants'])) |
|
| 139 | + if (is_array($data['participants'])) |
|
| 140 | 140 | { |
| 141 | 141 | $participants = $data['participants']; |
| 142 | 142 | $data['participants'] = array(); |
@@ -144,25 +144,25 @@ discard block |
||
| 144 | 144 | } |
| 145 | 145 | // if clients eg. CalDAV do NOT set participants, they are left untouched |
| 146 | 146 | // therefore we should not track them, as all updates then show up as all participants removed |
| 147 | - elseif(!isset($data['participants'])) |
|
| 147 | + elseif (!isset($data['participants'])) |
|
| 148 | 148 | { |
| 149 | 149 | unset($old['participants']); |
| 150 | 150 | } |
| 151 | - if(is_array($old['participants'])) |
|
| 151 | + if (is_array($old['participants'])) |
|
| 152 | 152 | { |
| 153 | 153 | $participants = $old['participants']; |
| 154 | 154 | $old['participants'] = array(); |
| 155 | 155 | $old = array_merge($old, $this->alter_participants($participants)); |
| 156 | 156 | } |
| 157 | - parent::track($data,$old,$user,$deleted, $changed_fields); |
|
| 157 | + parent::track($data, $old, $user, $deleted, $changed_fields); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | /** |
| 161 | 161 | * Overrides parent because calendar_boupdates handles the notifications |
| 162 | 162 | */ |
| 163 | - public function do_notifications($data,$old,$deleted=null) |
|
| 163 | + public function do_notifications($data, $old, $deleted = null) |
|
| 164 | 164 | { |
| 165 | - unset($data, $old, $deleted); // unused, but required by function signature |
|
| 165 | + unset($data, $old, $deleted); // unused, but required by function signature |
|
| 166 | 166 | return true; |
| 167 | 167 | } |
| 168 | 168 | |
@@ -177,21 +177,21 @@ discard block |
||
| 177 | 177 | * @param array $old = null |
| 178 | 178 | * @return array of keys with different values in $data and $old |
| 179 | 179 | */ |
| 180 | - public function changed_fields(array $data,array $old=null) |
|
| 180 | + public function changed_fields(array $data, array $old = null) |
|
| 181 | 181 | { |
| 182 | - if(is_array($data['participants'])) |
|
| 182 | + if (is_array($data['participants'])) |
|
| 183 | 183 | { |
| 184 | 184 | $participants = $data['participants']; |
| 185 | 185 | $data['participants'] = array(); |
| 186 | 186 | $data = array_merge($data, $this->alter_participants($participants)); |
| 187 | 187 | } |
| 188 | - if(is_array($old['participants'])) |
|
| 188 | + if (is_array($old['participants'])) |
|
| 189 | 189 | { |
| 190 | 190 | $participants = $old['participants']; |
| 191 | 191 | $old['participants'] = array(); |
| 192 | 192 | $old = array_merge($old, $this->alter_participants($participants)); |
| 193 | 193 | } |
| 194 | - return parent::changed_fields($data,$old); |
|
| 194 | + return parent::changed_fields($data, $old); |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | /** |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | protected function alter_participants($participants) |
| 203 | 203 | { |
| 204 | 204 | $data = array(); |
| 205 | - foreach($participants as $uid => $status) |
|
| 205 | + foreach ($participants as $uid => $status) |
|
| 206 | 206 | { |
| 207 | 207 | $quantity = $role = $user_type = $user_id = null; |
| 208 | 208 | calendar_so::split_status($status, $quantity, $role); |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | use EGroupware\Api\Asyncservice; |
| 16 | 16 | |
| 17 | 17 | if (!isset($_REQUEST['domain'])) $_REQUEST['domain'] = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : 'default'; |
| 18 | -$path_to_egroupware = realpath(__DIR__.'/..'); // need to be adapted if this script is moved somewhere else |
|
| 18 | +$path_to_egroupware = realpath(__DIR__.'/..'); // need to be adapted if this script is moved somewhere else |
|
| 19 | 19 | |
| 20 | 20 | // remove the comment from one of the following lines to enable loging |
| 21 | 21 | // define('ASYNC_LOG','C:\\async.log'); // Windows |
@@ -25,8 +25,8 @@ discard block |
||
| 25 | 25 | if (defined('ASYNC_LOG')) |
| 26 | 26 | { |
| 27 | 27 | $msg = date('Y/m/d H:i:s ').$_REQUEST['domain'].": asyncservice started\n"; |
| 28 | - $f = fopen(ASYNC_LOG,'a+'); |
|
| 29 | - fwrite($f,$msg); |
|
| 28 | + $f = fopen(ASYNC_LOG, 'a+'); |
|
| 29 | + fwrite($f, $msg); |
|
| 30 | 30 | fclose($f); |
| 31 | 31 | } |
| 32 | 32 | $GLOBALS['egw_info']['flags'] = array( |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | if (defined('ASYNC_LOG')) |
| 45 | 45 | { |
| 46 | - $f = fopen(ASYNC_LOG,'a+'); |
|
| 47 | - fwrite($f,$msg); |
|
| 46 | + $f = fopen(ASYNC_LOG, 'a+'); |
|
| 47 | + fwrite($f, $msg); |
|
| 48 | 48 | fclose($f); |
| 49 | 49 | } |
| 50 | 50 | die($msg); |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | if (defined('ASYNC_LOG')) |
| 65 | 65 | { |
| 66 | - $f = fopen(ASYNC_LOG,'a+'); |
|
| 67 | - fwrite($f,$msg); |
|
| 66 | + $f = fopen(ASYNC_LOG, 'a+'); |
|
| 67 | + fwrite($f, $msg); |
|
| 68 | 68 | fclose($f); |
| 69 | 69 | } |
| 70 | 70 | die($msg); |
@@ -75,8 +75,7 @@ discard block |
||
| 75 | 75 | $async = new Asyncservice(); |
| 76 | 76 | $num = $async->check_run(isset($_REQUEST['run_by']) ? $_REQUEST['run_by'] : 'crontab'); |
| 77 | 77 | |
| 78 | -$msg = date('Y/m/d H:i:s ').$_REQUEST['domain'].': '.($num === false ? 'An error occured: can not obtain semaphore!' : |
|
| 79 | - ($num ? "$num job(s) executed" : 'Nothing to execute'))."\n\n"; |
|
| 78 | +$msg = date('Y/m/d H:i:s ').$_REQUEST['domain'].': '.($num === false ? 'An error occured: can not obtain semaphore!' : ($num ? "$num job(s) executed" : 'Nothing to execute'))."\n\n"; |
|
| 80 | 79 | |
| 81 | 80 | if (isset($_SERVER['HTTP_HOST'])) |
| 82 | 81 | { |
@@ -87,7 +86,7 @@ discard block |
||
| 87 | 86 | |
| 88 | 87 | if (defined('ASYNC_LOG')) |
| 89 | 88 | { |
| 90 | - $f = fopen(ASYNC_LOG,'a+'); |
|
| 91 | - fwrite($f,$msg); |
|
| 89 | + $f = fopen(ASYNC_LOG, 'a+'); |
|
| 90 | + fwrite($f, $msg); |
|
| 92 | 91 | fclose($f); |
| 93 | 92 | } |
@@ -28,17 +28,17 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | include '../header.inc.php'; |
| 30 | 30 | |
| 31 | -$content = json_encode(Api\Image::map(preg_match('/^[a-z0-9_-]+$/i',$_GET['template']) ? $_GET['template'] : null, $_GET['svg']), |
|
| 32 | - JSON_FORCE_OBJECT | // export empty php-arrays as empty objects, not empty arrays |
|
| 33 | - JSON_UNESCAPED_SLASHES | // do not escape slashes, smaller and better readable |
|
| 31 | +$content = json_encode(Api\Image::map(preg_match('/^[a-z0-9_-]+$/i', $_GET['template']) ? $_GET['template'] : null, $_GET['svg']), |
|
| 32 | + JSON_FORCE_OBJECT|// export empty php-arrays as empty objects, not empty arrays |
|
| 33 | + JSON_UNESCAPED_SLASHES|// do not escape slashes, smaller and better readable |
|
| 34 | 34 | (!empty($_GET['debug']) ? JSON_PRETTY_PRINT : 0)); |
| 35 | 35 | |
| 36 | 36 | // use an etag over the image mapp |
| 37 | 37 | $etag = '"'.md5($content).'"'; |
| 38 | 38 | |
| 39 | 39 | // headers to allow caching, egw_framework specifies etag on url to force reload, even with Expires header |
| 40 | -Api\Session::cache_control(86400); // cache for one day |
|
| 41 | -Header('Content-Type: '.(empty($_GET['debug'])?'text/javascript':'application/json').'; charset=utf-8'); |
|
| 40 | +Api\Session::cache_control(86400); // cache for one day |
|
| 41 | +Header('Content-Type: '.(empty($_GET['debug']) ? 'text/javascript' : 'application/json').'; charset=utf-8'); |
|
| 42 | 42 | Header('ETag: '.$etag); |
| 43 | 43 | |
| 44 | 44 | // if servers send a If-None-Match header, response with 304 Not Modified, if etag matches |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | if (empty($_GET['debug'])) $content = 'egw.set_images('.$content.", egw && egw.window !== window);\n"; |
| 52 | 52 | |
| 53 | 53 | // we run our own gzip compression, to set a correct Content-Length of the encoded content |
| 54 | -if (in_array('gzip', explode(',',$_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode')) |
|
| 54 | +if (in_array('gzip', explode(',', $_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode')) |
|
| 55 | 55 | { |
| 56 | 56 | $content = gzencode($content); |
| 57 | 57 | header('Content-Encoding: gzip'); |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | private function parse_file($file) |
| 81 | 81 | { |
| 82 | 82 | // file is from url and can contain query-params, eg. /phpgwapi/inc/jscalendar-setup.php?dateformat=d.m.Y&lang=de |
| 83 | - if (strpos($file,'?') !== false) list($file) = explode('?',$file); |
|
| 83 | + if (strpos($file, '?') !== false) list($file) = explode('?', $file); |
|
| 84 | 84 | |
| 85 | 85 | // Mark the file as parsed |
| 86 | 86 | $this->parsed_files[$file] = true; |
@@ -284,17 +284,17 @@ discard block |
||
| 284 | 284 | * @returns the correct path on the server if the file is found or false, if the |
| 285 | 285 | * file is not found or no further processing is needed. |
| 286 | 286 | */ |
| 287 | - private function translate_params($package, $file=null, $app='api') |
|
| 287 | + private function translate_params($package, $file = null, $app = 'api') |
|
| 288 | 288 | { |
| 289 | 289 | if ($package[0] == '/' && is_readable(EGW_SERVER_ROOT.parse_url($path = $package, PHP_URL_PATH)) || |
| 290 | 290 | // fix old /phpgwapi/js/ path by replacing it with /api/js/ |
| 291 | 291 | substr($package, 0, 13) == '/phpgwapi/js/' && is_readable(EGW_SERVER_ROOT.parse_url($path = str_replace('/phpgwapi/js/', '/api/js/', $package), PHP_URL_PATH)) || |
| 292 | 292 | $package[0] == '/' && is_readable(EGW_SERVER_ROOT.($path = $package)) || |
| 293 | - $package == '.' && is_readable(EGW_SERVER_ROOT.($path="/$app/js/$file.js")) || |
|
| 294 | - is_readable(EGW_SERVER_ROOT.($path="/$app/js/$package/$file.js")) || |
|
| 293 | + $package == '.' && is_readable(EGW_SERVER_ROOT.($path = "/$app/js/$file.js")) || |
|
| 294 | + is_readable(EGW_SERVER_ROOT.($path = "/$app/js/$package/$file.js")) || |
|
| 295 | 295 | // fix not found by using app='api' |
| 296 | - $app != 'api' && is_readable(EGW_SERVER_ROOT.($path="/api/js/$package/$file.js")) || |
|
| 297 | - $app != 'phpgwapi' && is_readable(EGW_SERVER_ROOT.($path="/phpgwapi/js/$package/$file.js"))) |
|
| 296 | + $app != 'api' && is_readable(EGW_SERVER_ROOT.($path = "/api/js/$package/$file.js")) || |
|
| 297 | + $app != 'phpgwapi' && is_readable(EGW_SERVER_ROOT.($path = "/phpgwapi/js/$package/$file.js"))) |
|
| 298 | 298 | { |
| 299 | 299 | // normalise /./ to / |
| 300 | 300 | $path = str_replace('/./', '/', $path); |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | // adding the ctime to all js files... |
| 306 | 306 | if (is_array($file)) |
| 307 | 307 | { |
| 308 | - foreach($file as $name => $val) |
|
| 308 | + foreach ($file as $name => $val) |
|
| 309 | 309 | { |
| 310 | 310 | $args .= (empty($args) ? '?' : '&').$name.'='.urlencode($val); |
| 311 | 311 | } |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | * @param array $files |
| 376 | 376 | * @param boolean $clear_files =false if true clear list of files, before including given ones |
| 377 | 377 | */ |
| 378 | - public function include_files(array $files, $clear_files=false) |
|
| 378 | + public function include_files(array $files, $clear_files = false) |
|
| 379 | 379 | { |
| 380 | 380 | if ($clear_files) $this->included_files = array(); |
| 381 | 381 | |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | * @param boolean $clear_files =false if true clear list of files after returning them |
| 392 | 392 | * @return array |
| 393 | 393 | */ |
| 394 | - public function get_included_files($clear_files=false) |
|
| 394 | + public function get_included_files($clear_files = false) |
|
| 395 | 395 | { |
| 396 | 396 | $ret = array_keys($this->included_files); |
| 397 | 397 | if ($clear_files) $this->included_files = array(); |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | |
| 425 | 425 | $paths = !empty($_GET['path']) ? (array)$_GET['path'] : (array)'/stylite/js/filemanager/filemanager.js'; |
| 426 | 426 | |
| 427 | - foreach($paths as $path) |
|
| 427 | + foreach ($paths as $path) |
|
| 428 | 428 | { |
| 429 | 429 | echo "\t<h1>".htmlspecialchars($path)."</h1>\n"; |
| 430 | 430 | $mgr->include_js_file($path); |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * - function-name like set_var to get eg. all assignments or |
| 33 | 33 | * - handle- / variable-names - if you are only interested in some variables ;-) |
| 34 | 34 | */ |
| 35 | - var $debug = False; // array('cat_list','cat_list_t'); |
|
| 35 | + var $debug = False; // array('cat_list','cat_list_t'); |
|
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * $file[handle] = 'filename'; |
@@ -128,9 +128,9 @@ discard block |
||
| 128 | 128 | */ |
| 129 | 129 | function set_file($handle, $filename = '') |
| 130 | 130 | { |
| 131 | - if ($this->debug && $this->check_debug('set_file',$handle,$filename)) |
|
| 131 | + if ($this->debug && $this->check_debug('set_file', $handle, $filename)) |
|
| 132 | 132 | { |
| 133 | - echo "<p>Template::set_file('".print_r($handle,true)."','$filename')</p>\n"; |
|
| 133 | + echo "<p>Template::set_file('".print_r($handle, true)."','$filename')</p>\n"; |
|
| 134 | 134 | } |
| 135 | 135 | if (!is_array($handle)) |
| 136 | 136 | { |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | } |
| 144 | 144 | else |
| 145 | 145 | { |
| 146 | - foreach($handle as $h => $f) |
|
| 146 | + foreach ($handle as $h => $f) |
|
| 147 | 147 | { |
| 148 | 148 | $this->file[$h] = $this->filename($f); |
| 149 | 149 | } |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | function set_block($parent, $handle, $name = '') |
| 162 | 162 | { |
| 163 | - if ($this->debug && $this->check_debug('set_block',$parent,$handle,$name)) |
|
| 163 | + if ($this->debug && $this->check_debug('set_block', $parent, $handle, $name)) |
|
| 164 | 164 | { |
| 165 | 165 | echo "<p>Template::set_block('$parent','$handle','$name')</p>\n"; |
| 166 | 166 | } |
@@ -177,14 +177,14 @@ discard block |
||
| 177 | 177 | $qhandle = preg_quote($handle); |
| 178 | 178 | $reg = "/<!--\\s+BEGIN $qhandle\\s+-->(.*)\n\\s*<!--\\s+END $qhandle\\s+-->/s"; |
| 179 | 179 | $match = null; |
| 180 | - if (!preg_match($reg,$str,$match)) |
|
| 180 | + if (!preg_match($reg, $str, $match)) |
|
| 181 | 181 | { |
| 182 | 182 | // unfortunaly some apps set non-existing blocks, therefor I have to disable this diagnostics again for now |
| 183 | 183 | $this->halt("set_block: unable to find block '$handle' in '$parent'=<pre>".htmlspecialchars($str)."</pre> this->root=$this->root"); |
| 184 | 184 | // return False; |
| 185 | 185 | } |
| 186 | - $this->set_var($handle,$match[1]); |
|
| 187 | - $this->set_var($parent,preg_replace($reg, '{' . "$name}",$str)); |
|
| 186 | + $this->set_var($handle, $match[1]); |
|
| 187 | + $this->set_var($parent, preg_replace($reg, '{'."$name}", $str)); |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | /* public: set_var(array $values) |
@@ -205,18 +205,18 @@ discard block |
||
| 205 | 205 | $varname => $value |
| 206 | 206 | ); |
| 207 | 207 | } |
| 208 | - foreach($varname as $k => $v) |
|
| 208 | + foreach ($varname as $k => $v) |
|
| 209 | 209 | { |
| 210 | 210 | if (!empty($k)) |
| 211 | 211 | { |
| 212 | - if ($this->debug && $this->check_debug('set_var',$k)) |
|
| 212 | + if ($this->debug && $this->check_debug('set_var', $k)) |
|
| 213 | 213 | { |
| 214 | 214 | echo "<p>Template::set_var('$k','$v')</p>\n"; |
| 215 | 215 | } |
| 216 | 216 | $this->varkeys[$k] = $this->varname($k); |
| 217 | 217 | $this->varvals[$k] = $this->egroupware_hack ? str_replace( |
| 218 | - array('phpGroupWare','www.phpgroupware.org'), |
|
| 219 | - array('eGroupWare','www.eGroupWare.org'),$v |
|
| 218 | + array('phpGroupWare', 'www.phpgroupware.org'), |
|
| 219 | + array('eGroupWare', 'www.eGroupWare.org'), $v |
|
| 220 | 220 | ) : $v; |
| 221 | 221 | } |
| 222 | 222 | } |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | */ |
| 231 | 231 | function subst($handle) |
| 232 | 232 | { |
| 233 | - if ($this->debug && $this->check_debug('subst',$handle)) |
|
| 233 | + if ($this->debug && $this->check_debug('subst', $handle)) |
|
| 234 | 234 | { |
| 235 | 235 | echo "<p>Template::subst('$handle')</p>\n"; |
| 236 | 236 | } |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | $str = $this->get_var($handle); |
| 244 | - foreach($this->varkeys as $k => $v) |
|
| 244 | + foreach ($this->varkeys as $k => $v) |
|
| 245 | 245 | { |
| 246 | 246 | $str = str_replace($v, $this->varvals[$k], $str); |
| 247 | 247 | } |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | $str = $this->subst($handle); |
| 277 | 277 | if ($append) |
| 278 | 278 | { |
| 279 | - $this->set_var($target, $this->get_var($target) . $str); |
|
| 279 | + $this->set_var($target, $this->get_var($target).$str); |
|
| 280 | 280 | } |
| 281 | 281 | else |
| 282 | 282 | { |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | } |
| 286 | 286 | else |
| 287 | 287 | { |
| 288 | - foreach($handle as $h) |
|
| 288 | + foreach ($handle as $h) |
|
| 289 | 289 | { |
| 290 | 290 | $str = $this->subst($h); |
| 291 | 291 | $this->set_var($target, $str); |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | */ |
| 333 | 333 | function get_vars() |
| 334 | 334 | { |
| 335 | - foreach(array_keys($this->varkeys) as $k) |
|
| 335 | + foreach (array_keys($this->varkeys) as $k) |
|
| 336 | 336 | { |
| 337 | 337 | $result[$k] = $this->varvals[$k]; |
| 338 | 338 | } |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | } |
| 354 | 354 | else |
| 355 | 355 | { |
| 356 | - foreach(array_keys($varname) as $k) |
|
| 356 | + foreach (array_keys($varname) as $k) |
|
| 357 | 357 | { |
| 358 | 358 | $result[$k] = $this->varvals[$k]; |
| 359 | 359 | } |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | { |
| 383 | 383 | return false; |
| 384 | 384 | } |
| 385 | - foreach($m as $v) |
|
| 385 | + foreach ($m as $v) |
|
| 386 | 386 | { |
| 387 | 387 | if (!isset($this->varkeys[$v])) |
| 388 | 388 | { |
@@ -448,15 +448,15 @@ discard block |
||
| 448 | 448 | * @param string $root ='' default $this->root |
| 449 | 449 | * @param int $time =1 |
| 450 | 450 | */ |
| 451 | - protected function filename($filename,$root='',$time=1) |
|
| 451 | + protected function filename($filename, $root = '', $time = 1) |
|
| 452 | 452 | { |
| 453 | - if($root == '') |
|
| 453 | + if ($root == '') |
|
| 454 | 454 | { |
| 455 | 455 | $root = $this->root; |
| 456 | 456 | } |
| 457 | - if(substr($filename, 0, 1) != '/') |
|
| 457 | + if (substr($filename, 0, 1) != '/') |
|
| 458 | 458 | { |
| 459 | - $new_filename = $root . '/' . $filename; |
|
| 459 | + $new_filename = $root.'/'.$filename; |
|
| 460 | 460 | } |
| 461 | 461 | else |
| 462 | 462 | { |
@@ -465,14 +465,14 @@ discard block |
||
| 465 | 465 | |
| 466 | 466 | if (!file_exists($new_filename)) |
| 467 | 467 | { |
| 468 | - if($time==2) |
|
| 468 | + if ($time == 2) |
|
| 469 | 469 | { |
| 470 | 470 | $this->halt("filename: file $new_filename does not exist."); |
| 471 | 471 | } |
| 472 | 472 | else |
| 473 | 473 | { |
| 474 | - $new_root = dirname($root) . DIRECTORY_SEPARATOR . 'default'; |
|
| 475 | - $new_filename = $this->filename(str_replace($root.'/','',$new_filename),$new_root,2); |
|
| 474 | + $new_root = dirname($root).DIRECTORY_SEPARATOR.'default'; |
|
| 475 | + $new_filename = $this->filename(str_replace($root.'/', '', $new_filename), $new_root, 2); |
|
| 476 | 476 | } |
| 477 | 477 | } |
| 478 | 478 | return $new_filename; |
@@ -491,9 +491,9 @@ discard block |
||
| 491 | 491 | */ |
| 492 | 492 | function loadfile($handle) |
| 493 | 493 | { |
| 494 | - if ($this->debug && $this->check_debug('loadfile',$handle)) |
|
| 494 | + if ($this->debug && $this->check_debug('loadfile', $handle)) |
|
| 495 | 495 | { |
| 496 | - echo "<p>Template::loadfile('$handle') file=<pre>\n".print_r($this->file,True)."</pre>\n"; |
|
| 496 | + echo "<p>Template::loadfile('$handle') file=<pre>\n".print_r($this->file, True)."</pre>\n"; |
|
| 497 | 497 | echo "<p>backtrace: ".function_backtrace()."</p>\n"; |
| 498 | 498 | } |
| 499 | 499 | if (isset($this->varkeys[$handle]) && !empty($this->varvals[$handle])) |
@@ -502,9 +502,9 @@ discard block |
||
| 502 | 502 | } |
| 503 | 503 | if (!isset($this->file[$handle])) |
| 504 | 504 | { |
| 505 | - if ($this->debug && $this->check_debug('loadfile',$handle)) |
|
| 505 | + if ($this->debug && $this->check_debug('loadfile', $handle)) |
|
| 506 | 506 | { |
| 507 | - echo "varkeys =<pre>".print_r($this->varkeys,True)."</pre>varvals =<pre>".print_r($this->varvals,True)."</pre>\n"; |
|
| 507 | + echo "varkeys =<pre>".print_r($this->varkeys, True)."</pre>varvals =<pre>".print_r($this->varvals, True)."</pre>\n"; |
|
| 508 | 508 | } |
| 509 | 509 | $this->halt("loadfile: $handle is not a valid handle."); |
| 510 | 510 | return false; |
@@ -549,10 +549,10 @@ discard block |
||
| 549 | 549 | { |
| 550 | 550 | if (!$this->debug) return False; |
| 551 | 551 | |
| 552 | - foreach(func_get_args() as $arg) |
|
| 552 | + foreach (func_get_args() as $arg) |
|
| 553 | 553 | { |
| 554 | 554 | if (!is_array($this->debug) && $this->debug === $arg || |
| 555 | - (is_array($this->debug) && (@$this->debug[$arg] || in_array($arg,$this->debug,True)))) |
|
| 555 | + (is_array($this->debug) && (@$this->debug[$arg] || in_array($arg, $this->debug, True)))) |
|
| 556 | 556 | { |
| 557 | 557 | return True; |
| 558 | 558 | } |
@@ -601,8 +601,8 @@ discard block |
||
| 601 | 601 | { |
| 602 | 602 | $GLOBALS['egw_info']['server']['template_set'] = 'idots'; |
| 603 | 603 | } |
| 604 | - $tpldir = EGW_SERVER_ROOT . '/' . $appname . '/templates/' . $GLOBALS['egw_info']['server']['template_set']; |
|
| 605 | - $tpldir_default = EGW_SERVER_ROOT . '/' . $appname . '/templates/default'; |
|
| 604 | + $tpldir = EGW_SERVER_ROOT.'/'.$appname.'/templates/'.$GLOBALS['egw_info']['server']['template_set']; |
|
| 605 | + $tpldir_default = EGW_SERVER_ROOT.'/'.$appname.'/templates/default'; |
|
| 606 | 606 | |
| 607 | 607 | if (@is_dir($tpldir)) |
| 608 | 608 | { |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * |
| 33 | 33 | * @param array $content |
| 34 | 34 | */ |
| 35 | - function popup ($content=null) |
|
| 35 | + function popup($content = null) |
|
| 36 | 36 | { |
| 37 | 37 | // check and if not done register tutorial_menu hook |
| 38 | 38 | if (!Api\Hooks::exists('sidebox_all', 'api') || |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | if (!is_array($content)) |
| 49 | 49 | { |
| 50 | 50 | // Get tutorial object id |
| 51 | - $tuid_indx = explode('-',$_GET['tuid']); |
|
| 51 | + $tuid_indx = explode('-', $_GET['tuid']); |
|
| 52 | 52 | $appName = $tuid_indx[0]; |
| 53 | 53 | $lang = $tuid_indx[1]; |
| 54 | 54 | $id = $tuid_indx[2]; |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | { |
| 58 | 58 | $appName = $content['list']['apps']; |
| 59 | 59 | $lang = $GLOBALS['egw_info']['user']['preferences']['common']['lang']; |
| 60 | - $id ="0"; |
|
| 60 | + $id = "0"; |
|
| 61 | 61 | } |
| 62 | 62 | // read tutorials json file to fetch data |
| 63 | 63 | $tutorials = json_decode(self::getJsonData(), true); |
@@ -74,8 +74,7 @@ discard block |
||
| 74 | 74 | if (in_array($appName, array_keys($GLOBALS['egw_info']['user']['apps'])) || $appName === "introduction") |
| 75 | 75 | { |
| 76 | 76 | // fallback to english video |
| 77 | - $tutorial = $tutorials[$appName][$lang][$id]? $tutorials[$appName][$lang][$id]: |
|
| 78 | - $tutorials[$appName]['en'][$id]; |
|
| 77 | + $tutorial = $tutorials[$appName][$lang][$id] ? $tutorials[$appName][$lang][$id] : $tutorials[$appName]['en'][$id]; |
|
| 79 | 78 | |
| 80 | 79 | $list = array( |
| 81 | 80 | 'apps' => $appName, |
@@ -86,7 +85,7 @@ discard block |
||
| 86 | 85 | $v ['onclick'] = 'app[egw.app_name()].tutorial_videoOnClick("'.$v['src'].'")'; |
| 87 | 86 | array_push($list, $v); |
| 88 | 87 | } |
| 89 | - $content = array ( |
|
| 88 | + $content = array( |
|
| 90 | 89 | 'src' => $tutorial['src'], |
| 91 | 90 | 'title' => $tutorial['title'], |
| 92 | 91 | 'desc' => $tutorial['desc'], |
@@ -137,13 +136,13 @@ discard block |
||
| 137 | 136 | public static function tutorial_menu() |
| 138 | 137 | { |
| 139 | 138 | if (Api\Header\UserAgent::mobile()) return; |
| 140 | - $tutorials = json_decode(self::getJsonData(),true); |
|
| 139 | + $tutorials = json_decode(self::getJsonData(), true); |
|
| 141 | 140 | $appname = $GLOBALS['egw_info']['flags']['currentapp']; |
| 142 | 141 | if (!is_array($tutorials[$appname])) return false; |
| 143 | 142 | if (!$GLOBALS['egw_info']['server']['egw_tutorial_disable'] |
| 144 | 143 | || $GLOBALS['egw_info']['server']['egw_tutorial_disable'] == 'intro') |
| 145 | 144 | { |
| 146 | - $file = Array ( |
|
| 145 | + $file = Array( |
|
| 147 | 146 | array( |
| 148 | 147 | 'text' => '<div id="egw_tutorial_'.$appname.'_sidebox" class="egwTutorial"/>', |
| 149 | 148 | 'no_lang' => true, |