@@ -29,9 +29,9 @@ discard block |
||
| 29 | 29 | * @param string $passwd_type ='text' 'text' for cleartext passwords (default) |
| 30 | 30 | * @return boolean true if successful authenticated, false otherwise |
| 31 | 31 | */ |
| 32 | - function authenticate($username, $passwd, $passwd_type='text') |
|
| 32 | + function authenticate($username, $passwd, $passwd_type = 'text') |
|
| 33 | 33 | { |
| 34 | - unset($passwd, $passwd_type); // not used, but required by interface |
|
| 34 | + unset($passwd, $passwd_type); // not used, but required by interface |
|
| 35 | 35 | |
| 36 | 36 | return isset($_SERVER['PHP_AUTH_USER']) && $_SERVER['PHP_AUTH_USER'] === $username; |
| 37 | 37 | } |
@@ -44,9 +44,9 @@ discard block |
||
| 44 | 44 | * @param int $account_id account id of user whose passwd should be changed |
| 45 | 45 | * @return boolean true if password successful changed, false otherwise |
| 46 | 46 | */ |
| 47 | - function change_password($old_passwd, $new_passwd, $account_id=0) |
|
| 47 | + function change_password($old_passwd, $new_passwd, $account_id = 0) |
|
| 48 | 48 | { |
| 49 | - unset($old_passwd, $new_passwd, $account_id); // not used, but required by interface |
|
| 49 | + unset($old_passwd, $new_passwd, $account_id); // not used, but required by interface |
|
| 50 | 50 | |
| 51 | 51 | return False; |
| 52 | 52 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * @param string $primary ='ldap' |
| 42 | 42 | * @param string $fallback ='sql' |
| 43 | 43 | */ |
| 44 | - function __construct($primary='ldap',$fallback='sql') |
|
| 44 | + function __construct($primary = 'ldap', $fallback = 'sql') |
|
| 45 | 45 | { |
| 46 | 46 | $this->primary_backend = Api\Auth::backend(str_replace('auth_', '', $primary)); |
| 47 | 47 | |
@@ -55,26 +55,26 @@ discard block |
||
| 55 | 55 | * @param string $passwd corresponding password |
| 56 | 56 | * @return boolean true if successful authenticated, false otherwise |
| 57 | 57 | */ |
| 58 | - function authenticate($username, $passwd, $passwd_type='text') |
|
| 58 | + function authenticate($username, $passwd, $passwd_type = 'text') |
|
| 59 | 59 | { |
| 60 | 60 | if ($this->primary_backend->authenticate($username, $passwd, $passwd_type)) |
| 61 | 61 | { |
| 62 | - Api\Cache::setInstance(__CLASS__,'backend_used-'.$username,'primary'); |
|
| 62 | + Api\Cache::setInstance(__CLASS__, 'backend_used-'.$username, 'primary'); |
|
| 63 | 63 | // check if fallback has correct password, if not update it |
| 64 | 64 | if (($account_id = $GLOBALS['egw']->accounts->name2id($username)) && |
| 65 | - !$this->fallback_backend->authenticate($username,$passwd, $passwd_type)) |
|
| 65 | + !$this->fallback_backend->authenticate($username, $passwd, $passwd_type)) |
|
| 66 | 66 | { |
| 67 | 67 | $backup_currentapp = $GLOBALS['egw_info']['flags']['currentapp']; |
| 68 | - $GLOBALS['egw_info']['flags']['currentapp'] = 'admin'; // otherwise |
|
| 68 | + $GLOBALS['egw_info']['flags']['currentapp'] = 'admin'; // otherwise |
|
| 69 | 69 | $this->fallback_backend->change_password('', $passwd, $account_id); |
| 70 | 70 | $GLOBALS['egw_info']['flags']['currentapp'] = $backup_currentapp; |
| 71 | 71 | //error_log(__METHOD__."('$username', \$passwd) updated password for #$account_id on fallback ".($ret ? 'successfull' : 'failed!')); |
| 72 | 72 | } |
| 73 | 73 | return true; |
| 74 | 74 | } |
| 75 | - if ($this->fallback_backend->authenticate($username,$passwd, $passwd_type)) |
|
| 75 | + if ($this->fallback_backend->authenticate($username, $passwd, $passwd_type)) |
|
| 76 | 76 | { |
| 77 | - Api\Cache::setInstance(__CLASS__,'backend_used-'.$username,'fallback'); |
|
| 77 | + Api\Cache::setInstance(__CLASS__, 'backend_used-'.$username, 'fallback'); |
|
| 78 | 78 | return true; |
| 79 | 79 | } |
| 80 | 80 | return false; |
@@ -91,9 +91,9 @@ discard block |
||
| 91 | 91 | * @param int $account_id account id of user whose passwd should be changed |
| 92 | 92 | * @return boolean true if password successful changed, false otherwise |
| 93 | 93 | */ |
| 94 | - function change_password($old_passwd, $new_passwd, $account_id=0) |
|
| 94 | + function change_password($old_passwd, $new_passwd, $account_id = 0) |
|
| 95 | 95 | { |
| 96 | - if(!$account_id) |
|
| 96 | + if (!$account_id) |
|
| 97 | 97 | { |
| 98 | 98 | $account_id = $GLOBALS['egw_info']['user']['account_id']; |
| 99 | 99 | $username = $GLOBALS['egw_info']['user']['account_lid']; |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | { |
| 103 | 103 | $username = $GLOBALS['egw']->accounts->id2name($account_id); |
| 104 | 104 | } |
| 105 | - if (Api\Cache::getInstance(__CLASS__,'backend_used-'.$username) == 'primary') |
|
| 105 | + if (Api\Cache::getInstance(__CLASS__, 'backend_used-'.$username) == 'primary') |
|
| 106 | 106 | { |
| 107 | 107 | if (($ret = $this->primary_backend->change_password($old_passwd, $new_passwd, $account_id))) |
| 108 | 108 | { |
@@ -126,14 +126,14 @@ discard block |
||
| 126 | 126 | */ |
| 127 | 127 | function getLastPwdChange($username) |
| 128 | 128 | { |
| 129 | - if (Api\Cache::getInstance(__CLASS__,'backend_used-'.$username) == 'primary') |
|
| 129 | + if (Api\Cache::getInstance(__CLASS__, 'backend_used-'.$username) == 'primary') |
|
| 130 | 130 | { |
| 131 | - if (method_exists($this->primary_backend,'getLastPwdChange')) |
|
| 131 | + if (method_exists($this->primary_backend, 'getLastPwdChange')) |
|
| 132 | 132 | { |
| 133 | 133 | return $this->primary_backend->getLastPwdChange($username); |
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | - if (method_exists($this->fallback_backend,'getLastPwdChange')) |
|
| 136 | + if (method_exists($this->fallback_backend, 'getLastPwdChange')) |
|
| 137 | 137 | { |
| 138 | 138 | return $this->fallback_backend->getLastPwdChange($username); |
| 139 | 139 | } |
@@ -148,9 +148,9 @@ discard block |
||
| 148 | 148 | * @param int $lastpwdchange must be a unixtimestamp |
| 149 | 149 | * @return boolean true if account_lastpwd_change successful changed, false otherwise |
| 150 | 150 | */ |
| 151 | - function setLastPwdChange($account_id=0, $passwd=NULL, $lastpwdchange=NULL) |
|
| 151 | + function setLastPwdChange($account_id = 0, $passwd = NULL, $lastpwdchange = NULL) |
|
| 152 | 152 | { |
| 153 | - if(!$account_id || $GLOBALS['egw_info']['flags']['currentapp'] == 'login') |
|
| 153 | + if (!$account_id || $GLOBALS['egw_info']['flags']['currentapp'] == 'login') |
|
| 154 | 154 | { |
| 155 | 155 | $account_id = $GLOBALS['egw_info']['user']['account_id']; |
| 156 | 156 | $username = $GLOBALS['egw_info']['user']['account_lid']; |
@@ -159,14 +159,14 @@ discard block |
||
| 159 | 159 | { |
| 160 | 160 | $username = $GLOBALS['egw']->accounts->id2name($account_id); |
| 161 | 161 | } |
| 162 | - if (Api\Cache::getInstance(__CLASS__,'backend_used-'.$username) == 'primary') |
|
| 162 | + if (Api\Cache::getInstance(__CLASS__, 'backend_used-'.$username) == 'primary') |
|
| 163 | 163 | { |
| 164 | - if (method_exists($this->primary_backend,'setLastPwdChange')) |
|
| 164 | + if (method_exists($this->primary_backend, 'setLastPwdChange')) |
|
| 165 | 165 | { |
| 166 | 166 | return $this->primary_backend->setLastPwdChange($username); |
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | - if (method_exists($this->fallback_backend,'setLastPwdChange')) |
|
| 169 | + if (method_exists($this->fallback_backend, 'setLastPwdChange')) |
|
| 170 | 170 | { |
| 171 | 171 | return $this->fallback_backend->setLastPwdChange($account_id, $passwd, $lastpwdchange); |
| 172 | 172 | } |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | { |
| 47 | 47 | if (!function_exists('apcu_fetch')) // apc >= 3.0 |
| 48 | 48 | { |
| 49 | - throw new Exception (__METHOD__.'('.array2string($params).") No function apcu_fetch()!"); |
|
| 49 | + throw new Exception(__METHOD__.'('.array2string($params).") No function apcu_fetch()!"); |
|
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | { |
| 66 | 66 | $size = ini_get('apc.shm_size'); |
| 67 | 67 | |
| 68 | - switch(strtoupper(substr($size, -1))) |
|
| 68 | + switch (strtoupper(substr($size, -1))) |
|
| 69 | 69 | { |
| 70 | 70 | case 'G': |
| 71 | 71 | $size *= 1024; |
@@ -91,9 +91,9 @@ discard block |
||
| 91 | 91 | * @param int $expiration =0 |
| 92 | 92 | * @return boolean true on success, false on error, incl. key already exists in cache |
| 93 | 93 | */ |
| 94 | - function add(array $keys,$data,$expiration=0) |
|
| 94 | + function add(array $keys, $data, $expiration = 0) |
|
| 95 | 95 | { |
| 96 | - return apcu_add(self::key($keys),$data,$expiration); |
|
| 96 | + return apcu_add(self::key($keys), $data, $expiration); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /** |
@@ -104,9 +104,9 @@ discard block |
||
| 104 | 104 | * @param int $expiration =0 |
| 105 | 105 | * @return boolean true on success, false on error |
| 106 | 106 | */ |
| 107 | - function set(array $keys,$data,$expiration=0) |
|
| 107 | + function set(array $keys, $data, $expiration = 0) |
|
| 108 | 108 | { |
| 109 | - return apcu_store(self::key($keys),$data,$expiration); |
|
| 109 | + return apcu_store(self::key($keys), $data, $expiration); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | /** |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | function get(array $keys) |
| 119 | 119 | { |
| 120 | 120 | $success = null; |
| 121 | - $data = apcu_fetch($key=self::key($keys),$success); |
|
| 121 | + $data = apcu_fetch($key = self::key($keys), $success); |
|
| 122 | 122 | |
| 123 | 123 | if (!$success) |
| 124 | 124 | { |
@@ -160,12 +160,12 @@ discard block |
||
| 160 | 160 | // APCu > 5 has APCUIterator |
| 161 | 161 | if (class_exists('APCUIterator')) |
| 162 | 162 | { |
| 163 | - $iterator = new \APCUIterator($preg='/^'.preg_quote(self::key($keys).'/')); |
|
| 163 | + $iterator = new \APCUIterator($preg = '/^'.preg_quote(self::key($keys).'/')); |
|
| 164 | 164 | } |
| 165 | 165 | // APC >= 3.1.1, but also seems to be missing if apc is disabled eg. for cli |
| 166 | - elseif(class_exists('APCIterator')) |
|
| 166 | + elseif (class_exists('APCIterator')) |
|
| 167 | 167 | { |
| 168 | - $iterator = new \APCIterator('user', $preg='/^'.preg_quote(self::key($keys).'/')); |
|
| 168 | + $iterator = new \APCIterator('user', $preg = '/^'.preg_quote(self::key($keys).'/')); |
|
| 169 | 169 | } |
| 170 | 170 | else |
| 171 | 171 | { |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | return false; |
| 175 | 175 | } |
| 176 | - foreach($iterator as $item) |
|
| 176 | + foreach ($iterator as $item) |
|
| 177 | 177 | { |
| 178 | 178 | //error_log(__METHOD__."(".array2string($keys).") preg='$preg': calling apcu_delete('$item[key]')"); |
| 179 | 179 | apcu_delete($item['key']); |
@@ -189,6 +189,6 @@ discard block |
||
| 189 | 189 | */ |
| 190 | 190 | private static function key(array $keys) |
| 191 | 191 | { |
| 192 | - return implode('::',$keys); |
|
| 192 | + return implode('::', $keys); |
|
| 193 | 193 | } |
| 194 | 194 | } |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | { |
| 47 | 47 | if (!function_exists('apc_fetch')) // apc >= 3.0 |
| 48 | 48 | { |
| 49 | - throw new Exception (__METHOD__.'('.array2string($params).") No function apc_fetch()!"); |
|
| 49 | + throw new Exception(__METHOD__.'('.array2string($params).") No function apc_fetch()!"); |
|
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | // ancent APC (3.1.3) in Debian 6/Squezze has size in MB without a unit |
| 67 | 67 | if (is_numeric($size) && $size <= 1048576) $size .= 'M'; |
| 68 | 68 | |
| 69 | - switch(strtoupper(substr($size, -1))) |
|
| 69 | + switch (strtoupper(substr($size, -1))) |
|
| 70 | 70 | { |
| 71 | 71 | case 'G': |
| 72 | 72 | $size *= 1024; |
@@ -92,9 +92,9 @@ discard block |
||
| 92 | 92 | * @param int $expiration =0 |
| 93 | 93 | * @return boolean true on success, false on error, incl. key already exists in cache |
| 94 | 94 | */ |
| 95 | - function add(array $keys,$data,$expiration=0) |
|
| 95 | + function add(array $keys, $data, $expiration = 0) |
|
| 96 | 96 | { |
| 97 | - return apc_add(self::key($keys),$data,$expiration); |
|
| 97 | + return apc_add(self::key($keys), $data, $expiration); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
@@ -105,9 +105,9 @@ discard block |
||
| 105 | 105 | * @param int $expiration =0 |
| 106 | 106 | * @return boolean true on success, false on error |
| 107 | 107 | */ |
| 108 | - function set(array $keys,$data,$expiration=0) |
|
| 108 | + function set(array $keys, $data, $expiration = 0) |
|
| 109 | 109 | { |
| 110 | - return apc_store(self::key($keys),$data,$expiration); |
|
| 110 | + return apc_store(self::key($keys), $data, $expiration); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | /** |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | function get(array $keys) |
| 120 | 120 | { |
| 121 | 121 | $success = null; |
| 122 | - $data = apc_fetch($key=self::key($keys),$success); |
|
| 122 | + $data = apc_fetch($key = self::key($keys), $success); |
|
| 123 | 123 | |
| 124 | 124 | if (!$success) |
| 125 | 125 | { |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | return false; |
| 161 | 161 | } |
| 162 | 162 | //error_log(__METHOD__."(".array2string($keys).")"); |
| 163 | - foreach(new \APCIterator('user', $preg='/^'.preg_quote(self::key($keys).'/')) as $item) |
|
| 163 | + foreach (new \APCIterator('user', $preg = '/^'.preg_quote(self::key($keys).'/')) as $item) |
|
| 164 | 164 | { |
| 165 | 165 | //error_log(__METHOD__."(".array2string($keys).") preg='$preg': calling apc_delete('$item[key]')"); |
| 166 | 166 | apc_delete($item['key']); |
@@ -176,6 +176,6 @@ discard block |
||
| 176 | 176 | */ |
| 177 | 177 | private static function key(array $keys) |
| 178 | 178 | { |
| 179 | - return implode('::',$keys); |
|
| 179 | + return implode('::', $keys); |
|
| 180 | 180 | } |
| 181 | 181 | } |
@@ -43,9 +43,9 @@ |
||
| 43 | 43 | 'ppt' => 'application/vnd.ms-powerpoint', |
| 44 | 44 | 'qt' => 'video/quicktime', |
| 45 | 45 | ); |
| 46 | -$src_dir=__DIR__.'/MimeTypes-Link-Icons/images'; |
|
| 47 | -$dst_dir=__DIR__; |
|
| 48 | -foreach(scandir($src_dir) as $file) |
|
| 46 | +$src_dir = __DIR__.'/MimeTypes-Link-Icons/images'; |
|
| 47 | +$dst_dir = __DIR__; |
|
| 48 | +foreach (scandir($src_dir) as $file) |
|
| 49 | 49 | { |
| 50 | 50 | if (preg_match('/^([^-]+)-icon-128x128.png$/', $file, $matches)) |
| 51 | 51 | { |
@@ -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,24 +122,24 @@ 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 | 130 | $plugin_options = $_definition->plugin_options; |
| 131 | - $plugin_options['events_owner'] = isset( $_definition->plugin_options['events_owner'] ) ? |
|
| 131 | + $plugin_options['events_owner'] = isset($_definition->plugin_options['events_owner']) ? |
|
| 132 | 132 | $_definition->plugin_options['events_owner'] : $this->user; |
| 133 | 133 | $_definition->plugin_options = $plugin_options; |
| 134 | 134 | |
| 135 | 135 | // trash_users_records ? |
| 136 | - if ( $_definition->plugin_options['trash_users_records'] === true ) { |
|
| 137 | - if ( !$_definition->plugin_options['dry_run'] ) { |
|
| 136 | + if ($_definition->plugin_options['trash_users_records'] === true) { |
|
| 137 | + if (!$_definition->plugin_options['dry_run']) { |
|
| 138 | 138 | $socal = new calendar_socal(); |
| 139 | - $this->bocalupdate->so->deleteaccount( $_definition->plugin_options['events_owner']); |
|
| 140 | - unset( $socal ); |
|
| 139 | + $this->bocalupdate->so->deleteaccount($_definition->plugin_options['events_owner']); |
|
| 140 | + unset($socal); |
|
| 141 | 141 | } else { |
| 142 | - $lid = $GLOBALS['egw']->accounts->id2name( $_definition->plugin_options['events_owner'] ); |
|
| 142 | + $lid = $GLOBALS['egw']->accounts->id2name($_definition->plugin_options['events_owner']); |
|
| 143 | 143 | echo "Attension: All Events of '$lid' would be deleted!\n"; |
| 144 | 144 | } |
| 145 | 145 | } |
@@ -147,44 +147,44 @@ discard block |
||
| 147 | 147 | $this->errors = array(); |
| 148 | 148 | $this->results = array(); |
| 149 | 149 | |
| 150 | - while ( $record = $import_csv->get_record() ) { |
|
| 150 | + while ($record = $import_csv->get_record()) { |
|
| 151 | 151 | |
| 152 | 152 | // don't import empty events |
| 153 | - if( count( array_unique( $record ) ) < 2 ) continue; |
|
| 153 | + if (count(array_unique($record)) < 2) continue; |
|
| 154 | 154 | |
| 155 | - if ( $_definition->plugin_options['events_owner'] != -1 ) { |
|
| 155 | + if ($_definition->plugin_options['events_owner'] != -1) { |
|
| 156 | 156 | $record['owner'] = $_definition->plugin_options['events_owner']; |
| 157 | - } else unset( $record['owner'] ); |
|
| 157 | + } else unset($record['owner']); |
|
| 158 | 158 | |
| 159 | - if ( $_definition->plugin_options['conditions'] ) { |
|
| 160 | - foreach ( $_definition->plugin_options['conditions'] as $condition ) { |
|
| 161 | - switch ( $condition['type'] ) { |
|
| 159 | + if ($_definition->plugin_options['conditions']) { |
|
| 160 | + foreach ($_definition->plugin_options['conditions'] as $condition) { |
|
| 161 | + switch ($condition['type']) { |
|
| 162 | 162 | // exists |
| 163 | 163 | case 'exists' : |
| 164 | 164 | |
| 165 | - if ( is_array( $event = $this->bocalupdate->read( $record['uid'], null, $this->is_admin ) ) ) { |
|
| 165 | + if (is_array($event = $this->bocalupdate->read($record['uid'], null, $this->is_admin))) { |
|
| 166 | 166 | // apply action to event matching this exists condition |
| 167 | 167 | $record['id'] = $event['id']; |
| 168 | 168 | |
| 169 | - if ( $_definition->plugin_options['update_cats'] == 'add' ) { |
|
| 170 | - if ( !is_array( $event['cat_id'] ) ) $event['cat_id'] = explode( ',', $event['cat_id'] ); |
|
| 171 | - if ( !is_array( $record['cat_id'] ) ) $record['cat_id'] = explode( ',', $record['cat_id'] ); |
|
| 172 | - $record['cat_id'] = implode( ',', array_unique( array_merge( $record['cat_id'], $event['cat_id'] ) ) ); |
|
| 169 | + if ($_definition->plugin_options['update_cats'] == 'add') { |
|
| 170 | + if (!is_array($event['cat_id'])) $event['cat_id'] = explode(',', $event['cat_id']); |
|
| 171 | + if (!is_array($record['cat_id'])) $record['cat_id'] = explode(',', $record['cat_id']); |
|
| 172 | + $record['cat_id'] = implode(',', array_unique(array_merge($record['cat_id'], $event['cat_id']))); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | // check if entry is modiefied |
| 176 | - $event = array_intersect_key( $event, $record ); |
|
| 177 | - $diff = array_diff( $event, $record ); |
|
| 178 | - if( !empty( $diff ) ) $record['modified'] = time(); |
|
| 176 | + $event = array_intersect_key($event, $record); |
|
| 177 | + $diff = array_diff($event, $record); |
|
| 178 | + if (!empty($diff)) $record['modified'] = time(); |
|
| 179 | 179 | |
| 180 | 180 | $action = $condition['true']; |
| 181 | 181 | } else $action = $condition['false']; |
| 182 | 182 | |
| 183 | - $this->action( $action['action'], $record ); |
|
| 183 | + $this->action($action['action'], $record); |
|
| 184 | 184 | break; |
| 185 | 185 | case 'empty' : |
| 186 | - $action = empty( $record[$condition['string']] ) ? $condition['true'] : $condition['false']; |
|
| 187 | - $this->action( $action['action'], $record ); |
|
| 186 | + $action = empty($record[$condition['string']]) ? $condition['true'] : $condition['false']; |
|
| 187 | + $this->action($action['action'], $record); |
|
| 188 | 188 | break; |
| 189 | 189 | |
| 190 | 190 | // not supported action |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | } |
| 197 | 197 | } else { |
| 198 | 198 | // unconditional insert |
| 199 | - $this->action( 'insert', $record ); |
|
| 199 | + $this->action('insert', $record); |
|
| 200 | 200 | } |
| 201 | 201 | } |
| 202 | 202 | } |
@@ -208,8 +208,8 @@ discard block |
||
| 208 | 208 | * @param array $_data event data for the action |
| 209 | 209 | * @return bool success or not |
| 210 | 210 | */ |
| 211 | - private function action ( $_action, $_data ) { |
|
| 212 | - switch ( $_action ) { |
|
| 211 | + private function action($_action, $_data) { |
|
| 212 | + switch ($_action) { |
|
| 213 | 213 | case 'none' : |
| 214 | 214 | return true; |
| 215 | 215 | |
@@ -217,32 +217,32 @@ discard block |
||
| 217 | 217 | case 'insert' : |
| 218 | 218 | |
| 219 | 219 | // paticipants handling |
| 220 | - $participants = $_data['participants'] ? split( '[,;]', $_data['participants'] ) : array(); |
|
| 220 | + $participants = $_data['participants'] ? split('[,;]', $_data['participants']) : array(); |
|
| 221 | 221 | $_data['participants'] = array(); |
| 222 | - if ( $this->definition->plugin_options['owner_joins_event'] && $this->definition->plugin_options['events_owner'] > 0 ) { |
|
| 222 | + if ($this->definition->plugin_options['owner_joins_event'] && $this->definition->plugin_options['events_owner'] > 0) { |
|
| 223 | 223 | $_data['participants'][$this->definition->plugin_options['events_owner']] = 'A'; |
| 224 | 224 | } |
| 225 | - foreach( $participants as $participant ) { |
|
| 226 | - list( $participant, $status ) = explode( '=', $participant ); |
|
| 227 | - $valid_staties = array('U'=>'U','u'=>'U','A'=>'A','a'=>'A','R'=>'R','r'=>'R','T'=>'T','t'=>'T'); |
|
| 228 | - $status = isset( $valid_staties[$status] ) ? $valid_staties[$status] : 'U'; |
|
| 229 | - if ( $participant && is_numeric($participant ) ) { |
|
| 225 | + foreach ($participants as $participant) { |
|
| 226 | + list($participant, $status) = explode('=', $participant); |
|
| 227 | + $valid_staties = array('U'=>'U', 'u'=>'U', 'A'=>'A', 'a'=>'A', 'R'=>'R', 'r'=>'R', 'T'=>'T', 't'=>'T'); |
|
| 228 | + $status = isset($valid_staties[$status]) ? $valid_staties[$status] : 'U'; |
|
| 229 | + if ($participant && is_numeric($participant)) { |
|
| 230 | 230 | $_data['participants'][$participant] = $status; |
| 231 | 231 | } |
| 232 | 232 | } |
| 233 | 233 | // no valid participants so far --> add the importing user/owner |
| 234 | - if ( empty( $_data['participants'] ) ) { |
|
| 234 | + if (empty($_data['participants'])) { |
|
| 235 | 235 | $_data['participants'][$this->user] = 'A'; |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | // are we serious? |
| 239 | - if ( $this->dry_run ) { |
|
| 239 | + if ($this->dry_run) { |
|
| 240 | 240 | print_r($_data); |
| 241 | 241 | $this->results[$_action]++; |
| 242 | 242 | } else { |
| 243 | 243 | $messages = array(); |
| 244 | - $result = $this->bocalupdate->update( $_data, true, !$_data['modified'], $this->is_admin, true, $messages); |
|
| 245 | - if(!$result) { |
|
| 244 | + $result = $this->bocalupdate->update($_data, true, !$_data['modified'], $this->is_admin, true, $messages); |
|
| 245 | + if (!$result) { |
|
| 246 | 246 | $this->errors = implode(',', $messages); |
| 247 | 247 | } else { |
| 248 | 248 | $this->results[$_action]++; |
@@ -45,11 +45,11 @@ discard block |
||
| 45 | 45 | if (self::LOG_LEVEL > 0) error_log(__METHOD__.'('.array2string($data).')'); |
| 46 | 46 | // create a user-dir |
| 47 | 47 | Api\Vfs::$is_root = true; |
| 48 | - if (Api\Vfs::file_exists($dir='/home/'.$data['account_lid']) || Api\Vfs::mkdir($dir, 0700, 0)) |
|
| 48 | + if (Api\Vfs::file_exists($dir = '/home/'.$data['account_lid']) || Api\Vfs::mkdir($dir, 0700, 0)) |
|
| 49 | 49 | { |
| 50 | - Api\Vfs::chown($dir,(int)$data['account_id']); |
|
| 51 | - Api\Vfs::chgrp($dir,0); |
|
| 52 | - Api\Vfs::chmod($dir,0700); // only user has access |
|
| 50 | + Api\Vfs::chown($dir, (int)$data['account_id']); |
|
| 51 | + Api\Vfs::chgrp($dir, 0); |
|
| 52 | + Api\Vfs::chmod($dir, 0700); // only user has access |
|
| 53 | 53 | } |
| 54 | 54 | Api\Vfs::$is_root = false; |
| 55 | 55 | } |
@@ -67,11 +67,11 @@ discard block |
||
| 67 | 67 | if (self::LOG_LEVEL > 0) error_log(__METHOD__.'('.array2string($data).')'); |
| 68 | 68 | if (empty($data['account_lid']) || empty($data['old_loginid']) || $data['account_lid'] == $data['old_loginid']) |
| 69 | 69 | { |
| 70 | - return; // nothing to do here |
|
| 70 | + return; // nothing to do here |
|
| 71 | 71 | } |
| 72 | 72 | // rename the user-dir |
| 73 | 73 | Api\Vfs::$is_root = true; |
| 74 | - Api\Vfs::rename('/home/'.$data['old_loginid'],'/home/'.$data['account_lid']); |
|
| 74 | + Api\Vfs::rename('/home/'.$data['old_loginid'], '/home/'.$data['account_lid']); |
|
| 75 | 75 | Api\Vfs::$is_root = false; |
| 76 | 76 | } |
| 77 | 77 | |
@@ -90,15 +90,15 @@ discard block |
||
| 90 | 90 | if ($data['new_owner'] && ($new_lid = $GLOBALS['egw']->accounts->id2name($data['new_owner']))) |
| 91 | 91 | { |
| 92 | 92 | // copy content of user-dir to new owner's user-dir as old-home-$name |
| 93 | - for ($i=''; file_exists(Api\Vfs::PREFIX.($new_dir = '/home/'.$new_lid.'/old-home-'.$data['account_lid'].$i)); $i++) |
|
| 93 | + for ($i = ''; file_exists(Api\Vfs::PREFIX.($new_dir = '/home/'.$new_lid.'/old-home-'.$data['account_lid'].$i)); $i++) |
|
| 94 | 94 | { |
| 95 | 95 | |
| 96 | 96 | } |
| 97 | - Api\Vfs::rename('/home/'.$data['account_lid'],$new_dir); |
|
| 97 | + Api\Vfs::rename('/home/'.$data['account_lid'], $new_dir); |
|
| 98 | 98 | // make the new owner the owner of the dir and it's content |
| 99 | 99 | Api\Vfs::find($new_dir, array(), 'EGroupware\Api\Vfs::chown', $data['new_owner']); |
| 100 | 100 | } |
| 101 | - elseif(!empty($data['account_lid']) && $data['account_lid'] != '/') |
|
| 101 | + elseif (!empty($data['account_lid']) && $data['account_lid'] != '/') |
|
| 102 | 102 | { |
| 103 | 103 | // delete the user-directory |
| 104 | 104 | Api\Vfs::remove('/home/'.$data['account_lid']); |
@@ -124,11 +124,11 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | // create a group-dir |
| 126 | 126 | Api\Vfs::$is_root = true; |
| 127 | - if (Api\Vfs::file_exists($dir='/home/'.$data['account_lid']) || Api\Vfs::mkdir($dir, 0070, 0)) |
|
| 127 | + if (Api\Vfs::file_exists($dir = '/home/'.$data['account_lid']) || Api\Vfs::mkdir($dir, 0070, 0)) |
|
| 128 | 128 | { |
| 129 | - Api\Vfs::chown($dir,0); |
|
| 130 | - Api\Vfs::chgrp($dir,abs($data['account_id'])); // gid in Vfs is positiv! |
|
| 131 | - Api\Vfs::chmod($dir,0070); // only group has access |
|
| 129 | + Api\Vfs::chown($dir, 0); |
|
| 130 | + Api\Vfs::chgrp($dir, abs($data['account_id'])); // gid in Vfs is positiv! |
|
| 131 | + Api\Vfs::chmod($dir, 0070); // only group has access |
|
| 132 | 132 | } |
| 133 | 133 | Api\Vfs::$is_root = false; |
| 134 | 134 | } |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | { |
| 162 | 162 | // rename the group-dir |
| 163 | 163 | Api\Vfs::$is_root = true; |
| 164 | - Api\Vfs::rename('/home/'.$data['old_name'],'/home/'.$data['account_lid']); |
|
| 164 | + Api\Vfs::rename('/home/'.$data['old_name'], '/home/'.$data['account_lid']); |
|
| 165 | 165 | Api\Vfs::$is_root = false; |
| 166 | 166 | } |
| 167 | 167 | } |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | { |
| 178 | 178 | if (self::LOG_LEVEL > 0) error_log(__METHOD__.'('.array2string($data).')'); |
| 179 | 179 | |
| 180 | - if(empty($data['account_lid']) || $data['account_lid'] == '/') |
|
| 180 | + if (empty($data['account_lid']) || $data['account_lid'] == '/') |
|
| 181 | 181 | { |
| 182 | 182 | throw new Api\Exception\AssertionFailed(__METHOD__.'('.array2string($data).') account_lid NOT set!'); |
| 183 | 183 | } |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | private function parse_file($file) |
| 81 | 81 | { |
| 82 | 82 | // file is from url and can contain query-params, eg. /phpgwapi/inc/jscalendar-setup.php?dateformat=d.m.Y&lang=de |
| 83 | - if (strpos($file,'?') !== false) list($file) = explode('?',$file); |
|
| 83 | + if (strpos($file, '?') !== false) list($file) = explode('?', $file); |
|
| 84 | 84 | |
| 85 | 85 | // Mark the file as parsed |
| 86 | 86 | $this->parsed_files[$file] = true; |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | * @param array $modules pathes to include |
| 257 | 257 | * @param boolean $append =true false: prepend modules before already included ones, keeping their order |
| 258 | 258 | */ |
| 259 | - private function include_module(array $modules, $append=true) |
|
| 259 | + private function include_module(array $modules, $append = true) |
|
| 260 | 260 | { |
| 261 | 261 | if (self::$DEBUG_MODE) |
| 262 | 262 | { |
@@ -295,17 +295,17 @@ discard block |
||
| 295 | 295 | * @returns the correct path on the server if the file is found or false, if the |
| 296 | 296 | * file is not found or no further processing is needed. |
| 297 | 297 | */ |
| 298 | - private function translate_params($package, $file=null, $app='api') |
|
| 298 | + private function translate_params($package, $file = null, $app = 'api') |
|
| 299 | 299 | { |
| 300 | 300 | if ($package[0] == '/' && is_readable(EGW_SERVER_ROOT.parse_url($path = $package, PHP_URL_PATH)) || |
| 301 | 301 | // fix old /phpgwapi/js/ path by replacing it with /api/js/ |
| 302 | 302 | substr($package, 0, 13) == '/phpgwapi/js/' && is_readable(EGW_SERVER_ROOT.parse_url($path = str_replace('/phpgwapi/js/', '/api/js/', $package), PHP_URL_PATH)) || |
| 303 | 303 | $package[0] == '/' && is_readable(EGW_SERVER_ROOT.($path = $package)) || |
| 304 | - $package == '.' && is_readable(EGW_SERVER_ROOT.($path="/$app/js/$file.js")) || |
|
| 305 | - is_readable(EGW_SERVER_ROOT.($path="/$app/js/$package/$file.js")) || |
|
| 304 | + $package == '.' && is_readable(EGW_SERVER_ROOT.($path = "/$app/js/$file.js")) || |
|
| 305 | + is_readable(EGW_SERVER_ROOT.($path = "/$app/js/$package/$file.js")) || |
|
| 306 | 306 | // fix not found by using app='api' |
| 307 | - $app != 'api' && is_readable(EGW_SERVER_ROOT.($path="/api/js/$package/$file.js")) || |
|
| 308 | - $app != 'phpgwapi' && is_readable(EGW_SERVER_ROOT.($path="/phpgwapi/js/$package/$file.js"))) |
|
| 307 | + $app != 'api' && is_readable(EGW_SERVER_ROOT.($path = "/api/js/$package/$file.js")) || |
|
| 308 | + $app != 'phpgwapi' && is_readable(EGW_SERVER_ROOT.($path = "/phpgwapi/js/$package/$file.js"))) |
|
| 309 | 309 | { |
| 310 | 310 | // normalise /./ to / |
| 311 | 311 | $path = str_replace('/./', '/', $path); |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | // adding the ctime to all js files... |
| 317 | 317 | if (is_array($file)) |
| 318 | 318 | { |
| 319 | - foreach($file as $name => $val) |
|
| 319 | + foreach ($file as $name => $val) |
|
| 320 | 320 | { |
| 321 | 321 | $args .= (empty($args) ? '?' : '&').$name.'='.urlencode($val); |
| 322 | 322 | } |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | * @param string $app ='phpgwapi' application directory to search - default = phpgwapi |
| 360 | 360 | * @param boolean $append =true true append file, false prepend (add as first) file used eg. for template itself |
| 361 | 361 | */ |
| 362 | - public function include_js_file($package, $file = null, $app = 'phpgwapi', $append=true) |
|
| 362 | + public function include_js_file($package, $file = null, $app = 'phpgwapi', $append = true) |
|
| 363 | 363 | { |
| 364 | 364 | // Translate the given parameters into a valid path - false is returned |
| 365 | 365 | // if the file is not found or the file is already included/has already |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | * @param array $files |
| 388 | 388 | * @param boolean $clear_files =false if true clear list of files, before including given ones |
| 389 | 389 | */ |
| 390 | - public function include_files(array $files, $clear_files=false) |
|
| 390 | + public function include_files(array $files, $clear_files = false) |
|
| 391 | 391 | { |
| 392 | 392 | if ($clear_files) $this->included_files = array(); |
| 393 | 393 | |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | * @param boolean $clear_files =false if true clear list of files after returning them |
| 404 | 404 | * @return array |
| 405 | 405 | */ |
| 406 | - public function get_included_files($clear_files=false) |
|
| 406 | + public function get_included_files($clear_files = false) |
|
| 407 | 407 | { |
| 408 | 408 | $ret = array_keys($this->included_files); |
| 409 | 409 | if ($clear_files) $this->included_files = array(); |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | |
| 437 | 437 | $paths = !empty($_GET['path']) ? (array)$_GET['path'] : (array)'/stylite/js/filemanager/filemanager.js'; |
| 438 | 438 | |
| 439 | - foreach($paths as $path) |
|
| 439 | + foreach ($paths as $path) |
|
| 440 | 440 | { |
| 441 | 441 | echo "\t<h1>".htmlspecialchars($path)."</h1>\n"; |
| 442 | 442 | $mgr->include_js_file($path); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | { |
| 30 | 30 | return stripslashes($var); |
| 31 | 31 | } |
| 32 | - foreach($var as $key => $val) |
|
| 32 | + foreach ($var as $key => $val) |
|
| 33 | 33 | { |
| 34 | 34 | $var[$key] = is_array($val) ? array_stripslashes($val) : stripslashes($val); |
| 35 | 35 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | if (is_null($func_overload)) $func_overload = extension_loaded('mbstring') ? ini_get('mbstring.func_overload') : 0; |
| 51 | 51 | |
| 52 | - return $func_overload & 2 ? mb_strlen($str,'ascii') : strlen($str); |
|
| 52 | + return $func_overload&2 ? mb_strlen($str, 'ascii') : strlen($str); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * @param int $len |
| 61 | 61 | * @return string |
| 62 | 62 | */ |
| 63 | -function cut_bytes(&$data,$offset,$len=null) |
|
| 63 | +function cut_bytes(&$data, $offset, $len = null) |
|
| 64 | 64 | { |
| 65 | 65 | static $func_overload = null; |
| 66 | 66 | |
@@ -68,9 +68,9 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | if (is_null($len)) |
| 70 | 70 | { |
| 71 | - return $func_overload & 2 ? mb_substr($data,$offset,bytes($data),'ascii') : substr($data,$offset); |
|
| 71 | + return $func_overload&2 ? mb_substr($data, $offset, bytes($data), 'ascii') : substr($data, $offset); |
|
| 72 | 72 | } |
| 73 | - return $func_overload & 2 ? mb_substr($data,$offset,$len,'ascii') : substr($data,$offset,$len); |
|
| 73 | + return $func_overload&2 ? mb_substr($data, $offset, $len, 'ascii') : substr($data, $offset, $len); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | if (!function_exists('imap_rfc822_parse_adrlist')) |
@@ -102,10 +102,10 @@ discard block |
||
| 102 | 102 | { |
| 103 | 103 | $addresses = array(); |
| 104 | 104 | $pending = ''; |
| 105 | - foreach(explode(',', $address) as $part) |
|
| 105 | + foreach (explode(',', $address) as $part) |
|
| 106 | 106 | { |
| 107 | 107 | $trimmed = trim(($pending ? $pending.',' : '').$part); |
| 108 | - if (($trimmed[0] == '"' && substr($trimmed, -1) != '>')||strpos($part, '@')===false) |
|
| 108 | + if (($trimmed[0] == '"' && substr($trimmed, -1) != '>') || strpos($part, '@') === false) |
|
| 109 | 109 | { |
| 110 | 110 | $pending .= ($pending ? $pending.',' : '').$part; |
| 111 | 111 | continue; |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | //if (!preg_match('/^[!#$%&\'*+/0-9=?A-Z^_`a-z{|}~-]+$/u', $personal)) // that's how I read the rfc(2)822 |
| 159 | 159 | if ($personal && !preg_match('/^[0-9A-Z -]*$/iu', $personal)) // but quoting is never wrong, so quote more then necessary |
| 160 | 160 | { |
| 161 | - $personal = '"'.str_replace(array('\\', '"'),array('\\\\', '\\"'), $personal).'"'; |
|
| 161 | + $personal = '"'.str_replace(array('\\', '"'), array('\\\\', '\\"'), $personal).'"'; |
|
| 162 | 162 | } |
| 163 | 163 | return ($personal ? $personal.' <' : '').$mailbox.($host ? '@'.$host : '').($personal ? '>' : ''); |
| 164 | 164 | } |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | { |
| 180 | 180 | return array((object)array( |
| 181 | 181 | 'text' => Horde_Mime::decode($text), |
| 182 | - 'charset' => Api\Translation::charset(), // is already in our internal encoding! |
|
| 182 | + 'charset' => Api\Translation::charset(), // is already in our internal encoding! |
|
| 183 | 183 | )); |
| 184 | 184 | } |
| 185 | 185 | } |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | * @param int $len |
| 209 | 209 | * @return string |
| 210 | 210 | */ |
| 211 | - function mb_substr(&$data, $offset, $len=null) |
|
| 211 | + function mb_substr(&$data, $offset, $len = null) |
|
| 212 | 212 | { |
| 213 | 213 | return is_null($len) ? substr($data, $offset) : substr($data, $offset, $len); |
| 214 | 214 | } |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | return 'NULL'; |
| 237 | 237 | case 'object': |
| 238 | 238 | case 'array': |
| 239 | - return str_replace(array("\n",' '/*,'Array'*/),'',print_r($var,true)); |
|
| 239 | + return str_replace(array("\n", ' '/*,'Array'*/), '', print_r($var, true)); |
|
| 240 | 240 | } |
| 241 | 241 | return 'UNKNOWN TYPE!'; |
| 242 | 242 | } |
@@ -249,14 +249,14 @@ discard block |
||
| 249 | 249 | * @return boolean true if loaded now, false otherwise |
| 250 | 250 | * @throws Api\Exception\AssertionFailed |
| 251 | 251 | */ |
| 252 | -function check_load_extension($extension,$throw=false) |
|
| 252 | +function check_load_extension($extension, $throw = false) |
|
| 253 | 253 | { |
| 254 | 254 | if (!defined('PHP_SHLIB_PREFIX')) |
| 255 | 255 | { |
| 256 | - define('PHP_SHLIB_PREFIX',PHP_SHLIB_SUFFIX == 'dll' ? 'php_' : ''); |
|
| 256 | + define('PHP_SHLIB_PREFIX', PHP_SHLIB_SUFFIX == 'dll' ? 'php_' : ''); |
|
| 257 | 257 | } |
| 258 | 258 | // we check for the existens of 'dl', as multithreaded webservers dont have it and some hosters disable it !!! |
| 259 | - $loaded = extension_loaded($extension) || function_exists('dl') && @dl($dl=PHP_SHLIB_PREFIX.$extension.'.'.PHP_SHLIB_SUFFIX); |
|
| 259 | + $loaded = extension_loaded($extension) || function_exists('dl') && @dl($dl = PHP_SHLIB_PREFIX.$extension.'.'.PHP_SHLIB_SUFFIX); |
|
| 260 | 260 | |
| 261 | 261 | if (!$loaded && $throw) |
| 262 | 262 | { |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | * @param int/string $default_id either a name or an id |
| 285 | 285 | * @return int account_id |
| 286 | 286 | */ |
| 287 | -function get_account_id($account_id = '',$default_id = '') |
|
| 287 | +function get_account_id($account_id = '', $default_id = '') |
|
| 288 | 288 | { |
| 289 | 289 | if (gettype($account_id) == 'integer') |
| 290 | 290 | { |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | { |
| 295 | 295 | if ($default_id == '') |
| 296 | 296 | { |
| 297 | - return (isset($GLOBALS['egw_info']['user']['account_id'])?$GLOBALS['egw_info']['user']['account_id']:0); |
|
| 297 | + return (isset($GLOBALS['egw_info']['user']['account_id']) ? $GLOBALS['egw_info']['user']['account_id'] : 0); |
|
| 298 | 298 | } |
| 299 | 299 | elseif (is_string($default_id)) |
| 300 | 300 | { |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | } |
| 305 | 305 | elseif (is_string($account_id)) |
| 306 | 306 | { |
| 307 | - if((int)$account_id && $GLOBALS['egw']->accounts->exists((int)$account_id) == True) |
|
| 307 | + if ((int)$account_id && $GLOBALS['egw']->accounts->exists((int)$account_id) == True) |
|
| 308 | 308 | { |
| 309 | 309 | return (int)$account_id; |
| 310 | 310 | } |
@@ -322,9 +322,9 @@ discard block |
||
| 322 | 322 | * @param boolean $print =true print or return the content |
| 323 | 323 | * @return string if !$print |
| 324 | 324 | */ |
| 325 | -function _debug_array($array,$print=True) |
|
| 325 | +function _debug_array($array, $print = True) |
|
| 326 | 326 | { |
| 327 | - $output = '<pre>'.print_r($array,true)."</pre>\n"; |
|
| 327 | + $output = '<pre>'.print_r($array, true)."</pre>\n"; |
|
| 328 | 328 | |
| 329 | 329 | if ($print) |
| 330 | 330 | { |
@@ -343,28 +343,28 @@ discard block |
||
| 343 | 343 | * @param int $remove =0 number of levels to remove |
| 344 | 344 | * @return string function-names separated by slashes (beginning with the calling function not this one) |
| 345 | 345 | */ |
| 346 | -function function_backtrace($remove=0) |
|
| 346 | +function function_backtrace($remove = 0) |
|
| 347 | 347 | { |
| 348 | 348 | if (function_exists('debug_backtrace')) |
| 349 | 349 | { |
| 350 | 350 | $backtrace = debug_backtrace(); |
| 351 | 351 | //echo "function_backtrace($remove)<pre>".print_r($backtrace,True)."</pre>\n"; |
| 352 | - foreach($backtrace as $n => $level) |
|
| 352 | + foreach ($backtrace as $n => $level) |
|
| 353 | 353 | { |
| 354 | 354 | if ($remove-- < 0) |
| 355 | 355 | { |
| 356 | - $ret[] = (isset($level['class'])?$level['class'].$level['type']:'').$level['function']. |
|
| 357 | - ($n > 0 && isset($backtrace[$n-1]['line']) ? ':'.$backtrace[$n-1]['line'] : ''). // add line number of call |
|
| 356 | + $ret[] = (isset($level['class']) ? $level['class'].$level['type'] : '').$level['function']. |
|
| 357 | + ($n > 0 && isset($backtrace[$n - 1]['line']) ? ':'.$backtrace[$n - 1]['line'] : '').// add line number of call |
|
| 358 | 358 | (!$level['class'] && !is_object($level['args'][0]) && $level['function'] != 'unserialize' ? |
| 359 | - '('.substr(str_replace(EGW_SERVER_ROOT,'',(string)$level['args'][0]),0,64).')' : ''); |
|
| 359 | + '('.substr(str_replace(EGW_SERVER_ROOT, '', (string)$level['args'][0]), 0, 64).')' : ''); |
|
| 360 | 360 | } |
| 361 | 361 | } |
| 362 | 362 | if (is_array($ret)) |
| 363 | 363 | { |
| 364 | - return implode(' / ',$ret); |
|
| 364 | + return implode(' / ', $ret); |
|
| 365 | 365 | } |
| 366 | 366 | } |
| 367 | - return $_GET['menuaction'] ? $_GET['menuaction'] : str_replace(EGW_SERVER_ROOT,'',$_SERVER['SCRIPT_FILENAME']); |
|
| 367 | + return $_GET['menuaction'] ? $_GET['menuaction'] : str_replace(EGW_SERVER_ROOT, '', $_SERVER['SCRIPT_FILENAME']); |
|
| 368 | 368 | } |
| 369 | 369 | |
| 370 | 370 | if (!function_exists('lang') || defined('NO_LANG')) // setup declares an own version |
@@ -376,14 +376,14 @@ discard block |
||
| 376 | 376 | * @param string $vars =null multiple values to replace the placeholders |
| 377 | 377 | * @return string translated message with placeholders replaced |
| 378 | 378 | */ |
| 379 | - function lang($key,$vars=null) |
|
| 379 | + function lang($key, $vars = null) |
|
| 380 | 380 | { |
| 381 | - if(!is_array($vars)) |
|
| 381 | + if (!is_array($vars)) |
|
| 382 | 382 | { |
| 383 | 383 | $vars = func_get_args(); |
| 384 | - array_shift($vars); // remove $key |
|
| 384 | + array_shift($vars); // remove $key |
|
| 385 | 385 | } |
| 386 | - return Api\Translation::translate($key,$vars); |
|
| 386 | + return Api\Translation::translate($key, $vars); |
|
| 387 | 387 | } |
| 388 | 388 | } |
| 389 | 389 | |
@@ -413,9 +413,9 @@ discard block |
||
| 413 | 413 | * |
| 414 | 414 | * @deprecated use $GLOBALS['egw']->framework->sidebox() |
| 415 | 415 | */ |
| 416 | - function display_sidebox($appname,$menu_title,$_file) |
|
| 416 | + function display_sidebox($appname, $menu_title, $_file) |
|
| 417 | 417 | { |
| 418 | 418 | $file = str_replace('preferences.uisettings.index', 'preferences.preferences_settings.index', $_file); |
| 419 | - $GLOBALS['egw']->framework->sidebox($appname,$menu_title,$file); |
|
| 419 | + $GLOBALS['egw']->framework->sidebox($appname, $menu_title, $file); |
|
| 420 | 420 | } |
| 421 | 421 | } |