From 65ea2ecf27418feaf7681a02d74168d0d82626fb Mon Sep 17 00:00:00 2001 From: mcramer Date: Thu, 13 Sep 2012 16:28:26 +0000 Subject: [PATCH] Fixed/Implemented: replaced intval() by $app->functions->intval() in all interface functions due to big number problem in intval() --- interface/lib/app.inc.php | 5 +- .../lib/classes/aps_guicontroller.inc.php | 16 +- interface/lib/classes/auth.inc.php | 10 +- .../lib/classes/client_templates.inc.php | 8 +- interface/lib/classes/form.inc.php | 5 +- interface/lib/classes/functions.inc.php | 10 +- interface/lib/classes/getconf.inc.php | 2 +- interface/lib/classes/listform.inc.php | 16 +- .../lib/classes/plugin_backuplist.inc.php | 2 +- interface/lib/classes/remoting.inc.php | 58 +++---- interface/lib/classes/remoting_lib.inc.php | 161 ++++++++++++------ interface/lib/classes/searchform.inc.php | 7 +- .../lib/classes/sites_database_plugin.inc.php | 40 ++--- interface/lib/classes/tform.inc.php | 27 ++- interface/lib/classes/tform_actions.inc.php | 4 +- interface/lib/classes/tools_sites.inc.php | 4 +- interface/lib/classes/validate_dns.inc.php | 4 +- interface/lib/classes/validate_domain.inc.php | 6 +- .../plugins/mail_user_filter_plugin.inc.php | 4 +- .../sites_web_database_user_plugin.inc.php | 6 +- .../plugins/sites_web_domain_plugin.inc.php | 14 +- .../sites_web_vhost_subdomain_plugin.inc.php | 6 +- .../lib/plugins/vm_openvz_plugin.inc.php | 8 +- interface/web/admin/login_as.php | 4 +- interface/web/admin/software_package_del.php | 2 +- .../web/admin/software_package_install.php | 2 +- interface/web/admin/software_package_list.php | 14 +- interface/web/admin/software_update_list.php | 16 +- interface/web/client/client_del.php | 14 +- interface/web/client/client_edit.php | 10 +- interface/web/client/client_message.php | 12 +- interface/web/client/domain_edit.php | 2 +- interface/web/client/reseller_del.php | 6 +- interface/web/client/reseller_edit.php | 8 +- interface/web/dns/ajax_get_json.php | 4 +- interface/web/dns/dns_a_edit.php | 10 +- interface/web/dns/dns_aaaa_edit.php | 10 +- interface/web/dns/dns_alias_edit.php | 10 +- interface/web/dns/dns_cname_edit.php | 10 +- interface/web/dns/dns_hinfo_edit.php | 10 +- interface/web/dns/dns_import.php | 88 +++++----- interface/web/dns/dns_mx_edit.php | 10 +- interface/web/dns/dns_ns_edit.php | 10 +- interface/web/dns/dns_ptr_edit.php | 10 +- interface/web/dns/dns_rp_edit.php | 10 +- interface/web/dns/dns_rr_del.php | 4 +- interface/web/dns/dns_slave_del.php | 2 +- interface/web/dns/dns_slave_edit.php | 12 +- interface/web/dns/dns_soa_del.php | 2 +- interface/web/dns/dns_soa_edit.php | 12 +- interface/web/dns/dns_srv_edit.php | 10 +- interface/web/dns/dns_txt_edit.php | 10 +- interface/web/dns/dns_wizard.php | 10 +- interface/web/dns/form/dns_a.tform.php | 3 +- interface/web/dns/form/dns_aaaa.tform.php | 3 +- interface/web/dns/form/dns_alias.tform.php | 3 +- interface/web/dns/form/dns_cname.tform.php | 3 +- interface/web/dns/form/dns_hinfo.tform.php | 3 +- interface/web/dns/form/dns_mx.tform.php | 4 +- interface/web/dns/form/dns_ns.tform.php | 3 +- interface/web/dns/form/dns_ptr.tform.php | 3 +- interface/web/dns/form/dns_rp.tform.php | 3 +- interface/web/dns/form/dns_soa.tform.php | 3 +- interface/web/dns/form/dns_srv.tform.php | 3 +- interface/web/dns/form/dns_txt.tform.php | 3 +- interface/web/mail/form/mail_user.tform.php | 3 +- .../web/mail/form/mail_user_filter.tform.php | 3 +- interface/web/mail/mail_domain_edit.php | 18 +- interface/web/mail/mail_mailinglist_edit.php | 8 +- interface/web/mail/mail_spamfilter_edit.php | 2 +- interface/web/mail/mail_user_edit.php | 8 +- interface/web/mail/mail_user_filter_edit.php | 6 +- interface/web/mail/mail_user_stats.php | 8 +- interface/web/mail/mailinglist.php | 4 +- .../web/mail/spamfilter_blacklist_edit.php | 2 +- .../web/mail/spamfilter_whitelist_edit.php | 2 +- interface/web/mail/webmailer.php | 4 +- .../mailuser/form/mail_user_filter.tform.php | 4 +- .../web/mailuser/mail_user_filter_edit.php | 2 +- .../mailuser/mail_user_spamfilter_edit.php | 2 +- interface/web/monitor/log_del.php | 2 +- interface/web/monitor/show_log.php | 2 +- interface/web/monitor/show_sys_state.php | 2 +- interface/web/remote/monitor.php | 2 +- interface/web/sites/ajax_get_ip.php | 4 +- interface/web/sites/ajax_get_json.php | 8 +- interface/web/sites/aps_do_operation.php | 6 +- interface/web/sites/cron_edit.php | 6 +- interface/web/sites/database_edit.php | 6 +- interface/web/sites/database_phpmyadmin.php | 4 +- interface/web/sites/database_user_del.php | 4 +- interface/web/sites/database_user_edit.php | 10 +- interface/web/sites/ftp_user_edit.php | 6 +- interface/web/sites/shell_user_edit.php | 4 +- interface/web/sites/web_aliasdomain_edit.php | 10 +- interface/web/sites/web_domain_del.php | 16 +- interface/web/sites/web_domain_edit.php | 58 +++---- interface/web/sites/web_folder_del.php | 2 +- interface/web/sites/web_folder_edit.php | 2 +- interface/web/sites/web_folder_user_edit.php | 2 +- interface/web/sites/web_sites_stats.php | 8 +- interface/web/sites/web_subdomain_edit.php | 10 +- .../web/sites/web_vhost_subdomain_del.php | 2 +- .../web/sites/web_vhost_subdomain_edit.php | 40 ++--- interface/web/sites/webdav_user_edit.php | 6 +- interface/web/tools/import_ispconfig.php | 6 +- interface/web/tools/import_plesk.php | 2 +- interface/web/vm/ajax_get_ip.php | 2 +- interface/web/vm/openvz_action.php | 2 +- interface/web/vm/openvz_vm_edit.php | 4 +- 110 files changed, 596 insertions(+), 512 deletions(-) diff --git a/interface/lib/app.inc.php b/interface/lib/app.inc.php index 7f73f7401..71566e6d1 100755 --- a/interface/lib/app.inc.php +++ b/interface/lib/app.inc.php @@ -81,7 +81,8 @@ class app { if(empty($_SESSION['s']['language'])) $_SESSION['s']['language'] = $conf['language']; } - $this->uses('auth,plugin,functions'); + $this->uses('functions'); // we need this before all others! + $this->uses('auth,plugin'); } public function __destruct() { @@ -119,7 +120,7 @@ class app { if($priority >= $this->_conf['log_priority']) { // $server_id = $conf["server_id"]; $server_id = 0; - $priority = intval($priority); + $priority = $this->functions->intval($priority); $tstamp = time(); $msg = $this->db->quote('[INTERFACE]: '.$msg); $this->db->query("INSERT INTO sys_log (server_id,datalog_id,loglevel,tstamp,message) VALUES ($server_id,0,$priority,$tstamp,'$msg')"); diff --git a/interface/lib/classes/aps_guicontroller.inc.php b/interface/lib/classes/aps_guicontroller.inc.php index cef7cec8f..cec49d76f 100644 --- a/interface/lib/classes/aps_guicontroller.inc.php +++ b/interface/lib/classes/aps_guicontroller.inc.php @@ -210,7 +210,7 @@ class ApsGUIController extends ApsBase //* Get server config of the web server $this->app->uses("getconf"); - $web_config = $this->app->getconf->get_server_config(intval($websrv["server_id"]),'web'); + $web_config = $this->app->getconf->get_server_config($app->functions->intval($websrv["server_id"]),'web'); //* Set mysql mode to php-fcgi and enable suexec in website on apache servers if($web_config['server_type'] == 'apache') { @@ -239,7 +239,7 @@ class ApsGUIController extends ApsBase $client = $app->db->queryOneRecord("SELECT default_dbserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ".$websrv['sys_groupid']); if(is_array($client) && $client['default_dbserver'] > 0 && $client['default_dbserver'] != $websrv['server_id']) { $mysql_db_server_id = $client['default_dbserver']; - $dbserver_config = $web_config = $app->getconf->get_server_config(intval($mysql_db_server_id),'server'); + $dbserver_config = $web_config = $app->getconf->get_server_config($app->functions->intval($mysql_db_server_id),'server'); $mysql_db_host = $dbserver_config['ip_address']; $mysql_db_remote_access = 'y'; $mysql_db_remote_ips = $dbserver_config['ip_address']; @@ -322,7 +322,7 @@ class ApsGUIController extends ApsBase if($tmp['database_id'] > 0) $this->db->datalogDelete('web_database', 'database_id', $tmp['database_id']); $database_user = $tmp['database_user_id']; - $tmp = $this->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `database_user_id` = '" . intval($database_user) . "' OR `database_ro_user_id` = '" . intval($database_user) . "'"); + $tmp = $this->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `database_user_id` = '" . $app->functions->intval($database_user) . "' OR `database_ro_user_id` = '" . $app->functions->intval($database_user) . "'"); if($tmp['cnt'] < 1) $this->db->datalogDelete('web_database_user', 'database_user_id', $database_user); $this->db->datalogUpdate('aps_instances', "instance_status = ".INSTANCE_REMOVE, 'id', $instanceid); @@ -449,6 +449,8 @@ class ApsGUIController extends ApsBase */ public function validateInstallerInput($postinput, $pkg_details, $domains, $settings = array()) { + global $app; + $ret = array(); $input = array(); $error = array(); @@ -566,12 +568,12 @@ class ApsGUIController extends ApsBase { if($setting['SettingType'] == 'string' || $setting['SettingType'] == 'password') { - if(intval($setting['SettingMinLength']) != 0 - && strlen($postinput[$setting_id]) < intval($setting['SettingMinLength'])) + if($app->functions->intval($setting['SettingMinLength'], true) != 0 + && strlen($postinput[$setting_id]) < $app->functions->intval($setting['SettingMinLength'], true)) $temp_errstr = sprintf($this->app->lng('error_short_value_for'), $setting['setting_name']); - if(intval($setting['SettingMaxLength']) != 0 - && strlen($postinput[$setting_id]) > intval($setting['SettingMaxLength'])) + if($app->functions->intval($setting['SettingMaxLength'], true) != 0 + && strlen($postinput[$setting_id]) > $app->functions->intval($setting['SettingMaxLength'], true)) $temp_errstr = sprintf($this->app->lng('error_long_value_for'), $setting['setting_name']); if(isset($setting['SettingRegex']) diff --git a/interface/lib/classes/auth.inc.php b/interface/lib/classes/auth.inc.php index aa4eb9f30..50d49503e 100644 --- a/interface/lib/classes/auth.inc.php +++ b/interface/lib/classes/auth.inc.php @@ -47,7 +47,7 @@ class auth { public function has_clients($userid) { global $app, $conf; - $userid = intval($userid); + $userid = $app->functions->intval($userid); $client = $app->db->queryOneRecord("SELECT client.limit_client FROM sys_user, client WHERE sys_user.userid = $userid AND sys_user.client_id = client.client_id"); if($client['limit_client'] > 0) { return true; @@ -60,8 +60,8 @@ class auth { public function add_group_to_user($userid,$groupid) { global $app; - $userid = intval($userid); - $groupid = intval($groupid); + $userid = $app->functions->intval($userid); + $groupid = $app->functions->intval($groupid); if($userid > 0 && $groupid > 0) { $user = $app->db->queryOneRecord("SELECT * FROM sys_user WHERE userid = $userid"); @@ -98,8 +98,8 @@ class auth { public function remove_group_from_user($userid,$groupid) { global $app; - $userid = intval($userid); - $groupid = intval($groupid); + $userid = $app->functions->intval($userid); + $groupid = $app->functions->intval($groupid); if($userid > 0 && $groupid > 0) { $user = $app->db->queryOneRecord("SELECT * FROM sys_user WHERE userid = $userid"); diff --git a/interface/lib/classes/client_templates.inc.php b/interface/lib/classes/client_templates.inc.php index 7c86fcff5..3acc2df6f 100644 --- a/interface/lib/classes/client_templates.inc.php +++ b/interface/lib/classes/client_templates.inc.php @@ -15,7 +15,7 @@ class client_templates { /* * Get the master-template for the client */ - $sql = "SELECT template_master, template_additional FROM client WHERE client_id = " . intval($clientId); + $sql = "SELECT template_master, template_additional FROM client WHERE client_id = " . $app->functions->intval($clientId); $record = $app->db->queryOneRecord($sql); $masterTemplateId = $record['template_master']; $additionalTemplateStr = $record['template_additional']; @@ -24,7 +24,7 @@ class client_templates { * if the master-Template is custom there is NO changing */ if ($masterTemplateId > 0){ - $sql = "SELECT * FROM client_template WHERE template_id = " . intval($masterTemplateId); + $sql = "SELECT * FROM client_template WHERE template_id = " . $app->functions->intval($masterTemplateId); $limits = $app->db->queryOneRecord($sql); } else { // if there is no master template it makes NO SENSE adding sub templates. @@ -40,7 +40,7 @@ class client_templates { $addTpl = explode('/', $additionalTemplateStr); foreach ($addTpl as $item){ if (trim($item) != ''){ - $sql = "SELECT * FROM client_template WHERE template_id = " . intval($item); + $sql = "SELECT * FROM client_template WHERE template_id = " . $app->functions->intval($item); $addLimits = $app->db->queryOneRecord($sql); /* maybe the template is deleted in the meantime */ if (is_array($addLimits)){ @@ -115,7 +115,7 @@ class client_templates { } } if($update != '') { - $sql = 'UPDATE client SET ' . $update . " WHERE client_id = " . intval($clientId); + $sql = 'UPDATE client SET ' . $update . " WHERE client_id = " . $app->functions->intval($clientId); $app->db->query($sql); } } diff --git a/interface/lib/classes/form.inc.php b/interface/lib/classes/form.inc.php index 4feb32910..898cbe6c0 100644 --- a/interface/lib/classes/form.inc.php +++ b/interface/lib/classes/form.inc.php @@ -140,6 +140,7 @@ class form { * @return record */ function decode($record) { + global $app; if(is_array($record)) { foreach($record as $key => $val) { switch ($this->tableDef[$key]['datatype']) { @@ -154,7 +155,7 @@ class form { break; case 'INTEGER': - $new_record[$key] = intval($val); + $new_record[$key] = $app->functions->intval($val); break; case 'DOUBLE': @@ -306,7 +307,7 @@ class form { } break; case 'INTEGER': - $new_record[$key] = intval($val); + $new_record[$key] = $app->functions->intval($val); break; case 'DOUBLE': $new_record[$key] = $app->db->quote($val); diff --git a/interface/lib/classes/functions.inc.php b/interface/lib/classes/functions.inc.php index fa4413aba..2e2fdfaec 100644 --- a/interface/lib/classes/functions.inc.php +++ b/interface/lib/classes/functions.inc.php @@ -299,7 +299,15 @@ class functions { return $result_array; } - + public function intval($string, $force_numeric = false) { + if(intval($string) == 2147483647) { + if($force_numeric == true) return floatval($string); + elseif(preg_match('/^([-]?)[0]*([1-9][0-9]*)([^0-9].*)*$/', $string, $match)) return $match[1].$match[2]; + else return 0; + } else { + return intval($string); + } + } } diff --git a/interface/lib/classes/getconf.inc.php b/interface/lib/classes/getconf.inc.php index 12059ac6c..ad2a30231 100644 --- a/interface/lib/classes/getconf.inc.php +++ b/interface/lib/classes/getconf.inc.php @@ -37,7 +37,7 @@ class getconf { if(!isset($this->config[$server_id])) { $app->uses('ini_parser'); - $server_id = intval($server_id); + $server_id = $app->functions->intval($server_id); $server = $app->db->queryOneRecord('SELECT config FROM server WHERE server_id = '.$server_id); $this->config[$server_id] = $app->ini_parser->parse_ini_string(stripslashes($server['config'])); } diff --git a/interface/lib/classes/listform.inc.php b/interface/lib/classes/listform.inc.php index 96c39f11d..4b6b7c1a0 100644 --- a/interface/lib/classes/listform.inc.php +++ b/interface/lib/classes/listform.inc.php @@ -194,14 +194,14 @@ class listform { global $app, $conf; //* Add Global Limit from selectbox - if(!empty($_POST['search_limit']) AND intval($_POST['search_limit'])){ - $_SESSION['search']['limit'] = intval($_POST['search_limit']); + if(!empty($_POST['search_limit']) AND $app->functions->intval($_POST['search_limit'])){ + $_SESSION['search']['limit'] = $app->functions->intval($_POST['search_limit']); } //* Get Config variables $list_name = $this->listDef['name']; $search_prefix = $this->listDef['search_prefix']; - $records_per_page = (empty($_SESSION['search']['limit']) ? intval($this->listDef['records_per_page']) : intval($_SESSION['search']['limit'])) ; + $records_per_page = (empty($_SESSION['search']['limit']) ? $app->functions->intval($this->listDef['records_per_page']) : $app->functions->intval($_SESSION['search']['limit'])) ; $table = $this->listDef['table']; //* set PAGE to zero, if in session not set @@ -210,14 +210,14 @@ class listform { } //* set PAGE to worth request variable "PAGE" - ? setze page auf wert der request variablen "page" - if(isset($_REQUEST["page"])) $_SESSION["search"][$list_name]["page"] = intval($_REQUEST["page"]); + if(isset($_REQUEST["page"])) $_SESSION["search"][$list_name]["page"] = $app->functions->intval($_REQUEST["page"]); //* PAGE to 0 set, if look for themselves ? page auf 0 setzen, wenn suche sich ge�ndert hat. if($this->searchChanged == 1) $_SESSION['search'][$list_name]['page'] = 0; - $sql_von = intval($_SESSION['search'][$list_name]['page'] * $records_per_page); + $sql_von = $app->functions->intval($_SESSION['search'][$list_name]['page'] * $records_per_page); $record_count = $app->db->queryOneRecord("SELECT count(*) AS anzahl FROM $table WHERE $sql_where"); - $pages = intval(($record_count['anzahl'] - 1) / $records_per_page); + $pages = $app->functions->intval(($record_count['anzahl'] - 1) / $records_per_page); $vars['list_file'] = $_SESSION['s']['module']['name'].'/'.$this->listDef['file']; @@ -331,7 +331,7 @@ class listform { break; case 'INTEGER': - $record[$key] = intval($record[$key]); + $record[$key] = $app->functions->intval($record[$key]); break; case 'DOUBLE': @@ -387,7 +387,7 @@ class listform { break; case 'INTEGER': - $record[$key] = intval($record[$key]); + $record[$key] = $app->functions->intval($record[$key]); break; case 'DOUBLE': diff --git a/interface/lib/classes/plugin_backuplist.inc.php b/interface/lib/classes/plugin_backuplist.inc.php index ac0396b3f..ad567b29e 100644 --- a/interface/lib/classes/plugin_backuplist.inc.php +++ b/interface/lib/classes/plugin_backuplist.inc.php @@ -53,7 +53,7 @@ class plugin_backuplist extends plugin_base { $error = ''; if(isset($_GET['backup_action'])) { - $backup_id = intval($_GET['backup_id']); + $backup_id = $app->functions->intval($_GET['backup_id']); if($_GET['backup_action'] == 'download' && $backup_id > 0) { $sql = "SELECT count(action_id) as number FROM sys_remoteaction WHERE action_state = 'pending' AND action_type = 'backup_download' AND action_param = '$backup_id'"; diff --git a/interface/lib/classes/remoting.inc.php b/interface/lib/classes/remoting.inc.php index 9b1e13ca2..6cf9133c1 100644 --- a/interface/lib/classes/remoting.inc.php +++ b/interface/lib/classes/remoting.inc.php @@ -1023,11 +1023,11 @@ class remoting { return false; } - $sys_userid = intval($sys_userid); + $sys_userid = $app->functions->intval($sys_userid); $rec = $app->db->queryOneRecord("SELECT client_id FROM sys_user WHERE userid = ".$sys_userid); if(isset($rec['client_id'])) { - return intval($rec['client_id']); + return $app->functions->intval($rec['client_id']); } else { $this->server->fault('no_client_found', 'There is no sysuser account for this client ID.'); return false; @@ -1043,11 +1043,11 @@ class remoting { return false; } - $client_id = intval($client_id); + $client_id = $app->functions->intval($client_id); $rec = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$client_id); if(isset($rec['groupid'])) { - return intval($rec['groupid']); + return $app->functions->intval($rec['groupid']); } else { $this->server->fault('no_group_found', 'There is no group for this client ID.'); return false; @@ -1112,12 +1112,12 @@ class remoting { $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); return false; } - $client_id = intval($client_id); + $client_id = $app->functions->intval($client_id); $client_group = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = $client_id"); $tables = 'client,dns_rr,dns_soa,dns_slave,ftp_user,mail_access,mail_content_filter,mail_domain,mail_forwarding,mail_get,mail_user,mail_user_filter,shell_user,spamfilter_users,support_message,web_database,web_database_user,web_domain,web_traffic'; $tables_array = explode(',',$tables); - $client_group_id = intval($client_group['groupid']); + $client_group_id = $app->functions->intval($client_group['groupid']); $table_list = array(); if($client_group_id > 1) { @@ -1133,7 +1133,7 @@ class remoting { if($client_id > 0) { // remove the group of the client from the resellers group - $parent_client_id = intval($this->dataRecord['parent_client_id']); + $parent_client_id = $app->functions->intval($this->dataRecord['parent_client_id']); $parent_user = $app->db->queryOneRecord("SELECT userid FROM sys_user WHERE client_id = $parent_client_id"); $client_group = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = $client_id"); $app->auth->remove_group_from_user($parent_user['userid'],$client_group['groupid']); @@ -1147,7 +1147,7 @@ class remoting { // Delete all records (sub-clients, mail, web, etc....) of this client. $tables = 'client,dns_rr,dns_soa,dns_slave,ftp_user,mail_access,mail_content_filter,mail_domain,mail_forwarding,mail_get,mail_user,mail_user_filter,shell_user,spamfilter_users,support_message,web_database,web_database_user,web_domain,web_traffic'; $tables_array = explode(',',$tables); - $client_group_id = intval($client_group['groupid']); + $client_group_id = $app->functions->intval($client_group['groupid']); if($client_group_id > 1) { foreach($tables_array as $table) { if($table != '') { @@ -1507,7 +1507,7 @@ class remoting { } if(!isset($params['client_group_id']) or (isset($params['client_group_id']) && empty($params['client_group_id']))) { - $rec = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".intval($client_id)); + $rec = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$app->functions->intval($client_id)); $params['client_group_id'] = $rec['groupid']; } @@ -1769,7 +1769,7 @@ class remoting { } // Delete all users that belong to this folder. - taken from web_folder_delete.php - $records = $app->db->queryAllRecords("SELECT web_folder_user_id FROM web_folder_user WHERE web_folder_id = '".intval($primary_id)."'"); + $records = $app->db->queryAllRecords("SELECT web_folder_user_id FROM web_folder_user WHERE web_folder_id = '".$app->functions->intval($primary_id)."'"); foreach($records as $rec) { $this->deleteQuery('../sites/form/web_folder_user.tform.php',$rec['web_folder_user_id']); //$app->db->datalogDelete('web_folder_user','web_folder_user_id',$rec['web_folder_user_id']); @@ -1874,7 +1874,7 @@ class remoting { $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); return false; } - $group_id = intval($group_id); + $group_id = $app->functions->intval($group_id); $sql = "SELECT domain_id, domain FROM domain WHERE sys_groupid = $group_id "; $all = $app->db->queryAllRecords($sql); return $all; @@ -1892,7 +1892,7 @@ class remoting { return false; } - $client = $app->db->queryOneRecord("SELECT default_dnsserver FROM client WHERE client_id = ".intval($client_id)); + $client = $app->db->queryOneRecord("SELECT default_dnsserver FROM client WHERE client_id = ".$app->functions->intval($client_id)); $server_id = $client["default_dnsserver"]; $template_record = $app->db->queryOneRecord("SELECT * FROM dns_template WHERE template_id = '$template_id'"); $fields = explode(',',$template_record['fields']); @@ -1959,7 +1959,7 @@ class remoting { if($error == '') { // Insert the soa record - $tmp = $app->db->queryOneRecord("SELECT userid,default_group FROM sys_user WHERE client_id = ".intval($client_id)); + $tmp = $app->db->queryOneRecord("SELECT userid,default_group FROM sys_user WHERE client_id = ".$app->functions->intval($client_id)); $sys_userid = $tmp['userid']; $sys_groupid = $tmp['default_group']; unset($tmp); @@ -2024,7 +2024,7 @@ class remoting { $rec = $app->db->queryOneRecord("SELECT id FROM dns_soa WHERE origin like '".$origin.'%'); if(isset($rec['id'])) { - return intval($rec['id']); + return $app->functions->intval($rec['id']); } else { $this->server->fault('no_domain_found', 'There is no domain ID with informed domain name.'); return false; @@ -2909,11 +2909,11 @@ class remoting { $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); return false; } - $sys_userid = intval($sys_userid); + $sys_userid = $app->functions->intval($sys_userid); $sys_groupid = explode(',', $sys_groupid); $new_group = array(); foreach($sys_groupid as $group_id) { - $new_group[] = intval( $group_id); + $new_group[] = $app->functions->intval( $group_id); } $group_list = implode(',', $new_group); $sql ="SELECT domain, domain_id, document_root, active FROM web_domain WHERE ( (sys_userid = $sys_userid AND sys_perm_user LIKE '%r%') OR (sys_groupid IN ($group_list) AND sys_perm_group LIKE '%r%') OR sys_perm_other LIKE '%r%') AND type = 'vhost'"; @@ -2947,7 +2947,7 @@ class remoting { } else { $status = 'n'; } - $sql = "UPDATE web_domain SET active = '$status' WHERE domain_id = ".intval($primary_id); + $sql = "UPDATE web_domain SET active = '$status' WHERE domain_id = ".$app->functions->intval($primary_id); $app->db->query($sql); $result = $app->db->affectedRows(); return $result; @@ -3017,7 +3017,7 @@ class remoting { $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); return false; } - $client_id = intval($client_id); + $client_id = $app->functions->intval($client_id); $client = $app->db->queryOneRecord("SELECT client_id FROM client WHERE client_id = ".$client_id); if($client['client_id'] > 0) { $new_password = $app->db->quote($new_password); @@ -3080,7 +3080,7 @@ class remoting { $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); return false; } - $client_id = intval($client_id); + $client_id = $app->functions->intval($client_id); $sql = "SELECT d.database_id, d.database_name, d.database_user_id, d.database_ro_user_id, du.database_user, du.database_password FROM web_database d LEFT JOIN web_database_user du ON (du.database_user_id = d.database_user_id) INNER JOIN sys_user s on(d.sys_groupid = s.default_group) WHERE client_id = $client_id"; $all = $app->db->queryAllRecords($sql); return $all; @@ -3113,8 +3113,8 @@ class remoting { return false; } if (!empty($client_id) && !empty($server_id)) { - $server_id = intval($server_id); - $client_id = intval($client_id); + $server_id = $app->functions->intval($server_id); + $client_id = $app->functions->intval($client_id); $sql = "SELECT id, origin FROM dns_soa d INNER JOIN sys_user s on(d.sys_groupid = s.default_group) WHERE client_id = $client_id AND server_id = $server_id"; $result = $app->db->queryAllRecords($sql); return $result; @@ -3134,7 +3134,7 @@ class remoting { $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); return false; } - $sql = "SELECT * FROM dns_rr WHERE zone = ".intval($zone_id);; + $sql = "SELECT * FROM dns_rr WHERE zone = ".$app->functions->intval($zone_id);; $result = $app->db->queryAllRecords($sql); return $result; } @@ -3159,7 +3159,7 @@ class remoting { } else { $status = 'N'; } - $sql = "UPDATE dns_soa SET active = '$status' WHERE id = ".intval($primary_id); + $sql = "UPDATE dns_soa SET active = '$status' WHERE id = ".$app->functions->intval($primary_id); $app->db->query($sql); $result = $app->db->affectedRows(); return $result; @@ -3181,7 +3181,7 @@ class remoting { } else { $status = 'n'; } - $sql = "UPDATE mail_domain SET active = '$status' WHERE domain_id = ".intval($primary_id); + $sql = "UPDATE mail_domain SET active = '$status' WHERE domain_id = ".$app->functions->intval($primary_id); $app->db->query($sql); $result = $app->db->affectedRows(); return $result; @@ -3308,7 +3308,7 @@ class remoting { $this->server->fault('permission_denied', 'You do not have the permissions to access this function.'); return false; } - $server_id = intval($server_id); + $server_id = $app->functions->intval($server_id); if($server_id > 0) { $tmp = $app->db->queryOneRecord("SELECT ip_address_id, server_id, ip_address FROM openvz_ip WHERE reserved = 'n' AND vm_id = 0 AND server_id = $server_id LIMIT 0,1"); @@ -3380,9 +3380,9 @@ class remoting { } if (!empty($client_id)) { - $client_id = intval($client_id); + $client_id = $app->functions->intval($client_id); $tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = $client_id"); - $sql = "SELECT * FROM openvz_vm WHERE sys_groupid = ".intval($tmp['groupid']); + $sql = "SELECT * FROM openvz_vm WHERE sys_groupid = ".$app->functions->intval($tmp['groupid']); $result = $app->db->queryAllRecords($sql); return $result; } @@ -3410,8 +3410,8 @@ class remoting { } - $template_id = intval($template_id); - $ostemplate_id = intval($ostemplate_id); + $template_id = $app->functions->intval($template_id); + $ostemplate_id = $app->functions->intval($ostemplate_id); //* Verify parameters if($template_id == 0) { diff --git a/interface/lib/classes/remoting_lib.inc.php b/interface/lib/classes/remoting_lib.inc.php index fcde405eb..67ad85592 100644 --- a/interface/lib/classes/remoting_lib.inc.php +++ b/interface/lib/classes/remoting_lib.inc.php @@ -37,39 +37,37 @@ Copyright (c) Tri-Plex technology /** * Formularbehandlung * -* Funktionen zur Umwandlung von Formulardaten -* sowie zum vorbereiten von HTML und SQL -* Ausgaben +* Functions to validate, display and save form values * -* Tabellendefinition +* Database table field definitions * -* Datentypen: -* - INTEGER (Wandelt Ausdr�cke in Int um) +* Datatypes: +* - INTEGER (Converts data to int automatically) * - DOUBLE -* - CURRENCY (Formatiert Zahlen nach W�hrungsnotation) -* - VARCHAR (kein weiterer Format Check) -* - DATE (Datumsformat, Timestamp Umwandlung) +* - CURRENCY (Formats digits in currency notation) +* - VARCHAR (No format check) +* - DATE (Date format, converts from and to UNIX timestamps automatically) * * Formtype: -* - TEXT (normales Textfeld) -* - PASSWORD (Feldinhalt wird nicht angezeigt) -* - SELECT (Gibt Werte als option Feld aus) -* - MULTIPLE (Select-Feld mit nehreren Werten) +* - TEXT (Normal text field) +* - PASSWORD (password field, the content will not be displayed again to the user) +* - SELECT (Option fiield) +* - MULTIPLE (Allows selection of multiple values) * * VALUE: -* - Wert oder Array +* - Value or array * * SEPARATOR -* - Trennzeichen f�r multiple Felder +* - separator char used for fileds with multiple values +* +* Hint: The auto increment (ID) filed of the table has not be be definied separately. * -* Hinweis: -* Das ID-Feld ist nicht bei den Table Values einzuf�gen. */ class remoting_lib { /** - * Definition of the database atble (array) + * Definition of the database table (array) * @var tableDef */ private $tableDef; @@ -141,7 +139,7 @@ class remoting_lib { function loadUserProfile($client_id = 0) { global $app,$conf; - $client_id = intval($client_id); + $client_id = $app->functions->intval($client_id); if($client_id == 0) { $this->sys_username = 'admin'; @@ -176,7 +174,8 @@ class remoting_lib { /** - * Converts data in human readable form + * Converts the data in the array to human readable format + * Datatype conversion e.g. to show the data in lists * * @param record * @return record @@ -208,13 +207,7 @@ class remoting_lib { break; case 'INTEGER': - //* We use + 0 to force the string to be a number as - //* intval return value is too limited on 32bit systems - if(intval($record[$key]) == 2147483647) { - $new_record[$key] = $record[$key] + 0; - } else { - $new_record[$key] = intval($record[$key]); - } + $new_record[$key] = $app->functions->intval($record[$key]); break; case 'DOUBLE': @@ -222,7 +215,7 @@ class remoting_lib { break; case 'CURRENCY': - $new_record[$key] = number_format($record[$key], 2, ',', ''); + $new_record[$key] = $app->functions->currency_format($record[$key]); break; default: @@ -263,7 +256,7 @@ class remoting_lib { unset($tmp_recordid); $querystring = str_replace("{AUTHSQL}",$this->getAuthSQL('r'),$querystring); - + // Getting the records $tmp_records = $app->db->queryAllRecords($querystring); if($app->db->errorMessage != '') die($app->db->errorMessage); @@ -285,7 +278,7 @@ class remoting_lib { $app->uses($datasource_class); $values = $app->$datasource_class->$datasource_function($field, $record); } else { - $this->errorMessage .= "Custom datasource class or function is empty
\r\n"; + $this->errorMessage .= "Custom datasource class or function is empty
\r\n"; } } @@ -294,29 +287,39 @@ class remoting_lib { } /** - * Converts the data in a format to store it in the database table + /** + * Rewrite the record data to be stored in the database + * and check values with regular expressions. * * @param record = Datensatz als Array * @return record */ - function encode($record) { + function encode($record,$dbencode = true) { global $app; if(is_array($record)) { foreach($this->formDef['fields'] as $key => $field) { - if(isset($field['validators']) && is_array($field['validators'])) $this->validateField($key, (isset($record[$key]))?$record[$key]:'', $field['validators']); + //* Apply filter to record value + if(isset($field['filters']) && is_array($field['filters'])) { + $record[$key] = $this->filterField($key, (isset($record[$key]))?$record[$key]:'', $field['filters'], 'SAVE'); + } + + //* Validate record value + if(isset($field['validators']) && is_array($field['validators'])) { + $this->validateField($key, (isset($record[$key]))?$record[$key]:'', $field['validators']); + } switch ($field['datatype']) { case 'VARCHAR': if(!@is_array($record[$key])) { - $new_record[$key] = (isset($record[$key]))?$app->db->quote($record[$key]):''; + $new_record[$key] = (isset($record[$key]))?$record[$key]:''; } else { $new_record[$key] = implode($field['separator'],$record[$key]); } break; case 'TEXT': if(!is_array($record[$key])) { - $new_record[$key] = $app->db->quote($record[$key]); + $new_record[$key] = $record[$key]; } else { $new_record[$key] = implode($field['separator'],$record[$key]); } @@ -348,12 +351,12 @@ class remoting_lib { } break; case 'INTEGER': - $new_record[$key] = (isset($record[$key]))?intval($record[$key]):0; + $new_record[$key] = (isset($record[$key]))?$app->functions->intval($record[$key]):0; //if($new_record[$key] != $record[$key]) $new_record[$key] = $field['default']; //if($key == 'refresh') die($record[$key]); break; case 'DOUBLE': - $new_record[$key] = $app->db->quote($record[$key]); + $new_record[$key] = $record[$key]; break; case 'CURRENCY': $new_record[$key] = str_replace(",",".",$record[$key]); @@ -381,12 +384,62 @@ class remoting_lib { $this->errorMessage .= $errmsg."\r\n"; } } - - + + //* Add slashes to all records, when we encode data which shall be inserted into mysql. + if($dbencode == true) $new_record[$key] = $app->db->quote($new_record[$key]); } } return $new_record; } + + /** + * process the filters for a given field. + * + * @param field_name = Name of the field + * @param field_value = value of the field + * @param filters = Array of filters + * @param filter_event = 'SAVE'or 'SHOW' + * @return record + */ + + function filterField($field_name, $field_value, $filters, $filter_event) { + + global $app; + $returnval = $field_value; + + //* Loop trough all filters + foreach($filters as $filter) { + if($filter['event'] == $filter_event) { + switch ($filter['type']) { + case 'TOLOWER': + $returnval = strtolower($field_value); + break; + case 'TOUPPER': + $returnval = strtoupper($field_value); + break; + case 'IDNTOASCII': + if(function_exists('idn_to_ascii')) { + $returnval = idn_to_ascii($field_value); + } else { + $returnval = $field_value; + } + break; + case 'IDNTOUTF8': + if(function_exists('idn_to_utf8')) { + $returnval = idn_to_utf8($field_value); + } else { + $returnval = $field_value; + } + break; + default: + $this->errorMessage .= "Unknown Filter: ".$filter['type']; + break; + } + } + } + + return $returnval; + } /** * process the validators for a given field. @@ -453,7 +506,7 @@ class remoting_lib { break; case 'ISEMAIL': if(function_exists('filter_var')) { - if(!filter_var($field_value, FILTER_VALIDATE_EMAIL)) { + if(filter_var($field_value, FILTER_VALIDATE_EMAIL) === false) { $errmsg = $validator['errmsg']; if(isset($this->wordbook[$errmsg])) { $this->errorMessage .= $this->wordbook[$errmsg]."
\r\n"; @@ -474,16 +527,16 @@ class remoting_lib { break; case 'ISINT': if(function_exists('filter_var')) { - if($vield_value != '' && filter_var($field_value, FILTER_VALIDATE_INT) === false) { + if($field_value != '' && filter_var($field_value, FILTER_VALIDATE_INT) === false) { $errmsg = $validator['errmsg']; - if(isset($this->wordbook[$errmsg])) { + if(isset($this->wordbook[$errmsg])) { $this->errorMessage .= $this->wordbook[$errmsg]."
\r\n"; } else { $this->errorMessage .= $errmsg."
\r\n"; } } } else { - $tmpval = intval($field_value); + $tmpval = $app->functions->intval($field_value); if($tmpval === 0 and !empty($field_value)) { $errmsg = $validator['errmsg']; if(isset($this->wordbook[$errmsg])) { @@ -610,14 +663,14 @@ class remoting_lib { $this->action = $action; $this->primary_id = $primary_id; - $record = $this->encode($record,$tab); + $record = $this->encode($record,true); $sql_insert_key = ''; $sql_insert_val = ''; $sql_update = ''; - if(!is_array($this->formDef)) $app->error("No form definition found."); + if(!is_array($this->formDef)) $app->error("Form definition not found."); - // gehe durch alle Felder des Tabs + // go trough all fields of the tab if(is_array($record)) { foreach($this->formDef['fields'] as $key => $field) { // Wenn es kein leeres Passwortfeld ist @@ -637,6 +690,7 @@ class remoting_lib { $record[$key] = md5(stripslashes($record[$key])); $sql_insert_val .= "'".$app->db->quote($record[$key])."', "; } + } elseif ($field['formtype'] == 'CHECKBOX') { $sql_insert_key .= "`$key`, "; if($record[$key] == '') { @@ -651,7 +705,6 @@ class remoting_lib { $sql_insert_val .= "'".$record[$key]."', "; } } else { - if($field['formtype'] == 'PASSWORD') { if(isset($field['encryption']) && $field['encryption'] == 'CRYPT') { $record[$key] = $app->auth->crypt_password(stripslashes($record[$key])); @@ -664,6 +717,7 @@ class remoting_lib { $record[$key] = md5(stripslashes($record[$key])); $sql_update .= "`$key` = '".$app->db->quote($record[$key])."', "; } + } elseif ($field['formtype'] == 'CHECKBOX') { if($record[$key] == '') { // if a checkbox is not set, we set it to the unchecked value @@ -685,7 +739,7 @@ class remoting_lib { } - + // Add backticks for incomplete table names if(stristr($this->formDef['db_table'],'.')) { $escape = ''; } else { @@ -695,7 +749,7 @@ class remoting_lib { if($action == "INSERT") { if($this->formDef['auth'] == 'yes') { - // Setze User und Gruppe + // Set user and group $sql_insert_key .= "`sys_userid`, "; $sql_insert_val .= ($this->formDef["auth_preset"]["userid"] > 0)?"'".$this->formDef["auth_preset"]["userid"]."', ":"'".$this->sys_userid."', "; $sql_insert_key .= "`sys_groupid`, "; @@ -785,7 +839,7 @@ class remoting_lib { $usertheme = $app->db->quote($params["usertheme"]); $type = 'user'; $active = 1; - $insert_id = intval($insert_id); + $insert_id = $app->functions->intval($insert_id); $language = $app->db->quote($params["language"]); $groupid = $app->db->datalogInsert('sys_group', "(name,description,client_id) VALUES ('$username','','$insert_id')", 'groupid'); $groups = $groupid; @@ -799,7 +853,7 @@ class remoting_lib { global $app; $username = $app->db->quote($params["username"]); $clear_password = $app->db->quote($params["password"]); - $client_id = intval($client_id); + $client_id = $app->functions->intval($client_id); $password = $app->auth->crypt_password(stripslashes($clear_password)); if ($clear_password) $pwstring = ", passwort = '$password'"; else $pwstring ="" ; $sql = "UPDATE sys_user set username = '$username' $pwstring WHERE client_id = $client_id"; @@ -808,7 +862,7 @@ class remoting_lib { function ispconfig_sysuser_delete($client_id){ global $app; - $client_id = intval($client_id); + $client_id = $app->functions->intval($client_id); $sql = "DELETE FROM sys_user WHERE client_id = $client_id"; $app->db->query($sql); $sql = "DELETE FROM sys_group WHERE client_id = $client_id"; @@ -820,8 +874,9 @@ class remoting_lib { $app->db->datalogSave($this->formDef['db_table'], $action, $this->formDef['db_table_idx'], $primary_id, $record_old, $record_new); return true; + /* - + // Add backticks for incomplete table names. if(stristr($this->formDef['db_table'],'.')) { $escape = ''; } else { diff --git a/interface/lib/classes/searchform.inc.php b/interface/lib/classes/searchform.inc.php index 035b7444d..ef18baf44 100644 --- a/interface/lib/classes/searchform.inc.php +++ b/interface/lib/classes/searchform.inc.php @@ -177,7 +177,7 @@ class searchform { $sql_von = $_SESSION['search'][$list_name]['page'] * $records_per_page; $record_count = $app->db->queryOneRecord("SELECT count(*) AS anzahl FROM $table WHERE $sql_where"); - $pages = intval(($record_count['anzahl'] - 1) / $records_per_page); + $pages = $app->functions->intval(($record_count['anzahl'] - 1) / $records_per_page); $vars['list_file'] = $this->listDef['file']; $vars['page'] = $_SESSION['search'][$list_name]['page']; @@ -264,6 +264,7 @@ class searchform { public function decode($record) { + global $app; if(is_array($record)) { foreach($this->listDef['item'] as $field) { $key = $field['field']; @@ -276,7 +277,7 @@ class searchform { break; case 'INTEGER': - $record[$key] = intval($record[$key]); + $record[$key] = $app->functions->intval($record[$key]); break; case 'DOUBLE': @@ -324,7 +325,7 @@ class searchform { break; case 'INTEGER': - $record[$key] = intval($record[$key]); + $record[$key] = $app->functions->intval($record[$key]); break; case 'DOUBLE': diff --git a/interface/lib/classes/sites_database_plugin.inc.php b/interface/lib/classes/sites_database_plugin.inc.php index e97566ccd..b8181aa25 100644 --- a/interface/lib/classes/sites_database_plugin.inc.php +++ b/interface/lib/classes/sites_database_plugin.inc.php @@ -34,7 +34,7 @@ class sites_database_plugin { global $app; if($form_page->dataRecord["parent_domain_id"] > 0) { - $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($form_page->dataRecord["parent_domain_id"])); + $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($form_page->dataRecord["parent_domain_id"])); //* The Database user shall be owned by the same group then the website $sys_groupid = $web['sys_groupid']; @@ -45,11 +45,11 @@ class sites_database_plugin { if($form_page->dataRecord['database_user_id']) { // check if there has already been a database on this server with that user - $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `server_id` = '" . intval($form_page->dataRecord['server_id']) . "' AND (`database_user_id` = '" . intval($form_page->dataRecord['database_user_id']) . "' OR `database_ro_user_id` = '" . intval($form_page->dataRecord['database_user_id']) . "') AND `sys_groupid` = '" . intval($sys_groupid) . "'"); + $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `server_id` = '" . $app->functions->intval($form_page->dataRecord['server_id']) . "' AND (`database_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_user_id']) . "' OR `database_ro_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_user_id']) . "') AND `sys_groupid` = '" . $app->functions->intval($sys_groupid) . "'"); if($check && $check['cnt'] < 1) { // we need to make a datalog insert for the database users that are connected to this database - $db_user = $app->db->queryOneRecord("SELECT * FROM `web_database_user` WHERE `database_user_id` = '" . intval($form_page->dataRecord['database_user_id']) . "' AND `sys_groupid` = '" . intval($sys_groupid) . "'"); + $db_user = $app->db->queryOneRecord("SELECT * FROM `web_database_user` WHERE `database_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_user_id']) . "' AND `sys_groupid` = '" . $app->functions->intval($sys_groupid) . "'"); if($db_user) { $db_user['server_id'] = $form_page->dataRecord['server_id']; $app->db->datalogSave('web_database_user', 'INSERT', 'database_user_id', $db_user['database_user_id'], array(), $db_user); @@ -59,11 +59,11 @@ class sites_database_plugin { if($form_page->dataRecord['database_ro_user_id']) { // check if there has already been a database on this server with that user - $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `server_id` = '" . intval($form_page->dataRecord['server_id']) . "' AND (`database_user_id` = '" . intval($form_page->dataRecord['database_ro_user_id']) . "' OR `database_ro_user_id` = '" . intval($form_page->dataRecord['database_ro_user_id']) . "') AND `sys_groupid` = '" . intval($sys_groupid) . "'"); + $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `server_id` = '" . $app->functions->intval($form_page->dataRecord['server_id']) . "' AND (`database_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_ro_user_id']) . "' OR `database_ro_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_ro_user_id']) . "') AND `sys_groupid` = '" . $app->functions->intval($sys_groupid) . "'"); if($check && $check['cnt'] < 1) { // we need to make a datalog insert for the database users that are connected to this database - $db_user = $app->db->queryOneRecord("SELECT * FROM `web_database_user` WHERE `database_user_id` = '" . intval($form_page->dataRecord['database_ro_user_id']) . "' AND `sys_groupid` = '" . intval($sys_groupid) . "'"); + $db_user = $app->db->queryOneRecord("SELECT * FROM `web_database_user` WHERE `database_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_ro_user_id']) . "' AND `sys_groupid` = '" . $app->functions->intval($sys_groupid) . "'"); if($db_user) { $db_user['server_id'] = $form_page->dataRecord['server_id']; $app->db->datalogSave('web_database_user', 'INSERT', 'database_user_id', $db_user['database_user_id'], array(), $db_user); @@ -75,10 +75,10 @@ class sites_database_plugin { public function processDatabaseUpdate($form_page) { global $app; - $old_record = $app->db->queryOneRecord('SELECT * FROM `web_database` WHERE `database_id` = ' . intval($form_page->id)); + $old_record = $app->db->queryOneRecord('SELECT * FROM `web_database` WHERE `database_id` = ' . $app->functions->intval($form_page->id)); if($form_page->dataRecord["parent_domain_id"] > 0) { - $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($form_page->dataRecord["parent_domain_id"])); + $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($form_page->dataRecord["parent_domain_id"])); //* The Database user shall be owned by the same group then the website $sys_groupid = $web['sys_groupid']; @@ -89,10 +89,10 @@ class sites_database_plugin { // check if database user has changed if($old_record['database_user_id'] && $old_record['database_user_id'] != $form_page->dataRecord['database_user_id'] && $old_record['database_user_id'] != $form_page->dataRecord['database_ro_user_id']) { // check if any database on the server still uses this one - $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `server_id` = '" . intval($form_page->dataRecord['server_id']) . "' AND (`database_user_id` = '" . intval($old_record['database_user_id']) . "' OR `database_ro_user_id` = '" . intval($old_record['database_user_id']) . "') AND `sys_groupid` = '" . intval($sys_groupid) . "' AND `database_id` != '" . intval($form_page->id) . "'"); + $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `server_id` = '" . $app->functions->intval($form_page->dataRecord['server_id']) . "' AND (`database_user_id` = '" . $app->functions->intval($old_record['database_user_id']) . "' OR `database_ro_user_id` = '" . $app->functions->intval($old_record['database_user_id']) . "') AND `sys_groupid` = '" . $app->functions->intval($sys_groupid) . "' AND `database_id` != '" . $app->functions->intval($form_page->id) . "'"); if($check['cnt'] < 1) { // send a datalog delete - $db_user = $app->db->queryOneRecord("SELECT * FROM `web_database_user` WHERE `database_user_id` = '" . intval($old_record['database_user_id']) . "' AND `sys_groupid` = '" . intval($sys_groupid) . "'"); + $db_user = $app->db->queryOneRecord("SELECT * FROM `web_database_user` WHERE `database_user_id` = '" . $app->functions->intval($old_record['database_user_id']) . "' AND `sys_groupid` = '" . $app->functions->intval($sys_groupid) . "'"); if($db_user) { $db_user['server_id'] = $form_page->dataRecord['server_id']; $app->db->datalogSave('web_database_user', 'DELETE', 'database_user_id', $db_user['database_user_id'], $db_user, array()); @@ -102,10 +102,10 @@ class sites_database_plugin { // check if readonly database user has changed if($old_record['database_ro_user_id'] && $old_record['database_ro_user_id'] != $form_page->dataRecord['database_ro_user_id'] && $old_record['database_ro_user_id'] != $form_page->dataRecord['database_user_id']) { // check if any database on the server still uses this one - $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `server_id` = '" . intval($form_page->dataRecord['server_id']) . "' AND (`database_user_id` = '" . intval($old_record['database_ro_user_id']) . "' OR `database_ro_user_id` = '" . intval($old_record['database_ro_user_id']) . "') AND `sys_groupid` = '" . intval($sys_groupid) . "' AND `database_id` != '" . intval($form_page->id) . "'"); + $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `server_id` = '" . $app->functions->intval($form_page->dataRecord['server_id']) . "' AND (`database_user_id` = '" . $app->functions->intval($old_record['database_ro_user_id']) . "' OR `database_ro_user_id` = '" . $app->functions->intval($old_record['database_ro_user_id']) . "') AND `sys_groupid` = '" . $app->functions->intval($sys_groupid) . "' AND `database_id` != '" . $app->functions->intval($form_page->id) . "'"); if($check['cnt'] < 1) { // send a datalog delete - $db_user = $app->db->queryOneRecord("SELECT * FROM `web_database_user` WHERE `database_user_id` = '" . intval($old_record['database_ro_user_id']) . "' AND `sys_groupid` = '" . intval($sys_groupid) . "'"); + $db_user = $app->db->queryOneRecord("SELECT * FROM `web_database_user` WHERE `database_user_id` = '" . $app->functions->intval($old_record['database_ro_user_id']) . "' AND `sys_groupid` = '" . $app->functions->intval($sys_groupid) . "'"); if($db_user) { $db_user['server_id'] = $form_page->dataRecord['server_id']; $app->db->datalogSave('web_database_user', 'DELETE', 'database_user_id', $db_user['database_user_id'], $db_user, array()); @@ -115,11 +115,11 @@ class sites_database_plugin { if($form_page->dataRecord['database_user_id']) { // check if there has already been a database on this server with that user - $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `server_id` = '" . intval($form_page->dataRecord['server_id']) . "' AND (`database_user_id` = '" . intval($form_page->dataRecord['database_user_id']) . "' OR `database_ro_user_id` = '" . intval($form_page->dataRecord['database_user_id']) . "') AND `sys_groupid` = '" . intval($sys_groupid) . "'"); + $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `server_id` = '" . $app->functions->intval($form_page->dataRecord['server_id']) . "' AND (`database_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_user_id']) . "' OR `database_ro_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_user_id']) . "') AND `sys_groupid` = '" . $app->functions->intval($sys_groupid) . "'"); if($check && $check['cnt'] < 1) { // we need to make a datalog insert for the database users that are connected to this database - $db_user = $app->db->queryOneRecord("SELECT * FROM `web_database_user` WHERE `database_user_id` = '" . intval($form_page->dataRecord['database_user_id']) . "' AND `sys_groupid` = '" . intval($sys_groupid) . "'"); + $db_user = $app->db->queryOneRecord("SELECT * FROM `web_database_user` WHERE `database_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_user_id']) . "' AND `sys_groupid` = '" . $app->functions->intval($sys_groupid) . "'"); if($db_user) { $db_user['server_id'] = $form_page->dataRecord['server_id']; $app->db->datalogSave('web_database_user', 'INSERT', 'database_user_id', $db_user['database_user_id'], array(), $db_user); @@ -129,11 +129,11 @@ class sites_database_plugin { if($form_page->dataRecord['database_ro_user_id']) { // check if there has already been a database on this server with that user - $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `server_id` = '" . intval($form_page->dataRecord['server_id']) . "' AND (`database_user_id` = '" . intval($form_page->dataRecord['database_ro_user_id']) . "' OR `database_ro_user_id` = '" . intval($form_page->dataRecord['database_ro_user_id']) . "') AND `sys_groupid` = '" . intval($sys_groupid) . "'"); + $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `server_id` = '" . $app->functions->intval($form_page->dataRecord['server_id']) . "' AND (`database_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_ro_user_id']) . "' OR `database_ro_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_ro_user_id']) . "') AND `sys_groupid` = '" . $app->functions->intval($sys_groupid) . "'"); if($check && $check['cnt'] < 1) { // we need to make a datalog insert for the database users that are connected to this database - $db_user = $app->db->queryOneRecord("SELECT * FROM `web_database_user` WHERE `database_user_id` = '" . intval($form_page->dataRecord['database_ro_user_id']) . "' AND `sys_groupid` = '" . intval($sys_groupid) . "'"); + $db_user = $app->db->queryOneRecord("SELECT * FROM `web_database_user` WHERE `database_user_id` = '" . $app->functions->intval($form_page->dataRecord['database_ro_user_id']) . "' AND `sys_groupid` = '" . $app->functions->intval($sys_groupid) . "'"); if($db_user) { $db_user['server_id'] = $form_page->dataRecord['server_id']; $app->db->datalogSave('web_database_user', 'INSERT', 'database_user_id', $db_user['database_user_id'], array(), $db_user); @@ -146,13 +146,13 @@ class sites_database_plugin { public function processDatabaseDelete($primary_id) { global $app; - $old_record = $app->db->queryOneRecord('SELECT * FROM `web_database` WHERE `database_id` = ' . intval($primary_id)); + $old_record = $app->db->queryOneRecord('SELECT * FROM `web_database` WHERE `database_id` = ' . $app->functions->intval($primary_id)); if($old_record['database_user_id']) { // check if any database on the server still uses this one - $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `server_id` = '" . intval($old_record['server_id']) . "' AND (`database_user_id` = '" . intval($old_record['database_user_id']) . "' OR `database_ro_user_id` = '" . intval($old_record['database_user_id']) . "') AND `sys_groupid` = '" . intval($old_record['sys_groupid']) . "' AND `database_id` != '" . intval($primary_id) . "'"); + $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `server_id` = '" . $app->functions->intval($old_record['server_id']) . "' AND (`database_user_id` = '" . $app->functions->intval($old_record['database_user_id']) . "' OR `database_ro_user_id` = '" . $app->functions->intval($old_record['database_user_id']) . "') AND `sys_groupid` = '" . $app->functions->intval($old_record['sys_groupid']) . "' AND `database_id` != '" . $app->functions->intval($primary_id) . "'"); if($check['cnt'] < 1) { // send a datalog delete - $db_user = $app->db->queryOneRecord("SELECT * FROM `web_database_user` WHERE `database_user_id` = '" . intval($old_record['database_user_id']) . "' AND `sys_groupid` = '" . intval($old_record['sys_groupid']) . "'"); + $db_user = $app->db->queryOneRecord("SELECT * FROM `web_database_user` WHERE `database_user_id` = '" . $app->functions->intval($old_record['database_user_id']) . "' AND `sys_groupid` = '" . $app->functions->intval($old_record['sys_groupid']) . "'"); if($db_user) { $db_user['server_id'] = $old_record['server_id']; $app->db->datalogSave('web_database_user', 'DELETE', 'database_user_id', $db_user['database_user_id'], $db_user, array()); @@ -161,10 +161,10 @@ class sites_database_plugin { } if($old_record['database_ro_user_id']) { // check if any database on the server still uses this one - $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `server_id` = '" . intval($old_record['server_id']) . "' AND (`database_user_id` = '" . intval($old_record['database_ro_user_id']) . "' OR `database_ro_user_id` = '" . intval($old_record['database_ro_user_id']) . "') AND `sys_groupid` = '" . intval($old_record['sys_groupid']) . "' AND `database_id` != '" . intval($primary_id) . "'"); + $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_database` WHERE `server_id` = '" . $app->functions->intval($old_record['server_id']) . "' AND (`database_user_id` = '" . $app->functions->intval($old_record['database_ro_user_id']) . "' OR `database_ro_user_id` = '" . $app->functions->intval($old_record['database_ro_user_id']) . "') AND `sys_groupid` = '" . $app->functions->intval($old_record['sys_groupid']) . "' AND `database_id` != '" . $app->functions->intval($primary_id) . "'"); if($check['cnt'] < 1) { // send a datalog delete - $db_user = $app->db->queryOneRecord("SELECT * FROM `web_database_user` WHERE `database_user_id` = '" . intval($old_record['database_ro_user_id']) . "' AND `sys_groupid` = '" . intval($old_record['sys_groupid']) . "'"); + $db_user = $app->db->queryOneRecord("SELECT * FROM `web_database_user` WHERE `database_user_id` = '" . $app->functions->intval($old_record['database_ro_user_id']) . "' AND `sys_groupid` = '" . $app->functions->intval($old_record['sys_groupid']) . "'"); if($db_user) { $db_user['server_id'] = $old_record['server_id']; $app->db->datalogSave('web_database_user', 'DELETE', 'database_user_id', $db_user['database_user_id'], $db_user, array()); diff --git a/interface/lib/classes/tform.inc.php b/interface/lib/classes/tform.inc.php index 8beb795b7..cfb04b416 100644 --- a/interface/lib/classes/tform.inc.php +++ b/interface/lib/classes/tform.inc.php @@ -54,14 +54,14 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SEPARATOR * - separator char used for fileds with multiple values * -* Hint: The auto increment (ID) filed of the table has not be be definied eoarately. +* Hint: The auto increment (ID) filed of the table has not be be definied separately. * */ class tform { /** - * Table definition (array) + * Definition of the database table (array) * @var tableDef */ var $tableDef; @@ -79,25 +79,25 @@ class tform { var $table_name; /** - * Enable debigging + * Debug Variable * @var debug */ var $debug = 0; /** - * name of the primary field of the datbase table (string) + * name of the primary field of the database table (string) * @var table_index */ var $table_index; /** - * contains the error message + * contains the error messages * @var errorMessage */ var $errorMessage = ''; var $dateformat = "d.m.Y"; - var $formDef; + var $formDef = array(); var $wordbook; var $module; var $primary_id; @@ -124,7 +124,7 @@ class tform { function loadFormDef($file,$module = '') { global $app,$conf; - include_once($file); + include($file); $this->formDef = $form; $this->module = $module; @@ -169,7 +169,7 @@ class tform { if(!is_array($this->formDef['tabs'][$tab])) $app->error("Tab does not exist or the tab is empty (TAB: $tab)."); $new_record = ''; $table_idx = $this->formDef['db_table_idx']; - if(isset($record[$table_idx])) $new_record[$table_idx] = intval($record[$table_idx ]); + if(isset($record[$table_idx])) $new_record[$table_idx] = $app->functions->intval($record[$table_idx ]); if(is_array($record)) { foreach($this->formDef['tabs'][$tab]['fields'] as $key => $field) { @@ -202,7 +202,7 @@ class tform { break; case 'INTEGER': - $new_record[$key] = intval($record[$key]); + $new_record[$key] = $app->functions->intval($record[$key]); break; case 'DOUBLE': @@ -224,7 +224,7 @@ class tform { } /** - * Get the key => value array of a form filed from a datasource definitiom + * Get the key => value array of a form filled from a datasource definitiom * * @param field = array with field definition * @param record = Dataset as array @@ -247,7 +247,6 @@ class tform { $table_idx = $this->formDef['db_table_idx']; $tmp_recordid = (isset($record[$table_idx]))?$record[$table_idx]:0; - //$tmp_recordid = intval($this->primary_id); $querystring = str_replace("{RECORDID}",$tmp_recordid,$querystring); unset($tmp_recordid); @@ -678,7 +677,7 @@ class tform { } break; case 'INTEGER': - $new_record[$key] = (isset($record[$key]))?$record[$key]:0; + $new_record[$key] = (isset($record[$key]))?$app->functions->intval($record[$key]):0; //if($new_record[$key] != $record[$key]) $new_record[$key] = $field['default']; //if($key == 'refresh') die($record[$key]); break; @@ -863,7 +862,7 @@ class tform { } } } else { - $tmpval = intval($field_value); + $tmpval = $app->functions->intval($field_value); if($tmpval === 0 and !empty($field_value)) { $errmsg = $validator['errmsg']; if(isset($this->wordbook[$errmsg])) { @@ -976,7 +975,7 @@ class tform { } /** - * Create the SQL staement. + * Create SQL statement * * @param record = Datensatz als Array * @param action = INSERT oder UPDATE diff --git a/interface/lib/classes/tform_actions.inc.php b/interface/lib/classes/tform_actions.inc.php index 52ebe162f..d60ecbf13 100644 --- a/interface/lib/classes/tform_actions.inc.php +++ b/interface/lib/classes/tform_actions.inc.php @@ -49,7 +49,7 @@ class tform_actions { $app->tform->loadFormDef($tform_def_file); // Importing ID - $this->id = (isset($_REQUEST["id"]))?intval($_REQUEST["id"]):0; + $this->id = (isset($_REQUEST["id"]))?$app->functions->intval($_REQUEST["id"]):0; // show print version of the form if(isset($_GET["print_form"]) && $_GET["print_form"] == 1) { @@ -291,7 +291,7 @@ class tform_actions { $app->tform->loadFormDef($tform_def_file); // importing ID - $this->id = intval($_REQUEST["id"]); + $this->id = $app->functions->intval($_REQUEST["id"]); if($this->id > 0) { diff --git a/interface/lib/classes/tools_sites.inc.php b/interface/lib/classes/tools_sites.inc.php index 8abf2b921..0619f2fd1 100644 --- a/interface/lib/classes/tools_sites.inc.php +++ b/interface/lib/classes/tools_sites.inc.php @@ -74,7 +74,7 @@ class tools_sites { } } - $tmp = $app->db->queryOneRecord("SELECT name FROM sys_group WHERE groupid = " . intval($client_group_id)); + $tmp = $app->db->queryOneRecord("SELECT name FROM sys_group WHERE groupid = " . $app->functions->intval($client_group_id)); $clientName = $tmp['name']; if ($clientName == "") $clientName = 'default'; $clientName = $this->convertClientName($clientName); @@ -100,7 +100,7 @@ class tools_sites { $client_group_id = 0; } } - $tmp = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE groupid = " . intval($client_group_id)); + $tmp = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE groupid = " . $app->functions->intval($client_group_id)); $clientID = $tmp['client_id']; if ($clientID == '') $clientID = '0'; return $clientID; diff --git a/interface/lib/classes/validate_dns.inc.php b/interface/lib/classes/validate_dns.inc.php index faab6a058..2e5643d07 100644 --- a/interface/lib/classes/validate_dns.inc.php +++ b/interface/lib/classes/validate_dns.inc.php @@ -150,7 +150,7 @@ function is_integer($value, $fieldname, $zero_allowed = 0){ $error = ''; - if(intval($value) != $value || !is_numeric($value)) $error .= $fieldname." ".$app->tform->wordbook['error_must_be_integer']."
\r\n"; + if($app->functions->intval($value, true) != $value || !is_numeric($value)) $error .= $fieldname." ".$app->tform->wordbook['error_must_be_integer']."
\r\n"; if($value > 2147483647) $error .= $fieldname." ".$app->tform->wordbook['error_must_not_be_greater_than_2147483647']."
\r\n"; if(!$zero_allowed){ if($value <= 0) $error .= $fieldname." ".$app->tform->wordbook['error_must_be_positive']."
\r\n"; @@ -268,7 +268,7 @@ function increase_serial($serial){ // increase serial $serial_date = substr($serial, 0, 8); - $count = intval(substr($serial, 8, 2)); + $count = $app->functions->intval(substr($serial, 8, 2)); $current_date = date("Ymd"); if($serial_date >= $current_date){ $count += 1; diff --git a/interface/lib/classes/validate_domain.inc.php b/interface/lib/classes/validate_domain.inc.php index 729e0cf36..e70f1618f 100644 --- a/interface/lib/classes/validate_domain.inc.php +++ b/interface/lib/classes/validate_domain.inc.php @@ -88,7 +88,7 @@ class validate_domain { $app->uses('ini_parser,getconf'); $settings = $app->getconf->get_global_config('domains'); if ($settings['use_domain_module'] == 'y') { - $sql = "SELECT domain_id, domain FROM domain WHERE domain_id = " . intval($check_domain); + $sql = "SELECT domain_id, domain FROM domain WHERE domain_id = " . $app->functions->intval($check_domain); $domain_check = $app->db->queryOneRecord($sql); if(!$domain_check) return; $check_domain = $domain_check['domain']; @@ -114,11 +114,11 @@ class validate_domain { $primary_id = $app->tform->primary_id; } - $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_domain` WHERE `domain` = '" . $app->db->quote($domain_name) . "' AND `domain_id` != " . intval($primary_id)); + $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_domain` WHERE `domain` = '" . $app->db->quote($domain_name) . "' AND `domain_id` != " . $app->functions->intval($primary_id)); if($check['cnt'] > 0) return false; if($only_domain == false) { - $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_domain` WHERE CONCAT(`subdomain`, '.', `domain`) = '" . $app->db->quote($domain_name) . "' AND `domain_id` != " . intval($primary_id)); + $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_domain` WHERE CONCAT(`subdomain`, '.', `domain`) = '" . $app->db->quote($domain_name) . "' AND `domain_id` != " . $app->functions->intval($primary_id)); if($check['cnt'] > 0) return false; } diff --git a/interface/lib/plugins/mail_user_filter_plugin.inc.php b/interface/lib/plugins/mail_user_filter_plugin.inc.php index 66f46eac5..dcdcc5442 100644 --- a/interface/lib/plugins/mail_user_filter_plugin.inc.php +++ b/interface/lib/plugins/mail_user_filter_plugin.inc.php @@ -124,8 +124,8 @@ class mail_user_filter_plugin { global $app,$conf; $app->uses("getconf"); - $mailuser_rec = $app->db->queryOneRecord("SELECT server_id FROM mail_user WHERE mailuser_id = ".intval($page_form->dataRecord["mailuser_id"])); - $mail_config = $app->getconf->get_server_config(intval($mailuser_rec["server_id"]),'mail'); + $mailuser_rec = $app->db->queryOneRecord("SELECT server_id FROM mail_user WHERE mailuser_id = ".$app->functions->intval($page_form->dataRecord["mailuser_id"])); + $mail_config = $app->getconf->get_server_config($app->functions->intval($mailuser_rec["server_id"]),'mail'); if($mail_config['mail_filter_syntax'] == 'sieve') { diff --git a/interface/lib/plugins/sites_web_database_user_plugin.inc.php b/interface/lib/plugins/sites_web_database_user_plugin.inc.php index be894caa8..30c1e2216 100644 --- a/interface/lib/plugins/sites_web_database_user_plugin.inc.php +++ b/interface/lib/plugins/sites_web_database_user_plugin.inc.php @@ -29,13 +29,13 @@ class sites_web_database_user_plugin { // make sure that the record belongs to the clinet group and not the admin group when a dmin inserts it // also make sure that the user can not delete domain created by a admin if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($page_form->dataRecord["client_group_id"])) { - $client_group_id = intval($page_form->dataRecord["client_group_id"]); + $client_group_id = $app->functions->intval($page_form->dataRecord["client_group_id"]); $app->db->query("UPDATE web_database_user SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE database_user_id = ".$page_form->id); } if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($page_form->dataRecord["client_group_id"])) { - $client_group_id = intval($page_form->dataRecord["client_group_id"]); + $client_group_id = $app->functions->intval($page_form->dataRecord["client_group_id"]); $app->db->query("UPDATE web_database_user SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE database_user_id = ".$page_form->id); } - $app->db->query("UPDATE web_database_user SET server_id = '" . intval($conf['server_id']) . "' WHERE database_user_id = ".$page_form->id); + $app->db->query("UPDATE web_database_user SET server_id = '" . $app->functions->intval($conf['server_id']) . "' WHERE database_user_id = ".$page_form->id); } } \ No newline at end of file diff --git a/interface/lib/plugins/sites_web_domain_plugin.inc.php b/interface/lib/plugins/sites_web_domain_plugin.inc.php index f41edd620..a21c56fa0 100644 --- a/interface/lib/plugins/sites_web_domain_plugin.inc.php +++ b/interface/lib/plugins/sites_web_domain_plugin.inc.php @@ -43,16 +43,16 @@ class sites_web_domain_plugin { // make sure that the record belongs to the clinet group and not the admin group when a dmin inserts it // also make sure that the user can not delete domain created by a admin if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($page_form->dataRecord["client_group_id"])) { - $client_group_id = intval($page_form->dataRecord["client_group_id"]); + $client_group_id = $app->functions->intval($page_form->dataRecord["client_group_id"]); $app->db->query("UPDATE web_domain SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE domain_id = ".$page_form->id); } if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($page_form->dataRecord["client_group_id"])) { - $client_group_id = intval($page_form->dataRecord["client_group_id"]); + $client_group_id = $app->functions->intval($page_form->dataRecord["client_group_id"]); $app->db->query("UPDATE web_domain SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE domain_id = ".$page_form->id); } // Get configuration for the web system $app->uses("getconf"); - $web_config = $app->getconf->get_server_config(intval($page_form->dataRecord['server_id']),'web'); + $web_config = $app->getconf->get_server_config($app->functions->intval($page_form->dataRecord['server_id']),'web'); $document_root = str_replace("[website_id]",$page_form->id,$web_config["website_path"]); $document_root = str_replace("[website_idhash_1]",$this->id_hash($page_form->id,1),$document_root); $document_root = str_replace("[website_idhash_2]",$this->id_hash($page_form->id,1),$document_root); @@ -63,11 +63,11 @@ class sites_web_domain_plugin { if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) { $client_group_id = $_SESSION["s"]["user"]["default_group"]; $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = $client_group_id"); - $client_id = intval($client["client_id"]); + $client_id = $app->functions->intval($client["client_id"]); } else { - //$client_id = intval($this->dataRecord["client_group_id"]); - $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".intval($page_form->dataRecord["client_group_id"])); - $client_id = intval($client["client_id"]); + //$client_id = $app->functions->intval($this->dataRecord["client_group_id"]); + $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".$app->functions->intval($page_form->dataRecord["client_group_id"])); + $client_id = $app->functions->intval($client["client_id"]); } // Set the values for document_root, system_user and system_group diff --git a/interface/lib/plugins/sites_web_vhost_subdomain_plugin.inc.php b/interface/lib/plugins/sites_web_vhost_subdomain_plugin.inc.php index a30298279..ba9f061d3 100644 --- a/interface/lib/plugins/sites_web_vhost_subdomain_plugin.inc.php +++ b/interface/lib/plugins/sites_web_vhost_subdomain_plugin.inc.php @@ -47,9 +47,9 @@ class sites_web_vhost_subdomain_plugin { // Get configuration for the web system $app->uses("getconf"); $web_rec = $app->tform->getDataRecord($page_form->id); - $web_config = $app->getconf->get_server_config(intval($web_rec['server_id']),'web'); + $web_config = $app->getconf->get_server_config($app->functions->intval($web_rec['server_id']),'web'); - $parent_domain = $app->db->queryOneRecord("SELECT * FROM `web_domain` WHERE `domain_id` = '" . intval($web_rec['parent_domain_id']) . "'"); + $parent_domain = $app->db->queryOneRecord("SELECT * FROM `web_domain` WHERE `domain_id` = '" . $app->functions->intval($web_rec['parent_domain_id']) . "'"); // Set the values for document_root, system_user and system_group $system_user = $app->db->quote($parent_domain['system_user']); @@ -61,7 +61,7 @@ class sites_web_vhost_subdomain_plugin { $php_open_basedir = $app->db->quote(str_replace("[website_domain]",$web_rec['domain'],$php_open_basedir)); $htaccess_allow_override = $app->db->quote($parent_domain['allow_override']); - $sql = "UPDATE web_domain SET sys_groupid = ".intval($parent_domain['sys_groupid']).",system_user = '$system_user', system_group = '$system_group', document_root = '$document_root', allow_override = '$htaccess_allow_override', php_open_basedir = '$php_open_basedir' WHERE domain_id = ".$page_form->id; + $sql = "UPDATE web_domain SET sys_groupid = ".$app->functions->intval($parent_domain['sys_groupid']).",system_user = '$system_user', system_group = '$system_group', document_root = '$document_root', allow_override = '$htaccess_allow_override', php_open_basedir = '$php_open_basedir' WHERE domain_id = ".$page_form->id; $app->db->query($sql); } } \ No newline at end of file diff --git a/interface/lib/plugins/vm_openvz_plugin.inc.php b/interface/lib/plugins/vm_openvz_plugin.inc.php index 42a653033..0e8696e16 100644 --- a/interface/lib/plugins/vm_openvz_plugin.inc.php +++ b/interface/lib/plugins/vm_openvz_plugin.inc.php @@ -39,11 +39,11 @@ class vm_openvz_plugin { // make sure that the record belongs to the clinet group and not the admin group when admin inserts it // also make sure that the user can not delete domain created by a admin if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) { - $client_group_id = intval($this->dataRecord["client_group_id"]); + $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); $app->db->query("UPDATE openvz_vm SET sys_groupid = $client_group_id WHERE vm_id = ".$this->id); } if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) { - $client_group_id = intval($this->dataRecord["client_group_id"]); + $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); $app->db->query("UPDATE openvz_vm SET sys_groupid = $client_group_id WHERE vm_id = ".$this->id); } @@ -80,11 +80,11 @@ class vm_openvz_plugin { // make sure that the record belongs to the clinet group and not the admin group when a admin inserts it // also make sure that the user can not delete domain created by a admin if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) { - $client_group_id = intval($this->dataRecord["client_group_id"]); + $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); $app->db->query("UPDATE openvz_vm SET sys_groupid = $client_group_id WHERE vm_id = ".$this->id); } if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) { - $client_group_id = intval($this->dataRecord["client_group_id"]); + $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); $app->db->query("UPDATE openvz_vm SET sys_groupid = $client_group_id WHERE vm_id = ".$this->id); } diff --git a/interface/web/admin/login_as.php b/interface/web/admin/login_as.php index 807897763..6c6b48788 100644 --- a/interface/web/admin/login_as.php +++ b/interface/web/admin/login_as.php @@ -45,10 +45,10 @@ if (!isset($_GET['id']) && !isset($_GET['cid'])){ } if(isset($_GET['id'])) { - $userId = intval($_GET['id']); + $userId = $app->functions->intval($_GET['id']); $backlink = 'admin/users_list.php'; } else { - $client_id = intval($_GET['cid']); + $client_id = $app->functions->intval($_GET['cid']); $tmp_client = $app->db->queryOneRecord("SELECT username FROM client WHERE client_id = $client_id"); $tmp_sys_user = $app->db->queryOneRecord("SELECT userid FROM sys_user WHERE username = '".$app->db->quote($tmp_client['username'])."'"); $userId = $tmp_sys_user['userid']; diff --git a/interface/web/admin/software_package_del.php b/interface/web/admin/software_package_del.php index 30cadec7f..bd43b3409 100644 --- a/interface/web/admin/software_package_del.php +++ b/interface/web/admin/software_package_del.php @@ -35,7 +35,7 @@ require_once('../../lib/app.inc.php'); $app->auth->check_module_permissions('admin'); if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.'); -$software_update_inst_id = intval($_GET['software_update_inst_id']); +$software_update_inst_id = $app->functions->intval($_GET['software_update_inst_id']); if($software_update_inst_id > 0) { $app->db->datalogDelete('software_update_inst', 'software_update_inst_id', $software_update_inst_id); diff --git a/interface/web/admin/software_package_install.php b/interface/web/admin/software_package_install.php index 9957c14de..f8381777f 100644 --- a/interface/web/admin/software_package_install.php +++ b/interface/web/admin/software_package_install.php @@ -38,7 +38,7 @@ $app->auth->check_module_permissions('admin'); if(!$app->auth->is_admin()) die('only allowed for administrators.'); $package_name = $app->db->quote($_REQUEST['package']); -$install_server_id = intval($_REQUEST['server_id']); +$install_server_id = $app->functions->intval($_REQUEST['server_id']); $install_key = $app->db->quote(trim($_REQUEST['install_key'])); $package = $app->db->queryOneRecord("SELECT * FROM software_package WHERE package_name = '$package_name'"); diff --git a/interface/web/admin/software_package_list.php b/interface/web/admin/software_package_list.php index c9380052c..2a2475955 100644 --- a/interface/web/admin/software_package_list.php +++ b/interface/web/admin/software_package_list.php @@ -53,7 +53,7 @@ if(is_array($repos) && isset($_GET['action']) && $_GET['action'] == 'repoupdate' $package_title = $app->db->quote($p['title']); $package_description = $app->db->quote($p['description']); - $software_repo_id = intval($repo['software_repo_id']); + $software_repo_id = $app->functions->intval($repo['software_repo_id']); $package_type = $app->db->quote($p['type']); $package_installable = $app->db->quote($p['installable']); $package_requires_db = $app->db->quote($p['requires_db']); @@ -86,13 +86,13 @@ if(is_array($repos) && isset($_GET['action']) && $_GET['action'] == 'repoupdate' foreach($updates as $u) { $version_array = explode('.',$u['version']); - $v1 = intval($version_array[0]); - $v2 = intval($version_array[1]); - $v3 = intval($version_array[2]); - $v4 = intval($version_array[3]); + $v1 = $app->functions->intval($version_array[0]); + $v2 = $app->functions->intval($version_array[1]); + $v3 = $app->functions->intval($version_array[2]); + $v4 = $app->functions->intval($version_array[3]); $package_name = $app->db->quote($u['package_name']); - $software_repo_id = intval($repo['software_repo_id']); + $software_repo_id = $app->functions->intval($repo['software_repo_id']); $update_url = $app->db->quote($u['url']); $update_md5 = $app->db->quote($u['md5']); $update_dependencies = (isset($u['dependencies']))?$app->db->quote($u['dependencies']):''; @@ -124,7 +124,7 @@ if(is_array($repos) && isset($_GET['action']) && $_GET['action'] == 'repoupdate' /* if(isset($_GET['action']) && $_GET['action'] == 'install' && $_GET['package'] != '' && $_GET['server_id'] > 0) { $package_name = $app->db->quote($_GET['package']); - $server_id = intval($_GET['server_id']); + $server_id = $app->functions->intval($_GET['server_id']); $sql = "SELECT software_update_id, package_name, update_title FROM software_update WHERE type = 'full' AND package_name = '$package_name' ORDER BY v1 DESC, v2 DESC, v3 DESC, v4 DESC LIMIT 0,1"; $tmp = $app->db->queryOneRecord($sql); $software_update_id = $tmp['software_update_id']; diff --git a/interface/web/admin/software_update_list.php b/interface/web/admin/software_update_list.php index 226a5693a..0f0924198 100644 --- a/interface/web/admin/software_update_list.php +++ b/interface/web/admin/software_update_list.php @@ -66,13 +66,13 @@ if(is_array($repos)) { foreach($updates as $u) { $version_array = explode('.',$u['version']); - $v1 = intval($version_array[0]); - $v2 = intval($version_array[1]); - $v3 = intval($version_array[2]); - $v4 = intval($version_array[3]); + $v1 = $app->functions->intval($version_array[0]); + $v2 = $app->functions->intval($version_array[1]); + $v3 = $app->functions->intval($version_array[2]); + $v4 = $app->functions->intval($version_array[3]); $package_name = $app->db->quote($u['package_name']); - $software_repo_id = intval($repo['software_repo_id']); + $software_repo_id = $app->functions->intval($repo['software_repo_id']); $update_url = $app->db->quote($u['url']); $update_md5 = $app->db->quote($u['md5']); $update_dependencies = (isset($u['dependencies']))?$app->db->quote($u['dependencies']):''; @@ -101,8 +101,8 @@ if(is_array($repos)) { //* Install packages, if GET Request if(isset($_GET['action']) && $_GET['action'] == 'install' && $_GET['package'] != '' && $_GET['server_id'] > 0) { $package_name = $app->db->quote($_GET['package']); - $server_id = intval($_GET['server_id']); - $software_update_id = intval($_GET['id']); + $server_id = $app->functions->intval($_GET['server_id']); + $software_update_id = $app->functions->intval($_GET['id']); $insert_data = "(package_name, server_id, software_update_id, status) VALUES ('$package_name', '$server_id', '$software_update_id','installing')"; // $insert_data = "(package_name, server_id, software_update_id, status) VALUES ('$package_name', '$server_id', '$software_update_id','installed')"; @@ -130,7 +130,7 @@ GROUP BY software_update.software_update_id if(isset($_POST["server_id"]) && $_POST["server_id"] > 0) { - $server_id = intval($_POST["server_id"]); + $server_id = $app->functions->intval($_POST["server_id"]); } else { $server_id = 1; } diff --git a/interface/web/client/client_del.php b/interface/web/client/client_del.php index 3cc8e5e73..5015a5517 100644 --- a/interface/web/client/client_del.php +++ b/interface/web/client/client_del.php @@ -70,20 +70,20 @@ class page_action extends tform_actions { // Load table definition from file $app->tform->loadFormDef($tform_def_file); - $this->id = intval($_REQUEST["id"]); + $this->id = $app->functions->intval($_REQUEST["id"]); $this->dataRecord = $app->tform->getDataRecord($this->id); - $client_id = intval($this->dataRecord['client_id']); + $client_id = $app->functions->intval($this->dataRecord['client_id']); - //$parent_client_id = intval($this->dataRecord['parent_client_id']); + //$parent_client_id = $app->functions->intval($this->dataRecord['parent_client_id']); //$parent_user = $app->db->queryOneRecord("SELECT userid FROM sys_user WHERE client_id = $parent_client_id"); $client_group = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = $client_id"); // Get all records (sub-clients, mail, web, etc....) of this client. $tables = 'cron,client,dns_rr,dns_soa,dns_slave,ftp_user,mail_access,mail_content_filter,mail_domain,mail_forwarding,mail_get,mail_user,mail_user_filter,shell_user,spamfilter_users,support_message,web_database,web_domain'; $tables_array = explode(',',$tables); - $client_group_id = intval($client_group['groupid']); + $client_group_id = $app->functions->intval($client_group['groupid']); $table_list = array(); if($client_group_id > 1) { @@ -115,11 +115,11 @@ class page_action extends tform_actions { function onAfterDelete() { global $app, $conf; - $client_id = intval($this->dataRecord['client_id']); + $client_id = $app->functions->intval($this->dataRecord['client_id']); if($client_id > 0) { // remove the group of the client from the resellers group - $parent_client_id = intval($this->dataRecord['parent_client_id']); + $parent_client_id = $app->functions->intval($this->dataRecord['parent_client_id']); $parent_user = $app->db->queryOneRecord("SELECT userid FROM sys_user WHERE client_id = $parent_client_id"); $client_group = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = $client_id"); $app->auth->remove_group_from_user($parent_user['userid'],$client_group['groupid']); @@ -133,7 +133,7 @@ class page_action extends tform_actions { // Delete all records (sub-clients, mail, web, etc....) of this client. $tables = 'client,dns_rr,dns_soa,dns_slave,ftp_user,mail_access,mail_content_filter,mail_domain,mail_forwarding,mail_get,mail_user,mail_user_filter,shell_user,spamfilter_users,support_message,web_database,web_domain,web_folder,web_folder_user,domain'; $tables_array = explode(',',$tables); - $client_group_id = intval($client_group['groupid']); + $client_group_id = $app->functions->intval($client_group['groupid']); if($client_group_id > 1) { foreach($tables_array as $table) { if($table != '') { diff --git a/interface/web/client/client_edit.php b/interface/web/client/client_edit.php index 4c3705a61..350244cca 100644 --- a/interface/web/client/client_edit.php +++ b/interface/web/client/client_edit.php @@ -164,18 +164,18 @@ class page_action extends tform_actions { //* to his groups, so he can administrate the records of this client. if($_SESSION['s']['user']['typ'] == 'user') { $app->auth->add_group_to_user($_SESSION['s']['user']['userid'],$groupid); - $app->db->query("UPDATE client SET parent_client_id = ".intval($_SESSION['s']['user']['client_id'])." WHERE client_id = ".$this->id); + $app->db->query("UPDATE client SET parent_client_id = ".$app->functions->intval($_SESSION['s']['user']['client_id'])." WHERE client_id = ".$this->id); } //* Set the default servers $tmp = $app->db->queryOneRecord('SELECT server_id FROM server WHERE mail_server = 1 AND mirror_server_id = 0 LIMIT 0,1'); - $default_mailserver = intval($tmp['server_id']); + $default_mailserver = $app->functions->intval($tmp['server_id']); $tmp = $app->db->queryOneRecord('SELECT server_id FROM server WHERE web_server = 1 AND mirror_server_id = 0 LIMIT 0,1'); - $default_webserver = intval($tmp['server_id']); + $default_webserver = $app->functions->intval($tmp['server_id']); $tmp = $app->db->queryOneRecord('SELECT server_id FROM server WHERE dns_server = 1 AND mirror_server_id = 0 LIMIT 0,1'); - $default_dnsserver = intval($tmp['server_id']); + $default_dnsserver = $app->functions->intval($tmp['server_id']); $tmp = $app->db->queryOneRecord('SELECT server_id FROM server WHERE db_server = 1 AND mirror_server_id = 0 LIMIT 0,1'); - $default_dbserver = intval($tmp['server_id']); + $default_dbserver = $app->functions->intval($tmp['server_id']); $sql = "UPDATE client SET default_mailserver = $default_mailserver, default_webserver = $default_webserver, default_dnsserver = $default_dnsserver, default_dbserver = $default_dbserver WHERE client_id = ".$this->id; $app->db->query($sql); diff --git a/interface/web/client/client_message.php b/interface/web/client/client_message.php index 496ee7468..fc9de0bc3 100644 --- a/interface/web/client/client_message.php +++ b/interface/web/client/client_message.php @@ -59,8 +59,8 @@ if(isset($_POST) && count($_POST) > 1) { //* Send message if($error == '') { - if(intval($_POST['recipient']) > 0){ - $circle = $app->db->queryOneRecord("SELECT client_ids FROM client_circle WHERE active = 'y' AND circle_id = ".intval($_POST['recipient'])." AND ".$app->tform->getAuthSQL('r')); + if($app->functions->intval($_POST['recipient']) > 0){ + $circle = $app->db->queryOneRecord("SELECT client_ids FROM client_circle WHERE active = 'y' AND circle_id = ".$app->functions->intval($_POST['recipient'])." AND ".$app->tform->getAuthSQL('r')); if(isset($circle['client_ids']) && $circle['client_ids'] != ''){ $tmp_client_ids = explode(',',$circle['client_ids']); $where = array(); @@ -77,7 +77,7 @@ if(isset($_POST) && count($_POST) > 1) { if($_SESSION["s"]["user"]["typ"] == 'admin'){ $sql = "SELECT * FROM client WHERE email != ''"; } else { - $client_id = intval($_SESSION['s']['user']['client_id']); + $client_id = $app->functions->intval($_SESSION['s']['user']['client_id']); if($client_id == 0) die('Invalid Client ID.'); $sql = "SELECT * FROM client WHERE email != '' AND parent_client_id = '$client_id'"; } @@ -113,7 +113,7 @@ if(isset($_POST) && count($_POST) > 1) { } else { // pre-fill Sender field with reseller's email address if($_SESSION["s"]["user"]["typ"] != 'admin'){ - $client_id = intval($_SESSION['s']['user']['client_id']); + $client_id = $app->functions->intval($_SESSION['s']['user']['client_id']); if($client_id > 0){ $sql = "SELECT email FROM client WHERE client_id = ".$client_id; $client = $app->db->queryOneRecord($sql); @@ -123,12 +123,12 @@ if(isset($_POST) && count($_POST) > 1) { } // Recipient Drop-Down -$recipient = ''; +$recipient = ''; $sql = "SELECT * FROM client_circle WHERE active = 'y' AND ".$app->tform->getAuthSQL('r'); $circles = $app->db->queryAllRecords($sql); if(is_array($circles) && !empty($circles)){ foreach($circles as $circle){ - $recipient .= ''; + $recipient .= ''; } } $app->tpl->setVar('recipient',$recipient); diff --git a/interface/web/client/domain_edit.php b/interface/web/client/domain_edit.php index 25b190cda..13e35b81a 100644 --- a/interface/web/client/domain_edit.php +++ b/interface/web/client/domain_edit.php @@ -142,7 +142,7 @@ class page_action extends tform_actions { // make sure that the record belongs to the client group and not the admin group when admin inserts it // also make sure that the user can not delete domain created by a admin if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) { - $client_group_id = intval($this->dataRecord["client_group_id"]); + $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); $app->db->query("UPDATE domain SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE domain_id = ".$this->id); } } diff --git a/interface/web/client/reseller_del.php b/interface/web/client/reseller_del.php index fefd37060..2cf2003fd 100644 --- a/interface/web/client/reseller_del.php +++ b/interface/web/client/reseller_del.php @@ -57,7 +57,7 @@ class page_action extends tform_actions { if($conf['demo_mode'] == true) $app->error('This function is disabled in demo mode.'); - $client_id = intval($this->dataRecord['client_id']); + $client_id = $app->functions->intval($this->dataRecord['client_id']); $tmp = $app->db->queryOneRecord("SELECT count(client_id) as number FROM client WHERE parent_client_id = ".$client_id); if($tmp["number"] > 0) $app->error($app->lng('error_has_clients')); @@ -67,13 +67,13 @@ class page_action extends tform_actions { function onAfterDelete() { global $app, $conf; - $client_id = intval($this->dataRecord['client_id']); + $client_id = $app->functions->intval($this->dataRecord['client_id']); if($client_id > 0) { // TODO: Delete all records (sub-clients, mail, web, etc....) of this client. // remove the group of the client from the resellers group - $parent_client_id = intval($this->dataRecord['parent_client_id']); + $parent_client_id = $app->functions->intval($this->dataRecord['parent_client_id']); $parent_user = $app->db->queryOneRecord("SELECT userid FROM sys_user WHERE client_id = $parent_client_id"); $client_group = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = $client_id"); $app->auth->remove_group_from_user($parent_user['userid'],$client_group['groupid']); diff --git a/interface/web/client/reseller_edit.php b/interface/web/client/reseller_edit.php index a58058f33..d482bdb51 100644 --- a/interface/web/client/reseller_edit.php +++ b/interface/web/client/reseller_edit.php @@ -167,13 +167,13 @@ class page_action extends tform_actions { //* Set the default servers $tmp = $app->db->queryOneRecord('SELECT server_id FROM server WHERE mail_server = 1 LIMIT 0,1'); - $default_mailserver = intval($tmp['server_id']); + $default_mailserver = $app->functions->intval($tmp['server_id']); $tmp = $app->db->queryOneRecord('SELECT server_id FROM server WHERE web_server = 1 LIMIT 0,1'); - $default_webserver = intval($tmp['server_id']); + $default_webserver = $app->functions->intval($tmp['server_id']); $tmp = $app->db->queryOneRecord('SELECT server_id FROM server WHERE dns_server = 1 LIMIT 0,1'); - $default_dnsserver = intval($tmp['server_id']); + $default_dnsserver = $app->functions->intval($tmp['server_id']); $tmp = $app->db->queryOneRecord('SELECT server_id FROM server WHERE db_server = 1 LIMIT 0,1'); - $default_dbserver = intval($tmp['server_id']); + $default_dbserver = $app->functions->intval($tmp['server_id']); $sql = "UPDATE client SET default_mailserver = $default_mailserver, default_webserver = $default_webserver, default_dnsserver = $default_dnsserver, default_dbserver = $default_dbserver WHERE client_id = ".$this->id; $app->db->query($sql); diff --git a/interface/web/dns/ajax_get_json.php b/interface/web/dns/ajax_get_json.php index 3be847c25..4ff46c234 100644 --- a/interface/web/dns/ajax_get_json.php +++ b/interface/web/dns/ajax_get_json.php @@ -49,7 +49,7 @@ $type = $_GET["type"]; $result = array(); // ipv4 - //$result[] = _search('admin', 'server_ip', "AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=".intval($_SESSION['s']['user']['client_id']).")"); + //$result[] = _search('admin', 'server_ip', "AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=".$app->functions->intval($_SESSION['s']['user']['client_id']).")"); $result[] = $app->functions->suggest_ips('IPv4'); $json = $app->functions->json_encode($result); @@ -63,7 +63,7 @@ $type = $_GET["type"]; $result = array(); // ipv6 - //$result[] = _search('admin', 'server_ip', "AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=".intval($_SESSION['s']['user']['client_id']).")"); + //$result[] = _search('admin', 'server_ip', "AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=".$app->functions->intval($_SESSION['s']['user']['client_id']).")"); $result[] = $app->functions->suggest_ips('IPv6'); $json = $app->functions->json_encode($result); diff --git a/interface/web/dns/dns_a_edit.php b/interface/web/dns/dns_a_edit.php index 01d6198d9..1f94633ff 100644 --- a/interface/web/dns/dns_a_edit.php +++ b/interface/web/dns/dns_a_edit.php @@ -76,7 +76,7 @@ class page_action extends tform_actions { global $app, $conf; // Get the parent soa record of the domain - $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r')); + $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".$app->functions->intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r')); // Check if Domain belongs to user if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"]; @@ -117,11 +117,11 @@ class page_action extends tform_actions { global $app, $conf; //* Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record - $soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); + $soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); $app->db->datalogUpdate('dns_rr', "sys_groupid = ".$soa['sys_groupid'], 'id', $this->id); //* Update the serial number of the SOA record - $soa_id = intval($_POST["zone"]); + $soa_id = $app->functions->intval($_POST["zone"]); $serial = $app->validate_dns->increase_serial($soa["serial"]); $app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id); } @@ -130,8 +130,8 @@ class page_action extends tform_actions { global $app, $conf; //* Update the serial number of the SOA record - $soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); - $soa_id = intval($_POST["zone"]); + $soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); + $soa_id = $app->functions->intval($_POST["zone"]); $serial = $app->validate_dns->increase_serial($soa["serial"]); $app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id); } diff --git a/interface/web/dns/dns_aaaa_edit.php b/interface/web/dns/dns_aaaa_edit.php index 536957aa5..ccd6fe8ad 100644 --- a/interface/web/dns/dns_aaaa_edit.php +++ b/interface/web/dns/dns_aaaa_edit.php @@ -76,7 +76,7 @@ class page_action extends tform_actions { global $app, $conf; // Get the parent soa record of the domain - $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r')); + $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".$app->functions->intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r')); // Check if Domain belongs to user if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"]; @@ -112,11 +112,11 @@ class page_action extends tform_actions { global $app, $conf; //* Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record - $soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); + $soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); $app->db->datalogUpdate('dns_rr', "sys_groupid = ".$soa['sys_groupid'], 'id', $this->id); //* Update the serial number of the SOA record - $soa_id = intval($_POST["zone"]); + $soa_id = $app->functions->intval($_POST["zone"]); $serial = $app->validate_dns->increase_serial($soa["serial"]); $app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id); } @@ -125,8 +125,8 @@ class page_action extends tform_actions { global $app, $conf; //* Update the serial number of the SOA record - $soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); - $soa_id = intval($_POST["zone"]); + $soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); + $soa_id = $app->functions->intval($_POST["zone"]); $serial = $app->validate_dns->increase_serial($soa["serial"]); $app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id); } diff --git a/interface/web/dns/dns_alias_edit.php b/interface/web/dns/dns_alias_edit.php index 63967ddb8..86a6dcd07 100644 --- a/interface/web/dns/dns_alias_edit.php +++ b/interface/web/dns/dns_alias_edit.php @@ -76,7 +76,7 @@ class page_action extends tform_actions { global $app, $conf; // Get the parent soa record of the domain - $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r')); + $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".$app->functions->intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r')); // Check if Domain belongs to user if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"]; @@ -112,11 +112,11 @@ class page_action extends tform_actions { global $app, $conf; //* Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record - $soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); + $soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); $app->db->datalogUpdate('dns_rr', "sys_groupid = ".$soa['sys_groupid'], 'id', $this->id); //* Update the serial number of the SOA record - $soa_id = intval($_POST["zone"]); + $soa_id = $app->functions->intval($_POST["zone"]); $serial = $app->validate_dns->increase_serial($soa["serial"]); $app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id); } @@ -125,8 +125,8 @@ class page_action extends tform_actions { global $app, $conf; //* Update the serial number of the SOA record - $soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); - $soa_id = intval($_POST["zone"]); + $soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); + $soa_id = $app->functions->intval($_POST["zone"]); $serial = $app->validate_dns->increase_serial($soa["serial"]); $app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id); } diff --git a/interface/web/dns/dns_cname_edit.php b/interface/web/dns/dns_cname_edit.php index 9a76c1f07..75ec7c45b 100644 --- a/interface/web/dns/dns_cname_edit.php +++ b/interface/web/dns/dns_cname_edit.php @@ -76,7 +76,7 @@ class page_action extends tform_actions { global $app, $conf; // Get the parent soa record of the domain - $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r')); + $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".$app->functions->intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r')); // Check if Domain belongs to user if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"]; @@ -117,11 +117,11 @@ class page_action extends tform_actions { global $app, $conf; //* Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record - $soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); + $soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); $app->db->datalogUpdate('dns_rr', "sys_groupid = ".$soa['sys_groupid'], 'id', $this->id); //* Update the serial number of the SOA record - $soa_id = intval($_POST["zone"]); + $soa_id = $app->functions->intval($_POST["zone"]); $serial = $app->validate_dns->increase_serial($soa["serial"]); $app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id); } @@ -130,8 +130,8 @@ class page_action extends tform_actions { global $app, $conf; //* Update the serial number of the SOA record - $soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); - $soa_id = intval($_POST["zone"]); + $soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); + $soa_id = $app->functions->intval($_POST["zone"]); $serial = $app->validate_dns->increase_serial($soa["serial"]); $app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id); } diff --git a/interface/web/dns/dns_hinfo_edit.php b/interface/web/dns/dns_hinfo_edit.php index c43af94e5..910ebeaba 100644 --- a/interface/web/dns/dns_hinfo_edit.php +++ b/interface/web/dns/dns_hinfo_edit.php @@ -76,7 +76,7 @@ class page_action extends tform_actions { global $app, $conf; // Get the parent soa record of the domain - $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r')); + $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".$app->functions->intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r')); // Check if Domain belongs to user if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"]; @@ -112,11 +112,11 @@ class page_action extends tform_actions { global $app, $conf; //* Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record - $soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); + $soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); $app->db->datalogUpdate('dns_rr', "sys_groupid = ".$soa['sys_groupid'], 'id', $this->id); //* Update the serial number of the SOA record - $soa_id = intval($_POST["zone"]); + $soa_id = $app->functions->intval($_POST["zone"]); $serial = $app->validate_dns->increase_serial($soa["serial"]); $app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id); } @@ -125,8 +125,8 @@ class page_action extends tform_actions { global $app, $conf; //* Update the serial number of the SOA record - $soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); - $soa_id = intval($_POST["zone"]); + $soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); + $soa_id = $app->functions->intval($_POST["zone"]); $serial = $app->validate_dns->increase_serial($soa["serial"]); $app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id); } diff --git a/interface/web/dns/dns_import.php b/interface/web/dns/dns_import.php index fdac6ac08..e722a1054 100644 --- a/interface/web/dns/dns_import.php +++ b/interface/web/dns/dns_import.php @@ -44,13 +44,13 @@ $app->tpl->setInclude('content_tpl','templates/dns_import.htm'); $app->load_language_file('/web/dns/lib/lang/'.$_SESSION['s']['language'].'_dns_wizard.lng'); // import variables -$template_id = (isset($_POST['template_id']))?intval($_POST['template_id']):0; -$sys_groupid = (isset($_POST['client_group_id']))?intval($_POST['client_group_id']):0; +$template_id = (isset($_POST['template_id']))?$app->functions->intval($_POST['template_id']):0; +$sys_groupid = (isset($_POST['client_group_id']))?$app->functions->intval($_POST['client_group_id']):0; $domain = (isset($_POST['domain'])&&!empty($_POST['domain']))?$_POST['domain']:NULL; // get the correct server_id if($_SESSION['s']['user']['typ'] == 'admin') { - $server_id = (isset($_POST['server_id']))?intval($_POST['server_id']):1; + $server_id = (isset($_POST['server_id']))?$app->functions->intval($_POST['server_id']):1; } else { $client_group_id = $_SESSION["s"]["user"]["default_group"]; $client = $app->db->queryOneRecord("SELECT default_dnsserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id"); @@ -129,7 +129,7 @@ $app->tpl->setVar($wb); if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name'])){ $valid_zone_file = FALSE; - $sql = "SELECT server_name FROM `server` WHERE server_id=".intval($server_id)." OR mirror_server_id=".intval($server_id)." ORDER BY server_name ASC"; + $sql = "SELECT server_name FROM `server` WHERE server_id=".$app->functions->intval($server_id)." OR mirror_server_id=".$app->functions->intval($server_id)." ORDER BY server_name ASC"; $servers = $app->db->queryAllRecords($sql); for ($i=0;$ifunctions->intval(substr($parts[1],0,-1)); break; case 'm': - $soa['ttl'] = intval(substr($parts[1],0,-1)) * 60; + $soa['ttl'] = $app->functions->intval(substr($parts[1],0,-1)) * 60; break; case 'h': - $soa['ttl'] = intval(substr($parts[1],0,-1)) * 3600; + $soa['ttl'] = $app->functions->intval(substr($parts[1],0,-1)) * 3600; break; case 'd': - $soa['ttl'] = intval(substr($parts[1],0,-1)) * 86400; + $soa['ttl'] = $app->functions->intval(substr($parts[1],0,-1)) * 86400; break; case 'w': - $soa['ttl'] = intval(substr($parts[1],0,-1)) * 604800; + $soa['ttl'] = $app->functions->intval(substr($parts[1],0,-1)) * 604800; break; default: - $soa['ttl'] = intval($parts[1]); + $soa['ttl'] = $app->functions->intval($parts[1]); } unset($time_format); } @@ -234,28 +234,28 @@ if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name' $valid_zone_file = TRUE; } // SERIAL - if($i == ($soa_array_key + 1)) $soa['serial'] = intval($parts[0]); + if($i == ($soa_array_key + 1)) $soa['serial'] = $app->functions->intval($parts[0]); // REFRESH if($i == ($soa_array_key + 2)){ $time_format = strtolower(substr($parts[0],-1)); switch ($time_format) { case 's': - $soa['refresh'] = intval(substr($parts[0],0,-1)); + $soa['refresh'] = $app->functions->intval(substr($parts[0],0,-1)); break; case 'm': - $soa['refresh'] = intval(substr($parts[0],0,-1)) * 60; + $soa['refresh'] = $app->functions->intval(substr($parts[0],0,-1)) * 60; break; case 'h': - $soa['refresh'] = intval(substr($parts[0],0,-1)) * 3600; + $soa['refresh'] = $app->functions->intval(substr($parts[0],0,-1)) * 3600; break; case 'd': - $soa['refresh'] = intval(substr($parts[0],0,-1)) * 86400; + $soa['refresh'] = $app->functions->intval(substr($parts[0],0,-1)) * 86400; break; case 'w': - $soa['refresh'] = intval(substr($parts[0],0,-1)) * 604800; + $soa['refresh'] = $app->functions->intval(substr($parts[0],0,-1)) * 604800; break; default: - $soa['refresh'] = intval($parts[0]); + $soa['refresh'] = $app->functions->intval($parts[0]); } unset($time_format); } @@ -264,22 +264,22 @@ if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name' $time_format = strtolower(substr($parts[0],-1)); switch ($time_format) { case 's': - $soa['retry'] = intval(substr($parts[0],0,-1)); + $soa['retry'] = $app->functions->intval(substr($parts[0],0,-1)); break; case 'm': - $soa['retry'] = intval(substr($parts[0],0,-1)) * 60; + $soa['retry'] = $app->functions->intval(substr($parts[0],0,-1)) * 60; break; case 'h': - $soa['retry'] = intval(substr($parts[0],0,-1)) * 3600; + $soa['retry'] = $app->functions->intval(substr($parts[0],0,-1)) * 3600; break; case 'd': - $soa['retry'] = intval(substr($parts[0],0,-1)) * 86400; + $soa['retry'] = $app->functions->intval(substr($parts[0],0,-1)) * 86400; break; case 'w': - $soa['retry'] = intval(substr($parts[0],0,-1)) * 604800; + $soa['retry'] = $app->functions->intval(substr($parts[0],0,-1)) * 604800; break; default: - $soa['retry'] = intval($parts[0]); + $soa['retry'] = $app->functions->intval($parts[0]); } unset($time_format); } @@ -288,22 +288,22 @@ if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name' $time_format = strtolower(substr($parts[0],-1)); switch ($time_format) { case 's': - $soa['expire'] = intval(substr($parts[0],0,-1)); + $soa['expire'] = $app->functions->intval(substr($parts[0],0,-1)); break; case 'm': - $soa['expire'] = intval(substr($parts[0],0,-1)) * 60; + $soa['expire'] = $app->functions->intval(substr($parts[0],0,-1)) * 60; break; case 'h': - $soa['expire'] = intval(substr($parts[0],0,-1)) * 3600; + $soa['expire'] = $app->functions->intval(substr($parts[0],0,-1)) * 3600; break; case 'd': - $soa['expire'] = intval(substr($parts[0],0,-1)) * 86400; + $soa['expire'] = $app->functions->intval(substr($parts[0],0,-1)) * 86400; break; case 'w': - $soa['expire'] = intval(substr($parts[0],0,-1)) * 604800; + $soa['expire'] = $app->functions->intval(substr($parts[0],0,-1)) * 604800; break; default: - $soa['expire'] = intval($parts[0]); + $soa['expire'] = $app->functions->intval($parts[0]); } unset($time_format); } @@ -312,22 +312,22 @@ if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name' $time_format = strtolower(substr($parts[0],-1)); switch ($time_format) { case 's': - $soa['minimum'] = intval(substr($parts[0],0,-1)); + $soa['minimum'] = $app->functions->intval(substr($parts[0],0,-1)); break; case 'm': - $soa['minimum'] = intval(substr($parts[0],0,-1)) * 60; + $soa['minimum'] = $app->functions->intval(substr($parts[0],0,-1)) * 60; break; case 'h': - $soa['minimum'] = intval(substr($parts[0],0,-1)) * 3600; + $soa['minimum'] = $app->functions->intval(substr($parts[0],0,-1)) * 3600; break; case 'd': - $soa['minimum'] = intval(substr($parts[0],0,-1)) * 86400; + $soa['minimum'] = $app->functions->intval(substr($parts[0],0,-1)) * 86400; break; case 'w': - $soa['minimum'] = intval(substr($parts[0],0,-1)) * 604800; + $soa['minimum'] = $app->functions->intval(substr($parts[0],0,-1)) * 604800; break; default: - $soa['minimum'] = intval($parts[0]); + $soa['minimum'] = $app->functions->intval($parts[0]); } unset($time_format); } @@ -358,14 +358,14 @@ if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name' $dns_rr[$r]['name'] = $parts[0]; } if(is_numeric($parts[1])){ - $dns_rr[$r]['ttl'] = intval($parts[1]); + $dns_rr[$r]['ttl'] = $app->functions->intval($parts[1]); } else { $dns_rr[$r]['ttl'] = $soa['ttl']; } switch ($resource_type) { case 'mx': case 'srv': - $dns_rr[$r]['aux'] = intval($parts[$pkey+1]); + $dns_rr[$r]['aux'] = $app->functions->intval($parts[$pkey+1]); $dns_rr[$r]['data'] = implode(' ',array_slice($parts, $pkey+2)); break; case 'txt': @@ -385,11 +385,11 @@ if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name' $pkey = 3; $dns_rr[$r]['type'] = $resource_type; $dns_rr[$r]['name'] = $parts[0]; - $dns_rr[$r]['ttl'] = intval($parts[1]); + $dns_rr[$r]['ttl'] = $app->functions->intval($parts[1]); switch ($resource_type) { case 'mx': case 'srv': - $dns_rr[$r]['aux'] = intval($parts[$pkey+1]); + $dns_rr[$r]['aux'] = $app->functions->intval($parts[$pkey+1]); $dns_rr[$r]['data'] = implode(' ',array_slice($parts, $pkey+2)); break; case 'txt': @@ -413,7 +413,7 @@ if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name' switch ($resource_type) { case 'mx': case 'srv': - $dns_rr[$r]['aux'] = intval($parts[$pkey+1]); + $dns_rr[$r]['aux'] = $app->functions->intval($parts[$pkey+1]); $dns_rr[$r]['data'] = implode(' ',array_slice($parts, $pkey+2)); break; case 'txt': @@ -433,11 +433,11 @@ if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name' $pkey = 2; $dns_rr[$r]['type'] = $resource_type; $dns_rr[$r]['name'] = $parts[0]; - $dns_rr[$r]['ttl'] = intval($parts[1]); + $dns_rr[$r]['ttl'] = $app->functions->intval($parts[1]); switch ($resource_type) { case 'mx': case 'srv': - $dns_rr[$r]['aux'] = intval($parts[$pkey+1]); + $dns_rr[$r]['aux'] = $app->functions->intval($parts[$pkey+1]); $dns_rr[$r]['data'] = implode(' ',array_slice($parts, $pkey+2)); break; case 'txt': @@ -463,7 +463,7 @@ if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name' switch ($resource_type) { case 'mx': case 'srv': - $dns_rr[$r]['aux'] = intval($parts[$pkey+1]); + $dns_rr[$r]['aux'] = $app->functions->intval($parts[$pkey+1]); $dns_rr[$r]['data'] = implode(' ',array_slice($parts, $pkey+2)); break; case 'txt': @@ -634,7 +634,7 @@ if(isset($_FILES['file']['name']) && is_uploaded_file($_FILES['file']['tmp_name' $minimum = $app->db->quote($soa['minimum']); $ttl = $app->db->quote($soa['ttl']); $xfer = $app->db->quote(''); - $serial = $app->db->quote(intval($soa['serial'])+1); + $serial = $app->db->quote($app->functions->intval($soa['serial'])+1); //print_r($soa); //die(); if($valid_zone_file){ diff --git a/interface/web/dns/dns_mx_edit.php b/interface/web/dns/dns_mx_edit.php index 22c89e5d7..d78ae720e 100644 --- a/interface/web/dns/dns_mx_edit.php +++ b/interface/web/dns/dns_mx_edit.php @@ -76,7 +76,7 @@ class page_action extends tform_actions { global $app, $conf; // Get the parent soa record of the domain - $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r')); + $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".$app->functions->intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r')); // Check if Domain belongs to user if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"]; @@ -112,11 +112,11 @@ class page_action extends tform_actions { global $app, $conf; //* Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record - $soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); + $soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); $app->db->datalogUpdate('dns_rr', "sys_groupid = ".$soa['sys_groupid'], 'id', $this->id); //* Update the serial number of the SOA record - $soa_id = intval($_POST["zone"]); + $soa_id = $app->functions->intval($_POST["zone"]); $serial = $app->validate_dns->increase_serial($soa["serial"]); $app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id); } @@ -125,8 +125,8 @@ class page_action extends tform_actions { global $app, $conf; //* Update the serial number of the SOA record - $soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); - $soa_id = intval($_POST["zone"]); + $soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); + $soa_id = $app->functions->intval($_POST["zone"]); $serial = $app->validate_dns->increase_serial($soa["serial"]); $app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id); } diff --git a/interface/web/dns/dns_ns_edit.php b/interface/web/dns/dns_ns_edit.php index 2fdee3f1f..059c0e050 100644 --- a/interface/web/dns/dns_ns_edit.php +++ b/interface/web/dns/dns_ns_edit.php @@ -76,7 +76,7 @@ class page_action extends tform_actions { global $app, $conf; // Get the parent soa record of the domain - $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r')); + $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".$app->functions->intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r')); // Check if Domain belongs to user if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"]; @@ -112,11 +112,11 @@ class page_action extends tform_actions { global $app, $conf; //* Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record - $soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); + $soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); $app->db->datalogUpdate('dns_rr', "sys_groupid = ".$soa['sys_groupid'], 'id', $this->id); //* Update the serial number of the SOA record - $soa_id = intval($_POST["zone"]); + $soa_id = $app->functions->intval($_POST["zone"]); $serial = $app->validate_dns->increase_serial($soa["serial"]); $app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id); } @@ -125,8 +125,8 @@ class page_action extends tform_actions { global $app, $conf; //* Update the serial number of the SOA record - $soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); - $soa_id = intval($_POST["zone"]); + $soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); + $soa_id = $app->functions->intval($_POST["zone"]); $serial = $app->validate_dns->increase_serial($soa["serial"]); $app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id); } diff --git a/interface/web/dns/dns_ptr_edit.php b/interface/web/dns/dns_ptr_edit.php index e82f8d821..8dc790e99 100644 --- a/interface/web/dns/dns_ptr_edit.php +++ b/interface/web/dns/dns_ptr_edit.php @@ -76,7 +76,7 @@ class page_action extends tform_actions { global $app, $conf; // Get the parent soa record of the domain - $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r')); + $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".$app->functions->intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r')); // Check if Domain belongs to user if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"]; @@ -112,11 +112,11 @@ class page_action extends tform_actions { global $app, $conf; //* Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record - $soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); + $soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); $app->db->datalogUpdate('dns_rr', "sys_groupid = ".$soa['sys_groupid'], 'id', $this->id); //* Update the serial number of the SOA record - $soa_id = intval($_POST["zone"]); + $soa_id = $app->functions->intval($_POST["zone"]); $serial = $app->validate_dns->increase_serial($soa["serial"]); $app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id); } @@ -125,8 +125,8 @@ class page_action extends tform_actions { global $app, $conf; //* Update the serial number of the SOA record - $soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); - $soa_id = intval($_POST["zone"]); + $soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); + $soa_id = $app->functions->intval($_POST["zone"]); $serial = $app->validate_dns->increase_serial($soa["serial"]); $app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id); } diff --git a/interface/web/dns/dns_rp_edit.php b/interface/web/dns/dns_rp_edit.php index a628bfb1e..0e4eb0b6c 100644 --- a/interface/web/dns/dns_rp_edit.php +++ b/interface/web/dns/dns_rp_edit.php @@ -76,7 +76,7 @@ class page_action extends tform_actions { global $app, $conf; // Get the parent soa record of the domain - $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r')); + $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".$app->functions->intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r')); // Check if Domain belongs to user if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"]; @@ -112,11 +112,11 @@ class page_action extends tform_actions { global $app, $conf; //* Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record - $soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); + $soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); $app->db->datalogUpdate('dns_rr', "sys_groupid = ".$soa['sys_groupid'], 'id', $this->id); //* Update the serial number of the SOA record - $soa_id = intval($_POST["zone"]); + $soa_id = $app->functions->intval($_POST["zone"]); $serial = $app->validate_dns->increase_serial($soa["serial"]); $app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id); } @@ -125,8 +125,8 @@ class page_action extends tform_actions { global $app, $conf; //* Update the serial number of the SOA record - $soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); - $soa_id = intval($_POST["zone"]); + $soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); + $soa_id = $app->functions->intval($_POST["zone"]); $serial = $app->validate_dns->increase_serial($soa["serial"]); $app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id); } diff --git a/interface/web/dns/dns_rr_del.php b/interface/web/dns/dns_rr_del.php index d88e2d949..46356e18d 100644 --- a/interface/web/dns/dns_rr_del.php +++ b/interface/web/dns/dns_rr_del.php @@ -54,8 +54,8 @@ class page_action extends tform_actions { global $app; $conf; //* Update the serial number of the SOA record - $soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); - $soa_id = intval($this->dataRecord["zone"]); + $soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); + $soa_id = $app->functions->intval($this->dataRecord["zone"]); $serial = $app->validate_dns->increase_serial($soa["serial"]); $app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id); } diff --git a/interface/web/dns/dns_slave_del.php b/interface/web/dns/dns_slave_del.php index 470bb7c0a..a2bba0022 100644 --- a/interface/web/dns/dns_slave_del.php +++ b/interface/web/dns/dns_slave_del.php @@ -56,7 +56,7 @@ class page_action extends tform_actions { if($app->tform->checkPerm($this->id,'d') == false) $app->error($app->lng('error_no_delete_permission')); // Delete all records that belog to this zone. - $records = $app->db->queryAllRecords("SELECT id FROM dns_slave WHERE zone = '".intval($this->id)."'"); + $records = $app->db->queryAllRecords("SELECT id FROM dns_slave WHERE zone = '".$app->functions->intval($this->id)."'"); foreach($records as $rec) { $app->db->datalogDelete('dns_slave','id',$rec['id']); } diff --git a/interface/web/dns/dns_slave_edit.php b/interface/web/dns/dns_slave_edit.php index 5e7df8512..82d62b401 100644 --- a/interface/web/dns/dns_slave_edit.php +++ b/interface/web/dns/dns_slave_edit.php @@ -128,7 +128,7 @@ class page_action extends tform_actions { // When the record is updated if($this->id > 0) { // restore the server ID if the user is not admin and record is edited - $tmp = $app->db->queryOneRecord("SELECT server_id FROM dns_slave WHERE id = ".intval($this->id)); + $tmp = $app->db->queryOneRecord("SELECT server_id FROM dns_slave WHERE id = ".$app->functions->intval($this->id)); $this->dataRecord["server_id"] = $tmp["server_id"]; unset($tmp); // When the record is inserted @@ -163,11 +163,11 @@ class page_action extends tform_actions { // make sure that the record belongs to the client group and not the admin group when a dmin inserts it if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) { - $client_group_id = intval($this->dataRecord["client_group_id"]); + $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); $app->db->query("UPDATE dns_slave SET sys_groupid = $client_group_id WHERE id = ".$this->id); } if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) { - $client_group_id = intval($this->dataRecord["client_group_id"]); + $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); $app->db->query("UPDATE dns_slave SET sys_groupid = $client_group_id WHERE id = ".$this->id); } @@ -180,17 +180,17 @@ class page_action extends tform_actions { // make sure that the record belongs to the client group and not the admin group when a dmin inserts it if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) { - $client_group_id = intval($this->dataRecord["client_group_id"]); + $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); $app->db->query("UPDATE dns_slave SET sys_groupid = $client_group_id WHERE id = ".$this->id); } if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) { - $client_group_id = intval($this->dataRecord["client_group_id"]); + $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); $app->db->query("UPDATE dns_slave SET sys_groupid = $client_group_id WHERE id = ".$this->id); } //** When the client group has changed, change also the owner of the record if the owner is not the admin user if($this->oldDataRecord["client_group_id"] != $this->dataRecord["client_group_id"] && $this->dataRecord["sys_userid"] != 1) { - $client_group_id = intval($this->dataRecord["client_group_id"]); + $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); $tmp = $app->db->queryOneREcord("SELECT userid FROM sys_user WHERE default_group = ".$client_group_id); if($tmp["userid"] > 0) { $app->db->query("UPDATE dns_slave SET sys_userid = ".$tmp["userid"]." WHERE id = ".$this->id); diff --git a/interface/web/dns/dns_soa_del.php b/interface/web/dns/dns_soa_del.php index 0a1944b5f..82d680b0c 100644 --- a/interface/web/dns/dns_soa_del.php +++ b/interface/web/dns/dns_soa_del.php @@ -56,7 +56,7 @@ class page_action extends tform_actions { if($app->tform->checkPerm($this->id,'d') == false) $app->error($app->lng('error_no_delete_permission')); // Delete all records that belog to this zone. - $records = $app->db->queryAllRecords("SELECT id FROM dns_rr WHERE zone = '".intval($this->id)."'"); + $records = $app->db->queryAllRecords("SELECT id FROM dns_rr WHERE zone = '".$app->functions->intval($this->id)."'"); foreach($records as $rec) { $app->db->datalogDelete('dns_rr','id',$rec['id']); } diff --git a/interface/web/dns/dns_soa_edit.php b/interface/web/dns/dns_soa_edit.php index 48c4b25ac..5ffa3acf4 100644 --- a/interface/web/dns/dns_soa_edit.php +++ b/interface/web/dns/dns_soa_edit.php @@ -138,7 +138,7 @@ class page_action extends tform_actions { // When the record is updated if($this->id > 0) { // restore the server ID if the user is not admin and record is edited - $tmp = $app->db->queryOneRecord("SELECT server_id FROM dns_soa WHERE id = ".intval($this->id)); + $tmp = $app->db->queryOneRecord("SELECT server_id FROM dns_soa WHERE id = ".$app->functions->intval($this->id)); $this->dataRecord["server_id"] = $tmp["server_id"]; unset($tmp); // When the record is inserted @@ -187,13 +187,13 @@ class page_action extends tform_actions { // make sure that the record belongs to the client group and not the admin group when a dmin inserts it if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) { - $client_group_id = intval($this->dataRecord["client_group_id"]); + $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); $app->db->query("UPDATE dns_soa SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE id = ".$this->id); // And we want to update all rr records too, that belong to this record $app->db->query("UPDATE dns_rr SET sys_groupid = $client_group_id WHERE zone = ".$this->id); } if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) { - $client_group_id = intval($this->dataRecord["client_group_id"]); + $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); $app->db->query("UPDATE dns_soa SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE id = ".$this->id); // And we want to update all rr records too, that belong to this record $app->db->query("UPDATE dns_rr SET sys_groupid = $client_group_id WHERE zone = ".$this->id); @@ -230,13 +230,13 @@ class page_action extends tform_actions { // make sure that the record belongs to the client group and not the admin group when a dmin inserts it if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) { - $client_group_id = intval($this->dataRecord["client_group_id"]); + $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); $app->db->query("UPDATE dns_soa SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE id = ".$this->id); // And we want to update all rr records too, that belong to this record $app->db->query("UPDATE dns_rr SET sys_groupid = $client_group_id WHERE zone = ".$this->id); } if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) { - $client_group_id = intval($this->dataRecord["client_group_id"]); + $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); $app->db->query("UPDATE dns_soa SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE id = ".$this->id); // And we want to update all rr records too, that belong to this record $app->db->query("UPDATE dns_rr SET sys_groupid = $client_group_id WHERE zone = ".$this->id); @@ -244,7 +244,7 @@ class page_action extends tform_actions { //** When the client group has changed, change also the owner of the record if the owner is not the admin user if($this->oldDataRecord["client_group_id"] != $this->dataRecord["client_group_id"] && $this->dataRecord["sys_userid"] != 1) { - $client_group_id = intval($this->dataRecord["client_group_id"]); + $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); $tmp = $app->db->queryOneREcord("SELECT userid FROM sys_user WHERE default_group = ".$client_group_id); if($tmp["userid"] > 0) { $app->db->query("UPDATE dns_soa SET sys_userid = ".$tmp["userid"]." WHERE id = ".$this->id); diff --git a/interface/web/dns/dns_srv_edit.php b/interface/web/dns/dns_srv_edit.php index a9d77fdb2..893fcd207 100644 --- a/interface/web/dns/dns_srv_edit.php +++ b/interface/web/dns/dns_srv_edit.php @@ -105,7 +105,7 @@ class page_action extends tform_actions { global $app, $conf; // Get the parent soa record of the domain - $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r')); + $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".$app->functions->intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r')); // Check if Domain belongs to user if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"]; @@ -141,11 +141,11 @@ class page_action extends tform_actions { global $app, $conf; //* Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record - $soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); + $soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); $app->db->datalogUpdate('dns_rr', "sys_groupid = ".$soa['sys_groupid'], 'id', $this->id); //* Update the serial number of the SOA record - $soa_id = intval($_POST["zone"]); + $soa_id = $app->functions->intval($_POST["zone"]); $serial = $app->validate_dns->increase_serial($soa["serial"]); $app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id); } @@ -154,8 +154,8 @@ class page_action extends tform_actions { global $app, $conf; //* Update the serial number of the SOA record - $soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); - $soa_id = intval($_POST["zone"]); + $soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); + $soa_id = $app->functions->intval($_POST["zone"]); $serial = $app->validate_dns->increase_serial($soa["serial"]); $app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id); } diff --git a/interface/web/dns/dns_txt_edit.php b/interface/web/dns/dns_txt_edit.php index b31af031f..2445f0321 100644 --- a/interface/web/dns/dns_txt_edit.php +++ b/interface/web/dns/dns_txt_edit.php @@ -76,7 +76,7 @@ class page_action extends tform_actions { global $app, $conf; // Get the parent soa record of the domain - $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r')); + $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = '".$app->functions->intval($_POST["zone"])."' AND ".$app->tform->getAuthSQL('r')); // Check if Domain belongs to user if($soa["id"] != $_POST["zone"]) $app->tform->errorMessage .= $app->tform->wordbook["no_zone_perm"]; @@ -112,11 +112,11 @@ class page_action extends tform_actions { global $app, $conf; //* Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record - $soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); + $soa = $app->db->queryOneRecord("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); $app->db->datalogUpdate('dns_rr', "sys_groupid = ".$soa['sys_groupid'], 'id', $this->id); //* Update the serial number of the SOA record - $soa_id = intval($_POST["zone"]); + $soa_id = $app->functions->intval($_POST["zone"]); $serial = $app->validate_dns->increase_serial($soa["serial"]); $app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id); } @@ -125,8 +125,8 @@ class page_action extends tform_actions { global $app, $conf; //* Update the serial number of the SOA record - $soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); - $soa_id = intval($_POST["zone"]); + $soa = $app->db->queryOneRecord("SELECT serial FROM dns_soa WHERE id = '".$app->functions->intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r')); + $soa_id = $app->functions->intval($_POST["zone"]); $serial = $app->validate_dns->increase_serial($soa["serial"]); $app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id); } diff --git a/interface/web/dns/dns_wizard.php b/interface/web/dns/dns_wizard.php index 18c75298a..216e084ce 100644 --- a/interface/web/dns/dns_wizard.php +++ b/interface/web/dns/dns_wizard.php @@ -42,12 +42,12 @@ $app->tpl->setInclude('content_tpl','templates/dns_wizard.htm'); $app->load_language_file('/web/dns/lib/lang/'.$_SESSION['s']['language'].'_dns_wizard.lng'); // import variables -$template_id = (isset($_POST['template_id']))?intval($_POST['template_id']):0; -$sys_groupid = (isset($_POST['client_group_id']))?intval($_POST['client_group_id']):0; +$template_id = (isset($_POST['template_id']))?$app->functions->intval($_POST['template_id']):0; +$sys_groupid = (isset($_POST['client_group_id']))?$app->functions->intval($_POST['client_group_id']):0; // get the correct server_id if($_SESSION['s']['user']['typ'] == 'admin') { - $server_id = (isset($_POST['server_id']))?intval($_POST['server_id']):1; + $server_id = (isset($_POST['server_id']))?$app->functions->intval($_POST['server_id']):1; } else { $client_group_id = $_SESSION["s"]["user"]["default_group"]; $client = $app->db->queryOneRecord("SELECT default_dnsserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id"); @@ -145,9 +145,9 @@ if($_POST['create'] == 1) { // make sure that the record belongs to the clinet group and not the admin group when a dmin inserts it if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($_POST['client_group_id'])) { - $sys_groupid = intval($_POST['client_group_id']); + $sys_groupid = $app->functions->intval($_POST['client_group_id']); } elseif($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($_POST['client_group_id'])) { - $sys_groupid = intval($_POST['client_group_id']); + $sys_groupid = $app->functions->intval($_POST['client_group_id']); } else { $sys_groupid = $_SESSION["s"]["user"]["default_group"]; } diff --git a/interface/web/dns/form/dns_a.tform.php b/interface/web/dns/form/dns_a.tform.php index ed67f8ad0..50950c085 100644 --- a/interface/web/dns/form/dns_a.tform.php +++ b/interface/web/dns/form/dns_a.tform.php @@ -32,6 +32,7 @@ */ +global $app; $form["title"] = "DNS A"; $form["description"] = ""; @@ -69,7 +70,7 @@ $form["tabs"]['dns'] = array ( 'zone' => array ( 'datatype' => 'INTEGER', 'formtype' => 'TEXT', - 'default' => @intval($_REQUEST["zone"]), + 'default' => @$app->functions->intval($_REQUEST["zone"]), 'value' => '', 'width' => '30', 'maxlength' => '255' diff --git a/interface/web/dns/form/dns_aaaa.tform.php b/interface/web/dns/form/dns_aaaa.tform.php index de7de68e1..d674913c2 100644 --- a/interface/web/dns/form/dns_aaaa.tform.php +++ b/interface/web/dns/form/dns_aaaa.tform.php @@ -32,6 +32,7 @@ */ +global $app; $form["title"] = "DNS AAAA"; $form["description"] = ""; @@ -69,7 +70,7 @@ $form["tabs"]['dns'] = array ( 'zone' => array ( 'datatype' => 'INTEGER', 'formtype' => 'TEXT', - 'default' => @intval($_REQUEST["zone"]), + 'default' => @$app->functions->intval($_REQUEST["zone"]), 'value' => '', 'width' => '30', 'maxlength' => '255' diff --git a/interface/web/dns/form/dns_alias.tform.php b/interface/web/dns/form/dns_alias.tform.php index 69e060fd1..c998f8151 100644 --- a/interface/web/dns/form/dns_alias.tform.php +++ b/interface/web/dns/form/dns_alias.tform.php @@ -32,6 +32,7 @@ */ +global $app; $form["title"] = "DNS ALIAS"; $form["description"] = ""; @@ -69,7 +70,7 @@ $form["tabs"]['dns'] = array ( 'zone' => array ( 'datatype' => 'INTEGER', 'formtype' => 'TEXT', - 'default' => @intval($_REQUEST["zone"]), + 'default' => @$app->functions->intval($_REQUEST["zone"]), 'value' => '', 'width' => '30', 'maxlength' => '255' diff --git a/interface/web/dns/form/dns_cname.tform.php b/interface/web/dns/form/dns_cname.tform.php index e8f9a4e02..c9e9d9bcd 100644 --- a/interface/web/dns/form/dns_cname.tform.php +++ b/interface/web/dns/form/dns_cname.tform.php @@ -32,6 +32,7 @@ */ +global $app; $form["title"] = "DNS CNAME"; $form["description"] = ""; @@ -69,7 +70,7 @@ $form["tabs"]['dns'] = array ( 'zone' => array ( 'datatype' => 'INTEGER', 'formtype' => 'TEXT', - 'default' => @intval($_REQUEST["zone"]), + 'default' => @$app->functions->intval($_REQUEST["zone"]), 'value' => '', 'width' => '30', 'maxlength' => '255' diff --git a/interface/web/dns/form/dns_hinfo.tform.php b/interface/web/dns/form/dns_hinfo.tform.php index 9a56f1b7c..556d57344 100644 --- a/interface/web/dns/form/dns_hinfo.tform.php +++ b/interface/web/dns/form/dns_hinfo.tform.php @@ -32,6 +32,7 @@ */ +global $app; $form["title"] = "DNS hinfo"; $form["description"] = ""; @@ -69,7 +70,7 @@ $form["tabs"]['dns'] = array ( 'zone' => array ( 'datatype' => 'INTEGER', 'formtype' => 'TEXT', - 'default' => @intval($_REQUEST["zone"]), + 'default' => @$app->functions->intval($_REQUEST["zone"]), 'value' => '', 'width' => '30', 'maxlength' => '255' diff --git a/interface/web/dns/form/dns_mx.tform.php b/interface/web/dns/form/dns_mx.tform.php index 9afc26c8f..df8ef7263 100644 --- a/interface/web/dns/form/dns_mx.tform.php +++ b/interface/web/dns/form/dns_mx.tform.php @@ -33,6 +33,8 @@ */ +global $app; + $form["title"] = "DNS mx"; $form["description"] = ""; $form["name"] = "dns_mx"; @@ -69,7 +71,7 @@ $form["tabs"]['dns'] = array ( 'zone' => array ( 'datatype' => 'INTEGER', 'formtype' => 'TEXT', - 'default' => @intval($_REQUEST["zone"]), + 'default' => @$app->functions->intval($_REQUEST["zone"]), 'value' => '', 'width' => '30', 'maxlength' => '255' diff --git a/interface/web/dns/form/dns_ns.tform.php b/interface/web/dns/form/dns_ns.tform.php index aad83bd18..2efa866fa 100644 --- a/interface/web/dns/form/dns_ns.tform.php +++ b/interface/web/dns/form/dns_ns.tform.php @@ -32,6 +32,7 @@ */ +global $app; $form["title"] = "DNS ns"; $form["description"] = ""; @@ -69,7 +70,7 @@ $form["tabs"]['dns'] = array ( 'zone' => array ( 'datatype' => 'INTEGER', 'formtype' => 'TEXT', - 'default' => @intval($_REQUEST["zone"]), + 'default' => @$app->functions->intval($_REQUEST["zone"]), 'value' => '', 'width' => '30', 'maxlength' => '255' diff --git a/interface/web/dns/form/dns_ptr.tform.php b/interface/web/dns/form/dns_ptr.tform.php index 01a12344d..4b1a2d824 100644 --- a/interface/web/dns/form/dns_ptr.tform.php +++ b/interface/web/dns/form/dns_ptr.tform.php @@ -32,6 +32,7 @@ */ +global $app; $form["title"] = "DNS ptr"; $form["description"] = ""; @@ -69,7 +70,7 @@ $form["tabs"]['dns'] = array ( 'zone' => array ( 'datatype' => 'INTEGER', 'formtype' => 'TEXT', - 'default' => @intval($_REQUEST["zone"]), + 'default' => @$app->functions->intval($_REQUEST["zone"]), 'value' => '', 'width' => '30', 'maxlength' => '255' diff --git a/interface/web/dns/form/dns_rp.tform.php b/interface/web/dns/form/dns_rp.tform.php index aa94b55ca..35737a27a 100644 --- a/interface/web/dns/form/dns_rp.tform.php +++ b/interface/web/dns/form/dns_rp.tform.php @@ -32,6 +32,7 @@ */ +global $app; $form["title"] = "DNS RP"; $form["description"] = ""; @@ -69,7 +70,7 @@ $form["tabs"]['dns'] = array ( 'zone' => array ( 'datatype' => 'INTEGER', 'formtype' => 'TEXT', - 'default' => @intval($_REQUEST["zone"]), + 'default' => @$app->functions->intval($_REQUEST["zone"]), 'value' => '', 'width' => '30', 'maxlength' => '255' diff --git a/interface/web/dns/form/dns_soa.tform.php b/interface/web/dns/form/dns_soa.tform.php index 16e9b11e0..175bb12ee 100644 --- a/interface/web/dns/form/dns_soa.tform.php +++ b/interface/web/dns/form/dns_soa.tform.php @@ -37,6 +37,7 @@ */ +global $app; $form["title"] = "DNS Zone"; $form["description"] = ""; @@ -250,7 +251,7 @@ $form["tabs"]['dns_records'] = array ( 'class' => 'plugin_listview', 'options' => array( 'listdef' => 'list/dns_a.list.php', - 'sqlextwhere' => "zone = ".@intval(@$_REQUEST['id']), + 'sqlextwhere' => "zone = ".@$app->functions->intval(@$_REQUEST['id']), 'sql_order_by' => "ORDER BY type, name" ) ) diff --git a/interface/web/dns/form/dns_srv.tform.php b/interface/web/dns/form/dns_srv.tform.php index 0891c92fa..25f3584ae 100644 --- a/interface/web/dns/form/dns_srv.tform.php +++ b/interface/web/dns/form/dns_srv.tform.php @@ -32,6 +32,7 @@ */ +global $app; $form["title"] = "DNS SRV"; $form["description"] = ""; @@ -69,7 +70,7 @@ $form["tabs"]['dns'] = array ( 'zone' => array ( 'datatype' => 'INTEGER', 'formtype' => 'TEXT', - 'default' => @intval($_REQUEST["zone"]), + 'default' => @$app->functions->intval($_REQUEST["zone"]), 'value' => '', 'width' => '30', 'maxlength' => '255' diff --git a/interface/web/dns/form/dns_txt.tform.php b/interface/web/dns/form/dns_txt.tform.php index e9d616d65..ad68d9781 100644 --- a/interface/web/dns/form/dns_txt.tform.php +++ b/interface/web/dns/form/dns_txt.tform.php @@ -32,6 +32,7 @@ */ +global $app; $form["title"] = "DNS TXT Record"; $form["description"] = ""; @@ -69,7 +70,7 @@ $form["tabs"]['dns'] = array ( 'zone' => array ( 'datatype' => 'INTEGER', 'formtype' => 'TEXT', - 'default' => @intval($_REQUEST["zone"]), + 'default' => @$app->functions->intval($_REQUEST["zone"]), 'value' => '', 'width' => '30', 'maxlength' => '255' diff --git a/interface/web/mail/form/mail_user.tform.php b/interface/web/mail/form/mail_user.tform.php index 6232da7b0..0dd7c8f98 100644 --- a/interface/web/mail/form/mail_user.tform.php +++ b/interface/web/mail/form/mail_user.tform.php @@ -37,6 +37,7 @@ */ +global $app; $form["title"] = "Mailbox"; $form["description"] = ""; @@ -280,7 +281,7 @@ $form["tabs"]['filter_records'] = array ( 'class' => 'plugin_listview', 'options' => array( 'listdef' => 'list/mail_user_filter.list.php', - 'sqlextwhere' => "mailuser_id = ".@intval(@$_REQUEST['id']), + 'sqlextwhere' => "mailuser_id = ".@$app->functions->intval(@$_REQUEST['id']), 'sql_order_by' => "ORDER BY rulename" ) ) diff --git a/interface/web/mail/form/mail_user_filter.tform.php b/interface/web/mail/form/mail_user_filter.tform.php index 765668511..2ea37233c 100644 --- a/interface/web/mail/form/mail_user_filter.tform.php +++ b/interface/web/mail/form/mail_user_filter.tform.php @@ -32,6 +32,7 @@ */ +global $app; $form["title"] = "Email filter"; $form["description"] = ""; @@ -61,7 +62,7 @@ $form["tabs"]['filter'] = array ( 'mailuser_id' => array ( 'datatype' => 'INTEGER', 'formtype' => 'TEXT', - 'default' => @intval($_REQUEST["mailuser_id"]), + 'default' => @$app->functions->intval($_REQUEST["mailuser_id"]), 'value' => '', 'width' => '30', 'maxlength' => '255' diff --git a/interface/web/mail/mail_domain_edit.php b/interface/web/mail/mail_domain_edit.php index 8a43a69f2..1690a2559 100644 --- a/interface/web/mail/mail_domain_edit.php +++ b/interface/web/mail/mail_domain_edit.php @@ -189,9 +189,9 @@ class page_action extends tform_actions { $app->uses('ini_parser,getconf'); $settings = $app->getconf->get_global_config('domains'); if ($settings['use_domain_module'] == 'y') { - $client_group_id = intval($_SESSION["s"]["user"]["default_group"]); + $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]); - $sql = "SELECT domain_id, domain FROM domain WHERE domain_id = " . intval($this->dataRecord['domain']); + $sql = "SELECT domain_id, domain FROM domain WHERE domain_id = " . $app->functions->intval($this->dataRecord['domain']); if ($_SESSION["s"]["user"]["typ"] != 'admin') { $sql .= "AND sys_groupid =" . $client_group_id; } @@ -213,7 +213,7 @@ class page_action extends tform_actions { // When the record is updated if($this->id > 0) { // restore the server ID if the user is not admin and record is edited - $tmp = $app->db->queryOneRecord("SELECT server_id FROM mail_domain WHERE domain_id = ".intval($this->id)); + $tmp = $app->db->queryOneRecord("SELECT server_id FROM mail_domain WHERE domain_id = ".$app->functions->intval($this->id)); $this->dataRecord["server_id"] = $tmp["server_id"]; unset($tmp); // When the record is inserted @@ -247,16 +247,16 @@ class page_action extends tform_actions { // make sure that the record belongs to the client group and not the admin group when a dmin inserts it // also make sure that the user can not delete domain created by a admin if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) { - $client_group_id = intval($this->dataRecord["client_group_id"]); + $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); $app->db->query("UPDATE mail_domain SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE domain_id = ".$this->id); } if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) { - $client_group_id = intval($this->dataRecord["client_group_id"]); + $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); $app->db->query("UPDATE mail_domain SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE domain_id = ".$this->id); } // Spamfilter policy - $policy_id = intval($this->dataRecord["policy"]); + $policy_id = $app->functions->intval($this->dataRecord["policy"]); if($policy_id > 0) { $tmp_user = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = '@".$app->db->quote($this->dataRecord["domain"])."'"); if($tmp_user["id"] > 0) { @@ -307,20 +307,20 @@ class page_action extends tform_actions { // make sure that the record belongs to the client group and not the admin group when admin inserts it // also make sure that the user can not delete domain created by a admin if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) { - $client_group_id = intval($this->dataRecord["client_group_id"]); + $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); $tmp = $app->db->queryOneRecord("SELECT userid FROM sys_user WHERE default_group = $client_group_id"); $client_user_id = ($tmp['userid'] > 0)?$tmp['userid']:1; $app->db->query("UPDATE mail_domain SET sys_userid = $client_user_id, sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE domain_id = ".$this->id); } if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) { - $client_group_id = intval($this->dataRecord["client_group_id"]); + $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); $tmp = $app->db->queryOneRecord("SELECT userid FROM sys_user WHERE default_group = $client_group_id"); $client_user_id = ($tmp['userid'] > 0)?$tmp['userid']:1; $app->db->query("UPDATE mail_domain SET sys_userid = $client_user_id, sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE domain_id = ".$this->id); } // Spamfilter policy - $policy_id = intval($this->dataRecord["policy"]); + $policy_id = $app->functions->intval($this->dataRecord["policy"]); $tmp_user = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = '@".$app->db->quote($this->dataRecord["domain"])."'"); if($policy_id > 0) { if($tmp_user["id"] > 0) { diff --git a/interface/web/mail/mail_mailinglist_edit.php b/interface/web/mail/mail_mailinglist_edit.php index 9de50febe..47b18eb19 100644 --- a/interface/web/mail/mail_mailinglist_edit.php +++ b/interface/web/mail/mail_mailinglist_edit.php @@ -197,11 +197,11 @@ class page_action extends tform_actions { // make sure that the record belongs to the client group and not the admin group when a dmin inserts it // also make sure that the user can not delete domain created by a admin if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) { - $client_group_id = intval($this->dataRecord["client_group_id"]); + $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); $app->db->query("UPDATE mail_mailinglist SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE mailinglist_id = ".$this->id); } if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) { - $client_group_id = intval($this->dataRecord["client_group_id"]); + $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); $app->db->query("UPDATE mail_mailinglist SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE mailinglist_id = ".$this->id); } } @@ -234,11 +234,11 @@ class page_action extends tform_actions { // make sure that the record belongs to the clinet group and not the admin group when admin inserts it // also make sure that the user can not delete domain created by a admin if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) { - $client_group_id = intval($this->dataRecord["client_group_id"]); + $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); $app->db->query("UPDATE mail_mailinglist SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE mailinglist_id = ".$this->id); } if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) { - $client_group_id = intval($this->dataRecord["client_group_id"]); + $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); $app->db->query("UPDATE mail_mailinglist SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE mailinglist_id = ".$this->id); } } diff --git a/interface/web/mail/mail_spamfilter_edit.php b/interface/web/mail/mail_spamfilter_edit.php index 5009f4981..768ec9b95 100644 --- a/interface/web/mail/mail_spamfilter_edit.php +++ b/interface/web/mail/mail_spamfilter_edit.php @@ -108,7 +108,7 @@ class page_action extends tform_actions { $this->dataRecord["spam_delete_score_int"] = $_POST["spam_delete_score_int"] * 100; // Changing mailbox_id to maildir - $sql = "SELECT maildir FROM mail_box WHERE mailbox_id = '".intval($_POST["spam_redirect_maildir"])."' AND ".$app->tform->getAuthSQL('r'); + $sql = "SELECT maildir FROM mail_box WHERE mailbox_id = '".$app->functions->intval($_POST["spam_redirect_maildir"])."' AND ".$app->tform->getAuthSQL('r'); $mailbox = $app->db->queryOneRecord($sql); $this->dataRecord["spam_redirect_maildir"] = $mailbox["maildir"]; diff --git a/interface/web/mail/mail_user_edit.php b/interface/web/mail/mail_user_edit.php index 36e2858f7..9fd3d5b97 100644 --- a/interface/web/mail/mail_user_edit.php +++ b/interface/web/mail/mail_user_edit.php @@ -159,9 +159,9 @@ class page_action extends tform_actions { // Check the quota and adjust if(isset($_POST["quota"]) && $client["limit_mailquota"] >= 0) { - $tmp = $app->db->queryOneRecord("SELECT sum(quota) as mailquota FROM mail_user WHERE mailuser_id != ".intval($this->id)." AND ".$app->tform->getAuthSQL('u')); + $tmp = $app->db->queryOneRecord("SELECT sum(quota) as mailquota FROM mail_user WHERE mailuser_id != ".$app->functions->intval($this->id)." AND ".$app->tform->getAuthSQL('u')); $mailquota = $tmp["mailquota"] / 1024 / 1024; - $new_mailbox_quota = intval($this->dataRecord["quota"]); + $new_mailbox_quota = $app->functions->intval($this->dataRecord["quota"]); if(($mailquota + $new_mailbox_quota > $client["limit_mailquota"]) || ($new_mailbox_quota == 0 && $client["limit_mailquota"] != -1)) { $max_free_quota = $client["limit_mailquota"] - $mailquota; $app->tform->errorMessage .= $app->tform->lng("limit_mailquota_txt").": ".$max_free_quota."
"; @@ -229,7 +229,7 @@ class page_action extends tform_actions { $app->db->query("UPDATE mail_user SET sys_groupid = ".$domain["sys_groupid"]." WHERE mailuser_id = ".$this->id); // Spamfilter policy - $policy_id = intval($this->dataRecord["policy"]); + $policy_id = $app->functions->intval($this->dataRecord["policy"]); if($policy_id > 0) { $tmp_user = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = '".$app->db->quote($this->dataRecord["email"])."'"); if($tmp_user["id"] > 0) { @@ -265,7 +265,7 @@ class page_action extends tform_actions { $app->db->query("UPDATE mail_user SET sys_groupid = ".$domain["sys_groupid"]." WHERE mailuser_id = ".$this->id); // Spamfilter policy - $policy_id = intval($this->dataRecord["policy"]); + $policy_id = $app->functions->intval($this->dataRecord["policy"]); $tmp_user = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = '".$app->db->quote($this->dataRecord["email"])."'"); if($policy_id > 0) { if($tmp_user["id"] > 0) { diff --git a/interface/web/mail/mail_user_filter_edit.php b/interface/web/mail/mail_user_filter_edit.php index c1873ac89..d74a85a2f 100644 --- a/interface/web/mail/mail_user_filter_edit.php +++ b/interface/web/mail/mail_user_filter_edit.php @@ -70,7 +70,7 @@ class page_action extends tform_actions { global $app, $conf; // Get the parent mail_user record - $mailuser = $app->db->queryOneRecord("SELECT * FROM mail_user WHERE mailuser_id = '".intval($_REQUEST["mailuser_id"])."' AND ".$app->tform->getAuthSQL('r')); + $mailuser = $app->db->queryOneRecord("SELECT * FROM mail_user WHERE mailuser_id = '".$app->functions->intval($_REQUEST["mailuser_id"])."' AND ".$app->tform->getAuthSQL('r')); // Check if Domain belongs to user if($mailuser["mailuser_id"] != $_POST["mailuser_id"]) $app->tform->errorMessage .= $app->tform->wordbook["no_mailuser_perm"]; @@ -147,8 +147,8 @@ class page_action extends tform_actions { global $app,$conf; $app->uses("getconf"); - $mailuser_rec = $app->db->queryOneRecord("SELECT server_id FROM mail_user WHERE mailuser_id = ".intval($this->dataRecord["mailuser_id"])); - $mail_config = $app->getconf->get_server_config(intval($mailuser_rec["server_id"]),'mail'); + $mailuser_rec = $app->db->queryOneRecord("SELECT server_id FROM mail_user WHERE mailuser_id = ".$app->functions->intval($this->dataRecord["mailuser_id"])); + $mail_config = $app->getconf->get_server_config($app->functions->intval($mailuser_rec["server_id"]),'mail'); if($mail_config['mail_filter_syntax'] == 'sieve') { diff --git a/interface/web/mail/mail_user_stats.php b/interface/web/mail/mail_user_stats.php index c501a86f0..36c7da555 100644 --- a/interface/web/mail/mail_user_stats.php +++ b/interface/web/mail/mail_user_stats.php @@ -33,22 +33,22 @@ class list_action extends listform_actions { //** Traffic of the current month $tmp_date = date('Y-m'); $tmp_rec = $app->db->queryOneRecord("SELECT traffic as t FROM mail_traffic WHERE mailuser_id = ".$rec['mailuser_id']." AND month = '$tmp_date'"); - $rec['this_month'] = number_format(intval($tmp_rec['t'])/1024/1024, 0, '.', ' '); + $rec['this_month'] = number_format($app->functions->intval($tmp_rec['t'])/1024/1024, 0, '.', ' '); //** Traffic of the current year $tmp_date = date('Y'); $tmp_rec = $app->db->queryOneRecord("SELECT sum(traffic) as t FROM mail_traffic WHERE mailuser_id = ".$rec['mailuser_id']." AND month like '$tmp_date%'"); - $rec['this_year'] = number_format(intval($tmp_rec['t'])/1024/1024, 0, '.', ' '); + $rec['this_year'] = number_format($app->functions->intval($tmp_rec['t'])/1024/1024, 0, '.', ' '); //** Traffic of the last month $tmp_date = date('Y-m',mktime(0, 0, 0, date("m")-1, date("d"), date("Y"))); $tmp_rec = $app->db->queryOneRecord("SELECT traffic as t FROM mail_traffic WHERE mailuser_id = ".$rec['mailuser_id']." AND month = '$tmp_date'"); - $rec['last_month'] = number_format(intval($tmp_rec['t'])/1024/1024, 0, '.', ' '); + $rec['last_month'] = number_format($app->functions->intval($tmp_rec['t'])/1024/1024, 0, '.', ' '); //** Traffic of the last year $tmp_date = date('Y',mktime(0, 0, 0, date("m"), date("d"), date("Y")-1)); $tmp_rec = $app->db->queryOneRecord("SELECT sum(traffic) as t FROM mail_traffic WHERE mailuser_id = ".$rec['mailuser_id']." AND month like '$tmp_date%'"); - $rec['last_year'] = number_format(intval($tmp_rec['t'])/1024/1024, 0, '.', ' '); + $rec['last_year'] = number_format($app->functions->intval($tmp_rec['t'])/1024/1024, 0, '.', ' '); //* The variable "id" contains always the index variable $rec['id'] = $rec[$this->idx_key]; diff --git a/interface/web/mail/mailinglist.php b/interface/web/mail/mailinglist.php index 9940e64cc..dfabb4806 100644 --- a/interface/web/mail/mailinglist.php +++ b/interface/web/mail/mailinglist.php @@ -38,13 +38,13 @@ $app->auth->check_module_permissions('mail'); if (!isset($_GET['id'])){ die ("No List selected!"); } -$listId = intval($_GET['id']); +$listId = $app->functions->intval($_GET['id']); /* * Get the data to connect to the database */ $dbData = $app->db->queryAllRecords("SELECT server_id, listname FROM mail_mailinglist WHERE mailinglist_id = " . $listId); -$serverId = intval($dbData[0]['server_id']); +$serverId = $app->functions->intval($dbData[0]['server_id']); if ($serverId == 0){ die ("No List - Server found!"); } diff --git a/interface/web/mail/spamfilter_blacklist_edit.php b/interface/web/mail/spamfilter_blacklist_edit.php index b6c45dd98..860319c4b 100644 --- a/interface/web/mail/spamfilter_blacklist_edit.php +++ b/interface/web/mail/spamfilter_blacklist_edit.php @@ -103,7 +103,7 @@ function onSubmit() { } // end if user is not admin // Select and set the server_id so it matches the server_id of the spa,filter_users record - $tmp = $app->db->queryOneRecord("SELECT server_id FROM spamfilter_users WHERE id = ".intval($this->dataRecord["rid"])); + $tmp = $app->db->queryOneRecord("SELECT server_id FROM spamfilter_users WHERE id = ".$app->functions->intval($this->dataRecord["rid"])); $this->dataRecord["server_id"] = $tmp["server_id"]; unset($tmp); diff --git a/interface/web/mail/spamfilter_whitelist_edit.php b/interface/web/mail/spamfilter_whitelist_edit.php index c4bba0e8a..167059771 100644 --- a/interface/web/mail/spamfilter_whitelist_edit.php +++ b/interface/web/mail/spamfilter_whitelist_edit.php @@ -103,7 +103,7 @@ class page_action extends tform_actions { } // end if user is not admin // Select and set the server_id so it matches the server_id of the spa,filter_users record - $tmp = $app->db->queryOneRecord("SELECT server_id FROM spamfilter_users WHERE id = ".intval($this->dataRecord["rid"])); + $tmp = $app->db->queryOneRecord("SELECT server_id FROM spamfilter_users WHERE id = ".$app->functions->intval($this->dataRecord["rid"])); $this->dataRecord["server_id"] = $tmp["server_id"]; unset($tmp); diff --git a/interface/web/mail/webmailer.php b/interface/web/mail/webmailer.php index e731992bc..2cff5daa1 100644 --- a/interface/web/mail/webmailer.php +++ b/interface/web/mail/webmailer.php @@ -38,13 +38,13 @@ $app->auth->check_module_permissions('mail'); if (!isset($_GET['id'])){ die ("No E-Mail selected!"); } -$emailId = intval($_GET['id']); +$emailId = $app->functions->intval($_GET['id']); /* * Get the data to connect to the database */ $dbData = $app->db->queryOneRecord("SELECT server_id FROM mail_user WHERE mailuser_id = " . $emailId); -$serverId = intval($dbData['server_id']); +$serverId = $app->functions->intval($dbData['server_id']); if ($serverId == 0){ die ("No E-Mail - Server found!"); } diff --git a/interface/web/mailuser/form/mail_user_filter.tform.php b/interface/web/mailuser/form/mail_user_filter.tform.php index 3923a0612..02b6c79fa 100644 --- a/interface/web/mailuser/form/mail_user_filter.tform.php +++ b/interface/web/mailuser/form/mail_user_filter.tform.php @@ -33,6 +33,8 @@ */ +global $app; + $form["title"] = "mailbox_filter_txt"; $form["description"] = ""; $form["name"] = "mail_user_filter"; @@ -61,7 +63,7 @@ $form["tabs"]['filter'] = array ( 'mailuser_id' => array ( 'datatype' => 'INTEGER', 'formtype' => 'TEXT', - 'default' => @intval($_REQUEST["mailuser_id"]), + 'default' => @$app->functions->intval($_REQUEST["mailuser_id"]), 'value' => '', 'width' => '30', 'maxlength' => '255' diff --git a/interface/web/mailuser/mail_user_filter_edit.php b/interface/web/mailuser/mail_user_filter_edit.php index afbfb7dc5..14f8dd5c3 100644 --- a/interface/web/mailuser/mail_user_filter_edit.php +++ b/interface/web/mailuser/mail_user_filter_edit.php @@ -71,7 +71,7 @@ class page_action extends tform_actions { global $app, $conf; // Get the parent mail_user record - $mailuser = $app->db->queryOneRecord("SELECT * FROM mail_user WHERE mailuser_id = '".intval($_SESSION['s']['user']['mailuser_id'])."'"); + $mailuser = $app->db->queryOneRecord("SELECT * FROM mail_user WHERE mailuser_id = '".$app->functions->intval($_SESSION['s']['user']['mailuser_id'])."'"); // Set the mailuser_id $this->dataRecord["mailuser_id"] = $mailuser["mailuser_id"]; diff --git a/interface/web/mailuser/mail_user_spamfilter_edit.php b/interface/web/mailuser/mail_user_spamfilter_edit.php index e226b3bd2..905149cf7 100644 --- a/interface/web/mailuser/mail_user_spamfilter_edit.php +++ b/interface/web/mailuser/mail_user_spamfilter_edit.php @@ -76,7 +76,7 @@ class page_action extends tform_actions { $domain = $app->db->queryOneRecord("SELECT sys_userid, sys_groupid, server_id FROM mail_domain WHERE domain = '".$app->db->quote($email_domain)."'"); // Spamfilter policy - $policy_id = intval($this->dataRecord["policy"]); + $policy_id = $app->functions->intval($this->dataRecord["policy"]); $tmp_user = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = '".$app->db->quote($rec["email"])."'"); if($policy_id > 0) { if($tmp_user["id"] > 0) { diff --git a/interface/web/monitor/log_del.php b/interface/web/monitor/log_del.php index 969c08668..09b339b70 100644 --- a/interface/web/monitor/log_del.php +++ b/interface/web/monitor/log_del.php @@ -34,7 +34,7 @@ require_once('../../lib/app.inc.php'); //* Check permissions for module $app->auth->check_module_permissions('monitor'); -$syslog_id = intval($_GET['id']); +$syslog_id = $app->functions->intval($_GET['id']); $app->db->query("UPDATE sys_log SET loglevel = 0 WHERE syslog_id = '$syslog_id'"); header('Location: log_list.php'); diff --git a/interface/web/monitor/show_log.php b/interface/web/monitor/show_log.php index fc1ecf470..ec10a982b 100644 --- a/interface/web/monitor/show_log.php +++ b/interface/web/monitor/show_log.php @@ -42,7 +42,7 @@ $app->tpl->newTemplate("form.tpl.htm"); $app->tpl->setInclude('content_tpl','templates/show_log.htm'); // Importing the GET values -$refresh = (isset($_GET["refresh"]))?intval($_GET["refresh"]):0; +$refresh = (isset($_GET["refresh"]))?$app->functions->intval($_GET["refresh"]):0; $logParam = $_GET["log"]; /* Get some translations */ diff --git a/interface/web/monitor/show_sys_state.php b/interface/web/monitor/show_sys_state.php index 92f9f150f..d251cdc48 100644 --- a/interface/web/monitor/show_sys_state.php +++ b/interface/web/monitor/show_sys_state.php @@ -76,7 +76,7 @@ $app->tpl->setVar("monTransRefreshsq", $monTransRefreshsq); Attention: the core-module ist triggered every 5 minutes, so reload every 2 minutes is impossible! */ -$refresh = (isset($_GET["refresh"]))?intval($_GET["refresh"]):0; +$refresh = (isset($_GET["refresh"]))?$app->functions->intval($_GET["refresh"]):0; $refresh_values = array('0' => '- '.$app->lng("No Refresh").' -','5' => '5 '.$app->lng("minutes"),'10' => '10 '.$app->lng("minutes"),'15' => '15 '.$app->lng("minutes"),'30' => '30 '.$app->lng("minutes"),'60' => '60 '.$app->lng("minutes")); $tmp = ''; diff --git a/interface/web/remote/monitor.php b/interface/web/remote/monitor.php index 2f35105d4..ae138d536 100644 --- a/interface/web/remote/monitor.php +++ b/interface/web/remote/monitor.php @@ -13,7 +13,7 @@ header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past $type = addslashes($_GET['type']); $token = addslashes($_GET['token']); -$server_id = intval($_GET['server']); +$server_id = $app->functions->intval($_GET['server']); $app->uses('getconf'); $interface_config = $app->getconf->get_global_config('misc'); diff --git a/interface/web/sites/ajax_get_ip.php b/interface/web/sites/ajax_get_ip.php index bca24cc65..34fbab86a 100644 --- a/interface/web/sites/ajax_get_ip.php +++ b/interface/web/sites/ajax_get_ip.php @@ -35,8 +35,8 @@ require_once('../../lib/app.inc.php'); $app->auth->check_module_permissions('sites'); $app->uses('getconf'); -$server_id = intval($_GET["server_id"]); -$client_group_id = intval($_GET["client_group_id"]); +$server_id = $app->functions->intval($_GET["server_id"]); +$client_group_id = $app->functions->intval($_GET["client_group_id"]); $ip_type = $app->db->quote($_GET['ip_type']); if($_SESSION["s"]["user"]["typ"] == 'admin' or $app->auth->has_clients($_SESSION['s']['user']['userid'])) { diff --git a/interface/web/sites/ajax_get_json.php b/interface/web/sites/ajax_get_json.php index 14eb44081..53702bd29 100644 --- a/interface/web/sites/ajax_get_json.php +++ b/interface/web/sites/ajax_get_json.php @@ -36,8 +36,8 @@ $app->auth->check_module_permissions('sites'); $app->uses('getconf'); -$server_id = intval($_GET["server_id"]); -$web_id = intval($_GET["web_id"]); +$server_id = $app->functions->intval($_GET["server_id"]); +$web_id = $app->functions->intval($_GET["web_id"]); $php_type = $_GET["php_type"]; $type = $_GET["type"]; @@ -104,7 +104,7 @@ $type = $_GET["type"]; $result = array(); // ipv4 - //$result[] = _search('admin', 'server_ip', "AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=".intval($_SESSION['s']['user']['client_id']).")"); + //$result[] = _search('admin', 'server_ip', "AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=".$app->functions->intval($_SESSION['s']['user']['client_id']).")"); $result[] = $app->functions->suggest_ips('IPv4'); $json = $app->functions->json_encode($result); @@ -114,7 +114,7 @@ $type = $_GET["type"]; $result = array(); // ipv6 - //$result[] = _search('admin', 'server_ip', "AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=".intval($_SESSION['s']['user']['client_id']).")"); + //$result[] = _search('admin', 'server_ip', "AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=".$app->functions->intval($_SESSION['s']['user']['client_id']).")"); $result[] = $app->functions->suggest_ips('IPv6'); $json = $app->functions->json_encode($result); diff --git a/interface/web/sites/aps_do_operation.php b/interface/web/sites/aps_do_operation.php index 0f1da3ddf..033bece03 100644 --- a/interface/web/sites/aps_do_operation.php +++ b/interface/web/sites/aps_do_operation.php @@ -50,15 +50,15 @@ if($_GET['action'] == 'change_status') if(!$gui->isValidPackageID($_GET['id'], true)) die($app->lng('Invalid ID')); // Change the existing status to the opposite - $get_status = $app->db->queryOneRecord("SELECT package_status FROM aps_packages WHERE id = '".intval($_GET['id'])."';"); + $get_status = $app->db->queryOneRecord("SELECT package_status FROM aps_packages WHERE id = '".$app->functions->intval($_GET['id'])."';"); if($get_status['package_status'] == strval(PACKAGE_LOCKED)) { - $app->db->query("UPDATE aps_packages SET package_status = ".PACKAGE_ENABLED." WHERE id = '".intval($_GET['id'])."';"); + $app->db->query("UPDATE aps_packages SET package_status = ".PACKAGE_ENABLED." WHERE id = '".$app->functions->intval($_GET['id'])."';"); echo '
'.$app->lng('Yes').'
'; } else { - $app->db->query("UPDATE aps_packages SET Package_status = ".PACKAGE_LOCKED." WHERE id = '".intval($_GET['id'])."';"); + $app->db->query("UPDATE aps_packages SET Package_status = ".PACKAGE_LOCKED." WHERE id = '".$app->functions->intval($_GET['id'])."';"); echo '
'.$app->lng('No').'
'; } } diff --git a/interface/web/sites/cron_edit.php b/interface/web/sites/cron_edit.php index 8ccf340e9..a78af2dde 100644 --- a/interface/web/sites/cron_edit.php +++ b/interface/web/sites/cron_edit.php @@ -104,7 +104,7 @@ class page_action extends tform_actions { } // Get the record of the parent domain - $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".intval(@$this->dataRecord["parent_domain_id"])); + $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"])); // Set fixed values $this->dataRecord["server_id"] = $parent_domain["server_id"]; @@ -114,7 +114,7 @@ class page_action extends tform_actions { if(preg_match("'^http(s)?:\/\/'i", $command)) { $this->dataRecord["type"] = 'url'; } else { - $domain_owner = $app->db->queryOneRecord("SELECT limit_cron_type FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ".intval($parent_domain["sys_groupid"])); + $domain_owner = $app->db->queryOneRecord("SELECT limit_cron_type FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ".$app->functions->intval($parent_domain["sys_groupid"])); if($domain_owner["limit_cron_type"] == 'full') $this->dataRecord["type"] = 'full'; else $this->dataRecord["type"] = 'chrooted'; } @@ -176,7 +176,7 @@ class page_action extends tform_actions { function onAfterInsert() { global $app, $conf; - $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($this->dataRecord["parent_domain_id"])); + $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["parent_domain_id"])); $server_id = $web["server_id"]; // The cron shall be owned by the same group then the website diff --git a/interface/web/sites/database_edit.php b/interface/web/sites/database_edit.php index 3858440e7..959b018dc 100644 --- a/interface/web/sites/database_edit.php +++ b/interface/web/sites/database_edit.php @@ -148,7 +148,7 @@ class page_action extends tform_actions { // When the record is updated if($this->id > 0) { // restore the server ID if the user is not admin and record is edited - $tmp = $app->db->queryOneRecord("SELECT server_id FROM web_database WHERE database_id = ".intval($this->id)); + $tmp = $app->db->queryOneRecord("SELECT server_id FROM web_database WHERE database_id = ".$app->functions->intval($this->id)); $this->dataRecord["server_id"] = $tmp["server_id"]; unset($tmp); // When the record is inserted @@ -321,7 +321,7 @@ class page_action extends tform_actions { global $app, $conf; if($this->dataRecord["parent_domain_id"] > 0) { - $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($this->dataRecord["parent_domain_id"])); + $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["parent_domain_id"])); //* The Database user shall be owned by the same group then the website $sys_groupid = $web['sys_groupid']; @@ -337,7 +337,7 @@ class page_action extends tform_actions { global $app, $conf; if($this->dataRecord["parent_domain_id"] > 0) { - $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($this->dataRecord["parent_domain_id"])); + $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["parent_domain_id"])); //* The Database user shall be owned by the same group then the website $sys_groupid = $web['sys_groupid']; diff --git a/interface/web/sites/database_phpmyadmin.php b/interface/web/sites/database_phpmyadmin.php index e0ab32477..51b8820e1 100644 --- a/interface/web/sites/database_phpmyadmin.php +++ b/interface/web/sites/database_phpmyadmin.php @@ -40,13 +40,13 @@ $app->auth->check_module_permissions('sites'); if (!isset($_GET['id'])){ die ("No DB selected!"); } -$databaseId = intval($_GET['id']); +$databaseId = $app->functions->intval($_GET['id']); /* * Get the data to connect to the database */ $dbData = $app->db->queryOneRecord("SELECT server_id FROM web_database WHERE database_id = " . $databaseId); -$serverId = intval($dbData['server_id']); +$serverId = $app->functions->intval($dbData['server_id']); if ($serverId == 0){ die ("No DB-Server found!"); } diff --git a/interface/web/sites/database_user_del.php b/interface/web/sites/database_user_del.php index 5ecdde5ab..9abcfd148 100644 --- a/interface/web/sites/database_user_del.php +++ b/interface/web/sites/database_user_del.php @@ -60,12 +60,12 @@ class page_action extends tform_actions { global $app; $conf; //* Update all records that belog to this user - $records = $app->db->queryAllRecords("SELECT database_id FROM web_database WHERE database_user_id = '".intval($this->id)."'"); + $records = $app->db->queryAllRecords("SELECT database_id FROM web_database WHERE database_user_id = '".$app->functions->intval($this->id)."'"); foreach($records as $rec) { $app->db->datalogUpdate('web_database','database_user_id=NULL','database_id', $rec['database_id']); } - $records = $app->db->queryAllRecords("SELECT database_id FROM web_database WHERE database_ro_user_id = '".intval($this->id)."'"); + $records = $app->db->queryAllRecords("SELECT database_id FROM web_database WHERE database_ro_user_id = '".$app->functions->intval($this->id)."'"); foreach($records as $rec) { $app->db->datalogUpdate('web_database','database_ro_user_id=NULL','database_id', $rec['database_id']); } diff --git a/interface/web/sites/database_user_edit.php b/interface/web/sites/database_user_edit.php index f3ec904ec..357fa89ad 100644 --- a/interface/web/sites/database_user_edit.php +++ b/interface/web/sites/database_user_edit.php @@ -184,11 +184,11 @@ class page_action extends tform_actions { global $app, $conf; if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) { - $client_group_id = intval($this->dataRecord["client_group_id"]); + $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); $app->db->query("UPDATE web_database_user SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE database_user_id = ".$this->id); } if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) { - $client_group_id = intval($this->dataRecord["client_group_id"]); + $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); $app->db->query("UPDATE web_database_user SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE database_user_id = ".$this->id); } } @@ -197,17 +197,17 @@ class page_action extends tform_actions { global $app, $conf; if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) { - $client_group_id = intval($this->dataRecord["client_group_id"]); + $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); $app->db->query("UPDATE web_database_user SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE database_user_id = ".$this->id); } if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) { - $client_group_id = intval($this->dataRecord["client_group_id"]); + $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); $app->db->query("UPDATE web_database_user SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE database_user_id = ".$this->id); } $old_rec = $app->db->queryOneRecord("SELECT * FROM web_database_user WHERE database_user_id = '".$this->id."'"); - $records = $app->db->queryAllRecords("SELECT DISTINCT server_id FROM web_database WHERE database_user_id = '".intval($this->id)."' UNION SELECT DISTINCT server_id FROM web_database WHERE database_ro_user_id = '".intval($this->id)."'"); + $records = $app->db->queryAllRecords("SELECT DISTINCT server_id FROM web_database WHERE database_user_id = '".$app->functions->intval($this->id)."' UNION SELECT DISTINCT server_id FROM web_database WHERE database_ro_user_id = '".$app->functions->intval($this->id)."'"); foreach($records as $rec) { $new_rec = $this->dataRecord; $new_rec['server_id'] = $rec['server_id']; diff --git a/interface/web/sites/ftp_user_edit.php b/interface/web/sites/ftp_user_edit.php index 9a956cc01..cd52d177d 100644 --- a/interface/web/sites/ftp_user_edit.php +++ b/interface/web/sites/ftp_user_edit.php @@ -95,7 +95,7 @@ class page_action extends tform_actions { global $app, $conf; // Get the record of the parent domain - $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".intval(@$this->dataRecord["parent_domain_id"])); + $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"])); // Set a few fixed values $this->dataRecord["server_id"] = $parent_domain["server_id"]; @@ -127,7 +127,7 @@ class page_action extends tform_actions { function onAfterInsert() { global $app, $conf; - $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($this->dataRecord["parent_domain_id"])); + $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["parent_domain_id"])); $server_id = $web["server_id"]; $dir = $web["document_root"]; $uid = $web["system_user"]; @@ -162,7 +162,7 @@ class page_action extends tform_actions { //* When the site of the FTP user has been changed if(isset($this->dataRecord['parent_domain_id']) && $this->oldDataRecord['parent_domain_id'] != $this->dataRecord['parent_domain_id']) { - $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($this->dataRecord["parent_domain_id"])); + $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["parent_domain_id"])); $server_id = $web["server_id"]; $dir = $web["document_root"]; $uid = $web["system_user"]; diff --git a/interface/web/sites/shell_user_edit.php b/interface/web/sites/shell_user_edit.php index 2ce781d4d..8f2a93fd8 100644 --- a/interface/web/sites/shell_user_edit.php +++ b/interface/web/sites/shell_user_edit.php @@ -102,7 +102,7 @@ class page_action extends tform_actions { global $app, $conf; // Get the record of the parent domain - $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".intval(@$this->dataRecord["parent_domain_id"])); + $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"])); // Set a few fixed values $this->dataRecord["server_id"] = $parent_domain["server_id"]; @@ -147,7 +147,7 @@ class page_action extends tform_actions { function onAfterInsert() { global $app, $conf; - $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($this->dataRecord["parent_domain_id"])); + $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["parent_domain_id"])); $server_id = $web["server_id"]; $dir = $web["document_root"]; $puser = $web["system_user"]; diff --git a/interface/web/sites/web_aliasdomain_edit.php b/interface/web/sites/web_aliasdomain_edit.php index 6273b37b4..b928c92ca 100644 --- a/interface/web/sites/web_aliasdomain_edit.php +++ b/interface/web/sites/web_aliasdomain_edit.php @@ -124,9 +124,9 @@ class page_action extends tform_actions { $app->uses('ini_parser,getconf'); $settings = $app->getconf->get_global_config('domains'); if ($settings['use_domain_module'] == 'y') { - $client_group_id = intval($_SESSION["s"]["user"]["default_group"]); + $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]); - $sql = "SELECT domain_id, domain FROM domain WHERE domain_id = " . intval($this->dataRecord['domain']); + $sql = "SELECT domain_id, domain FROM domain WHERE domain_id = " . $app->functions->intval($this->dataRecord['domain']); if ($_SESSION["s"]["user"]["typ"] != 'admin') { $sql .= "AND sys_groupid =" . $client_group_id; } @@ -140,7 +140,7 @@ class page_action extends tform_actions { } // Get the record of the parent domain - $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".intval(@$this->dataRecord["parent_domain_id"])); + $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"])); // Set a few fixed values $this->dataRecord["type"] = 'alias'; @@ -158,7 +158,7 @@ class page_action extends tform_actions { function onAfterInsert() { global $app, $conf; - $app->db->query('UPDATE web_domain SET sys_groupid = '.intval($this->parent_domain_record['sys_groupid']).' WHERE domain_id = '.$this->id); + $app->db->query('UPDATE web_domain SET sys_groupid = '.$app->functions->intval($this->parent_domain_record['sys_groupid']).' WHERE domain_id = '.$this->id); } @@ -169,7 +169,7 @@ class page_action extends tform_actions { if($this->dataRecord['parent_domain_id'] != $this->oldDataRecord['parent_domain_id']) { //* Update the domain owner - $app->db->query('UPDATE web_domain SET sys_groupid = '.intval($this->parent_domain_record['sys_groupid']).' WHERE domain_id = '.$this->id); + $app->db->query('UPDATE web_domain SET sys_groupid = '.$app->functions->intval($this->parent_domain_record['sys_groupid']).' WHERE domain_id = '.$this->id); //* Update the old website, so that the vhost alias gets removed //* We force the update by inserting a transaction record without changes manually. diff --git a/interface/web/sites/web_domain_del.php b/interface/web/sites/web_domain_del.php index f84f4f106..3f3a49aa1 100644 --- a/interface/web/sites/web_domain_del.php +++ b/interface/web/sites/web_domain_del.php @@ -56,49 +56,49 @@ class page_action extends tform_actions { if($app->tform->checkPerm($this->id,'d') == false) $app->error($app->lng('error_no_delete_permission')); //* Delete all records that belog to this zone. - $records = $app->db->queryAllRecords("SELECT domain_id FROM web_domain WHERE parent_domain_id = '".intval($this->id)."' AND type != 'vhost'"); + $records = $app->db->queryAllRecords("SELECT domain_id FROM web_domain WHERE parent_domain_id = '".$app->functions->intval($this->id)."' AND type != 'vhost'"); foreach($records as $rec) { $app->db->datalogDelete('web_domain','domain_id',$rec['domain_id']); } //* Delete all records that belog to this zone. - $records = $app->db->queryAllRecords("SELECT ftp_user_id FROM ftp_user WHERE parent_domain_id = '".intval($this->id)."'"); + $records = $app->db->queryAllRecords("SELECT ftp_user_id FROM ftp_user WHERE parent_domain_id = '".$app->functions->intval($this->id)."'"); foreach($records as $rec) { $app->db->datalogDelete('ftp_user','ftp_user_id',$rec['ftp_user_id']); } //* Delete all records that belog to this web. - $records = $app->db->queryAllRecords("SELECT shell_user_id FROM shell_user WHERE parent_domain_id = '".intval($this->id)."'"); + $records = $app->db->queryAllRecords("SELECT shell_user_id FROM shell_user WHERE parent_domain_id = '".$app->functions->intval($this->id)."'"); foreach($records as $rec) { $app->db->datalogDelete('shell_user','shell_user_id',$rec['shell_user_id']); } //* Delete all records that belog to this web. - $records = $app->db->queryAllRecords("SELECT id FROM cron WHERE parent_domain_id = '".intval($this->id)."'"); + $records = $app->db->queryAllRecords("SELECT id FROM cron WHERE parent_domain_id = '".$app->functions->intval($this->id)."'"); foreach($records as $rec) { $app->db->datalogDelete('cron','id',$rec['id']); } //* Delete all records that belog to this web. - $records = $app->db->queryAllRecords("SELECT id FROM cron WHERE parent_domain_id = '".intval($this->id)."'"); + $records = $app->db->queryAllRecords("SELECT id FROM cron WHERE parent_domain_id = '".$app->functions->intval($this->id)."'"); foreach($records as $rec) { $app->db->datalogDelete('cron','id',$rec['id']); } //* Delete all records that belog to this web - $records = $app->db->queryAllRecords("SELECT webdav_user_id FROM webdav_user WHERE parent_domain_id = '".intval($this->id)."'"); + $records = $app->db->queryAllRecords("SELECT webdav_user_id FROM webdav_user WHERE parent_domain_id = '".$app->functions->intval($this->id)."'"); foreach($records as $rec) { $app->db->datalogDelete('webdav_user','webdav_user_id',$rec['webdav_user_id']); } //* Delete all records that belog to this web - $records = $app->db->queryAllRecords("SELECT backup_id FROM web_backup WHERE parent_domain_id = '".intval($this->id)."'"); + $records = $app->db->queryAllRecords("SELECT backup_id FROM web_backup WHERE parent_domain_id = '".$app->functions->intval($this->id)."'"); foreach($records as $rec) { $app->db->datalogDelete('web_backup','backup_id',$rec['backup_id']); } //* Delete all web folders - $records = $app->db->queryAllRecords("SELECT web_folder_id FROM web_folder WHERE parent_domain_id = '".intval($this->id)."'"); + $records = $app->db->queryAllRecords("SELECT web_folder_id FROM web_folder WHERE parent_domain_id = '".$app->functions->intval($this->id)."'"); foreach($records as $rec) { //* Delete all web folder users $records2 = $app->db->queryAllRecords("SELECT web_folder_user_id FROM web_folder_user WHERE web_folder_id = '".$rec['web_folder_id']."'"); diff --git a/interface/web/sites/web_domain_edit.php b/interface/web/sites/web_domain_edit.php index e16d81e87..b8db757e3 100644 --- a/interface/web/sites/web_domain_edit.php +++ b/interface/web/sites/web_domain_edit.php @@ -259,7 +259,7 @@ class page_action extends tform_actions { // The user is admin, so we fill in all IP addresses of the server if($this->id > 0) { if(!isset($this->dataRecord["server_id"])){ - $tmp = $app->db->queryOneRecord("SELECT server_id FROM web_domain WHERE domain_id = ".intval($this->id)); + $tmp = $app->db->queryOneRecord("SELECT server_id FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id)); $this->dataRecord["server_id"] = $tmp["server_id"]; unset($tmp); } @@ -463,9 +463,9 @@ class page_action extends tform_actions { $app->uses('ini_parser,getconf'); $settings = $app->getconf->get_global_config('domains'); if ($settings['use_domain_module'] == 'y') { - $client_group_id = intval($_SESSION["s"]["user"]["default_group"]); + $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]); - $sql = "SELECT domain_id, domain FROM domain WHERE domain_id = " . intval($this->dataRecord['domain']); + $sql = "SELECT domain_id, domain FROM domain WHERE domain_id = " . $app->functions->intval($this->dataRecord['domain']); if ($_SESSION["s"]["user"]["typ"] != 'admin') { $sql .= "AND sys_groupid =" . $client_group_id; } @@ -504,9 +504,9 @@ class page_action extends tform_actions { //* Check the website quota of the client if(isset($_POST["hd_quota"]) && $client["limit_web_quota"] >= 0) { - $tmp = $app->db->queryOneRecord("SELECT sum(hd_quota) as webquota FROM web_domain WHERE domain_id != ".intval($this->id)." AND ".$app->tform->getAuthSQL('u')); + $tmp = $app->db->queryOneRecord("SELECT sum(hd_quota) as webquota FROM web_domain WHERE domain_id != ".$app->functions->intval($this->id)." AND ".$app->tform->getAuthSQL('u')); $webquota = $tmp["webquota"]; - $new_web_quota = intval($this->dataRecord["hd_quota"]); + $new_web_quota = $app->functions->intval($this->dataRecord["hd_quota"]); if(($webquota + $new_web_quota > $client["limit_web_quota"]) || ($new_web_quota < 0 && $client["limit_web_quota"] >= 0)) { $max_free_quota = floor($client["limit_web_quota"] - $webquota); if($max_free_quota < 0) $max_free_quota = 0; @@ -520,9 +520,9 @@ class page_action extends tform_actions { //* Check the traffic quota of the client if(isset($_POST["traffic_quota"]) && $client["limit_traffic_quota"] > 0) { - $tmp = $app->db->queryOneRecord("SELECT sum(traffic_quota) as trafficquota FROM web_domain WHERE domain_id != ".intval($this->id)." AND ".$app->tform->getAuthSQL('u')); + $tmp = $app->db->queryOneRecord("SELECT sum(traffic_quota) as trafficquota FROM web_domain WHERE domain_id != ".$app->functions->intval($this->id)." AND ".$app->tform->getAuthSQL('u')); $trafficquota = $tmp["trafficquota"]; - $new_traffic_quota = intval($this->dataRecord["traffic_quota"]); + $new_traffic_quota = $app->functions->intval($this->dataRecord["traffic_quota"]); if(($trafficquota + $new_traffic_quota > $client["limit_traffic_quota"]) || ($new_traffic_quota < 0 && $client["limit_traffic_quota"] >= 0)) { $max_free_quota = floor($client["limit_traffic_quota"] - $trafficquota); if($max_free_quota < 0) $max_free_quota = 0; @@ -540,9 +540,9 @@ class page_action extends tform_actions { //* Check the website quota of the client if(isset($_POST["hd_quota"]) && $reseller["limit_web_quota"] >= 0) { - $tmp = $app->db->queryOneRecord("SELECT sum(hd_quota) as webquota FROM web_domain WHERE domain_id != ".intval($this->id)." AND ".$app->tform->getAuthSQL('u')); + $tmp = $app->db->queryOneRecord("SELECT sum(hd_quota) as webquota FROM web_domain WHERE domain_id != ".$app->functions->intval($this->id)." AND ".$app->tform->getAuthSQL('u')); $webquota = $tmp["webquota"]; - $new_web_quota = intval($this->dataRecord["hd_quota"]); + $new_web_quota = $app->functions->intval($this->dataRecord["hd_quota"]); if(($webquota + $new_web_quota > $reseller["limit_web_quota"]) || ($new_web_quota < 0 && $reseller["limit_web_quota"] >= 0)) { $max_free_quota = floor($reseller["limit_web_quota"] - $webquota); if($max_free_quota < 0) $max_free_quota = 0; @@ -556,9 +556,9 @@ class page_action extends tform_actions { //* Check the traffic quota of the client if(isset($_POST["traffic_quota"]) && $reseller["limit_traffic_quota"] > 0) { - $tmp = $app->db->queryOneRecord("SELECT sum(traffic_quota) as trafficquota FROM web_domain WHERE domain_id != ".intval($this->id)." AND ".$app->tform->getAuthSQL('u')); + $tmp = $app->db->queryOneRecord("SELECT sum(traffic_quota) as trafficquota FROM web_domain WHERE domain_id != ".$app->functions->intval($this->id)." AND ".$app->tform->getAuthSQL('u')); $trafficquota = $tmp["trafficquota"]; - $new_traffic_quota = intval($this->dataRecord["traffic_quota"]); + $new_traffic_quota = $app->functions->intval($this->dataRecord["traffic_quota"]); if(($trafficquota + $new_traffic_quota > $reseller["limit_traffic_quota"]) || ($new_traffic_quota < 0 && $reseller["limit_traffic_quota"] >= 0)) { $max_free_quota = floor($reseller["limit_traffic_quota"] - $trafficquota); if($max_free_quota < 0) $max_free_quota = 0; @@ -574,7 +574,7 @@ class page_action extends tform_actions { // When the record is updated if($this->id > 0) { // restore the server ID if the user is not admin and record is edited - $tmp = $app->db->queryOneRecord("SELECT server_id, `cgi`, `ssi`, `perl`, `ruby`, `python`, `suexec`, `errordocs`, `subdomain`, `ssl` FROM web_domain WHERE domain_id = ".intval($this->id)); + $tmp = $app->db->queryOneRecord("SELECT server_id, `cgi`, `ssi`, `perl`, `ruby`, `python`, `suexec`, `errordocs`, `subdomain`, `ssl` FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id)); $this->dataRecord["server_id"] = $tmp["server_id"]; // set the settings to current if not provided (or cleared due to limits) @@ -613,7 +613,7 @@ class page_action extends tform_actions { //* get the server config for this server $app->uses("getconf"); - $web_config = $app->getconf->get_server_config(intval(isset($this->dataRecord["server_id"]) ? $this->dataRecord["server_id"] : 0),'web'); + $web_config = $app->getconf->get_server_config($app->functions->intval(isset($this->dataRecord["server_id"]) ? $this->dataRecord["server_id"] : 0),'web'); //* Check for duplicate ssl certs per IP if SNI is disabled if(isset($this->dataRecord['ssl']) && $this->dataRecord['ssl'] == 'y' && $web_config['enable_sni'] != 'y') { $sql = "SELECT count(domain_id) as number FROM web_domain WHERE `ssl` = 'y' AND ip_address = '".$app->db->quote($this->dataRecord['ip_address'])."' and domain_id != ".$this->id; @@ -623,7 +623,7 @@ class page_action extends tform_actions { // Check if pm.max_children >= pm.max_spare_servers >= pm.start_servers >= pm.min_spare_servers > 0 if(isset($this->dataRecord['pm_max_children']) && $this->dataRecord['pm'] == 'dynamic') { - if(intval($this->dataRecord['pm_max_children']) >= intval($this->dataRecord['pm_max_spare_servers']) && intval($this->dataRecord['pm_max_spare_servers']) >= intval($this->dataRecord['pm_start_servers']) && intval($this->dataRecord['pm_start_servers']) >= intval($this->dataRecord['pm_min_spare_servers']) && intval($this->dataRecord['pm_min_spare_servers']) > 0){ + if($app->functions->intval($this->dataRecord['pm_max_children'], true) >= $app->functions->intval($this->dataRecord['pm_max_spare_servers'], true) && $app->functions->intval($this->dataRecord['pm_max_spare_servers'], true) >= $app->functions->intval($this->dataRecord['pm_start_servers'], true) && $app->functions->intval($this->dataRecord['pm_start_servers'], true) >= $app->functions->intval($this->dataRecord['pm_min_spare_servers'], true) && $app->functions->intval($this->dataRecord['pm_min_spare_servers'], true) > 0){ } else { $app->tform->errorMessage .= $app->tform->lng("error_php_fpm_pm_settings_txt").'
'; @@ -639,18 +639,18 @@ class page_action extends tform_actions { // make sure that the record belongs to the clinet group and not the admin group when admin inserts it // also make sure that the user can not delete domain created by a admin if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) { - $client_group_id = intval($this->dataRecord["client_group_id"]); + $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); $app->db->query("UPDATE web_domain SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE domain_id = ".$this->id); } if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) { - $client_group_id = intval($this->dataRecord["client_group_id"]); + $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); $app->db->query("UPDATE web_domain SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE domain_id = ".$this->id); } // Get configuration for the web system $app->uses("getconf"); $web_rec = $app->tform->getDataRecord($this->id); - $web_config = $app->getconf->get_server_config(intval($web_rec["server_id"]),'web'); + $web_config = $app->getconf->get_server_config($app->functions->intval($web_rec["server_id"]),'web'); $document_root = str_replace("[website_id]",$this->id,$web_config["website_path"]); $document_root = str_replace("[website_idhash_1]",$this->id_hash($page_form->id,1),$document_root); $document_root = str_replace("[website_idhash_2]",$this->id_hash($page_form->id,1),$document_root); @@ -661,11 +661,11 @@ class page_action extends tform_actions { if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) { $client_group_id = $_SESSION["s"]["user"]["default_group"]; $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = $client_group_id"); - $client_id = intval($client["client_id"]); + $client_id = $app->functions->intval($client["client_id"]); } else { - //$client_id = intval($this->dataRecord["client_group_id"]); - $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".intval($this->dataRecord["client_group_id"])); - $client_id = intval($client["client_id"]); + //$client_id = $app->functions->intval($this->dataRecord["client_group_id"]); + $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".$app->functions->intval($this->dataRecord["client_group_id"])); + $client_id = $app->functions->intval($client["client_id"]); } // Set the values for document_root, system_user and system_group @@ -739,18 +739,18 @@ class page_action extends tform_actions { // make sure that the record belongs to the client group and not the admin group when a admin inserts it // also make sure that the user can not delete domain created by a admin if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($this->dataRecord["client_group_id"])) { - $client_group_id = intval($this->dataRecord["client_group_id"]); + $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); $app->db->query("UPDATE web_domain SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE domain_id = ".$this->id); } if($app->auth->has_clients($_SESSION['s']['user']['userid']) && isset($this->dataRecord["client_group_id"])) { - $client_group_id = intval($this->dataRecord["client_group_id"]); + $client_group_id = $app->functions->intval($this->dataRecord["client_group_id"]); $app->db->query("UPDATE web_domain SET sys_groupid = $client_group_id, sys_perm_group = 'riud' WHERE domain_id = ".$this->id); } // Get configuration for the web system $app->uses("getconf"); $web_rec = $app->tform->getDataRecord($this->id); - $web_config = $app->getconf->get_server_config(intval($web_rec["server_id"]),'web'); + $web_config = $app->getconf->get_server_config($app->functions->intval($web_rec["server_id"]),'web'); $document_root = str_replace("[website_id]",$this->id,$web_config["website_path"]); $page_formid = isset($page_form->id) ? $page_form->id : ''; $document_root = str_replace("[website_idhash_1]",$this->id_hash($page_formid,1),$document_root); @@ -762,15 +762,15 @@ class page_action extends tform_actions { if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) { $client_group_id = $_SESSION["s"]["user"]["default_group"]; $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = $client_group_id"); - $client_id = intval($client["client_id"]); + $client_id = $app->functions->intval($client["client_id"]); } elseif (isset($this->dataRecord["client_group_id"])) { $client_group_id = $this->dataRecord["client_group_id"]; - $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".intval(@$this->dataRecord["client_group_id"])); - $client_id = intval($client["client_id"]); + $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".$app->functions->intval(@$this->dataRecord["client_group_id"])); + $client_id = $app->functions->intval($client["client_id"]); } else { $client_group_id = $web_rec['sys_groupid']; - $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".intval($client_group_id)); - $client_id = intval($client["client_id"]); + $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".$app->functions->intval($client_group_id)); + $client_id = $app->functions->intval($client["client_id"]); } if(($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) && isset($this->dataRecord["client_group_id"]) && $this->dataRecord["client_group_id"] != $this->oldDataRecord["sys_groupid"]) { diff --git a/interface/web/sites/web_folder_del.php b/interface/web/sites/web_folder_del.php index 81faa658d..75f56f48b 100644 --- a/interface/web/sites/web_folder_del.php +++ b/interface/web/sites/web_folder_del.php @@ -56,7 +56,7 @@ class page_action extends tform_actions { if($app->tform->checkPerm($this->id,'d') == false) $app->error($app->lng('error_no_delete_permission')); // Delete all users that belong to this folder. - $records = $app->db->queryAllRecords("SELECT web_folder_user_id FROM web_folder_user WHERE web_folder_id = '".intval($this->id)."'"); + $records = $app->db->queryAllRecords("SELECT web_folder_user_id FROM web_folder_user WHERE web_folder_id = '".$app->functions->intval($this->id)."'"); foreach($records as $rec) { $app->db->datalogDelete('web_folder_user','web_folder_user_id',$rec['web_folder_user_id']); } diff --git a/interface/web/sites/web_folder_edit.php b/interface/web/sites/web_folder_edit.php index 182b22361..178c2af69 100644 --- a/interface/web/sites/web_folder_edit.php +++ b/interface/web/sites/web_folder_edit.php @@ -55,7 +55,7 @@ class page_action extends tform_actions { global $app, $conf; // Get the record of the parent domain - $parent_domain = $app->db->queryOneRecord("select server_id FROM web_domain WHERE domain_id = ".intval(@$this->dataRecord["parent_domain_id"])); + $parent_domain = $app->db->queryOneRecord("select server_id FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"])); // Set a few fixed values $this->dataRecord["server_id"] = $parent_domain["server_id"]; diff --git a/interface/web/sites/web_folder_user_edit.php b/interface/web/sites/web_folder_user_edit.php index 75a2caf5f..95a886449 100644 --- a/interface/web/sites/web_folder_user_edit.php +++ b/interface/web/sites/web_folder_user_edit.php @@ -55,7 +55,7 @@ class page_action extends tform_actions { global $app, $conf; // Get the record of the parent domain - $folder = $app->db->queryOneRecord("select server_id FROM web_folder WHERE web_folder_id = ".intval(@$this->dataRecord["web_folder_id"])); + $folder = $app->db->queryOneRecord("select server_id FROM web_folder WHERE web_folder_id = ".$app->functions->intval(@$this->dataRecord["web_folder_id"])); // Set a few fixed values $this->dataRecord["server_id"] = $folder["server_id"]; diff --git a/interface/web/sites/web_sites_stats.php b/interface/web/sites/web_sites_stats.php index bd7acb642..3a010691d 100644 --- a/interface/web/sites/web_sites_stats.php +++ b/interface/web/sites/web_sites_stats.php @@ -70,10 +70,10 @@ class list_action extends listform_actions { { global $app; - $app->tpl->setVar('sum_this_month',number_format(intval($this->sum_this_month), 0, '.', ' ')); - $app->tpl->setVar('sum_this_year',number_format(intval($this->sum_this_year), 0, '.', ' ')); - $app->tpl->setVar('sum_last_month',number_format(intval($this->sum_last_month), 0, '.', ' ')); - $app->tpl->setVar('sum_last_year',number_format(intval($this->sum_last_year), 0, '.', ' ')); + $app->tpl->setVar('sum_this_month',number_format($app->functions->intval($this->sum_this_month), 0, '.', ' ')); + $app->tpl->setVar('sum_this_year',number_format($app->functions->intval($this->sum_this_year), 0, '.', ' ')); + $app->tpl->setVar('sum_last_month',number_format($app->functions->intval($this->sum_last_month), 0, '.', ' ')); + $app->tpl->setVar('sum_last_year',number_format($app->functions->intval($this->sum_last_year), 0, '.', ' ')); $app->tpl->setVar('sum_txt',$app->listform->lng('sum_txt')); $app->tpl_defaults(); diff --git a/interface/web/sites/web_subdomain_edit.php b/interface/web/sites/web_subdomain_edit.php index 6e9db86f0..ad0079477 100644 --- a/interface/web/sites/web_subdomain_edit.php +++ b/interface/web/sites/web_subdomain_edit.php @@ -113,7 +113,7 @@ class page_action extends tform_actions { } else { // Get the record of the parent domain - $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".intval(@$this->dataRecord["parent_domain_id"])); + $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"])); // remove the parent domain part of the domain name before we show it in the text field. $this->dataRecord["domain"] = str_replace('.'.$parent_domain["domain"],'',$this->dataRecord["domain"]); @@ -128,13 +128,13 @@ class page_action extends tform_actions { global $app, $conf; // Get the record of the parent domain - $parent_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval(@$this->dataRecord["parent_domain_id"])); + $parent_domain = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"])); $app->uses('ini_parser,getconf'); $settings = $app->getconf->get_global_config('domains'); if ($settings['use_domain_module'] == 'y') { // get the record of the domain module domain - $domain = $app->db->queryOneRecord("SELECT * FROM domain WHERE domain_id = ".intval($this->dataRecord["sel_domain"])); + $domain = $app->db->queryOneRecord("SELECT * FROM domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["sel_domain"])); if(!$domain) { $app->tform->errorMessage .= $app->tform->lng("domain_error_empty")."
"; } else { @@ -159,7 +159,7 @@ class page_action extends tform_actions { function onAfterInsert() { global $app, $conf; - $app->db->query('UPDATE web_domain SET sys_groupid = '.intval($this->parent_domain_record['sys_groupid']).' WHERE domain_id = '.$this->id); + $app->db->query('UPDATE web_domain SET sys_groupid = '.$app->functions->intval($this->parent_domain_record['sys_groupid']).' WHERE domain_id = '.$this->id); } @@ -170,7 +170,7 @@ class page_action extends tform_actions { if($this->dataRecord['parent_domain_id'] != $this->oldDataRecord['parent_domain_id']) { //* Update the domain owner - $app->db->query('UPDATE web_domain SET sys_groupid = '.intval($this->parent_domain_record['sys_groupid']).' WHERE domain_id = '.$this->id); + $app->db->query('UPDATE web_domain SET sys_groupid = '.$app->functions->intval($this->parent_domain_record['sys_groupid']).' WHERE domain_id = '.$this->id); //* Update the old website, so that the vhost alias gets removed //* We force the update by inserting a transaction record without changes manually. diff --git a/interface/web/sites/web_vhost_subdomain_del.php b/interface/web/sites/web_vhost_subdomain_del.php index 4f6948a70..9d3609bf8 100644 --- a/interface/web/sites/web_vhost_subdomain_del.php +++ b/interface/web/sites/web_vhost_subdomain_del.php @@ -53,7 +53,7 @@ class page_action extends tform_actions { global $app; $conf; //* Delete all web folders - $records = $app->db->queryAllRecords("SELECT web_folder_id FROM web_folder WHERE parent_domain_id = '".intval($this->id)."'"); + $records = $app->db->queryAllRecords("SELECT web_folder_id FROM web_folder WHERE parent_domain_id = '".$app->functions->intval($this->id)."'"); foreach($records as $rec) { //* Delete all web folder users $records2 = $app->db->queryAllRecords("SELECT web_folder_user_id FROM web_folder_user WHERE web_folder_id = '".$rec['web_folder_id']."'"); diff --git a/interface/web/sites/web_vhost_subdomain_edit.php b/interface/web/sites/web_vhost_subdomain_edit.php index 45371eecf..c96c69c1b 100644 --- a/interface/web/sites/web_vhost_subdomain_edit.php +++ b/interface/web/sites/web_vhost_subdomain_edit.php @@ -85,7 +85,7 @@ class page_action extends tform_actions { $read_limits = array('limit_cgi', 'limit_ssi', 'limit_perl', 'limit_ruby', 'limit_python', 'force_suexec', 'limit_hterror', 'limit_wildcard', 'limit_ssl'); - $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".intval(@$this->dataRecord["parent_domain_id"])); + $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"])); //* Client: If the logged in user is not admin and has no sub clients (no reseller) if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) { @@ -279,7 +279,7 @@ class page_action extends tform_actions { global $app, $conf; // Get the record of the parent domain - $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".intval(@$this->dataRecord["parent_domain_id"])); + $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"])); // Set a few fixed values $this->dataRecord["type"] = 'vhostsubdomain'; @@ -300,9 +300,9 @@ class page_action extends tform_actions { $app->uses('ini_parser,getconf'); $settings = $app->getconf->get_global_config('domains'); if ($settings['use_domain_module'] == 'y') { - $client_group_id = intval($_SESSION["s"]["user"]["default_group"]); + $client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]); - $sql = "SELECT domain_id, domain FROM domain WHERE domain_id = " . intval($this->dataRecord['sel_domain']); + $sql = "SELECT domain_id, domain FROM domain WHERE domain_id = " . $app->functions->intval($this->dataRecord['sel_domain']); if ($_SESSION["s"]["user"]["typ"] != 'admin') { $sql .= "AND sys_groupid =" . $client_group_id; } @@ -324,7 +324,7 @@ class page_action extends tform_actions { $app->tform->errorMessage .= $app->tform->lng("web_folder_invalid_txt")."
"; } // check for duplicate folder usage - $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_domain` WHERE `type` = 'vhostsubdomain' AND `parent_domain_id` = '" . intval($this->dataRecord['parent_domain_id']) . "' AND `web_folder` = '" . $app->db->quote($this->dataRecord['web_folder']) . "' AND `domain_id` != '" . intval($this->id) . "'"); + $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_domain` WHERE `type` = 'vhostsubdomain' AND `parent_domain_id` = '" . $app->functions->intval($this->dataRecord['parent_domain_id']) . "' AND `web_folder` = '" . $app->db->quote($this->dataRecord['web_folder']) . "' AND `domain_id` != '" . $app->functions->intval($this->id) . "'"); if($check && $check['cnt'] > 0) { $app->tform->errorMessage .= $app->tform->lng("web_folder_unique_txt")."
"; } @@ -347,9 +347,9 @@ class page_action extends tform_actions { //* Check the website quota of the client if(isset($_POST["hd_quota"]) && $client["limit_web_quota"] >= 0) { - $tmp = $app->db->queryOneRecord("SELECT sum(hd_quota) as webquota FROM web_domain WHERE domain_id != ".intval($this->id)." AND ".$app->tform->getAuthSQL('u')); + $tmp = $app->db->queryOneRecord("SELECT sum(hd_quota) as webquota FROM web_domain WHERE domain_id != ".$app->functions->intval($this->id)." AND ".$app->tform->getAuthSQL('u')); $webquota = $tmp["webquota"]; - $new_web_quota = intval($this->dataRecord["hd_quota"]); + $new_web_quota = $app->functions->intval($this->dataRecord["hd_quota"]); if(($webquota + $new_web_quota > $client["limit_web_quota"]) || ($new_web_quota < 0 && $client["limit_web_quota"] >= 0)) { $max_free_quota = floor($client["limit_web_quota"] - $webquota); if($max_free_quota < 0) $max_free_quota = 0; @@ -363,9 +363,9 @@ class page_action extends tform_actions { //* Check the traffic quota of the client if(isset($_POST["traffic_quota"]) && $client["limit_traffic_quota"] > 0) { - $tmp = $app->db->queryOneRecord("SELECT sum(traffic_quota) as trafficquota FROM web_domain WHERE domain_id != ".intval($this->id)." AND ".$app->tform->getAuthSQL('u')); + $tmp = $app->db->queryOneRecord("SELECT sum(traffic_quota) as trafficquota FROM web_domain WHERE domain_id != ".$app->functions->intval($this->id)." AND ".$app->tform->getAuthSQL('u')); $trafficquota = $tmp["trafficquota"]; - $new_traffic_quota = intval($this->dataRecord["traffic_quota"]); + $new_traffic_quota = $app->functions->intval($this->dataRecord["traffic_quota"]); if(($trafficquota + $new_traffic_quota > $client["limit_traffic_quota"]) || ($new_traffic_quota < 0 && $client["limit_traffic_quota"] >= 0)) { $max_free_quota = floor($client["limit_traffic_quota"] - $trafficquota); if($max_free_quota < 0) $max_free_quota = 0; @@ -383,9 +383,9 @@ class page_action extends tform_actions { //* Check the website quota of the client if(isset($_POST["hd_quota"]) && $reseller["limit_web_quota"] >= 0) { - $tmp = $app->db->queryOneRecord("SELECT sum(hd_quota) as webquota FROM web_domain WHERE domain_id != ".intval($this->id)." AND ".$app->tform->getAuthSQL('u')); + $tmp = $app->db->queryOneRecord("SELECT sum(hd_quota) as webquota FROM web_domain WHERE domain_id != ".$app->functions->intval($this->id)." AND ".$app->tform->getAuthSQL('u')); $webquota = $tmp["webquota"]; - $new_web_quota = intval($this->dataRecord["hd_quota"]); + $new_web_quota = $app->functions->intval($this->dataRecord["hd_quota"]); if(($webquota + $new_web_quota > $reseller["limit_web_quota"]) || ($new_web_quota < 0 && $reseller["limit_web_quota"] >= 0)) { $max_free_quota = floor($reseller["limit_web_quota"] - $webquota); if($max_free_quota < 0) $max_free_quota = 0; @@ -399,9 +399,9 @@ class page_action extends tform_actions { //* Check the traffic quota of the client if(isset($_POST["traffic_quota"]) && $reseller["limit_traffic_quota"] > 0) { - $tmp = $app->db->queryOneRecord("SELECT sum(traffic_quota) as trafficquota FROM web_domain WHERE domain_id != ".intval($this->id)." AND ".$app->tform->getAuthSQL('u')); + $tmp = $app->db->queryOneRecord("SELECT sum(traffic_quota) as trafficquota FROM web_domain WHERE domain_id != ".$app->functions->intval($this->id)." AND ".$app->tform->getAuthSQL('u')); $trafficquota = $tmp["trafficquota"]; - $new_traffic_quota = intval($this->dataRecord["traffic_quota"]); + $new_traffic_quota = $app->functions->intval($this->dataRecord["traffic_quota"]); if(($trafficquota + $new_traffic_quota > $reseller["limit_traffic_quota"]) || ($new_traffic_quota < 0 && $reseller["limit_traffic_quota"] >= 0)) { $max_free_quota = floor($reseller["limit_traffic_quota"] - $trafficquota); if($max_free_quota < 0) $max_free_quota = 0; @@ -417,7 +417,7 @@ class page_action extends tform_actions { // When the record is updated if($this->id > 0) { // restore the server ID if the user is not admin and record is edited - $tmp = $app->db->queryOneRecord("SELECT server_id, `web_folder`, `cgi`, `ssi`, `perl`, `ruby`, `python`, `suexec`, `errordocs`, `subdomain`, `ssl` FROM web_domain WHERE domain_id = ".intval($this->id)); + $tmp = $app->db->queryOneRecord("SELECT server_id, `web_folder`, `cgi`, `ssi`, `perl`, `ruby`, `python`, `suexec`, `errordocs`, `subdomain`, `ssl` FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id)); $this->dataRecord['web_folder'] = $tmp['web_folder']; // cannot be changed! // set the settings to current if not provided (or cleared due to limits) @@ -449,7 +449,7 @@ class page_action extends tform_actions { //* get the server config for this server $app->uses("getconf"); - $web_config = $app->getconf->get_server_config(intval(isset($this->dataRecord["server_id"]) ? $this->dataRecord["server_id"] : 0),'web'); + $web_config = $app->getconf->get_server_config($app->functions->intval(isset($this->dataRecord["server_id"]) ? $this->dataRecord["server_id"] : 0),'web'); //* Check for duplicate ssl certs per IP if SNI is disabled if(isset($this->dataRecord['ssl']) && $this->dataRecord['ssl'] == 'y' && $web_config['enable_sni'] != 'y') { $sql = "SELECT count(domain_id) as number FROM web_domain WHERE `ssl` = 'y' AND ip_address = '".$app->db->quote($this->dataRecord['ip_address'])."' and domain_id != ".$this->id; @@ -459,7 +459,7 @@ class page_action extends tform_actions { // Check if pm.max_children >= pm.max_spare_servers >= pm.start_servers >= pm.min_spare_servers > 0 if(isset($this->dataRecord['pm_max_children']) && $this->dataRecord['pm'] == 'dynamic') { - if(intval($this->dataRecord['pm_max_children']) >= intval($this->dataRecord['pm_max_spare_servers']) && intval($this->dataRecord['pm_max_spare_servers']) >= intval($this->dataRecord['pm_start_servers']) && intval($this->dataRecord['pm_start_servers']) >= intval($this->dataRecord['pm_min_spare_servers']) && intval($this->dataRecord['pm_min_spare_servers']) > 0){ + if($app->functions->intval($this->dataRecord['pm_max_children'], true) >= $app->functions->intval($this->dataRecord['pm_max_spare_servers'], true) && $app->functions->intval($this->dataRecord['pm_max_spare_servers'], true) >= $app->functions->intval($this->dataRecord['pm_start_servers'], true) && $app->functions->intval($this->dataRecord['pm_start_servers'], true) >= $app->functions->intval($this->dataRecord['pm_min_spare_servers'], true) && $app->functions->intval($this->dataRecord['pm_min_spare_servers'], true) > 0){ } else { $app->tform->errorMessage .= $app->tform->lng("error_php_fpm_pm_settings_txt").'
'; @@ -475,7 +475,7 @@ class page_action extends tform_actions { // Get configuration for the web system $app->uses("getconf"); $web_rec = $app->tform->getDataRecord($this->id); - $web_config = $app->getconf->get_server_config(intval($web_rec["server_id"]),'web'); + $web_config = $app->getconf->get_server_config($app->functions->intval($web_rec["server_id"]),'web'); var_dump($this->parent_domain_record, $web_rec); // Set the values for document_root, system_user and system_group $system_user = $app->db->quote($this->parent_domain_record['system_user']); @@ -487,7 +487,7 @@ class page_action extends tform_actions { $php_open_basedir = $app->db->quote(str_replace("[website_domain]",$web_rec['domain'],$php_open_basedir)); $htaccess_allow_override = $app->db->quote($this->parent_domain_record['allow_override']); - $sql = "UPDATE web_domain SET sys_groupid = ".intval($this->parent_domain_record['sys_groupid']).",system_user = '$system_user', system_group = '$system_group', document_root = '$document_root', allow_override = '$htaccess_allow_override', php_open_basedir = '$php_open_basedir' WHERE domain_id = ".$this->id; + $sql = "UPDATE web_domain SET sys_groupid = ".$app->functions->intval($this->parent_domain_record['sys_groupid']).",system_user = '$system_user', system_group = '$system_group', document_root = '$document_root', allow_override = '$htaccess_allow_override', php_open_basedir = '$php_open_basedir' WHERE domain_id = ".$this->id; $app->db->query($sql); } @@ -515,7 +515,7 @@ class page_action extends tform_actions { // Get configuration for the web system $app->uses("getconf"); $web_rec = $app->tform->getDataRecord($this->id); - $web_config = $app->getconf->get_server_config(intval($web_rec["server_id"]),'web'); + $web_config = $app->getconf->get_server_config($app->functions->intval($web_rec["server_id"]),'web'); // Set the values for document_root, system_user and system_group $system_user = $app->db->quote($this->parent_domain_record['system_user']); @@ -527,7 +527,7 @@ class page_action extends tform_actions { $php_open_basedir = $app->db->quote(str_replace("[website_domain]",$web_rec['domain'],$php_open_basedir)); $htaccess_allow_override = $app->db->quote($this->parent_domain_record['allow_override']); - $sql = "UPDATE web_domain SET sys_groupid = ".intval($this->parent_domain_record['sys_groupid']).",system_user = '$system_user', system_group = '$system_group', document_root = '$document_root', allow_override = '$htaccess_allow_override', php_open_basedir = '$php_open_basedir' WHERE domain_id = ".$this->id; + $sql = "UPDATE web_domain SET sys_groupid = ".$app->functions->intval($this->parent_domain_record['sys_groupid']).",system_user = '$system_user', system_group = '$system_group', document_root = '$document_root', allow_override = '$htaccess_allow_override', php_open_basedir = '$php_open_basedir' WHERE domain_id = ".$this->id; $app->db->query($sql); } diff --git a/interface/web/sites/webdav_user_edit.php b/interface/web/sites/webdav_user_edit.php index 05756c738..8f11bb0db 100644 --- a/interface/web/sites/webdav_user_edit.php +++ b/interface/web/sites/webdav_user_edit.php @@ -101,7 +101,7 @@ class page_action extends tform_actions { global $app, $conf; /* Get the record of the parent domain */ - $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".intval(@$this->dataRecord["parent_domain_id"])); + $parent_domain = $app->db->queryOneRecord("select * FROM web_domain WHERE domain_id = ".$app->functions->intval(@$this->dataRecord["parent_domain_id"])); /* * Set a few fixed values @@ -143,7 +143,7 @@ class page_action extends tform_actions { /* * Get the data of the domain, owning the webdav user */ - $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".intval($this->dataRecord["parent_domain_id"])); + $web = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->dataRecord["parent_domain_id"])); /* The server is the server of the domain */ $this->dataRecord["server_id"] = $web["server_id"]; /* The Webdav user shall be owned by the same group then the website */ @@ -164,7 +164,7 @@ class page_action extends tform_actions { * we can not change the username and the dir, so get the "old" - data from the db * and set it */ - $data = $app->db->queryOneRecord("SELECT * FROM webdav_user WHERE webdav_user_id = ".intval($this->id)); + $data = $app->db->queryOneRecord("SELECT * FROM webdav_user WHERE webdav_user_id = ".$app->functions->intval($this->id)); $this->dataRecord["username"] = $data['username']; $this->dataRecord["dir"] = $data['dir']; $passwordOld = $data['password']; diff --git a/interface/web/tools/import_ispconfig.php b/interface/web/tools/import_ispconfig.php index eb0a2f3b2..a06366448 100644 --- a/interface/web/tools/import_ispconfig.php +++ b/interface/web/tools/import_ispconfig.php @@ -49,7 +49,7 @@ include($lng_file); $app->tpl->setVar($wb); if(isset($_POST['connected'])) { - $connected = intval($_POST['connected']); + $connected = $app->functions->intval($_POST['connected']); if($connected == 0) { //* Try to connect to remote server @@ -142,9 +142,9 @@ function start_domain_import($mail_domain) { global $app, $conf, $client, $msg, $error, $remote_session_id; //* Get the user and groupid for the new records - $sys_groupid = intval($_POST['client_group_id']); + $sys_groupid = $app->functions->intval($_POST['client_group_id']); $tmp = $app->db->queryOneRecord("SELECT userid FROM sys_user WHERE default_group = $sys_groupid"); - $sys_userid = intval($tmp['userid']); + $sys_userid = $app->functions->intval($tmp['userid']); unset($tmp); if($sys_groupid == 0) $error .= 'Inavlid groupid
'; if($sys_userid == 0) $error .= 'Inavlid Userid
'; diff --git a/interface/web/tools/import_plesk.php b/interface/web/tools/import_plesk.php index 341a400ad..1f38bf95b 100644 --- a/interface/web/tools/import_plesk.php +++ b/interface/web/tools/import_plesk.php @@ -269,7 +269,7 @@ if(isset($_POST['start']) && $_POST['start'] == 1) { 'web_php_options' => implode(',', $phpopts), 'limit_web_aliasdomain' => get_limit($limits, $entry['id'], 'max_dom_aliases', -1), 'limit_web_subdomain' => get_limit($limits, $entry['id'], 'max_subdom', -1), - 'limit_ftp_user' => (string)(intval(get_limit($limits, $entry['id'], 'max_subftp_users', -2)) + 1), + 'limit_ftp_user' => (string)($app->functions->intval(get_limit($limits, $entry['id'], 'max_subftp_users', -2)) + 1), 'limit_shell_user' => 0, 'ssh_chroot' => 'no,jailkit', 'limit_webdav_user' => get_limit($limits, $entry['id'], 'max_wu', 0), diff --git a/interface/web/vm/ajax_get_ip.php b/interface/web/vm/ajax_get_ip.php index b6963ade9..a7636f5fc 100644 --- a/interface/web/vm/ajax_get_ip.php +++ b/interface/web/vm/ajax_get_ip.php @@ -34,7 +34,7 @@ require_once('../../lib/app.inc.php'); //* Check permissions for module $app->auth->check_module_permissions('vm'); -$server_id = intval($_GET["server_id"]); +$server_id = $app->functions->intval($_GET["server_id"]); if($_SESSION["s"]["user"]["typ"] == 'admin' or $app->auth->has_clients($_SESSION['s']['user']['userid'])) { diff --git a/interface/web/vm/openvz_action.php b/interface/web/vm/openvz_action.php index e1707da72..b62ca3367 100644 --- a/interface/web/vm/openvz_action.php +++ b/interface/web/vm/openvz_action.php @@ -11,7 +11,7 @@ require_once('../../lib/app.inc.php'); $app->auth->check_module_permissions('vm'); $action = (isset($_POST['action']) && $_POST['action'] != '')?$_POST['action']:'show'; -$vm_id = intval($_REQUEST['id']); +$vm_id = $app->functions->intval($_REQUEST['id']); $error_msg = ''; $notify_msg = ''; diff --git a/interface/web/vm/openvz_vm_edit.php b/interface/web/vm/openvz_vm_edit.php index 1f210ae94..f77d04cd8 100644 --- a/interface/web/vm/openvz_vm_edit.php +++ b/interface/web/vm/openvz_vm_edit.php @@ -161,12 +161,12 @@ class page_action extends tform_actions { //* Fill the IPv4 select field with the IP addresses that are allowed for this client //$sql = "SELECT ip_address FROM server_ip WHERE server_id = ".$client['default_webserver']." AND ip_type = 'IPv4' AND (client_id = 0 OR client_id=".$_SESSION['s']['user']['client_id'].")"; if(isset($this->dataRecord["server_id"])) { - $vm_server_id = intval($this->dataRecord["server_id"]); + $vm_server_id = $app->functions->intval($this->dataRecord["server_id"]); } else { $tmp = $app->db->queryOneRecord('SELECT server_id FROM server WHERE vserver_server = 1 AND mirror_server_id = 0 ORDER BY server_name LIMIT 0,1'); $vm_server_id = $tmp['server_id']; } - $sql = "SELECT ip_address FROM openvz_ip WHERE reserved = 'n' AND (vm_id = 0 or vm_id = '".$this->id."') AND server_id = ".intval($vm_server_id)." ORDER BY ip_address"; + $sql = "SELECT ip_address FROM openvz_ip WHERE reserved = 'n' AND (vm_id = 0 or vm_id = '".$this->id."') AND server_id = ".$app->functions->intval($vm_server_id)." ORDER BY ip_address"; $ips = $app->db->queryAllRecords($sql); $ip_select = ""; if(is_array($ips)) { -- GitLab