Fixed/Implemented: replaced intval() by $app->functions->intval() in all interface functions due to big number problem in intval()
| | |
| | | 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() { |
| | |
| | | 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')"); |
| | |
| | |
|
| | | //* 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') {
|
| | |
| | | $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'];
|
| | |
| | | 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);
|
| | |
| | | */
|
| | | public function validateInstallerInput($postinput, $pkg_details, $domains, $settings = array())
|
| | | {
|
| | | global $app;
|
| | | |
| | | $ret = array();
|
| | | $input = array();
|
| | | $error = array();
|
| | |
| | | {
|
| | | 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'])
|
| | |
| | | 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; |
| | |
| | | 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"); |
| | |
| | | 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"); |
| | |
| | | /* |
| | | * 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']; |
| | |
| | | * 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. |
| | |
| | | $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)){ |
| | |
| | | } |
| | | } |
| | | 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); |
| | | } |
| | | } |
| | |
| | | * @return record |
| | | */ |
| | | function decode($record) { |
| | | global $app; |
| | | if(is_array($record)) { |
| | | foreach($record as $key => $val) { |
| | | switch ($this->tableDef[$key]['datatype']) { |
| | |
| | | break; |
| | | |
| | | case 'INTEGER': |
| | | $new_record[$key] = intval($val); |
| | | $new_record[$key] = $app->functions->intval($val); |
| | | break; |
| | | |
| | | case 'DOUBLE': |
| | |
| | | } |
| | | 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); |
| | |
| | | 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); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | 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'])); |
| | | } |
| | |
| | | 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 |
| | |
| | | } |
| | | |
| | | //* 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']; |
| | |
| | | break; |
| | | |
| | | case 'INTEGER': |
| | | $record[$key] = intval($record[$key]); |
| | | $record[$key] = $app->functions->intval($record[$key]); |
| | | break; |
| | | |
| | | case 'DOUBLE': |
| | |
| | | break; |
| | | |
| | | case 'INTEGER': |
| | | $record[$key] = intval($record[$key]); |
| | | $record[$key] = $app->functions->intval($record[$key]); |
| | | break; |
| | | |
| | | case 'DOUBLE': |
| | |
| | | $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'"; |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | $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) { |
| | |
| | | |
| | | 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']); |
| | |
| | | // 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 != '') { |
| | |
| | | } |
| | | |
| | | 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']; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | // 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']); |
| | |
| | | $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; |
| | |
| | | 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']); |
| | |
| | | |
| | | 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); |
| | |
| | | |
| | | $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; |
| | |
| | | $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'"; |
| | |
| | | } 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; |
| | |
| | | $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); |
| | |
| | | $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; |
| | |
| | | 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; |
| | |
| | | $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; |
| | | } |
| | |
| | | } 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; |
| | |
| | | } 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; |
| | |
| | | $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"); |
| | |
| | | } |
| | | |
| | | 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; |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | $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) { |
| | |
| | | /** |
| | | * 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 |
| | | * |
| | | * Hinweis: |
| | | * Das ID-Feld ist nicht bei den Table Values einzuf�gen. |
| | | * Hint: The auto increment (ID) filed of the table has not be be definied separately. |
| | | * |
| | | */ |
| | | |
| | | class remoting_lib { |
| | | |
| | | /** |
| | | * Definition of the database atble (array) |
| | | * Definition of the database table (array) |
| | | * @var tableDef |
| | | */ |
| | | private $tableDef; |
| | |
| | | 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'; |
| | |
| | | |
| | | |
| | | /** |
| | | * 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 |
| | |
| | | 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': |
| | |
| | | break; |
| | | |
| | | case 'CURRENCY': |
| | | $new_record[$key] = number_format($record[$key], 2, ',', ''); |
| | | $new_record[$key] = $app->functions->currency_format($record[$key]); |
| | | break; |
| | | |
| | | default: |
| | |
| | | $app->uses($datasource_class); |
| | | $values = $app->$datasource_class->$datasource_function($field, $record); |
| | | } else { |
| | | $this->errorMessage .= "Custom datasource class or function is empty<br>\r\n"; |
| | | $this->errorMessage .= "Custom datasource class or function is empty<br />\r\n"; |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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]); |
| | | } |
| | |
| | | } |
| | | 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]); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | //* 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; |
| | | } |
| | | |
| | | /** |
| | |
| | | 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]."<br />\r\n"; |
| | |
| | | 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])) { |
| | | $this->errorMessage .= $this->wordbook[$errmsg]."<br />\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])) { |
| | |
| | | $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 |
| | |
| | | $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] == '') { |
| | |
| | | $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])); |
| | |
| | | $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 |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | // Add backticks for incomplete table names |
| | | if(stristr($this->formDef['db_table'],'.')) { |
| | | $escape = ''; |
| | | } else { |
| | |
| | | |
| | | 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`, "; |
| | |
| | | $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; |
| | |
| | | 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"; |
| | |
| | | |
| | | 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"; |
| | |
| | | |
| | | $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 { |
| | |
| | | |
| | | $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']; |
| | |
| | | |
| | | public function decode($record) |
| | | { |
| | | global $app; |
| | | if(is_array($record)) { |
| | | foreach($this->listDef['item'] as $field) { |
| | | $key = $field['field']; |
| | |
| | | break; |
| | | |
| | | case 'INTEGER': |
| | | $record[$key] = intval($record[$key]); |
| | | $record[$key] = $app->functions->intval($record[$key]); |
| | | break; |
| | | |
| | | case 'DOUBLE': |
| | |
| | | break; |
| | | |
| | | case 'INTEGER': |
| | | $record[$key] = intval($record[$key]); |
| | | $record[$key] = $app->functions->intval($record[$key]); |
| | | break; |
| | | |
| | | case 'DOUBLE': |
| | |
| | | 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']; |
| | |
| | | |
| | | 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); |
| | |
| | | |
| | | 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); |
| | |
| | | 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']; |
| | |
| | | // 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()); |
| | |
| | | // 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()); |
| | |
| | | |
| | | 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); |
| | |
| | | |
| | | 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); |
| | |
| | | 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()); |
| | |
| | | } |
| | | 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()); |
| | |
| | | * 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; |
| | |
| | | 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; |
| | |
| | | function loadFormDef($file,$module = '') { |
| | | global $app,$conf; |
| | | |
| | | include_once($file); |
| | | include($file); |
| | | $this->formDef = $form; |
| | | |
| | | $this->module = $module; |
| | |
| | | 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) { |
| | |
| | | break; |
| | | |
| | | case 'INTEGER': |
| | | $new_record[$key] = intval($record[$key]); |
| | | $new_record[$key] = $app->functions->intval($record[$key]); |
| | | break; |
| | | |
| | | case 'DOUBLE': |
| | |
| | | } |
| | | |
| | | /** |
| | | * 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 |
| | |
| | | $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); |
| | | |
| | |
| | | } |
| | | 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; |
| | |
| | | } |
| | | } |
| | | } 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])) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * Create the SQL staement. |
| | | * Create SQL statement |
| | | * |
| | | * @param record = Datensatz als Array |
| | | * @param action = INSERT oder UPDATE |
| | |
| | | $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) { |
| | |
| | | $app->tform->loadFormDef($tform_def_file); |
| | | |
| | | // importing ID |
| | | $this->id = intval($_REQUEST["id"]); |
| | | $this->id = $app->functions->intval($_REQUEST["id"]); |
| | | |
| | | if($this->id > 0) { |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | $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); |
| | |
| | | $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; |
| | |
| | | |
| | | $error = ''; |
| | | |
| | | if(intval($value) != $value || !is_numeric($value)) $error .= $fieldname." ".$app->tform->wordbook['error_must_be_integer']."<br>\r\n"; |
| | | if($app->functions->intval($value, true) != $value || !is_numeric($value)) $error .= $fieldname." ".$app->tform->wordbook['error_must_be_integer']."<br>\r\n"; |
| | | if($value > 2147483647) $error .= $fieldname." ".$app->tform->wordbook['error_must_not_be_greater_than_2147483647']."<br>\r\n"; |
| | | if(!$zero_allowed){ |
| | | if($value <= 0) $error .= $fieldname." ".$app->tform->wordbook['error_must_be_positive']."<br>\r\n"; |
| | |
| | | |
| | | // 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; |
| | |
| | | $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']; |
| | |
| | | $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; |
| | | } |
| | | |
| | |
| | | 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') { |
| | | |
| | |
| | | // 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); |
| | | } |
| | | } |
| | |
| | | // 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); |
| | |
| | | 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 |
| | |
| | | // 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']); |
| | |
| | | $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); |
| | | } |
| | | } |
| | |
| | | // 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); |
| | | } |
| | | |
| | |
| | | // 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); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | 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']; |
| | |
| | | $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); |
| | |
| | | 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'"); |
| | |
| | | |
| | | $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']); |
| | |
| | | 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']):''; |
| | |
| | | /* |
| | | 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']; |
| | |
| | | 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']):''; |
| | |
| | | //* 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')"; |
| | |
| | | |
| | | |
| | | 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; |
| | | } |
| | |
| | | // 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) { |
| | |
| | | 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']); |
| | |
| | | // 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 != '') { |
| | |
| | | //* 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); |
| | |
| | | |
| | | //* 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(); |
| | |
| | | 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'"; |
| | | } |
| | |
| | | } 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); |
| | |
| | | } |
| | | |
| | | // Recipient Drop-Down |
| | | $recipient = '<option value="0"'.(intval($_POST['recipient']) == 0 ? ' selected="selected"' : '').'>'.($_SESSION["s"]["user"]["typ"] == 'admin'? $wb['all_clients_resellers_txt'] : $wb['all_clients_txt']).'</option>'; |
| | | $recipient = '<option value="0"'.($app->functions->intval($_POST['recipient']) == 0 ? ' selected="selected"' : '').'>'.($_SESSION["s"]["user"]["typ"] == 'admin'? $wb['all_clients_resellers_txt'] : $wb['all_clients_txt']).'</option>'; |
| | | $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 .= '<option value="'.$circle['circle_id'].'"'.(intval($_POST['recipient']) == $circle['circle_id'] ? ' selected="selected"' : '').'>'.$circle['circle_name'].'</option>'; |
| | | $recipient .= '<option value="'.$circle['circle_id'].'"'.($app->functions->intval($_POST['recipient']) == $circle['circle_id'] ? ' selected="selected"' : '').'>'.$circle['circle_name'].'</option>'; |
| | | } |
| | | } |
| | | $app->tpl->setVar('recipient',$recipient); |
| | |
| | | // 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); |
| | | } |
| | | } |
| | |
| | | |
| | | 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')); |
| | |
| | | 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']); |
| | |
| | | |
| | | //* 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); |
| | |
| | | $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); |
| | |
| | | $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); |
| | |
| | | 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"]; |
| | |
| | | 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); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | 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"]; |
| | |
| | | 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); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | 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"]; |
| | |
| | | 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); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | 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"]; |
| | |
| | | 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); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | 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"]; |
| | |
| | | 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); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | $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"); |
| | |
| | | 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;$i<count($servers);$i++) |
| | | { |
| | |
| | | $time_format = strtolower(substr($parts[1],-1)); |
| | | switch ($time_format) { |
| | | case 's': |
| | | $soa['ttl'] = intval(substr($parts[1],0,-1)); |
| | | $soa['ttl'] = $app->functions->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); |
| | | } |
| | |
| | | $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); |
| | | } |
| | |
| | | $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); |
| | | } |
| | |
| | | $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); |
| | | } |
| | |
| | | $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); |
| | | } |
| | |
| | | $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': |
| | |
| | | $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': |
| | |
| | | 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': |
| | |
| | | $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': |
| | |
| | | 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': |
| | |
| | | $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){ |
| | |
| | | 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"]; |
| | |
| | | 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); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | 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"]; |
| | |
| | | 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); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | 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"]; |
| | |
| | | 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); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | 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"]; |
| | |
| | | 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); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | 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']); |
| | | } |
| | |
| | | // 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 |
| | |
| | | |
| | | // 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); |
| | | } |
| | | |
| | |
| | | |
| | | // 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); |
| | |
| | | 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']); |
| | | } |
| | |
| | | // 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 |
| | |
| | | |
| | | // 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); |
| | |
| | | |
| | | // 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); |
| | |
| | | |
| | | //** 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); |
| | |
| | | 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"]; |
| | |
| | | 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); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | 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"]; |
| | |
| | | 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); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | $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"); |
| | |
| | | |
| | | // 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"]; |
| | | } |
| | |
| | | |
| | | |
| | | */ |
| | | global $app; |
| | | |
| | | $form["title"] = "DNS A"; |
| | | $form["description"] = ""; |
| | |
| | | 'zone' => array ( |
| | | 'datatype' => 'INTEGER', |
| | | 'formtype' => 'TEXT', |
| | | 'default' => @intval($_REQUEST["zone"]), |
| | | 'default' => @$app->functions->intval($_REQUEST["zone"]), |
| | | 'value' => '', |
| | | 'width' => '30', |
| | | 'maxlength' => '255' |
| | |
| | | |
| | | |
| | | */ |
| | | global $app; |
| | | |
| | | $form["title"] = "DNS AAAA"; |
| | | $form["description"] = ""; |
| | |
| | | 'zone' => array ( |
| | | 'datatype' => 'INTEGER', |
| | | 'formtype' => 'TEXT', |
| | | 'default' => @intval($_REQUEST["zone"]), |
| | | 'default' => @$app->functions->intval($_REQUEST["zone"]), |
| | | 'value' => '', |
| | | 'width' => '30', |
| | | 'maxlength' => '255' |
| | |
| | | |
| | | |
| | | */ |
| | | global $app; |
| | | |
| | | $form["title"] = "DNS ALIAS"; |
| | | $form["description"] = ""; |
| | |
| | | 'zone' => array ( |
| | | 'datatype' => 'INTEGER', |
| | | 'formtype' => 'TEXT', |
| | | 'default' => @intval($_REQUEST["zone"]), |
| | | 'default' => @$app->functions->intval($_REQUEST["zone"]), |
| | | 'value' => '', |
| | | 'width' => '30', |
| | | 'maxlength' => '255' |
| | |
| | | |
| | | |
| | | */ |
| | | global $app; |
| | | |
| | | $form["title"] = "DNS CNAME"; |
| | | $form["description"] = ""; |
| | |
| | | 'zone' => array ( |
| | | 'datatype' => 'INTEGER', |
| | | 'formtype' => 'TEXT', |
| | | 'default' => @intval($_REQUEST["zone"]), |
| | | 'default' => @$app->functions->intval($_REQUEST["zone"]), |
| | | 'value' => '', |
| | | 'width' => '30', |
| | | 'maxlength' => '255' |
| | |
| | | |
| | | |
| | | */ |
| | | global $app; |
| | | |
| | | $form["title"] = "DNS hinfo"; |
| | | $form["description"] = ""; |
| | |
| | | 'zone' => array ( |
| | | 'datatype' => 'INTEGER', |
| | | 'formtype' => 'TEXT', |
| | | 'default' => @intval($_REQUEST["zone"]), |
| | | 'default' => @$app->functions->intval($_REQUEST["zone"]), |
| | | 'value' => '', |
| | | 'width' => '30', |
| | | 'maxlength' => '255' |
| | |
| | | |
| | | */ |
| | | |
| | | global $app; |
| | | |
| | | $form["title"] = "DNS mx"; |
| | | $form["description"] = ""; |
| | | $form["name"] = "dns_mx"; |
| | |
| | | 'zone' => array ( |
| | | 'datatype' => 'INTEGER', |
| | | 'formtype' => 'TEXT', |
| | | 'default' => @intval($_REQUEST["zone"]), |
| | | 'default' => @$app->functions->intval($_REQUEST["zone"]), |
| | | 'value' => '', |
| | | 'width' => '30', |
| | | 'maxlength' => '255' |
| | |
| | | |
| | | |
| | | */ |
| | | global $app; |
| | | |
| | | $form["title"] = "DNS ns"; |
| | | $form["description"] = ""; |
| | |
| | | 'zone' => array ( |
| | | 'datatype' => 'INTEGER', |
| | | 'formtype' => 'TEXT', |
| | | 'default' => @intval($_REQUEST["zone"]), |
| | | 'default' => @$app->functions->intval($_REQUEST["zone"]), |
| | | 'value' => '', |
| | | 'width' => '30', |
| | | 'maxlength' => '255' |
| | |
| | | |
| | | |
| | | */ |
| | | global $app; |
| | | |
| | | $form["title"] = "DNS ptr"; |
| | | $form["description"] = ""; |
| | |
| | | 'zone' => array ( |
| | | 'datatype' => 'INTEGER', |
| | | 'formtype' => 'TEXT', |
| | | 'default' => @intval($_REQUEST["zone"]), |
| | | 'default' => @$app->functions->intval($_REQUEST["zone"]), |
| | | 'value' => '', |
| | | 'width' => '30', |
| | | 'maxlength' => '255' |
| | |
| | | |
| | | |
| | | */ |
| | | global $app; |
| | | |
| | | $form["title"] = "DNS RP"; |
| | | $form["description"] = ""; |
| | |
| | | 'zone' => array ( |
| | | 'datatype' => 'INTEGER', |
| | | 'formtype' => 'TEXT', |
| | | 'default' => @intval($_REQUEST["zone"]), |
| | | 'default' => @$app->functions->intval($_REQUEST["zone"]), |
| | | 'value' => '', |
| | | 'width' => '30', |
| | | 'maxlength' => '255' |
| | |
| | | |
| | | |
| | | */ |
| | | global $app; |
| | | |
| | | $form["title"] = "DNS Zone"; |
| | | $form["description"] = ""; |
| | |
| | | '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" |
| | | ) |
| | | ) |
| | |
| | | |
| | | |
| | | */ |
| | | global $app; |
| | | |
| | | $form["title"] = "DNS SRV"; |
| | | $form["description"] = ""; |
| | |
| | | 'zone' => array ( |
| | | 'datatype' => 'INTEGER', |
| | | 'formtype' => 'TEXT', |
| | | 'default' => @intval($_REQUEST["zone"]), |
| | | 'default' => @$app->functions->intval($_REQUEST["zone"]), |
| | | 'value' => '', |
| | | 'width' => '30', |
| | | 'maxlength' => '255' |
| | |
| | | |
| | | |
| | | */ |
| | | global $app; |
| | | |
| | | $form["title"] = "DNS TXT Record"; |
| | | $form["description"] = ""; |
| | |
| | | 'zone' => array ( |
| | | 'datatype' => 'INTEGER', |
| | | 'formtype' => 'TEXT', |
| | | 'default' => @intval($_REQUEST["zone"]), |
| | | 'default' => @$app->functions->intval($_REQUEST["zone"]), |
| | | 'value' => '', |
| | | 'width' => '30', |
| | | 'maxlength' => '255' |
| | |
| | | |
| | | |
| | | */ |
| | | global $app; |
| | | |
| | | $form["title"] = "Mailbox"; |
| | | $form["description"] = ""; |
| | |
| | | '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" |
| | | ) |
| | | ) |
| | |
| | | |
| | | |
| | | */ |
| | | global $app; |
| | | |
| | | $form["title"] = "Email filter"; |
| | | $form["description"] = ""; |
| | |
| | | 'mailuser_id' => array ( |
| | | 'datatype' => 'INTEGER', |
| | | 'formtype' => 'TEXT', |
| | | 'default' => @intval($_REQUEST["mailuser_id"]), |
| | | 'default' => @$app->functions->intval($_REQUEST["mailuser_id"]), |
| | | 'value' => '', |
| | | 'width' => '30', |
| | | 'maxlength' => '255' |
| | |
| | | $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; |
| | | } |
| | |
| | | // 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 |
| | |
| | | // 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) { |
| | |
| | | // 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) { |
| | |
| | | // 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); |
| | | } |
| | | } |
| | |
| | | // 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); |
| | | } |
| | | } |
| | |
| | | $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"]; |
| | | |
| | |
| | | |
| | | // 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."<br>"; |
| | |
| | | $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) { |
| | |
| | | $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) { |
| | |
| | | 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"]; |
| | |
| | | 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') { |
| | | |
| | |
| | | //** 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]; |
| | |
| | | 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!"); |
| | | } |
| | |
| | | } // 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); |
| | | |
| | |
| | | } // 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); |
| | | |
| | |
| | | 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!"); |
| | | } |
| | |
| | | |
| | | */ |
| | | |
| | | global $app; |
| | | |
| | | $form["title"] = "mailbox_filter_txt"; |
| | | $form["description"] = ""; |
| | | $form["name"] = "mail_user_filter"; |
| | |
| | | 'mailuser_id' => array ( |
| | | 'datatype' => 'INTEGER', |
| | | 'formtype' => 'TEXT', |
| | | 'default' => @intval($_REQUEST["mailuser_id"]), |
| | | 'default' => @$app->functions->intval($_REQUEST["mailuser_id"]), |
| | | 'value' => '', |
| | | 'width' => '30', |
| | | 'maxlength' => '255' |
| | |
| | | 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"]; |
| | |
| | | $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) { |
| | |
| | | //* 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'); |
| | |
| | | $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 */ |
| | |
| | | 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 = ''; |
| | |
| | | |
| | | $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'); |
| | |
| | | $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'])) { |
| | |
| | | |
| | | $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"]; |
| | | |
| | |
| | | $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); |
| | |
| | | $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); |
| | |
| | | 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 '<div class="swap" id="ir-Yes"><span>'.$app->lng('Yes').'</span></div>';
|
| | | }
|
| | | 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 '<div class="swap" id="ir-No"><span>'.$app->lng('No').'</span></div>';
|
| | | }
|
| | | }
|
| | |
| | | } |
| | | |
| | | // 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"]; |
| | |
| | | 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'; |
| | | } |
| | |
| | | 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 |
| | |
| | | // 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 |
| | |
| | | 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']; |
| | |
| | | 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']; |
| | |
| | | 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!"); |
| | | } |
| | |
| | | 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']); |
| | | } |
| | |
| | | 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); |
| | | } |
| | | } |
| | |
| | | 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']; |
| | |
| | | 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"]; |
| | |
| | | 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"]; |
| | |
| | | |
| | | //* 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"]; |
| | |
| | | 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"]; |
| | |
| | | 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"]; |
| | |
| | | $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; |
| | | } |
| | |
| | | } |
| | | |
| | | // 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'; |
| | |
| | | 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); |
| | | |
| | | } |
| | | |
| | |
| | | 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. |
| | |
| | | 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']."'"); |
| | |
| | | // 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); |
| | | } |
| | |
| | | $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; |
| | | } |
| | |
| | | |
| | | //* 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; |
| | |
| | | |
| | | //* 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; |
| | |
| | | |
| | | //* 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; |
| | |
| | | |
| | | //* 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; |
| | |
| | | // 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) |
| | |
| | | |
| | | //* 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; |
| | |
| | | |
| | | // 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").'<br>'; |
| | |
| | | // 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); |
| | |
| | | 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 |
| | |
| | | // 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); |
| | |
| | | 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"]) { |
| | |
| | | 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']); |
| | | } |
| | |
| | | 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"]; |
| | |
| | | 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"]; |
| | |
| | | { |
| | | 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(); |
| | |
| | | } 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"]); |
| | |
| | | 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")."<br />"; |
| | | } else { |
| | |
| | | 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); |
| | | |
| | | } |
| | | |
| | |
| | | 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. |
| | |
| | | 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']."'"); |
| | |
| | | |
| | | $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'])) { |
| | |
| | | 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'; |
| | |
| | | $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; |
| | | } |
| | |
| | | $app->tform->errorMessage .= $app->tform->lng("web_folder_invalid_txt")."<br>"; |
| | | } |
| | | // 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")."<br>"; |
| | | } |
| | |
| | | |
| | | //* 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; |
| | |
| | | |
| | | //* 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; |
| | |
| | | |
| | | //* 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; |
| | |
| | | |
| | | //* 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; |
| | |
| | | // 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) |
| | |
| | | |
| | | //* 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; |
| | |
| | | |
| | | // 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").'<br>'; |
| | |
| | | // 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']); |
| | |
| | | $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); |
| | | } |
| | | |
| | |
| | | // 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']); |
| | |
| | | $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); |
| | | } |
| | | |
| | |
| | | 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 |
| | |
| | | /* |
| | | * 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 */ |
| | |
| | | * 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']; |
| | |
| | | $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 |
| | |
| | | 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<br />'; |
| | | if($sys_userid == 0) $error .= 'Inavlid Userid<br />'; |
| | |
| | | '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), |
| | |
| | | //* 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'])) { |
| | | |
| | |
| | | $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 = ''; |
| | | |
| | |
| | | //* 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)) { |