@@ -41,23 +41,23 @@ discard block |
||
| 41 | 41 | $GLOBALS['egw_info']['flags']['currentapp'] = 'calendar'; |
| 42 | 42 | } |
| 43 | 43 | // fix for SOGo connector, which does not decode the = in our f/b url |
| 44 | -if (strpos($_SERVER['QUERY_STRING'],'=3D') !== false && substr($_GET['user'],0,2) == '3D') |
|
| 44 | +if (strpos($_SERVER['QUERY_STRING'], '=3D') !== false && substr($_GET['user'], 0, 2) == '3D') |
|
| 45 | 45 | { |
| 46 | - $_GET['user'] = substr($_GET['user'],2); |
|
| 47 | - if (isset($_GET['password'])) $_GET['password'] = substr($_GET['password'],2); |
|
| 48 | - if (isset($_GET['cred'])) $_GET['cred'] = substr($_GET['cred'],2); |
|
| 46 | + $_GET['user'] = substr($_GET['user'], 2); |
|
| 47 | + if (isset($_GET['password'])) $_GET['password'] = substr($_GET['password'], 2); |
|
| 48 | + if (isset($_GET['cred'])) $_GET['cred'] = substr($_GET['cred'], 2); |
|
| 49 | 49 | } |
| 50 | 50 | if (!is_numeric($user = $_GET['user'])) |
| 51 | 51 | { |
| 52 | 52 | // check if user contains the current domain --> remove it |
| 53 | - list(,$domain) = explode('@',$user); |
|
| 53 | + list(,$domain) = explode('@', $user); |
|
| 54 | 54 | if ($domain === $GLOBALS['egw_info']['user']['domain']) |
| 55 | - list($user) = explode('@',$user); |
|
| 56 | - $user = $GLOBALS['egw']->accounts->name2id($user,'account_lid','u'); |
|
| 55 | + list($user) = explode('@', $user); |
|
| 56 | + $user = $GLOBALS['egw']->accounts->name2id($user, 'account_lid', 'u'); |
|
| 57 | 57 | } |
| 58 | 58 | if ($user === false || !($username = $GLOBALS['egw']->accounts->id2name($user))) |
| 59 | 59 | { |
| 60 | - fail_exit(lang("freebusy: Unknow user '%1', wrong password or not availible to not loged in users !!!"." $username($user)",$_GET['user'])); |
|
| 60 | + fail_exit(lang("freebusy: Unknow user '%1', wrong password or not availible to not loged in users !!!"." $username($user)", $_GET['user'])); |
|
| 61 | 61 | } |
| 62 | 62 | if (!$loged_in) |
| 63 | 63 | { |
@@ -78,11 +78,11 @@ discard block |
||
| 78 | 78 | if (strpos($authuser, '@') === false) |
| 79 | 79 | { |
| 80 | 80 | $domain = $GLOBALS['egw_info']['server']['default_domain']; |
| 81 | - $authuser .= '@' . $domain; |
|
| 81 | + $authuser .= '@'.$domain; |
|
| 82 | 82 | } |
| 83 | 83 | else |
| 84 | 84 | { |
| 85 | - list(, $domain) = explode('@',$authuser, 2); |
|
| 85 | + list(, $domain) = explode('@', $authuser, 2); |
|
| 86 | 86 | } |
| 87 | 87 | if (array_key_exists($domain, $GLOBALS['egw_domain'])) |
| 88 | 88 | { |
@@ -92,8 +92,8 @@ discard block |
||
| 92 | 92 | $GLOBALS['egw_info']['user']['domain'] = $domain; |
| 93 | 93 | $GLOBALS['egw_info']['flags']['currentapp'] = 'login'; |
| 94 | 94 | $GLOBALS['egw_info']['flags']['noapi'] = false; |
| 95 | - require_once(EGW_API_INC . '/functions.inc.php'); |
|
| 96 | - $loged_in = $GLOBALS['egw']->session->create($authuser, $password, 'text'); |
|
| 95 | + require_once(EGW_API_INC.'/functions.inc.php'); |
|
| 96 | + $loged_in = $GLOBALS['egw']->session->create($authuser, $password, 'text'); |
|
| 97 | 97 | session_unset(); |
| 98 | 98 | session_destroy(); |
| 99 | 99 | } |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | } |
| 110 | 110 | else |
| 111 | 111 | { |
| 112 | - Api\Header\Content::type('freebusy.ifb','text/calendar'); |
|
| 112 | + Api\Header\Content::type('freebusy.ifb', 'text/calendar'); |
|
| 113 | 113 | } |
| 114 | 114 | $ical = new calendar_ical(); |
| 115 | 115 | echo $ical->freebusy($user, $_GET['end']); |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | unset($this->export_fields['participants-r']); |
| 25 | 25 | |
| 26 | 26 | $custom = Api\Storage\Customfields::get('calendar', true); |
| 27 | - foreach($custom as $name => $data) { |
|
| 27 | + foreach ($custom as $name => $data) { |
|
| 28 | 28 | $this->export_fields['#'.$name] = $data['label']; |
| 29 | 29 | } |
| 30 | 30 | } |
@@ -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; |
@@ -32,19 +32,19 @@ discard block |
||
| 32 | 32 | $reload = !is_null($need_reload); |
| 33 | 33 | |
| 34 | 34 | // Let parent handle the basic stuff |
| 35 | - parent::__construct($context,$need_reload); |
|
| 35 | + parent::__construct($context, $need_reload); |
|
| 36 | 36 | |
| 37 | - if($this->favorite['state']['view'] == 'listview') |
|
| 37 | + if ($this->favorite['state']['view'] == 'listview') |
|
| 38 | 38 | { |
| 39 | 39 | $this->context['template'] = 'calendar.list.rows'; |
| 40 | 40 | $this->context['sel_options'] = array(); |
| 41 | 41 | $this->nm_settings += array( |
| 42 | 42 | 'csv_export' => True, |
| 43 | - 'filter_no_lang' => True, // I set no_lang for filter (=dont translate the options) |
|
| 44 | - 'no_filter2' => True, // I disable the 2. filter (params are the same as for filter) |
|
| 45 | - 'no_cat' => True, // I disable the cat-selectbox |
|
| 43 | + 'filter_no_lang' => True, // I set no_lang for filter (=dont translate the options) |
|
| 44 | + 'no_filter2' => True, // I disable the 2. filter (params are the same as for filter) |
|
| 45 | + 'no_cat' => True, // I disable the cat-selectbox |
|
| 46 | 46 | 'filter' => 'after', |
| 47 | - 'row_id' => 'row_id', // set in get rows "$event[id]:$event[recur_date]" |
|
| 47 | + 'row_id' => 'row_id', // set in get rows "$event[id]:$event[recur_date]" |
|
| 48 | 48 | 'row_modified' => 'modified', |
| 49 | 49 | 'get_rows' => 'calendar_favorite_portlet::get_rows', |
| 50 | 50 | // Use a different template so it can be accessed from client side |
@@ -58,17 +58,17 @@ discard block |
||
| 58 | 58 | $need_reload = $reload && $need_reload; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - public function exec($id = null, Etemplate &$etemplate = null) |
|
| 61 | + public function exec($id = null, Etemplate&$etemplate = null) |
|
| 62 | 62 | { |
| 63 | 63 | |
| 64 | 64 | // Always load app's javascript, so most actions have a chance of working |
| 65 | - Framework::includeJS('.','app',$this->context['appname']); |
|
| 65 | + Framework::includeJS('.', 'app', $this->context['appname']); |
|
| 66 | 66 | |
| 67 | 67 | // Always load app's css |
| 68 | 68 | Framework::includeCSS('calendar', 'app-'.$GLOBALS['egw_info']['user']['preferences']['common']['theme']) || |
| 69 | - Framework::includeCSS('calendar','app'); |
|
| 69 | + Framework::includeCSS('calendar', 'app'); |
|
| 70 | 70 | |
| 71 | - if($this->favorite['state']['view'] == 'listview' || is_array($this->favorite) && !$this->favorite['state']['view']) |
|
| 71 | + if ($this->favorite['state']['view'] == 'listview' || is_array($this->favorite) && !$this->favorite['state']['view']) |
|
| 72 | 72 | { |
| 73 | 73 | $ui = new calendar_uilist(); |
| 74 | 74 | } |
@@ -77,16 +77,16 @@ discard block |
||
| 77 | 77 | $ui = new calendar_uiviews(); |
| 78 | 78 | if ($this->favorite) |
| 79 | 79 | { |
| 80 | - if($this->favorite['state']['start']) $ui->search_params['start'] = $this->favorite['state']['start']; |
|
| 81 | - if($this->favorite['state']['cat_id']) $ui->search_params['cat_id'] = $this->favorite['state']['cat_id']; |
|
| 80 | + if ($this->favorite['state']['start']) $ui->search_params['start'] = $this->favorite['state']['start']; |
|
| 81 | + if ($this->favorite['state']['cat_id']) $ui->search_params['cat_id'] = $this->favorite['state']['cat_id']; |
|
| 82 | 82 | // Owner can be 0 for current user |
| 83 | - if(array_key_exists('owner',$this->favorite['state'])) $ui->search_params['users'] = $this->favorite['state']['owner']; |
|
| 84 | - if($ui->search_params['users'] && !is_array($ui->search_params['users'])) |
|
| 83 | + if (array_key_exists('owner', $this->favorite['state'])) $ui->search_params['users'] = $this->favorite['state']['owner']; |
|
| 84 | + if ($ui->search_params['users'] && !is_array($ui->search_params['users'])) |
|
| 85 | 85 | { |
| 86 | - $ui->search_params['users'] = explode(',',$ui->search_params['users']); |
|
| 86 | + $ui->search_params['users'] = explode(',', $ui->search_params['users']); |
|
| 87 | 87 | } |
| 88 | - if($this->favorite['state']['filter']) $ui->search_params['filter'] = $this->favorite['state']['filter']; |
|
| 89 | - if($this->favorite['state']['sortby']) $ui->search_params['sortby'] = $this->favorite['state']['sortby']; |
|
| 88 | + if ($this->favorite['state']['filter']) $ui->search_params['filter'] = $this->favorite['state']['filter']; |
|
| 89 | + if ($this->favorite['state']['sortby']) $ui->search_params['sortby'] = $this->favorite['state']['sortby']; |
|
| 90 | 90 | $ui->search_params['weekend'] = $this->favorite['state']['weekend']; |
| 91 | 91 | } |
| 92 | 92 | $etemplate->read('home.legacy'); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | $content = array('legacy' => ''); |
| 98 | 98 | |
| 99 | - switch($this->favorite['state']['view']) |
|
| 99 | + switch ($this->favorite['state']['view']) |
|
| 100 | 100 | { |
| 101 | 101 | case 'listview': |
| 102 | 102 | $this->context['sel_options']['filter'] = &$ui->date_filters; |
@@ -110,9 +110,9 @@ discard block |
||
| 110 | 110 | $content = array(); |
| 111 | 111 | $etemplate->read('calendar.planner'); |
| 112 | 112 | $etemplate->set_dom_id($id); |
| 113 | - $this->actions =& $etemplate->getElementAttribute('planner', 'actions'); |
|
| 113 | + $this->actions = & $etemplate->getElementAttribute('planner', 'actions'); |
|
| 114 | 114 | // Don't notify the calendar app of date changes |
| 115 | - $etemplate->setElementAttribute('planner','onchange',false); |
|
| 115 | + $etemplate->setElementAttribute('planner', 'onchange', false); |
|
| 116 | 116 | $ui->planner_view = $this->favorite['state']['planner_view']; |
| 117 | 117 | $ui->planner(array(), $etemplate); |
| 118 | 118 | return; |
@@ -120,20 +120,19 @@ discard block |
||
| 120 | 120 | case 'weekN': |
| 121 | 121 | $etemplate->read('calendar.view'); |
| 122 | 122 | $etemplate->set_dom_id($id); |
| 123 | - $this->actions =& $etemplate->getElementAttribute('view', 'actions'); |
|
| 123 | + $this->actions = & $etemplate->getElementAttribute('view', 'actions'); |
|
| 124 | 124 | |
| 125 | 125 | $ui->month($this->favorite['state']['view'] == 'month' ? |
| 126 | - 0 : |
|
| 127 | - (int)$ui->cal_prefs['multiple_weeks'], |
|
| 126 | + 0 : (int)$ui->cal_prefs['multiple_weeks'], |
|
| 128 | 127 | $etemplate |
| 129 | 128 | ); |
| 130 | 129 | return; |
| 131 | 130 | case 'week': |
| 132 | 131 | $etemplate->read('calendar.view'); |
| 133 | 132 | $etemplate->set_dom_id($id); |
| 134 | - $this->actions =& $etemplate->getElementAttribute('view', 'actions'); |
|
| 133 | + $this->actions = & $etemplate->getElementAttribute('view', 'actions'); |
|
| 135 | 134 | // Don't notify the calendar app of date changes |
| 136 | - $etemplate->setElementAttribute('view[0]','onchange',false); |
|
| 135 | + $etemplate->setElementAttribute('view[0]', 'onchange', false); |
|
| 137 | 136 | $ui->week(array(), $etemplate); |
| 138 | 137 | return; |
| 139 | 138 | case 'day': |
@@ -143,7 +142,7 @@ discard block |
||
| 143 | 142 | $days = $this->favorite['state']['days'] ? $this->favorite['state']['days'] : ( |
| 144 | 143 | $this->favorite['state']['view'] == 'day' ? 1 : 4 |
| 145 | 144 | ); |
| 146 | - $this->actions =& $etemplate->getElementAttribute('view', 'actions'); |
|
| 145 | + $this->actions = & $etemplate->getElementAttribute('view', 'actions'); |
|
| 147 | 146 | $ui->week($days, $etemplate); |
| 148 | 147 | return; |
| 149 | 148 | } |
@@ -156,7 +155,7 @@ discard block |
||
| 156 | 155 | $old_app = $GLOBALS['egw_info']['flags']['currentapp']; |
| 157 | 156 | $GLOBALS['egw_info']['flags']['currentapp'] = 'calendar'; |
| 158 | 157 | |
| 159 | - $etemplate->exec(get_called_class() .'::process',$content); |
|
| 158 | + $etemplate->exec(get_called_class().'::process', $content); |
|
| 160 | 159 | $GLOBALS['egw_info']['flags']['currentapp'] = $old_app; |
| 161 | 160 | } |
| 162 | 161 | |
@@ -199,27 +198,27 @@ discard block |
||
| 199 | 198 | else |
| 200 | 199 | { |
| 201 | 200 | $success = $failed = $action_msg = $msg = null; |
| 202 | - if ($ui->action($values['nm']['action'],$values['nm']['selected'],$values['nm']['select_all'], |
|
| 203 | - $success,$failed,$action_msg,'calendar_list',$msg, $values['nm']['checkboxes']['no_notifications'])) |
|
| 201 | + if ($ui->action($values['nm']['action'], $values['nm']['selected'], $values['nm']['select_all'], |
|
| 202 | + $success, $failed, $action_msg, 'calendar_list', $msg, $values['nm']['checkboxes']['no_notifications'])) |
|
| 204 | 203 | { |
| 205 | - $msg .= lang('%1 event(s) %2',$success,$action_msg); |
|
| 206 | - Api\Json\Response::get()->apply('egw.message',array($msg,'success')); |
|
| 207 | - foreach($values['nm']['selected'] as &$id) |
|
| 204 | + $msg .= lang('%1 event(s) %2', $success, $action_msg); |
|
| 205 | + Api\Json\Response::get()->apply('egw.message', array($msg, 'success')); |
|
| 206 | + foreach ($values['nm']['selected'] as &$id) |
|
| 208 | 207 | { |
| 209 | 208 | $id = 'calendar::'.$id; |
| 210 | 209 | } |
| 211 | 210 | // Directly request an update - this will get addressbook tab too |
| 212 | - Api\Json\Response::get()->apply('egw.dataRefreshUIDs',array($values['nm']['selected'])); |
|
| 211 | + Api\Json\Response::get()->apply('egw.dataRefreshUIDs', array($values['nm']['selected'])); |
|
| 213 | 212 | } |
| 214 | - elseif(is_null($msg)) |
|
| 213 | + elseif (is_null($msg)) |
|
| 215 | 214 | { |
| 216 | - $msg .= lang('%1 entries %2, %3 failed because of insufficent rights !!!',$success,$action_msg,$failed); |
|
| 217 | - Api\Json\Response::get()->apply('egw.message',array($msg,'error')); |
|
| 215 | + $msg .= lang('%1 entries %2, %3 failed because of insufficent rights !!!', $success, $action_msg, $failed); |
|
| 216 | + Api\Json\Response::get()->apply('egw.message', array($msg, 'error')); |
|
| 218 | 217 | } |
| 219 | - elseif($msg) |
|
| 218 | + elseif ($msg) |
|
| 220 | 219 | { |
| 221 | - $msg .= "\n".lang('%1 entries %2, %3 failed.',$success,$action_msg,$failed); |
|
| 222 | - Api\Json\Response::get()->apply('egw.message',array($msg,'error')); |
|
| 220 | + $msg .= "\n".lang('%1 entries %2, %3 failed.', $success, $action_msg, $failed); |
|
| 221 | + Api\Json\Response::get()->apply('egw.message', array($msg, 'error')); |
|
| 223 | 222 | } |
| 224 | 223 | unset($values['nm']['action']); |
| 225 | 224 | unset($values['nm']['select_all']); |
@@ -235,9 +234,9 @@ discard block |
||
| 235 | 234 | public function get_properties() |
| 236 | 235 | { |
| 237 | 236 | $properties = parent::get_properties(); |
| 238 | - foreach($properties as &$property) |
|
| 237 | + foreach ($properties as &$property) |
|
| 239 | 238 | { |
| 240 | - if($property['name'] == 'favorite') |
|
| 239 | + if ($property['name'] == 'favorite') |
|
| 241 | 240 | { |
| 242 | 241 | unset($property['select_options']['blank']); |
| 243 | 242 | break; |
@@ -247,7 +246,7 @@ discard block |
||
| 247 | 246 | } |
| 248 | 247 | |
| 249 | 248 | public function get_actions() { |
| 250 | - if($this->favorite['state']['view'] == 'listview' || !$this->actions) |
|
| 249 | + if ($this->favorite['state']['view'] == 'listview' || !$this->actions) |
|
| 251 | 250 | { |
| 252 | 251 | return array(); |
| 253 | 252 | } |
@@ -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'); |