@@ -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; |
@@ -259,7 +274,10 @@ discard block |
||
| 259 | 274 | // if called via HTTPS, only send cookie for https and only allow cookie access via HTTP (true) |
| 260 | 275 | Api\Header\Http::schema() === 'https', true); |
| 261 | 276 | |
| 262 | - if (isset($_COOKIE[self::SESSIONID])) session_id($_COOKIE[self::SESSIONID]); |
|
| 277 | + if (isset($_COOKIE[self::SESSIONID])) |
|
| 278 | + { |
|
| 279 | + session_id($_COOKIE[self::SESSIONID]); |
|
| 280 | + } |
|
| 263 | 281 | |
| 264 | 282 | $ok = @session_start(); // suppress notice if session already started or warning in CLI |
| 265 | 283 | break; |
@@ -477,7 +495,10 @@ discard block |
||
| 477 | 495 | */ |
| 478 | 496 | function register_app($appname, $_enable=99, array $setup_info=null) |
| 479 | 497 | { |
| 480 | - if (!isset($setup_info)) $setup_info = $GLOBALS['setup_info']; |
|
| 498 | + if (!isset($setup_info)) |
|
| 499 | + { |
|
| 500 | + $setup_info = $GLOBALS['setup_info']; |
|
| 501 | + } |
|
| 481 | 502 | |
| 482 | 503 | if(!$appname) |
| 483 | 504 | { |
@@ -585,7 +606,10 @@ discard block |
||
| 585 | 606 | */ |
| 586 | 607 | function update_app($appname, array $setup_info=null) |
| 587 | 608 | { |
| 588 | - if (!isset($setup_info)) $setup_info = $GLOBALS['setup_info']; |
|
| 609 | + if (!isset($setup_info)) |
|
| 610 | + { |
|
| 611 | + $setup_info = $GLOBALS['setup_info']; |
|
| 612 | + } |
|
| 589 | 613 | |
| 590 | 614 | if(!$appname) |
| 591 | 615 | { |
@@ -737,7 +761,10 @@ discard block |
||
| 737 | 761 | { |
| 738 | 762 | $GLOBALS['settings'] = array(); |
| 739 | 763 | include_once($file); |
| 740 | - if ($GLOBALS['settings']) $settings = array_merge($settings,$GLOBALS['settings']); |
|
| 764 | + if ($GLOBALS['settings']) |
|
| 765 | + { |
|
| 766 | + $settings = array_merge($settings,$GLOBALS['settings']); |
|
| 767 | + } |
|
| 741 | 768 | } |
| 742 | 769 | $default = $forced = array(); |
| 743 | 770 | foreach($settings as $name => $setting) |
@@ -819,52 +846,72 @@ discard block |
||
| 819 | 846 | |
| 820 | 847 | for($i=0;$i<count($testa);$i++) |
| 821 | 848 | { |
| 822 | - if($DEBUG) { echo'<br>Checking if '. (int)$testa[$i] . ' is less than ' . (int)$testb[$i] . ' ...'; } |
|
| 849 | + if($DEBUG) |
|
| 850 | + { |
|
| 851 | +echo'<br>Checking if '. (int)$testa[$i] . ' is less than ' . (int)$testb[$i] . ' ...'; } |
|
| 823 | 852 | if((int)$testa[$i] < (int)$testb[$i]) |
| 824 | 853 | { |
| 825 | - if ($DEBUG) { echo ' yes.'; } |
|
| 854 | + if ($DEBUG) |
|
| 855 | + { |
|
| 856 | +echo ' yes.'; } |
|
| 826 | 857 | $less++; |
| 827 | 858 | if($i<3) |
| 828 | 859 | { |
| 829 | 860 | /* Ensure that this is definitely smaller */ |
| 830 | - if($DEBUG) { echo" This is the $num[$i] octet, so A is definitely less than B."; } |
|
| 861 | + if($DEBUG) |
|
| 862 | + { |
|
| 863 | +echo" This is the $num[$i] octet, so A is definitely less than B."; } |
|
| 831 | 864 | $less = 5; |
| 832 | 865 | break; |
| 833 | 866 | } |
| 834 | 867 | } |
| 835 | 868 | elseif((int)$testa[$i] > (int)$testb[$i]) |
| 836 | 869 | { |
| 837 | - if($DEBUG) { echo ' no.'; } |
|
| 870 | + if($DEBUG) |
|
| 871 | + { |
|
| 872 | +echo ' no.'; } |
|
| 838 | 873 | $less--; |
| 839 | 874 | if($i<2) |
| 840 | 875 | { |
| 841 | 876 | /* Ensure that this is definitely greater */ |
| 842 | - if($DEBUG) { echo" This is the $num[$i] octet, so A is definitely greater than B."; } |
|
| 877 | + if($DEBUG) |
|
| 878 | + { |
|
| 879 | +echo" This is the $num[$i] octet, so A is definitely greater than B."; } |
|
| 843 | 880 | $less = -5; |
| 844 | 881 | break; |
| 845 | 882 | } |
| 846 | 883 | } |
| 847 | 884 | else |
| 848 | 885 | { |
| 849 | - if($DEBUG) { echo ' no, they are equal or of different length.'; } |
|
| 886 | + if($DEBUG) |
|
| 887 | + { |
|
| 888 | +echo ' no, they are equal or of different length.'; } |
|
| 850 | 889 | // makes sure eg. '1.0.0' is counted less the '1.0.0.xxx' ! |
| 851 | 890 | $less = count($testa) < count($testb) ? 1 : 0; |
| 852 | 891 | } |
| 853 | 892 | } |
| 854 | - if($DEBUG) { echo '<br>Check value is: "'.$less.'"'; } |
|
| 893 | + if($DEBUG) |
|
| 894 | + { |
|
| 895 | +echo '<br>Check value is: "'.$less.'"'; } |
|
| 855 | 896 | if($less>0) |
| 856 | 897 | { |
| 857 | - if($DEBUG) { echo '<br>A is less than B'; } |
|
| 898 | + if($DEBUG) |
|
| 899 | + { |
|
| 900 | +echo '<br>A is less than B'; } |
|
| 858 | 901 | return True; |
| 859 | 902 | } |
| 860 | 903 | elseif($less<0) |
| 861 | 904 | { |
| 862 | - if($DEBUG) { echo '<br>A is greater than B'; } |
|
| 905 | + if($DEBUG) |
|
| 906 | + { |
|
| 907 | +echo '<br>A is greater than B'; } |
|
| 863 | 908 | return False; |
| 864 | 909 | } |
| 865 | 910 | else |
| 866 | 911 | { |
| 867 | - if($DEBUG) { echo '<br>A is equal to B'; } |
|
| 912 | + if($DEBUG) |
|
| 913 | + { |
|
| 914 | +echo '<br>A is equal to B'; } |
|
| 868 | 915 | return False; |
| 869 | 916 | } |
| 870 | 917 | } |
@@ -901,51 +948,71 @@ discard block |
||
| 901 | 948 | |
| 902 | 949 | for($i=0;$i<count($testa);$i++) |
| 903 | 950 | { |
| 904 | - if($DEBUG) { echo'<br>Checking if '. (int)$testa[$i] . ' is more than ' . (int)$testb[$i] . ' ...'; } |
|
| 951 | + if($DEBUG) |
|
| 952 | + { |
|
| 953 | +echo'<br>Checking if '. (int)$testa[$i] . ' is more than ' . (int)$testb[$i] . ' ...'; } |
|
| 905 | 954 | if((int)$testa[$i] > (int)$testb[$i]) |
| 906 | 955 | { |
| 907 | - if($DEBUG) { echo ' yes.'; } |
|
| 956 | + if($DEBUG) |
|
| 957 | + { |
|
| 958 | +echo ' yes.'; } |
|
| 908 | 959 | $less++; |
| 909 | 960 | if($i<3) |
| 910 | 961 | { |
| 911 | 962 | /* Ensure that this is definitely greater */ |
| 912 | - if($DEBUG) { echo" This is the $num[$i] octet, so A is definitely greater than B."; } |
|
| 963 | + if($DEBUG) |
|
| 964 | + { |
|
| 965 | +echo" This is the $num[$i] octet, so A is definitely greater than B."; } |
|
| 913 | 966 | $less = 5; |
| 914 | 967 | break; |
| 915 | 968 | } |
| 916 | 969 | } |
| 917 | 970 | elseif((int)$testa[$i] < (int)$testb[$i]) |
| 918 | 971 | { |
| 919 | - if($DEBUG) { echo ' no.'; } |
|
| 972 | + if($DEBUG) |
|
| 973 | + { |
|
| 974 | +echo ' no.'; } |
|
| 920 | 975 | $less--; |
| 921 | 976 | if($i<2) |
| 922 | 977 | { |
| 923 | 978 | /* Ensure that this is definitely smaller */ |
| 924 | - if($DEBUG) { echo" This is the $num[$i] octet, so A is definitely less than B."; } |
|
| 979 | + if($DEBUG) |
|
| 980 | + { |
|
| 981 | +echo" This is the $num[$i] octet, so A is definitely less than B."; } |
|
| 925 | 982 | $less = -5; |
| 926 | 983 | break; |
| 927 | 984 | } |
| 928 | 985 | } |
| 929 | 986 | else |
| 930 | 987 | { |
| 931 | - if($DEBUG) { echo ' no, they are equal.'; } |
|
| 988 | + if($DEBUG) |
|
| 989 | + { |
|
| 990 | +echo ' no, they are equal.'; } |
|
| 932 | 991 | $less = 0; |
| 933 | 992 | } |
| 934 | 993 | } |
| 935 | - if($DEBUG) { echo '<br>Check value is: "'.$less.'"'; } |
|
| 994 | + if($DEBUG) |
|
| 995 | + { |
|
| 996 | +echo '<br>Check value is: "'.$less.'"'; } |
|
| 936 | 997 | if($less>0) |
| 937 | 998 | { |
| 938 | - if($DEBUG) { echo '<br>A is greater than B'; } |
|
| 999 | + if($DEBUG) |
|
| 1000 | + { |
|
| 1001 | +echo '<br>A is greater than B'; } |
|
| 939 | 1002 | return True; |
| 940 | 1003 | } |
| 941 | 1004 | elseif($less<0) |
| 942 | 1005 | { |
| 943 | - if($DEBUG) { echo '<br>A is less than B'; } |
|
| 1006 | + if($DEBUG) |
|
| 1007 | + { |
|
| 1008 | +echo '<br>A is less than B'; } |
|
| 944 | 1009 | return False; |
| 945 | 1010 | } |
| 946 | 1011 | else |
| 947 | 1012 | { |
| 948 | - if($DEBUG) { echo '<br>A is equal to B'; } |
|
| 1013 | + if($DEBUG) |
|
| 1014 | + { |
|
| 1015 | +echo '<br>A is equal to B'; } |
|
| 949 | 1016 | return False; |
| 950 | 1017 | } |
| 951 | 1018 | } |
@@ -982,7 +1049,10 @@ discard block |
||
| 982 | 1049 | echo "<p><b>".$e->getMessage()."</b></p>\n"; |
| 983 | 1050 | return false; |
| 984 | 1051 | } |
| 985 | - if (!isset($GLOBALS['egw']->accounts)) $GLOBALS['egw']->accounts = $this->accounts; |
|
| 1052 | + if (!isset($GLOBALS['egw']->accounts)) |
|
| 1053 | + { |
|
| 1054 | + $GLOBALS['egw']->accounts = $this->accounts; |
|
| 1055 | + } |
|
| 986 | 1056 | Api\Accounts::cache_invalidate(); // the cache is shared for all instances of the class |
| 987 | 1057 | } |
| 988 | 1058 | return true; |
@@ -1019,7 +1089,10 @@ discard block |
||
| 1019 | 1089 | $passwd = $_passwd; |
| 1020 | 1090 | if ($username == 'anonymous') |
| 1021 | 1091 | { |
| 1022 | - if (!isset($this->anonpw)) $this->anonpw = Api\Auth::randomstring(16); |
|
| 1092 | + if (!isset($this->anonpw)) |
|
| 1093 | + { |
|
| 1094 | + $this->anonpw = Api\Auth::randomstring(16); |
|
| 1095 | + } |
|
| 1023 | 1096 | $passwd = $anonpw = $this->anonpw; |
| 1024 | 1097 | } |
| 1025 | 1098 | |
@@ -1090,11 +1163,17 @@ discard block |
||
| 1090 | 1163 | 'account_lid' => $username, |
| 1091 | 1164 | )); |
| 1092 | 1165 | } |
| 1093 | - if ($primary_group) // only for users, NOT groups |
|
| 1166 | + if ($primary_group) |
|
| 1167 | + { |
|
| 1168 | + // only for users, NOT groups |
|
| 1094 | 1169 | { |
| 1095 | 1170 | $this->set_memberships(array($primary_group_id), $accountid); |
| 1171 | + } |
|
| 1096 | 1172 | |
| 1097 | - if (!$changepw) $this->add_acl('preferences','nopasswordchange',$accountid); |
|
| 1173 | + if (!$changepw) |
|
| 1174 | + { |
|
| 1175 | + $this->add_acl('preferences','nopasswordchange',$accountid); |
|
| 1176 | + } |
|
| 1098 | 1177 | } |
| 1099 | 1178 | //error_log("setup::add_account('$username','$first','$last',\$passwd,'$primary_group',$changepw,'$email') successfull created accountid=$accountid"); |
| 1100 | 1179 | return $accountid; |
@@ -1131,7 +1210,10 @@ discard block |
||
| 1131 | 1210 | function accounts_exist() |
| 1132 | 1211 | { |
| 1133 | 1212 | try { |
| 1134 | - if (!$this->setup_account_object()) return false; |
|
| 1213 | + if (!$this->setup_account_object()) |
|
| 1214 | + { |
|
| 1215 | + return false; |
|
| 1216 | + } |
|
| 1135 | 1217 | |
| 1136 | 1218 | $this->accounts->search(array( |
| 1137 | 1219 | 'type' => 'accounts', |
@@ -1218,9 +1300,15 @@ discard block |
||
| 1218 | 1300 | { |
| 1219 | 1301 | static $table_names = False; |
| 1220 | 1302 | |
| 1221 | - if (!$table_names || $force_refresh) $table_names = $this->db->table_names(); |
|
| 1303 | + if (!$table_names || $force_refresh) |
|
| 1304 | + { |
|
| 1305 | + $table_names = $this->db->table_names(); |
|
| 1306 | + } |
|
| 1222 | 1307 | |
| 1223 | - if (!$table_names) return false; |
|
| 1308 | + if (!$table_names) |
|
| 1309 | + { |
|
| 1310 | + return false; |
|
| 1311 | + } |
|
| 1224 | 1312 | |
| 1225 | 1313 | foreach($table_names as $data) |
| 1226 | 1314 | { |
@@ -1250,10 +1338,13 @@ discard block |
||
| 1250 | 1338 | { |
| 1251 | 1339 | $table = $this->table_exist($tables,$force_refresh); |
| 1252 | 1340 | |
| 1253 | - if ($table && $table != $this->$name) // only overwrite the default name, if we realy got one (important for new installs) |
|
| 1341 | + if ($table && $table != $this->$name) |
|
| 1342 | + { |
|
| 1343 | + // only overwrite the default name, if we realy got one (important for new installs) |
|
| 1254 | 1344 | { |
| 1255 | 1345 | $this->$name = $table; |
| 1256 | 1346 | } |
| 1347 | + } |
|
| 1257 | 1348 | //echo "<p>setup::set_table_names: $name = '{$this->$name}'</p>\n"; |
| 1258 | 1349 | } |
| 1259 | 1350 | } |