diff --git a/lib/DB/patches/0118~release_naming_regexes.sql b/lib/DB/patches/0118~release_naming_regexes.sql new file mode 100644 index 000000000..7bfea98b4 --- /dev/null +++ b/lib/DB/patches/0118~release_naming_regexes.sql @@ -0,0 +1,71 @@ +DROP TABLE IF EXISTS release_naming_regexes; +CREATE TABLE release_naming_regexes ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT, + group_regex VARCHAR(255) NULL COMMENT 'This is a regex to match against usenet groups', + regex VARCHAR(5000) NOT NULL COMMENT 'Regex used for extracting name from subject', + status TINYINT(1) UNSIGNED NOT NULL DEFAULT '1' COMMENT '1=ON 0=OFF', + description VARCHAR(1000) NOT NULL COMMENT 'Optional extra details on this regex', + ordinal INT SIGNED NOT NULL DEFAULT '0' COMMENT 'Order to run the regex in', + PRIMARY KEY (id), + INDEX ix_release_naming_regexes_group_regex (group_regex), + INDEX ix_release_naming_regexes_status (status), + INDEX ix_release_naming_regexes_ordinal (ordinal) +) + ENGINE = MYISAM + DEFAULT CHARSET = utf8 + COLLATE = utf8_unicode_ci + AUTO_INCREMENT = 100000; + +INSERT INTO release_naming_regexes (id, group_regex, regex, status, description, ordinal) + VALUES ( + 1, + 'alt\\.binaries\\.teevee', + '/\\[\\d+\\]-\\[.+?\\]-\\[.+?\\]-\\[ (.+\\.S\\d\\dE\\d\\d\\..+?) \\][- ]\\[\d+\\/\\d+\\][ -]{0,3}"[\\w\\säöüÄÖÜß+¤ƒ¶!.,&_()\\[\\]\\\'\\`{}-]{8,}?\\b.?([-_](proof|sample|thumbs?))*(\\.part\\d*(\\.rar)?|\\.rar|\\.7z)?(\\d{1,3}\\.rev"|\\.vol.+?"|\\.[A-Za-z0-9]{2,4}"|")[-_\\s]{0,3}\d+([.,]\\d+)? [kKmMgG][bB][-_\\s]{0,3}[-_\\s]{0,3}yEnc$/ui', + 1, + 'rename these teevee releases as the requestid is for the full season ::: [169018]-[FULL]-[a.b.teevee]-[ House.of.Lies.S01E01.720p.WEB-DL.DD5.1.H.264-BS ]-[04/32] - "House.of.Lies.S01E01.The.Gods.of.Dangerous.Financial.Instruments.720p.WEB-DL.DD5.1.H.264-BS.part03.rar" yEnc', + 5 +), ( + 2, + 'alt\\.binaries\\.teevee', + '/\\[\\d+\\]-\\[.+?\\]-\\[.+?\\]-\\[ .+\\.S\\d\\d\\..+? \\][- ]\\[\\d+\\/\\d+\\][ -]{0,3}"([\\w\\säöüÄÖÜß+¤ƒ¶!.,&_()\[\]\\\'\\`{}#-]{8,}?\\b.?)([-_](proof|sample|thumbs?))*(\\.part\\d*(\\.rar)?|\\.rar|\\.7z)?(\\d{1,3}\\.rev"|\\.vol.+?"|\\.[A-Za-z0-9]{2,4}"|")[-_\\s]{0,3}\d+([.,]\\d+)? [kKmMgG][bB][-_\\s]{0,3}[-_\\s]{0,3}yEnc$/ui', + 1, + 'Season only in 4th block so take filename ::: [169019]-[FULL]-[a.b.teevee]-[ House.of.Lies.S02.720p.WEB-DL.DD5.1.H.264-BS ]-[24/32] - "House.of.Lies.S02E02.When.Dinosaurs.Ruled.the.Planet.720p.WEB-DL.DD5.1.H.264-BS.vol000+01.par2" yEnc', + 10 +), ( + 3, + 'alt\\.binaries\\.teevee', + '/^\\[#+\\]-\\[.+?\\]-\\[.+?\\]-\\[ (?P.+?) \\][- ]\\[\\d+\\/\\d+\\][-_\\s]{0,3}("|#34;).+?("|#34;) yEnc$/', + 1, + '[######]-[FULL]-[#a.b.teevee@EFNet]-[ Misfits.S01.SUBPACK.DVDRip.XviD-P0W4DVD ] [1/5] - "Misfits.S01.SUBPACK.DVDRip.XviD-P0W4DVD.nfo" yEnc', + 15 +), ( + 4, + 'alt\\.binaries\\.teevee', + '/^\\[#+\\]-\\[.+?\\]-\\[.+?\\]-\\[(?P.+?)\\][- ]\\[\\d+\\/\\d+\\][-_\\s]{0,3}".+?" yEnc$/', + 1, + '[34148]-[FULL]-[#a.b.teevee@EFNet]-[Batman.The.Animated.Series.S04E01.DVDRiP.XviD-PyRo]-[00/35] "Batman.The.Animated.Series.S04E01.DVDRiP.XviD-PyRo.nzb" yEnc', + 20 +), ( + 5, + 'alt\\.binaries\\.teevee', + '/^\\[#+\\]-\\[.+?\\]-\\[ (?P.+?) \\][- ]\\[\\d+\\/\\d+\\][-_\\s]{0,3}".+?" yEnc$/', + 1, + '[38722]-[#a.b.foreign@EFNet]-[ Game.Of.Thrones.S01E01.Der.Winter.Naht.GERMAN.DL.WS.1080p.HDTV.x264-MiSFiTS ]-[01/37] - "misfits-gameofthrones1080-s01e01-sample-sample.par2" yEnc', + 25 +), ( + 6, + 'alt\\.binaries\\.teevee', + '/^\\[#+\\]-\\[.+?\\]-\\[.+?\\]-\\[ (?P.+?) \\][- ]\\[\\d+\\/\\d+\\][-_\\s]{0,3}("|#34;).+?("|#34;) yEnc$/', + 1, + '[#a.b.teevee] Parks.and.Recreation.S01E01.720p.WEB-DL.DD5.1.H.264-CtrlHD - [01/24] - "Parks.and.Recreation.S01E01.720p.WEB-DL.DD5.1.H.264-CtrlHD.nfo" yEnc', + 30 +), ( + 7, + 'alt\\.binaries\\.teevee', + '/\\[#+\\]-\\[.+?\\]-\\[.+?\\]-\\[ ?(?P.+?) ?\\][- ]\\[\\d+\\/\\d+\\][-_\\s]{0,3}("|#34;).+?("|#34;) \\(\\d+\\/\\d+\\) \\(\\d+\\/\\d+$/', + 1, + '[17319]-[FULL]-[#a.b.teevee@EFNet]-[ CSI.New.York.S05E22.720p.HDTV.X264-DIMENSION ]-[01/34] "csi.new.york.522.720p-dimension.nfo" (1/1) (1/1', + 35 +); + +UPDATE `tmux` set `value` = '118' where `setting` = 'sqlpatch'; \ No newline at end of file diff --git a/lib/Sharing.php b/lib/Sharing.php index 1334b8e9b..118b7768c 100644 --- a/lib/Sharing.php +++ b/lib/Sharing.php @@ -70,19 +70,22 @@ Class Sharing /** * Construct. * - * @param DB $db - * @param NNTP $nntp + * @param array $options Class instances. + * + * @access public */ - public function __construct(&$db = null, &$nntp = null) + public function __construct(array $options = []) { - if (!is_null($db)) { - $this->db = $db; - } else { - $this->db = new DB(); - } + $defaults= [ + 'Settings' => null, + 'NNTP' => null, + ]; + $options += $defaults; + + $this->pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB()); // Get all sharing info from DB. - $check = $this->db->queryOneRow('SELECT * FROM sharing'); + $check = $this->pdo->queryOneRow('SELECT * FROM sharing'); // Initiate sharing settings if this is the first time.. if (empty($check)) { @@ -94,7 +97,7 @@ Class Sharing return; } - $this->nntp = $nntp; + $this->nntp = ($options['NNTP'] instanceof \NNTP ? $options['NNTP'] : new \NNTP(['Settings' => $this->pdo])); // Cache sharing settings. $this->siteSettings = $check; diff --git a/lib/copy_this/www/admin/ajax.php b/lib/copy_this/www/admin/ajax.php new file mode 100644 index 000000000..02cfd0b82 --- /dev/null +++ b/lib/copy_this/www/admin/ajax.php @@ -0,0 +1,142 @@ + $admin->settings]; +switch($_GET['action']) { + case 'binary_blacklist_delete': + $id = (int) $_GET['row_id']; + (new Binaries($settings))->deleteBlacklist($id); + print "Blacklist $id deleted."; + break; + + case 'collection_regex_delete': + $id = (int) $_GET['row_id']; + (new Regexes(['Settings' => $admin->settings, 'Table_Name' => 'collection_regexes']))->deleteRegex($id); + print "Regex $id deleted."; + break; + + case 'release_naming_regex_delete': + $id = (int) $_GET['row_id']; + (new Regexes(['Settings' => $admin->settings, 'Table_Name' => 'release_naming_regexes']))->deleteRegex($id); + print "Regex $id deleted."; + break; + + case 'group_edit_purge_all': + session_write_close(); + (new Groups($settings))->purge(); + print "All groups purged."; + break; + + case 'group_edit_reset_all': + (new Groups($settings))->resetall(); + print "All groups reset."; + break; + + case 'group_edit_purge_single': + $id = (int)$_GET['group_id']; + session_write_close(); + (new Groups($settings))->purge($id); + print "Group $id purged."; + break; + + case 'group_edit_reset_single': + $id = (int)$_GET['group_id']; + session_write_close(); + (new Groups($settings))->reset($id); + print "Group $id reset."; + break; + + case 'group_edit_delete_single': + $id = (int)$_GET['group_id']; + session_write_close(); + (new Groups($settings))->delete($id); + print "Group $id deleted."; + break; + + case 'toggle_group_active_status': + print (new Groups($settings))->updateGroupStatus((int)$_GET['group_id'], (isset($_GET['group_status']) ? (int)$_GET['group_status'] : 0)); + break; + + case 'toggle_group_backfill_status': + print (new Groups($settings))->updateBackfillStatus((int)$_GET['group_id'], (isset($_GET['backfill_status']) ? (int)$_GET['backfill_status'] : 0)); + break; + + case 'sharing_toggle_status': + $admin->settings->queryExec(sprintf('UPDATE sharing_sites SET enabled = %d WHERE id = %d', $_GET['site_status'], $_GET['site_id'])); + print ($_GET['site_status'] == 1 ? 'Activated' : 'Deactivated') . ' site ' . $_GET['site_id']; + break; + + case 'sharing_toggle_enabled': + $admin->settings->queryExec(sprintf('UPDATE sharing SET enabled = %d', $_GET['enabled_status'])); + print ($_GET['enabled_status'] == 1 ? 'Enabled' : 'Disabled') . ' sharing!'; + break; + + case 'sharing_start_position': + $admin->settings->queryExec(sprintf('UPDATE sharing SET start_position = %d', $_GET['start_position'])); + print ($_GET['start_position'] == 1 ? 'Enabled' : 'Disabled') . ' fetching from start of group!'; + break; + + case 'sharing_reset_settings': + $guid = $admin->settings->queryOneRow('SELECT site_guid FROM sharing'); + $guid = ($guid === false ? '' : $guid['site_guid']); + (new Sharing(['Settings' => $admin->settings]))->initSettings($guid); + print 'Re-initiated sharing settings!'; + break; + + case 'sharing_purge_site': + $guid = $admin->settings->queryOneRow(sprintf('SELECT site_guid FROM sharing_sites WHERE id = %d', $_GET['purge_site'])); + if ($guid === false) { + print 'Error purging site ' . $_GET['purge_site'] . '!'; + } else { + $ids = $admin->settings->query(sprintf('SELECT id FROM releasecomments WHERE siteid = %s', $admin->settings->escapeString($guid['site_guid']))); + $total = count($ids); + if ($total > 0) { + $rc = new ReleaseComments($admin->settings); + foreach ($ids as $id) { + $rc->deleteComment($id['id']); + } + } + $admin->settings->queryExec(sprintf('UPDATE sharing_sites SET comments = 0 WHERE id = %d', $_GET['purge_site'])); + print 'Deleted ' . $total . ' comments for site ' . $_GET['purge_site']; + } + break; + + case 'sharing_toggle_posting': + $admin->settings->queryExec(sprintf('UPDATE sharing SET posting = %d', $_GET['posting_status'])); + print ($_GET['posting_status'] == 1 ? 'Enabled' : 'Disabled') . ' posting!'; + break; + + case 'sharing_toggle_fetching': + $admin->settings->queryExec(sprintf('UPDATE sharing SET fetching = %d', $_GET['fetching_status'])); + print ($_GET['fetching_status'] == 1 ? 'Enabled' : 'Disabled') . ' fetching!'; + break; + + case 'sharing_toggle_site_auto_enabling'; + $admin->settings->queryExec(sprintf('UPDATE sharing SET auto_enable = %d', $_GET['auto_status'])); + print ($_GET['auto_status'] == 1 ? 'Enabled' : 'Disabled') . ' automatic site enabling!'; + break; + + case 'sharing_toggle_hide_users': + $admin->settings->queryExec(sprintf('UPDATE sharing SET hide_users = %d', $_GET['hide_status'])); + print ($_GET['hide_status'] == 1? 'Enabled' : 'Disabled') . ' hiding of user names!'; + break; + + case 'sharing_toggle_all_sites': + $admin->settings->queryExec(sprintf('UPDATE sharing_sites SET enabled = %d', $_GET['toggle_all'])); + break; +} \ No newline at end of file diff --git a/lib/copy_this/www/admin/collection_regexes-edit.php b/lib/copy_this/www/admin/collection_regexes-edit.php index 56e067b8d..57792b7a5 100644 --- a/lib/copy_this/www/admin/collection_regexes-edit.php +++ b/lib/copy_this/www/admin/collection_regexes-edit.php @@ -1,11 +1,8 @@ $page->settings]); +$regexes = new Regexes(['Settings' => $page->settings, 'Table_Name' => 'collection_regexes']); // Set the current action. $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'view'; @@ -32,9 +29,9 @@ switch($action) { } if ($_POST["id"] == "") { - $cc->addRegex($_POST); + $regexes->addRegex($_POST); } else { - $cc->updateRegex($_POST); + $regexes->updateRegex($_POST); } header("Location:".WWW_TOP."/collection_regexes-list.php"); @@ -45,7 +42,7 @@ switch($action) { if (isset($_GET["id"])) { $page->title = "Collections Regex Edit"; $id = $_GET["id"]; - $r = $cc->getRegexByID($id); + $r = $regexes->getRegexByID($id); } else { $page->title = "Collections Regex Add"; $r = ['status' => 1]; diff --git a/lib/copy_this/www/admin/collection_regexes-list.php b/lib/copy_this/www/admin/collection_regexes-list.php index 97a51cac7..992c315bd 100644 --- a/lib/copy_this/www/admin/collection_regexes-list.php +++ b/lib/copy_this/www/admin/collection_regexes-list.php @@ -1,10 +1,8 @@ $page->settings]); +$regexes = new Regexes(['Settings' => $page->settings, 'Table_Name' => 'collection_regexes']); $page->title = "Collections Regex List"; @@ -14,10 +12,10 @@ if (isset($_REQUEST['group']) && !empty($_REQUEST['group'])) { } $offset = isset($_REQUEST["offset"]) ? $_REQUEST["offset"] : 0; -$regex = $cc->getRegex($group, ITEMS_PER_PAGE, $offset); +$regex = $regexes->getRegex($group, ITEMS_PER_PAGE, $offset); $page->smarty->assign('regex', $regex); -$count = $cc->getCount($group); +$count = $regexes->getCount($group); $page->smarty->assign('pagertotalitems', $count); $page->smarty->assign('pageroffset', $offset); $page->smarty->assign('pageritemsperpage', ITEMS_PER_PAGE); diff --git a/lib/copy_this/www/admin/collection_regexes-test.php b/lib/copy_this/www/admin/collection_regexes-test.php index febb2c587..d663dd4ab 100644 --- a/lib/copy_this/www/admin/collection_regexes-test.php +++ b/lib/copy_this/www/admin/collection_regexes-test.php @@ -1,16 +1,11 @@ get(); $page->title = "Collections Regex Test"; -$tpg = $page->site->tablepergroup; +$tpg = $page->settings->getSetting('tablepergroup'); $page->smarty->assign('tpg', $tpg); if ($tpg) { @@ -21,7 +16,7 @@ if ($tpg) { $page->smarty->assign(['group' => $group, 'regex' => $regex, 'limit' => $limit]); if ($group && $regex) { - $page->smarty->assign('data', (new CollectionsCleaning(['Settings' => $page->settings]))->testRegex($group, $regex, $limit)); + $page->smarty->assign('data', (new Regexes(['Settings' => $page->settings, 'Table_Name' => 'collection_regexes']))->testCollectionRegex($group, $regex, $limit)); } } diff --git a/lib/copy_this/www/admin/release_naming_regexes-edit.php b/lib/copy_this/www/admin/release_naming_regexes-edit.php new file mode 100644 index 000000000..a61dc8fde --- /dev/null +++ b/lib/copy_this/www/admin/release_naming_regexes-edit.php @@ -0,0 +1,58 @@ + $page->settings, 'Table_Name' => 'release_naming_regexes']); + +// Set the current action. +$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'view'; + +switch($action) { + case 'submit': + if ($_POST["group_regex"] == "") { + $page->smarty->assign('error', "Group regex must not be empty!"); + break; + } + + if ($_POST["regex"] == "") { + $page->smarty->assign('error', "Regex cannot be empty"); + break; + } + + if ($_POST['description'] == '') { + $_POST['description'] = ''; + } + + if (!is_numeric($_POST['ordinal']) || $_POST['ordinal'] < 0) { + $page->smarty->assign('error', "Ordinal must be a number, 0 or higher."); + break; + } + + if ($_POST["id"] == "") { + $regexes->addRegex($_POST); + } else { + $regexes->updateRegex($_POST); + } + + header("Location:".WWW_TOP."/release_naming_regexes-list.php"); + break; + + case 'view': + default: + if (isset($_GET["id"])) { + $page->title = "Release Naming Regex Edit"; + $id = $_GET["id"]; + $r = $regexes->getRegexByID($id); + } else { + $page->title = "Release Naming Regex Add"; + $r = ['status' => 1]; + } + $page->smarty->assign('regex', $r); + break; +} + +$page->smarty->assign('status_ids', array(Category::STATUS_ACTIVE,Category::STATUS_INACTIVE)); +$page->smarty->assign('status_names', array( 'Yes', 'No')); + +$page->content = $page->smarty->fetch('release_naming_regexes-edit.tpl'); +$page->render(); \ No newline at end of file diff --git a/lib/copy_this/www/admin/release_naming_regexes-list.php b/lib/copy_this/www/admin/release_naming_regexes-list.php new file mode 100644 index 000000000..be1dda3ed --- /dev/null +++ b/lib/copy_this/www/admin/release_naming_regexes-list.php @@ -0,0 +1,27 @@ + $page->settings, 'Table_Name' => 'release_naming_regexes']); + +$page->title = "Release Naming Regex List"; + +$group = ''; +if (isset($_REQUEST['group']) && !empty($_REQUEST['group'])) { + $group = $_REQUEST['group']; +} + +$offset = isset($_REQUEST["offset"]) ? $_REQUEST["offset"] : 0; +$regex = $regexes->getRegex($group, ITEMS_PER_PAGE, $offset); +$page->smarty->assign('regex', $regex); + +$count = $regexes->getCount($group); +$page->smarty->assign('pagertotalitems', $count); +$page->smarty->assign('pageroffset', $offset); +$page->smarty->assign('pageritemsperpage', ITEMS_PER_PAGE); + +$page->smarty->assign('pagerquerybase', WWW_TOP . "/release_naming_regexes-list.php?" . $group . "offset="); +$page->smarty->assign('pager', $page->smarty->fetch("pager.tpl")); + +$page->content = $page->smarty->fetch('release_naming_regexes-list.tpl'); +$page->render(); \ No newline at end of file diff --git a/lib/copy_this/www/admin/release_naming_regexes-test.php b/lib/copy_this/www/admin/release_naming_regexes-test.php new file mode 100644 index 000000000..fc0325bdc --- /dev/null +++ b/lib/copy_this/www/admin/release_naming_regexes-test.php @@ -0,0 +1,20 @@ +title = "Release Naming Regex Test"; + +$group = trim(isset($_POST['group']) && !empty($_POST['group']) ? $_POST['group'] : ''); +$regex = trim(isset($_POST['regex']) && !empty($_POST['regex']) ? $_POST['regex'] : ''); +$showLimit = (isset($_POST['showlimit']) && is_numeric($_POST['showlimit']) ? $_POST['showlimit'] : 250); +$queryLimit = (isset($_POST['querylimit']) && is_numeric($_POST['querylimit']) ? $_POST['querylimit'] : 100000); +$page->smarty->assign(['group' => $group, 'regex' => $regex, 'showlimit' => $showLimit, 'querylimit' => $queryLimit]); + +if ($group && $regex) { + $page->smarty->assign('data', (new Regexes(['Settings' => $page->settings, 'Table_Name' => 'release_naming_regexes']))->testReleaseNamingRegex($group, $regex, $showLimit, $queryLimit)); +} + + +$page->content = $page->smarty->fetch('release_naming_regexes-test.tpl'); +$page->render(); \ No newline at end of file diff --git a/lib/copy_this/www/lib/CollectionsCleaning.php b/lib/copy_this/www/lib/CollectionsCleaning.php index 642e0290d..f40c87970 100644 --- a/lib/copy_this/www/lib/CollectionsCleaning.php +++ b/lib/copy_this/www/lib/CollectionsCleaning.php @@ -1,4 +1,5 @@ pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB()); - } - - /** - * Add a new regex. - * - * @param array $data - * - * @return bool - */ - public function addRegex(array $data) - { - return (bool)$this->pdo->queryInsert( - sprintf( - 'INSERT INTO collection_regexes (group_regex, regex, status, description, ordinal) VALUES (%s, %s, %d, %s, %d)', - trim($this->pdo->escapeString($data['group_regex'])), - trim($this->pdo->escapeString($data['regex'])), - $data['status'], - trim($this->pdo->escapeString($data['description'])), - $data['ordinal'] - ) - ); - } - - /** - * Update a regex with new info. - * - * @param array $data - * - * @return bool - */ - public function updateRegex(array $data) - { - return (bool)$this->pdo->queryExec( - sprintf( - 'UPDATE collection_regexes - SET group_regex = %s, regex = %s, status = %d, description = %s, ordinal = %d - WHERE id = %d', - trim($this->pdo->escapeString($data['group_regex'])), - trim($this->pdo->escapeString($data['regex'])), - $data['status'], - trim($this->pdo->escapeString($data['description'])), - $data['ordinal'], - $data['id'] - ) - ); - } - - /** - * Get a single regex using its id. - * - * @param int $id - * - * @return array - */ - public function getRegexByID($id) - { - return $this->pdo->queryOneRow(sprintf('SELECT * FROM collection_regexes WHERE id = %d', $id)); - } - - /** - * Get all regex. - * - * @param string $group_regex Optional, a keyword to find a group. - * @param int $limit Optional, amount of results to limit. - * @param int $offset Optional, the offset to use when limiting the result set. - * - * @return array - */ - public function getRegex($group_regex = '', $limit = 0, $offset = 0) - { - return $this->pdo->query( - sprintf( - 'SELECT * FROM collection_regexes %s %s', - ($group_regex ? ('WHERE group_regex ' . $this->pdo->likeString($group_regex)) : ''), - ($limit ? ('LIMIT ' . $limit . ' OFFSET ' . $offset) : '') - ) - ); - } - - /** - * Get the count of regex in the DB. - * - * @param string $group_regex Optional, keyword to find a group. - * - * @return int - */ - public function getCount($group_regex = '') - { - $query = $this->pdo->queryOneRow( - sprintf( - 'SELECT COUNT(id) AS count FROM collection_regexes %s', - ($group_regex ? ('WHERE group_regex ' . $this->pdo->likeString($group_regex)) : '') - ) - ); - return (int)$query['count']; - } - - /** - * Delete a regex using its id. - * - * @param int $id - */ - public function deleteRegex($id) - { - $this->pdo->queryExec('DELETE FROM collection_regexes WHERE id = ' . $id); - } - - /** - * Test a regex for a group name. - * - * Requires table per group to be on. - * - * @param string $groupName - * @param string $regex - * @param int $limit - * - * @return array - */ - public function testRegex($groupName, $regex, $limit) - { - $groups = new Groups(['Settings' => $this->pdo]); - $groupID = $groups->getIDByName($groupName); - - if (!$groupID) { - return []; - } - - $tableNames = $groups->getCBPTableNames(true, $groupID); - - $rows = $this->pdo->query( - sprintf( - 'SELECT - b.name, b.totalparts, b.currentparts, b.binaryhash, - c.fromname, c.collectionhash - FROM %s b - INNER JOIN %s c ON c.id = b.collection_id', - $tableNames['bname'], $tableNames['cname'] - ) - ); - - $data = []; - if ($rows) { - $limit--; - $hashes = []; - foreach ($rows as $row) { - if (preg_match($regex, $row['name'], $matches)) { - ksort($matches); - $string = $string2 = ''; - foreach ($matches as $key => $match) { - if (!is_int($key)) { - $string .= $match; - $string2 .= '
' . $key . ': ' . $match; - } - } - $files = 0; - if (preg_match('/[[(\s](\d{1,5})(\/|[\s_]of[\s_]|-)(\d{1,5})[])\s$:]/i', $row['name'], $fileCount)) { - $files = $fileCount[3]; - } - $newCollectionHash = sha1($string . $row['fromname'] . $groupID . $files); - $data['New hash: ' . $newCollectionHash . $string2][$row['binaryhash']] = [ - 'file_name' => $row['name'], - 'file_total_parts' => $row['totalparts'], - 'file_current_parts' => $row['currentparts'], - 'collection_poster' => $row['fromname'], - 'old_collection_hash' => $row['collectionhash'], - ]; - - if ($limit > 0) { - if (count($hashes) > $limit) { - break; - } - $hashes[$newCollectionHash] = ''; - } - } - } - } - return $data; + $this->_regexes = new Regexes(['Settings' => $this->pdo, 'Table_Name' => 'collection_regexes']); } /** @@ -273,7 +98,7 @@ class CollectionsCleaning $this->groupName = $groupName; // Try DB regex first. - $potentialString = $this->_processDBRegex(); + $potentialString = $this->_regexes->tryRegex($subject, $groupName); if ($potentialString) { return $potentialString; } @@ -472,81 +297,6 @@ class CollectionsCleaning } } - /** - * Get the regex from the DB, cache them locally for 15 mins. - * Cache them also in the cache server, as this script might be terminated. - */ - protected function _fetchRegex() - { - // Check if we need to do an initial cache or refresh our cache. - if (isset($this->_regexCache[$this->groupName]['ttl']) && (time() - $this->_regexCache[$this->groupName]['ttl']) < 900) { - return; - } - - // Get all regex from DB which match the current group name. Cache them for 15 minutes. #CACHEDQUERY# - $this->_regexCache[$this->groupName]['regex'] = $this->pdo->query( - sprintf( - 'SELECT c.regex FROM collection_regexes c WHERE %s REGEXP c.group_regex AND c.status = 1 ORDER BY c.ordinal ASC, c.group_regex ASC', - $this->pdo->escapeString($this->groupName) - ), true, 900 - ); - // Set the TTL. - $this->_regexCache[$this->groupName]['ttl'] = time(); - } - - /** - * This will process the regex stored in the DB before trying hardcoded regex below. - * - * @return string - */ - protected function _processDBRegex() - { - $this->_fetchRegex(); - - $returnString = ''; - // If there are no regex, return and try regex in this file. - if ($this->_regexCache[$this->groupName]['regex']) { - foreach ($this->_regexCache[$this->groupName]['regex'] as $regex) { - - $returnString = $this->_matchDBRegex($regex['regex']); - // If this regex found something, break and return, or else continue trying other regex. - if ($returnString) { - break; - } - } - } - return $returnString; - } - - /** - * Find matches on a regex taken from the database. - * - * Requires at least 1 named captured group. - * - * @param string $regex - * - * @return string - */ - protected function _matchDBRegex($regex) - { - $returnString = ''; - if (preg_match($regex, $this->subject, $matches)) { - if (count($matches) > 0) { - // Sort the keys, the named key matches will be concatenated in this order. - ksort($matches); - foreach ($matches as $key => $value) { - // Ignore non-named capture groups. Only named capture groups are important. - if (is_int($key)) { - continue; - } - // Concatenate the string to return. - $returnString .= $value; - } - } - } - return $returnString; - } - // a.b.0daystuffz protected function _0daystuffz() { diff --git a/lib/copy_this/www/lib/Regexes.php b/lib/copy_this/www/lib/Regexes.php new file mode 100644 index 000000000..66094d11d --- /dev/null +++ b/lib/copy_this/www/lib/Regexes.php @@ -0,0 +1,358 @@ + null, + 'Table_Name' => '', + ]; + $options += $defaults; + + $this->pdo = ($options['Settings'] instanceof DB ? $options['Settings'] : new DB()); + $this->tableName = $options['Table_Name']; + } + + /** + * Add a new regex. + * + * @param array $data + * + * @return bool + */ + public function addRegex(array $data) + { + return (bool)$this->pdo->queryInsert( + sprintf( + 'INSERT INTO %s (group_regex, regex, status, description, ordinal) VALUES (%s, %s, %d, %s, %d)', + $this->tableName, + trim($this->pdo->escapeString($data['group_regex'])), + trim($this->pdo->escapeString($data['regex'])), + $data['status'], + trim($this->pdo->escapeString($data['description'])), + $data['ordinal'] + ) + ); + } + + /** + * Update a regex with new info. + * + * @param array $data + * + * @return bool + */ + public function updateRegex(array $data) + { + return (bool)$this->pdo->queryExec( + sprintf( + 'UPDATE %s + SET group_regex = %s, regex = %s, status = %d, description = %s, ordinal = %d + WHERE id = %d', + $this->tableName, + trim($this->pdo->escapeString($data['group_regex'])), + trim($this->pdo->escapeString($data['regex'])), + $data['status'], + trim($this->pdo->escapeString($data['description'])), + $data['ordinal'], + $data['id'] + ) + ); + } + + /** + * Get a single regex using its id. + * + * @param int $id + * + * @return array + */ + public function getRegexByID($id) + { + return $this->pdo->queryOneRow(sprintf('SELECT * FROM %s WHERE id = %d', $this->tableName, $id)); + } + + /** + * Get all regex. + * + * @param string $group_regex Optional, a keyword to find a group. + * @param int $limit Optional, amount of results to limit. + * @param int $offset Optional, the offset to use when limiting the result set. + * + * @return array + */ + public function getRegex($group_regex = '', $limit = 0, $offset = 0) + { + return $this->pdo->query( + sprintf( + 'SELECT * FROM %s %s %s', + $this->tableName, + $this->_groupQueryString($group_regex), + ($limit ? ('LIMIT ' . $limit . ' OFFSET ' . $offset) : '') + ) + ); + } + + /** + * Get the count of regex in the DB. + * + * @param string $group_regex Optional, keyword to find a group. + * + * @return int + */ + public function getCount($group_regex = '') + { + $query = $this->pdo->queryOneRow( + sprintf( + 'SELECT COUNT(id) AS count FROM %s %s', + $this->tableName, + $this->_groupQueryString($group_regex) + ) + ); + return (int)$query['count']; + } + + /** + * Delete a regex using its id. + * + * @param int $id + */ + public function deleteRegex($id) + { + $this->pdo->queryExec(sprintf('DELETE FROM %s WHERE id = %d', $this->tableName, $id)); + } + + /** + * Test a single collection regex for a group name. + * + * Requires table per group to be on. + * + * @param string $groupName + * @param string $regex + * @param int $limit + * + * @return array + */ + public function testCollectionRegex($groupName, $regex, $limit) + { + $groups = new Groups(['Settings' => $this->pdo]); + $groupID = $groups->getIDByName($groupName); + + if (!$groupID) { + return []; + } + + $tableNames = $groups->getCBPTableNames(true, $groupID); + + $rows = $this->pdo->query( + sprintf( + 'SELECT + b.name, b.totalparts, b.currentparts, b.binaryhash, + c.fromname, c.collectionhash + FROM %s b + INNER JOIN %s c ON c.id = b.collection_id', + $tableNames['bname'], $tableNames['cname'] + ) + ); + + $data = []; + if ($rows) { + $limit--; + $hashes = []; + foreach ($rows as $row) { + if (preg_match($regex, $row['name'], $matches)) { + ksort($matches); + $string = $string2 = ''; + foreach ($matches as $key => $match) { + if (!is_int($key)) { + $string .= $match; + $string2 .= '
' . $key . ': ' . $match; + } + } + $files = 0; + if (preg_match('/[[(\s](\d{1,5})(\/|[\s_]of[\s_]|-)(\d{1,5})[])\s$:]/i', $row['name'], $fileCount)) { + $files = $fileCount[3]; + } + $newCollectionHash = sha1($string . $row['fromname'] . $groupID . $files); + $data['New hash: ' . $newCollectionHash . $string2][$row['binaryhash']] = [ + 'file_name' => $row['name'], + 'file_total_parts' => $row['totalparts'], + 'file_current_parts' => $row['currentparts'], + 'collection_poster' => $row['fromname'], + 'old_collection_hash' => $row['collectionhash'], + ]; + + if ($limit > 0) { + if (count($hashes) > $limit) { + break; + } + $hashes[$newCollectionHash] = ''; + } + } + } + } + return $data; + } + + /** + * Test a single release naming regex for a group name. + * + * @param string $groupName + * @param string $regex + * @param int $displayLimit + * @param int $queryLimit + * + * @return array + */ + public function testReleaseNamingRegex($groupName, $regex, $displayLimit, $queryLimit) + { + $groups = new Groups(['Settings' => $this->pdo]); + $groupID = $groups->getIDByName($groupName); + + if (!$groupID) { + return []; + } + + $rows = $this->pdo->query( + sprintf( + 'SELECT name, searchname, id FROM releases WHERE groupid = %d LIMIT %d', + $groupID, + $queryLimit + ) + ); + + $data = []; + if ($rows) { + $limit = 1; + foreach ($rows as $row) { + $match = $this->_matchRegex($regex, $row['name']); + if ($match) { + $data[$row['id']] = [ + 'subject' => $row['name'], + 'old_name' => $row['searchname'], + 'new_name' => $match + ]; + if ($limit++ > $displayLimit) { + break; + } + } + } + } + return $data; + } + + /** + * This will try to find regex in the DB for a group and a usenet subject, attempt to match them and return the matches. + * + * @param string $subject + * @param string $groupName + * + * @return string + */ + public function tryRegex($subject, $groupName) + { + $this->_fetchRegex($groupName); + + $returnString = ''; + // If there are no regex, return and try regex in this file. + if ($this->_regexCache[$groupName]['regex']) { + foreach ($this->_regexCache[$groupName]['regex'] as $regex) { + + $returnString = $this->_matchRegex($regex['regex'], $subject); + // If this regex found something, break and return, or else continue trying other regex. + if ($returnString) { + break; + } + } + } + return $returnString; + } + + /** + * Get the regex from the DB, cache them locally for 15 mins. + * Cache them also in the cache server, as this script might be terminated. + * + * @param string $groupName + */ + protected function _fetchRegex($groupName) + { + // Check if we need to do an initial cache or refresh our cache. + if (isset($this->_regexCache[$groupName]['ttl']) && (time() - $this->_regexCache[$groupName]['ttl']) < 900) { + return; + } + + // Get all regex from DB which match the current group name. Cache them for 15 minutes. #CACHEDQUERY# + $this->_regexCache[$groupName]['regex'] = $this->pdo->query( + sprintf( + 'SELECT c.regex FROM %s c WHERE %s REGEXP c.group_regex AND c.status = 1 ORDER BY c.ordinal ASC, c.group_regex ASC', + $this->tableName, + $this->pdo->escapeString($groupName) + ), true, 900 + ); + // Set the TTL. + $this->_regexCache[$groupName]['ttl'] = time(); + } + + /** + * Find matches on a regex taken from the database. + * + * Requires at least 1 named captured group. + * + * @param string $regex + * @param string $subject + * + * @return string + */ + protected function _matchRegex($regex, $subject) + { + $returnString = ''; + if (preg_match($regex, $subject, $matches)) { + if (count($matches) > 0) { + // Sort the keys, the named key matches will be concatenated in this order. + ksort($matches); + foreach ($matches as $key => $value) { + // Ignore non-named capture groups. Only named capture groups are important. + if (is_int($key)) { + continue; + } + // Concatenate the string to return. + $returnString .= $value; + } + } + } + return $returnString; + } + + /** + * Format part of a query. + * + * @param string $group_regex + * + * @return string + */ + protected function _groupQueryString($group_regex) + { + return ($group_regex ? ('WHERE group_regex ' . $this->pdo->likeString($group_regex)) : ''); + } +} \ No newline at end of file diff --git a/lib/copy_this/www/lib/ReleaseCleaning.php b/lib/copy_this/www/lib/ReleaseCleaning.php index ab426bfe0..7554762c7 100644 --- a/lib/copy_this/www/lib/ReleaseCleaning.php +++ b/lib/copy_this/www/lib/ReleaseCleaning.php @@ -2,6 +2,7 @@ require_once(WWW_DIR . "lib/framework/db.php"); require_once(WWW_DIR . "lib/groups.php"); require_once(WWW_DIR . "lib/CollectionsCleaning.php"); +require_once(WWW_DIR . "lib/Regexes.php"); require_once(NN_TMUX . 'lib' . DS . 'prehash.php'); /* * Cleans names for releases/imports/namefixer. @@ -72,6 +73,11 @@ class ReleaseCleaning */ public $subject = ''; + /** + * @var Regexes + */ + protected $_regexes; + /** * @param DB $settings */ @@ -83,6 +89,7 @@ class ReleaseCleaning $this->e2 = \CollectionsCleaning::REGEX_FILE_EXTENSIONS . \CollectionsCleaning::REGEX_SUBJECT_SIZE . \CollectionsCleaning::REGEX_END; $this->pdo = ($settings instanceof DB ? $settings : new DB()); + $this->_regexes = new Regexes(['Settings' => $this->pdo, 'Table_Name' => 'release_naming_regexes']); } public function releaseCleaner($subject, $fromName, $size, $groupName, $usepre = false) @@ -178,10 +185,18 @@ class ReleaseCleaning if ($usepre === true) { return false; } + + // Try DB regex. + $potentialName = $this->_regexes->tryRegex($subject, $groupName); + if ($potentialName) { + return $potentialName; + } + //if www.town.ag releases check against generic_town regexes if (preg_match('/www\.town\.ag/i', $this->subject)) { return $this->generic_town(); } + switch ($groupName) { case 'alt.binaries.0day.stuffz': return $this->_0daystuffz(); @@ -6834,56 +6849,6 @@ class ReleaseCleaning public function teevee() { - // rename these teevee releases as the requestid is for the full season - // Episode info in 4th block so use that - //[169018]-[FULL]-[a.b.teevee]-[ House.of.Lies.S01E01.720p.WEB-DL.DD5.1.H.264-BS ]-[04/32] - "House.of.Lies.S01E01.The.Gods.of.Dangerous.Financial.Instruments.720p.WEB-DL.DD5.1.H.264-BS.part03.rar" yEnc - if (preg_match('/\[\d+\]-\[.+?\]-\[.+?\]-\[ (.+\.S\d\dE\d\d\..+?) \][- ]\[\d+\/\d+\][ -]{0,3}"[\w\säöüÄÖÜß+¤ƒ¶!.,&_()\[\]\'\`{}-]{8,}?\b.?' . $this->e1, - $this->subject, - $match) - ) { - return $match[1]; - } - // Season only in 4th block so take filename - //[169019]-[FULL]-[a.b.teevee]-[ House.of.Lies.S02.720p.WEB-DL.DD5.1.H.264-BS ]-[24/32] - "House.of.Lies.S02E02.When.Dinosaurs.Ruled.the.Planet.720p.WEB-DL.DD5.1.H.264-BS.vol000+01.par2" yEnc - if (preg_match('/\[\d+\]-\[.+?\]-\[.+?\]-\[ .+\.S\d\d\..+? \][- ]\[\d+\/\d+\][ -]{0,3}"([\w\säöüÄÖÜß+¤ƒ¶!.,&_()\[\]\'\`{}#-]{8,}?\b.?)' . $this->e1, - $this->subject, - $match) - ) { - return $match[1]; - } - // END teevee requestid renaming - - //[######]-[FULL]-[#a.b.teevee@EFNet]-[ Misfits.S01.SUBPACK.DVDRip.XviD-P0W4DVD ] [1/5] - "Misfits.S01.SUBPACK.DVDRip.XviD-P0W4DVD.nfo" yEnc - if (preg_match('/^\[#+\]-\[.+?\]-\[.+?\]-\[ (.+?) \][- ]\[\d+\/\d+\][-_\s]{0,3}("|#34;).+?("|#34;) yEnc$/', - $this->subject, - $match) - ) { - return $match[1]; - } //[34148]-[FULL]-[#a.b.teevee@EFNet]-[Batman.The.Animated.Series.S04E01.DVDRiP.XviD-PyRo]-[00/35] "Batman.The.Animated.Series.S04E01.DVDRiP.XviD-PyRo.nzb" yEnc - if (preg_match('/^\[#+\]-\[.+?\]-\[.+?\]-\[(.+?)\][- ]\[\d+\/\d+\][-_\s]{0,3}".+?" yEnc$/', - $this->subject, - $match) - ) { - return $match[1]; - } //[38722]-[#a.b.foreign@EFNet]-[ Game.Of.Thrones.S01E01.Der.Winter.Naht.GERMAN.DL.WS.1080p.HDTV.x264-MiSFiTS ]-[01/37] - "misfits-gameofthrones1080-s01e01-sample-sample.par2" yEnc - if (preg_match('/^\[#+\]-\[.+?\]-\[ (.+?) \][- ]\[\d+\/\d+\][-_\s]{0,3}".+?" yEnc$/', - $this->subject, - $match) - ) { - return $match[1]; - } //[#a.b.teevee] Parks.and.Recreation.S01E01.720p.WEB-DL.DD5.1.H.264-CtrlHD - [01/24] - "Parks.and.Recreation.S01E01.720p.WEB-DL.DD5.1.H.264-CtrlHD.nfo" yEnc - if (preg_match('/^\[#+\]-\[.+?\]-\[.+?\]-\[ (.+?) \][- ]\[\d+\/\d+\][-_\s]{0,3}("|#34;).+?("|#34;) yEnc$/', - $this->subject, - $match) - ) { - return $match[1]; - } //[17319]-[FULL]-[#a.b.teevee@EFNet]-[ CSI.New.York.S05E22.720p.HDTV.X264-DIMENSION ]-[01/34] "csi.new.york.522.720p-dimension.nfo" (1/1) (1/1 - if (preg_match('/\[#+\]-\[.+?\]-\[.+?\]-\[ ?(.+?) ?\][- ]\[\d+\/\d+\][-_\s]{0,3}("|#34;).+?("|#34;) \(\d+\/\d+\) \(\d+\/\d+$/', - $this->subject, - $match) - ) { - return $match[1]; - } //(01/37) "Entourage S08E08.part01.rar" - 349,20 MB - yEnc //(01/24) "EGtnu7OrLNQMO2pDbgpDrBL8SnjZDpab.nfo" - 686 B - 338.74 MB - yEnc (1/1) if (preg_match('/^\(\d+\/\d+\) "([\w\säöüÄÖÜß+¤ƒ¶!.,&_()\[\]\'\`{}#-]{8,}?\b.?)' . $this->e0 . diff --git a/lib/copy_this/www/lib/TmuxOutput.php b/lib/copy_this/www/lib/TmuxOutput.php index 9766d4431..e657ccb6f 100644 --- a/lib/copy_this/www/lib/TmuxOutput.php +++ b/lib/copy_this/www/lib/TmuxOutput.php @@ -117,7 +117,7 @@ class TmuxOutput extends Tmux $buffer = ''; $state = ($this->runVar['settings']['is_running'] == 1) ? 'Running' : 'Disabled'; //$version = $this->_tvers . 'r' . $this->_vers; - $tversion = '0.6r0053'; + $tversion = '0.6r0060'; $buffer .= sprintf($this->tmpMasks[2], "Monitor $state v$tversion @ $this->_tvers [" . $this->_vers ."]: ", diff --git a/lib/copy_this/www/templates/nntmux/scripts/utils-admin.js b/lib/copy_this/www/templates/nntmux/scripts/utils-admin.js index ab860f630..6f68fc9e9 100644 --- a/lib/copy_this/www/templates/nntmux/scripts/utils-admin.js +++ b/lib/copy_this/www/templates/nntmux/scripts/utils-admin.js @@ -655,6 +655,31 @@ function ajax_collection_regex_delete(id) }); } +/** + * ajax_release_naming_regex_delete() + * + * @param id binary id + */ +function ajax_release_naming_regex_delete(id) +{ + // no caching of results + var rand_no = Math.random(); + $.ajax({ + url : WWW_TOP + '/admin/ajax.php?action=release_naming_regex_delete&rand=' + rand_no, + data : { row_id: id}, + dataType : "html", + success : function(data) + { + $('div#message').html(data); + $('div#message').show('fast', function() {}); + $('#row-'+id).fadeOut(2000); + $('#message').fadeOut(5000); + }, + error: function(xhr,err,e) { alert( "Error in ajax_release_naming_regex_delete: " + err ); } + }); +} + + jQuery(function($){ $('#regexGroupSelect').change(function() { diff --git a/lib/copy_this/www/templates/nntmux/views/admin/adminmenu.tpl b/lib/copy_this/www/templates/nntmux/views/admin/adminmenu.tpl index 7e14f8b6a..580aee2fa 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/adminmenu.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/adminmenu.tpl @@ -15,6 +15,13 @@
  • View
  • +
  • Release Names + +
  • View Add Blacklist
  • View Releases
  • View Previews
  • diff --git a/lib/copy_this/www/templates/nntmux/views/admin/collection_regexes-edit.tpl b/lib/copy_this/www/templates/nntmux/views/admin/collection_regexes-edit.tpl index 5fc72212c..41e885d25 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/collection_regexes-edit.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/collection_regexes-edit.tpl @@ -26,13 +26,12 @@ The regex delimiters are not added, you MUST add them. See this page.
    To make the regex case insensitive, add i after the last delimiter.
    You MUST include at least one regex capture group.
    - You MUST name your regex capture groups.
    + You MUST name your regex capture groups (the ones you want to be included).
    A string will be created from your matched capture groups.
    The string will form part of a "collection hash".
    The collection hash is used to group many parts together, to form the finalized release.
    The usenet group and name of the poster are added automatically when hashing.
    Capture groups are sorted alphabetically (by capture group name) when concatenating the string.
    - The regex search will be done case insensitive. diff --git a/lib/copy_this/www/templates/nntmux/views/admin/release_naming_regexes-edit.tpl b/lib/copy_this/www/templates/nntmux/views/admin/release_naming_regexes-edit.tpl new file mode 100644 index 000000000..e6d691f22 --- /dev/null +++ b/lib/copy_this/www/templates/nntmux/views/admin/release_naming_regexes-edit.tpl @@ -0,0 +1,70 @@ +

    {$page->title}

    +{if $error != ''} +
    {$error}
    +{/if} +
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + +
    + Regex to match against a group or multiple groups.
    + Delimiters are already added, and PCRE_CASELESS is added after for case insensitivity. + An example of matching a single group: alt\.binaries\.example
    + An example of matching multiple groups: alt\.binaries.* +
    +
    + +
    + The regex to use when trying to name a release using the usenet subject.
    + The regex delimiters are not added, you MUST add them. See this page.
    + To make the regex case insensitive, add i after the last delimiter.
    + You MUST include at least one regex capture group.
    + You MUST name your regex capture groups (the ones you want included).
    + The named capture groups will be concatenated into a string. + Capture groups are sorted alphabetically (by capture group name) when concatenating the string.
    +
    +
    + +
    + Description for this regex.
    + You can include an example usenet subject this regex would match on. +
    +
    + +
    + The order to run this regex in.
    + Must be a number, 0 or higher.
    + If multiple regex have the same ordinal, MySQL will randomly sort them. +
    +
    + {html_radios id="status" name='status' values=$status_ids output=$status_names selected=$regex.status separator='
    '} +
    Only active regex are used during the collection matching process.
    +
    + +
    +
    \ No newline at end of file diff --git a/lib/copy_this/www/templates/nntmux/views/admin/release_naming_regexes-list.tpl b/lib/copy_this/www/templates/nntmux/views/admin/release_naming_regexes-list.tpl new file mode 100644 index 000000000..bb68e3da1 --- /dev/null +++ b/lib/copy_this/www/templates/nntmux/views/admin/release_naming_regexes-list.tpl @@ -0,0 +1,43 @@ +

    {$page->title}

    +

    This page lists regex used for getting names for releases from usenet subjects.

    +
    + +
    + + +    + +
    +{if $regex} + +
    {$pager}
    + + + + + + + + + + + + {foreach from=$regex item=row} + + + + + + + + {if $row.status==1} + + {else} + + {/if} + + + {/foreach} +
    idgroupeditdescriptiondeleteordinalstatusregex
    {$row.id}{$row.group_regex}Edit{$row.description|truncate:50:"...":true}Delete{$row.ordinal}ActiveDisabled{$row.regex|escape:html|truncate:50:"...":true}
    +
    {$pager}
    +{/if} \ No newline at end of file diff --git a/lib/copy_this/www/templates/nntmux/views/admin/release_naming_regexes-test.tpl b/lib/copy_this/www/templates/nntmux/views/admin/release_naming_regexes-test.tpl new file mode 100644 index 000000000..e29f45d8d --- /dev/null +++ b/lib/copy_this/www/templates/nntmux/views/admin/release_naming_regexes-test.tpl @@ -0,0 +1,35 @@ +

    {$page->title}

    +

    This page is used for testing regex for getting release names from usenet subject. +
    Maximum releases to display will limit the amount of results displayed on the page. 0 for no limit. +
    Query limit will limit the amount of releases to select from MySQL (setting this high can be very slow). 0 for no limit. +

    + +
    + +
    + +
    + +
    + +
    + +
    +{if $data} + + + + + + + + {foreach from=$data key=id item=names} + + + + + + + {/foreach} +
    Release IDUsenet SubjectOld Search NameNew Search Name
    {$id}{$names.subject}{$names.old_name}{$names.new_name}
    +{/if} \ No newline at end of file