@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @return so_sql2 |
55 | 55 | */ |
56 | - function __construct($app='',$table='',Api\Db $db=null,$column_prefix='',$no_clone=false) |
|
56 | + function __construct($app = '', $table = '', Api\Db $db = null, $column_prefix = '', $no_clone = false) |
|
57 | 57 | { |
58 | - parent::__construct($app,$table,$db,$column_prefix,$no_clone); |
|
58 | + parent::__construct($app, $table, $db, $column_prefix, $no_clone); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -68,13 +68,13 @@ discard block |
||
68 | 68 | */ |
69 | 69 | function __get($property) |
70 | 70 | { |
71 | - switch($property) |
|
71 | + switch ($property) |
|
72 | 72 | { |
73 | 73 | case 'id': |
74 | 74 | $property = $this->autoinc_id; |
75 | 75 | break; |
76 | 76 | } |
77 | - if (in_array($property,$this->db_cols) || in_array($property,$this->non_db_cols)) |
|
77 | + if (in_array($property, $this->db_cols) || in_array($property, $this->non_db_cols)) |
|
78 | 78 | { |
79 | 79 | return $this->data[$property]; |
80 | 80 | } |
@@ -88,15 +88,15 @@ discard block |
||
88 | 88 | * @param string $property |
89 | 89 | * @param mixed $value |
90 | 90 | */ |
91 | - function __set($property,$value) |
|
91 | + function __set($property, $value) |
|
92 | 92 | { |
93 | - switch($property) |
|
93 | + switch ($property) |
|
94 | 94 | { |
95 | 95 | case 'id': |
96 | 96 | $property = $this->autoinc_id; |
97 | 97 | break; |
98 | 98 | } |
99 | - if (in_array($property,$this->db_cols) || in_array($property,$this->non_db_cols)) |
|
99 | + if (in_array($property, $this->db_cols) || in_array($property, $this->non_db_cols)) |
|
100 | 100 | { |
101 | 101 | $this->data[$property] = $value; |
102 | 102 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | */ |
22 | 22 | class App extends Exception\NoPermission |
23 | 23 | { |
24 | - function __construct($msg=null,$code=101) |
|
24 | + function __construct($msg = null, $code = 101) |
|
25 | 25 | { |
26 | 26 | if (isset($GLOBALS['egw_info']['apps'][$msg])) |
27 | 27 | { |
@@ -39,6 +39,6 @@ discard block |
||
39 | 39 | '"'.$app.'"'); |
40 | 40 | } |
41 | 41 | } |
42 | - parent::__construct($msg,$code); |
|
42 | + parent::__construct($msg, $code); |
|
43 | 43 | } |
44 | 44 | } |
@@ -26,10 +26,10 @@ |
||
26 | 26 | * @param string $msg =null message, default "Entry not found!" |
27 | 27 | * @param int $code =99 numerical code, default 2 |
28 | 28 | */ |
29 | - function __construct($msg=null,$code=2) |
|
29 | + function __construct($msg = null, $code = 2) |
|
30 | 30 | { |
31 | 31 | if (is_null($msg)) $msg = lang('Entry not found!'); |
32 | 32 | |
33 | - parent::__construct($msg,$code); |
|
33 | + parent::__construct($msg, $code); |
|
34 | 34 | } |
35 | 35 | } |
@@ -28,7 +28,10 @@ |
||
28 | 28 | */ |
29 | 29 | function __construct($msg=null,$code=2) |
30 | 30 | { |
31 | - if (is_null($msg)) $msg = lang('Entry not found!'); |
|
31 | + if (is_null($msg)) |
|
32 | + { |
|
33 | + $msg = lang('Entry not found!'); |
|
34 | + } |
|
32 | 35 | |
33 | 36 | parent::__construct($msg,$code); |
34 | 37 | } |
@@ -33,7 +33,7 @@ |
||
33 | 33 | * @param string $msg |
34 | 34 | * @param int $code |
35 | 35 | */ |
36 | - function __construct($url,$app=null,$msg=null,$code=301) |
|
36 | + function __construct($url, $app = null, $msg = null, $code = 301) |
|
37 | 37 | { |
38 | 38 | $this->url = $url; |
39 | 39 | $this->app = $app; |
@@ -24,19 +24,19 @@ discard block |
||
24 | 24 | // Only variables should be assigned by reference, eg. soetemplate::tree_walk() |
25 | 25 | // Declaration of <extended method> should be compatible with <parent method>, varios places where method parameters change |
26 | 26 | // --> switching it off for now, as it makes error-log unusable |
27 | -error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT); |
|
27 | +error_reporting(E_ALL&~E_NOTICE&~E_STRICT); |
|
28 | 28 | if (function_exists('get_magic_quotes_runtime') && get_magic_quotes_runtime()) |
29 | 29 | { |
30 | 30 | set_magic_quotes_runtime(false); |
31 | 31 | } |
32 | 32 | |
33 | 33 | $egw_min_php_version = '5.4'; |
34 | -if (!function_exists('version_compare') || version_compare(PHP_VERSION,$egw_min_php_version) < 0) |
|
34 | +if (!function_exists('version_compare') || version_compare(PHP_VERSION, $egw_min_php_version) < 0) |
|
35 | 35 | { |
36 | 36 | die("EGroupware requires PHP $egw_min_php_version or greater.<br />Please contact your System Administrator to upgrade PHP!"); |
37 | 37 | } |
38 | 38 | |
39 | -if (!defined('EGW_API_INC')) define('EGW_API_INC',PHPGW_API_INC); // this is to support the header upgrade |
|
39 | +if (!defined('EGW_API_INC')) define('EGW_API_INC', PHPGW_API_INC); // this is to support the header upgrade |
|
40 | 40 | |
41 | 41 | /* Make sure the header.inc.php is current. */ |
42 | 42 | if (!isset($GLOBALS['egw_domain']) || $GLOBALS['egw_info']['server']['versions']['header'] < $GLOBALS['egw_info']['server']['versions']['current_header']) |
@@ -67,12 +67,12 @@ discard block |
||
67 | 67 | $GLOBALS['egw_info']['flags']['restored_from_session'] = true; |
68 | 68 | |
69 | 69 | // restoring the egw_info-array |
70 | - $GLOBALS['egw_info'] = array_merge($_SESSION[Session::EGW_INFO_CACHE],array('flags' => $GLOBALS['egw_info']['flags'])); |
|
70 | + $GLOBALS['egw_info'] = array_merge($_SESSION[Session::EGW_INFO_CACHE], array('flags' => $GLOBALS['egw_info']['flags'])); |
|
71 | 71 | |
72 | 72 | // include required class-definitions |
73 | 73 | if (is_array($_SESSION[Session::EGW_REQUIRED_FILES])) // all classes, which can not be autoloaded |
74 | 74 | { |
75 | - foreach($_SESSION[Session::EGW_REQUIRED_FILES] as $file) |
|
75 | + foreach ($_SESSION[Session::EGW_REQUIRED_FILES] as $file) |
|
76 | 76 | { |
77 | 77 | require_once($file); |
78 | 78 | } |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | |
82 | 82 | if (is_object($GLOBALS['egw']) && ($GLOBALS['egw'] instanceof Egw)) // only egw object has wakeup2, setups egw_minimal eg. has not! |
83 | 83 | { |
84 | - $GLOBALS['egw']->wakeup2(); // adapt the restored egw-object/enviroment to this request (eg. changed current app) |
|
84 | + $GLOBALS['egw']->wakeup2(); // adapt the restored egw-object/enviroment to this request (eg. changed current app) |
|
85 | 85 | |
86 | 86 | $GLOBALS['egw_info']['flags']['session_restore_time'] = microtime(true) - $GLOBALS['egw_info']['flags']['page_start_time']; |
87 | - if (is_object($GLOBALS['egw']->translation)) return; // exit this file, as the rest of the file creates a new egw-object and -enviroment |
|
87 | + if (is_object($GLOBALS['egw']->translation)) return; // exit this file, as the rest of the file creates a new egw-object and -enviroment |
|
88 | 88 | } |
89 | 89 | // egw object could NOT be restored from the session, create a new one |
90 | 90 | unset($GLOBALS['egw']); |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | |
110 | 110 | $GLOBALS['egw_info']['user']['domain'] = Session::search_instance( |
111 | 111 | isset($_POST['login']) ? $_POST['login'] : (isset($_SERVER['PHP_AUTH_USER']) ? $_SERVER['PHP_AUTH_USER'] : $_SERVER['REMOTE_USER']), |
112 | - Session::get_request('domain'),$GLOBALS['egw_info']['server']['default_domain'], |
|
113 | - array($_SERVER['HTTP_HOST'], $_SERVER['SERVER_NAME']),$GLOBALS['egw_domain']); |
|
112 | + Session::get_request('domain'), $GLOBALS['egw_info']['server']['default_domain'], |
|
113 | + array($_SERVER['HTTP_HOST'], $_SERVER['SERVER_NAME']), $GLOBALS['egw_domain']); |
|
114 | 114 | |
115 | 115 | $GLOBALS['egw_info']['server']['db_host'] = $GLOBALS['egw_domain'][$GLOBALS['egw_info']['user']['domain']]['db_host']; |
116 | 116 | $GLOBALS['egw_info']['server']['db_port'] = $GLOBALS['egw_domain'][$GLOBALS['egw_info']['user']['domain']]['db_port']; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | // store domain config user&pw as a hash (originals get unset) |
126 | 126 | $GLOBALS['egw_info']['server']['config_hash'] = Session::user_pw_hash($GLOBALS['egw_domain'][$GLOBALS['egw_info']['user']['domain']]['config_user'], |
127 | - $GLOBALS['egw_domain'][$GLOBALS['egw_info']['user']['domain']]['config_passwd'],true); |
|
127 | + $GLOBALS['egw_domain'][$GLOBALS['egw_info']['user']['domain']]['config_passwd'], true); |
|
128 | 128 | |
129 | 129 | if ($GLOBALS['egw_info']['flags']['currentapp'] != 'login' && !$GLOBALS['egw_info']['server']['show_domain_selectbox']) |
130 | 130 | { |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | if ($GLOBALS['egw_info']['flags']['currentapp'] != 'login') |
138 | 138 | { |
139 | 139 | $_SESSION[Session::EGW_INFO_CACHE] = $GLOBALS['egw_info']; |
140 | - unset($_SESSION[Session::EGW_INFO_CACHE]['flags']); // dont save the flags, they change on each request |
|
140 | + unset($_SESSION[Session::EGW_INFO_CACHE]['flags']); // dont save the flags, they change on each request |
|
141 | 141 | |
142 | 142 | $_SESSION[Session::EGW_OBJECT_CACHE] = serialize($GLOBALS['egw']); |
143 | 143 | } |
@@ -36,7 +36,11 @@ discard block |
||
36 | 36 | die("EGroupware requires PHP $egw_min_php_version or greater.<br />Please contact your System Administrator to upgrade PHP!"); |
37 | 37 | } |
38 | 38 | |
39 | -if (!defined('EGW_API_INC')) define('EGW_API_INC',PHPGW_API_INC); // this is to support the header upgrade |
|
39 | +if (!defined('EGW_API_INC')) |
|
40 | +{ |
|
41 | + define('EGW_API_INC',PHPGW_API_INC); |
|
42 | +} |
|
43 | +// this is to support the header upgrade |
|
40 | 44 | |
41 | 45 | /* Make sure the header.inc.php is current. */ |
42 | 46 | if (!isset($GLOBALS['egw_domain']) || $GLOBALS['egw_info']['server']['versions']['header'] < $GLOBALS['egw_info']['server']['versions']['current_header']) |
@@ -70,21 +74,32 @@ discard block |
||
70 | 74 | $GLOBALS['egw_info'] = array_merge($_SESSION[Session::EGW_INFO_CACHE],array('flags' => $GLOBALS['egw_info']['flags'])); |
71 | 75 | |
72 | 76 | // include required class-definitions |
73 | - if (is_array($_SESSION[Session::EGW_REQUIRED_FILES])) // all classes, which can not be autoloaded |
|
77 | + if (is_array($_SESSION[Session::EGW_REQUIRED_FILES])) |
|
78 | + { |
|
79 | + // all classes, which can not be autoloaded |
|
74 | 80 | { |
75 | 81 | foreach($_SESSION[Session::EGW_REQUIRED_FILES] as $file) |
76 | 82 | { |
77 | 83 | require_once($file); |
84 | + } |
|
78 | 85 | } |
79 | 86 | } |
80 | 87 | $GLOBALS['egw'] = unserialize($_SESSION[Session::EGW_OBJECT_CACHE]); |
81 | 88 | |
82 | - if (is_object($GLOBALS['egw']) && ($GLOBALS['egw'] instanceof Egw)) // only egw object has wakeup2, setups egw_minimal eg. has not! |
|
89 | + if (is_object($GLOBALS['egw']) && ($GLOBALS['egw'] instanceof Egw)) |
|
83 | 90 | { |
84 | - $GLOBALS['egw']->wakeup2(); // adapt the restored egw-object/enviroment to this request (eg. changed current app) |
|
91 | + // only egw object has wakeup2, setups egw_minimal eg. has not! |
|
92 | + { |
|
93 | + $GLOBALS['egw']->wakeup2(); |
|
94 | + } |
|
95 | + // adapt the restored egw-object/enviroment to this request (eg. changed current app) |
|
85 | 96 | |
86 | 97 | $GLOBALS['egw_info']['flags']['session_restore_time'] = microtime(true) - $GLOBALS['egw_info']['flags']['page_start_time']; |
87 | - if (is_object($GLOBALS['egw']->translation)) return; // exit this file, as the rest of the file creates a new egw-object and -enviroment |
|
98 | + if (is_object($GLOBALS['egw']->translation)) |
|
99 | + { |
|
100 | + return; |
|
101 | + } |
|
102 | + // exit this file, as the rest of the file creates a new egw-object and -enviroment |
|
88 | 103 | } |
89 | 104 | // egw object could NOT be restored from the session, create a new one |
90 | 105 | unset($GLOBALS['egw']); |
@@ -27,10 +27,10 @@ |
||
27 | 27 | * @param string $msg =null message, default "Database error!" |
28 | 28 | * @param int $code =100 |
29 | 29 | */ |
30 | - function __construct($msg=null,$code=100) |
|
30 | + function __construct($msg = null, $code = 100) |
|
31 | 31 | { |
32 | 32 | if (is_null($msg)) $msg = lang('Database error!'); |
33 | 33 | |
34 | - parent::__construct($msg,$code); |
|
34 | + parent::__construct($msg, $code); |
|
35 | 35 | } |
36 | 36 | } |
@@ -29,7 +29,10 @@ |
||
29 | 29 | */ |
30 | 30 | function __construct($msg=null,$code=100) |
31 | 31 | { |
32 | - if (is_null($msg)) $msg = lang('Database error!'); |
|
32 | + if (is_null($msg)) |
|
33 | + { |
|
34 | + $msg = lang('Database error!'); |
|
35 | + } |
|
33 | 36 | |
34 | 37 | parent::__construct($msg,$code); |
35 | 38 | } |
@@ -64,12 +64,12 @@ discard block |
||
64 | 64 | */ |
65 | 65 | static $sub_objects = array( |
66 | 66 | 'log' => 'errorlog', |
67 | - 'link' => 'bolink', // depricated use static egw_link methods |
|
67 | + 'link' => 'bolink', // depricated use static egw_link methods |
|
68 | 68 | 'datetime' => 'egw_datetime', |
69 | 69 | // classes moved to new api dir |
70 | 70 | 'template' => true, |
71 | 71 | 'applications' => 'EGroupware\\Api\\Egw\\Applications', |
72 | - 'framework' => true, // special handling in __get() |
|
72 | + 'framework' => true, // special handling in __get() |
|
73 | 73 | 'ldap' => true, |
74 | 74 | ); |
75 | 75 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | { |
96 | 96 | //error_log(__METHOD__."($name)".function_backtrace()); |
97 | 97 | |
98 | - if ($name == 'js') $name = 'framework'; // javascript class is integrated now into framework |
|
98 | + if ($name == 'js') $name = 'framework'; // javascript class is integrated now into framework |
|
99 | 99 | |
100 | 100 | if (isset($this->$name)) |
101 | 101 | { |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | if ($name != 'ADOdb') error_log(__METHOD__.": There's NO $name object! ".function_backtrace()); |
108 | 108 | return null; |
109 | 109 | } |
110 | - switch($name) |
|
110 | + switch ($name) |
|
111 | 111 | { |
112 | 112 | case 'framework': |
113 | 113 | return $this->framework = Api\Framework::factory(); |
@@ -95,7 +95,11 @@ discard block |
||
95 | 95 | { |
96 | 96 | //error_log(__METHOD__."($name)".function_backtrace()); |
97 | 97 | |
98 | - if ($name == 'js') $name = 'framework'; // javascript class is integrated now into framework |
|
98 | + if ($name == 'js') |
|
99 | + { |
|
100 | + $name = 'framework'; |
|
101 | + } |
|
102 | + // javascript class is integrated now into framework |
|
99 | 103 | |
100 | 104 | if (isset($this->$name)) |
101 | 105 | { |
@@ -104,7 +108,10 @@ discard block |
||
104 | 108 | |
105 | 109 | if (!isset(self::$sub_objects[$name]) && !class_exists('EGroupware\\Api\\'.ucfirst($name)) && !class_exists($name)) |
106 | 110 | { |
107 | - if ($name != 'ADOdb') error_log(__METHOD__.": There's NO $name object! ".function_backtrace()); |
|
111 | + if ($name != 'ADOdb') |
|
112 | + { |
|
113 | + error_log(__METHOD__.": There's NO $name object! ".function_backtrace()); |
|
114 | + } |
|
108 | 115 | return null; |
109 | 116 | } |
110 | 117 | switch($name) |
@@ -121,7 +128,10 @@ discard block |
||
121 | 128 | return $this->ldap = Api\Ldap::factory(false); |
122 | 129 | default: |
123 | 130 | $class = isset(self::$sub_objects[$name]) ? self::$sub_objects[$name] : 'EGroupware\\Api\\'.ucfirst($name); |
124 | - if (!class_exists($class)) $class = $name; |
|
131 | + if (!class_exists($class)) |
|
132 | + { |
|
133 | + $class = $name; |
|
134 | + } |
|
125 | 135 | break; |
126 | 136 | } |
127 | 137 | return $this->$name = new $class(); |
@@ -58,21 +58,21 @@ discard block |
||
58 | 58 | */ |
59 | 59 | function read_repository() |
60 | 60 | { |
61 | - if (!isset($GLOBALS['egw_info']['apps']) || !is_array($GLOBALS['egw_info']['apps'])) |
|
61 | + if (!isset($GLOBALS['egw_info']['apps']) || !is_array($GLOBALS['egw_info']['apps'])) |
|
62 | 62 | { |
63 | 63 | $this->read_installed_apps(); |
64 | 64 | } |
65 | 65 | $this->data = Array(); |
66 | - if(!$this->account_id) |
|
66 | + if (!$this->account_id) |
|
67 | 67 | { |
68 | 68 | return False; |
69 | 69 | } |
70 | 70 | $apps = $GLOBALS['egw']->acl->get_user_applications($this->account_id); |
71 | - foreach(array_keys($GLOBALS['egw_info']['apps']) as $app) |
|
71 | + foreach (array_keys($GLOBALS['egw_info']['apps']) as $app) |
|
72 | 72 | { |
73 | 73 | if (isset($apps[$app]) && $apps[$app]) |
74 | 74 | { |
75 | - $this->data[$app] =& $GLOBALS['egw_info']['apps'][$app]; |
|
75 | + $this->data[$app] = & $GLOBALS['egw_info']['apps'][$app]; |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 | return $this->data; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | function read_installed_apps() |
86 | 86 | { |
87 | - foreach($this->db->select($this->table_name,'*',false,__LINE__,__FILE__,false,'ORDER BY app_order ASC') as $row) |
|
87 | + foreach ($this->db->select($this->table_name, '*', false, __LINE__, __FILE__, false, 'ORDER BY app_order ASC') as $row) |
|
88 | 88 | { |
89 | 89 | $title = $app_name = $row['app_name']; |
90 | 90 |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | class Applications |
20 | 20 | { |
21 | 21 | var $account_id; |
22 | - var $data = Array(); |
|
22 | + var $data = array(); |
|
23 | 23 | /** |
24 | 24 | * Reference to the global db class |
25 | 25 | * |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | { |
63 | 63 | $this->read_installed_apps(); |
64 | 64 | } |
65 | - $this->data = Array(); |
|
65 | + $this->data = array(); |
|
66 | 66 | if(!$this->account_id) |
67 | 67 | { |
68 | 68 | return False; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | { |
93 | 93 | $title = $t; |
94 | 94 | } |
95 | - $GLOBALS['egw_info']['apps'][$app_name] = Array( |
|
95 | + $GLOBALS['egw_info']['apps'][$app_name] = array( |
|
96 | 96 | 'title' => $title, |
97 | 97 | 'name' => $app_name, |
98 | 98 | 'enabled' => True, |
@@ -106,17 +106,17 @@ discard block |
||
106 | 106 | * @param array $old =null old/last state of the entry or null for a new entry |
107 | 107 | * @return mixed |
108 | 108 | */ |
109 | - function get_config($name,$data,$old=null) |
|
109 | + function get_config($name, $data, $old = null) |
|
110 | 110 | { |
111 | - unset($old); // not used, but required by function signature |
|
111 | + unset($old); // not used, but required by function signature |
|
112 | 112 | |
113 | - switch($name) |
|
113 | + switch ($name) |
|
114 | 114 | { |
115 | 115 | case 'copy': |
116 | 116 | if ($data['is_contactform']) |
117 | 117 | { |
118 | - $copy = preg_split('/, ?/',$data['email_contactform']); |
|
119 | - if ($data['email_copytoreceiver']) $copy[] = $data['email']; |
|
118 | + $copy = preg_split('/, ?/', $data['email_contactform']); |
|
119 | + if ($data['email_copytoreceiver']) $copy[] = $data['email']; |
|
120 | 120 | return $copy; |
121 | 121 | } |
122 | 122 | break; |
@@ -144,27 +144,27 @@ discard block |
||
144 | 144 | * @param array $changed_fields =null changed fields from ealier call to $this->changed_fields($data,$old), to not compute it again |
145 | 145 | * @return int number of log-entries made |
146 | 146 | */ |
147 | - protected function save_history(array $data,array $old=null,$deleted=null,array $changed_fields=null) |
|
147 | + protected function save_history(array $data, array $old = null, $deleted = null, array $changed_fields = null) |
|
148 | 148 | { |
149 | 149 | if (is_null($changed_fields)) |
150 | 150 | { |
151 | - $changed_fields = self::changed_fields($data,$old); |
|
151 | + $changed_fields = self::changed_fields($data, $old); |
|
152 | 152 | } |
153 | 153 | if (!$changed_fields) return 0; |
154 | 154 | |
155 | - foreach(array('adr_one_countryname' => 'adr_one_countrycode', 'adr_two_countryname' => 'adr_two_countrycode') as $name => $code) |
|
155 | + foreach (array('adr_one_countryname' => 'adr_one_countrycode', 'adr_two_countryname' => 'adr_two_countrycode') as $name => $code) |
|
156 | 156 | { |
157 | 157 | // Only codes involved, but old text name is automatically added when loaded |
158 | - if($old[$code] && $data[$code] && ($key = array_search($name, $changed_fields)) !== false) |
|
158 | + if ($old[$code] && $data[$code] && ($key = array_search($name, $changed_fields)) !== false) |
|
159 | 159 | { |
160 | 160 | unset($changed_fields[$key]); |
161 | 161 | continue; |
162 | 162 | } |
163 | 163 | |
164 | 164 | // Code and a text name |
165 | - if(in_array($name, $changed_fields) && in_array($code, $changed_fields)) |
|
165 | + if (in_array($name, $changed_fields) && in_array($code, $changed_fields)) |
|
166 | 166 | { |
167 | - if($data[$code]) |
|
167 | + if ($data[$code]) |
|
168 | 168 | { |
169 | 169 | $data[$name] = Api\Country::get_full_name($data[$code], true); |
170 | 170 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | } |
173 | 173 | } |
174 | 174 | //error_log(__METHOD__.__LINE__.' ChangedFields:'.array2string($changed_fields)); |
175 | - return parent::save_history($data,$old,$deleted,$changed_fields); |
|
175 | + return parent::save_history($data, $old, $deleted, $changed_fields); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | /** |
@@ -183,9 +183,9 @@ discard block |
||
183 | 183 | * @param int|string $receiver nummeric account_id or email address |
184 | 184 | * @return string |
185 | 185 | */ |
186 | - protected function get_message($data,$old,$receiver=null) |
|
186 | + protected function get_message($data, $old, $receiver = null) |
|
187 | 187 | { |
188 | - unset($receiver); // not used, but required by function signature |
|
188 | + unset($receiver); // not used, but required by function signature |
|
189 | 189 | |
190 | 190 | if (!$data['modified'] || !$old) |
191 | 191 | { |
@@ -207,9 +207,9 @@ discard block |
||
207 | 207 | * @param int|string $receiver nummeric account_id or email address |
208 | 208 | * @return string |
209 | 209 | */ |
210 | - protected function get_subject($data,$old,$deleted=null,$receiver=null) |
|
210 | + protected function get_subject($data, $old, $deleted = null, $receiver = null) |
|
211 | 211 | { |
212 | - unset($old, $deleted, $receiver); // not used, but required by function signature |
|
212 | + unset($old, $deleted, $receiver); // not used, but required by function signature |
|
213 | 213 | |
214 | 214 | if ($data['is_contactform']) |
215 | 215 | { |
@@ -225,15 +225,15 @@ discard block |
||
225 | 225 | * @param int|string $receiver nummeric account_id or email address |
226 | 226 | * @return array of details as array with values for keys 'label','value','type' |
227 | 227 | */ |
228 | - function get_details($data,$receiver=null) |
|
228 | + function get_details($data, $receiver = null) |
|
229 | 229 | { |
230 | - unset($receiver); // not used, but required by function signature |
|
230 | + unset($receiver); // not used, but required by function signature |
|
231 | 231 | |
232 | - foreach($this->contacts->contact_fields as $name => $label) |
|
232 | + foreach ($this->contacts->contact_fields as $name => $label) |
|
233 | 233 | { |
234 | 234 | if (!$data[$name] && $name != 'owner') continue; |
235 | 235 | |
236 | - switch($name) |
|
236 | + switch ($name) |
|
237 | 237 | { |
238 | 238 | case 'n_prefix': case 'n_given': case 'n_middle': case 'n_family': case 'n_suffix': // already in n_fn |
239 | 239 | case 'n_fileas': case 'id': case 'tid': |
@@ -263,13 +263,13 @@ discard block |
||
263 | 263 | if ($data[$name]) |
264 | 264 | { |
265 | 265 | $cats = array(); |
266 | - foreach(is_array($data[$name]) ? $data[$name] : explode(',',$data[$name]) as $cat_id) |
|
266 | + foreach (is_array($data[$name]) ? $data[$name] : explode(',', $data[$name]) as $cat_id) |
|
267 | 267 | { |
268 | 268 | $cats[] = $GLOBALS['egw']->cats->id2name($cat_id); |
269 | 269 | } |
270 | 270 | $details[$name] = array( |
271 | 271 | 'label' => $label, |
272 | - 'value' => explode(', ',$cats), |
|
272 | + 'value' => explode(', ', $cats), |
|
273 | 273 | ); |
274 | 274 | } |
275 | 275 | case 'note': |
@@ -116,7 +116,10 @@ discard block |
||
116 | 116 | if ($data['is_contactform']) |
117 | 117 | { |
118 | 118 | $copy = preg_split('/, ?/',$data['email_contactform']); |
119 | - if ($data['email_copytoreceiver']) $copy[] = $data['email']; |
|
119 | + if ($data['email_copytoreceiver']) |
|
120 | + { |
|
121 | + $copy[] = $data['email']; |
|
122 | + } |
|
120 | 123 | return $copy; |
121 | 124 | } |
122 | 125 | break; |
@@ -150,7 +153,10 @@ discard block |
||
150 | 153 | { |
151 | 154 | $changed_fields = self::changed_fields($data,$old); |
152 | 155 | } |
153 | - if (!$changed_fields) return 0; |
|
156 | + if (!$changed_fields) |
|
157 | + { |
|
158 | + return 0; |
|
159 | + } |
|
154 | 160 | |
155 | 161 | foreach(array('adr_one_countryname' => 'adr_one_countrycode', 'adr_two_countryname' => 'adr_two_countrycode') as $name => $code) |
156 | 162 | { |
@@ -231,7 +237,10 @@ discard block |
||
231 | 237 | |
232 | 238 | foreach($this->contacts->contact_fields as $name => $label) |
233 | 239 | { |
234 | - if (!$data[$name] && $name != 'owner') continue; |
|
240 | + if (!$data[$name] && $name != 'owner') |
|
241 | + { |
|
242 | + continue; |
|
243 | + } |
|
235 | 244 | |
236 | 245 | switch($name) |
237 | 246 | { |