@@ -84,11 +84,20 @@ discard block |
||
84 | 84 | $this->detection = new setup_detection(); |
85 | 85 | $this->process = new setup_process(); |
86 | 86 | |
87 | - if (preg_match('/^[a-z0-9-]+$/i', $_REQUEST['system_charset'])) $this->system_charset = $_REQUEST['system_charset']; |
|
87 | + if (preg_match('/^[a-z0-9-]+$/i', $_REQUEST['system_charset'])) |
|
88 | + { |
|
89 | + $this->system_charset = $_REQUEST['system_charset']; |
|
90 | + } |
|
88 | 91 | |
89 | 92 | /* The setup application needs these */ |
90 | - if ($html) $this->html = new setup_html(); |
|
91 | - if ($translation) $this->translation = new setup_translation(); |
|
93 | + if ($html) |
|
94 | + { |
|
95 | + $this->html = new setup_html(); |
|
96 | + } |
|
97 | + if ($translation) |
|
98 | + { |
|
99 | + $this->translation = new setup_translation(); |
|
100 | + } |
|
92 | 101 | } |
93 | 102 | |
94 | 103 | /** |
@@ -131,12 +140,15 @@ discard block |
||
131 | 140 | $this->db_charset_was = $this->db->Link_ID->GetCharSet(); // needed for the update |
132 | 141 | |
133 | 142 | // we can NOT set the DB charset for mysql, if the api version < 1.0.1.019, as it would mess up the DB content!!! |
134 | - if (substr($this->db->Type,0,5) == 'mysql') // we need to check the api version |
|
143 | + if (substr($this->db->Type,0,5) == 'mysql') |
|
144 | + { |
|
145 | + // we need to check the api version |
|
135 | 146 | { |
136 | 147 | $api_version = $this->db->select($this->applications_table,'app_version',array( |
137 | 148 | 'app_name' => 'phpgwapi', |
138 | 149 | ),__LINE__,__FILE__)->fetchColumn(); |
139 | 150 | } |
151 | + } |
|
140 | 152 | if (!$api_version || !$this->alessthanb($api_version,'1.0.1.019')) |
141 | 153 | { |
142 | 154 | $this->db->Link_ID->SetCharSet($this->system_charset); |
@@ -205,7 +217,10 @@ discard block |
||
205 | 217 | } |
206 | 218 | else |
207 | 219 | { |
208 | - if (!isset($_SESSION)) self::session_start(); |
|
220 | + if (!isset($_SESSION)) |
|
221 | + { |
|
222 | + self::session_start(); |
|
223 | + } |
|
209 | 224 | $ConfigLang = $_SESSION['ConfigLang']; |
210 | 225 | } |
211 | 226 | $matches = null; |
@@ -253,14 +268,20 @@ discard block |
||
253 | 268 | case PHP_SESSION_DISABLED: |
254 | 269 | throw new \ErrorException('EGroupware requires PHP session extension!'); |
255 | 270 | case PHP_SESSION_NONE: |
256 | - if (headers_sent()) return false; |
|
271 | + if (headers_sent()) |
|
272 | + { |
|
273 | + return false; |
|
274 | + } |
|
257 | 275 | ini_set('session.use_cookie', true); |
258 | 276 | session_name(self::SESSIONID); |
259 | 277 | session_set_cookie_params(0, '/', self::cookiedomain(), |
260 | 278 | // if called via HTTPS, only send cookie for https and only allow cookie access via HTTP (true) |
261 | 279 | Api\Header\Http::schema() === 'https', true); |
262 | 280 | |
263 | - if (isset($_COOKIE[self::SESSIONID])) session_id($_COOKIE[self::SESSIONID]); |
|
281 | + if (isset($_COOKIE[self::SESSIONID])) |
|
282 | + { |
|
283 | + session_id($_COOKIE[self::SESSIONID]); |
|
284 | + } |
|
264 | 285 | |
265 | 286 | $ok = @session_start(); // suppress notice if session already started or warning in CLI |
266 | 287 | break; |
@@ -478,7 +499,10 @@ discard block |
||
478 | 499 | */ |
479 | 500 | function register_app($appname, $_enable=99, array $setup_info=null) |
480 | 501 | { |
481 | - if (!isset($setup_info)) $setup_info = $GLOBALS['setup_info']; |
|
502 | + if (!isset($setup_info)) |
|
503 | + { |
|
504 | + $setup_info = $GLOBALS['setup_info']; |
|
505 | + } |
|
482 | 506 | |
483 | 507 | if(!$appname) |
484 | 508 | { |
@@ -586,7 +610,10 @@ discard block |
||
586 | 610 | */ |
587 | 611 | function update_app($appname, array $setup_info=null) |
588 | 612 | { |
589 | - if (!isset($setup_info)) $setup_info = $GLOBALS['setup_info']; |
|
613 | + if (!isset($setup_info)) |
|
614 | + { |
|
615 | + $setup_info = $GLOBALS['setup_info']; |
|
616 | + } |
|
590 | 617 | |
591 | 618 | if(!$appname) |
592 | 619 | { |
@@ -738,7 +765,10 @@ discard block |
||
738 | 765 | { |
739 | 766 | $GLOBALS['settings'] = array(); |
740 | 767 | include_once($file); |
741 | - if ($GLOBALS['settings']) $settings = array_merge($settings,$GLOBALS['settings']); |
|
768 | + if ($GLOBALS['settings']) |
|
769 | + { |
|
770 | + $settings = array_merge($settings,$GLOBALS['settings']); |
|
771 | + } |
|
742 | 772 | } |
743 | 773 | $default = $forced = array(); |
744 | 774 | foreach($settings as $name => $setting) |
@@ -820,52 +850,72 @@ discard block |
||
820 | 850 | |
821 | 851 | for($i=0;$i<count($testa);$i++) |
822 | 852 | { |
823 | - if($DEBUG) { echo'<br>Checking if '. (int)$testa[$i] . ' is less than ' . (int)$testb[$i] . ' ...'; } |
|
853 | + if($DEBUG) |
|
854 | + { |
|
855 | +echo'<br>Checking if '. (int)$testa[$i] . ' is less than ' . (int)$testb[$i] . ' ...'; } |
|
824 | 856 | if((int)$testa[$i] < (int)$testb[$i]) |
825 | 857 | { |
826 | - if ($DEBUG) { echo ' yes.'; } |
|
858 | + if ($DEBUG) |
|
859 | + { |
|
860 | +echo ' yes.'; } |
|
827 | 861 | $less++; |
828 | 862 | if($i<3) |
829 | 863 | { |
830 | 864 | /* Ensure that this is definitely smaller */ |
831 | - if($DEBUG) { echo" This is the $num[$i] octet, so A is definitely less than B."; } |
|
865 | + if($DEBUG) |
|
866 | + { |
|
867 | +echo" This is the $num[$i] octet, so A is definitely less than B."; } |
|
832 | 868 | $less = 5; |
833 | 869 | break; |
834 | 870 | } |
835 | 871 | } |
836 | 872 | elseif((int)$testa[$i] > (int)$testb[$i]) |
837 | 873 | { |
838 | - if($DEBUG) { echo ' no.'; } |
|
874 | + if($DEBUG) |
|
875 | + { |
|
876 | +echo ' no.'; } |
|
839 | 877 | $less--; |
840 | 878 | if($i<2) |
841 | 879 | { |
842 | 880 | /* Ensure that this is definitely greater */ |
843 | - if($DEBUG) { echo" This is the $num[$i] octet, so A is definitely greater than B."; } |
|
881 | + if($DEBUG) |
|
882 | + { |
|
883 | +echo" This is the $num[$i] octet, so A is definitely greater than B."; } |
|
844 | 884 | $less = -5; |
845 | 885 | break; |
846 | 886 | } |
847 | 887 | } |
848 | 888 | else |
849 | 889 | { |
850 | - if($DEBUG) { echo ' no, they are equal or of different length.'; } |
|
890 | + if($DEBUG) |
|
891 | + { |
|
892 | +echo ' no, they are equal or of different length.'; } |
|
851 | 893 | // makes sure eg. '1.0.0' is counted less the '1.0.0.xxx' ! |
852 | 894 | $less = count($testa) < count($testb) ? 1 : 0; |
853 | 895 | } |
854 | 896 | } |
855 | - if($DEBUG) { echo '<br>Check value is: "'.$less.'"'; } |
|
897 | + if($DEBUG) |
|
898 | + { |
|
899 | +echo '<br>Check value is: "'.$less.'"'; } |
|
856 | 900 | if($less>0) |
857 | 901 | { |
858 | - if($DEBUG) { echo '<br>A is less than B'; } |
|
902 | + if($DEBUG) |
|
903 | + { |
|
904 | +echo '<br>A is less than B'; } |
|
859 | 905 | return True; |
860 | 906 | } |
861 | 907 | elseif($less<0) |
862 | 908 | { |
863 | - if($DEBUG) { echo '<br>A is greater than B'; } |
|
909 | + if($DEBUG) |
|
910 | + { |
|
911 | +echo '<br>A is greater than B'; } |
|
864 | 912 | return False; |
865 | 913 | } |
866 | 914 | else |
867 | 915 | { |
868 | - if($DEBUG) { echo '<br>A is equal to B'; } |
|
916 | + if($DEBUG) |
|
917 | + { |
|
918 | +echo '<br>A is equal to B'; } |
|
869 | 919 | return False; |
870 | 920 | } |
871 | 921 | } |
@@ -902,51 +952,71 @@ discard block |
||
902 | 952 | |
903 | 953 | for($i=0;$i<count($testa);$i++) |
904 | 954 | { |
905 | - if($DEBUG) { echo'<br>Checking if '. (int)$testa[$i] . ' is more than ' . (int)$testb[$i] . ' ...'; } |
|
955 | + if($DEBUG) |
|
956 | + { |
|
957 | +echo'<br>Checking if '. (int)$testa[$i] . ' is more than ' . (int)$testb[$i] . ' ...'; } |
|
906 | 958 | if((int)$testa[$i] > (int)$testb[$i]) |
907 | 959 | { |
908 | - if($DEBUG) { echo ' yes.'; } |
|
960 | + if($DEBUG) |
|
961 | + { |
|
962 | +echo ' yes.'; } |
|
909 | 963 | $less++; |
910 | 964 | if($i<3) |
911 | 965 | { |
912 | 966 | /* Ensure that this is definitely greater */ |
913 | - if($DEBUG) { echo" This is the $num[$i] octet, so A is definitely greater than B."; } |
|
967 | + if($DEBUG) |
|
968 | + { |
|
969 | +echo" This is the $num[$i] octet, so A is definitely greater than B."; } |
|
914 | 970 | $less = 5; |
915 | 971 | break; |
916 | 972 | } |
917 | 973 | } |
918 | 974 | elseif((int)$testa[$i] < (int)$testb[$i]) |
919 | 975 | { |
920 | - if($DEBUG) { echo ' no.'; } |
|
976 | + if($DEBUG) |
|
977 | + { |
|
978 | +echo ' no.'; } |
|
921 | 979 | $less--; |
922 | 980 | if($i<2) |
923 | 981 | { |
924 | 982 | /* Ensure that this is definitely smaller */ |
925 | - if($DEBUG) { echo" This is the $num[$i] octet, so A is definitely less than B."; } |
|
983 | + if($DEBUG) |
|
984 | + { |
|
985 | +echo" This is the $num[$i] octet, so A is definitely less than B."; } |
|
926 | 986 | $less = -5; |
927 | 987 | break; |
928 | 988 | } |
929 | 989 | } |
930 | 990 | else |
931 | 991 | { |
932 | - if($DEBUG) { echo ' no, they are equal.'; } |
|
992 | + if($DEBUG) |
|
993 | + { |
|
994 | +echo ' no, they are equal.'; } |
|
933 | 995 | $less = 0; |
934 | 996 | } |
935 | 997 | } |
936 | - if($DEBUG) { echo '<br>Check value is: "'.$less.'"'; } |
|
998 | + if($DEBUG) |
|
999 | + { |
|
1000 | +echo '<br>Check value is: "'.$less.'"'; } |
|
937 | 1001 | if($less>0) |
938 | 1002 | { |
939 | - if($DEBUG) { echo '<br>A is greater than B'; } |
|
1003 | + if($DEBUG) |
|
1004 | + { |
|
1005 | +echo '<br>A is greater than B'; } |
|
940 | 1006 | return True; |
941 | 1007 | } |
942 | 1008 | elseif($less<0) |
943 | 1009 | { |
944 | - if($DEBUG) { echo '<br>A is less than B'; } |
|
1010 | + if($DEBUG) |
|
1011 | + { |
|
1012 | +echo '<br>A is less than B'; } |
|
945 | 1013 | return False; |
946 | 1014 | } |
947 | 1015 | else |
948 | 1016 | { |
949 | - if($DEBUG) { echo '<br>A is equal to B'; } |
|
1017 | + if($DEBUG) |
|
1018 | + { |
|
1019 | +echo '<br>A is equal to B'; } |
|
950 | 1020 | return False; |
951 | 1021 | } |
952 | 1022 | } |
@@ -983,7 +1053,10 @@ discard block |
||
983 | 1053 | echo "<p><b>".$e->getMessage()."</b></p>\n"; |
984 | 1054 | return false; |
985 | 1055 | } |
986 | - if (!isset($GLOBALS['egw']->accounts)) $GLOBALS['egw']->accounts = $this->accounts; |
|
1056 | + if (!isset($GLOBALS['egw']->accounts)) |
|
1057 | + { |
|
1058 | + $GLOBALS['egw']->accounts = $this->accounts; |
|
1059 | + } |
|
987 | 1060 | Api\Accounts::cache_invalidate(); // the cache is shared for all instances of the class |
988 | 1061 | } |
989 | 1062 | return true; |
@@ -1020,7 +1093,10 @@ discard block |
||
1020 | 1093 | $passwd = $_passwd; |
1021 | 1094 | if ($username == 'anonymous') |
1022 | 1095 | { |
1023 | - if (!isset($this->anonpw)) $this->anonpw = Api\Auth::randomstring(16); |
|
1096 | + if (!isset($this->anonpw)) |
|
1097 | + { |
|
1098 | + $this->anonpw = Api\Auth::randomstring(16); |
|
1099 | + } |
|
1024 | 1100 | $passwd = $anonpw = $this->anonpw; |
1025 | 1101 | } |
1026 | 1102 | |
@@ -1091,11 +1167,17 @@ discard block |
||
1091 | 1167 | 'account_lid' => $username, |
1092 | 1168 | )); |
1093 | 1169 | } |
1094 | - if ($primary_group) // only for users, NOT groups |
|
1170 | + if ($primary_group) |
|
1171 | + { |
|
1172 | + // only for users, NOT groups |
|
1095 | 1173 | { |
1096 | 1174 | $this->set_memberships(array($primary_group_id), $accountid); |
1175 | + } |
|
1097 | 1176 | |
1098 | - if (!$changepw) $this->add_acl('preferences','nopasswordchange',$accountid); |
|
1177 | + if (!$changepw) |
|
1178 | + { |
|
1179 | + $this->add_acl('preferences','nopasswordchange',$accountid); |
|
1180 | + } |
|
1099 | 1181 | } |
1100 | 1182 | //error_log("setup::add_account('$username','$first','$last',\$passwd,'$primary_group',$changepw,'$email') successfull created accountid=$accountid"); |
1101 | 1183 | return $accountid; |
@@ -1132,7 +1214,10 @@ discard block |
||
1132 | 1214 | function accounts_exist() |
1133 | 1215 | { |
1134 | 1216 | try { |
1135 | - if (!$this->setup_account_object()) return false; |
|
1217 | + if (!$this->setup_account_object()) |
|
1218 | + { |
|
1219 | + return false; |
|
1220 | + } |
|
1136 | 1221 | |
1137 | 1222 | $this->accounts->search(array( |
1138 | 1223 | 'type' => 'accounts', |
@@ -1219,9 +1304,15 @@ discard block |
||
1219 | 1304 | { |
1220 | 1305 | static $table_names = False; |
1221 | 1306 | |
1222 | - if (!$table_names || $force_refresh) $table_names = $this->db->table_names(); |
|
1307 | + if (!$table_names || $force_refresh) |
|
1308 | + { |
|
1309 | + $table_names = $this->db->table_names(); |
|
1310 | + } |
|
1223 | 1311 | |
1224 | - if (!$table_names) return false; |
|
1312 | + if (!$table_names) |
|
1313 | + { |
|
1314 | + return false; |
|
1315 | + } |
|
1225 | 1316 | |
1226 | 1317 | foreach($table_names as $data) |
1227 | 1318 | { |
@@ -1251,10 +1342,13 @@ discard block |
||
1251 | 1342 | { |
1252 | 1343 | $table = $this->table_exist($tables,$force_refresh); |
1253 | 1344 | |
1254 | - if ($table && $table != $this->$name) // only overwrite the default name, if we realy got one (important for new installs) |
|
1345 | + if ($table && $table != $this->$name) |
|
1346 | + { |
|
1347 | + // only overwrite the default name, if we realy got one (important for new installs) |
|
1255 | 1348 | { |
1256 | 1349 | $this->$name = $table; |
1257 | 1350 | } |
1351 | + } |
|
1258 | 1352 | //echo "<p>setup::set_table_names: $name = '{$this->$name}'</p>\n"; |
1259 | 1353 | } |
1260 | 1354 | } |