@@ -130,11 +129,11 @@
|
- |
- |
- |
- |
- |
+ |
+ |
+ |
+ |
+ |
@@ -153,6 +152,20 @@
+
+
Date: Fri, 26 Feb 2016 23:36:45 +0100
Subject: [PATCH 47/61] Implemented feature as requested in #92, fixed filter
not submited correct using order
---
inc/record.inc.php | 150 +++++++++++++++++++++++----------------------
search.php | 18 +++---
2 files changed, 86 insertions(+), 82 deletions(-)
diff --git a/inc/record.inc.php b/inc/record.inc.php
index fec5780b6..e6bbcf641 100644
--- a/inc/record.inc.php
+++ b/inc/record.inc.php
@@ -1614,102 +1614,104 @@ function get_users_from_domain_id($id) {
return $owners;
}
-/** Search for Zone or Record
+/**
+ * Search for Zones and/or Records
*
- * @param string $search_string String to search
+ * @param array $parameters Array with parameters which configures function
* @param string $permission_view User permitted to view 'all' or 'own' zones
- * @param string $sort_zones_by Column to sort domain results [default='name']
- * @param string $sort_records_by Column to sort record results by [default='name']
- * @param boolean $wildcard Add wildcards automatically
- * @param boolean $reverse Search reverse records automatically
- *
- * @return mixed[] 'zones' => array of zones, 'records' => array of records
+ * @param string $sort_zones_by Column to sort zone results
+ * @param string $sort_records_by Column to sort record results
+ * @return array|bool
*/
-function search_zone_and_record($search_string, $permission_view, $sort_zones_by = 'name', $sort_records_by = 'name', $wildcard = true, $reverse = true) {
+function search_zone_and_record($parameters, $permission_view, $sort_zones_by, $sort_records_by) {
global $db;
$return = array('zones' => [], 'records' => []);
- if ($reverse) {
- if (filter_var($search_string, FILTER_FLAG_IPV4)) {
- $reverse_search_string = implode('.', array_reverse(explode('.', $search_string)));
- } elseif (filter_var($search_string, FILTER_FLAG_IPV6)) {
- $reverse_search_string = unpack('H*hex', inet_pton($search_string));
+ if ($parameters['reverse']) {
+ if (filter_var($parameters['query'], FILTER_FLAG_IPV4)) {
+ $reverse_search_string = implode('.', array_reverse(explode('.', $parameters['query'])));
+ } elseif (filter_var($parameters['query'], FILTER_FLAG_IPV6)) {
+ $reverse_search_string = unpack('H*hex', inet_pton($parameters['query']));
$reverse_search_string = implode('.', array_reverse(str_split($reverse_search_string['hex'])));
} else {
- $reverse = false;
+ $parameters['reverse'] = false;
$reverse_search_string = '';
}
$reverse_search_string = $db->quote('%' . $reverse_search_string . '%', 'text');
}
- $search_string = ($wildcard ? '%' : '') . trim($search_string) . ($wildcard ? '%' : '');
-
- $zonesQuery = '
- SELECT
- domains.id,
- domains.name,
- domains.type,
- z.id as zone_id,
- z.domain_id,
- z.owner,
- u.id as user_id,
- u.fullname,
- record_count.count_records
- FROM
- domains
- LEFT JOIN zones z on domains.id = z.domain_id
- LEFT JOIN users u on z.owner = u.id
- LEFT JOIN (SELECT COUNT(domain_id) AS count_records, domain_id FROM records WHERE type IS NOT NULL GROUP BY domain_id) record_count ON record_count.domain_id=domains.id
- WHERE
- (domains.name LIKE ' . $db->quote($search_string, 'text') .
- ($reverse ? ' OR domains.name LIKE ' . $reverse_search_string : '') . ') ' .
+ $search_string = ($parameters['wildcard'] ? '%' : '') . trim($parameters['query']) . ($parameters['wildcard'] ? '%' : '');
+
+ if ($parameters['zones']) {
+ $zonesQuery = '
+ SELECT
+ domains.id,
+ domains.name,
+ domains.type,
+ z.id as zone_id,
+ z.domain_id,
+ z.owner,
+ u.id as user_id,
+ u.fullname,
+ record_count.count_records
+ FROM
+ domains
+ LEFT JOIN zones z on domains.id = z.domain_id
+ LEFT JOIN users u on z.owner = u.id
+ LEFT JOIN (SELECT COUNT(domain_id) AS count_records, domain_id FROM records WHERE type IS NOT NULL GROUP BY domain_id) record_count ON record_count.domain_id=domains.id
+ WHERE
+ (domains.name LIKE ' . $db->quote($search_string, 'text') .
+ ($parameters['reverse'] ? ' OR domains.name LIKE ' . $reverse_search_string : '') . ') ' .
($permission_view == 'own' ? ' AND z.owner = ' . $db->quote($_SESSION['userid'], 'integer') : '') .
- ' ORDER BY ' . $sort_zones_by;
+ ' ORDER BY ' . $sort_zones_by;
- $zonesResponse = $db->query($zonesQuery);
- if (PEAR::isError($zonesResponse)) {
- error($zonesResponse->getMessage());
- return false;
+ $zonesResponse = $db->query($zonesQuery);
+ if (PEAR::isError($zonesResponse)) {
+ error($zonesResponse->getMessage());
+ return false;
+ }
+
+ while ($zone = $zonesResponse->fetchRow()) {
+ $return['zones'][] = $zone;
+ }
}
- while($zone = $zonesResponse->fetchRow()) {
- $return['zones'][] = $zone;
- }
-
-
- $recordsQuery = '
- SELECT
- records.id,
- records.domain_id,
- records.name,
- records.type,
- records.content,
- records.ttl,
- records.prio,
- z.id as zone_id,
- z.owner,
- u.id as user_id,
- u.fullname
- FROM
- records
- LEFT JOIN zones z on records.domain_id = z.domain_id
- LEFT JOIN users u on z.owner = u.id
- WHERE
- (records.name LIKE ' . $db->quote($search_string, 'text') . ' OR records.content LIKE ' . $db->quote($search_string, 'text') .
- ($reverse ? ' OR records.name LIKE ' . $reverse_search_string . ' OR records.content LIKE ' . $reverse_search_string : '') . ')' .
+
+ if ($parameters['records']) {
+ $recordsQuery = '
+ SELECT
+ records.id,
+ records.domain_id,
+ records.name,
+ records.type,
+ records.content,
+ records.ttl,
+ records.prio,
+ z.id as zone_id,
+ z.owner,
+ u.id as user_id,
+ u.fullname
+ FROM
+ records
+ LEFT JOIN zones z on records.domain_id = z.domain_id
+ LEFT JOIN users u on z.owner = u.id
+ WHERE
+ (records.name LIKE ' . $db->quote($search_string, 'text') . ' OR records.content LIKE ' . $db->quote($search_string, 'text') .
+ ($parameters['reverse'] ? ' OR records.name LIKE ' . $reverse_search_string . ' OR records.content LIKE ' . $reverse_search_string : '') . ')' .
($permission_view == 'own' ? 'AND z.owner = ' . $db->quote($_SESSION['userid'], 'integer') : '') .
- ' ORDER BY ' . $sort_records_by;
+ ' ORDER BY ' . $sort_records_by;
- $recordsResponse = $db->query($recordsQuery);
- if (PEAR::isError($recordsResponse)) {
- error($recordsResponse->getMessage());
- return false;
- }
+ $recordsResponse = $db->query($recordsQuery);
+ if (PEAR::isError($recordsResponse)) {
+ error($recordsResponse->getMessage());
+ return false;
+ }
- while($record = $recordsResponse->fetchRow()) {
- $return['records'][] = $record;
+ while ($record = $recordsResponse->fetchRow()) {
+ $return['records'][] = $record;
+ }
}
return $return;
diff --git a/search.php b/search.php
index e50e624c8..14db935e6 100644
--- a/search.php
+++ b/search.php
@@ -40,8 +40,10 @@
}
$parameters['query'] = isset($_POST['query']) && !empty($_POST['query']) ? $_POST['query'] : '';
-$parameters['wildcard'] = !isset($_POST['wildcard']) || isset($_POST['wildcard']) && $_POST['wildcard'] == true ? true : false;
-$parameters['reverse'] = !isset($_POST['reverse']) || isset($_POST['reverse']) && $_POST['reverse'] == true ? true : false;
+$parameters['zones'] = !isset($_POST['do_search']) && !isset($_POST['zones']) || isset($_POST['zones']) && $_POST['zones'] == true ? true : false;
+$parameters['records'] = !isset($_POST['do_search']) && !isset($_POST['records']) || isset($_POST['records']) && $_POST['records'] == true ? true : false;
+$parameters['wildcard'] = !isset($_POST['do_search']) && !isset($_POST['wildcard']) || isset($_POST['wildcard']) && $_POST['wildcard'] == true ? true : false;
+$parameters['reverse'] = !isset($_POST['do_search']) && !isset($_POST['reverse']) || isset($_POST['reverse']) && $_POST['reverse'] == true ? true : false;
?>
@@ -52,6 +54,8 @@
+ >
+ > |
>
>
@@ -84,12 +88,10 @@
}
$searchResult = search_zone_and_record(
- $parameters['query'],
+ $parameters,
$permissions['view'],
ZONE_SORT_BY,
- RECORD_SORT_BY,
- $parameters['wildcard'],
- $parameters['reverse']
+ RECORD_SORT_BY
);
if (is_array($searchResult['zones'])):
@@ -156,13 +158,13 @@
function zone_sort_by(sortbytype)
{
document.search_form.zone_sort_by.value = sortbytype;
- document.search_form.submit();
+ document.getElementsByName("do_search")[0].click();
}
function record_sort_by(sortbytype)
{
document.search_form.record_sort_by.value = sortbytype;
- document.search_form.submit();
+ document.getElementsByName("do_search")[0].click();
}
From 95017a780d71805ee647eb732c4c2e9fbbe9e6c1 Mon Sep 17 00:00:00 2001
From: Edmondas Girkantas
Date: Sat, 27 Feb 2016 21:32:48 +0200
Subject: [PATCH 48/61] Updated valid TLD list.
---
inc/toolkit.inc.php | 252 ++++++++++++++++++++++++++++----------------
1 file changed, 160 insertions(+), 92 deletions(-)
diff --git a/inc/toolkit.inc.php b/inc/toolkit.inc.php
index f86dcaa36..a7ddf22f5 100644
--- a/inc/toolkit.inc.php
+++ b/inc/toolkit.inc.php
@@ -108,99 +108,167 @@
define('RECORD_SORT_BY', "name");
}
-// Updated on 2015092200 - 1061 TLDs
+// Updated on 2016022601 - 1238 TLDs
// http://data.iana.org/TLD/tlds-alpha-by-domain.txt
-$valid_tlds = array('aaa', 'abb', 'abbott', 'abogado', 'ac', 'academy', 'accenture', 'accountant', 'accountants',
-'aco', 'active', 'actor', 'ad', 'ads', 'adult', 'ae', 'aeg', 'aero', 'af', 'afl', 'ag', 'agency', 'ai', 'aig',
-'airforce', 'airtel', 'al', 'allfinanz', 'alsace', 'am', 'amica', 'amsterdam', 'android', 'ao', 'apartments',
-'app', 'aq', 'aquarelle', 'ar', 'archi', 'army', 'arpa', 'as', 'asia', 'associates', 'at', 'attorney', 'au',
-'auction', 'audio', 'auto', 'autos', 'aw', 'ax', 'axa', 'az', 'azure', 'ba', 'band', 'bank', 'bar', 'barcelona',
-'barclaycard', 'barclays', 'bargains', 'bauhaus', 'bayern', 'bb', 'bbc', 'bbva', 'bcn', 'bd', 'be', 'beer',
-'bentley', 'berlin', 'best', 'bet', 'bf', 'bg', 'bh', 'bharti', 'bi', 'bible', 'bid', 'bike', 'bing', 'bingo',
-'bio', 'biz', 'bj', 'black', 'blackfriday', 'bloomberg', 'blue', 'bm', 'bmw', 'bn', 'bnl', 'bnpparibas', 'bo',
-'boats', 'bond', 'boo', 'boots', 'boutique', 'br', 'bradesco', 'bridgestone', 'broker', 'brother', 'brussels',
-'bs', 'bt', 'budapest', 'build', 'builders', 'business', 'buzz', 'bv', 'bw', 'by', 'bz', 'bzh', 'ca', 'cab',
-'cafe', 'cal', 'camera', 'camp', 'cancerresearch', 'canon', 'capetown', 'capital', 'car', 'caravan', 'cards',
-'care', 'career', 'careers', 'cars', 'cartier', 'casa', 'cash', 'casino', 'cat', 'catering', 'cba', 'cbn', 'cc',
-'cd', 'ceb', 'center', 'ceo', 'cern', 'cf', 'cfa', 'cfd', 'cg', 'ch', 'chanel', 'channel', 'chat', 'cheap',
-'chloe', 'christmas', 'chrome', 'church', 'ci', 'cisco', 'citic', 'city', 'ck', 'cl', 'claims', 'cleaning',
-'click', 'clinic', 'clothing', 'cloud', 'club', 'cm', 'cn', 'co', 'coach', 'codes', 'coffee', 'college',
-'cologne', 'com', 'commbank', 'community', 'company', 'computer', 'condos', 'construction', 'consulting',
-'contractors', 'cooking', 'cool', 'coop', 'corsica', 'country', 'coupons', 'courses', 'cr', 'credit',
-'creditcard', 'cricket', 'crown', 'crs', 'cruises', 'csc', 'cu', 'cuisinella', 'cv', 'cw', 'cx', 'cy',
-'cymru', 'cyou', 'cz', 'dabur', 'dad', 'dance', 'date', 'dating', 'datsun', 'day', 'dclk', 'de', 'deals',
-'degree', 'delivery', 'delta', 'democrat', 'dental', 'dentist', 'desi', 'design', 'dev', 'diamonds', 'diet',
-'digital', 'direct', 'directory', 'discount', 'dj', 'dk', 'dm', 'dnp', 'do', 'docs', 'dog', 'doha', 'domains',
-'doosan', 'download', 'drive', 'durban', 'dvag', 'dz', 'earth', 'eat', 'ec', 'edu', 'education', 'ee', 'eg',
-'email', 'emerck', 'energy', 'engineer', 'engineering', 'enterprises', 'epson', 'equipment', 'er', 'erni',
-'es', 'esq', 'estate', 'et', 'eu', 'eurovision', 'eus', 'events', 'everbank', 'exchange', 'expert', 'exposed',
-'express', 'fage', 'fail', 'faith', 'family', 'fan', 'fans', 'farm', 'fashion', 'feedback', 'fi', 'film',
-'finance', 'financial', 'firmdale', 'fish', 'fishing', 'fit', 'fitness', 'fj', 'fk', 'flights', 'florist',
-'flowers', 'flsmidth', 'fly', 'fm', 'fo', 'foo', 'football', 'forex', 'forsale', 'forum', 'foundation', 'fr',
-'frl', 'frogans', 'fund', 'furniture', 'futbol', 'fyi', 'ga', 'gal', 'gallery', 'game', 'garden', 'gb', 'gbiz',
-'gd', 'gdn', 'ge', 'gea', 'gent', 'genting', 'gf', 'gg', 'ggee', 'gh', 'gi', 'gift', 'gifts', 'gives', 'giving',
-'gl', 'glass', 'gle', 'global', 'globo', 'gm', 'gmail', 'gmo', 'gmx', 'gn', 'gold', 'goldpoint', 'golf', 'goo',
-'goog', 'google', 'gop', 'gov', 'gp', 'gq', 'gr', 'graphics', 'gratis', 'green', 'gripe', 'group', 'gs', 'gt',
-'gu', 'guge', 'guide', 'guitars', 'guru', 'gw', 'gy', 'hamburg', 'hangout', 'haus', 'healthcare', 'help', 'here',
-'hermes', 'hiphop', 'hitachi', 'hiv', 'hk', 'hm', 'hn', 'hockey', 'holdings', 'holiday', 'homedepot', 'homes',
-'honda', 'horse', 'host', 'hosting', 'hoteles', 'hotmail', 'house', 'how', 'hr', 'hsbc', 'ht', 'hu', 'ibm',
-'icbc', 'ice', 'icu', 'id', 'ie', 'ifm', 'iinet', 'il', 'im', 'immo', 'immobilien', 'in', 'industries',
-'infiniti', 'info', 'ing', 'ink', 'institute', 'insure', 'int', 'international', 'investments', 'io',
-'ipiranga', 'iq', 'ir', 'irish', 'is', 'ist', 'istanbul', 'it', 'itau', 'iwc', 'java', 'jcb', 'je',
-'jetzt', 'jewelry', 'jlc', 'jll', 'jm', 'jo', 'jobs', 'joburg', 'jp', 'jprs', 'juegos', 'kaufen', 'kddi',
-'ke', 'kg', 'kh', 'ki', 'kim', 'kitchen', 'kiwi', 'km', 'kn', 'koeln', 'komatsu', 'kp', 'kr', 'krd', 'kred',
-'kw', 'ky', 'kyoto', 'kz', 'la', 'lacaixa', 'lancaster', 'land', 'lasalle', 'lat', 'latrobe', 'law', 'lawyer',
-'lb', 'lc', 'lds', 'lease', 'leclerc', 'legal', 'lexus', 'lgbt', 'li', 'liaison', 'lidl', 'life', 'lighting',
-'limited', 'limo', 'linde', 'link', 'live', 'lixil', 'lk', 'loan', 'loans', 'lol', 'london', 'lotte', 'lotto',
-'love', 'lr', 'ls', 'lt', 'ltda', 'lu', 'lupin', 'luxe', 'luxury', 'lv', 'ly', 'ma', 'madrid', 'maif', 'maison',
-'man', 'management', 'mango', 'market', 'marketing', 'markets', 'marriott', 'mba', 'mc', 'md', 'me', 'media',
-'meet', 'melbourne', 'meme', 'memorial', 'men', 'menu', 'mg', 'mh', 'miami', 'microsoft', 'mil', 'mini', 'mk',
-'ml', 'mm', 'mma', 'mn', 'mo', 'mobi', 'moda', 'moe', 'mom', 'monash', 'money', 'montblanc', 'mormon', 'mortgage',
-'moscow', 'motorcycles', 'mov', 'movie', 'movistar', 'mp', 'mq', 'mr', 'ms', 'mt', 'mtn', 'mtpc', 'mu', 'museum',
-'mv', 'mw', 'mx', 'my', 'mz', 'na', 'nadex', 'nagoya', 'name', 'navy', 'nc', 'ne', 'nec', 'net', 'netbank',
-'network', 'neustar', 'new', 'news', 'nexus', 'nf', 'ng', 'ngo', 'nhk', 'ni', 'nico', 'ninja', 'nissan', 'nl',
-'no', 'nokia', 'np', 'nr', 'nra', 'nrw', 'ntt', 'nu', 'nyc', 'nz', 'office', 'okinawa', 'om', 'omega', 'one',
-'ong', 'onl', 'online', 'ooo', 'oracle', 'orange', 'org', 'organic', 'osaka', 'otsuka', 'ovh', 'pa', 'page',
-'panerai', 'paris', 'partners', 'parts', 'party', 'pe', 'pet', 'pf', 'pg', 'ph', 'pharmacy', 'philips', 'photo',
-'photography', 'photos', 'physio', 'piaget', 'pics', 'pictet', 'pictures', 'pink', 'pizza', 'pk', 'pl', 'place',
-'play', 'plumbing', 'plus', 'pm', 'pn', 'pohl', 'poker', 'porn', 'post', 'pr', 'praxi', 'press', 'pro', 'prod',
-'productions', 'prof', 'properties', 'property', 'protection', 'ps', 'pt', 'pub', 'pw', 'py', 'qa', 'qpon',
-'quebec', 'racing', 're', 'realtor', 'realty', 'recipes', 'red', 'redstone', 'rehab', 'reise', 'reisen', 'reit',
-'ren', 'rent', 'rentals', 'repair', 'report', 'republican', 'rest', 'restaurant', 'review', 'reviews', 'rich',
-'ricoh', 'rio', 'rip', 'ro', 'rocks', 'rodeo', 'rs', 'rsvp', 'ru', 'ruhr', 'run', 'rw', 'ryukyu', 'sa', 'saarland',
-'sakura', 'sale', 'samsung', 'sandvik', 'sandvikcoromant', 'sanofi', 'sap', 'sarl', 'saxo', 'sb', 'sc', 'sca',
-'scb', 'schmidt', 'scholarships', 'school', 'schule', 'schwarz', 'science', 'scor', 'scot', 'sd', 'se', 'seat',
-'security', 'seek', 'sener', 'services', 'sew', 'sex', 'sexy', 'sg', 'sh', 'shiksha', 'shoes', 'show', 'shriram',
-'si', 'singles', 'site', 'sj', 'sk', 'ski', 'sky', 'skype', 'sl', 'sm', 'sn', 'sncf', 'so', 'soccer', 'social',
-'software', 'sohu', 'solar', 'solutions', 'sony', 'soy', 'space', 'spiegel', 'spreadbetting', 'sr', 'srl', 'st',
-'stada', 'starhub', 'statoil', 'stc', 'stcgroup', 'studio', 'study', 'style', 'su', 'sucks', 'supplies', 'supply',
-'support', 'surf', 'surgery', 'suzuki', 'sv', 'swatch', 'swiss', 'sx', 'sy', 'sydney', 'systems', 'sz', 'taipei',
-'tatamotors', 'tatar', 'tattoo', 'tax', 'taxi', 'tc', 'td', 'team', 'tech', 'technology', 'tel', 'telefonica',
-'temasek', 'tennis', 'tf', 'tg', 'th', 'thd', 'theater', 'theatre', 'tickets', 'tienda', 'tips', 'tires', 'tirol',
-'tj', 'tk', 'tl', 'tm', 'tn', 'to', 'today', 'tokyo', 'tools', 'top', 'toray', 'toshiba', 'tours', 'town', 'toyota',
-'toys', 'tr', 'trade', 'trading', 'training', 'travel', 'trust', 'tt', 'tui', 'tv', 'tw', 'tz', 'ua', 'ubs', 'ug',
-'uk', 'university', 'uno', 'uol', 'us', 'uy', 'uz', 'va', 'vacations', 'vc', 've', 'vegas', 'ventures',
-'versicherung', 'vet', 'vg', 'vi', 'viajes', 'video', 'villas', 'vin', 'vision', 'vista', 'vistaprint', 'viva',
-'vlaanderen', 'vn', 'vodka', 'vote', 'voting', 'voto', 'voyage', 'vu', 'wales', 'walter', 'wang', 'watch',
-'webcam', 'website', 'wed', 'wedding', 'weir', 'wf', 'whoswho', 'wien', 'wiki', 'williamhill', 'win', 'windows',
-'wine', 'wme', 'work', 'works', 'world', 'ws', 'wtc', 'wtf', 'xbox', 'xerox', 'xin', 'xn--11b4c3d', 'xn--1qqw23a',
-'xn--30rr7y', 'xn--3bst00m', 'xn--3ds443g', 'xn--3e0b707e', 'xn--3pxu8k', 'xn--42c2d9a', 'xn--45brj9c',
-'xn--45q11c', 'xn--4gbrim', 'xn--55qw42g', 'xn--55qx5d', 'xn--6frz82g', 'xn--6qq986b3xl', 'xn--80adxhks',
-'xn--80ao21a', 'xn--80asehdb', 'xn--80aswg', 'xn--90a3ac', 'xn--90ais', 'xn--9dbq2a', 'xn--9et52u',
-'xn--b4w605ferd', 'xn--c1avg', 'xn--c2br7g', 'xn--cg4bki', 'xn--clchc0ea0b2g2a9gcd', 'xn--czr694b',
-'xn--czrs0t', 'xn--czru2d', 'xn--d1acj3b', 'xn--d1alf', 'xn--efvy88h', 'xn--estv75g', 'xn--fhbei',
-'xn--fiq228c5hs', 'xn--fiq64b', 'xn--fiqs8s', 'xn--fiqz9s', 'xn--fjq720a', 'xn--flw351e', 'xn--fpcrj9c3d',
-'xn--fzc2c9e2c', 'xn--gecrj9c', 'xn--h2brj9c', 'xn--hxt814e', 'xn--i1b6b1a6a2e', 'xn--imr513n', 'xn--io0a7i',
-'xn--j1aef', 'xn--j1amh', 'xn--j6w193g', 'xn--kcrx77d1x4a', 'xn--kprw13d', 'xn--kpry57d', 'xn--kput3i',
-'xn--l1acc', 'xn--lgbbat1ad8j', 'xn--mgb9awbf', 'xn--mgba3a4f16a', 'xn--mgbaam7a8h', 'xn--mgbab2bd',
-'xn--mgbayh7gpa', 'xn--mgbbh1a71e', 'xn--mgbc0a9azcg', 'xn--mgberp4a5d4ar', 'xn--mgbpl2fh', 'xn--mgbx4cd0ab',
-'xn--mk1bu44c', 'xn--mxtq1m', 'xn--ngbc5azd', 'xn--node', 'xn--nqv7f', 'xn--nqv7fs00ema', 'xn--nyqy26a',
-'xn--o3cw4h', 'xn--ogbpf8fl', 'xn--p1acf', 'xn--p1ai', 'xn--pgbs0dh', 'xn--pssy2u', 'xn--q9jyb4c',
-'xn--qcka1pmc', 'xn--rhqv96g', 'xn--s9brj9c', 'xn--ses554g', 'xn--t60b56a', 'xn--tckwe', 'xn--unup4y',
-'xn--vermgensberater-ctb', 'xn--vermgensberatung-pwb', 'xn--vhquv', 'xn--vuq861b', 'xn--wgbh1c',
-'xn--wgbl6a', 'xn--xhq521b', 'xn--xkc2al3hye2a', 'xn--xkc2dl3a5ee0h', 'xn--y9a3aq', 'xn--yfro4i67o',
-'xn--ygbi2ammx', 'xn--zfr164b', 'xperia', 'xxx', 'xyz', 'yachts', 'yandex', 'ye', 'yodobashi', 'yoga',
-'yokohama', 'youtube', 'yt', 'za', 'zip', 'zm', 'zone', 'zuerich', 'zw');
+$valid_tlds = array("aaa", "aarp", "abb", "abbott", "abogado", "ac", "academy",
+ "accenture", "accountant", "accountants", "aco", "active", "actor", "ad",
+ "adac", "ads", "adult", "ae", "aeg", "aero", "af", "afl", "ag", "agency",
+ "ai", "aig", "airforce", "airtel", "al", "alibaba", "alipay", "allfinanz",
+ "alsace", "am", "amica", "amsterdam", "analytics", "android", "ao",
+ "apartments", "app", "apple", "aq", "aquarelle", "ar", "aramco", "archi",
+ "army", "arpa", "arte", "as", "asia", "associates", "at", "attorney", "au",
+ "auction", "audi", "audio", "author", "auto", "autos", "aw", "ax", "axa",
+ "az", "azure", "ba", "baidu", "band", "bank", "bar", "barcelona",
+ "barclaycard", "barclays", "bargains", "bauhaus", "bayern", "bb", "bbc",
+ "bbva", "bcn", "bd", "be", "beats", "beer", "bentley", "berlin", "best",
+ "bet", "bf", "bg", "bh", "bharti", "bi", "bible", "bid", "bike", "bing",
+ "bingo", "bio", "biz", "bj", "black", "blackfriday", "bloomberg", "blue",
+ "bm", "bms", "bmw", "bn", "bnl", "bnpparibas", "bo", "boats", "boehringer",
+ "bom", "bond", "boo", "book", "boots", "bosch", "bostik", "bot", "boutique",
+ "br", "bradesco", "bridgestone", "broadway", "broker", "brother", "brussels",
+ "bs", "bt", "budapest", "bugatti", "build", "builders", "business", "buy",
+ "buzz", "bv", "bw", "by", "bz", "bzh", "ca", "cab", "cafe", "cal", "call",
+ "camera", "camp", "cancerresearch", "canon", "capetown", "capital", "car",
+ "caravan", "cards", "care", "career", "careers", "cars", "cartier", "casa",
+ "cash", "casino", "cat", "catering", "cba", "cbn", "cc", "cd", "ceb",
+ "center", "ceo", "cern", "cf", "cfa", "cfd", "cg", "ch", "chanel", "channel",
+ "chat", "cheap", "chloe", "christmas", "chrome", "church", "ci", "cipriani",
+ "circle", "cisco", "citic", "city", "cityeats", "ck", "cl", "claims",
+ "cleaning", "click", "clinic", "clinique", "clothing", "cloud", "club",
+ "clubmed", "cm", "cn", "co", "coach", "codes", "coffee", "college", "cologne",
+ "com", "commbank", "community", "company", "compare", "computer", "comsec",
+ "condos", "construction", "consulting", "contact", "contractors", "cooking",
+ "cool", "coop", "corsica", "country", "coupon", "coupons", "courses", "cr",
+ "credit", "creditcard", "creditunion", "cricket", "crown", "crs", "cruises",
+ "csc", "cu", "cuisinella", "cv", "cw", "cx", "cy", "cymru", "cyou", "cz",
+ "dabur", "dad", "dance", "date", "dating", "datsun", "day", "dclk", "de",
+ "dealer", "deals", "degree", "delivery", "dell", "deloitte", "delta",
+ "democrat", "dental", "dentist", "desi", "design", "dev", "diamonds", "diet",
+ "digital", "direct", "directory", "discount", "dj", "dk", "dm", "dnp", "do",
+ "docs", "dog", "doha", "domains", "download", "drive", "dubai", "durban",
+ "dvag", "dz", "earth", "eat", "ec", "edeka", "edu", "education", "ee", "eg",
+ "email", "emerck", "energy", "engineer", "engineering", "enterprises",
+ "epson", "equipment", "er", "erni", "es", "esq", "estate", "et", "eu",
+ "eurovision", "eus", "events", "everbank", "exchange", "expert", "exposed",
+ "express", "fage", "fail", "fairwinds", "faith", "family", "fan", "fans",
+ "farm", "fashion", "fast", "feedback", "ferrero", "fi", "film", "final",
+ "finance", "financial", "firestone", "firmdale", "fish", "fishing", "fit",
+ "fitness", "fj", "fk", "flickr", "flights", "florist", "flowers", "flsmidth",
+ "fly", "fm", "fo", "foo", "football", "ford", "forex", "forsale", "forum",
+ "foundation", "fox", "fr", "fresenius", "frl", "frogans", "frontier", "fund",
+ "furniture", "futbol", "fyi", "ga", "gal", "gallery", "gallup", "game",
+ "garden", "gb", "gbiz", "gd", "gdn", "ge", "gea", "gent", "genting", "gf",
+ "gg", "ggee", "gh", "gi", "gift", "gifts", "gives", "giving", "gl", "glass",
+ "gle", "global", "globo", "gm", "gmail", "gmo", "gmx", "gn", "gold",
+ "goldpoint", "golf", "goo", "goog", "google", "gop", "got", "gov", "gp", "gq",
+ "gr", "grainger", "graphics", "gratis", "green", "gripe", "group", "gs", "gt",
+ "gu", "gucci", "guge", "guide", "guitars", "guru", "gw", "gy", "hamburg",
+ "hangout", "haus", "hdfcbank", "health", "healthcare", "help", "helsinki",
+ "here", "hermes", "hiphop", "hitachi", "hiv", "hk", "hm", "hn", "hockey",
+ "holdings", "holiday", "homedepot", "homes", "honda", "horse", "host",
+ "hosting", "hoteles", "hotmail", "house", "how", "hr", "hsbc", "ht", "hu",
+ "hyundai", "ibm", "icbc", "ice", "icu", "id", "ie", "ifm", "iinet", "il",
+ "im", "immo", "immobilien", "in", "industries", "infiniti", "info", "ing",
+ "ink", "institute", "insurance", "insure", "int", "international",
+ "investments", "io", "ipiranga", "iq", "ir", "irish", "is", "iselect", "ist",
+ "istanbul", "it", "itau", "iwc", "jaguar", "java", "jcb", "je", "jetzt",
+ "jewelry", "jlc", "jll", "jm", "jmp", "jo", "jobs", "joburg", "jot", "joy",
+ "jp", "jprs", "juegos", "kaufen", "kddi", "ke", "kfh", "kg", "kh", "ki",
+ "kia", "kim", "kinder", "kitchen", "kiwi", "km", "kn", "koeln", "komatsu",
+ "kp", "kpn", "kr", "krd", "kred", "kw", "ky", "kyoto", "kz", "la", "lacaixa",
+ "lamborghini", "lamer", "lancaster", "land", "landrover", "lanxess",
+ "lasalle", "lat", "latrobe", "law", "lawyer", "lb", "lc", "lds", "lease",
+ "leclerc", "legal", "lexus", "lgbt", "li", "liaison", "lidl", "life",
+ "lifeinsurance", "lifestyle", "lighting", "like", "limited", "limo",
+ "lincoln", "linde", "link", "live", "living", "lixil", "lk", "loan", "loans",
+ "lol", "london", "lotte", "lotto", "love", "lr", "ls", "lt", "ltd", "ltda",
+ "lu", "lupin", "luxe", "luxury", "lv", "ly", "ma", "madrid", "maif", "maison",
+ "makeup", "man", "management", "mango", "market", "marketing", "markets",
+ "marriott", "mba", "mc", "md", "me", "med", "media", "meet", "melbourne",
+ "meme", "memorial", "men", "menu", "meo", "mg", "mh", "miami", "microsoft",
+ "mil", "mini", "mk", "ml", "mm", "mma", "mn", "mo", "mobi", "mobily", "moda",
+ "moe", "moi", "mom", "monash", "money", "montblanc", "mormon", "mortgage",
+ "moscow", "motorcycles", "mov", "movie", "movistar", "mp", "mq", "mr", "ms",
+ "mt", "mtn", "mtpc", "mtr", "mu", "museum", "mutuelle", "mv", "mw", "mx",
+ "my", "mz", "na", "nadex", "nagoya", "name", "natura", "navy", "nc", "ne",
+ "nec", "net", "netbank", "network", "neustar", "new", "news", "nexus", "nf",
+ "ng", "ngo", "nhk", "ni", "nico", "nikon", "ninja", "nissan", "nl", "no",
+ "nokia", "norton", "nowruz", "np", "nr", "nra", "nrw", "ntt", "nu", "nyc",
+ "nz", "obi", "office", "okinawa", "om", "omega", "one", "ong", "onl",
+ "online", "ooo", "oracle", "orange", "org", "organic", "origins", "osaka",
+ "otsuka", "ovh", "pa", "page", "pamperedchef", "panerai", "paris", "pars",
+ "partners", "parts", "party", "pe", "pet", "pf", "pg", "ph", "pharmacy",
+ "philips", "photo", "photography", "photos", "physio", "piaget", "pics",
+ "pictet", "pictures", "pid", "pin", "ping", "pink", "pizza", "pk", "pl",
+ "place", "play", "playstation", "plumbing", "plus", "pm", "pn", "pohl",
+ "poker", "porn", "post", "pr", "praxi", "press", "pro", "prod", "productions",
+ "prof", "promo", "properties", "property", "protection", "ps", "pt", "pub",
+ "pw", "pwc", "py", "qa", "qpon", "quebec", "quest", "racing", "re", "read",
+ "realtor", "realty", "recipes", "red", "redstone", "redumbrella", "rehab",
+ "reise", "reisen", "reit", "ren", "rent", "rentals", "repair", "report",
+ "republican", "rest", "restaurant", "review", "reviews", "rexroth", "rich",
+ "ricoh", "rio", "rip", "ro", "rocher", "rocks", "rodeo", "room", "rs", "rsvp",
+ "ru", "ruhr", "run", "rw", "rwe", "ryukyu", "sa", "saarland", "safe",
+ "safety", "sakura", "sale", "salon", "samsung", "sandvik", "sandvikcoromant",
+ "sanofi", "sap", "sapo", "sarl", "sas", "saxo", "sb", "sbs", "sc", "sca",
+ "scb", "schaeffler", "schmidt", "scholarships", "school", "schule", "schwarz",
+ "science", "scor", "scot", "sd", "se", "seat", "security", "seek", "select",
+ "sener", "services", "seven", "sew", "sex", "sexy", "sfr", "sg", "sh",
+ "sharp", "shell", "shia", "shiksha", "shoes", "show", "shriram", "si",
+ "singles", "site", "sj", "sk", "ski", "skin", "sky", "skype", "sl", "sm",
+ "smile", "sn", "sncf", "so", "soccer", "social", "softbank", "software",
+ "sohu", "solar", "solutions", "song", "sony", "soy", "space", "spiegel",
+ "spot", "spreadbetting", "sr", "srl", "st", "stada", "star", "starhub",
+ "statefarm", "statoil", "stc", "stcgroup", "stockholm", "storage", "store",
+ "studio", "study", "style", "su", "sucks", "supplies", "supply", "support",
+ "surf", "surgery", "suzuki", "sv", "swatch", "swiss", "sx", "sy", "sydney",
+ "symantec", "systems", "sz", "tab", "taipei", "taobao", "tatamotors", "tatar",
+ "tattoo", "tax", "taxi", "tc", "tci", "td", "team", "tech", "technology",
+ "tel", "telecity", "telefonica", "temasek", "tennis", "tf", "tg", "th", "thd",
+ "theater", "theatre", "tickets", "tienda", "tiffany", "tips", "tires",
+ "tirol", "tj", "tk", "tl", "tm", "tmall", "tn", "to", "today", "tokyo",
+ "tools", "top", "toray", "toshiba", "tours", "town", "toyota", "toys", "tr",
+ "trade", "trading", "training", "travel", "travelers", "travelersinsurance",
+ "trust", "trv", "tt", "tube", "tui", "tunes", "tushu", "tv", "tvs", "tw",
+ "tz", "ua", "ubs", "ug", "uk", "unicom", "university", "uno", "uol", "us",
+ "uy", "uz", "va", "vacations", "vana", "vc", "ve", "vegas", "ventures",
+ "verisign", "versicherung", "vet", "vg", "vi", "viajes", "video", "viking",
+ "villas", "vin", "vip", "virgin", "vision", "vista", "vistaprint", "viva",
+ "vlaanderen", "vn", "vodka", "volkswagen", "vote", "voting", "voto", "voyage",
+ "vu", "wales", "walter", "wang", "wanggou", "watch", "watches", "weather",
+ "weatherchannel", "webcam", "weber", "website", "wed", "wedding", "weir",
+ "wf", "whoswho", "wien", "wiki", "williamhill", "win", "windows", "wine",
+ "wme", "wolterskluwer", "work", "works", "world", "ws", "wtc", "wtf", "xbox",
+ "xerox", "xin", "xn--11b4c3d", "xn--1ck2e1b", "xn--1qqw23a", "xn--30rr7y",
+ "xn--3bst00m", "xn--3ds443g", "xn--3e0b707e", "xn--3pxu8k", "xn--42c2d9a",
+ "xn--45brj9c", "xn--45q11c", "xn--4gbrim", "xn--55qw42g", "xn--55qx5d",
+ "xn--6frz82g", "xn--6qq986b3xl", "xn--80adxhks", "xn--80ao21a",
+ "xn--80asehdb", "xn--80aswg", "xn--8y0a063a", "xn--90a3ac", "xn--90ais",
+ "xn--9dbq2a", "xn--9et52u", "xn--b4w605ferd", "xn--bck1b9a5dre4c",
+ "xn--c1avg", "xn--c2br7g", "xn--cck2b3b", "xn--cg4bki",
+ "xn--clchc0ea0b2g2a9gcd", "xn--czr694b", "xn--czrs0t", "xn--czru2d",
+ "xn--d1acj3b", "xn--d1alf", "xn--e1a4c", "xn--eckvdtc9d", "xn--efvy88h",
+ "xn--estv75g", "xn--fhbei", "xn--fiq228c5hs", "xn--fiq64b", "xn--fiqs8s",
+ "xn--fiqz9s", "xn--fjq720a", "xn--flw351e", "xn--fpcrj9c3d", "xn--fzc2c9e2c",
+ "xn--g2xx48c", "xn--gckr3f0f", "xn--gecrj9c", "xn--h2brj9c", "xn--hxt814e",
+ "xn--i1b6b1a6a2e", "xn--imr513n", "xn--io0a7i", "xn--j1aef", "xn--j1amh",
+ "xn--j6w193g", "xn--jlq61u9w7b", "xn--jvr189m", "xn--kcrx77d1x4a",
+ "xn--kprw13d", "xn--kpry57d", "xn--kpu716f", "xn--kput3i", "xn--l1acc",
+ "xn--lgbbat1ad8j", "xn--mgb9awbf", "xn--mgba3a3ejt", "xn--mgba3a4f16a",
+ "xn--mgbaam7a8h", "xn--mgbab2bd", "xn--mgbayh7gpa", "xn--mgbb9fbpob",
+ "xn--mgbbh1a71e", "xn--mgbc0a9azcg", "xn--mgberp4a5d4ar", "xn--mgbpl2fh",
+ "xn--mgbt3dhd", "xn--mgbtx2b", "xn--mgbx4cd0ab", "xn--mix891f",
+ "xn--mk1bu44c", "xn--mxtq1m", "xn--ngbc5azd", "xn--ngbe9e0a", "xn--node",
+ "xn--nqv7f", "xn--nqv7fs00ema", "xn--nyqy26a", "xn--o3cw4h", "xn--ogbpf8fl",
+ "xn--p1acf", "xn--p1ai", "xn--pbt977c", "xn--pgbs0dh", "xn--pssy2u",
+ "xn--q9jyb4c", "xn--qcka1pmc", "xn--qxam", "xn--rhqv96g", "xn--rovu88b",
+ "xn--s9brj9c", "xn--ses554g", "xn--t60b56a", "xn--tckwe", "xn--unup4y",
+ "xn--vermgensberater-ctb", "xn--vermgensberatung-pwb", "xn--vhquv",
+ "xn--vuq861b", "xn--wgbh1c", "xn--wgbl6a", "xn--xhq521b", "xn--xkc2al3hye2a",
+ "xn--xkc2dl3a5ee0h", "xn--y9a3aq", "xn--yfro4i67o", "xn--ygbi2ammx",
+ "xn--zfr164b", "xperia", "xxx", "xyz", "yachts", "yahoo", "yamaxun", "yandex",
+ "ye", "yodobashi", "yoga", "yokohama", "youtube", "yt", "za", "zara", "zero",
+ "zip", "zm", "zone", "zuerich", "zw");
// Special TLDs for testing and documentation purposes
// http://tools.ietf.org/html/rfc2606#section-2
From 3e842ba88e0eb384f3e4630c6055538dca927bbe Mon Sep 17 00:00:00 2001
From: Robin Elfrink
Date: Wed, 2 Mar 2016 13:48:20 +0100
Subject: [PATCH 49/61] Log DNSSEC operations.
---
inc/dnssec.inc.php | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/inc/dnssec.inc.php b/inc/dnssec.inc.php
index cc428e8ec..e4d5f51de 100644
--- a/inc/dnssec.inc.php
+++ b/inc/dnssec.inc.php
@@ -144,6 +144,9 @@ function dnssec_secure_zone($domain_name) {
return false;
}
+ log_info(sprintf('client_ip:%s user:%s operation:dnssec_secure_zone zone:%s',
+ $_SERVER['REMOTE_ADDR'], $_SESSION["userlogin"], $domain_name));
+
return true;
}
@@ -162,6 +165,9 @@ function dnssec_unsecure_zone($domain_name) {
return false;
}
+ log_info(sprintf('client_ip:%s user:%s operation:dnssec_unsecure_zone zone:%s',
+ $_SERVER['REMOTE_ADDR'], $_SESSION["userlogin"], $domain_name));
+
return true;
}
@@ -190,6 +196,8 @@ function dnssec_is_zone_secured($domain_name) {
*/
function dnssec_set_nsec3($domain_name) {
dnssec_call_pdnssec('set-nsec3', $domain_name);
+ log_info(sprintf('client_ip:%s user:%s operation:dnssec_set_nsec3 zone:%s',
+ $_SERVER['REMOTE_ADDR'], $_SESSION["userlogin"], $domain_name));
}
/** Switch back to NSEC
@@ -198,6 +206,8 @@ function dnssec_set_nsec3($domain_name) {
*/
function dnssec_unset_nsec3($domain_name) {
dnssec_call_pdnssec('unset-nsec3', $domain_name);
+ log_info(sprintf('client_ip:%s user:%s operation:dnssec_unset_nsec3 zone:%s',
+ $_SERVER['REMOTE_ADDR'], $_SESSION["userlogin"], $domain_name));
}
/** Return nsec type
@@ -219,6 +229,8 @@ function dnssec_get_nsec_type($domain_name) {
*/
function dnssec_set_presigned($domain_name) {
dnssec_call_pdnssec('set-presigned', $domain_name);
+ log_info(sprintf('client_ip:%s user:%s operation:dnssec_set_presigned zone:%s',
+ $_SERVER['REMOTE_ADDR'], $_SESSION["userlogin"], $domain_name));
}
/** No longer use presigned RRSIGs
@@ -227,6 +239,8 @@ function dnssec_set_presigned($domain_name) {
*/
function dnssec_unset_presigned($domain_name) {
dnssec_call_pdnssec('unset-presigned', $domain_name);
+ log_info(sprintf('client_ip:%s user:%s operation:unset-presigned zone:%s',
+ $_SERVER['REMOTE_ADDR'], $_SESSION["userlogin"], $domain_name));
}
/** Return presigned status
@@ -246,6 +260,8 @@ function dnssec_get_presigned_status($domain_name) {
*/
function dnssec_rectify_all_zones() {
dnssec_call_pdnssec('rectify-all-zones', '');
+ log_info(sprintf('client_ip:%s user:%s operation:dnssec_rectify_all_zones',
+ $_SERVER['REMOTE_ADDR'], $_SESSION["userlogin"]));
}
/** Return DS records
@@ -455,6 +471,9 @@ function dnssec_activate_zone_key($domain_name, $key_id) {
return false;
}
+ log_info(sprintf('client_ip:%s user:%s operation:dnssec_activate_zone_key zone:%s key_id:%s',
+ $_SERVER['REMOTE_ADDR'], $_SESSION["userlogin"], $domain_name, $key_id));
+
return true;
}
@@ -473,6 +492,9 @@ function dnssec_deactivate_zone_key($domain_name, $key_id) {
return false;
}
+ log_info(sprintf('client_ip:%s user:%s operation:dnssec_deactivate_zone_key zone:%s key_id:%s',
+ $_SERVER['REMOTE_ADDR'], $_SESSION["userlogin"], $domain_name, $key_id));
+
return true;
}
@@ -522,6 +544,9 @@ function dnssec_add_zone_key($domain_name, $key_type, $bits, $algorithm) {
return false;
}
+ log_info(sprintf('client_ip:%s user:%s operation:dnssec_add_zone_key zone:%s type:%s bits:%s algorithm:%s',
+ $_SERVER['REMOTE_ADDR'], $_SESSION["userlogin"], $domain_name, $key_type, $bits, $algorithm));
+
return true;
}
@@ -541,6 +566,9 @@ function dnssec_remove_zone_key($domain_name, $key_id) {
return false;
}
+ log_info(sprintf('client_ip:%s user:%s operation:dnssec_remove_zone_key zone:%s key_id:%s',
+ $_SERVER['REMOTE_ADDR'], $_SESSION["userlogin"], $domain_name, $key_id));
+
return true;
}
From c58e787501f6e145dda6fc7fad1a75135b748e87 Mon Sep 17 00:00:00 2001
From: Edmondas Girkantas
Date: Sun, 6 Mar 2016 19:59:42 +0200
Subject: [PATCH 50/61] Use single quotes.
---
inc/dnssec.inc.php | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/inc/dnssec.inc.php b/inc/dnssec.inc.php
index e4d5f51de..5a5888105 100644
--- a/inc/dnssec.inc.php
+++ b/inc/dnssec.inc.php
@@ -145,7 +145,7 @@ function dnssec_secure_zone($domain_name) {
}
log_info(sprintf('client_ip:%s user:%s operation:dnssec_secure_zone zone:%s',
- $_SERVER['REMOTE_ADDR'], $_SESSION["userlogin"], $domain_name));
+ $_SERVER['REMOTE_ADDR'], $_SESSION['userlogin'], $domain_name));
return true;
}
@@ -166,7 +166,7 @@ function dnssec_unsecure_zone($domain_name) {
}
log_info(sprintf('client_ip:%s user:%s operation:dnssec_unsecure_zone zone:%s',
- $_SERVER['REMOTE_ADDR'], $_SESSION["userlogin"], $domain_name));
+ $_SERVER['REMOTE_ADDR'], $_SESSION['userlogin'], $domain_name));
return true;
}
@@ -197,7 +197,7 @@ function dnssec_is_zone_secured($domain_name) {
function dnssec_set_nsec3($domain_name) {
dnssec_call_pdnssec('set-nsec3', $domain_name);
log_info(sprintf('client_ip:%s user:%s operation:dnssec_set_nsec3 zone:%s',
- $_SERVER['REMOTE_ADDR'], $_SESSION["userlogin"], $domain_name));
+ $_SERVER['REMOTE_ADDR'], $_SESSION['userlogin'], $domain_name));
}
/** Switch back to NSEC
@@ -207,7 +207,7 @@ function dnssec_set_nsec3($domain_name) {
function dnssec_unset_nsec3($domain_name) {
dnssec_call_pdnssec('unset-nsec3', $domain_name);
log_info(sprintf('client_ip:%s user:%s operation:dnssec_unset_nsec3 zone:%s',
- $_SERVER['REMOTE_ADDR'], $_SESSION["userlogin"], $domain_name));
+ $_SERVER['REMOTE_ADDR'], $_SESSION['userlogin'], $domain_name));
}
/** Return nsec type
@@ -230,7 +230,7 @@ function dnssec_get_nsec_type($domain_name) {
function dnssec_set_presigned($domain_name) {
dnssec_call_pdnssec('set-presigned', $domain_name);
log_info(sprintf('client_ip:%s user:%s operation:dnssec_set_presigned zone:%s',
- $_SERVER['REMOTE_ADDR'], $_SESSION["userlogin"], $domain_name));
+ $_SERVER['REMOTE_ADDR'], $_SESSION['userlogin'], $domain_name));
}
/** No longer use presigned RRSIGs
@@ -240,7 +240,7 @@ function dnssec_set_presigned($domain_name) {
function dnssec_unset_presigned($domain_name) {
dnssec_call_pdnssec('unset-presigned', $domain_name);
log_info(sprintf('client_ip:%s user:%s operation:unset-presigned zone:%s',
- $_SERVER['REMOTE_ADDR'], $_SESSION["userlogin"], $domain_name));
+ $_SERVER['REMOTE_ADDR'], $_SESSION['userlogin'], $domain_name));
}
/** Return presigned status
@@ -261,7 +261,7 @@ function dnssec_get_presigned_status($domain_name) {
function dnssec_rectify_all_zones() {
dnssec_call_pdnssec('rectify-all-zones', '');
log_info(sprintf('client_ip:%s user:%s operation:dnssec_rectify_all_zones',
- $_SERVER['REMOTE_ADDR'], $_SESSION["userlogin"]));
+ $_SERVER['REMOTE_ADDR'], $_SESSION['userlogin']));
}
/** Return DS records
@@ -472,7 +472,7 @@ function dnssec_activate_zone_key($domain_name, $key_id) {
}
log_info(sprintf('client_ip:%s user:%s operation:dnssec_activate_zone_key zone:%s key_id:%s',
- $_SERVER['REMOTE_ADDR'], $_SESSION["userlogin"], $domain_name, $key_id));
+ $_SERVER['REMOTE_ADDR'], $_SESSION['userlogin'], $domain_name, $key_id));
return true;
}
@@ -493,7 +493,7 @@ function dnssec_deactivate_zone_key($domain_name, $key_id) {
}
log_info(sprintf('client_ip:%s user:%s operation:dnssec_deactivate_zone_key zone:%s key_id:%s',
- $_SERVER['REMOTE_ADDR'], $_SESSION["userlogin"], $domain_name, $key_id));
+ $_SERVER['REMOTE_ADDR'], $_SESSION['userlogin'], $domain_name, $key_id));
return true;
}
@@ -545,7 +545,7 @@ function dnssec_add_zone_key($domain_name, $key_type, $bits, $algorithm) {
}
log_info(sprintf('client_ip:%s user:%s operation:dnssec_add_zone_key zone:%s type:%s bits:%s algorithm:%s',
- $_SERVER['REMOTE_ADDR'], $_SESSION["userlogin"], $domain_name, $key_type, $bits, $algorithm));
+ $_SERVER['REMOTE_ADDR'], $_SESSION['userlogin'], $domain_name, $key_type, $bits, $algorithm));
return true;
}
@@ -567,7 +567,7 @@ function dnssec_remove_zone_key($domain_name, $key_id) {
}
log_info(sprintf('client_ip:%s user:%s operation:dnssec_remove_zone_key zone:%s key_id:%s',
- $_SERVER['REMOTE_ADDR'], $_SESSION["userlogin"], $domain_name, $key_id));
+ $_SERVER['REMOTE_ADDR'], $_SESSION['userlogin'], $domain_name, $key_id));
return true;
}
From ed45d620d0788259b04e4f19e592a5959a5ce4a9 Mon Sep 17 00:00:00 2001
From: Edmondas Girkantas
Date: Sun, 6 Mar 2016 20:00:21 +0200
Subject: [PATCH 51/61] Updated php doc for some functions.
---
inc/dnssec.inc.php | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/inc/dnssec.inc.php b/inc/dnssec.inc.php
index 5a5888105..80149803b 100644
--- a/inc/dnssec.inc.php
+++ b/inc/dnssec.inc.php
@@ -459,8 +459,9 @@ function dnssec_get_dnskey_record($domain_name) {
/** Activate zone key
*
* @param string $domain_name Domain Name
+ * @param $key_id
*
- * @return boolean true on success, false on failure
+ * @return bool true on success, false on failure
*/
function dnssec_activate_zone_key($domain_name, $key_id) {
$call_result = dnssec_call_pdnssec('activate-zone-key', join(" ", array($domain_name, $key_id)));
@@ -480,8 +481,9 @@ function dnssec_activate_zone_key($domain_name, $key_id) {
/** Deactivate zone key
*
* @param string $domain_name Domain Name
+ * @param $key_id
*
- * @return boolean true on success, false on failure
+ * @return bool true on success, false on failure
*/
function dnssec_deactivate_zone_key($domain_name, $key_id) {
$call_result = dnssec_call_pdnssec('deactivate-zone-key', join(" ", array($domain_name, $key_id)));
From bfe81d62ffad2b10e47a593d7a6aea175433bbec Mon Sep 17 00:00:00 2001
From: Edmondas Girkantas
Date: Sun, 6 Mar 2016 20:05:34 +0200
Subject: [PATCH 52/61] Updated phpdoc block.
---
inc/dnssec.inc.php | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/inc/dnssec.inc.php b/inc/dnssec.inc.php
index 80149803b..bc777dc8b 100644
--- a/inc/dnssec.inc.php
+++ b/inc/dnssec.inc.php
@@ -52,8 +52,9 @@ function dnssec_is_pdnssec_callable() {
/** Execute dnssec utility
*
- * @param $command Command name
- * @param $args Command arguments
+ * @param string $command Command name
+ * @param string $args Command arguments
+ *
* @return mixed[] Array with output from command execution and error code
*/
function dnssec_call_pdnssec($command, $args) {
From f70c08c9cc7e3b29d9a8121788c14575eb2b7102 Mon Sep 17 00:00:00 2001
From: Edmondas Girkantas
Date: Fri, 11 Mar 2016 12:19:36 +0200
Subject: [PATCH 53/61] Updated phpdoc for password functions.
---
inc/password.inc.php | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/inc/password.inc.php b/inc/password.inc.php
index 67f6ebeb0..1974234b6 100644
--- a/inc/password.inc.php
+++ b/inc/password.inc.php
@@ -36,7 +36,7 @@
*
* @param string $pass password
*
- * @return salted password
+ * @return string salted password
*/
function gen_mix_salt($pass) {
$salt = generate_salt();
@@ -121,7 +121,12 @@ function needs_rehash($hash) {
}
/**
+ * Count the number of bytes in a string
* @see https://github.com/ircmaxell/password_compat
+ *
+ * @param string $binary_string The input string
+ *
+ * @return int The number of bytes
*/
function _strlen($binary_string) {
if (function_exists('mb_strlen')) {
@@ -131,7 +136,13 @@ function _strlen($binary_string) {
}
/**
+ *
* @see https://github.com/ircmaxell/password_compat
+ *
+ * @param string $str1 The first string
+ * @param string $str2 The second string
+ *
+ * @return bool true if they are equal, otherwise - false
*/
function _strsafecmp($str1, $str2) {
if (!is_string($str1) || !is_string($str2) || _strlen($str1) !== _strlen($str1)) {
From 02ea7d8c0a8ba3945e2b1a9937f9a1630bc307dc Mon Sep 17 00:00:00 2001
From: Edmondas Girkantas
Date: Fri, 11 Mar 2016 12:49:28 +0200
Subject: [PATCH 54/61] Let's use bcrypt as hashing algorithm for new
installations.
---
inc/config-me.inc.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/inc/config-me.inc.php b/inc/config-me.inc.php
index c5b9feeee..9e50ca356 100644
--- a/inc/config-me.inc.php
+++ b/inc/config-me.inc.php
@@ -28,8 +28,8 @@
// Security settings
// This should be changed upon install
$session_key = 'p0w3r4dm1n';
-$password_encryption = 'md5'; // md5, md5salt or bcrypt
-//$password_encryption_cost = 12; // needed for bcrypt
+$password_encryption = 'bcrypt'; // md5, md5salt or bcrypt
+$password_encryption_cost = 12; // needed for bcrypt
// Interface settings
$iface_lang = 'en_EN';
From 51c4165f8754273a1eff11ad2d9cf17baa1f2451 Mon Sep 17 00:00:00 2001
From: Edmondas Girkantas
Date: Fri, 11 Mar 2016 13:09:29 +0200
Subject: [PATCH 55/61] Removed unused function.
---
inc/toolkit.inc.php | 14 --------------
1 file changed, 14 deletions(-)
diff --git a/inc/toolkit.inc.php b/inc/toolkit.inc.php
index c34b143bd..666be2218 100644
--- a/inc/toolkit.inc.php
+++ b/inc/toolkit.inc.php
@@ -599,20 +599,6 @@ function clean_page($arg = '') {
}
}
-/** Print active status
- *
- * @param int $res status, 0 for inactive, 1 active
- *
- * @return string html containing status
- */
-function get_status($res) {
- if ($res == '0') {
- return "" . _('Inactive') . "";
- } elseif ($res == '1') {
- return "" . _('Active') . "";
- }
-}
-
/** Validate email address string
*
* @param string $address email address string
From f9d368bce6a26a3638609802d3a8cb74a2b19b4c Mon Sep 17 00:00:00 2001
From: Edmondas Girkantas
Date: Fri, 11 Mar 2016 13:09:49 +0200
Subject: [PATCH 56/61] Minor refactoring, let variable has better naming.
---
install/index.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/install/index.php b/install/index.php
index 92f89cba2..6f1ed51fc 100644
--- a/install/index.php
+++ b/install/index.php
@@ -10,7 +10,7 @@
$language = "en_EN";
}
-# FIXME: setlocale can fail if locale package is not installed ion the systme for that language
+# FIXME: setlocale can fail if locale package is not installed on the system for that language
setlocale(LC_ALL, $language, $language . '.UTF-8');
$gettext_domain = 'messages';
if (!function_exists('bindtextdomain')) {
@@ -180,8 +180,8 @@ function get_random_key() {
if (method_exists($fill_perm_items, 'free')) {
$fill_perm_items->free();
}
- foreach ($def_remaining_queries as $n => $user_query) {
- if ($n === 0) {
+ foreach ($def_remaining_queries as $query_nr => $user_query) {
+ if ($query_nr === 0) {
$user_query = sprintf($user_query, $db->quote(Poweradmin\password\hash($pa_pass), 'text'));
}
$db->query($user_query);
From ae919a67f09c9edb3aa999076ef38a091e37f54e Mon Sep 17 00:00:00 2001
From: Edmondas Girkantas
Date: Fri, 11 Mar 2016 13:13:06 +0200
Subject: [PATCH 57/61] Added new config variables that defines database
charset and collation.
---
inc/config-me.inc.php | 2 ++
1 file changed, 2 insertions(+)
diff --git a/inc/config-me.inc.php b/inc/config-me.inc.php
index 9e50ca356..e84ca4b62 100644
--- a/inc/config-me.inc.php
+++ b/inc/config-me.inc.php
@@ -21,6 +21,8 @@
$db_pass = '';
$db_name = '';
$db_type = '';
+$db_charset = 'latin1'; // or utf8
+$db_collation = 'latin1_swedish_ci'; // or 'utf8_general_ci';
//$db_file = ''; # used only for SQLite, provide full path to database file
//$db_debug = false; # show all SQL queries
//$db_ssl_ca = '';
From 64411b8bdccd5359dd4668245e47733b799e8b76 Mon Sep 17 00:00:00 2001
From: Edmondas Girkantas
Date: Fri, 11 Mar 2016 13:13:33 +0200
Subject: [PATCH 58/61] Do not set charset in sql statements, encoding and
collation will be inherited from database.
---
sql/poweradmin-mysql-db-structure.sql | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/sql/poweradmin-mysql-db-structure.sql b/sql/poweradmin-mysql-db-structure.sql
index a78f7de50..9b57158de 100644
--- a/sql/poweradmin-mysql-db-structure.sql
+++ b/sql/poweradmin-mysql-db-structure.sql
@@ -13,7 +13,7 @@ CREATE TABLE users (
active TINYINT NOT NULL,
use_ldap TINYINT NOT NULL,
PRIMARY KEY (id)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+) ENGINE=InnoDB;
START TRANSACTION;
INSERT INTO users ( id, username, `password`, fullname, email
@@ -27,7 +27,7 @@ CREATE TABLE perm_items (
name VARCHAR(64) NOT NULL,
descr TEXT NOT NULL,
PRIMARY KEY (id)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+) ENGINE=InnoDB;
START TRANSACTION;
INSERT INTO perm_items ( id, name, descr ) VALUES ( 41, 'zone_master_add', 'User is allowed to add new master zones.' );
@@ -58,7 +58,7 @@ CREATE TABLE perm_templ (
name VARCHAR(128) NOT NULL,
descr TEXT NOT NULL,
PRIMARY KEY (id)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+) ENGINE=InnoDB;
START TRANSACTION;
INSERT INTO perm_templ ( id, name, descr )
@@ -71,7 +71,7 @@ CREATE TABLE perm_templ_items (
templ_id INTEGER NOT NULL,
perm_id INTEGER NOT NULL,
PRIMARY KEY (id)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+) ENGINE=InnoDB;
START TRANSACTION;
INSERT INTO perm_templ_items ( id, templ_id, perm_id )
@@ -86,7 +86,7 @@ CREATE TABLE zones (
zone_templ_id INTEGER NOT NULL,
PRIMARY KEY (id),
KEY owner (owner)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+) ENGINE=InnoDB;
CREATE TABLE zone_templ (
id INTEGER NOT NULL AUTO_INCREMENT,
@@ -94,7 +94,7 @@ CREATE TABLE zone_templ (
descr TEXT NOT NULL,
owner INTEGER NOT NULL,
PRIMARY KEY (id)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+) ENGINE=InnoDB;
CREATE TABLE zone_templ_records (
id INTEGER NOT NULL AUTO_INCREMENT,
@@ -105,15 +105,15 @@ CREATE TABLE zone_templ_records (
ttl INTEGER NOT NULL,
prio INTEGER NOT NULL,
PRIMARY KEY (id)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+) ENGINE=InnoDB;
CREATE TABLE records_zone_templ (
domain_id INTEGER NOT NULL,
record_id INTEGER NOT NULL,
zone_templ_id INTEGER NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+) ENGINE=InnoDB;
CREATE TABLE migrations (
version VARCHAR(255) NOT NULL,
apply_time INTEGER NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+) ENGINE=InnoDB;
From bd7f4ea391c973030904c41ce82d24dadae4d203 Mon Sep 17 00:00:00 2001
From: Edmondas Girkantas
Date: Fri, 11 Mar 2016 17:20:17 +0200
Subject: [PATCH 59/61] Changed implementation of setting charset and collation
for database.
---
inc/PDOLayer.php | 8 ++++----
inc/config-me.inc.php | 3 +--
inc/database.inc.php | 5 +++--
install/database-structure.inc.php | 18 ++++++++--------
install/index.php | 33 ++++++++++++++++++++++++++++--
5 files changed, 48 insertions(+), 19 deletions(-)
diff --git a/inc/PDOLayer.php b/inc/PDOLayer.php
index a8a8e02dc..2026cb081 100644
--- a/inc/PDOLayer.php
+++ b/inc/PDOLayer.php
@@ -227,12 +227,12 @@ public function createTable($name, $fields, $options = array()) {
$query .= ' ENGINE=' . $options['type'];
}
- if (isset($options['default_charset'])) {
- $query .= ' DEFAULT CHARSET=' . $options['default_charset'];
+ if (isset($options['charset'])) {
+ $query .= ' DEFAULT CHARSET=' . $options['charset'];
}
- if (isset($options['collate'])) {
- $query .= ' COLLATE=' . $options['collate'];
+ if (isset($options['collation'])) {
+ $query .= ' COLLATE=' . $options['collation'];
}
}
diff --git a/inc/config-me.inc.php b/inc/config-me.inc.php
index e84ca4b62..2692c1e8f 100644
--- a/inc/config-me.inc.php
+++ b/inc/config-me.inc.php
@@ -21,8 +21,7 @@
$db_pass = '';
$db_name = '';
$db_type = '';
-$db_charset = 'latin1'; // or utf8
-$db_collation = 'latin1_swedish_ci'; // or 'utf8_general_ci';
+//$db_charset = 'latin1'; // or utf8
//$db_file = ''; # used only for SQLite, provide full path to database file
//$db_debug = false; # show all SQL queries
//$db_ssl_ca = '';
diff --git a/inc/database.inc.php b/inc/database.inc.php
index 1f629a986..2b15f9552 100644
--- a/inc/database.inc.php
+++ b/inc/database.inc.php
@@ -64,6 +64,7 @@ function dbConnect() {
global $db_host;
global $db_port;
global $db_name;
+ global $db_charset;
global $db_file;
global $db_debug;
global $db_ssl_ca;
@@ -131,14 +132,14 @@ function dbConnect() {
$dsn = "$db_type:host=$db_host;port=$db_port;dbname=$db_name";
}
- if ($db_type === 'mysql') {
+ if ($db_type === 'mysql' && $db_charset === 'utf8') {
$dsn .= ';charset=utf8';
}
$db = new PDOLayer($dsn, $db_user, $db_pass);
// http://stackoverflow.com/a/4361485/567193
- if ($db_type === 'mysql' && version_compare(phpversion(), '5.3.6', '<')) {
+ if ($db_type === 'mysql' && $db_charset === 'utf8' && version_compare(phpversion(), '5.3.6', '<')) {
$db->exec('set names utf8');
}
diff --git a/install/database-structure.inc.php b/install/database-structure.inc.php
index 5cdb9e9db..6f6c9d825 100644
--- a/install/database-structure.inc.php
+++ b/install/database-structure.inc.php
@@ -3,7 +3,7 @@
$def_tables = array(
array(
'table_name' => 'perm_items',
- 'options' => array('type' => 'innodb', 'default_charset' => 'utf8', 'collate' => 'utf8_unicode_ci'),
+ 'options' => array('type' => 'innodb'),
'fields' => array(
'id' => array(
'type' => 'integer',
@@ -38,7 +38,7 @@
),
array(
'table_name' => 'perm_templ',
- 'options' => array('type' => 'innodb', 'default_charset' => 'utf8', 'collate' => 'utf8_unicode_ci'),
+ 'options' => array('type' => 'innodb'),
'fields' => array(
'id' => array(
'type' => 'integer',
@@ -74,7 +74,7 @@
),
array(
'table_name' => 'perm_templ_items',
- 'options' => array('type' => 'innodb', 'default_charset' => 'utf8', 'collate' => 'utf8_unicode_ci'),
+ 'options' => array('type' => 'innodb'),
'fields' => array(
'id' => array(
'notnull' => 1,
@@ -110,7 +110,7 @@
),
array(
'table_name' => 'users',
- 'options' => array('type' => 'innodb', 'default_charset' => 'utf8', 'collate' => 'utf8_unicode_ci'),
+ 'options' => array('type' => 'innodb'),
'fields' => array(
'id' => array
(
@@ -215,7 +215,7 @@
),
array(
'table_name' => 'zones',
- 'options' => array('type' => 'innodb', 'default_charset' => 'utf8', 'collate' => 'utf8_unicode_ci'),
+ 'options' => array('type' => 'innodb'),
'fields' => array(
'id' => array
(
@@ -276,7 +276,7 @@
),
array(
'table_name' => 'zone_templ',
- 'options' => array('type' => 'innodb', 'default_charset' => 'utf8', 'collate' => 'utf8_unicode_ci'),
+ 'options' => array('type' => 'innodb'),
'fields' => array(
'id' => array
(
@@ -327,7 +327,7 @@
),
array(
'table_name' => 'zone_templ_records',
- 'options' => array('type' => 'innodb', 'default_charset' => 'utf8', 'collate' => 'utf8_unicode_ci'),
+ 'options' => array('type' => 'innodb'),
'fields' => array(
'id' => array
(
@@ -411,7 +411,7 @@
),
array(
'table_name' => 'records_zone_templ',
- 'options' => array('type' => 'innodb', 'default_charset' => 'utf8', 'collate' => 'utf8_unicode_ci'),
+ 'options' => array('type' => 'innodb'),
'fields' => array(
'domain_id' => array
(
@@ -450,7 +450,7 @@
),
array(
'table_name' => 'migrations',
- 'options' => array('type' => 'innodb', 'default_charset' => 'utf8', 'collate' => 'utf8_unicode_ci'),
+ 'options' => array('type' => 'innodb'),
'fields' => array(
'domain_id' => array
(
diff --git a/install/index.php b/install/index.php
index 6f1ed51fc..e24fbc2e3 100644
--- a/install/index.php
+++ b/install/index.php
@@ -138,6 +138,16 @@ function get_random_key() {
. "" . _('The path and filename to the PowerDNS SQLite database.') . " | \n";
echo "
\n";
echo "