@@ -22,11 +22,11 @@ discard block |
||
| 22 | 22 | "<a href=\"$webserverURL/redirect.php?go=".htmlentities(urlencode('http://www.egroupware.org')).'">' |
| 23 | 23 | */ |
| 24 | 24 | |
| 25 | - if(!function_exists('html_entity_decode')) |
|
| 25 | + if (!function_exists('html_entity_decode')) |
|
| 26 | 26 | { |
| 27 | 27 | function html_entity_decode($given_html, $quote_style = ENT_QUOTES) |
| 28 | 28 | { |
| 29 | - $trans_table = array_flip(get_html_translation_table( HTML_SPECIALCHARS, $quote_style)); |
|
| 29 | + $trans_table = array_flip(get_html_translation_table(HTML_SPECIALCHARS, $quote_style)); |
|
| 30 | 30 | $trans_table['''] = "'"; |
| 31 | 31 | return(strtr($given_html, $trans_table)); |
| 32 | 32 | } |
@@ -45,17 +45,17 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | /* Only allow redirects from inside this eGroupware installation. */ |
| 47 | 47 | $valid_referer = array(); |
| 48 | - $path = preg_replace('/\/[^\/]*$/','',$_SERVER['PHP_SELF']) . '/'; |
|
| 48 | + $path = preg_replace('/\/[^\/]*$/', '', $_SERVER['PHP_SELF']).'/'; |
|
| 49 | 49 | array_push($valid_referer, $path); |
| 50 | - array_push($valid_referer, ($_SERVER['HTTPS'] ? 'https://' : 'http://') . $_SERVER['SERVER_ADDR'] . $path); |
|
| 51 | - array_push($valid_referer, ($_SERVER['HTTPS'] ? 'https://' : 'http://') . $_SERVER['SERVER_NAME'] . $path); |
|
| 50 | + array_push($valid_referer, ($_SERVER['HTTPS'] ? 'https://' : 'http://').$_SERVER['SERVER_ADDR'].$path); |
|
| 51 | + array_push($valid_referer, ($_SERVER['HTTPS'] ? 'https://' : 'http://').$_SERVER['SERVER_NAME'].$path); |
|
| 52 | 52 | |
| 53 | 53 | $referrer = trim($_SERVER['HTTP_REFERER']); |
| 54 | 54 | if ((!isset($_SERVER['HTTP_REFERER'])) || (empty($referrer))) |
| 55 | 55 | { |
| 56 | 56 | echo "Only usable from within eGroupware.\n"; |
| 57 | 57 | } |
| 58 | - else if($_GET['go']) |
|
| 58 | + else if ($_GET['go']) |
|
| 59 | 59 | { |
| 60 | 60 | $allow = false; |
| 61 | 61 | foreach ($valid_referer as $urlRoot) |
@@ -69,15 +69,15 @@ discard block |
||
| 69 | 69 | } |
| 70 | 70 | if ($allow) |
| 71 | 71 | { |
| 72 | - $url= html_entity_decode(urldecode($_GET['go'])); |
|
| 72 | + $url = html_entity_decode(urldecode($_GET['go'])); |
|
| 73 | 73 | unset($_GET['go']); |
| 74 | 74 | /* Only add "&" if there is something to append. */ |
| 75 | 75 | if (!empty($_GET)) |
| 76 | 76 | { |
| 77 | - $url=$url."&".http_build_query($_GET); |
|
| 77 | + $url = $url."&".http_build_query($_GET); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - Header('Location: ' . html_entity_decode(urldecode($url))); |
|
| 80 | + Header('Location: '.html_entity_decode(urldecode($url))); |
|
| 81 | 81 | exit; |
| 82 | 82 | } |
| 83 | 83 | else |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | 'name' => 'Ralf Becker', |
| 21 | 21 | 'email' => '[email protected]' |
| 22 | 22 | ); |
| 23 | -$setup_info['filemanager']['license'] = 'GPL'; |
|
| 23 | +$setup_info['filemanager']['license'] = 'GPL'; |
|
| 24 | 24 | |
| 25 | 25 | /* The hooks this app includes, needed for hooks registration */ |
| 26 | 26 | $setup_info['filemanager']['hooks']['settings'] = 'filemanager_hooks::settings'; |
@@ -27,12 +27,12 @@ |
||
| 27 | 27 | $this->description = lang('This module displays the current month'); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - function get_content(&$arguments,$properties) |
|
| 30 | + function get_content(&$arguments, $properties) |
|
| 31 | 31 | { |
| 32 | - $date = (int) (strtotime(get_var('date',array('POST','GET')))); |
|
| 32 | + $date = (int)(strtotime(get_var('date', array('POST', 'GET')))); |
|
| 33 | 33 | $redirect = $arguments['redirect'] ? $arguments['redirect'] : '#'; |
| 34 | 34 | |
| 35 | 35 | return $GLOBALS['egw']->jscalendar->get_javascript(). |
| 36 | - $GLOBALS['egw']->jscalendar->flat($redirect,$date); |
|
| 36 | + $GLOBALS['egw']->jscalendar->flat($redirect, $date); |
|
| 37 | 37 | } |
| 38 | 38 | } |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | $setup_info['calendar']['enable'] = 1; |
| 16 | 16 | $setup_info['calendar']['index'] = 'calendar.calendar_uiviews.index&ajax=true'; |
| 17 | 17 | |
| 18 | -$setup_info['calendar']['license'] = 'GPL'; |
|
| 18 | +$setup_info['calendar']['license'] = 'GPL'; |
|
| 19 | 19 | $setup_info['calendar']['description'] = |
| 20 | 20 | 'Powerful group calendar with meeting request system and ACL security.'; |
| 21 | 21 | $setup_info['calendar']['note'] = |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | 'Arab Standard Time' => 'Asia/Riyadh', |
| 25 | 25 | 'Arabian Standard Time' => 'Asia/Dubai', |
| 26 | 26 | 'Arabic Standard Time' => 'Asia/Baghdad', |
| 27 | - 'Argentina Standard Time' => 'America/Argentina/Buenos_Aires', // was 'America/Buenos_Aires', |
|
| 27 | + 'Argentina Standard Time' => 'America/Argentina/Buenos_Aires', // was 'America/Buenos_Aires', |
|
| 28 | 28 | 'Atlantic Standard Time' => 'America/Halifax', |
| 29 | 29 | 'Azerbaijan Standard Time' => 'Asia/Baku', |
| 30 | 30 | 'Azores Standard Time' => 'Atlantic/Azores', |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | 'Greenland Standard Time' => 'America/Godthab', |
| 60 | 60 | 'Greenwich Standard Time' => 'Atlantic/Reykjavik', |
| 61 | 61 | 'Hawaiian Standard Time' => 'Pacific/Honolulu', |
| 62 | - 'India Standard Time' => 'Asia/Kolkata', // Asia/Calcutta is an alias to Asia/Kolkata |
|
| 62 | + 'India Standard Time' => 'Asia/Kolkata', // Asia/Calcutta is an alias to Asia/Kolkata |
|
| 63 | 63 | 'Iran Standard Time' => 'Asia/Tehran', |
| 64 | 64 | 'Israel Standard Time' => 'Asia/Jerusalem', |
| 65 | 65 | 'Jordan Standard Time' => 'Asia/Amman', |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | 'Eniwetok, Kwajalein, Dateline Time' => 'Pacific/Kwajalein', |
| 199 | 199 | |
| 200 | 200 | // various aliases collected over time |
| 201 | - 'America/Creston' => 'America/Dawson_Creek', // not in sqlight DB of Thunderbird version 1.2011n, Dawson Creek is also UTC-7 without DS |
|
| 201 | + 'America/Creston' => 'America/Dawson_Creek', // not in sqlight DB of Thunderbird version 1.2011n, Dawson Creek is also UTC-7 without DS |
|
| 202 | 202 | 'Armenian Standard Time' => 'Asia/Yerevan', |
| 203 | 203 | 'Asia/Katmandu' => 'Asia/Kathmandu', |
| 204 | 204 | 'Asia/Calcutta' => 'Asia/Kolkata', |
@@ -10,17 +10,17 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // enable auto-loading of holidays from localhost by default |
| 13 | -foreach(array( |
|
| 13 | +foreach (array( |
|
| 14 | 14 | 'auto_load_holidays' => 'True', |
| 15 | 15 | 'holidays_url_path' => 'localhost', |
| 16 | 16 | ) as $name => $value) |
| 17 | 17 | { |
| 18 | - $oProc->insert($GLOBALS['egw_setup']->config_table,array( |
|
| 18 | + $oProc->insert($GLOBALS['egw_setup']->config_table, array( |
|
| 19 | 19 | 'config_value' => $value, |
| 20 | - ),array( |
|
| 20 | + ), array( |
|
| 21 | 21 | 'config_app' => 'phpgwapi', |
| 22 | 22 | 'config_name' => $name, |
| 23 | - ),__FILE__,__LINE__); |
|
| 23 | + ), __FILE__, __LINE__); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | // import timezone data |
@@ -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); |
@@ -10,28 +10,28 @@ discard block |
||
| 10 | 10 | * @version $Id: $ |
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | -require_once(EGW_INCLUDE_ROOT. '/importexport/inc/class.iface_import_plugin.inc.php'); |
|
| 13 | +require_once(EGW_INCLUDE_ROOT.'/importexport/inc/class.iface_import_plugin.inc.php'); |
|
| 14 | 14 | require_once(EGW_INCLUDE_ROOT.'/importexport/inc/class.import_csv.inc.php'); |
| 15 | 15 | |
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | * class import_csv for addressbook |
| 19 | 19 | */ |
| 20 | -class import_events_csv implements iface_import_plugin { |
|
| 20 | +class import_events_csv implements iface_import_plugin { |
|
| 21 | 21 | |
| 22 | 22 | private static $plugin_options = array( |
| 23 | - 'fieldsep', // char |
|
| 24 | - 'charset', // string |
|
| 25 | - 'event_owner', // int account_id or -1 for leave untuched |
|
| 26 | - 'owner_joins_event', // bool |
|
| 27 | - 'update_cats', // string {override|add} overides record |
|
| 23 | + 'fieldsep', // char |
|
| 24 | + 'charset', // string |
|
| 25 | + 'event_owner', // int account_id or -1 for leave untuched |
|
| 26 | + 'owner_joins_event', // bool |
|
| 27 | + 'update_cats', // string {override|add} overides record |
|
| 28 | 28 | // with cat(s) from csv OR add the cat from |
| 29 | 29 | // csv file to exeisting cat(s) of record |
| 30 | - 'num_header_lines', // int number of header lines |
|
| 31 | - 'trash_users_records', // trashes all events of events owner before import |
|
| 32 | - 'field_conversion', // array( $csv_col_num => conversion) |
|
| 33 | - 'field_mapping', // array( $csv_col_num => adb_filed) |
|
| 34 | - 'conditions', /* => array containing condition arrays: |
|
| 30 | + 'num_header_lines', // int number of header lines |
|
| 31 | + 'trash_users_records', // trashes all events of events owner before import |
|
| 32 | + 'field_conversion', // array( $csv_col_num => conversion) |
|
| 33 | + 'field_mapping', // array( $csv_col_num => adb_filed) |
|
| 34 | + 'conditions', /* => array containing condition arrays: |
|
| 35 | 35 | 'type' => exists, // record['uid'] exists |
| 36 | 36 | 'true' => array( |
| 37 | 37 | 'action' => update, |
@@ -47,14 +47,14 @@ discard block |
||
| 47 | 47 | /** |
| 48 | 48 | * actions wich could be done to data entries |
| 49 | 49 | */ |
| 50 | - private static $actions = array( 'none', 'update', 'insert', 'delete', ); |
|
| 50 | + private static $actions = array('none', 'update', 'insert', 'delete',); |
|
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | 53 | * conditions for actions |
| 54 | 54 | * |
| 55 | 55 | * @var array |
| 56 | 56 | */ |
| 57 | - private static $conditions = array( 'exists', 'empty', ); |
|
| 57 | + private static $conditions = array('exists', 'empty',); |
|
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | 60 | * @var definition |
@@ -97,8 +97,8 @@ discard block |
||
| 97 | 97 | * @param string $_charset |
| 98 | 98 | * @param definition $_definition |
| 99 | 99 | */ |
| 100 | - public function import( $_stream, definition $_definition ) { |
|
| 101 | - $import_csv = new import_csv( $_stream, array( |
|
| 100 | + public function import($_stream, definition $_definition) { |
|
| 101 | + $import_csv = new import_csv($_stream, array( |
|
| 102 | 102 | 'fieldsep' => $_definition->plugin_options['fieldsep'], |
| 103 | 103 | 'charset' => $_definition->plugin_options['charset'], |
| 104 | 104 | )); |
@@ -106,11 +106,11 @@ discard block |
||
| 106 | 106 | $this->definition = $_definition; |
| 107 | 107 | |
| 108 | 108 | // user, is admin ? |
| 109 | - $this->is_admin = isset( $GLOBALS['egw_info']['user']['apps']['admin'] ) && $GLOBALS['egw_info']['user']['apps']['admin']; |
|
| 109 | + $this->is_admin = isset($GLOBALS['egw_info']['user']['apps']['admin']) && $GLOBALS['egw_info']['user']['apps']['admin']; |
|
| 110 | 110 | $this->user = $GLOBALS['egw_info']['user']['account_id']; |
| 111 | 111 | |
| 112 | 112 | // dry run? |
| 113 | - $this->dry_run = isset( $_definition->plugin_options['dry_run'] ) ? $_definition->plugin_options['dry_run'] : false; |
|
| 113 | + $this->dry_run = isset($_definition->plugin_options['dry_run']) ? $_definition->plugin_options['dry_run'] : false; |
|
| 114 | 114 | |
| 115 | 115 | // fetch the calendar bo |
| 116 | 116 | $this->bocalupdate = new calendar_boupdate(); |
@@ -122,22 +122,22 @@ discard block |
||
| 122 | 122 | $import_csv->conversion = $_definition->plugin_options['field_conversion']; |
| 123 | 123 | |
| 124 | 124 | //check if file has a header lines |
| 125 | - if ( isset( $_definition->plugin_options['num_header_lines'] ) ) { |
|
| 126 | - $import_csv->skip_records( $_definition->plugin_options['num_header_lines'] ); |
|
| 125 | + if (isset($_definition->plugin_options['num_header_lines'])) { |
|
| 126 | + $import_csv->skip_records($_definition->plugin_options['num_header_lines']); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | // set eventOwner |
| 130 | - $_definition->plugin_options['events_owner'] = isset( $_definition->plugin_options['events_owner'] ) ? |
|
| 130 | + $_definition->plugin_options['events_owner'] = isset($_definition->plugin_options['events_owner']) ? |
|
| 131 | 131 | $_definition->plugin_options['events_owner'] : $this->user; |
| 132 | 132 | |
| 133 | 133 | // trash_users_records ? |
| 134 | - if ( $_definition->plugin_options['trash_users_records'] === true ) { |
|
| 135 | - if ( !$_definition->plugin_options['dry_run'] ) { |
|
| 134 | + if ($_definition->plugin_options['trash_users_records'] === true) { |
|
| 135 | + if (!$_definition->plugin_options['dry_run']) { |
|
| 136 | 136 | $socal = new calendar_socal(); |
| 137 | - $this->bocalupdate->so->deleteaccount( $_definition->plugin_options['events_owner']); |
|
| 138 | - unset( $socal ); |
|
| 137 | + $this->bocalupdate->so->deleteaccount($_definition->plugin_options['events_owner']); |
|
| 138 | + unset($socal); |
|
| 139 | 139 | } else { |
| 140 | - $lid = $GLOBALS['egw']->accounts->id2name( $_definition->plugin_options['events_owner'] ); |
|
| 140 | + $lid = $GLOBALS['egw']->accounts->id2name($_definition->plugin_options['events_owner']); |
|
| 141 | 141 | echo "Attension: All Events of '$lid' would be deleted!\n"; |
| 142 | 142 | } |
| 143 | 143 | } |
@@ -145,44 +145,44 @@ discard block |
||
| 145 | 145 | $this->errors = array(); |
| 146 | 146 | $this->results = array(); |
| 147 | 147 | |
| 148 | - while ( $record = $import_csv->get_record() ) { |
|
| 148 | + while ($record = $import_csv->get_record()) { |
|
| 149 | 149 | |
| 150 | 150 | // don't import empty events |
| 151 | - if( count( array_unique( $record ) ) < 2 ) continue; |
|
| 151 | + if (count(array_unique($record)) < 2) continue; |
|
| 152 | 152 | |
| 153 | - if ( $_definition->plugin_options['events_owner'] != -1 ) { |
|
| 153 | + if ($_definition->plugin_options['events_owner'] != -1) { |
|
| 154 | 154 | $record['owner'] = $_definition->plugin_options['events_owner']; |
| 155 | - } else unset( $record['owner'] ); |
|
| 155 | + } else unset($record['owner']); |
|
| 156 | 156 | |
| 157 | - if ( $_definition->plugin_options['conditions'] ) { |
|
| 158 | - foreach ( $_definition->plugin_options['conditions'] as $condition ) { |
|
| 159 | - switch ( $condition['type'] ) { |
|
| 157 | + if ($_definition->plugin_options['conditions']) { |
|
| 158 | + foreach ($_definition->plugin_options['conditions'] as $condition) { |
|
| 159 | + switch ($condition['type']) { |
|
| 160 | 160 | // exists |
| 161 | 161 | case 'exists' : |
| 162 | 162 | |
| 163 | - if ( is_array( $event = $this->bocalupdate->read( $record['uid'], null, $this->is_admin ) ) ) { |
|
| 163 | + if (is_array($event = $this->bocalupdate->read($record['uid'], null, $this->is_admin))) { |
|
| 164 | 164 | // apply action to event matching this exists condition |
| 165 | 165 | $record['id'] = $event['id']; |
| 166 | 166 | |
| 167 | - if ( $_definition->plugin_options['update_cats'] == 'add' ) { |
|
| 168 | - if ( !is_array( $event['cat_id'] ) ) $event['cat_id'] = explode( ',', $event['cat_id'] ); |
|
| 169 | - if ( !is_array( $record['cat_id'] ) ) $record['cat_id'] = explode( ',', $record['cat_id'] ); |
|
| 170 | - $record['cat_id'] = implode( ',', array_unique( array_merge( $record['cat_id'], $event['cat_id'] ) ) ); |
|
| 167 | + if ($_definition->plugin_options['update_cats'] == 'add') { |
|
| 168 | + if (!is_array($event['cat_id'])) $event['cat_id'] = explode(',', $event['cat_id']); |
|
| 169 | + if (!is_array($record['cat_id'])) $record['cat_id'] = explode(',', $record['cat_id']); |
|
| 170 | + $record['cat_id'] = implode(',', array_unique(array_merge($record['cat_id'], $event['cat_id']))); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | // check if entry is modiefied |
| 174 | - $event = array_intersect_key( $event, $record ); |
|
| 175 | - $diff = array_diff( $event, $record ); |
|
| 176 | - if( !empty( $diff ) ) $record['modified'] = time(); |
|
| 174 | + $event = array_intersect_key($event, $record); |
|
| 175 | + $diff = array_diff($event, $record); |
|
| 176 | + if (!empty($diff)) $record['modified'] = time(); |
|
| 177 | 177 | |
| 178 | 178 | $action = $condition['true']; |
| 179 | 179 | } else $action = $condition['false']; |
| 180 | 180 | |
| 181 | - $this->action( $action['action'], $record ); |
|
| 181 | + $this->action($action['action'], $record); |
|
| 182 | 182 | break; |
| 183 | 183 | case 'empty' : |
| 184 | - $action = empty( $record[$condition['string']] ) ? $condition['true'] : $condition['false']; |
|
| 185 | - $this->action( $action['action'], $record ); |
|
| 184 | + $action = empty($record[$condition['string']]) ? $condition['true'] : $condition['false']; |
|
| 185 | + $this->action($action['action'], $record); |
|
| 186 | 186 | break; |
| 187 | 187 | |
| 188 | 188 | // not supported action |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | } |
| 195 | 195 | } else { |
| 196 | 196 | // unconditional insert |
| 197 | - $this->action( 'insert', $record ); |
|
| 197 | + $this->action('insert', $record); |
|
| 198 | 198 | } |
| 199 | 199 | } |
| 200 | 200 | } |
@@ -206,8 +206,8 @@ discard block |
||
| 206 | 206 | * @param array $_data event data for the action |
| 207 | 207 | * @return bool success or not |
| 208 | 208 | */ |
| 209 | - private function action ( $_action, $_data ) { |
|
| 210 | - switch ( $_action ) { |
|
| 209 | + private function action($_action, $_data) { |
|
| 210 | + switch ($_action) { |
|
| 211 | 211 | case 'none' : |
| 212 | 212 | return true; |
| 213 | 213 | |
@@ -215,32 +215,32 @@ discard block |
||
| 215 | 215 | case 'insert' : |
| 216 | 216 | |
| 217 | 217 | // paticipants handling |
| 218 | - $participants = $_data['participants'] ? split( '[,;]', $_data['participants'] ) : array(); |
|
| 218 | + $participants = $_data['participants'] ? split('[,;]', $_data['participants']) : array(); |
|
| 219 | 219 | $_data['participants'] = array(); |
| 220 | - if ( $this->definition->plugin_options['owner_joins_event'] && $this->definition->plugin_options['events_owner'] > 0 ) { |
|
| 220 | + if ($this->definition->plugin_options['owner_joins_event'] && $this->definition->plugin_options['events_owner'] > 0) { |
|
| 221 | 221 | $_data['participants'][$this->definition->plugin_options['events_owner']] = 'A'; |
| 222 | 222 | } |
| 223 | - foreach( $participants as $participant ) { |
|
| 224 | - list( $participant, $status ) = explode( '=', $participant ); |
|
| 225 | - $valid_staties = array('U'=>'U','u'=>'U','A'=>'A','a'=>'A','R'=>'R','r'=>'R','T'=>'T','t'=>'T'); |
|
| 226 | - $status = isset( $valid_staties[$status] ) ? $valid_staties[$status] : 'U'; |
|
| 227 | - if ( $participant && is_numeric($participant ) ) { |
|
| 223 | + foreach ($participants as $participant) { |
|
| 224 | + list($participant, $status) = explode('=', $participant); |
|
| 225 | + $valid_staties = array('U'=>'U', 'u'=>'U', 'A'=>'A', 'a'=>'A', 'R'=>'R', 'r'=>'R', 'T'=>'T', 't'=>'T'); |
|
| 226 | + $status = isset($valid_staties[$status]) ? $valid_staties[$status] : 'U'; |
|
| 227 | + if ($participant && is_numeric($participant)) { |
|
| 228 | 228 | $_data['participants'][$participant] = $status; |
| 229 | 229 | } |
| 230 | 230 | } |
| 231 | 231 | // no valid participants so far --> add the importing user/owner |
| 232 | - if ( empty( $_data['participants'] ) ) { |
|
| 232 | + if (empty($_data['participants'])) { |
|
| 233 | 233 | $_data['participants'][$this->user] = 'A'; |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | // are we serious? |
| 237 | - if ( $this->dry_run ) { |
|
| 237 | + if ($this->dry_run) { |
|
| 238 | 238 | print_r($_data); |
| 239 | 239 | $this->results[$_action]++; |
| 240 | 240 | } else { |
| 241 | 241 | $messages = array(); |
| 242 | - $result = $this->bocalupdate->update( $_data, true, !$_data['modified'], $this->is_admin, true, $messages); |
|
| 243 | - if(!$result) { |
|
| 242 | + $result = $this->bocalupdate->update($_data, true, !$_data['modified'], $this->is_admin, true, $messages); |
|
| 243 | + if (!$result) { |
|
| 244 | 244 | $this->errors = implode(',', $messages); |
| 245 | 245 | } else { |
| 246 | 246 | $this->results[$_action]++; |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | /** |
| 52 | 52 | * Mime type of directories, the old vfs used 'Directory', while eg. WebDAV uses 'httpd/unix-directory' |
| 53 | 53 | */ |
| 54 | - const DIR_MIME_TYPE = Vfs::DIR_MIME_TYPE ; |
|
| 54 | + const DIR_MIME_TYPE = Vfs::DIR_MIME_TYPE; |
|
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | 57 | * mode-bits, which have to be set for files |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | /** |
| 61 | 61 | * mode-bits, which have to be set for directories |
| 62 | 62 | */ |
| 63 | - const MODE_DIR = 040000; |
|
| 63 | + const MODE_DIR = 040000; |
|
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | 66 | * optional context param when opening the stream, null if no context passed |
@@ -123,50 +123,50 @@ discard block |
||
| 123 | 123 | * @param string $opened_path full path of the file/resource, if the open was successfull and STREAM_USE_PATH was set |
| 124 | 124 | * @return boolean true if the ressource was opened successful, otherwise false |
| 125 | 125 | */ |
| 126 | - function stream_open ( $url, $mode, $options, &$opened_path ) |
|
| 126 | + function stream_open($url, $mode, $options, &$opened_path) |
|
| 127 | 127 | { |
| 128 | - unset($opened_path); // not used, but required by interface |
|
| 128 | + unset($opened_path); // not used, but required by interface |
|
| 129 | 129 | |
| 130 | 130 | $this->opened_stream = $this->opened_stream_url = null; |
| 131 | - $read_only = str_replace('b','',$mode) == 'r'; |
|
| 131 | + $read_only = str_replace('b', '', $mode) == 'r'; |
|
| 132 | 132 | |
| 133 | 133 | // check access rights, based on the eGW mount perms |
| 134 | - if (!($stat = self::url_stat($url,0)) || $mode[0] == 'x') // file not found or file should NOT exist |
|
| 134 | + if (!($stat = self::url_stat($url, 0)) || $mode[0] == 'x') // file not found or file should NOT exist |
|
| 135 | 135 | { |
| 136 | 136 | $dir = Vfs::dirname($url); |
| 137 | - if ($mode[0] == 'r' || // does $mode require the file to exist (r,r+) |
|
| 138 | - $mode[0] == 'x' || // or file should not exist, but does |
|
| 139 | - !Vfs::check_access($dir,Vfs::WRITABLE,$dir_stat=self::url_stat($dir,0))) // or we are not allowed to create it |
|
| 137 | + if ($mode[0] == 'r' || // does $mode require the file to exist (r,r+) |
|
| 138 | + $mode[0] == 'x' || // or file should not exist, but does |
|
| 139 | + !Vfs::check_access($dir, Vfs::WRITABLE, $dir_stat = self::url_stat($dir, 0))) // or we are not allowed to create it |
|
| 140 | 140 | { |
| 141 | 141 | if (self::LOG_LEVEL) error_log(__METHOD__."($url,$mode,$options) file does not exist or can not be created!"); |
| 142 | - if (!($options & STREAM_URL_STAT_QUIET)) |
|
| 142 | + if (!($options&STREAM_URL_STAT_QUIET)) |
|
| 143 | 143 | { |
| 144 | - trigger_error(__METHOD__."($url,$mode,$options) file does not exist or can not be created!",E_USER_WARNING); |
|
| 144 | + trigger_error(__METHOD__."($url,$mode,$options) file does not exist or can not be created!", E_USER_WARNING); |
|
| 145 | 145 | } |
| 146 | 146 | return false; |
| 147 | 147 | } |
| 148 | 148 | } |
| 149 | - elseif (!$read_only && !Vfs::check_access($url,Vfs::WRITABLE,$stat)) // we are not allowed to edit it |
|
| 149 | + elseif (!$read_only && !Vfs::check_access($url, Vfs::WRITABLE, $stat)) // we are not allowed to edit it |
|
| 150 | 150 | { |
| 151 | 151 | if (self::LOG_LEVEL) error_log(__METHOD__."($url,$mode,$options) file can not be edited!"); |
| 152 | - if (!($options & STREAM_URL_STAT_QUIET)) |
|
| 152 | + if (!($options&STREAM_URL_STAT_QUIET)) |
|
| 153 | 153 | { |
| 154 | - trigger_error(__METHOD__."($url,$mode,$options) file can not be edited!",E_USER_WARNING); |
|
| 154 | + trigger_error(__METHOD__."($url,$mode,$options) file can not be edited!", E_USER_WARNING); |
|
| 155 | 155 | } |
| 156 | 156 | return false; |
| 157 | 157 | } |
| 158 | 158 | if (!$read_only && self::deny_script($url)) |
| 159 | 159 | { |
| 160 | 160 | if (self::LOG_LEVEL) error_log(__METHOD__."($url,$mode,$options) permission denied, file is a script!"); |
| 161 | - if (!($options & STREAM_URL_STAT_QUIET)) |
|
| 161 | + if (!($options&STREAM_URL_STAT_QUIET)) |
|
| 162 | 162 | { |
| 163 | - trigger_error(__METHOD__."($url,$mode,$options) permission denied, file is a script!",E_USER_WARNING); |
|
| 163 | + trigger_error(__METHOD__."($url,$mode,$options) permission denied, file is a script!", E_USER_WARNING); |
|
| 164 | 164 | } |
| 165 | 165 | return false; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | // open the "real" file |
| 169 | - if (!($this->opened_stream = fopen($path=Vfs::decodePath(Vfs::parse_url($url,PHP_URL_PATH)),$mode,$options))) |
|
| 169 | + if (!($this->opened_stream = fopen($path = Vfs::decodePath(Vfs::parse_url($url, PHP_URL_PATH)), $mode, $options))) |
|
| 170 | 170 | { |
| 171 | 171 | if (self::LOG_LEVEL) error_log(__METHOD__."($url,$mode,$options) fopen('$path','$mode',$options) returned false!"); |
| 172 | 172 | return false; |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | * |
| 182 | 182 | * You must release any resources that were locked or allocated by the stream. |
| 183 | 183 | */ |
| 184 | - function stream_close ( ) |
|
| 184 | + function stream_close( ) |
|
| 185 | 185 | { |
| 186 | 186 | $ret = fclose($this->opened_stream); |
| 187 | 187 | |
@@ -201,9 +201,9 @@ discard block |
||
| 201 | 201 | * @param int $count |
| 202 | 202 | * @return string/false up to count bytes read or false on EOF |
| 203 | 203 | */ |
| 204 | - function stream_read ( $count ) |
|
| 204 | + function stream_read($count) |
|
| 205 | 205 | { |
| 206 | - return fread($this->opened_stream,$count); |
|
| 206 | + return fread($this->opened_stream, $count); |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | /** |
@@ -217,9 +217,9 @@ discard block |
||
| 217 | 217 | * @param string $data |
| 218 | 218 | * @return integer |
| 219 | 219 | */ |
| 220 | - function stream_write ( $data ) |
|
| 220 | + function stream_write($data) |
|
| 221 | 221 | { |
| 222 | - return fwrite($this->opened_stream,$data); |
|
| 222 | + return fwrite($this->opened_stream, $data); |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | /** |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | * |
| 235 | 235 | * @return boolean true if the read/write position is at the end of the stream and no more data availible, false otherwise |
| 236 | 236 | */ |
| 237 | - function stream_eof ( ) |
|
| 237 | + function stream_eof( ) |
|
| 238 | 238 | { |
| 239 | 239 | return feof($this->opened_stream); |
| 240 | 240 | } |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | * |
| 245 | 245 | * @return integer current read/write position of the stream |
| 246 | 246 | */ |
| 247 | - function stream_tell ( ) |
|
| 247 | + function stream_tell( ) |
|
| 248 | 248 | { |
| 249 | 249 | return ftell($this->opened_stream); |
| 250 | 250 | } |
@@ -261,9 +261,9 @@ discard block |
||
| 261 | 261 | * SEEK_END - 2 - Set position to end-of-file plus offset. (To move to a position before the end-of-file, you need to pass a negative value in offset.) |
| 262 | 262 | * @return boolean TRUE if the position was updated, FALSE otherwise. |
| 263 | 263 | */ |
| 264 | - function stream_seek ( $offset, $whence ) |
|
| 264 | + function stream_seek($offset, $whence) |
|
| 265 | 265 | { |
| 266 | - return !fseek($this->opened_stream,$offset,$whence); // fseek returns 0 on success and -1 on failure |
|
| 266 | + return !fseek($this->opened_stream, $offset, $whence); // fseek returns 0 on success and -1 on failure |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | /** |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | * |
| 274 | 274 | * @return booelan TRUE if the cached data was successfully stored (or if there was no data to store), or FALSE if the data could not be stored. |
| 275 | 275 | */ |
| 276 | - function stream_flush ( ) |
|
| 276 | + function stream_flush( ) |
|
| 277 | 277 | { |
| 278 | 278 | return fflush($this->opened_stream); |
| 279 | 279 | } |
@@ -292,9 +292,9 @@ discard block |
||
| 292 | 292 | * |
| 293 | 293 | * @return array containing the same values as appropriate for the stream. |
| 294 | 294 | */ |
| 295 | - function stream_stat ( ) |
|
| 295 | + function stream_stat( ) |
|
| 296 | 296 | { |
| 297 | - return self::url_stat($this->opened_stream_url,0); |
|
| 297 | + return self::url_stat($this->opened_stream_url, 0); |
|
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | /** |
@@ -306,15 +306,15 @@ discard block |
||
| 306 | 306 | * @param string $url |
| 307 | 307 | * @return boolean TRUE on success or FALSE on failure |
| 308 | 308 | */ |
| 309 | - static function unlink ( $url ) |
|
| 309 | + static function unlink($url) |
|
| 310 | 310 | { |
| 311 | - $path = Vfs::decodePath(Vfs::parse_url($url,PHP_URL_PATH)); |
|
| 311 | + $path = Vfs::decodePath(Vfs::parse_url($url, PHP_URL_PATH)); |
|
| 312 | 312 | |
| 313 | 313 | // check access rights (file need to exist and directory need to be writable |
| 314 | - if (!file_exists($path) || is_dir($path) || !Vfs::check_access(Vfs::dirname($url),Vfs::WRITABLE)) |
|
| 314 | + if (!file_exists($path) || is_dir($path) || !Vfs::check_access(Vfs::dirname($url), Vfs::WRITABLE)) |
|
| 315 | 315 | { |
| 316 | 316 | if (self::LOG_LEVEL) error_log(__METHOD__."($url) permission denied!"); |
| 317 | - return false; // no permission or file does not exist |
|
| 317 | + return false; // no permission or file does not exist |
|
| 318 | 318 | } |
| 319 | 319 | return unlink($path); |
| 320 | 320 | } |
@@ -331,22 +331,22 @@ discard block |
||
| 331 | 331 | * @param string $url_to |
| 332 | 332 | * @return boolean TRUE on success or FALSE on failure |
| 333 | 333 | */ |
| 334 | - static function rename ( $url_from, $url_to ) |
|
| 334 | + static function rename($url_from, $url_to) |
|
| 335 | 335 | { |
| 336 | 336 | $from = Vfs::parse_url($url_from); |
| 337 | 337 | $to = Vfs::parse_url($url_to); |
| 338 | 338 | |
| 339 | 339 | // check access rights |
| 340 | - if (!($from_stat = self::url_stat($url_from,0)) || !Vfs::check_access(Vfs::dirname($url_from),Vfs::WRITABLE)) |
|
| 340 | + if (!($from_stat = self::url_stat($url_from, 0)) || !Vfs::check_access(Vfs::dirname($url_from), Vfs::WRITABLE)) |
|
| 341 | 341 | { |
| 342 | 342 | if (self::LOG_LEVEL) error_log(__METHOD__."($url_from,$url_to): $from[path] permission denied!"); |
| 343 | - return false; // no permission or file does not exist |
|
| 343 | + return false; // no permission or file does not exist |
|
| 344 | 344 | } |
| 345 | 345 | $to_dir = Vfs::dirname($url_to); |
| 346 | - if (!Vfs::check_access($to_dir,Vfs::WRITABLE,$to_dir_stat = self::url_stat($to_dir,0))) |
|
| 346 | + if (!Vfs::check_access($to_dir, Vfs::WRITABLE, $to_dir_stat = self::url_stat($to_dir, 0))) |
|
| 347 | 347 | { |
| 348 | 348 | if (self::LOG_LEVEL) error_log(__METHOD__."($url_from,$url_to): $to_dir permission denied!"); |
| 349 | - return false; // no permission or parent-dir does not exist |
|
| 349 | + return false; // no permission or parent-dir does not exist |
|
| 350 | 350 | } |
| 351 | 351 | if (self::deny_script($url_to)) |
| 352 | 352 | { |
@@ -355,12 +355,12 @@ discard block |
||
| 355 | 355 | } |
| 356 | 356 | // the filesystem stream-wrapper does NOT allow to rename files to directories, as this makes problems |
| 357 | 357 | // for our vfs too, we abort here with an error, like the filesystem one does |
| 358 | - if (($to_stat = self::url_stat($to['path'],0)) && |
|
| 358 | + if (($to_stat = self::url_stat($to['path'], 0)) && |
|
| 359 | 359 | ($to_stat['mime'] === self::DIR_MIME_TYPE) !== ($from_stat['mime'] === self::DIR_MIME_TYPE)) |
| 360 | 360 | { |
| 361 | 361 | $is_dir = $to_stat['mime'] === self::DIR_MIME_TYPE ? 'a' : 'no'; |
| 362 | 362 | if (self::LOG_LEVEL) error_log(__METHOD__."($url_to,$url_from) $to[path] is $is_dir directory!"); |
| 363 | - return false; // no permission or file does not exist |
|
| 363 | + return false; // no permission or file does not exist |
|
| 364 | 364 | } |
| 365 | 365 | // if destination file already exists, delete it |
| 366 | 366 | if ($to_stat && !self::unlink($url_to)) |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | if (self::LOG_LEVEL) error_log(__METHOD__."($url_to,$url_from) can't unlink existing $url_to!"); |
| 369 | 369 | return false; |
| 370 | 370 | } |
| 371 | - return rename(Vfs::decodePath($from['path']),Vfs::decodePath($to['path'])); |
|
| 371 | + return rename(Vfs::decodePath($from['path']), Vfs::decodePath($to['path'])); |
|
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | /** |
@@ -382,12 +382,12 @@ discard block |
||
| 382 | 382 | * @param int $options Posible values include STREAM_REPORT_ERRORS and STREAM_MKDIR_RECURSIVE |
| 383 | 383 | * @return boolean TRUE on success or FALSE on failure |
| 384 | 384 | */ |
| 385 | - static function mkdir ( $url, $mode, $options ) |
|
| 385 | + static function mkdir($url, $mode, $options) |
|
| 386 | 386 | { |
| 387 | - unset($mode); // not used, but required by interface |
|
| 387 | + unset($mode); // not used, but required by interface |
|
| 388 | 388 | |
| 389 | - $path = Vfs::decodePath(Vfs::parse_url($url,PHP_URL_PATH)); |
|
| 390 | - $recursive = (bool)($options & STREAM_MKDIR_RECURSIVE); |
|
| 389 | + $path = Vfs::decodePath(Vfs::parse_url($url, PHP_URL_PATH)); |
|
| 390 | + $recursive = (bool)($options&STREAM_MKDIR_RECURSIVE); |
|
| 391 | 391 | |
| 392 | 392 | // find the real parent (might be more then one level if $recursive!) |
| 393 | 393 | do { |
@@ -398,12 +398,12 @@ discard block |
||
| 398 | 398 | //echo __METHOD__."($url,$mode,$options) path=$path, recursive=$recursive, parent=$parent, Vfs::check_access(parent_url=$parent_url,Vfs::WRITABLE)=".(int)Vfs::check_access($parent_url,Vfs::WRITABLE)."\n"; |
| 399 | 399 | |
| 400 | 400 | // check access rights (in real filesystem AND by mount perms) |
| 401 | - if (file_exists($path) || !file_exists($parent) || !is_writable($parent) || !Vfs::check_access($parent_url,Vfs::WRITABLE)) |
|
| 401 | + if (file_exists($path) || !file_exists($parent) || !is_writable($parent) || !Vfs::check_access($parent_url, Vfs::WRITABLE)) |
|
| 402 | 402 | { |
| 403 | 403 | if (self::LOG_LEVEL) error_log(__METHOD__."($url) permission denied!"); |
| 404 | 404 | return false; |
| 405 | 405 | } |
| 406 | - return mkdir($path, 0700, $recursive); // setting mode 0700 allows (only) apache to write into the dir |
|
| 406 | + return mkdir($path, 0700, $recursive); // setting mode 0700 allows (only) apache to write into the dir |
|
| 407 | 407 | } |
| 408 | 408 | |
| 409 | 409 | /** |
@@ -416,15 +416,15 @@ discard block |
||
| 416 | 416 | * @param int $options Possible values include STREAM_REPORT_ERRORS. |
| 417 | 417 | * @return boolean TRUE on success or FALSE on failure. |
| 418 | 418 | */ |
| 419 | - static function rmdir ( $url, $options ) |
|
| 419 | + static function rmdir($url, $options) |
|
| 420 | 420 | { |
| 421 | - unset($options); // not used, but required by interface |
|
| 421 | + unset($options); // not used, but required by interface |
|
| 422 | 422 | |
| 423 | - $path = Vfs::decodePath(Vfs::parse_url($url,PHP_URL_PATH)); |
|
| 423 | + $path = Vfs::decodePath(Vfs::parse_url($url, PHP_URL_PATH)); |
|
| 424 | 424 | $parent = dirname($path); |
| 425 | 425 | |
| 426 | 426 | // check access rights (in real filesystem AND by mount perms) |
| 427 | - if (!file_exists($path) || !is_writable($parent) || !Vfs::check_access(Vfs::dirname($url),Vfs::WRITABLE)) |
|
| 427 | + if (!file_exists($path) || !is_writable($parent) || !Vfs::check_access(Vfs::dirname($url), Vfs::WRITABLE)) |
|
| 428 | 428 | { |
| 429 | 429 | if (self::LOG_LEVEL) error_log(__METHOD__."($url) permission denied!"); |
| 430 | 430 | return false; |
@@ -440,18 +440,18 @@ discard block |
||
| 440 | 440 | * @param int $atime =null access time (unix timestamp), default null = current time, not implemented in the vfs! |
| 441 | 441 | * @return boolean true on success, false otherwise |
| 442 | 442 | */ |
| 443 | - static function touch($url,$time=null,$atime=null) |
|
| 443 | + static function touch($url, $time = null, $atime = null) |
|
| 444 | 444 | { |
| 445 | - $path = Vfs::decodePath(Vfs::parse_url($url,PHP_URL_PATH)); |
|
| 445 | + $path = Vfs::decodePath(Vfs::parse_url($url, PHP_URL_PATH)); |
|
| 446 | 446 | $parent = dirname($path); |
| 447 | 447 | |
| 448 | 448 | // check access rights (in real filesystem AND by mount perms) |
| 449 | - if (!file_exists($path) || !is_writable($parent) || !Vfs::check_access(Vfs::dirname($url),Vfs::WRITABLE)) |
|
| 449 | + if (!file_exists($path) || !is_writable($parent) || !Vfs::check_access(Vfs::dirname($url), Vfs::WRITABLE)) |
|
| 450 | 450 | { |
| 451 | 451 | if (self::LOG_LEVEL) error_log(__METHOD__."($url) permission denied!"); |
| 452 | 452 | return false; |
| 453 | 453 | } |
| 454 | - return touch($path,$time,$atime); |
|
| 454 | + return touch($path, $time, $atime); |
|
| 455 | 455 | } |
| 456 | 456 | |
| 457 | 457 | /** |
@@ -463,9 +463,9 @@ discard block |
||
| 463 | 463 | * @param string $mode mode string see Vfs::mode2int |
| 464 | 464 | * @return boolean true on success, false otherwise |
| 465 | 465 | */ |
| 466 | - static function chmod($path,$mode) |
|
| 466 | + static function chmod($path, $mode) |
|
| 467 | 467 | { |
| 468 | - unset($path, $mode); // not used, but required by interface |
|
| 468 | + unset($path, $mode); // not used, but required by interface |
|
| 469 | 469 | |
| 470 | 470 | return false; |
| 471 | 471 | } |
@@ -479,9 +479,9 @@ discard block |
||
| 479 | 479 | * @param int $owner numeric user id |
| 480 | 480 | * @return boolean true on success, false otherwise |
| 481 | 481 | */ |
| 482 | - static function chown($path,$owner) |
|
| 482 | + static function chown($path, $owner) |
|
| 483 | 483 | { |
| 484 | - unset($path, $owner); // not used, but required by interface |
|
| 484 | + unset($path, $owner); // not used, but required by interface |
|
| 485 | 485 | |
| 486 | 486 | return false; |
| 487 | 487 | } |
@@ -495,9 +495,9 @@ discard block |
||
| 495 | 495 | * @param int $group numeric group id |
| 496 | 496 | * @return boolean true on success, false otherwise |
| 497 | 497 | */ |
| 498 | - static function chgrp($path,$group) |
|
| 498 | + static function chgrp($path, $group) |
|
| 499 | 499 | { |
| 500 | - unset($path, $group); // not used, but required by interface |
|
| 500 | + unset($path, $group); // not used, but required by interface |
|
| 501 | 501 | |
| 502 | 502 | return false; |
| 503 | 503 | } |
@@ -509,13 +509,13 @@ discard block |
||
| 509 | 509 | * @param int $options |
| 510 | 510 | * @return booelan |
| 511 | 511 | */ |
| 512 | - function dir_opendir ( $url, $options ) |
|
| 512 | + function dir_opendir($url, $options) |
|
| 513 | 513 | { |
| 514 | 514 | if (self::LOG_LEVEL > 1) error_log(__METHOD__."($url,$options)"); |
| 515 | 515 | |
| 516 | 516 | $this->opened_dir = null; |
| 517 | 517 | |
| 518 | - $path = Vfs::decodePath(Vfs::parse_url($this->opened_dir_url = $url,PHP_URL_PATH)); |
|
| 518 | + $path = Vfs::decodePath(Vfs::parse_url($this->opened_dir_url = $url, PHP_URL_PATH)); |
|
| 519 | 519 | |
| 520 | 520 | // ToDo: check access rights |
| 521 | 521 | |
@@ -553,31 +553,31 @@ discard block |
||
| 553 | 553 | * stat triggers it's own warning anyway, so it makes no sense to trigger one by our stream-wrapper! |
| 554 | 554 | * @return array |
| 555 | 555 | */ |
| 556 | - static function url_stat ( $url, $flags ) |
|
| 556 | + static function url_stat($url, $flags) |
|
| 557 | 557 | { |
| 558 | 558 | $parts = Vfs::parse_url($url); |
| 559 | 559 | $path = Vfs::decodePath($parts['path']); |
| 560 | 560 | |
| 561 | - $stat = @stat($path); // suppressed the stat failed warnings |
|
| 561 | + $stat = @stat($path); // suppressed the stat failed warnings |
|
| 562 | 562 | |
| 563 | 563 | if ($stat) |
| 564 | 564 | { |
| 565 | 565 | // set owner, group and mode from mount options |
| 566 | 566 | $uid = $gid = $mode = null; |
| 567 | - if (!self::parse_query($parts['query'],$uid,$gid,$mode)) |
|
| 567 | + if (!self::parse_query($parts['query'], $uid, $gid, $mode)) |
|
| 568 | 568 | { |
| 569 | 569 | return false; |
| 570 | 570 | } |
| 571 | 571 | $stat['uid'] = $stat[4] = $uid; |
| 572 | 572 | $stat['gid'] = $stat[5] = $gid; |
| 573 | - $stat['mode'] = $stat[2] = $stat['mode'] & self::MODE_DIR ? self::MODE_DIR | $mode : self::MODE_FILE | ($mode & ~0111); |
|
| 573 | + $stat['mode'] = $stat[2] = $stat['mode']&self::MODE_DIR ? self::MODE_DIR|$mode : self::MODE_FILE|($mode&~0111); |
|
| 574 | 574 | // write rights also depend on the write rights of the webserver |
| 575 | 575 | if (!is_writable($path)) |
| 576 | 576 | { |
| 577 | - $stat['mode'] = $stat[2] = $stat['mode'] & ~0222; |
|
| 577 | + $stat['mode'] = $stat[2] = $stat['mode']&~0222; |
|
| 578 | 578 | } |
| 579 | 579 | } |
| 580 | - if (self::LOG_LEVEL > 1) error_log(__METHOD__."($url,$flags) path=$path, mount_mode=".sprintf('0%o',$mode).", mode=".sprintf('0%o',$stat['mode']).'='.Vfs::int2mode($stat['mode'])); |
|
| 580 | + if (self::LOG_LEVEL > 1) error_log(__METHOD__."($url,$flags) path=$path, mount_mode=".sprintf('0%o', $mode).", mode=".sprintf('0%o', $stat['mode']).'='.Vfs::int2mode($stat['mode'])); |
|
| 581 | 581 | return $stat; |
| 582 | 582 | } |
| 583 | 583 | |
@@ -591,13 +591,13 @@ discard block |
||
| 591 | 591 | * |
| 592 | 592 | * @return string |
| 593 | 593 | */ |
| 594 | - function dir_readdir ( ) |
|
| 594 | + function dir_readdir( ) |
|
| 595 | 595 | { |
| 596 | 596 | do { |
| 597 | 597 | $file = readdir($this->opened_dir); |
| 598 | 598 | |
| 599 | - $ignore = !($file === false || // stop if no more dirs or |
|
| 600 | - ($file != '.' && $file != '..' )); // file not . or .. |
|
| 599 | + $ignore = !($file === false || // stop if no more dirs or |
|
| 600 | + ($file != '.' && $file != '..')); // file not . or .. |
|
| 601 | 601 | if (self::LOG_LEVEL > 1 && $ignore) error_log(__METHOD__.'() ignoring '.array2string($file)); |
| 602 | 602 | } |
| 603 | 603 | while ($ignore); |
@@ -618,7 +618,7 @@ discard block |
||
| 618 | 618 | * |
| 619 | 619 | * @return boolean |
| 620 | 620 | */ |
| 621 | - function dir_rewinddir ( ) |
|
| 621 | + function dir_rewinddir( ) |
|
| 622 | 622 | { |
| 623 | 623 | return rewinddir($this->opened_dir); |
| 624 | 624 | } |
@@ -630,7 +630,7 @@ discard block |
||
| 630 | 630 | * |
| 631 | 631 | * @return boolean |
| 632 | 632 | */ |
| 633 | - function dir_closedir ( ) |
|
| 633 | + function dir_closedir( ) |
|
| 634 | 634 | { |
| 635 | 635 | closedir($this->opened_dir); |
| 636 | 636 | |
@@ -648,18 +648,18 @@ discard block |
||
| 648 | 648 | * @param int &$mode default if not set is 05 r-x for others |
| 649 | 649 | * @return boolean true on successfull parse, false on error |
| 650 | 650 | */ |
| 651 | - static function parse_query($query,&$uid,&$gid,&$mode) |
|
| 651 | + static function parse_query($query, &$uid, &$gid, &$mode) |
|
| 652 | 652 | { |
| 653 | 653 | $params = null; |
| 654 | - parse_str(is_array($query) ? $query['query'] : $query,$params); |
|
| 654 | + parse_str(is_array($query) ? $query['query'] : $query, $params); |
|
| 655 | 655 | |
| 656 | 656 | // setting the default perms root.root r-x for other |
| 657 | 657 | $uid = $gid = 0; |
| 658 | 658 | $mode = 05; |
| 659 | 659 | |
| 660 | - foreach($params as $name => $value) |
|
| 660 | + foreach ($params as $name => $value) |
|
| 661 | 661 | { |
| 662 | - switch($name) |
|
| 662 | + switch ($name) |
|
| 663 | 663 | { |
| 664 | 664 | case 'user': |
| 665 | 665 | if (!is_numeric($value)) |
@@ -668,10 +668,10 @@ discard block |
||
| 668 | 668 | { |
| 669 | 669 | $value = 0; |
| 670 | 670 | } |
| 671 | - elseif (($value = $GLOBALS['egw']->accounts->name2id($value,'account_lid','u')) === false) |
|
| 671 | + elseif (($value = $GLOBALS['egw']->accounts->name2id($value, 'account_lid', 'u')) === false) |
|
| 672 | 672 | { |
| 673 | 673 | error_log(__METHOD__."('$query') unknown user-name '$value'!"); |
| 674 | - return false; // wrong user-name |
|
| 674 | + return false; // wrong user-name |
|
| 675 | 675 | } |
| 676 | 676 | } |
| 677 | 677 | // fall-through |
@@ -690,12 +690,12 @@ discard block |
||
| 690 | 690 | { |
| 691 | 691 | $value = 0; |
| 692 | 692 | } |
| 693 | - elseif (($value = $GLOBALS['egw']->accounts->name2id($value,'account_lid','g')) === false) |
|
| 693 | + elseif (($value = $GLOBALS['egw']->accounts->name2id($value, 'account_lid', 'g')) === false) |
|
| 694 | 694 | { |
| 695 | 695 | error_log(__METHOD__."('$query') unknown group-name '$value'!"); |
| 696 | - return false; // wrong group-name |
|
| 696 | + return false; // wrong group-name |
|
| 697 | 697 | } |
| 698 | - $value = -$value; // vfs uses positiv gid's! |
|
| 698 | + $value = -$value; // vfs uses positiv gid's! |
|
| 699 | 699 | } |
| 700 | 700 | // fall-through |
| 701 | 701 | case 'gid': |
@@ -731,9 +731,9 @@ discard block |
||
| 731 | 731 | { |
| 732 | 732 | $parts = Vfs::parse_url($url); |
| 733 | 733 | $get = null; |
| 734 | - parse_str($parts['query'],$get); |
|
| 734 | + parse_str($parts['query'], $get); |
|
| 735 | 735 | |
| 736 | - $deny = !$get['exec'] && preg_match(self::SCRIPT_EXTENSIONS_PREG,$parts['path']); |
|
| 736 | + $deny = !$get['exec'] && preg_match(self::SCRIPT_EXTENSIONS_PREG, $parts['path']); |
|
| 737 | 737 | |
| 738 | 738 | if (self::LOG_LEVEL > 1 || self::LOG_LEVEL > 0 && $deny) |
| 739 | 739 | { |
@@ -753,21 +753,21 @@ discard block |
||
| 753 | 753 | * @todo get $force_download working through webdav |
| 754 | 754 | * @return string|false string with full download url or false to use default webdav.php url |
| 755 | 755 | */ |
| 756 | - static function download_url($_url,$force_download=false) |
|
| 756 | + static function download_url($_url, $force_download = false) |
|
| 757 | 757 | { |
| 758 | - unset($force_download); // not used, but required by interface |
|
| 758 | + unset($force_download); // not used, but required by interface |
|
| 759 | 759 | |
| 760 | - list($url,$query) = explode('?',$_url,2); |
|
| 760 | + list($url, $query) = explode('?', $_url, 2); |
|
| 761 | 761 | $get = null; |
| 762 | - parse_str($query,$get); |
|
| 763 | - if (empty($get['url'])) return false; // no download url given for this mount-point |
|
| 762 | + parse_str($query, $get); |
|
| 763 | + if (empty($get['url'])) return false; // no download url given for this mount-point |
|
| 764 | 764 | |
| 765 | - if (!($mount_url = Vfs::mount_url($_url))) return false; // no mount url found, should not happen |
|
| 766 | - list($mount_url) = explode('?',$mount_url); |
|
| 765 | + if (!($mount_url = Vfs::mount_url($_url))) return false; // no mount url found, should not happen |
|
| 766 | + list($mount_url) = explode('?', $mount_url); |
|
| 767 | 767 | |
| 768 | - $relpath = substr($url,strlen($mount_url)); |
|
| 768 | + $relpath = substr($url, strlen($mount_url)); |
|
| 769 | 769 | |
| 770 | - $download_url = Vfs::concat($get['url'],$relpath); |
|
| 770 | + $download_url = Vfs::concat($get['url'], $relpath); |
|
| 771 | 771 | if ($download_url[0] == '/') |
| 772 | 772 | { |
| 773 | 773 | $download_url = ($_SERVER['HTTPS'] ? 'https://' : 'http://'). |