Changeset 1246
- Timestamp:
- 06/29/08 00:36:15
(2 months ago)
- Author:
- rats
- Message:
GUI Update 4/5: inlcude
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r1241 |
r1246 |
|
| 719 | 719 | 'URL_CHANGE_INTERFACE' => "change_user_interface.php?to_id=" . $rs->fields['domain_admin_id'], |
|---|
| 720 | 720 | 'USR_USERNAME' => $rs->fields['domain_name'], |
|---|
| | 721 | 'TR_EDIT_DOMAIN' => tr('Edit domain'), |
|---|
| | 722 | 'TR_EDIT_USR' => tr('Edit user'), |
|---|
| 721 | 723 | ) |
|---|
| 722 | 724 | ); |
|---|
| … | … | |
| 943 | 945 | |
|---|
| 944 | 946 | if ($sub_max != -1) { |
|---|
| 945 | | if ($sub_max == 0) $rsub_uf = '_on_'; |
|---|
| | 947 | if ($sub_max == 0) |
|---|
| | 948 | $rsub_uf = '_on_'; |
|---|
| 946 | 949 | |
|---|
| 947 | 950 | $rsub_current += $sub_current; |
|---|
| … | … | |
| 950 | 953 | |
|---|
| 951 | 954 | if ($als_max != -1) { |
|---|
| 952 | | if ($als_max == 0) $rals_uf = '_on_'; |
|---|
| | 955 | if ($als_max == 0) |
|---|
| | 956 | $rals_uf = '_on_'; |
|---|
| 953 | 957 | |
|---|
| 954 | 958 | $rals_current += $als_current; |
|---|
| … | … | |
| 956 | 960 | } |
|---|
| 957 | 961 | |
|---|
| 958 | | if ($mail_max == 0) $rmail_uf = '_on_'; |
|---|
| | 962 | if ($mail_max == 0) |
|---|
| | 963 | $rmail_uf = '_on_'; |
|---|
| 959 | 964 | |
|---|
| 960 | 965 | $rmail_current += $mail_current; |
|---|
| 961 | 966 | $rmail_max += $mail_max; |
|---|
| 962 | 967 | |
|---|
| 963 | | if ($ftp_max == 0) $rftp_uf = '_on_'; |
|---|
| | 968 | if ($ftp_max == 0) |
|---|
| | 969 | $rftp_uf = '_on_'; |
|---|
| 964 | 970 | |
|---|
| 965 | 971 | $rftp_current += $ftp_current; |
|---|
| … | … | |
| 967 | 973 | |
|---|
| 968 | 974 | if ($sql_db_max != -1) { |
|---|
| 969 | | if ($sql_db_max == 0) $rsql_db_uf = '_on_'; |
|---|
| | 975 | if ($sql_db_max == 0) |
|---|
| | 976 | $rsql_db_uf = '_on_'; |
|---|
| 970 | 977 | |
|---|
| 971 | 978 | $rsql_db_current += $sql_db_current; |
|---|
| … | … | |
| 974 | 981 | |
|---|
| 975 | 982 | if ($sql_user_max != -1) { |
|---|
| 976 | | if ($sql_user_max == 0) $rsql_user_uf = '_on_'; |
|---|
| | 983 | if ($sql_user_max == 0) |
|---|
| | 984 | $rsql_user_uf = '_on_'; |
|---|
| 977 | 985 | |
|---|
| 978 | 986 | $rsql_user_current += $sql_user_current; |
|---|
| … | … | |
| 980 | 988 | } |
|---|
| 981 | 989 | |
|---|
| 982 | | if ($traff_max == 0) $rtraff_uf = '_on_'; |
|---|
| | 990 | if ($traff_max == 0) |
|---|
| | 991 | $rtraff_uf = '_on_'; |
|---|
| 983 | 992 | |
|---|
| 984 | 993 | $rtraff_current += $traff_current; |
|---|
| 985 | 994 | $rtraff_max += $traff_max; |
|---|
| 986 | 995 | |
|---|
| 987 | | if ($disk_max == 0) $rdisk_uf = '_on_'; |
|---|
| | 996 | if ($disk_max == 0) |
|---|
| | 997 | $rdisk_uf = '_on_'; |
|---|
| 988 | 998 | |
|---|
| 989 | 999 | $rdisk_current += $disk_current; |
|---|
| … | … | |
| 1032 | 1042 | $als_current = records_count('alias_id', 'domain_aliasses', 'domain_id', $user_id); |
|---|
| 1033 | 1043 | $als_max = $rs->fields['domain_alias_limit']; |
|---|
| 1034 | | // Sorry 4 the strange Hack, but it works - RatS |
|---|
| | 1044 | // Sorry for the strange Hack, but it works - RatS |
|---|
| 1035 | 1045 | $mail_current = records_count('mail_id', 'mail_users', 'mail_type NOT RLIKE \'_catchall\' AND domain_id', $user_id); |
|---|
| 1036 | 1046 | $mail_max = $rs->fields['domain_mailacc_limit']; |
|---|
| 1037 | 1047 | |
|---|
| 1038 | | $ftp_current = sub_records_rlike_count('domain_name', 'domain', 'domain_id', $user_id, |
|---|
| 1039 | | 'userid', 'ftp_users', 'userid', '@', '' |
|---|
| 1040 | | ); |
|---|
| | 1048 | $ftp_current = sub_records_rlike_count( 'domain_name', 'domain', 'domain_id', $user_id, |
|---|
| | 1049 | 'userid', 'ftp_users', 'userid', '@', ''); |
|---|
| 1041 | 1050 | |
|---|
| 1042 | 1051 | $ftp_current += sub_records_rlike_count('subdomain_name', 'subdomain', 'domain_id', $user_id, |
|---|
| 1043 | | 'userid', 'ftp_users', 'userid', '@', '' |
|---|
| 1044 | | ); |
|---|
| | 1052 | 'userid', 'ftp_users', 'userid', '@', ''); |
|---|
| 1045 | 1053 | |
|---|
| 1046 | 1054 | $ftp_current += sub_records_rlike_count('alias_name', 'domain_aliasses', 'domain_id', $user_id, |
|---|
| 1047 | | 'userid', 'ftp_users', 'userid', '@', '' |
|---|
| 1048 | | ); |
|---|
| | 1055 | 'userid', 'ftp_users', 'userid', '@', ''); |
|---|
| 1049 | 1056 | |
|---|
| 1050 | 1057 | $ftp_max = $rs->fields['domain_ftpacc_limit']; |
|---|
| … | … | |
| 1053 | 1060 | $sql_db_max = $rs->fields['domain_sqld_limit']; |
|---|
| 1054 | 1061 | |
|---|
| 1055 | | $sql_user_current = sub_records_count('sqld_id', 'sql_database', 'domain_id', $user_id, |
|---|
| 1056 | | 'sqlu_id', 'sql_user', 'sqld_id', '', '' |
|---|
| 1057 | | ); |
|---|
| | 1062 | $sql_user_current = sub_records_count( 'sqld_id', 'sql_database', 'domain_id', $user_id, |
|---|
| | 1063 | 'sqlu_id', 'sql_user', 'sqld_id', '', ''); |
|---|
| 1058 | 1064 | |
|---|
| 1059 | 1065 | $sql_user_max = $rs->fields['domain_sqlu_limit']; |
|---|
| … | … | |
| 1063 | 1069 | $disk_max = $rs->fields['domain_disk_limit']; |
|---|
| 1064 | 1070 | |
|---|
| 1065 | | return array($sub_current, $sub_max, |
|---|
| 1066 | | $als_current, $als_max, |
|---|
| 1067 | | $mail_current, $mail_max, |
|---|
| 1068 | | $ftp_current, $ftp_max, |
|---|
| 1069 | | $sql_db_current, $sql_db_max, |
|---|
| 1070 | | $sql_user_current, $sql_user_max, |
|---|
| 1071 | | $traff_max, |
|---|
| 1072 | | $disk_max); |
|---|
| | 1071 | return array( |
|---|
| | 1072 | $sub_current, $sub_max, $als_current, $als_max, |
|---|
| | 1073 | $mail_current, $mail_max, $ftp_current, $ftp_max, |
|---|
| | 1074 | $sql_db_current, $sql_db_max, $sql_user_current, |
|---|
| | 1075 | $sql_user_max, $traff_max, $disk_max); |
|---|
| 1073 | 1076 | } |
|---|
| 1074 | 1077 | |
|---|
| … | … | |
| 2224 | 2227 | WHERE |
|---|
| 2225 | 2228 | user_id = ? |
|---|
| 2226 | | |
|---|
| 2227 | 2229 | SQL_QUERY; |
|---|
| 2228 | 2230 | |
|---|
| … | … | |
| 2247 | 2249 | </head> |
|---|
| 2248 | 2250 | <body> |
|---|
| 2249 | | <center> |
|---|
| | 2251 | <div align="center"> |
|---|
| 2250 | 2252 | <table width="100%" height="95%"> |
|---|
| 2251 | 2253 | <tr align="center"> |
|---|
| … | … | |
| 2257 | 2259 | </tr> |
|---|
| 2258 | 2260 | </table> |
|---|
| 2259 | | </center> |
|---|
| | 2261 | </div> |
|---|
| 2260 | 2262 | </body> |
|---|
| 2261 | 2263 | </html> |
|---|
| … | … | |
| 2354 | 2356 | $mail_result = mail($to, encode($subject), $message, $headers); |
|---|
| 2355 | 2357 | $mail_status = ($mail_result) ? 'OK' : 'NOT OK'; |
|---|
| 2356 | | write_log("$admin_login: Auto Ticket To: |$to|, From: |$from|, Status: |$mail_status|!"); |
|---|
| | 2358 | write_log(sprintf("%s send ticket To: %s, From: %s, Status: %s!", $_SESSION['user_logged'], $toname . ": " . $to_email, $fromname . ": " . $from_email, $mail_status)); |
|---|
| 2357 | 2359 | } |
|---|
| 2358 | 2360 | |
|---|
| r1241 |
r1246 |
|
| 1 | 1 | <?php |
|---|
| 2 | 2 | /** |
|---|
| 3 | | * ispCP (OMEGA) a Virtual Hosting Control Panel |
|---|
| | 3 | * ispCP ω (OMEGA) a Virtual Hosting Control System |
|---|
| 4 | 4 | * |
|---|
| 5 | | * @copyright 2001-2006 by moleSoftware GmbH |
|---|
| 6 | | * @copyright 2006-2007 by ispCP | http://isp-control.net |
|---|
| 7 | | * @link http://isp-control.net |
|---|
| 8 | | * @author ispCP Team (2007) |
|---|
| | 5 | * @copyright 2001-2006 by moleSoftware GmbH |
|---|
| | 6 | * @copyright 2006-2008 by ispCP | http://isp-control.net |
|---|
| | 7 | * @version SVN: $ID$ |
|---|
| | 8 | * @link http://isp-control.net |
|---|
| | 9 | * @author ispCP Team |
|---|
| 9 | 10 | * |
|---|
| 10 | | * @license |
|---|
| 11 | | * This program is free software; you can redistribute it and/or modify it under |
|---|
| 12 | | * the terms of the MPL General Public License as published by the Free Software |
|---|
| 13 | | * Foundation; either version 1.1 of the License, or (at your option) any later |
|---|
| 14 | | * version. |
|---|
| 15 | | * You should have received a copy of the MPL Mozilla Public License along with |
|---|
| 16 | | * this program; if not, write to the Open Source Initiative (OSI) |
|---|
| 17 | | * http://opensource.org | osi@opensource.org |
|---|
| 18 | | **/ |
|---|
| 19 | | |
|---|
| 20 | | |
|---|
| | 11 | * @license |
|---|
| | 12 | * This program is free software; you can redistribute it and/or modify it under |
|---|
| | 13 | * the terms of the MPL General Public License as published by the Free Software |
|---|
| | 14 | * Foundation; either version 1.1 of the License, or (at your option) any later |
|---|
| | 15 | * version. |
|---|
| | 16 | * You should have received a copy of the MPL Mozilla Public License along with |
|---|
| | 17 | * this program; if not, write to the Open Source Initiative (OSI) |
|---|
| | 18 | * http://opensource.org | osi@opensource.org |
|---|
| | 19 | */ |
|---|
| 21 | 20 | |
|---|
| 22 | 21 | function calc_bars($crnt, $max, $bars_max) { |
|---|
| … | … | |
| 35 | 34 | sprintf("%d", $bars) |
|---|
| 36 | 35 | ); |
|---|
| 37 | | |
|---|
| 38 | 36 | } |
|---|
| 39 | 37 | |
|---|
| … | … | |
| 95 | 93 | |
|---|
| 96 | 94 | function generate_rand_salt($min = 46, $max = 126) { |
|---|
| 97 | | |
|---|
| 98 | | $salt = chr(mt_rand($min, $max)); |
|---|
| 99 | | |
|---|
| | 95 | $salt = chr(mt_rand($min, $max)); |
|---|
| 100 | 96 | $salt .= chr(mt_rand($min, $max)); |
|---|
| 101 | | |
|---|
| 102 | 97 | return $salt; |
|---|
| 103 | | |
|---|
| 104 | 98 | } |
|---|
| 105 | 99 | |
|---|
| 106 | 100 | function get_salt_from($data) { |
|---|
| 107 | | |
|---|
| 108 | | |
|---|
| 109 | 101 | $salt = substr($data, 0, 2); |
|---|
| 110 | | |
|---|
| 111 | 102 | return $salt; |
|---|
| 112 | | |
|---|
| 113 | | |
|---|
| 114 | 103 | } |
|---|
| 115 | 104 | |
|---|
| 116 | 105 | function crypt_user_pass($data) { |
|---|
| 117 | | |
|---|
| 118 | 106 | $res = md5($data); |
|---|
| 119 | 107 | return $res; |
|---|
| 120 | | |
|---|
| 121 | 108 | } |
|---|
| 122 | 109 | |
|---|
| 123 | 110 | function crypt_user_ftp_pass($data) { |
|---|
| 124 | | |
|---|
| 125 | 111 | $res = crypt($data, generate_rand_salt()); |
|---|
| 126 | 112 | return $res; |
|---|
| 127 | | |
|---|
| 128 | 113 | } |
|---|
| 129 | 114 | |
|---|
| 130 | | |
|---|
| 131 | 115 | function check_user_pass($crdata, $data ) { |
|---|
| 132 | | |
|---|
| 133 | 116 | $salt = get_salt_from($crdata); |
|---|
| 134 | 117 | $udata = crypt($data, $salt); |
|---|
| 135 | | |
|---|
| 136 | 118 | return ($udata == $crdata); |
|---|
| 137 | 119 | } |
|---|
| 138 | 120 | |
|---|
| 139 | 121 | function _passgen() { |
|---|
| 140 | | |
|---|
| 141 | 122 | $pw = ''; |
|---|
| 142 | 123 | |
|---|
| 143 | 124 | for($i = 0; $i <= Config::get('PASSWD_CHARS'); $i++) { |
|---|
| 144 | | |
|---|
| 145 | 125 | $z = 0; |
|---|
| 146 | 126 | |
|---|
| … | … | |
| 148 | 128 | $z = mt_rand(42, 123); |
|---|
| 149 | 129 | } while($z >= 91 && $z <= 96); |
|---|
| 150 | | |
|---|
| 151 | 130 | $pw .= chr($z); |
|---|
| 152 | | |
|---|
| 153 | 131 | } |
|---|
| 154 | | |
|---|
| 155 | 132 | return $pw; |
|---|
| 156 | | |
|---|
| 157 | 133 | } |
|---|
| 158 | 134 | |
|---|
| 159 | 135 | function passgen() { |
|---|
| 160 | | |
|---|
| 161 | 136 | $pw = null; |
|---|
| 162 | 137 | |
|---|
| … | … | |
| 164 | 139 | $pw = _passgen(); |
|---|
| 165 | 140 | } |
|---|
| 166 | | |
|---|
| 167 | 141 | return $pw; |
|---|
| 168 | 142 | |
|---|
| 169 | 143 | } |
|---|
| 170 | 144 | |
|---|
| 171 | | function translate_limit_value($value, $autosize = false) |
|---|
| 172 | | { |
|---|
| | 145 | function translate_limit_value($value, $autosize = false) { |
|---|
| 173 | 146 | if ($value == -1) { |
|---|
| 174 | 147 | return tr('disabled'); |
|---|
| r1241 |
r1246 |
|
| 4 | 4 | * |
|---|
| 5 | 5 | * @copyright 2001-2006 by moleSoftware GmbH |
|---|
| 6 | | * @copyright 2006-2007 by ispCP | http://isp-control.net |
|---|
| | 6 | * @copyright 2006-2008 by ispCP | http://isp-control.net |
|---|
| 7 | 7 | * @version SVN: $ID$ |
|---|
| 8 | 8 | * @link http://isp-control.net |
|---|
| … | … | |
| 171 | 171 | $this->dtpl_data[$t_name] = $t_value; |
|---|
| 172 | 172 | |
|---|
| 173 | | $this->dtpl_data[strtoupper($t_name)] = @$value; |
|---|
| | 173 | $this->dtpl_data[strtoupper($t_name)] = @$t_value; |
|---|
| 174 | 174 | |
|---|
| 175 | 175 | $this->dtpl_options[$t_name] = ''; |
|---|
| r1241 |
r1246 |
|
| 5 | 5 | * @copyright 2001-2006 by moleSoftware GmbH |
|---|
| 6 | 6 | * @copyright 2006-2008 by ispCP | http://isp-control.net |
|---|
| 7 | | * @version $ID$ |
|---|
| | 7 | * @version SVN: $ID$ |
|---|
| 8 | 8 | * @link http://isp-control.net |
|---|
| 9 | 9 | * @author ispCP Team |
|---|
| … | … | |
| 79 | 79 | function get_domain_running_sub_cnt(&$sql, $domain_id) { |
|---|
| 80 | 80 | $query = <<<SQL_QUERY |
|---|
| 81 | | select |
|---|
| 82 | | count(subdomain_id) as cnt |
|---|
| 83 | | from |
|---|
| | 81 | SELECT |
|---|
| | 82 | COUNT(subdomain_id) AS cnt |
|---|
| | 83 | FROM |
|---|
| 84 | 84 | subdomain |
|---|
| 85 | | where |
|---|
| | 85 | WHERE |
|---|
| 86 | 86 | domain_id = ? |
|---|
| 87 | 87 | SQL_QUERY; |
|---|
| … | … | |
| 96 | 96 | function get_domain_running_als_cnt(&$sql, $domain_id) { |
|---|
| 97 | 97 | $query = <<<SQL_QUERY |
|---|
| 98 | | select |
|---|
| 99 | | count(alias_id) as cnt |
|---|
| 100 | | from |
|---|
| | 98 | SELECT |
|---|
| | 99 | COUNT(alias_id) AS cnt |
|---|
| | 100 | FROM |
|---|
| 101 | 101 | domain_aliasses |
|---|
| 102 | | where |
|---|
| | 102 | WHERE |
|---|
| 103 | 103 | domain_id = ? |
|---|
| 104 | 104 | |
|---|
| … | … | |
| 172 | 172 | function get_domain_running_dmn_ftp_acc_cnt(&$sql, $domain_id) { |
|---|
| 173 | 173 | $query = <<<SQL_QUERY |
|---|
| 174 | | select |
|---|
| | 174 | SELECT |
|---|
| 175 | 175 | domain_name |
|---|
| 176 | | from |
|---|
| | 176 | FROM |
|---|
| 177 | 177 | domain |
|---|
| 178 | | where |
|---|
| | 178 | WHERE |
|---|
| 179 | 179 | domain_id = ? |
|---|
| 180 | 180 | SQL_QUERY; |
|---|
| … | … | |
| 185 | 185 | |
|---|
| 186 | 186 | $query = <<<SQL_QUERY |
|---|
| 187 | | select |
|---|
| 188 | | count(userid) as cnt |
|---|
| 189 | | from |
|---|
| | 187 | SELECT |
|---|
| | 188 | COUNT(userid) AS cnt |
|---|
| | 189 | FROM |
|---|
| 190 | 190 | ftp_users |
|---|
| 191 | | where |
|---|
| 192 | | userid rlike ? |
|---|
| | 191 | WHERE |
|---|
| | 192 | userid RLIKE ? |
|---|
| 193 | 193 | SQL_QUERY; |
|---|
| 194 | 194 | |
|---|
| … | … | |
| 202 | 202 | function get_domain_running_sub_ftp_acc_cnt(&$sql, $domain_id) { |
|---|
| 203 | 203 | $query = <<<SQL_QUERY |
|---|
| 204 | | select |
|---|
| | 204 | SELECT |
|---|
| 205 | 205 | subdomain_name |
|---|
| 206 | | from |
|---|
| | 206 | FROM |
|---|
| 207 | 207 | subdomain |
|---|
| 208 | | where |
|---|
| 209 | | domain_id = ? |
|---|
| 210 | | order by |
|---|
| | 208 | WHERE |
|---|
| | 209 | domain_id = ? |
|---|
| | 210 | ORDER BY |
|---|
| 211 | 211 | subdomain_id |
|---|
| 212 | 212 | SQL_QUERY; |
|---|
| 213 | 213 | |
|---|
| 214 | 214 | $query2 = <<<SQL_QUERY |
|---|
| 215 | | select |
|---|
| | 215 | SELECT |
|---|
| 216 | 216 | domain_name |
|---|
| 217 | | from |
|---|
| | 217 | FROM |
|---|
| 218 | 218 | domain |
|---|
| 219 | | where |
|---|
| | 219 | WHERE |
|---|
| 220 | 220 | domain_id = ? |
|---|
| 221 | 221 | SQL_QUERY; |
|---|
| … | … | |
| 230 | 230 | |
|---|
| 231 | 231 | $query = <<<SQL_QUERY |
|---|
| 232 | | select |
|---|
| 233 | | count(userid) as cnt |
|---|
| 234 | | from |
|---|
| | 232 | SELECT |
|---|
| | 233 | COUNT(userid) AS cnt |
|---|
| | 234 | FROM |
|---|
| 235 | 235 | ftp_users |
|---|
| 236 | | where |
|---|
| 237 | | userid rlike ? |
|---|
| | 236 | WHERE |
|---|
| | 237 | userid RLIKE ? |
|---|
| 238 | 238 | SQL_QUERY; |
|---|
| 239 | 239 | |
|---|
| … | … | |
| 250 | 250 | function get_domain_running_als_ftp_acc_cnt(&$sql, $domain_id) { |
|---|
| 251 | 251 | $query = <<<SQL_QUERY |
|---|
| 252 | | select |
|---|
| | 252 | SELECT |
|---|
| 253 | 253 | alias_name |
|---|
| 254 | | from |
|---|
| | 254 | FROM |
|---|
| 255 | 255 | domain_aliasses |
|---|
| 256 | | where |
|---|
| 257 | | domain_id = ? |
|---|
| 258 | | order by |
|---|
| | 256 | WHERE |
|---|
| | 257 | domain_id = ? |
|---|
| | 258 | ORDER BY |
|---|
| 259 | 259 | alias_id |
|---|
| 260 | 260 | SQL_QUERY; |
|---|
| … | … | |
| 268 | 268 | |
|---|
| 269 | 269 | $query = <<<SQL_QUERY |
|---|
| 270 | | select |
|---|
| 271 | | count(userid) as cnt |
|---|
| 272 | | from |
|---|
| | 270 | SELECT |
|---|
| | 271 | COUNT(userid) AS cnt |
|---|
| | 272 | FROM |
|---|
| 273 | 273 | ftp_users |
|---|
| 274 | | where |
|---|
| 275 | | userid rlike ? |
|---|
| | 274 | WHERE |
|---|
| | 275 | userid RLIKE ? |
|---|
| 276 | 276 | SQL_QUERY; |
|---|
| 277 | 277 | |
|---|
| … | … | |
| 301 | 301 | function get_domain_running_sqld_acc_cnt(&$sql, $domain_id) { |
|---|
| 302 | 302 | $query = <<<SQL_QUERY |
|---|
| 303 | | select |
|---|
| 304 | | count(sqld_id) as cnt |
|---|
| 305 | | from |
|---|
| | 303 | SELECT |
|---|
| | 304 | COUNT(sqld_id) AS cnt |
|---|
| | 305 | FROM |
|---|
| 306 | 306 | sql_database |
|---|
| 307 | | where |
|---|
| | 307 | WHERE |
|---|
| 308 | 308 | domain_id = ? |
|---|
| 309 | 309 | SQL_QUERY; |
|---|
| … | … | |
| 318 | 318 | function get_domain_running_sqlu_acc_cnt(&$sql, $domain_id) { |
|---|
| 319 | 319 | $query = <<<SQL_QUERY |
|---|
| 320 | | select distinct |
|---|
| | 320 | SELECT DISTINCT |
|---|
| 321 | 321 | t1.sqlu_name |
|---|
| 322 | | from |
|---|
| 323 | | sql_user as t1, sql_database as t2 |
|---|
| 324 | | where |
|---|
| | 322 | FROM |
|---|
| | 323 | sql_user AS t1, sql_database AS t2 |
|---|
| | 324 | WHERE |
|---|
| 325 | 325 | t2.domain_id = ? |
|---|
| 326 | | and |
|---|
| | 326 | AND |
|---|
| 327 | 327 | t2.sqld_id = t1.sqld_id |
|---|
| 328 | 328 | SQL_QUERY; |
|---|
| … | … | |
| 411 | 411 | |
|---|
| 412 | 412 | $query = <<<SQL_QUERY |
|---|
| 413 | | select |
|---|
| | 413 | SELECT |
|---|
| 414 | 414 | * |
|---|
| 415 | | from |
|---|
| | 415 | FROM |
|---|
| 416 | 416 | custom_menus |
|---|
| 417 | | where |
|---|
| | 417 | WHERE |
|---|
| 418 | 418 | menu_level = 'user' |
|---|
| 419 | | or |
|---|
| | 419 | OR |
|---|
| 420 | 420 | menu_level = 'all' |
|---|
| 421 | 421 | SQL_QUERY; |
|---|
| … | … | |
| 472 | 472 | $tpl->assign('ISACTIVE_AWSTATS', ''); |
|---|
| 473 | 473 | } else { |
|---|
| 474 | | $tpl->assign('AWSTSTS', 'http://' . $_SERVER['HTTP_HOST'] . '/stats'); |
|---|
| | 474 | $tpl->assign( |
|---|
| | 475 | array( |
|---|
| | 476 | 'AWSTATS_PATH' => 'http://' . $_SESSION['user_logged'] . '/stats/', |
|---|
| | 477 | 'AWSTATS_TARGET' => '_blank' |
|---|
| | 478 | ) |
|---|
| | 479 | ); |
|---|
| 475 | 480 | } |
|---|
| 476 | 481 | |
|---|
| … | … | |
| 531 | 536 | |
|---|
| 532 | 537 | $query = <<<SQL_QUERY |
|---|
| 533 | | select |
|---|
| | 538 | SELECT |
|---|
| 534 | 539 | * |
|---|
| 535 | | from |
|---|
| | 540 | FROM |
|---|
| 536 | 541 | custom_menus |
|---|
| 537 | | where |
|---|
| | 542 | WHERE |
|---|
| 538 | 543 | menu_level = 'user' |
|---|
| 539 | | or |
|---|
| | 544 | OR |
|---|
| 540 | 545 | menu_level = 'all' |
|---|
| 541 | 546 | SQL_QUERY; |
|---|
| … | … | |
| 560 | 565 | |
|---|
| 561 | 566 | $tpl->assign( |
|---|
| 562 | | array('BUTTON_LINK' => $menu_link, |
|---|
| | 567 | array( |
|---|
| | 568 | 'BUTTON_LINK' => $menu_link, |
|---|
| 563 | 569 | 'BUTTON_NAME' => $menu_name, |
|---|
| 564 | 570 | 'BUTTON_TARGET' => $menu_target, |
|---|
| … | … | |
| 572 | 578 | } // end while |
|---|
| 573 | 579 | } // end else |
|---|
| 574 | | if (!Config::get('ISPCP_SUPPORT_SYSTEM')) { |
|---|
| | 580 | if (!$cfg['ISPCP_SUPPORT_SYSTEM']) { |
|---|
| 575 | 581 | $tpl->assign('SUPPORT_SYSTEM', ''); |
|---|
| 576 | 582 | } |
|---|
| 577 | 583 | |
|---|
| 578 | | if (Config::get('AWSTATS_ACTIVE') == 'no') { |
|---|
| 579 | | $tpl->assign('AWSTSTS', ''); |
|---|
| | 584 | if (Config::get('AWSTATS_ACTIVE') == 'yes') { |
|---|
| | 585 | $tpl->assign('ACTIVE_AWSTSTS', ''); |
|---|
| 580 | 586 | } else { |
|---|
| 581 | | $tpl->assign('AWSTSTS', 'http://' . $_SERVER['HTTP_HOST'] . '/stats'); |
|---|
| | 587 | $tpl->assign( |
|---|
| | 588 | array( |
|---|
| | 589 | 'AWSTATS_PATH' => 'http://' . $_SESSION['user_logged'] . '/stats/', |
|---|
| | 590 | 'AWSTATS_TARGET' => '_blank' |
|---|
| | 591 | ) |
|---|
| | 592 | ); |
|---|
| 582 | 593 | } |
|---|
| 583 | 594 | |
|---|
| … | … | |
| 587 | 598 | function get_user_domain_id(&$sql, $user_id) { |
|---|
| 588 | 599 | $query = <<<SQL_QUERY |
|---|
| 589 | | select |
|---|
| | 600 | SELECT |
|---|
| 590 | 601 | domain_id |
|---|
| 591 | | from |
|---|
| | 602 | FROM |
|---|
| 592 | 603 | domain |
|---|
| 593 | | where |
|---|
| | 604 | WHERE |
|---|
| 594 | 605 | domain_admin_id = ? |
|---|
| 595 | 606 | SQL_QUERY; |
|---|
| … | … | |
| 630 | 641 | $query = <<<SQL_QUERY |
|---|
| 631 | 642 | SELECT |
|---|
| 632 | | COUNT(sqlu_id) as cnt |
|---|
| | 643 | COUNT(sqlu_id) AS cnt |
|---|
| 633 | 644 | FROM |
|---|
| 634 | 645 | sql_user |
|---|
| … | … | |
| 645 | 656 | // let's get sql user common data; |
|---|
| 646 | 657 | $query = <<<SQL_QUERY |
|---|
| 647 | | select |
|---|
| | 658 | SELECT |
|---|
| 648 | 659 | t1.sqld_id, t1.sqlu_name, t2.sqld_name, t1.sqlu_name |
|---|
| 649 | | from |
|---|
| 650 | | sql_user as t1, |
|---|
| 651 | | sql_database as t2 |
|---|
| 652 | | where |
|---|
| | 660 | FROM |
|---|
| | 661 | sql_user AS t1, |
|---|
| | 662 | sql_database AS t2 |
|---|
| | 663 | WHERE |
|---|
| 653 | 664 | t1.sqld_id = t2.sqld_id |
|---|
| 654 | | and |
|---|
| | 665 | AND |
|---|
| 655 | 666 | t2.domain_id = ? |
|---|
| 656 | | and |
|---|
| | 667 | AND |
|---|
| 657 | 668 | t1.sqlu_id = ? |
|---|
| 658 | 669 | SQL_QUERY; |
|---|
| … | … | |
| 674 | 685 | // revoke grants on global level, if any; |
|---|
| 675 | 686 | $query = <<<SQL_QUERY |
|---|
| 676 | | revoke all on *.* from ?@'%' |
|---|
| | 687 | REVOKE ALL ON *.* FROM ?@'%' |
|---|
| 677 | 688 | SQL_QUERY; |
|---|
| 678 | 689 | $rs = exec_query($sql, $query, array($db_user_name)); |
|---|
| 679 | 690 | $query = <<<SQL_QUERY |
|---|
| 680 | | revoke all on *.* from ?@localhost |
|---|
| | 691 | REVOKE ALL ON *.* FROM ?@localhost |
|---|
| 681 | 692 | SQL_QUERY; |
|---|
| 682 | 693 | $rs = exec_query($sql, $query, array($db_user_name)); |
|---|
| 683 | 694 | // delete user record from mysql.user table; |
|---|
| 684 | 695 | $query = <<<SQL_QUERY |
|---|
| 685 | | delete from |
|---|
| | 696 | DELETE FROM |
|---|
| 686 | 697 | mysql.user |
|---|
| 687 | | where |
|---|
| 688 | | Host = '%' |
|---|
| 689 | | and |
|---|
| 690 | | User = ? |
|---|
| | 698 | WHERE |
|---|
| | 699 | Host = '%' |
|---|
| | 700 | AND |
|---|
| | 701 | User = ? |
|---|
| 691 | 702 | SQL_QUERY; |
|---|
| 692 | 703 | $rs = exec_query($sql, $query, array($db_user_name)); |
|---|
| 693 | 704 | |
|---|
| 694 | 705 | $query = <<<SQL_QUERY |
|---|
| 695 | | delete from |
|---|
| 696 | | mysql.user |
|---|
| 697 | | where |
|---|
| 698 | | Host = 'localhost' |
|---|
| 699 | | and |
|---|
| 700 | | User = ? |
|---|
| | 706 | DELETE FROM |
|---|
| | 707 | mysql.user |
|---|
| | 708 | WHERE |
|---|
| | 709 | Host = 'localhost' |
|---|
| | 710 | AND |
|---|
| | 711 | User = ? |
|---|
| 701 | 712 | SQL_QUERY; |
|---|
| 702 | 713 | $rs = exec_query($sql, $query, array($db_user_name)); |
|---|
| 703 | 714 | // flush privileges. |
|---|
| 704 | 715 | $query = <<<SQL_QUERY |
|---|
| 705 | | flush privileges |
|---|
| | 716 | FLUSH PRIVILEGES; |
|---|
| 706 | 717 | SQL_QUERY; |
|---|
| 707 | 718 | $rs = exec_query($sql, $query, array()); |
|---|
| … | … | |
| 709 | 720 | $new_db_name = str_replace("_", "\\_", $db_name); |
|---|
| 710 | 721 | $query = <<<SQL_QUERY |
|---|
| 711 | | revoke all on $new_db_name.* from ?@'%' |
|---|
| | 722 | REVOKE ALL ON $new_db_name.* FROM ?@'%' |
|---|
| 712 | 723 | SQL_QUERY; |
|---|
| 713 | 724 | $rs = exec_query($sql, $query, array($db_user_name)); |
|---|
| 714 | 725 | $query = <<<SQL_QUERY |
|---|
| 715 | | revoke all on $new_db_name.* from ?@localhost |
|---|
| | 726 | REVOKE ALL ON $new_db_name.* FROM ?@localhost |
|---|
| 716 | 727 | SQL_QUERY; |
|---|
| 717 | 728 | $rs = exec_query($sql, $query, array($db_user_name)); |
|---|
| … | … | |
| 723 | 734 | $tpl->assign('SQL_SUPPORT', ''); |
|---|
| 724 | 735 | } |
|---|
| 725 | | |
|---|
| 726 | 736 | if (isset($_SESSION['email_support']) && $_SESSION['email_support'] == "no") { |
|---|
| 727 | 737 | $tpl->assign('ADD_EMAIL', ''); |
|---|
| 728 | 738 | } |
|---|
| 729 | | |
|---|
| 730 | 739 | if (isset($_SESSION['subdomain_support']) && $_SESSION['subdomain_support'] == "no") { |
|---|
| 731 | 740 | $tpl->assign('SUBDOMAIN_SUPPORT', ''); |
|---|
| … | … | |
| 734 | 743 | $tpl->assign('DOMAINALIAS_SUPPORT', ''); |
|---|
| 735 | 744 | } |
|---|
| 736 | | |
|---|
| 737 | 745 | if (isset($_SESSION['subdomain_support']) && $_SESSION['subdomain_support'] == "no") { |
|---|
| 738 | 746 | $tpl->assign('SUBDOMAIN_SUPPORT_CONTENT', ''); |
|---|
| … | … | |
| 741 | 749 | $tpl->assign('DOMAINALIAS_SUPPORT_CONTENT', ''); |
|---|
| 742 | 750 | } |
|---|
| 743 | | |
|---|
| 744 | 751 | if (isset($_SESSION['alias_support']) && $_SESSION['alias_support'] == "no" && isset($_SESSION['subdomain_support']) && $_SESSION['subdomain_support'] == "no") { |
|---|
| 745 | 752 | $tpl->assign('DMN_MNGMNT', ''); |
|---|
| … | … | |
| 776 | 783 | function delete_sql_database(&$sql, $dmn_id, $db_id) { |
|---|
| 777 | 784 | $query = <<<SQL_QUERY |
|---|
| 778 | | select |
|---|
| 779 | | sqld_name as db_name |
|---|
| 780 | | from |
|---|
| | 785 | SELECT |
|---|
| | 786 | sqld_name AS db_name |
|---|
| | 787 | FROM |
|---|
| 781 | 788 | sql_database |
|---|
| 782 | | where |
|---|
| 783 | | domain_id = ? |
|---|
| 784 | | and |
|---|
| | 789 | WHERE |
|---|
| | 790 | domain_id = ? |
|---|
| | 791 | AND |
|---|
| 785 | 792 | sqld_id = ? |
|---|
| 786 | 793 | SQL_QUERY; |
|---|
| … | … | |
| 795 | 802 | // have we any users assigned to this database; |
|---|
| 796 | 803 | $query = <<<SQL_QUERY |
|---|
| 797 | | select |
|---|
| 798 | | t2.sqlu_id as db_user_id, |
|---|
| 799 | | t2.sqlu_name as db_user_name |
|---|
| 800 | | from |
|---|
| 801 | | sql_database as t1, |
|---|
| 802 | | sql_user as t2 |
|---|
| 803 | | where |
|---|
| | 804 | SELECT |
|---|
| | 805 | t2.sqlu_id AS db_user_id, |
|---|
| | 806 | t2.sqlu_name AS db_user_name |
|---|
| | 807 | FROM |
|---|
| | 808 | sql_database AS t1, |
|---|
| | 809 | sql_user AS t2 |
|---|
| | 810 | WHERE |
|---|
| 804 | 811 | t1.sqld_id = t2.sqld_id |
|---|
| 805 | | and |
|---|
| | 812 | AND |
|---|
| 806 | 813 | t1.domain_id = ? |
|---|
| 807 | | and |
|---|
| | 814 | AND |
|---|
| 808 | 815 | t1.sqld_id = ? |
|---|
| 809 | 816 | SQL_QUERY; |
|---|
| … | … | |
| 823 | 830 | } |
|---|
| 824 | 831 | // drop desired database; |
|---|
| 825 | | $query = <<<SQL_QUERY |
|---|
| 826 | | drop database |
|---|
| 827 | | SQL_QUERY; |
|---|
| 828 | | |
|---|
| 829 | | $query .= $db_name; |
|---|
| | 832 | $query = "DROP DATABASE IF EXISTS ".$db_name.";"; |
|---|
| 830 | 833 | |
|---|
| 831 | 834 | $rs = exec_query($sql, $query, array()); |
|---|
| … | … | |
| 834 | 837 | // delete desired database from the ispcp sql_database table; |
|---|
| 835 | 838 | $query = <<<SQL_QUERY |
|---|
| 836 | | delete from |
|---|
| | 839 | DELETE FROM |
|---|
| 837 | 840 | sql_database |
|---|
| 838 | | where |
|---|
| 839 | | domain_id = ? |
|---|
| 840 | | and |
|---|
| | 841 | WHERE |
|---|
| | 842 | domain_id = ? |
|---|
| | 843 | AND |
|---|
| 841 | 844 | sqld_id = ? |
|---|
| 842 | 845 | SQL_QUERY; |
|---|
| r1241 |
r1246 |
|
| 28 | 28 | |
|---|
| 29 | 29 | /* |
|---|
| 30 | | * Select the current revision from the database and return it |
|---|
| | 30 | * Get the current revision from the database and return it |
|---|
| 31 | 31 | */ |
|---|
| 32 | 32 | function getCurrentRevision() { |
|---|
| 33 | 33 | $sql = Database::getInstance(); |
|---|
| 34 | 34 | |
|---|
| 35 | | $query = "SELECT * FROM `config` WHERE `name` = 'DATABASE_REVISION'"; |
|---|
| 36 | | $rs = $sql->Execute($query); |
|---|
| 37 | | $current_revision = (int)$rs->fields['value']; |
|---|
| 38 | | |
|---|
| 39 | | return $current_revision; |
|---|
| | 35 | $query = "SELECT * FROM `config` WHERE `name` = 'DATABASE_REVISION'"; |
|---|
| | 36 | $rs = $sql->Execute($query); |
|---|
| | 37 | |
|---|
| | 38 | return (int)$rs->fields['value']; |
|---|
| 40 | 39 | } |
|---|
| 41 | 40 | |
|---|
| … | … | |
| 58 | 57 | |
|---|
| 59 | 58 | /* |
|---|
| 60 | | * Check for existenz of a available update |
|---|
| | 59 | * Check for existence of an available update |
|---|
| 61 | 60 | */ |
|---|
| 62 | 61 | function checkNewRevisionExists() { |
|---|
| … | … | |
| 74 | 73 | function returnFunctionName($revision) { |
|---|
| 75 | 74 | $functionName = "_databaseUpdate_" . $revision; |
|---|
| 76 | | |
|---|
| | 75 | |
|---|
| 77 | 76 | return $functionName; |
|---|
| 78 | 77 | } |
|---|
| … | … | |
| 83 | 82 | function executeDatabaseUpdates() { |
|---|
| 84 | 83 | $sql = Database::getInstance(); |
|---|
| 85 | | |
|---|
| | 84 | $failedUpdate = false; |
|---|
| | 85 | |
|---|
| 86 | 86 | while(checkNewRevisionExists()) { |
|---|
| | 87 | // Get the next database update revision |
|---|
| 87 | 88 | $newRevision = getNextRevision(); |
|---|
| | 89 | |
|---|
| | 90 | // Get the needed function name |
|---|
| 88 | 91 | $functionName = returnFunctionName($newRevision); |
|---|
| 89 | 92 | |
|---|
| 90 | | if(function_exists($functionName)) { |
|---|
| 91 | | $queryArray = $functionName(); |
|---|
| 92 | | |
|---|
| 93 | | // Query to set the new Database Revision |
|---|
| 94 | | $queryArray[] = "UPDATE `config` SET `value` = '$newRevision' WHERE `name` = 'DATABASE_REVISION'"; |
|---|
| 95 | | |
|---|
| 96 | | $sql->StartTrans(); |
|---|
| 97 | | |
|---|
| 98 | | foreach($queryArray as $query) { |
|---|
| 99 | | $sql->Execute($query); |
|---|
| 100 | | } |
|---|
| 101 | | |
|---|
| 102 | | // Prompt a error when a update fails |
|---|
| 103 | | if ($sql->HasFailedTrans()) { |
|---|
| 104 | | set_page_message(tr("Db update %s failed", $newRevision)); |
|---|
| 105 | | } |
|---|
| 106 | | |
|---|
| 107 | | $sql->CompleteTrans(); |
|---|
| 108 | | unset($queryArray); |
|---|
| | 93 | // Pull the query from the update function using a variable function |
|---|
| | 94 | $queryArray = $functionName(); |
|---|
| | 95 | |
|---|
| | 96 | // Add the query, to set the new Database Revision, to our queryArray |
|---|
| | 97 | $queryArray[] = "UPDATE `config` SET `value` = '$newRevision' WHERE `name` = 'DATABASE_REVISION'"; |
|---|
| | 98 | |
|---|
| | 99 | // Start the Transaction |
|---|
| | 100 | $sql->StartTrans(); |
|---|
| | 101 | |
|---|
| | 102 | // Execute every query in our queryArray |
|---|
| | 103 | foreach($queryArray as $query) { |
|---|
| | 104 | $sql->Execute($query); |
|---|
| 109 | 105 | } |
|---|
| | 106 | |
|---|
| | 107 | // Set failedUpdate to true if an databaseUpdate failed |
|---|
| | 108 | if ($sql->HasFailedTrans()) |
|---|
| | 109 | $failedUpdate = true; |
|---|
| | 110 | |
|---|
| | 111 | // Complete the Transactin and rollback if nessessary |
|---|
| | 112 | $sql->CompleteTrans(); |
|---|
| | 113 | |
|---|
| | 114 | // Display an error if nessessary |
|---|
| | 115 | if($failedUpdate) |
|---|
| | 116 | system_message(tr("Database update %s failed", $newRevision)); |
|---|
| 110 | 117 | } |
|---|
| 111 | 118 | } |
|---|
| 112 | 119 | |
|---|
| 113 | 120 | /* |
|---|
| 114 | | * Insert the update functions below this entry please. The revision should be ascending. |
|---|
| 115 | | * Don't insert a update twice! |
|---|
| | 121 | * Insert the update functions below this entry. The revision has to be ascending and unique. |
|---|
| | 122 | * Each databaseUpdate function has to return a array. Even if the array contains only one entry. |
|---|
| 116 | 123 | */ |
|---|
| 117 | 124 | |
|---|
| … | … | |
| 120 | 127 | */ |
|---|
| 121 | 128 | function _databaseUpdate_1() { |
|---|
| 122 | | $sqlUpd = "INSERT INTO config (name, value) VALUES (DATABASE_REVISION , 1)"; |
|---|
| 123 | | |
|---|
| | 129 | $sqlUpd = array(); |
|---|
| | 130 | |
|---|
| | 131 | $sqlUpd[] = "INSERT INTO `config` (name, value) VALUES ('DATABASE_REVISION' , '1')"; |
|---|
| | 132 | |
|---|
| 124 | 133 | return $sqlUpd; |
|---|
| 125 | 134 | } |
|---|
| … | … | |
| 138 | 147 | . "SET `mail_addr` = CONCAT(`mail_acc`,'@',`domain_name`)" |
|---|
| 139 |
|---|
|