| | |
| | | return $url; |
| | | } |
| | | |
| | | function json_encode($data) { |
| | | public function json_encode($data) { |
| | | if(!function_exists('json_encode')){ |
| | | if(is_array($data) || is_object($data)){ |
| | | $islist = is_array($data) && (empty($data) || array_keys($data) === range(0,count($data)-1)); |
| | |
| | | } |
| | | } |
| | | |
| | | public function suggest_ips($type = 'IPv4'){ |
| | | global $app; |
| | | |
| | | if($type == 'IPv4'){ |
| | | $regex = "/^[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}(\.)[0-9]{1,3}$/"; |
| | | } else { |
| | | // IPv6 |
| | | $regex = "/^(\:\:([a-f0-9]{1,4}\:){0,6}?[a-f0-9]{0,4}|[a-f0-9]{1,4}(\:[a-f0-9]{1,4}){0,6}?\:\:|[a-f0-9]{1,4}(\:[a-f0-9]{1,4}){1,6}?\:\:([a-f0-9]{1,4}\:){1,6}?[a-f0-9]{1,4})(\/\d{1,3})?$/i"; |
| | | } |
| | | |
| | | $ips = array(); |
| | | $results = $app->db->queryAllRecords("SELECT ip_address AS ip FROM server_ip WHERE ip_type = '".$type."'"); |
| | | if(!empty($results) && is_array($results)){ |
| | | foreach($results as $result){ |
| | | if(preg_match($regex, $result['ip'])) $ips[] = $result['ip']; |
| | | } |
| | | } |
| | | $results = $app->db->queryAllRecords("SELECT ip_address AS ip FROM openvz_ip"); |
| | | if(!empty($results) && is_array($results)){ |
| | | foreach($results as $result){ |
| | | if(preg_match($regex, $result['ip'])) $ips[] = $result['ip']; |
| | | } |
| | | } |
| | | $results = $app->db->queryAllRecords("SELECT data AS ip FROM dns_rr WHERE type = 'A' OR type = 'AAAA'"); |
| | | if(!empty($results) && is_array($results)){ |
| | | foreach($results as $result){ |
| | | if(preg_match($regex, $result['ip'])) $ips[] = $result['ip']; |
| | | } |
| | | } |
| | | $results = $app->db->queryAllRecords("SELECT ns AS ip FROM dns_slave"); |
| | | if(!empty($results) && is_array($results)){ |
| | | foreach($results as $result){ |
| | | if(preg_match($regex, $result['ip'])) $ips[] = $result['ip']; |
| | | } |
| | | } |
| | | |
| | | $results = $app->db->queryAllRecords("SELECT xfer FROM dns_slave WHERE xfer != ''"); |
| | | if(!empty($results) && is_array($results)){ |
| | | foreach($results as $result){ |
| | | $tmp_ips = explode(',', $result['xfer']); |
| | | foreach($tmp_ips as $tmp_ip){ |
| | | $tmp_ip = trim($tmp_ip); |
| | | if(preg_match($regex, $tmp_ip)) $ips[] = $tmp_ip; |
| | | } |
| | | } |
| | | } |
| | | $results = $app->db->queryAllRecords("SELECT xfer FROM dns_soa WHERE xfer != ''"); |
| | | if(!empty($results) && is_array($results)){ |
| | | foreach($results as $result){ |
| | | $tmp_ips = explode(',', $result['xfer']); |
| | | foreach($tmp_ips as $tmp_ip){ |
| | | $tmp_ip = trim($tmp_ip); |
| | | if(preg_match($regex, $tmp_ip)) $ips[] = $tmp_ip; |
| | | } |
| | | } |
| | | } |
| | | $results = $app->db->queryAllRecords("SELECT also_notify FROM dns_soa WHERE also_notify != ''"); |
| | | if(!empty($results) && is_array($results)){ |
| | | foreach($results as $result){ |
| | | $tmp_ips = explode(',', $result['also_notify']); |
| | | foreach($tmp_ips as $tmp_ip){ |
| | | $tmp_ip = trim($tmp_ip); |
| | | if(preg_match($regex, $tmp_ip)) $ips[] = $tmp_ip; |
| | | } |
| | | } |
| | | } |
| | | $results = $app->db->queryAllRecords("SELECT remote_ips FROM web_database WHERE remote_ips != ''"); |
| | | if(!empty($results) && is_array($results)){ |
| | | foreach($results as $result){ |
| | | $tmp_ips = explode(',', $result['remote_ips']); |
| | | foreach($tmp_ips as $tmp_ip){ |
| | | $tmp_ip = trim($tmp_ip); |
| | | if(preg_match($regex, $tmp_ip)) $ips[] = $tmp_ip; |
| | | } |
| | | } |
| | | } |
| | | $ips = array_unique($ips); |
| | | sort($ips, SORT_NUMERIC); |
| | | |
| | | $result_array = array('cheader' => array(), 'cdata' => array()); |
| | | |
| | | if(!empty($ips)){ |
| | | $result_array['cheader'] = array('title' => 'IPs', |
| | | 'total' => count($ips), |
| | | 'limit' => count($ips) |
| | | ); |
| | | |
| | | foreach($ips as $ip){ |
| | | $result_array['cdata'][] = array( 'title' => $ip, |
| | | 'description' => $type, |
| | | 'onclick' => '', |
| | | 'fill_text' => $ip |
| | | ); |
| | | } |
| | | } |
| | | |
| | | return $result_array; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | //* Check permissions for module |
| | | $app->auth->check_module_permissions('dns'); |
| | | |
| | | $app->uses('tform'); |
| | | //$app->uses('tform'); |
| | | |
| | | $type = $_GET["type"]; |
| | | |
| | |
| | | |
| | | |
| | | if($type == 'get_ipv4'){ |
| | | $q = $app->db->quote(trim($_GET["q"])); |
| | | $authsql = " AND ".$app->tform->getAuthSQL('r'); |
| | | $modules = explode(',', $_SESSION['s']['user']['modules']); |
| | | //$q = $app->db->quote(trim($_GET["q"])); |
| | | //$authsql = " AND ".$app->tform->getAuthSQL('r'); |
| | | //$modules = explode(',', $_SESSION['s']['user']['modules']); |
| | | |
| | | $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=".intval($_SESSION['s']['user']['client_id']).")"); |
| | | $result[] = $app->functions->suggest_ips('IPv4'); |
| | | |
| | | $json = $app->functions->json_encode($result); |
| | | } |
| | | |
| | | if($type == 'get_ipv6'){ |
| | | $q = $app->db->quote(trim($_GET["q"])); |
| | | $authsql = " AND ".$app->tform->getAuthSQL('r'); |
| | | $modules = explode(',', $_SESSION['s']['user']['modules']); |
| | | //$q = $app->db->quote(trim($_GET["q"])); |
| | | //$authsql = " AND ".$app->tform->getAuthSQL('r'); |
| | | //$modules = explode(',', $_SESSION['s']['user']['modules']); |
| | | |
| | | $result = array(); |
| | | |
| | | // ipv4 |
| | | $result[] = _search('admin', 'server_ip', "AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=".intval($_SESSION['s']['user']['client_id']).")"); |
| | | // ipv6 |
| | | //$result[] = _search('admin', 'server_ip', "AND ip_type = 'IPv6' AND (client_id = 0 OR client_id=".intval($_SESSION['s']['user']['client_id']).")"); |
| | | $result[] = $app->functions->suggest_ips('IPv6'); |
| | | |
| | | $json = $app->functions->json_encode($result); |
| | | } |
| | | |
| | | //} |
| | | |
| | | function _search($module, $section, $additional_sql = ''){ |
| | | /* |
| | | function _search($module, $section, $additional_sql = '', $unique = false){ |
| | | global $app, $q, $authsql, $modules; |
| | | |
| | | $result_array = array('cheader' => array(), 'cdata' => array()); |
| | |
| | | 'fill_text' => $result[$title_key] |
| | | ); |
| | | } |
| | | if($unique === true){ |
| | | $result_array['cdata'] = array_unique($result_array['cdata']); |
| | | $result_array['cheader']['total'] = $result_array['cheader']['limit'] = count($result_array['cdata']); |
| | | } |
| | | } |
| | | } |
| | | return $result_array; |
| | | } |
| | | */ |
| | | |
| | | header('Content-type: application/json'); |
| | | echo $json; |
| | |
| | | </div> |
| | | |
| | | </div> |
| | | <script language="JavaScript" type="text/javascript"> |
| | | jQuery('#ns').ispconfigSearch({ |
| | | dataSrc: '/dns/ajax_get_json.php?type=get_ipv4', |
| | | resultsLimit: '$ <tmpl_var name="globalsearch_resultslimit_of_txt"> % <tmpl_var name="globalsearch_resultslimit_results_txt">', |
| | | ResultsTextPrefix: '<tmpl_var name="globalsearch_suggestions_text_txt">', |
| | | noResultsText: '<tmpl_var name="globalsearch_noresults_text_txt">', |
| | | noResultsLimit: '<tmpl_var name="globalsearch_noresults_limit_txt">', |
| | | minChars: 0, |
| | | cssPrefix: 'df-', |
| | | fillSearchField: true, |
| | | fillSearchFieldWith: 'fill_text', |
| | | searchFieldWatermark: '', |
| | | resultBoxPosition: 'e' |
| | | }); |
| | | jQuery('#xfer').ispconfigSearch({ |
| | | dataSrc: '/dns/ajax_get_json.php?type=get_ipv4', |
| | | resultsLimit: '$ <tmpl_var name="globalsearch_resultslimit_of_txt"> % <tmpl_var name="globalsearch_resultslimit_results_txt">', |
| | | ResultsTextPrefix: '<tmpl_var name="globalsearch_suggestions_text_txt">', |
| | | noResultsText: '<tmpl_var name="globalsearch_noresults_text_txt">', |
| | | noResultsLimit: '<tmpl_var name="globalsearch_noresults_limit_txt">', |
| | | minChars: 0, |
| | | cssPrefix: 'df-', |
| | | fillSearchField: true, |
| | | fillSearchFieldWith: 'fill_text', |
| | | searchFieldWatermark: '', |
| | | resultBoxPosition: 'e' |
| | | }); |
| | | </script> |
| | |
| | | </div> |
| | | |
| | | </div> |
| | | <script language="JavaScript" type="text/javascript"> |
| | | jQuery('#xfer').ispconfigSearch({ |
| | | dataSrc: '/dns/ajax_get_json.php?type=get_ipv4', |
| | | resultsLimit: '$ <tmpl_var name="globalsearch_resultslimit_of_txt"> % <tmpl_var name="globalsearch_resultslimit_results_txt">', |
| | | ResultsTextPrefix: '<tmpl_var name="globalsearch_suggestions_text_txt">', |
| | | noResultsText: '<tmpl_var name="globalsearch_noresults_text_txt">', |
| | | noResultsLimit: '<tmpl_var name="globalsearch_noresults_limit_txt">', |
| | | minChars: 0, |
| | | cssPrefix: 'df-', |
| | | fillSearchField: true, |
| | | fillSearchFieldWith: 'fill_text', |
| | | searchFieldWatermark: '', |
| | | resultBoxPosition: 'e' |
| | | }); |
| | | jQuery('#also_notify').ispconfigSearch({ |
| | | dataSrc: '/dns/ajax_get_json.php?type=get_ipv4', |
| | | resultsLimit: '$ <tmpl_var name="globalsearch_resultslimit_of_txt"> % <tmpl_var name="globalsearch_resultslimit_results_txt">', |
| | | ResultsTextPrefix: '<tmpl_var name="globalsearch_suggestions_text_txt">', |
| | | noResultsText: '<tmpl_var name="globalsearch_noresults_text_txt">', |
| | | noResultsLimit: '<tmpl_var name="globalsearch_noresults_limit_txt">', |
| | | minChars: 0, |
| | | cssPrefix: 'df-', |
| | | fillSearchField: true, |
| | | fillSearchFieldWith: 'fill_text', |
| | | searchFieldWatermark: '', |
| | | resultBoxPosition: 'e' |
| | | }); |
| | | </script> |
| | |
| | | $json .= '"}'; |
| | | } |
| | | |
| | | if($type == 'get_ipv4'){ |
| | | $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[] = $app->functions->suggest_ips('IPv4'); |
| | | |
| | | $json = $app->functions->json_encode($result); |
| | | } |
| | | |
| | | if($type == 'get_ipv6'){ |
| | | $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[] = $app->functions->suggest_ips('IPv6'); |
| | | |
| | | $json = $app->functions->json_encode($result); |
| | | } |
| | | |
| | | //} |
| | | |
| | | header('Content-type: application/json'); |
| | | echo $json; |
| | | ?> |
| | |
| | | $wb["parent_domain_id_txt"] = 'Website'; |
| | | $wb["database_site_error_empty"] = 'Wählen Sie ein Website aus, zu der die Datenbank gehört.'; |
| | | $wb["select_site_txt"] = '- Website wählen -'; |
| | | $wb['globalsearch_resultslimit_of_txt'] = "von"; |
| | | $wb['globalsearch_resultslimit_results_txt'] = "Treffern"; |
| | | $wb['globalsearch_noresults_text_txt'] = "Keine Treffer."; |
| | | $wb['globalsearch_noresults_limit_txt'] = "0 Treffer"; |
| | | $wb['globalsearch_searchfield_watermark_txt'] = "Suche"; |
| | | $wb['globalsearch_suggestions_text_txt'] = "Vorschläge"; |
| | | ?> |
| | |
| | | $wb['repeat_password_txt'] = 'Repeat Password'; |
| | | $wb['password_mismatch_txt'] = 'The passwords do not match.'; |
| | | $wb['password_match_txt'] = 'The passwords do match.'; |
| | | $wb['globalsearch_resultslimit_of_txt'] = "of"; |
| | | $wb['globalsearch_resultslimit_results_txt'] = "results"; |
| | | $wb['globalsearch_noresults_text_txt'] = "No results."; |
| | | $wb['globalsearch_noresults_limit_txt'] = "0 results"; |
| | | $wb['globalsearch_searchfield_watermark_txt'] = "Search"; |
| | | $wb['globalsearch_suggestions_text_txt'] = "Suggestions"; |
| | | ?> |
| | |
| | | </div> |
| | | |
| | | </div> |
| | | <script language="JavaScript" type="text/javascript"> |
| | | jQuery('#remote_ips').ispconfigSearch({ |
| | | dataSrc: '/sites/ajax_get_json.php?type=get_ipv4', |
| | | resultsLimit: '$ <tmpl_var name="globalsearch_resultslimit_of_txt"> % <tmpl_var name="globalsearch_resultslimit_results_txt">', |
| | | ResultsTextPrefix: '<tmpl_var name="globalsearch_suggestions_text_txt">', |
| | | noResultsText: '<tmpl_var name="globalsearch_noresults_text_txt">', |
| | | noResultsLimit: '<tmpl_var name="globalsearch_noresults_limit_txt">', |
| | | minChars: 0, |
| | | cssPrefix: 'df-', |
| | | fillSearchField: true, |
| | | fillSearchFieldWith: 'fill_text', |
| | | searchFieldWatermark: '', |
| | | resultBoxPosition: 'e' |
| | | }); |
| | | </script> |