@@ -54,26 +54,26 @@ discard block |
||
| 54 | 54 | * @throws Exception if connection to backend could not be established |
| 55 | 55 | * @param array $params eg. array('localhost'[,'localhost:11211',...]) |
| 56 | 56 | */ |
| 57 | - function __construct(array $params=null) |
|
| 57 | + function __construct(array $params = null) |
|
| 58 | 58 | { |
| 59 | - check_load_extension('memcache',true); |
|
| 59 | + check_load_extension('memcache', true); |
|
| 60 | 60 | $this->memcache = new \Memcache(); |
| 61 | 61 | |
| 62 | - if (!$params) $params = array('localhost'); // some reasonable default |
|
| 62 | + if (!$params) $params = array('localhost'); // some reasonable default |
|
| 63 | 63 | |
| 64 | 64 | $ok = false; |
| 65 | - foreach($params as $host_port) |
|
| 65 | + foreach ($params as $host_port) |
|
| 66 | 66 | { |
| 67 | - $parts = explode(':',$host_port); |
|
| 67 | + $parts = explode(':', $host_port); |
|
| 68 | 68 | $host = array_shift($parts); |
| 69 | - $port = $parts ? array_shift($parts) : 11211; // default port |
|
| 69 | + $port = $parts ? array_shift($parts) : 11211; // default port |
|
| 70 | 70 | |
| 71 | - $ok = $this->memcache->addServer($host,$port) || $ok; |
|
| 71 | + $ok = $this->memcache->addServer($host, $port) || $ok; |
|
| 72 | 72 | //error_log(__METHOD__."(".array2string($params).") memcache->addServer('$host',$port) = ".(int)$ok); |
| 73 | 73 | } |
| 74 | 74 | if (!$ok) |
| 75 | 75 | { |
| 76 | - throw new Exception (__METHOD__.'('.array2string($params).") Can't open connection to any memcached server!"); |
|
| 76 | + throw new Exception(__METHOD__.'('.array2string($params).") Can't open connection to any memcached server!"); |
|
| 77 | 77 | } |
| 78 | 78 | $this->igbinary_available = function_exists('igbinary_serialize') && function_exists('igbinary_unserialize'); |
| 79 | 79 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * @param int $expiration =0 |
| 87 | 87 | * @return boolean true on success, false on error, incl. key already exists in cache |
| 88 | 88 | */ |
| 89 | - function add(array $keys,$data,$expiration=0) |
|
| 89 | + function add(array $keys, $data, $expiration = 0) |
|
| 90 | 90 | { |
| 91 | 91 | return $this->memcache->add(self::key($keys), |
| 92 | 92 | $this->igbinary_available ? igbinary_serialize($data) : serialize($data), |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | * @param int $expiration =0 |
| 102 | 102 | * @return boolean true on success, false on error |
| 103 | 103 | */ |
| 104 | - function set(array $keys,$data,$expiration=0) |
|
| 104 | + function set(array $keys, $data, $expiration = 0) |
|
| 105 | 105 | { |
| 106 | 106 | return $this->memcache->set(self::key($keys), |
| 107 | 107 | $this->igbinary_available ? igbinary_serialize($data) : serialize($data), |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | function get(array $keys) |
| 118 | 118 | { |
| 119 | - if (($data = $this->memcache->get($key=self::key($keys))) === false) |
|
| 119 | + if (($data = $this->memcache->get($key = self::key($keys))) === false) |
|
| 120 | 120 | { |
| 121 | 121 | //error_log(__METHOD__."(".array2string($keys).") key='$key' NOT found!"); |
| 122 | 122 | return null; |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | { |
| 136 | 136 | $locations = array_pop($keys); |
| 137 | 137 | $prefix = self::key($keys); |
| 138 | - foreach($locations as &$location) |
|
| 138 | + foreach ($locations as &$location) |
|
| 139 | 139 | { |
| 140 | 140 | $location = $prefix.'::'.$location; |
| 141 | 141 | } |
@@ -144,10 +144,10 @@ discard block |
||
| 144 | 144 | return array(); |
| 145 | 145 | } |
| 146 | 146 | $ret = array(); |
| 147 | - $prefix_len = strlen($prefix)+2; |
|
| 148 | - foreach($multiple as $location => $data) |
|
| 147 | + $prefix_len = strlen($prefix) + 2; |
|
| 148 | + foreach ($multiple as $location => $data) |
|
| 149 | 149 | { |
| 150 | - $key = substr($location,$prefix_len); |
|
| 150 | + $key = substr($location, $prefix_len); |
|
| 151 | 151 | //error_log(__METHOD__."(".array2string($locations).") key='$key' found ".bytes($data)." bytes)."); |
| 152 | 152 | $ret[$key] = $this->igbinary_available && $data[1] !== ':' ? igbinary_unserialize($data) : unserialize($data); |
| 153 | 153 | } |
@@ -175,6 +175,6 @@ discard block |
||
| 175 | 175 | */ |
| 176 | 176 | private function key(array $keys) |
| 177 | 177 | { |
| 178 | - return implode('::',$keys); |
|
| 178 | + return implode('::', $keys); |
|
| 179 | 179 | } |
| 180 | 180 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * @param boolean $verbose =false true: echo failed checks |
| 29 | 29 | * @return int number of failed checks |
| 30 | 30 | */ |
| 31 | - function check($verbose=false) |
|
| 31 | + function check($verbose = false) |
|
| 32 | 32 | { |
| 33 | 33 | // set us up as provider for Api\Cache class |
| 34 | 34 | $GLOBALS['egw_info']['server']['install_id'] = md5(microtime(true)); |
@@ -37,27 +37,27 @@ discard block |
||
| 37 | 37 | Api\Cache::$default_provider = get_class($this); |
| 38 | 38 | |
| 39 | 39 | $failed = 0; |
| 40 | - foreach(array( |
|
| 40 | + foreach (array( |
|
| 41 | 41 | Api\Cache::TREE => 'tree', |
| 42 | 42 | Api\Cache::INSTANCE => 'instance', |
| 43 | 43 | ) as $level => $label) |
| 44 | 44 | { |
| 45 | 45 | $locations = array(); |
| 46 | - foreach(array('string',123,true,false,null,array(),array(1,2,3)) as $data) |
|
| 46 | + foreach (array('string', 123, true, false, null, array(), array(1, 2, 3)) as $data) |
|
| 47 | 47 | { |
| 48 | 48 | $location = md5(microtime(true).$label.serialize($data)); |
| 49 | - $get_before_set = $this->get(array($level,__CLASS__,$location)); |
|
| 49 | + $get_before_set = $this->get(array($level, __CLASS__, $location)); |
|
| 50 | 50 | if (!is_null($get_before_set)) |
| 51 | 51 | { |
| 52 | 52 | if ($verbose) echo "$label: get_before_set=".array2string($get_before_set)." != NULL\n"; |
| 53 | 53 | ++$failed; |
| 54 | 54 | } |
| 55 | - if (($set = $this->set(array($level,__CLASS__,$location), $data, 10)) !== true) |
|
| 55 | + if (($set = $this->set(array($level, __CLASS__, $location), $data, 10)) !== true) |
|
| 56 | 56 | { |
| 57 | 57 | if ($verbose) echo "$label: set returned ".array2string($set)." !== TRUE\n"; |
| 58 | 58 | ++$failed; |
| 59 | 59 | } |
| 60 | - $get_after_set = $this->get(array($level,__CLASS__,$location)); |
|
| 60 | + $get_after_set = $this->get(array($level, __CLASS__, $location)); |
|
| 61 | 61 | if ($get_after_set !== $data) |
| 62 | 62 | { |
| 63 | 63 | if ($verbose) echo "$label: get_after_set=".array2string($get_after_set)." !== ".array2string($data)."\n"; |
@@ -65,25 +65,25 @@ discard block |
||
| 65 | 65 | } |
| 66 | 66 | if (is_a($this, 'EGroupware\Api\Cache\ProviderMultiple')) |
| 67 | 67 | { |
| 68 | - $mget_after_set = $this->mget(array($level,__CLASS__,array($location))); |
|
| 68 | + $mget_after_set = $this->mget(array($level, __CLASS__, array($location))); |
|
| 69 | 69 | if ($mget_after_set[$location] !== $data) |
| 70 | 70 | { |
| 71 | 71 | if ($verbose) echo "$label: mget_after_set['$location']=".array2string($mget_after_set[$location])." !== ".array2string($data)."\n"; |
| 72 | 72 | ++$failed; |
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | - $add_after_set = $this->add(array($level,__CLASS__,$location), 'other-data'); |
|
| 75 | + $add_after_set = $this->add(array($level, __CLASS__, $location), 'other-data'); |
|
| 76 | 76 | if ($add_after_set !== false) |
| 77 | 77 | { |
| 78 | 78 | if ($verbose) echo "$label: add_after_set=".array2string($add_after_set)."\n"; |
| 79 | 79 | ++$failed; |
| 80 | 80 | } |
| 81 | - if (($delete = $this->delete(array($level,__CLASS__,$location))) !== true) |
|
| 81 | + if (($delete = $this->delete(array($level, __CLASS__, $location))) !== true) |
|
| 82 | 82 | { |
| 83 | 83 | if ($verbose) echo "$label: delete returned ".array2string($delete)." !== TRUE\n"; |
| 84 | 84 | ++$failed; |
| 85 | 85 | } |
| 86 | - $get_after_delete = $this->get(array($level,__CLASS__,$location)); |
|
| 86 | + $get_after_delete = $this->get(array($level, __CLASS__, $location)); |
|
| 87 | 87 | if (!is_null($get_after_delete)) |
| 88 | 88 | { |
| 89 | 89 | if ($verbose) echo "$label: get_after_delete=".array2string($get_after_delete)." != NULL\n"; |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | if (is_a($this, 'EGroupware\Api\Cache\ProviderMultiple')) |
| 94 | 94 | { |
| 95 | 95 | $locations[$location] = $data; |
| 96 | - $mget_after_delete = $this->mget(array($level,__CLASS__,array($location))); |
|
| 96 | + $mget_after_delete = $this->mget(array($level, __CLASS__, array($location))); |
|
| 97 | 97 | if (isset($mget_after_delete[$location])) |
| 98 | 98 | { |
| 99 | 99 | if ($verbose) echo "$label: mget_after_delete['$location']=".array2string($mget_after_delete[$location])." != NULL\n"; |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | { |
| 105 | 105 | $locations[$location] = $data; |
| 106 | 106 | } |
| 107 | - $add_after_delete = $this->add(array($level,__CLASS__,$location), $data, 10); |
|
| 107 | + $add_after_delete = $this->add(array($level, __CLASS__, $location), $data, 10); |
|
| 108 | 108 | if ($add_after_delete !== true) |
| 109 | 109 | { |
| 110 | 110 | if ($verbose) echo "$label: add_after_delete=".array2string($add_after_delete)."\n"; |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | } |
| 113 | 113 | else |
| 114 | 114 | { |
| 115 | - $get_after_add = $this->get(array($level,__CLASS__,$location)); |
|
| 115 | + $get_after_add = $this->get(array($level, __CLASS__, $location)); |
|
| 116 | 116 | if ($get_after_add !== $data) |
| 117 | 117 | { |
| 118 | 118 | if ($verbose) echo "$label: get_after_add=".array2string($get_after_add)." !== ".array2string($data)."\n"; |
@@ -122,11 +122,11 @@ discard block |
||
| 122 | 122 | } |
| 123 | 123 | // get all above in one request |
| 124 | 124 | $keys = array_keys($locations); |
| 125 | - $keys_bogus = array_merge(array('not-set'),array_keys($locations),array('not-set-too')); |
|
| 125 | + $keys_bogus = array_merge(array('not-set'), array_keys($locations), array('not-set-too')); |
|
| 126 | 126 | if (is_a($this, 'EGroupware\Api\Cache\ProviderMultiple')) |
| 127 | 127 | { |
| 128 | - $mget = $this->mget(array($level,__CLASS__,$keys)); |
|
| 129 | - $mget_bogus = $this->mget(array($level,__CLASS__,$keys_bogus)); |
|
| 128 | + $mget = $this->mget(array($level, __CLASS__, $keys)); |
|
| 129 | + $mget_bogus = $this->mget(array($level, __CLASS__, $keys_bogus)); |
|
| 130 | 130 | /* Api\Cache::getCache() gives a different result, as it does NOT use $level direkt |
| 131 | 131 | } |
| 132 | 132 | else |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | function flush(array $keys) |
| 162 | 162 | { |
| 163 | - unset($keys); // required by function signature |
|
| 163 | + unset($keys); // required by function signature |
|
| 164 | 164 | return false; |
| 165 | 165 | } |
| 166 | 166 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * @param int $expiration =0 |
| 39 | 39 | * @return boolean true on success, false on error, incl. key already exists in cache |
| 40 | 40 | */ |
| 41 | - function add(array $keys,$data,$expiration=0); |
|
| 41 | + function add(array $keys, $data, $expiration = 0); |
|
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | 44 | * Stores some data in the cache |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * @param int $expiration =0 |
| 49 | 49 | * @return boolean true on success, false on error |
| 50 | 50 | */ |
| 51 | - function set(array $keys,$data,$expiration=0); |
|
| 51 | + function set(array $keys, $data, $expiration = 0); |
|
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | 54 | * Get some data from the cache |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | * @param boolean $translated =true use translated name or english |
| 365 | 365 | * @return string |
| 366 | 366 | */ |
| 367 | - public static function get_full_name($code,$translated=true) |
|
| 367 | + public static function get_full_name($code, $translated = true) |
|
| 368 | 368 | { |
| 369 | 369 | if ($translated) |
| 370 | 370 | { |
@@ -383,36 +383,36 @@ discard block |
||
| 383 | 383 | */ |
| 384 | 384 | public static function country_code($name) |
| 385 | 385 | { |
| 386 | - if (!$name) return ''; // nothing to do |
|
| 386 | + if (!$name) return ''; // nothing to do |
|
| 387 | 387 | |
| 388 | 388 | if (strlen($name) == 2 && isset(self::$country_array[$name])) |
| 389 | 389 | { |
| 390 | - return $name; // $name is already a country-code |
|
| 390 | + return $name; // $name is already a country-code |
|
| 391 | 391 | } |
| 392 | 392 | |
| 393 | - if (($code = array_search(strtoupper($name),self::$country_array)) !== false) |
|
| 393 | + if (($code = array_search(strtoupper($name), self::$country_array)) !== false) |
|
| 394 | 394 | { |
| 395 | 395 | return $code; |
| 396 | 396 | } |
| 397 | 397 | if (!self::$countries_translated) self::_translate_countries(); |
| 398 | 398 | |
| 399 | - if (($code = array_search(strtoupper($name),self::$countries_translated)) !== false || |
|
| 400 | - ($code = array_search($name,self::$countries_translated)) !== false) |
|
| 399 | + if (($code = array_search(strtoupper($name), self::$countries_translated)) !== false || |
|
| 400 | + ($code = array_search($name, self::$countries_translated)) !== false) |
|
| 401 | 401 | { |
| 402 | 402 | return $code; |
| 403 | 403 | } |
| 404 | 404 | // search case-insensitive all translations for the english phrase of given country $name |
| 405 | 405 | // we do that to catch all possible cases of translations |
| 406 | - static $en_names = array(); // we do some caching to minimize db-accesses |
|
| 406 | + static $en_names = array(); // we do some caching to minimize db-accesses |
|
| 407 | 407 | if (isset($en_names[$name])) |
| 408 | 408 | { |
| 409 | 409 | $name = $en_names[$name]; |
| 410 | 410 | } |
| 411 | - elseif (($name_en = Translation::get_message_id($name,'common'))) |
|
| 411 | + elseif (($name_en = Translation::get_message_id($name, 'common'))) |
|
| 412 | 412 | { |
| 413 | 413 | $name = $en_names[$name] = strtoupper($name_en); |
| 414 | 414 | } |
| 415 | - if (($code = array_search(strtoupper($name),self::$country_array)) !== false) |
|
| 415 | + if (($code = array_search(strtoupper($name), self::$country_array)) !== false) |
|
| 416 | 416 | { |
| 417 | 417 | return $code; |
| 418 | 418 | } |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | * @param boolean $translated =true use translated names or english |
| 426 | 426 | * @return array with 2-letter code => name pairs |
| 427 | 427 | */ |
| 428 | - public static function countries($translated=true) |
|
| 428 | + public static function countries($translated = true) |
|
| 429 | 429 | { |
| 430 | 430 | if ($translated) |
| 431 | 431 | { |
@@ -447,12 +447,12 @@ discard block |
||
| 447 | 447 | |
| 448 | 448 | self::$countries_translated = self::$country_array; |
| 449 | 449 | // try to translate them and sort alphabetic |
| 450 | - foreach(self::$countries_translated as $k => $name) |
|
| 450 | + foreach (self::$countries_translated as $k => $name) |
|
| 451 | 451 | { |
| 452 | 452 | self::$countries_translated[$k] = lang($name); |
| 453 | 453 | } |
| 454 | 454 | |
| 455 | - if(class_exists('Collator') && class_exists('Locale')) |
|
| 455 | + if (class_exists('Collator') && class_exists('Locale')) |
|
| 456 | 456 | { |
| 457 | 457 | $col = new \Collator(Preferences::setlocale()); |
| 458 | 458 | $col->asort(self::$countries_translated); |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | /** |
| 23 | 23 | * Constructor |
| 24 | 24 | */ |
| 25 | - function __construct($primary='mail', $fallback='sql') |
|
| 25 | + function __construct($primary = 'mail', $fallback = 'sql') |
|
| 26 | 26 | { |
| 27 | 27 | parent::__construct($primary, $fallback); |
| 28 | 28 | } |
@@ -26,22 +26,22 @@ discard block |
||
| 26 | 26 | * @param string $passwd_type ='text' 'text' for cleartext passwords (default) |
| 27 | 27 | * @return boolean true if successful authenticated, false otherwise |
| 28 | 28 | */ |
| 29 | - function authenticate($username, $passwd, $passwd_type='text') |
|
| 29 | + function authenticate($username, $passwd, $passwd_type = 'text') |
|
| 30 | 30 | { |
| 31 | - unset($passwd_type); // not used but required by interface |
|
| 31 | + unset($passwd_type); // not used but required by interface |
|
| 32 | 32 | |
| 33 | 33 | $domain = yp_get_default_domain(); |
| 34 | - if(!empty($GLOBALS['egw_info']['server']['nis_domain'])) |
|
| 34 | + if (!empty($GLOBALS['egw_info']['server']['nis_domain'])) |
|
| 35 | 35 | { |
| 36 | 36 | $domain = $GLOBALS['egw_info']['server']['nis_domain']; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | $map = "passwd.byname"; |
| 40 | - if(!empty($GLOBALS['egw_info']['server']['nis_map'])) |
|
| 40 | + if (!empty($GLOBALS['egw_info']['server']['nis_map'])) |
|
| 41 | 41 | { |
| 42 | 42 | $map = $GLOBALS['egw_info']['server']['nis_map']; |
| 43 | 43 | } |
| 44 | - $entry = yp_match( $domain, $map, $username ); |
|
| 44 | + $entry = yp_match($domain, $map, $username); |
|
| 45 | 45 | |
| 46 | 46 | /* |
| 47 | 47 | * we assume that the map is structured in the usual |
@@ -63,11 +63,11 @@ discard block |
||
| 63 | 63 | * @param int $account_id =0 account id of user whose passwd should be changed |
| 64 | 64 | * @return boolean true if password successful changed, false otherwise |
| 65 | 65 | */ |
| 66 | - function change_password($old_passwd, $new_passwd, $account_id=0) |
|
| 66 | + function change_password($old_passwd, $new_passwd, $account_id = 0) |
|
| 67 | 67 | { |
| 68 | - unset($old_passwd, $new_passwd, $account_id); // not used but required by interface |
|
| 68 | + unset($old_passwd, $new_passwd, $account_id); // not used but required by interface |
|
| 69 | 69 | |
| 70 | 70 | // can't change passwords unless server runs as root (bad idea) |
| 71 | - return( False ); |
|
| 71 | + return(False); |
|
| 72 | 72 | } |
| 73 | 73 | } |
@@ -29,21 +29,21 @@ 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_type); // not used but required by interface |
|
| 34 | + unset($passwd_type); // not used but required by interface |
|
| 35 | 35 | |
| 36 | 36 | $local_debug = False; |
| 37 | 37 | |
| 38 | - if($local_debug) |
|
| 38 | + if ($local_debug) |
|
| 39 | 39 | { |
| 40 | 40 | echo "<b>Debug SQL: uid - $username passwd - $passwd</b>"; |
| 41 | 41 | } |
| 42 | - if (!($row = $this->db->select($this->table,'account_lid,account_pwd',array( |
|
| 42 | + if (!($row = $this->db->select($this->table, 'account_lid,account_pwd', array( |
|
| 43 | 43 | 'account_lid' => $username, |
| 44 | 44 | 'account_status' => 'A', |
| 45 | 45 | 'account_type' => 'u', |
| 46 | - ),__LINE__,__FILE__)->fetch()) || $GLOBALS['egw_info']['server']['case_sensitive_username'] && $row['account_lid'] != $username) |
|
| 46 | + ), __LINE__, __FILE__)->fetch()) || $GLOBALS['egw_info']['server']['case_sensitive_username'] && $row['account_lid'] != $username) |
|
| 47 | 47 | { |
| 48 | 48 | return false; |
| 49 | 49 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | # Apache + mod_ssl provide the data in the environment |
| 52 | 52 | # Certificate (chain) verification occurs inside mod_ssl |
| 53 | 53 | # see http://www.modssl.org/docs/2.8/ssl_howto.html#ToC6 |
| 54 | - if(!isset($_SERVER['SSL_CLIENT_S_DN'])) |
|
| 54 | + if (!isset($_SERVER['SSL_CLIENT_S_DN'])) |
|
| 55 | 55 | { |
| 56 | 56 | # if we're not doing SSL authentication, behave like auth_sql |
| 57 | 57 | return Api\Auth::compare_password($passwd, $row['account_pwd'], 'md5', strtolower($username)); |
@@ -67,9 +67,9 @@ discard block |
||
| 67 | 67 | * @param int $account_id =0 account id of user whose passwd should be changed |
| 68 | 68 | * @return boolean true if password successful changed, false otherwise |
| 69 | 69 | */ |
| 70 | - function change_password($old_passwd, $new_passwd, $account_id=0) |
|
| 70 | + function change_password($old_passwd, $new_passwd, $account_id = 0) |
|
| 71 | 71 | { |
| 72 | - unset($old_passwd, $new_passwd, $account_id); // not used but required by interface |
|
| 72 | + unset($old_passwd, $new_passwd, $account_id); // not used but required by interface |
|
| 73 | 73 | |
| 74 | 74 | // deny password changes. |
| 75 | 75 | return False; |
@@ -30,9 +30,9 @@ discard block |
||
| 30 | 30 | * @param string $passwd_type ='text' 'text' for cleartext passwords (default) |
| 31 | 31 | * @return boolean true if successful authenticated, false otherwise |
| 32 | 32 | */ |
| 33 | - function authenticate($username, $passwd, $passwd_type='text') |
|
| 33 | + function authenticate($username, $passwd, $passwd_type = 'text') |
|
| 34 | 34 | { |
| 35 | - unset($passwd_type); // not used but required by interface |
|
| 35 | + unset($passwd_type); // not used but required by interface |
|
| 36 | 36 | |
| 37 | 37 | if (pam_auth($username, get_magic_quotes_gpc() ? stripslashes($passwd) : $passwd)) |
| 38 | 38 | { |
@@ -40,12 +40,12 @@ discard block |
||
| 40 | 40 | if (!$GLOBALS['egw']->accounts->name2id($username) && |
| 41 | 41 | function_exists('posix_getpwnam') && ($data = posix_getpwnam($username))) |
| 42 | 42 | { |
| 43 | - list($fullname) = explode(',',$data['gecos']); |
|
| 44 | - $parts = explode(' ',$fullname); |
|
| 43 | + list($fullname) = explode(',', $data['gecos']); |
|
| 44 | + $parts = explode(' ', $fullname); |
|
| 45 | 45 | if (count($parts) > 1) |
| 46 | 46 | { |
| 47 | 47 | $lastname = array_pop($parts); |
| 48 | - $firstname = implode(' ',$parts); |
|
| 48 | + $firstname = implode(' ', $parts); |
|
| 49 | 49 | $email = Api\Accounts::email($firstname, $lastname, $username); |
| 50 | 50 | |
| 51 | 51 | $GLOBALS['auto_create_acct'] = array( |
@@ -69,9 +69,9 @@ discard block |
||
| 69 | 69 | * @param int $account_id =0 account id of user whose passwd should be changed |
| 70 | 70 | * @return boolean true if password successful changed, false otherwise |
| 71 | 71 | */ |
| 72 | - function change_password($old_passwd, $new_passwd, $account_id=0) |
|
| 72 | + function change_password($old_passwd, $new_passwd, $account_id = 0) |
|
| 73 | 73 | { |
| 74 | - unset($old_passwd, $new_passwd, $account_id); // not used but required by interface |
|
| 74 | + unset($old_passwd, $new_passwd, $account_id); // not used but required by interface |
|
| 75 | 75 | |
| 76 | 76 | // deny password changes. |
| 77 | 77 | return False; |
@@ -34,14 +34,14 @@ discard block |
||
| 34 | 34 | * @param string $passwd_type ='text' 'text' for cleartext passwords (default) |
| 35 | 35 | * @return boolean true if successful authenticated, false otherwise |
| 36 | 36 | */ |
| 37 | - function authenticate($username, $passwd, $passwd_type='text') |
|
| 37 | + function authenticate($username, $passwd, $passwd_type = 'text') |
|
| 38 | 38 | { |
| 39 | - unset($passwd_type); // not used but required by function signature |
|
| 39 | + unset($passwd_type); // not used but required by function signature |
|
| 40 | 40 | |
| 41 | 41 | switch ($GLOBALS['egw_info']['server']['mail_login_type']) |
| 42 | 42 | { |
| 43 | 43 | case 'vmailmgr': |
| 44 | - $username = $username . '@' . $GLOBALS['egw_info']['server']['mail_suffix']; |
|
| 44 | + $username = $username.'@'.$GLOBALS['egw_info']['server']['mail_suffix']; |
|
| 45 | 45 | break; |
| 46 | 46 | case 'email': |
| 47 | 47 | $username = $GLOBALS['egw']->accounts->id2name($username, 'account_email'); |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $mailauth = true; |
| 69 | 69 | $imap->logout(); |
| 70 | 70 | } |
| 71 | - catch(Horde_Imap_Client_Exception $e) { |
|
| 71 | + catch (Horde_Imap_Client_Exception $e) { |
|
| 72 | 72 | // throw everything but authentication failed as exception |
| 73 | 73 | if ($e->getCode() != Horde_Imap_Client_Exception::LOGIN_AUTHENTICATIONFAILED) throw $e; |
| 74 | 74 | |
@@ -85,19 +85,19 @@ discard block |
||
| 85 | 85 | case 'imap': |
| 86 | 86 | default: |
| 87 | 87 | if (!isset($port)) $port = 143; |
| 88 | - $mailauth = imap_open('{'.$host.':'.$port.'/imap/novalidate-cert}INBOX', $username , $passwd); |
|
| 88 | + $mailauth = imap_open('{'.$host.':'.$port.'/imap/novalidate-cert}INBOX', $username, $passwd); |
|
| 89 | 89 | break; |
| 90 | 90 | case 'imaps': |
| 91 | 91 | if (!isset($port)) $port = 993; |
| 92 | - $mailauth = imap_open('{'.$host.'/imap/ssl/novalidate-cert:'.$port.'}INBOX', $username , $passwd); |
|
| 92 | + $mailauth = imap_open('{'.$host.'/imap/ssl/novalidate-cert:'.$port.'}INBOX', $username, $passwd); |
|
| 93 | 93 | break; |
| 94 | 94 | case 'pop3': |
| 95 | 95 | if (!isset($port)) $port = 110; |
| 96 | - $mailauth = imap_open('{'.$host.'/pop3/novalidate-cert:'.$port.'}INBOX', $username , $passwd); |
|
| 96 | + $mailauth = imap_open('{'.$host.'/pop3/novalidate-cert:'.$port.'}INBOX', $username, $passwd); |
|
| 97 | 97 | break; |
| 98 | 98 | case 'pop3s': |
| 99 | 99 | if (!isset($port)) $port = 995; |
| 100 | - $mailauth = imap_open('{'.$host.'/pop3/ssl/novalidate-cert:'.$port.'}INBOX', $username , $passwd); |
|
| 100 | + $mailauth = imap_open('{'.$host.'/pop3/ssl/novalidate-cert:'.$port.'}INBOX', $username, $passwd); |
|
| 101 | 101 | break; |
| 102 | 102 | } |
| 103 | 103 | if ($mailauth) imap_close($mailauth); |
@@ -113,9 +113,9 @@ discard block |
||
| 113 | 113 | * @param int $account_id =0 account id of user whose passwd should be changed |
| 114 | 114 | * @return boolean true if password successful changed, false otherwise |
| 115 | 115 | */ |
| 116 | - function change_password($old_passwd, $new_passwd, $account_id=0) |
|
| 116 | + function change_password($old_passwd, $new_passwd, $account_id = 0) |
|
| 117 | 117 | { |
| 118 | - unset($old_passwd, $new_passwd, $account_id); // not used but required by function sigature |
|
| 118 | + unset($old_passwd, $new_passwd, $account_id); // not used but required by function sigature |
|
| 119 | 119 | |
| 120 | 120 | return False; |
| 121 | 121 | } |