Merge remote-tracking branch 'origin/dev-regexless' into dev-regexless

This commit is contained in:
Darko
2015-06-04 12:56:30 +02:00
22 changed files with 355 additions and 251 deletions
+24 -16
View File
@@ -1,23 +1,31 @@
I have forked jonnyboys newznab-tmux as he and the dev team have moved to another project (https://github.com/nZEDb/nZEDb). I will try as much as i can to maintain and improve these tmux scripts, where possible and needed, as they are a valuable addendum to newznab+.
Support is given on irc.synirc.net #tmux channel.
I started adapting some of more interesting scripts from nZEDb, but they require tempering with newznab database, so use them at your own risk. Any update to nn+ db could render them useless. Scripts require PHP version => 5.5 and Python 2.7x or newer.
I started adapting some of more interesting scripts from nZEDb, but they require tempering with newznab database, so use them at your own risk. By using newznab-tmux you will render your indexer incompatible with newznab (you can revert changes by forcing the svn checkout, it will replace the changed files. Newznab is not aware of the changes in database, so you are safe to leave them as they are). Scripts require PHP version >= 5.5.x and Python 2.7x or newer.
Now, clone my github. These scripts need to run from this location and this is where I was asked to put them. If you have decided to use an alternate location, you will need to edit the file bin/config.php to point to the file newznab/www/config.php. If you do not, these scripts will not run.
# Steps to have a working tmux install:
cd /var/www/newznab/misc/update_scripts/nix_scripts/
git clone https://github.com/DariusIII/newznab-tmux.git tmux
cd tmux
CD to the root of your newznab install, ie. cd /var/www/newznab
Next steps are very important:
git init
git remote add origin https://github.com/DariusIII/newznab-tmux.git
git fetch
git reset --hard origin/your_wanted_branch, ie. git reset --hard origin/master
git checkout -t origin/your_wanted_branch, ie. git checkout -t origin/master
There is a lib folder in main tmux folder. In that folder you will find two folders, /DB/ and /copy_this/. if you are setting up tmux for the first time, import db.sql using cli (mysql -u {┤your username} -p newznab < db.sql).
There is a lib folder in main tmux folder. In that folder you will find DB folder. If you are setting up tmux for the first time, import db.sql using cli (mysql -u {┤your username} -p newznab < db.sql).
After importing db.sql you need to run the patchDB.php from same folder. After the last patch is applied, you need to manualy apply the next patch labeled XXXX~settings.sql (XXXX is a patch number that is different on dev/master(0122) and regexless branch(0149)).
When you have manualy applied that patch, you can use the new database updater located in /path/to/newznab/cli/ and run update_db.php true and it will apply the rest of the patches (if they exist).
After these steps, patchDB is unusable anymore and you need to use the new update_db.php script in cli folder.
1. Copy files from /lib/copy_this/www folder into your newznab installation folder. I have created the nntmux theme where all the settings are available.
You need to chmod to 777 following folders now:
resources/*
libs/smarty/templates_c
nzbfiles/
2. Copy files from /lib/copy_this/misc folder into your newznab installation folder.
3. Most of the scripts are now threaded.
4. All the required folders are created when you copy files from copy_this folder.
You need to add an alias to your apache/nginx conf of your indexer:
Alias /covers /path/to/newznab/resources/covers
# yEnc:
@@ -37,7 +45,7 @@ There is a lib folder in main tmux folder. In that folder you will find two fold
cd ~/
rm -rf simple_php_yenc_decode/
yydecode
yydecode:
cd ~/
mkdir -p yydecode
@@ -65,14 +73,14 @@ There is a lib folder in main tmux folder. In that folder you will find two fold
# Alternate NNTP provider:
Newznab-tmux has added support for dual NNTP providers, you need to edit the provided config.php in lib/copy_this/config_edit_before_copy folder
Newznab-tmux has added support for dual NNTP providers, you need to edit the provided config.php.example in www folder.
# Sphinx support:
Newznab-tmux now comes with its own Sphinx support, ported from nZEDb. Installation readme is in misc/sphinxsearch folder, and in copy_this/misc/sphinxsearch folder
Newznab-tmux now comes with its own Sphinx support, ported from nZEDb. Installation readme is in misc/sphinxsearch folder.
This version of tmux has many core newznab files modified, use at your own risk.
Tmux is started with start.php (php start.php command). Scripts not used anymore are still available for your use, but you need to run them manualy.
Tmux is started by following command in cli, from tmux folder: php tmux-ui.php start. Tmux can be gracefuly stopped in similar manner php tmux-ui.php stop.
+2 -2
View File
@@ -2,8 +2,8 @@
<newznab>
<versions>
<sql>
<db>152</db>
<file>152</file>
<db>155</db>
<file>155</file>
</sql>
<git>
<tag>0.4.1</tag>
+20 -1
View File
@@ -77,6 +77,12 @@ class Backfill
*/
protected $_safePartRepair;
/**
* Should we disable the group if we have backfilled far enough?
* @var bool
*/
protected $_disableBackfillGroup;
/**
* Constructor.
*
@@ -116,6 +122,7 @@ class Backfill
$this->_safeBackFillDate = ($this->pdo->getSetting('safebackfilldate') != '') ? (string)$this->pdo->getSetting('safebackfilldate') : '2008-08-14';
$this->_safePartRepair = ($this->pdo->getSetting('safepartrepair') == 1 ? 'update' : 'backfill');
$this->_tablePerGroup = ($this->pdo->getSetting('tablepergroup') == 1 ? true : false);
$this->_disableBackfillGroup = ($this->pdo->getSetting('disablebackfillgroup') == 1 ? true : false);
}
/**
@@ -270,11 +277,23 @@ class Backfill
$dMessage =
"We have hit the maximum we can backfill for " .
$groupName .
", skipping it, consider disabling backfill on it.";
($this->_disableBackfillGroup ? ", disabling backfill on it." :
", skipping it, consider disabling backfill on it.");
if ($this->_debug) {
$this->_debugging->log('Backfill', "backfillGroup", $dMessage, \Logger::LOG_NOTICE);
}
if ($this->_disableBackfillGroup) {
$this->pdo->queryExec(
sprintf('
UPDATE groups
SET backfill = 0
WHERE id = %d',
$groupArr['id']
)
);
}
if ($this->_echoCLI) {
$this->pdo->log->doEcho($this->pdo->log->notice($dMessage), true);
}
+22 -9
View File
@@ -909,7 +909,6 @@ class Releases
* @param string $usenetName
* @param string $posterName
* @param string $groupName
* @param array $cat
* @param int $sizeFrom
* @param int $sizeTo
* @param int $hasNfo
@@ -920,18 +919,32 @@ class Releases
* @param int $limit
* @param string $orderBy
* @param int $maxAge
* @param array $excludedCats
* @param integer[] $excludedCats
* @param string $type
* @param array $cat
*
* @return array
*/
public function search(
$searchName, $usenetName, $posterName, $groupName, $cat = [-1], $sizeFrom,
$sizeTo, $hasNfo, $hasComments, $daysNew, $daysOld, $offset = 0, $limit = 1000,
$orderBy = '', $maxAge = -1, $excludedCats = [], $type = 'basic'
)
{
$sizeRange = array(
$searchName,
$usenetName,
$posterName,
$groupName,
$sizeFrom,
$sizeTo,
$hasNfo,
$hasComments,
$daysNew,
$daysOld,
$offset = 0,
$limit = 1000,
$orderBy = '',
$maxAge = -1,
$excludedCats = [],
$type = 'basic',
$cat = [-1]
) {
$sizeRange = [
1 => 1,
2 => 2.5,
3 => 5,
@@ -943,7 +956,7 @@ class Releases
9 => 160,
10 => 320,
11 => 640,
);
];
if ($orderBy == '') {
$orderBy = [];
+51 -3
View File
@@ -18,6 +18,7 @@ class Users
const ROLE_USER = 1;
const ROLE_ADMIN = 2;
const ROLE_DISABLED = 3;
const ROLE_MODERATOR = 4;
const DEFAULT_INVITES = 1;
const DEFAULT_INVITE_EXPIRY_DAYS = 7;
@@ -434,9 +435,7 @@ class Users
public function isDisabled($username)
{
$role = $this->pdo->queryOneRow(sprintf("select role as role from users where username = %s ", $this->pdo->escapeString($username)));
return ($role["role"] == Users::ROLE_DISABLED);
return $this->roleCheck(self::ROLE_DISABLED, $username);
}
public function isValidUrl($url)
@@ -995,4 +994,53 @@ class Users
{
return $this->pdo->queryInsert(sprintf("delete from userdownloads where releaseid = %d", $releaseID));
}
/**
* Checks if a user is a specific role.
*
* @notes Uses type of $user to denote identifier. if string: username, if int: userid
* @param int $roleID
* @param string|int $user
* @return bool
*/
public function roleCheck($roleID, $user) {
if (is_string($user) && strlen($user) > 0) {
$user = $this->pdo->escapeString($user);
$querySuffix = "username = '$user'";
} elseif (is_int($user) && $user >= 0) {
$querySuffix = "id = $user";
} else {
return false;
}
$result = $this->pdo->queryOneRow(
sprintf(
"SELECT role FROM users WHERE %s",
$querySuffix
)
);
return ((integer)$result['role'] == (integer) $roleID) ? true : false;
}
/**
* Wrapper for roleCheck specifically for Admins.
*
* @param int $userID
* @return bool
*/
public function isAdmin($userID) {
return $this->roleCheck(self::ROLE_ADMIN, (integer) $userID);
}
/**
* Wrapper for roleCheck specifically for Moderators.
*
* @param int $userId
* @return bool
*/
public function isModerator($userId) {
return $this->roleCheck(self::ROLE_MODERATOR, (integer) $userId);
}
}
+6
View File
@@ -0,0 +1,6 @@
INSERT IGNORE INTO settings (name, value, hint, setting)
VALUES (
'disablebackfillgroup', 0,
'Whether to disable backfill on a group if the target date has been reached.',
'disablebackfillgroup'
);
+1
View File
@@ -0,0 +1 @@
INSERT INTO settings (section, subsection, name, value, hint, setting) VALUES ('', '', 'privateprofiles', 1, 'Hide profiles from other users (admin/mod can still access).', 'privateprofiles');
+9
View File
@@ -0,0 +1,9 @@
INSERT IGNORE INTO settings (name, value, hint, setting)
VALUES (
'processthumbnails', 0,
'Whether to attempt to process a video thumbnail image. You must have ffmpeg for this.',
'processthumbnails'
);
UPDATE settings SET value = 1
WHERE setting = 'processthumbnails' AND (SELECT * FROM (SELECT value FROM settings WHERE setting = 'ffmpegpath') s) != '';
+1 -1
View File
@@ -16,7 +16,7 @@ if (isset($_GET["id"]))
if (!$rel)
$page->show404();
$nzbpath = $nzb->getNZBPath($_GET["id"], $page->site->nzbpath);
$nzbpath = $nzb->getNZBPath($_GET["id"], $page->settings->getSetting('nzbpath'));
if (!file_exists($nzbpath))
$page->show404();
+1 -1
View File
@@ -4,7 +4,7 @@ require_once './config.php';
$page = new AdminPage();
$s = $page->site;
$s = $page->settings;
unset($s->siteseed);
unset($s->amazonprivkey);
unset($s->tmdbkey);
+1
View File
@@ -180,6 +180,7 @@ if (isset($_GET["id"]))
$page->smarty->assign('prehash', $pre);
$page->smarty->assign('comments',$comments);
$page->smarty->assign('searchname',$releases->getSimilarName($data['searchname']));
$page->smarty->assign('privateprofiles', ($page->settings->getSetting('privateprofiles') == 1) ? true : false );
$page->meta_title = "View NZB";
$page->meta_keywords = "view,nzb,description,details";
+1
View File
@@ -28,6 +28,7 @@ $page->smarty->assign('pageroffset',$offset);
$page->smarty->assign('pageritemsperpage',ITEMS_PER_PAGE);
$page->smarty->assign('pagerquerybase', WWW_TOP."/forum?offset=");
$page->smarty->assign('pagerquerysuffix', "#results");
$page->smarty->assign('privateprofiles', ($page->settings->getSetting('privateprofiles') == 1) ? true : false );
$pager = $page->smarty->fetch("pager.tpl");
$page->smarty->assign('pager', $pager);
+1
View File
@@ -25,6 +25,7 @@ $page->meta_keywords = "view,forum,post,thread";
$page->meta_description = "View forum post";
$page->smarty->assign('results', $results);
$page->smarty->assign('privateprofiles', ($page->settings->getSetting('privateprofiles') == 1) ? true : false );
$page->content = $page->smarty->fetch('forumpost.tpl');
$page->render();
+27
View File
@@ -19,6 +19,29 @@ elseif (isset($_GET["name"]))
else
$userid = $users->currentUserId();
$privileged = ($users->isAdmin($userid) || $users->isModerator($userid)) ? true : false;
$privateProfiles = ($page->settings->getSetting('privateprofiles') == 1) ? true : false;
$publicView = false;
if (!$privateProfiles || $privileged) {
$altID = (isset($_GET['id']) && $_GET['id'] >= 0) ? (int) $_GET['id'] : false;
$altUsername = (isset($_GET['name']) && strlen($_GET['name']) > 0) ? $_GET['name'] : false;
// If both 'id' and 'name' are specified, 'id' should take precedence.
if ($altID === false && $altUsername !== false) {
$user = $users->getByUsername($altUsername);
if ($user) {
$altID = $user['id'];
}
} else if ($altID !== false) {
$userid = $altID;
$publicView = true;
}
}
$data = $users->getById($userid);
if (!$data)
$page->show404();
@@ -31,6 +54,9 @@ $page->smarty->assign('apihits', $users->getApiRequests($userid));
$page->smarty->assign('grabstoday', $users->getDownloadRequests($userid));
$page->smarty->assign('userinvitedby',$invitedby);
$page->smarty->assign('user',$data);
$page->smarty->assign('privateprofiles', $privateProfiles);
$page->smarty->assign('publicview', $publicView);
$page->smarty->assign('privileged', $privileged);
$commentcount = $rc->getCommentCountForUser($userid);
$offset = isset($_REQUEST["offset"]) ? $_REQUEST["offset"] : 0;
@@ -39,6 +65,7 @@ $page->smarty->assign('pageroffset',$offset);
$page->smarty->assign('pageritemsperpage',ITEMS_PER_PAGE);
$page->smarty->assign('pagerquerybase', "/profile?id=".$userid."&offset=");
$page->smarty->assign('pagerquerysuffix', "#comments");
$page->smarty->assign('privateprofiles', ($page->settings->getSetting('privateprofiles') == 1) ? true : false );
$pager = $page->smarty->fetch("pager.tpl");
$page->smarty->assign('pager', $pager);
+134 -190
View File
@@ -1,205 +1,137 @@
<?php
if (!$users->isLoggedIn()) {
if (!$page->users->isLoggedIn()) {
$page->show403();
}
$grp = new Groups();
$releases = new Releases();
$c = new Category();
$groups = new Groups(['Settings' => $page->settings]);
$releases = new Releases(['Groups' => $groups, 'Settings' => $page->settings]);
$page->meta_title = "Search Nzbs";
$page->meta_keywords = "search,nzb,description,details";
$page->meta_title = "Search Nzbs";
$page->meta_keywords = "search,nzb,description,details";
$page->meta_description = "Search for Nzbs";
$results = array();
$searchtype = "basic";
$searchStr = "";
$results = [];
$searchType = "basic";
if (isset($_REQUEST["search_type"]) && $_REQUEST["search_type"] == "adv") {
$searchtype = "advanced";
$searchType = "advanced";
}
if (isset($_REQUEST["id"]) && !isset($_REQUEST["searchadvr"]) && !isset($_REQUEST["subject"])) {
$offset = (isset($_REQUEST["offset"]) && ctype_digit($_REQUEST['offset'])) ? $_REQUEST["offset"] : 0;
$ordering = $releases->getBrowseOrdering();
$orderby = isset($_REQUEST["ob"]) && in_array($_REQUEST['ob'], $ordering) ? $_REQUEST["ob"] : '';
$ordering = $releases->getBrowseOrdering();
$orderBy = (isset($_REQUEST["ob"]) && in_array($_REQUEST['ob'], $ordering) ? $_REQUEST["ob"] : '');
$offset = (isset($_REQUEST["offset"]) && ctype_digit($_REQUEST['offset'])) ? $_REQUEST["offset"] : 0;
if ($searchtype == "basic") {
$searchStr = (string) $_REQUEST["id"];
$categoryId = array();
if (isset($_REQUEST["t"])) {
$categoryId = explode(",", $_REQUEST["t"]);
} else {
$categoryId[] = -1;
}
foreach ($ordering as $ordertype) {
$page->smarty->assign('orderby' . $ordertype, WWW_TOP . "/search/" . htmlentities($searchStr) . "?t=" . (implode(',', $categoryId)) . "&amp;ob=" . $ordertype);
}
$page->smarty->assign('category', $categoryId);
$page->smarty->assign('pagerquerybase', WWW_TOP . "/search/" . htmlentities($searchStr) . "?t=" . (implode(',', $categoryId)) . "&amp;ob=" . $orderby . "&amp;offset=");
$page->smarty->assign('search', $searchStr);
if (isset ($_REQUEST['subject'])) {
$page->smarty->assign('subject', $_REQUEST['subject']);
}
$results = $releases->search($searchStr, -1, -1, -1, $categoryId, -1, -1, 0, 0, -1, -1, $offset, ITEMS_PER_PAGE, $orderby, -1, $page->userdata["categoryexclusions"]);
}
$page->smarty->assign('lastvisit', $page->userdata['lastlogin']);
if (sizeof($results) > 0) {
$totalRows = $results[0]['_totalrows'];
} else {
$totalRows = 0;
}
$page->smarty->assign('pagertotalitems', $totalRows);
$page->smarty->assign('pageroffset', $offset);
$page->smarty->assign('pageritemsperpage', ITEMS_PER_PAGE);
$page->smarty->assign('pagerquerysuffix', "#results");
$pager = $page->smarty->fetch("pager.tpl");
$page->smarty->assign('pager', $pager);
}
if (isset($_REQUEST["subject"]) && !isset($_REQUEST["searchadvr"]) && !isset($_REQUEST["id"])) {
$offset = (isset($_REQUEST["offset"]) && ctype_digit($_REQUEST['offset'])) ? $_REQUEST["offset"] : 0;
$ordering = $releases->getBrowseOrdering();
$orderby = isset($_REQUEST["ob"]) && in_array($_REQUEST['ob'], $ordering) ? $_REQUEST["ob"] : '';
if ($searchtype == "basic") {
$searchStr = (string) $_REQUEST["subject"];
$categoryId = array();
if (isset($_REQUEST["t"])) {
$categoryId = explode(",", $_REQUEST["t"]);
} else {
$categoryId[] = -1;
}
foreach ($ordering as $ordertype) {
$page->smarty->assign('orderby' . $ordertype, WWW_TOP . "/search/" . htmlentities($searchStr) . "?t=" . (implode(',', $categoryId)) . "&amp;ob=" . $ordertype);
}
$page->smarty->assign('category', $categoryId);
$page->smarty->assign('pagerquerybase', WWW_TOP . "/search/" . htmlentities($searchStr) . "?t=" . (implode(',', $categoryId)) . "&amp;ob=" . $orderby . "&amp;offset=");
$page->smarty->assign('subject', $searchStr);
$results = $releases->search($searchStr, -1, -1, -1, $categoryId, -1, -1, 0, 0, -1, -1, $offset, ITEMS_PER_PAGE, $orderby, -1, $page->userdata["categoryexclusions"]);
}
$page->smarty->assign('lastvisit', $page->userdata['lastlogin']);
if (sizeof($results) > 0) {
$totalRows = $results[0]['_totalrows'];
} else {
$totalRows = 0;
}
$page->smarty->assign('pagertotalitems', $totalRows);
$page->smarty->assign('pageroffset', $offset);
$page->smarty->assign('pageritemsperpage', ITEMS_PER_PAGE);
$page->smarty->assign('pagerquerysuffix', "#results");
$pager = $page->smarty->fetch("pager.tpl");
$page->smarty->assign('pager', $pager);
}
if (isset($_REQUEST["searchadvr"]) && !isset($_REQUEST["id"]) && !isset($_REQUEST["subject"])) {
$offset = (isset($_REQUEST["offset"]) && ctype_digit($_REQUEST['offset'])) ? $_REQUEST["offset"] : 0;
$ordering = $releases->getBrowseOrdering();
$orderby = isset($_REQUEST["ob"]) && in_array($_REQUEST['ob'], $ordering) ? $_REQUEST["ob"] : '';
if ($searchtype !== "basic") {
$searchSearchName = (string) $_REQUEST["searchadvr"];
$searchUsenetName = (string) $_REQUEST["searchadvsubject"];
$searchPoster = (string) $_REQUEST["searchadvposter"];
$searchdaysnew = (string) $_REQUEST["searchadvdaysnew"];
$searchdaysold = (string) $_REQUEST["searchadvdaysold"];
$searchGroups = (string) $_REQUEST["searchadvgroups"];
$searchCat = (string) $_REQUEST["searchadvcat"];
$searchSizeFrom = (string) $_REQUEST["searchadvsizefrom"];
$searchSizeTo = (string) $_REQUEST["searchadvsizeto"];
$searchHasNFO = (string) $_REQUEST["searchadvhasnfo"];
$searchHascomments = (string) $_REQUEST["searchadvhascomments"];
$page->smarty->assign('searchadvr', $searchSearchName);
$page->smarty->assign('searchadvsubject', $searchUsenetName);
$page->smarty->assign('searchadvposter', $searchPoster);
$page->smarty->assign('searchadvdaysnew', $searchdaysnew);
$page->smarty->assign('searchadvdaysold', $searchdaysold);
$page->smarty->assign('selectedgroup', $searchGroups);
$page->smarty->assign('selectedcat', $searchCat);
$page->smarty->assign('selectedsizefrom', $searchSizeFrom);
$page->smarty->assign('selectedsizeto', $searchSizeTo);
$page->smarty->assign('searchadvhasnfo', $searchHasNFO);
$page->smarty->assign('searchadvhascomments', $searchHascomments);
foreach ($ordering as $ordertype) {
$page->smarty->assign('orderby' . $ordertype, WWW_TOP . "/search?searchadvr=" . htmlentities($searchSearchName) . "&searchadvsubject=" . htmlentities($searchUsenetName) . "&searchadvposter=" . htmlentities($searchPoster) . "&searchadvdaysnew=" . htmlentities($searchdaysnew) . "&searchadvdaysold=" . htmlentities($searchdaysold) . "&searchadvgroups=" . htmlentities($searchGroups) . "&searchadvcat=" . htmlentities($searchCat) . "&searchadvsizefrom=" . htmlentities($searchSizeFrom) . "&searchadvsizeto=" . htmlentities($searchSizeTo) . "&searchadvhasnfo=" . htmlentities($searchHasNFO) . "&searchadvhascomments=" . htmlentities($searchHascomments) . "&search_type=adv" . "&amp;ob=" . $ordertype);
}
$page->smarty->assign('pagerquerybase', WWW_TOP . "/search?searchadvr=" . htmlentities($searchSearchName) . "&searchadvsubject=" . htmlentities($searchUsenetName) . "&searchadvposter=" . htmlentities($searchPoster) . "&searchadvdaysnew=" . htmlentities($searchdaysnew) . "&searchadvdaysold=" . htmlentities($searchdaysold) . "&searchadvgroups=" . htmlentities($searchGroups) . "&searchadvcat=" . htmlentities($searchCat) . "&searchadvsizefrom=" . htmlentities($searchSizeFrom) . "&searchadvsizeto=" . htmlentities($searchSizeTo) . "&searchadvhasnfo=" . htmlentities($searchHasNFO) . "&searchadvhascomments=" . htmlentities($searchHascomments) . "&search_type=adv" . "&amp;ob=" . $orderby . "&amp;offset=");
if ($_REQUEST["searchadvr"] == "") {
$searchSearchName = -1;
}
if ($_REQUEST["searchadvsubject"] == "") {
$searchUsenetName = -1;
}
if ($_REQUEST["searchadvposter"] == "") {
$searchPoster = -1;
}
if ($_REQUEST["searchadvdaysnew"] == "") {
$searchdaysnew = -1;
}
if ($_REQUEST["searchadvdaysold"] == "") {
$searchdaysold = -1;
}
if ($_REQUEST["searchadvcat"] == "") {
$searchCat = -1;
}
$results = $releases->search($searchSearchName, $searchUsenetName, $searchPoster, $searchGroups, [$searchCat], $searchSizeFrom, $searchSizeTo, $searchHasNFO, $searchHascomments, $searchdaysnew, $searchdaysold, $offset, ITEMS_PER_PAGE, $orderby, -1, $page->userdata["categoryexclusions"], "advanced");
}
$page->smarty->assign('lastvisit', $page->userdata['lastlogin']);
if (sizeof($results) > 0) {
$totalRows = $results[0]['_totalrows'];
} else {
$totalRows = 0;
}
$page->smarty->assign('pagertotalitems', $totalRows);
$page->smarty->assign('pageroffset', $offset);
$page->smarty->assign('pageritemsperpage', ITEMS_PER_PAGE);
$page->smarty->assign('pagerquerysuffix', "#results");
$pager = $page->smarty->fetch("pager.tpl");
$page->smarty->assign('pager', $pager);
}
$grouplist = $grp->getGroupsForSelect();
$page->smarty->assign('grouplist', $grouplist);
$catlist = $c->getForSelect();
$page->smarty->assign('catlist', $catlist);
$sizelist = array(-1 => '--Select--',
1 => '100MB',
2 => '250MB',
3 => '500MB',
4 => '1GB',
5 => '2GB',
6 => '3GB',
7 => '4GB',
8 => '8GB',
9 => '16GB',
10 => '32GB',
11 => '64GB'
$page->smarty->assign(
[
'subject' => '', 'search' => '', 'category' => [0], 'pagertotalitems' => 0,
'pageritemsperpage' => 1, 'pageroffset' => 1, 'covgroup' => ''
]
);
$page->smarty->assign('sizelist', $sizelist);
$page->smarty->assign('results', $results);
$page->smarty->assign('sadvanced', ($searchtype != "basic"));
if ((isset($_REQUEST["id"]) || isset($_REQUEST["subject"])) && !isset($_REQUEST["searchadvr"]) && $searchType == "basic") {
$searchString = '';
switch (true) {
case isset($_REQUEST["subject"]):
$searchString = (string) $_REQUEST["subject"];
$page->smarty->assign('subject', $searchString);
break;
case isset($_REQUEST["id"]):
$searchString =(string) $_REQUEST["id"];
$page->smarty->assign('search', $searchString);
break;
}
$categoryID[] = -1;
if (isset($_REQUEST['t'])) {
$categoryID = explode(',', $_REQUEST['t']);
}
foreach ($releases->getBrowseOrdering() as $orderType) {
$page->smarty->assign(
"orderby$orderType",
WWW_TOP . '/search/' . htmlentities($searchString) . '?t=' . (implode(',', $categoryID)) . "&amp;ob=$orderType"
);
}
$results = $releases->search(
$searchString, -1, -1, -1, -1, -1, 0, 0, -1, -1, $offset, ITEMS_PER_PAGE,
$orderBy, -1, $page->userdata["categoryexclusions"], "basic", $categoryID
);
$page->smarty->assign(
[
'lastvisit' => $page->userdata['lastlogin'],
'pagertotalitems' => (count($results) > 0 ? $results[0]['_totalrows'] : 0),
'pageroffset' => $offset,
'pageritemsperpage' => ITEMS_PER_PAGE,
'pagerquerysuffix' => "#results",
'pagerquerybase' =>
WWW_TOP . "/search/" . htmlentities($searchString) . "?t=" .
(implode(',', $categoryID)) . "&amp;ob=$orderBy&amp;offset=",
'category' => $categoryID
]
);
}
$searchVars = [
'searchadvr' => '', 'searchadvsubject' => '', 'searchadvposter' => '',
'searchadvdaysnew' => '', 'searchadvdaysold' => '', 'searchadvgroups' => '',
'searchadvcat' => '', 'searchadvsizefrom' => '', 'searchadvsizeto' => '',
'searchadvhasnfo' => '', 'searchadvhascomments' => ''
];
foreach($searchVars as $searchVarKey => $searchVar) {
$searchVars[$searchVarKey] = (isset($_REQUEST[$searchVarKey]) ? (string) $_REQUEST[$searchVarKey] : '');
}
$searchVars['selectedgroup'] = $searchVars['searchadvgroups'];
$searchVars['selectedcat'] = $searchVars['searchadvcat'];
$searchVars['selectedsizefrom'] = $searchVars['searchadvsizefrom'];
$searchVars['selectedsizeto'] = $searchVars['searchadvsizeto'];
foreach($searchVars as $searchVarKey => $searchVar) {
$page->smarty->assign($searchVarKey, $searchVars[$searchVarKey]);
}
if (isset($_REQUEST["searchadvr"]) && !isset($_REQUEST["id"]) && !isset($_REQUEST["subject"]) && $searchType != "basic") {
$orderByString = '';
foreach ($searchVars as $searchVarKey => $searchVar) {
$orderByString .= "&$searchVarKey=" . htmlentities($searchVar);
}
$orderByString = ltrim($orderByString, '&');
foreach ($ordering as $orderType) {
$page->smarty->assign(
'orderby' . $orderType,
WWW_TOP . "/search?$orderByString&search_type=adv&amp;ob=$orderType"
);
}
$results = $releases->search(
($searchVars['searchadvr'] == '' ? -1 : $searchVars['searchadvr']),
($searchVars['searchadvsubject'] == '' ? -1 : $searchVars['searchadvsubject']),
($searchVars['searchadvposter'] == '' ? -1 : $searchVars['searchadvposter']),
$searchVars['searchadvgroups'], $searchVars['searchadvsizefrom'], $searchVars['searchadvsizeto'],
$searchVars['searchadvhasnfo'], $searchVars['searchadvhascomments'],
($searchVars['searchadvdaysnew'] == '' ? -1 : $searchVars['searchadvdaysnew']),
($searchVars['searchadvdaysold'] == '' ? -1 : $searchVars['searchadvdaysold']),
$offset, ITEMS_PER_PAGE, $orderBy, -1, $page->userdata["categoryexclusions"], "advanced",
[($searchVars['searchadvcat'] == '' ? -1 : $searchVars['searchadvcat'])]
);
$page->smarty->assign(
[
'lastvisit' => $page->userdata['lastlogin'],
'pagertotalitems' => (count($results) > 0 ? $results[0]['_totalrows'] : 0),
'pageroffset' => $offset,
'pageritemsperpage' => ITEMS_PER_PAGE,
'pagerquerysuffix' => "#results",
'pagerquerybase' => WWW_TOP . "/search?$orderByString&search_type=adv&amp;ob=$orderBy&amp;offset="
]
);
}
$ft1 = $page->settings->checkIndex('releases', 'ix_releases_name_searchname_ft');
$ft2 = $page->settings->checkIndex('releases', 'ix_releases_name_ft');
@@ -207,7 +139,7 @@ $ft3 = $page->settings->checkIndex('releases', 'ix_releases_searchname_ft');
switch (NN_RELEASE_SEARCH_TYPE) {
case ReleaseSearch::FULLTEXT:
$search_description =
'MySQL Full Text Search Rules:<br />
'MySQL Full Text Search Rules:<br />
A leading exclamation point(! in place of +) indicates that this word must be present in each row that is returned.<br />
A leading minus sign indicates that this word must not be present in any of the rows that are returned.<br />
By default (when neither + nor - is specified) the word is optional, but the rows that contain it are rated higher.<br />
@@ -219,7 +151,7 @@ See <a target="_blank" href=\'http://dev.mysql.com/doc/refman/5.0/en/fulltext-bo
case ReleaseSearch::SPHINX:
default:
$search_description =
'Sphinx Search Rules:<br />
'Sphinx Search Rules:<br />
The search is case insensitive.<br />
All words must be separated by spaces.
Do not seperate words using . or _ or -, sphinx will match a space against those automatically.<br />
@@ -235,8 +167,20 @@ You can enclose words using paranthesis. ie: (^game*|^dex*)s03*(x264<&lt;nogrp$)
You can combine some of these rules, but not all.<br />';
break;
}
$page->smarty->assign('search_description', $search_description);
$page->smarty->assign(
[
'sizelist' => [
-1 => '--Select--', 1 => '100MB', 2 => '250MB', 3 => '500MB', 4 => '1GB', 5 => '2GB',
6 => '3GB', 7 => '4GB', 8 => '8GB', 9 => '16GB', 10 => '32GB', 11 => '64GB'
],
'results' => $results, 'sadvanced' => ($searchType != "basic"),
'grouplist' => $groups->getGroupsForSelect(),
'catlist' => (new Category(['Settings' => $page->settings]))->getForSelect(),
'search_description' => $search_description,
'pager' => $page->smarty->fetch("pager.tpl")
]
);
$page->content = $page->smarty->fetch('search.tpl');
$page->render();
@@ -662,6 +662,15 @@
</td>
</tr>
<tr>
<td style="width:180px;"><label for="disablebackfillgroup">Auto disable groups during Backfill:</label></td>
<td>
{html_radios id="disablebackfillgroup" name='disablebackfillgroup' values=$yesno_ids output=$yesno_names selected=$fsite->disablebackfillgroup separator='<br />'}
<div class="hint">Whether to disable a group automatically during backfill if the target date has been reached.</div>
</td>
</tr>
<tr>
</table>
</fieldset>
@@ -1610,6 +1619,15 @@
</td>
</tr>
</tr>
<tr>
<td style="width:180px;"><label for="privateprofiles">Private Profiles:</label></td>
<td>
{html_radios id="privateprofiles" name='privateprofiles' values=$yesno_ids output=$yesno_names selected=$fsite->privateprofiles separator='<br />'}
<div class="hint">Should we <strong>disallow</strong> users from accessing profiles other than their own? (regardless of this setting admin/mod can access).</div>
</td>
</tr>
<tr>
<td style="width:130px;"><label for="userdownloadpurgedays">User Downloads Purge Days</label>:</td>
<td>
@@ -25,10 +25,12 @@
{$result.message|escape:"htmlall"|truncate:200:'...':false:false}
</div>
</td>
<td>
<a title="View profile" href="{$smarty.const.WWW_TOP}/profile/?name={$result.username}">{$result.username}</a>
<br/>
on <span title="{$result.createddate}">{$result.createddate|date_format}</span> <div class="hint">({$result.createddate|timeago})</div>
{if !$privateprofiles || $isadmin || $ismod}
<a title="View profile" href="{$smarty.const.WWW_TOP}/profile/?name={$result.username}">{$result.username}</a><br>
{else}
{$result.username}
{/if}
<span title="{$result.createddate}">{$result.createddate|date_format}</span> <div class="hint">({$result.createddate|timeago})</div>
</td>
<td>
<a href="{$smarty.const.WWW_TOP}/forumpost/{$result.id}#last" title="{$result.updateddate}">{$result.updateddate|date_format}</a> <div class="hint">({$result.updateddate|timeago})</div>
@@ -17,10 +17,11 @@
{foreach from=$results item=result name=result}
<tr class="{cycle values=",alt"}">
<td width="15%;">
{if $result.isadmin == 1}<strong>{/if}
<a {if $smarty.foreach.result.last}id="last"{/if} title="{if $result.isadmin == 1}Admin{else}View profile{/if}" href="{$smarty.const.WWW_TOP}/profile/?name={$result.username}">{$result.username}</a>
{if $result.isadmin == 1}</strong>{/if}
<br/>
{if !$privateprofiles || $isadmin || $ismod}
<a {if $smarty.foreach.result.last}id="last"{/if} title="View profile" href="{$smarty.const.WWW_TOP}/profile/?name={$result.username}">{$result.username}</a>
{else}
{$result.username}
{/if}
on <span title="{$result.createddate}">{$result.createddate|date_format}</span> <div class="hint">({$result.createddate|timeago})</div>
{if $userdata.role==2}
<div>
@@ -3,14 +3,14 @@
<table class="data">
<tr><th>Username:</th><td>{$user.username|escape:"htmlall"}</td></tr>
{if $user.id==$userdata.id || $userdata.role==2}<tr><th title="Not public">Email:</th><td>{$user.email}</td></tr>{/if}
{if $isadmin || !$publicview}<tr><th title="Not public">Email:</th><td>{$user.email}</td></tr>{/if}
<tr><th>Registered:</th><td title="{$user.createddate}">{$user.createddate|date_format} ({$user.createddate|timeago} ago)</td></tr>
<tr><th>Last Login:</th><td title="{$user.lastlogin}">{$user.lastlogin|date_format} ({$user.lastlogin|timeago} ago)</td></tr>
<tr><th>Role:</th><td>{$user.rolename}</td></tr>
<tr><th>Theme:</th><td>{$user.style}</td></tr>
{if $userdata.role==2}<tr><th title="Admin Notes">Notes:</th><td>{$user.notes|escape:htmlall}{if $user.notes|count_characters > 0}<br/>{/if}<a href="{$smarty.const.WWW_TOP}/admin/user-edit.php?id={$user.id}#notes">Add/Edit</a></td></tr>{/if}
{if $user.id==$userdata.id || $userdata.role==2}<tr><th title="Not public">Site Api/Rss Key:</th><td><a href="{$smarty.const.WWW_TOP}/rss?t=0&amp;dl=1&amp;i={$user.id}&amp;r={$user.rsstoken}">{$user.rsstoken}</a></td></tr>{/if}
{if $user.id==$userdata.id || $userdata.role==2}
{if $isadmin || !$publicview}<tr><th title="Not public">Site Api/Rss Key:</th><td><a href="{$smarty.const.WWW_TOP}/rss?t=0&amp;dl=1&amp;i={$user.id}&amp;r={$user.rsstoken}">{$user.rsstoken}</a></td></tr>{/if}
{if $isadmin || !$publicview}
<tr><th>API Hits Today:</th><td><span id="uatd">{$apihits.num}</span> {if $userdata.role==2 && $apihits.num > 0}<a onclick="resetapireq({$user.id}, 'api'); document.getElementById('uatd').innerHTML='0'; return false;" href="#">Reset</a>{/if}</td></tr>
<tr><th>Grabs Today:</th><td><span id="ugrtd">{$grabstoday.num}</span> {if $grabstoday.num >= $user.downloadrequests}&nbsp;&nbsp;<small>(Next DL in {($grabstoday.nextdl/3600)|intval}h {($grabstoday.nextdl/60) % 60}m)</small>{/if}{if $userdata.role==2 && $grabstoday.num > 0}<a onclick="resetapireq({$user.id}, 'grabs'); document.getElementById('ugrtd').innerHTML='0'; return false;" href="#">Reset</a>{/if}</td></tr>
{/if}
@@ -37,8 +37,17 @@
{/if}
{if $userinvitedby && $userinvitedby.username != ""}
<tr><th>Invited By:</th><td><a title="View {$userinvitedby.username}'s profile" href="{$smarty.const.WWW_TOP}/profile?name={$userinvitedby.username}">{$userinvitedby.username}</a></td>
{/if}
<tr>
<th>Invited By:</th>
<td>
{if $privileged || !$privateprofiles}
<a title="View {$userinvitedby.username}'s profile" href="{$smarty.const.WWW_TOP}/profile?name={$userinvitedby.username}">{$userinvitedby.username}</a>
{else}
{$userinvitedby.username}
{/if}
</td>
</tr>{/if}
<tr><th>UI Preferences:</th>
<td>
@@ -50,8 +59,8 @@
{if $user.bookview == "1"}View book covers{else}View standard book category{/if}
</td>
</tr>
{if $user.id==$userdata.id || $userdata.role==2}<tr><th title="Not public">Excluded Categories:</th><td>{$exccats|replace:",":"<br/>"}</td></tr>{/if}
{if $page->site->sabintegrationtype == 2 && $user.id==$userdata.id}
{if $isadmin || !$publicview}<tr><th title="Not public">Excluded Categories:</th><td>{$exccats|replace:",":"<br/>"}</td></tr>{/if}
{if $page->settings->getSetting('sabintegrationtype') == 2 && $user.id==$userdata.id}
<tr><th>SABnzbd Integration:</th>
<td>
Url: {if $saburl == ''}N/A{else}{$saburl}{/if}<br/>
@@ -42,7 +42,7 @@
<fieldset>
<legend>Site Preferences</legend>
<table class="input">
{if $page->site->userselstyle == 1}
{if $page->settings->getSetting('userselstyle') == 1}
<tr>
<th>Site theme:</th>
<td>
@@ -113,7 +113,7 @@
</table>
</fieldset>
{if $page->site->sabintegrationtype != 1}
{if $page->settings->getSetting('sabintegrationtype') != 1}
<fieldset>
<legend>Queue Type</legend>
<table class="table table-condensed input">
@@ -130,7 +130,7 @@
</table>
</fieldset>
{/if}
{if $user.queuetype == 2 && ($page->site->sabintegrationtype == 0 || $page->site->sabintegrationtype == 2)}
{if $user.queuetype == 2 && ($page->settings->getSetting('sabintegrationtype') == 0 || $page->settings->getSetting('sabintegrationtype') == 2)}
<fieldset>
<legend>NZBGet Integration</legend>
<table class="table table-condensed input">
@@ -164,7 +164,7 @@
</table>
</fieldset>
{/if}
{if $user.queuetype == 1 && $page->site->sabintegrationtype == 2}
{if $user.queuetype == 1 && $page->settings->getSetting('sabintegrationtype') == 2}
<fieldset>
<legend>SABnzbd Integration</legend>
<table class="input">
@@ -575,14 +575,10 @@
{foreach from=$comments|@array_reverse:true item=comment}
<tr>
<td class="less" title="{$comment.createddate}">
{if $comment.role == -1}<i class="icon-globe" title="Syndicated User"></i>
{$comment.username}{if $isadmin} @<a href="{$smarty.const.WWW_TOP}/admin/spotnab-edit.php?id={$comment.sourceid}&amp;from={$smarty.server.REQUEST_URI}">{$comment.rolename}</a>{/if}
{elseif $comment.role == 2}<i class="icon-font" title="{$comment.rolename}"></i>
<strong><a title="View {$comment.username}'s profile" href="{$smarty.const.WWW_TOP}/profile?name={$comment.username}">{$comment.username}</a></strong>
{elseif $comment.role == 4}<i class="icon-certificate" title="{$comment.rolename}"></i>
<a title="View {$comment.username}'s profile" href="{$smarty.const.WWW_TOP}/profile?name={$comment.username}">{$comment.username}</a>
{else}<i class="icon-user" title="{$comment.username}"></i>
{if !$privateprofiles || $isadmin || $ismod}
<a title="View {$comment.username}'s profile" href="{$smarty.const.WWW_TOP}/profile?name={$comment.username}">{$comment.username}</a>
{else}
{$comment.username}
{/if}
<br/>{$comment.createddate|daysago}
</td>
@@ -1,10 +1,10 @@
{if $error == ''}
{if $page->site->sabintegrationtype > 0 || $user.queuetype == 2}
{if $page->settings->getSetting('sabintegrationtype') > 0 || $user.queuetype == 2}
<p style="text-align:center;">
The following queue is pulled from
<a href="{$serverURL|escape:"htmlall"}">{$serverURL|escape:"htmlall"}</a>.
<br />
{if $page->site->sabintegrationtype == 2 || $user.queuetype == 2}Edit your queue settings in <a href="{$smarty.const.WWW_TOP}/profileedit">your profile</a>.{/if}
{if $page->settings->getSetting('sabintegrationtype') == 2 || $user.queuetype == 2}Edit your queue settings in <a href="{$smarty.const.WWW_TOP}/profileedit">your profile</a>.{/if}
</p>
<div class="sab_queue"></div>
{if $user.queuetype == 2}