From 2b917ccd28ecf75a5fbc20f332596852b35fbeee Mon Sep 17 00:00:00 2001 From: Darko Date: Mon, 9 Mar 2015 12:47:47 +0100 Subject: [PATCH] Fisrt batch of updates. Renaming all the columns into lower case names used. --- bin/fixreleasenames.php | 20 +- bin/groupfixrelnames.php | 40 +- bin/monitor.php | 2 +- bin/update_releases.php | 4 +- lib/DB/db.sql | 200 ++++----- lib/DB/patches/0008_releases.sql | 2 +- lib/DB/patches/0009_releases.sql | 2 +- lib/DB/patches/0010_releases.sql | 2 +- lib/DB/patches/0015_sharing.sql | 4 +- lib/DB/patches/0019_sharing.sql | 2 +- lib/DB/patches/0022_releases.sql | 2 +- lib/DB/patches/0029_releases.sql | 2 +- lib/DB/patches/0032_releases.sql | 4 +- lib/DB/patches/0033_releases.sql | 4 +- lib/DB/patches/0038_releasesearch.sql | 14 +- lib/DB/patches/0041_predbhash.sql | 6 +- lib/DB/patches/0042_predbhash.sql | 2 +- lib/DB/patches/0044_releasecomment.sql | 2 +- lib/DB/patches/0046_releasecomment.sql | 2 +- lib/DB/patches/0050_category.sql | 134 +++--- lib/DB/patches/0054~releases.sql | 2 +- lib/DB/patches/0066~genres.sql | 6 +- lib/DB/patches/0072~site.sql | 12 +- lib/DB/patches/0086~category.sql | 2 +- lib/DB/patches/0091~releasesearch.sql | 6 +- lib/DB/patches/0093~anidb.sql | 6 +- lib/DB/patches/0099~releases.sql | 24 +- lib/DB/patches/0100~binaries.sql | 2 +- lib/DB/patches/0106~category.sql | 2 +- lib/DB/patches/0110~category.sql | 4 +- lib/DB/patches/0112~category.sql | 2 +- lib/DB/patches/0113~releases.sql | 2 +- lib/Film.php | 84 ++-- lib/IRCScraper.php | 16 +- lib/Info.php | 44 +- lib/Konsole.php | 50 +-- lib/MiscSorter.php | 62 +-- lib/NZBGet.php | 4 +- lib/Pprocess.php | 24 +- lib/ProcessAdditional.php | 138 +++--- lib/ReleaseRemover.php | 116 ++--- lib/Sharing.php | 36 +- lib/TvAnger.php | 136 +++--- lib/copy_this/misc/sphinxsearch/sphinx.conf | 2 +- .../misc/sphinxsearch/toggle_search_type.php | 24 +- lib/copy_this/misc/update_scripts/import.php | 14 +- .../multiprocessing/.do_not_run/switch.php | 24 +- .../nix_scripts/multiprocessing/Forking.php | 72 +-- .../nix_scripts/multiprocessing/README.md | 4 +- .../www/admin/ajax_sharing_settings.php | 10 +- lib/copy_this/www/admin/sharing.php | 2 +- lib/copy_this/www/admin/site-edit.php | 6 +- lib/copy_this/www/admin/user-edit.php | 8 +- lib/copy_this/www/lib/Books.php | 56 +-- lib/copy_this/www/lib/Categorize.php | 20 +- lib/copy_this/www/lib/CollectionsCleaning.php | 2 +- lib/copy_this/www/lib/Enzebe.php | 22 +- lib/copy_this/www/lib/Games.php | 38 +- lib/copy_this/www/lib/GiantBombAPI.php | 16 +- lib/copy_this/www/lib/Logger.php | 2 +- lib/copy_this/www/lib/Musik.php | 42 +- lib/copy_this/www/lib/NZBImport.php | 24 +- .../www/lib/Net_NNTP/NNTP/Client.php | 14 +- .../www/lib/Net_NNTP/NNTP/Protocol/Client.php | 2 +- lib/copy_this/www/lib/Regexes.php | 2 +- lib/copy_this/www/lib/ReleaseCleaning.php | 18 +- lib/copy_this/www/lib/ReleaseSearch.php | 4 +- lib/copy_this/www/lib/RequestID.php | 30 +- lib/copy_this/www/lib/RequestIDLocal.php | 64 +-- lib/copy_this/www/lib/RequestIDWeb.php | 82 ++-- lib/copy_this/www/lib/SphinxSearch.php | 2 +- lib/copy_this/www/lib/Tmux.php | 34 +- lib/copy_this/www/lib/TmuxOutput.php | 2 +- lib/copy_this/www/lib/XXX.php | 36 +- lib/copy_this/www/lib/anidb.php | 2 +- lib/copy_this/www/lib/backfill.php | 4 +- lib/copy_this/www/lib/binaries.php | 56 +-- lib/copy_this/www/lib/book.php | 78 ++-- lib/copy_this/www/lib/category.php | 38 +- lib/copy_this/www/lib/console.php | 40 +- lib/copy_this/www/lib/content.php | 2 +- lib/copy_this/www/lib/episode.php | 4 +- lib/copy_this/www/lib/forum.php | 24 +- lib/copy_this/www/lib/framework/basepage.php | 2 +- lib/copy_this/www/lib/genres.php | 20 +- lib/copy_this/www/lib/groups.php | 64 +-- lib/copy_this/www/lib/menu.php | 8 +- lib/copy_this/www/lib/movie.php | 120 ++--- lib/copy_this/www/lib/music.php | 46 +- lib/copy_this/www/lib/nfo.php | 46 +- lib/copy_this/www/lib/nntp.php | 28 +- lib/copy_this/www/lib/nzb.php | 16 +- lib/copy_this/www/lib/nzbvortex.php | 72 +-- lib/copy_this/www/lib/parsing.php | 138 +++--- lib/copy_this/www/lib/postprocess.php | 48 +- lib/copy_this/www/lib/powerprocess.php | 384 ++++++++-------- lib/copy_this/www/lib/predb.php | 16 +- lib/copy_this/www/lib/releasecomments.php | 24 +- lib/copy_this/www/lib/releaseextra.php | 30 +- lib/copy_this/www/lib/releasefiles.php | 10 +- lib/copy_this/www/lib/releaseregex.php | 66 +-- lib/copy_this/www/lib/releases.php | 424 +++++++++--------- lib/copy_this/www/lib/rottentomato.php | 6 +- lib/copy_this/www/lib/sabnzbd.php | 4 +- .../smarty_cacheresource_keyvaluestore.php | 2 +- .../smarty_internal_configfileparser.php | 4 +- .../sysplugins/smarty_internal_template.php | 2 +- .../smarty_internal_templatelexer.php | 2 +- .../smarty_internal_templateparser.php | 82 ++-- .../lib/smarty/sysplugins/smarty_resource.php | 2 +- lib/copy_this/www/lib/sphinx.php | 148 +++--- lib/copy_this/www/lib/spotnab.php | 108 ++--- lib/copy_this/www/lib/thetvdb.php | 62 +-- lib/copy_this/www/lib/tvrage.php | 72 +-- lib/copy_this/www/lib/usermovies.php | 10 +- lib/copy_this/www/lib/users.php | 94 ++-- lib/copy_this/www/lib/userseries.php | 12 +- lib/copy_this/www/lib/util.php | 6 +- lib/copy_this/www/pages/api.php | 28 +- lib/copy_this/www/pages/browse.php | 12 +- lib/copy_this/www/pages/console.php | 4 +- lib/copy_this/www/pages/details.php | 52 +-- lib/copy_this/www/pages/forgottenpassword.php | 6 +- lib/copy_this/www/pages/games.php | 4 +- lib/copy_this/www/pages/getnzb.php | 4 +- lib/copy_this/www/pages/login.php | 2 +- lib/copy_this/www/pages/movies.php | 2 +- lib/copy_this/www/pages/music.php | 2 +- lib/copy_this/www/pages/nfo.php | 2 +- lib/copy_this/www/pages/prehashinfo.php | 14 +- lib/copy_this/www/pages/profileedit.php | 2 +- lib/copy_this/www/pages/register.php | 2 +- lib/copy_this/www/pages/series.php | 2 +- lib/copy_this/www/pages/xxx.php | 2 +- lib/copy_this/www/populate/AniDB.php | 12 +- .../www/processing/ProcessReleases.php | 142 +++--- lib/copy_this/www/processing/post/AniDB.php | 18 +- .../templates/nntmux/scripts/jquery-1.9.1.js | 36 +- .../nntmux/views/admin/ajax_release-edit.tpl | 12 +- .../nntmux/views/admin/book-edit.tpl | 6 +- .../nntmux/views/admin/book-list.tpl | 10 +- .../nntmux/views/admin/category-edit.tpl | 4 +- .../nntmux/views/admin/category-list.tpl | 8 +- .../nntmux/views/admin/comments-list.tpl | 2 +- .../nntmux/views/admin/console-edit.tpl | 8 +- .../nntmux/views/admin/console-list.tpl | 10 +- .../nntmux/views/admin/group-edit.tpl | 6 +- .../nntmux/views/admin/group-list.tpl | 16 +- .../nntmux/views/admin/menu-edit.tpl | 4 +- .../nntmux/views/admin/menu-list.tpl | 8 +- .../nntmux/views/admin/movie-add.tpl | 4 +- .../nntmux/views/admin/movie-edit.tpl | 12 +- .../nntmux/views/admin/movie-list.tpl | 16 +- .../nntmux/views/admin/music-edit.tpl | 8 +- .../nntmux/views/admin/music-list.tpl | 10 +- .../nntmux/views/admin/nzb-export.tpl | 6 +- .../nntmux/views/admin/preview-list.tpl | 10 +- .../nntmux/views/admin/rage-edit.tpl | 14 +- .../nntmux/views/admin/rage-list.tpl | 10 +- .../nntmux/views/admin/regex-edit.tpl | 18 +- .../nntmux/views/admin/regex-list.tpl | 14 +- .../nntmux/views/admin/regex-submit.tpl | 4 +- .../nntmux/views/admin/regex-test.tpl | 16 +- .../nntmux/views/admin/release-edit.tpl | 24 +- .../nntmux/views/admin/release-list.tpl | 8 +- .../admin/release_naming_regexes-test.tpl | 2 +- .../nntmux/views/admin/role-edit.tpl | 8 +- .../nntmux/views/admin/role-list.tpl | 8 +- .../templates/nntmux/views/admin/sharing.tpl | 14 +- .../nntmux/views/admin/site-edit.tpl | 12 +- .../nntmux/views/admin/site-stats.tpl | 20 +- .../nntmux/views/admin/spotnab-edit.tpl | 14 +- .../nntmux/views/admin/spotnab-list.tpl | 10 +- .../nntmux/views/admin/thetvdb-edit.tpl | 8 +- .../nntmux/views/admin/thetvdb-list.tpl | 8 +- .../nntmux/views/admin/thetvdb-remove.tpl | 2 +- .../nntmux/views/admin/tmux-edit.tpl | 4 +- .../nntmux/views/admin/user-edit.tpl | 10 +- .../nntmux/views/admin/user-list.tpl | 12 +- .../nntmux/views/frontend/apicaps.tpl | 16 +- .../nntmux/views/frontend/apicomments.tpl | 6 +- .../nntmux/views/frontend/apidetail.tpl | 48 +- .../nntmux/views/frontend/basepage.tpl | 6 +- .../templates/nntmux/views/frontend/books.tpl | 4 +- .../nntmux/views/frontend/browse.tpl | 26 +- .../templates/nntmux/views/frontend/cart.tpl | 4 +- .../nntmux/views/frontend/console.tpl | 12 +- .../nntmux/views/frontend/dlbrowse.tpl | 32 +- .../templates/nntmux/views/frontend/forum.tpl | 12 +- .../nntmux/views/frontend/forumpost.tpl | 6 +- .../templates/nntmux/views/frontend/games.tpl | 2 +- .../nntmux/views/frontend/headermenu.tpl | 44 +- .../nntmux/views/frontend/movies.tpl | 22 +- .../templates/nntmux/views/frontend/music.tpl | 10 +- .../nntmux/views/frontend/mymovies.tpl | 2 +- .../nntmux/views/frontend/mymoviesedit.tpl | 12 +- .../nntmux/views/frontend/myshows.tpl | 12 +- .../nntmux/views/frontend/newposterwall.tpl | 16 +- .../nntmux/views/frontend/prehash.tpl | 8 +- .../nntmux/views/frontend/profile.tpl | 24 +- .../views/frontend/recentforumposts.tpl | 8 +- .../templates/nntmux/views/frontend/rss.tpl | 74 +-- .../nntmux/views/frontend/rssdesc.tpl | 52 +-- .../nntmux/views/frontend/search.tpl | 16 +- .../nntmux/views/frontend/searchraw.tpl | 14 +- .../nntmux/views/frontend/viewanime.tpl | 8 +- .../nntmux/views/frontend/viewbook.tpl | 2 +- .../nntmux/views/frontend/viewcalendar.tpl | 6 +- .../nntmux/views/frontend/viewconsole.tpl | 2 +- .../nntmux/views/frontend/viewmovie.tpl | 4 +- .../nntmux/views/frontend/viewmoviefull.tpl | 4 +- .../nntmux/views/frontend/viewmusic.tpl | 4 +- .../nntmux/views/frontend/viewnzb.tpl | 72 +-- .../nntmux/views/frontend/viewseries.tpl | 24 +- .../nntmux/views/frontend/viewserieslist.tpl | 14 +- .../nntmux/views/frontend/viewxxx.tpl | 4 +- .../templates/nntmux/views/frontend/xxx.tpl | 2 +- lib/decrypt_hashes.php | 8 +- lib/namefixer.php | 184 ++++---- lib/nzbcontents.php | 20 +- lib/prehash.php | 36 +- lib/removeCrapReleases.php | 2 +- lib/requestid.php | 4 +- lib/testing/DB/change_USP_provider.php | 4 +- lib/testing/DB/convert_to_tpg.php | 10 +- lib/testing/DB/populate_nzb_guid.php | 12 +- lib/testing/DB/reset_postprocessing.php | 82 ++-- lib/testing/DB/resetdb.php | 2 +- lib/testing/Dev/renametopre.php | 80 ++-- lib/testing/PostProc/getConsole.php | 2 +- lib/testing/PostProc/getImdb.php | 4 +- lib/testing/PostProc/getMovieCovers.php | 4 +- lib/testing/PostProc/populate_tvrage.php | 4 +- lib/testing/PostProc/updateBookImages.php | 10 +- lib/testing/PostProc/updateConsoleImages.php | 12 +- lib/testing/PostProc/updateMovieImages.php | 26 +- lib/testing/PostProc/updateMusicImages.php | 12 +- lib/testing/PostProc/updateTvRage.php | 8 +- lib/testing/_run_once/tpg_fixes.php | 14 +- lib/testing/predb_import_daily_batch.php | 20 +- lib/testing/recategorize.php | 32 +- python/binaries_threaded.py | 4 +- python/fixreleasenames_threaded.py | 18 +- python/groupfixrelnames_threaded.py | 6 +- python/nntpproxy.py | 4 +- python/postprocess_threaded.py | 46 +- python/requestid_threaded.py | 2 +- python/update_threaded.py | 2 +- 248 files changed, 3195 insertions(+), 3195 deletions(-) diff --git a/bin/fixreleasenames.php b/bin/fixreleasenames.php index 7cacb209f..105a8d91b 100644 --- a/bin/fixreleasenames.php +++ b/bin/fixreleasenames.php @@ -18,11 +18,11 @@ if (!isset($argv[1])) { $pieces = explode(' ', $argv[1]); if (isset($pieces[1]) && $pieces[0] == 'nfo') { $release = $pieces[1]; - if ($res = $db->queryOneRow(sprintf('SELECT rel.guid AS guid, nfo.releaseID AS nfoid, rel.groupID, rel.categoryID, rel.name, rel.searchname, uncompress(nfo) AS textstring, rel.ID AS releaseID FROM releases rel INNER JOIN releasenfo nfo ON (nfo.releaseID = rel.ID) WHERE rel.ID = %d', $release))) { + if ($res = $db->queryOneRow(sprintf('SELECT rel.guid AS guid, nfo.releaseid AS nfoid, rel.groupid, rel.categoryid, rel.name, rel.searchname, uncompress(nfo) AS textstring, rel.id AS releaseid FROM releases rel INNER JOIN releasenfo nfo ON (nfo.releaseid = rel.id) WHERE rel.id = %d', $release))) { //ignore encrypted nfos if (preg_match('/^=newz\[NZB\]=\w+/', $res['textstring'])) { $namefixer->done = $namefixer->matched = false; - $db->queryDirect(sprintf('UPDATE releases SET proc_nfo = 1 WHERE ID = %d', $res['releaseID'])); + $db->queryDirect(sprintf('UPDATE releases SET proc_nfo = 1 WHERE id = %d', $res['releaseid'])); $namefixer->checked++; echo '.'; } else { @@ -36,9 +36,9 @@ if (!isset($argv[1])) { } } else if (isset($pieces[1]) && $pieces[0] == 'filename') { $release = $pieces[1]; - if ($res = $db->queryOneRow(sprintf('SELECT relfiles.name AS textstring, rel.categoryID, rel.searchname, ' - . 'rel.groupID, relfiles.releaseID AS fileid, rel.ID AS releaseID, rel.name FROM releases rel ' - . 'INNER JOIN releasefiles relfiles ON (relfiles.releaseID = rel.ID) WHERE rel.ID = %d', $release))) { + if ($res = $db->queryOneRow(sprintf('SELECT relfiles.name AS textstring, rel.categoryid, rel.searchname, ' + . 'rel.groupid, relfiles.releaseid AS fileid, rel.id AS releaseid, rel.name FROM releases rel ' + . 'INNER JOIN releasefiles relfiles ON (relfiles.releaseid = rel.id) WHERE rel.id = %d', $release))) { $namefixer->done = $namefixer->matched = false; if ($namefixer->checkName($res, true, 'Filenames, ', 1, 1) !== true) { echo '.'; @@ -47,13 +47,13 @@ if (!isset($argv[1])) { } } else if (isset($pieces[1]) && $pieces[0] == 'md5') { $release = $pieces[1]; - if ($res = $db->queryOneRow(sprintf('SELECT r.ID AS releaseID, r.name, r.searchname, r.categoryID, r.groupID, dehashstatus, rf.name AS filename FROM releases r LEFT JOIN releasefiles rf ON r.ID = rf.releaseID WHERE r.ID = %d', $release))) { + if ($res = $db->queryOneRow(sprintf('SELECT r.id AS releaseid, r.name, r.searchname, r.categoryid, r.groupid, dehashstatus, rf.name AS filename FROM releases r LEFT JOIN releasefiles rf ON r.id = rf.releaseid WHERE r.id = %d', $release))) { if (preg_match('/[a-fA-F0-9]{32,40}/i', $res['name'], $matches)) { $namefixer->matchPredbHash($matches[0], $res, 1, 1, true, 1); } else if (preg_match('/[a-fA-F0-9]{32,40}/i', $res['filename'], $matches)) { $namefixer->matchPredbHash($matches[0], $res, 1, 1, true, 1); } else { - $db->queryExec(sprintf("UPDATE releases SET dehashstatus = %d - 1 WHERE ID = %d", $res['dehashstatus'], $res['releaseID'])); + $db->queryExec(sprintf("UPDATE releases SET dehashstatus = %d - 1 WHERE id = %d", $res['dehashstatus'], $res['releaseid'])); echo '.'; } } @@ -76,8 +76,8 @@ if (!isset($argv[1])) { } else if (isset($pieces[1]) && $pieces[0] == 'predbft') { $pre = $pieces[1]; - if ($res = $db->queryOneRow(sprintf('SELECT ID AS preid, title, source, searched FROM prehash ' - . 'WHERE ID = %d', $pre + if ($res = $db->queryOneRow(sprintf('SELECT id AS preid, title, source, searched FROM prehash ' + . 'WHERE id = %d', $pre ) ) ) { @@ -93,7 +93,7 @@ if (!isset($argv[1])) { $searched = $res['searched'] - 1; echo "."; } - $db->queryExec(sprintf("UPDATE prehash SET searched = %d WHERE ID = %d", $searched, $res['preid'])); + $db->queryExec(sprintf("UPDATE prehash SET searched = %d WHERE id = %d", $searched, $res['preid'])); $namefixer->checked++; } diff --git a/bin/groupfixrelnames.php b/bin/groupfixrelnames.php index 6c41faa21..5f198cbcf 100644 --- a/bin/groupfixrelnames.php +++ b/bin/groupfixrelnames.php @@ -25,15 +25,15 @@ if (!isset($argv[1])) { case $pieces[0] === 'nfo' && isset($guidChar) && isset($maxperrun) && is_numeric($maxperrun): $releases = $pdo->queryDirect( sprintf(' - SELECT r.ID AS releaseID, r.guid, r.groupID, r.categoryID, r.name, r.searchname, + SELECT r.id AS releaseid, r.guid, r.groupid, r.categoryid, r.name, r.searchname, uncompress(nfo) AS textstring FROM releases r - INNER JOIN releasenfo rn ON r.ID = rn.releaseID + INNER JOIN releasenfo rn ON r.id = rn.releaseid WHERE r.guid %s AND r.nzbstatus = 1 AND r.proc_nfo = 0 AND r.nfostatus = 1 - AND r.prehashID = 0 + AND r.prehashid = 0 ORDER BY r.postdate DESC LIMIT %s', $pdo->likeString($guidChar, false, true), @@ -45,7 +45,7 @@ if (!isset($argv[1])) { foreach ($releases as $release) { if (preg_match('/^=newz\[NZB\]=\w+/', $release['textstring'])) { $namefixer->done = $namefixer->matched = false; - $pdo->queryDirect(sprintf('UPDATE releases SET proc_nfo = 1 WHERE ID = %d', $release['releaseID'])); + $pdo->queryDirect(sprintf('UPDATE releases SET proc_nfo = 1 WHERE id = %d', $release['releaseid'])); $namefixer->checked++; echo '.'; } else { @@ -61,13 +61,13 @@ if (!isset($argv[1])) { case $pieces[0] === 'filename' && isset($guidChar) && isset($maxperrun) && is_numeric($maxperrun): $releases = $pdo->queryDirect( sprintf(' - SELECT rf.name AS textstring, rf.releaseID AS fileid, - r.ID AS releaseID, r.name, r.searchname, r.categoryID, r.groupID + SELECT rf.name AS textstring, rf.releaseid AS fileid, + r.id AS releaseid, r.name, r.searchname, r.categoryid, r.groupid FROM releases r - INNER JOIN releasefiles rf ON r.ID = rf.releaseID + INNER JOIN releasefiles rf ON r.id = rf.releaseid WHERE r.guid %s AND r.nzbstatus = 1 AND r.proc_files = 0 - AND r.prehashID = 0 + AND r.prehashid = 0 ORDER BY r.postdate ASC LIMIT %s', $pdo->likeString($guidChar, false, true), @@ -88,14 +88,14 @@ if (!isset($argv[1])) { case $pieces[0] === 'md5' && isset($guidChar) && isset($maxperrun) && is_numeric($maxperrun): $releases = $pdo->queryDirect( sprintf(' - SELECT DISTINCT r.ID AS releaseID, r.name, r.searchname, r.categoryID, r.groupID, r.dehashstatus, + SELECT DISTINCT r.id AS releaseid, r.name, r.searchname, r.categoryid, r.groupid, r.dehashstatus, rf.name AS filename FROM releases r - LEFT OUTER JOIN releasefiles rf ON r.ID = rf.releaseID AND rf.ishashed = 1 + LEFT OUTER JOIN releasefiles rf ON r.id = rf.releaseid AND rf.ishashed = 1 WHERE r.guid %s AND nzbstatus = 1 AND r.ishashed = 1 AND r.dehashstatus BETWEEN -6 AND 0 - AND r.prehashID = 0 + AND r.prehashid = 0 ORDER BY r.dehashstatus DESC, r.postdate ASC LIMIT %s', $pdo->likeString($guidChar, false, true), @@ -110,7 +110,7 @@ if (!isset($argv[1])) { } else if (preg_match('/[a-fA-F0-9]{32,40}/i', $release['filename'], $matches)) { $namefixer->matchPredbHash($matches[0], $release, 1, 1, true, 1); } else { - $pdo->queryExec(sprintf("UPDATE releases SET dehashstatus = %d - 1 WHERE ID = %d", $release['dehashstatus'], $release['releaseID'])); + $pdo->queryExec(sprintf("UPDATE releases SET dehashstatus = %d - 1 WHERE id = %d", $release['dehashstatus'], $release['releaseid'])); echo '.'; } } @@ -119,12 +119,12 @@ if (!isset($argv[1])) { case $pieces[0] === 'par2' && isset($guidChar) && isset($maxperrun) && is_numeric($maxperrun): $releases = $pdo->queryDirect( sprintf(' - SELECT r.ID AS releaseID, r.guid, r.groupID + SELECT r.id AS releaseid, r.guid, r.groupid FROM releases r WHERE r.guid %s AND r.nzbstatus = 1 AND r.proc_par2 = 0 - AND r.prehashID = 0 + AND r.prehashid = 0 ORDER BY r.postdate ASC LIMIT %s', $pdo->likeString($guidChar, false, true), @@ -146,7 +146,7 @@ if (!isset($argv[1])) { ) ); foreach ($releases as $release) { - $res = $nzbcontents->checkPAR2($release['guid'], $release['releaseID'], $release['groupID'], 1, 1); + $res = $nzbcontents->checkPAR2($release['guid'], $release['releaseid'], $release['groupid'], 1, 1); if ($res === false) { echo '.'; } @@ -156,12 +156,12 @@ if (!isset($argv[1])) { case $pieces[0] === 'miscsorter' && isset($guidChar) && isset($maxperrun) && is_numeric($maxperrun): $releases = $pdo->queryDirect( sprintf(' - SELECT r.ID AS releaseID + SELECT r.id AS releaseid FROM releases r WHERE r.guid %s AND r.nzbstatus = 1 AND r.nfostatus = 1 AND r.proc_sorter = 0 AND r.isrenamed = 0 - AND r.prehashID = 0 + AND r.prehashid = 0 ORDER BY r.postdate DESC LIMIT %s', $pdo->likeString($guidChar, false, true), @@ -172,14 +172,14 @@ if (!isset($argv[1])) { if ($releases instanceof Traversable) { $sorter = new MiscSorter(true, $pdo); foreach ($releases as $release) { - $res = $sorter->nfosorter(null, $release['releaseID']); + $res = $sorter->nfosorter(null, $release['releaseid']); } } break; case $pieces[0] === 'predbft' && isset($maxperrun) && is_numeric($maxperrun) && isset($thread) && is_numeric($thread): $pres = $pdo->queryDirect( sprintf(' - SELECT p.ID AS prehashID, p.title, p.source, p.searched + SELECT p.id AS prehashid, p.title, p.source, p.searched FROM prehash p WHERE LENGTH(title) >= 15 AND title NOT REGEXP "[\"\<\> ]" AND searched = 0 @@ -206,7 +206,7 @@ if (!isset($argv[1])) { $searched = $pre['searched'] - 1; echo "."; } - $pdo->queryExec(sprintf("UPDATE prehash SET searched = %d WHERE ID = %d", $searched, $pre['prehashID'])); + $pdo->queryExec(sprintf("UPDATE prehash SET searched = %d WHERE id = %d", $searched, $pre['prehashid'])); $namefixer->checked++; } } diff --git a/bin/monitor.php b/bin/monitor.php index b056092d4..aa5182f4c 100644 --- a/bin/monitor.php +++ b/bin/monitor.php @@ -36,7 +36,7 @@ $tRun->runPane('scraper', $runVar); $runVar['panes'] = $tRun->getListOfPanes($runVar['constants']); //totals per category in db, results by parentID -$catcntqry = "SELECT c.parentID AS parentID, COUNT(r.ID) AS count FROM category c, releases r WHERE r.categoryID = c.ID GROUP BY c.parentID"; +$catcntqry = "SELECT c.parentID AS parentID, COUNT(r.id) AS count FROM category c, releases r WHERE r.categoryid = c.id GROUP BY c.parentID"; //create timers and set to now $runVar['timers']['timer1'] = $runVar['timers']['timer2'] = $runVar['timers']['timer3'] = diff --git a/bin/update_releases.php b/bin/update_releases.php index 1792676f0..a2494c42c 100644 --- a/bin/update_releases.php +++ b/bin/update_releases.php @@ -43,7 +43,7 @@ if (isset($argv[1]) && isset($argv[2])) { } else if ($argv[1] == 5 && ($argv[2] == 'true' || $argv[2] == 'false')) { echo $pdo->log->header("Categorizing all non-categorized releases in other->misc using usenet subject. This can take a while, be patient."); $timestart = TIME(); - $relcount = $releases->categorizeRelease('name', 'WHERE iscategorized = 0 AND categoryID = 8010'); + $relcount = $releases->categorizeRelease('name', 'WHERE iscategorized = 0 AND categoryid = 8010'); $time = $consoletools->convertTime(TIME() - $timestart); echo $pdo->log->primary("\n" . 'Finished categorizing ' . $relcount . ' releases in ' . $time . " seconds, using the usenet subject."); } else if ($argv[1] == 6 && $argv[2] == 'true') { @@ -56,7 +56,7 @@ if (isset($argv[1]) && isset($argv[2])) { } else if ($argv[1] == 6 && $argv[2] == 'false') { echo $pdo->log->header("Categorizing releases in misc sections using the searchname. This can take a while, be patient."); $timestart = TIME(); - $relcount = $releases->categorizeRelease('searchname', 'WHERE categoryID IN (1090, 2020, 3050, 5050, 6050, 8010)'); + $relcount = $releases->categorizeRelease('searchname', 'WHERE categoryid IN (1090, 2020, 3050, 5050, 6050, 8010)'); $consoletools = new \ConsoleTools(['ColorCLI' => $pdo->log]); $time = $consoletools->convertTime(TIME() - $timestart); echo $pdo->log->primary("\n" . 'Finished categorizing ' . $relcount . ' releases in ' . $time . " seconds, using the search name."); diff --git a/lib/DB/db.sql b/lib/DB/db.sql index 64d0a767e..327dea188 100644 --- a/lib/DB/db.sql +++ b/lib/DB/db.sql @@ -5,7 +5,7 @@ ADD `jpgstatus` TINYINT(1) NOT NULL DEFAULT 0, ADD `audiostatus` TINYINT(1) NOT NULL DEFAULT 0, ADD `videostatus` TINYINT(1) NOT NULL DEFAULT 0, ADD `reqidstatus` TINYINT(1) NOT NULL DEFAULT 0, -ADD `prehashID` INT UNSIGNED NOT NULL DEFAULT 0, +ADD `prehashid` INT UNSIGNED NOT NULL DEFAULT 0, ADD `iscategorized` BIT NOT NULL DEFAULT 0, ADD `isrenamed` BIT NOT NULL DEFAULT 0, ADD `ishashed` BIT NOT NULL DEFAULT 0, @@ -21,14 +21,14 @@ ADD `proc_sorter` TINYINT(1) NOT NULL DEFAULT '0'; CREATE INDEX `ix_releases_nfostatus` ON `releases` (`nfostatus` ASC) USING HASH; CREATE INDEX `ix_releases_reqidstatus` ON `releases` (`reqidstatus` ASC) USING HASH; CREATE INDEX `ix_releases_passwordstatus` ON `releases` (`passwordstatus`); -CREATE INDEX `ix_releases_releasenfoID` ON `releases` (`releasenfoID`); +CREATE INDEX `ix_releases_releasenfoID` ON `releases` (`releasenfoid`); CREATE INDEX `ix_releases_dehashstatus` ON `releases` (`dehashstatus`); CREATE INDEX `ix_releases_haspreview` ON `releases` (`haspreview` ASC) USING HASH; CREATE INDEX `ix_releases_postdate_name` ON `releases` (`postdate`, `name`); -CREATE INDEX `ix_releases_prehashid_searchname` ON `releases` (`prehashID`, `searchname`); +CREATE INDEX `ix_releases_prehashid_searchname` ON `releases` (`prehashid`, `searchname`); CREATE INDEX `ix_releases_gamesinfo_id` ON `releases` (`gamesinfo_id`); CREATE INDEX `ix_releases_xxxinfo_id` ON `releases` (`xxxinfo_id`); -CREATE INDEX `ix_releases_status` ON `releases` (`nzbstatus`, `iscategorized`, `isrenamed`, `nfostatus`, `ishashed`, `passwordstatus`, `dehashstatus`, `releasenfoID`, `musicinfoID`, `consoleinfoID`, `bookinfoID`, `haspreview`, `categoryID`, `imdbID`, `rageID`); +CREATE INDEX `ix_releases_status` ON `releases` (`nzbstatus`, `iscategorized`, `isrenamed`, `nfostatus`, `ishashed`, `passwordstatus`, `dehashstatus`, `releasenfoid`, `musicinfoid`, `consoleinfoid`, `bookinfoid`, `haspreview`, `categoryid`, `imdbid`, `rageid`); ALTER TABLE users ADD COLUMN gameview INT AFTER consoleview; ALTER TABLE users ADD COLUMN xxxview INT AFTER consoleview; @@ -39,7 +39,7 @@ ALTER TABLE users ADD COLUMN queuetype TINYINT(1) NOT NULL DEFAULT 1; DROP TABLE IF EXISTS prehash; CREATE TABLE prehash ( - ID INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, + id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, filename VARCHAR(255) NOT NULL DEFAULT '', title VARCHAR(255) NOT NULL DEFAULT '', nfo VARCHAR(255) NULL, @@ -47,13 +47,13 @@ CREATE TABLE prehash ( category VARCHAR(255) NULL, predate DATETIME DEFAULT NULL, source VARCHAR(50) NOT NULL DEFAULT '', - requestID INT(10) UNSIGNED NOT NULL DEFAULT '0', - groupID INT(10) UNSIGNED NOT NULL DEFAULT '0', + requestid INT(10) UNSIGNED NOT NULL DEFAULT '0', + groupid INT(10) UNSIGNED NOT NULL DEFAULT '0', nuked TINYINT(1) NOT NULL DEFAULT '0', nukereason VARCHAR(255) NULL, files VARCHAR(50) NULL, searched TINYINT(1) NOT NULL DEFAULT '0', - PRIMARY KEY (ID) + PRIMARY KEY (id) ) ENGINE =INNODB DEFAULT CHARACTER SET utf8 @@ -65,20 +65,20 @@ CREATE UNIQUE INDEX `ix_prehash_title` ON `prehash` (`title`); CREATE INDEX `ix_prehash_nfo` ON `prehash` (`nfo`); CREATE INDEX `ix_prehash_predate` ON `prehash` (`predate`); CREATE INDEX `ix_prehash_source` ON `prehash` (`source`); -CREATE INDEX `ix_prehash_requestid` ON `prehash` (`requestID`, `groupID`); +CREATE INDEX `ix_prehash_requestid` ON `prehash` (`requestid`, `groupid`); CREATE INDEX `ix_prehash_size` ON `prehash` (`size`); CREATE INDEX `ix_prehash_category` ON `prehash` (`category`); CREATE INDEX `ix_prehash_searched` ON `prehash` (`searched`); DROP TABLE IF EXISTS tmux; CREATE TABLE tmux ( - ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, + id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, setting VARCHAR(64) COLLATE utf8_unicode_ci NOT NULL, value VARCHAR(19000) COLLATE utf8_unicode_ci DEFAULT NULL, updateddate TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - PRIMARY KEY (ID), + PRIMARY KEY (id), UNIQUE KEY setting (setting) ) ENGINE =INNODB @@ -208,12 +208,12 @@ INSERT INTO tmux (setting, value) VALUES ('defrag_cache', '900'), DROP TABLE IF EXISTS releasesearch; CREATE TABLE releasesearch ( - ID INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, - releaseID INT(11) UNSIGNED NOT NULL, + id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, + releaseid INT(11) UNSIGNED NOT NULL, guid VARCHAR(50) NOT NULL, name VARCHAR(255) NOT NULL DEFAULT '', searchname VARCHAR(255) NOT NULL DEFAULT '', - PRIMARY KEY (ID) + PRIMARY KEY (id) ) ENGINE =MYISAM DEFAULT CHARSET =utf8 @@ -221,15 +221,15 @@ CREATE TABLE releasesearch ( AUTO_INCREMENT =1; CREATE FULLTEXT INDEX ix_releasesearch_name_searchname_ft ON releasesearch (name, searchname); -CREATE INDEX ix_releasesearch_releaseid ON releasesearch (releaseID); +CREATE INDEX ix_releasesearch_releaseid ON releasesearch (releaseid); CREATE INDEX ix_releasesearch_guid ON releasesearch (guid); DROP TABLE IF EXISTS country; CREATE TABLE country ( - ID INT(11) NOT NULL AUTO_INCREMENT, + id INT(11) NOT NULL AUTO_INCREMENT, name VARCHAR(255) NOT NULL DEFAULT "", code CHAR(2) NOT NULL DEFAULT "", - PRIMARY KEY (ID) + PRIMARY KEY (id) ) ENGINE =INNODB DEFAULT CHARACTER SET utf8 @@ -336,7 +336,7 @@ INSERT INTO country (code, name) VALUES ('AF', 'Afghanistan'), ('HU', 'Hungary'), ('IS', 'Iceland'), ('IN', 'India'), -('ID', 'Indonesia'), +('id', 'Indonesia'), ('IR', 'Iran'), ('IQ', 'Iraq'), ('IE', 'Ireland'), @@ -530,14 +530,14 @@ CREATE TABLE xxxinfo ( DROP TABLE IF EXISTS `genres`; CREATE TABLE IF NOT EXISTS `genres` ( - `ID` int(11) NOT NULL AUTO_INCREMENT, + `id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `type` int(4) DEFAULT NULL, `disabled` tinyint(1) NOT NULL DEFAULT '0', - PRIMARY KEY (`ID`) + PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC AUTO_INCREMENT=635; -INSERT IGNORE INTO `genres` (`ID`, `title`, `type`, `disabled`) VALUES +INSERT IGNORE INTO `genres` (`id`, `title`, `type`, `disabled`) VALUES (150, 'Blues', 3000, 0), (151, 'Classic Rock', 3000, 0), (152, 'Country', 3000, 0), @@ -1026,25 +1026,25 @@ INSERT IGNORE INTO `genres` (`ID`, `title`, `type`, `disabled`) VALUES DROP TABLE IF EXISTS shortgroups; CREATE TABLE shortgroups ( - ID INT(11) NOT NULL AUTO_INCREMENT, + id INT(11) NOT NULL AUTO_INCREMENT, name VARCHAR(255) NOT NULL DEFAULT "", first_record BIGINT UNSIGNED NOT NULL DEFAULT "0", last_record BIGINT UNSIGNED NOT NULL DEFAULT "0", updated DATETIME DEFAULT NULL, - PRIMARY KEY (ID) + PRIMARY KEY (id) ) ENGINE =InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci AUTO_INCREMENT =1; -CREATE INDEX ix_shortgroups_id ON shortgroups (ID); +CREATE INDEX ix_shortgroups_id ON shortgroups (id); CREATE INDEX ix_shortgroups_name ON shortgroups (name); DROP TABLE IF EXISTS `category`; CREATE TABLE category ( - `ID` INT PRIMARY KEY NOT NULL AUTO_INCREMENT, + `id` INT PRIMARY KEY NOT NULL AUTO_INCREMENT, `title` VARCHAR(255) NOT NULL, `parentID` INT NULL, `status` INT NOT NULL DEFAULT '1', @@ -1058,90 +1058,90 @@ CREATE TABLE category COLLATE utf8_unicode_ci AUTO_INCREMENT =100000; -INSERT INTO category (ID, title) VALUES (1000, 'Console'); -INSERT INTO category (ID, title) VALUES (2000, 'Movies'); -INSERT INTO category (ID, title) VALUES (3000, 'Audio'); -INSERT INTO category (ID, title) VALUES (4000, 'PC'); -INSERT INTO category (ID, title) VALUES (5000, 'TV'); -INSERT INTO category (ID, title) VALUES (6000, 'XXX'); -INSERT INTO category (ID, title) VALUES (7000, 'Books'); -INSERT INTO category (ID, title) VALUES (8000, 'Other'); +INSERT INTO category (id, title) VALUES (1000, 'Console'); +INSERT INTO category (id, title) VALUES (2000, 'Movies'); +INSERT INTO category (id, title) VALUES (3000, 'Audio'); +INSERT INTO category (id, title) VALUES (4000, 'PC'); +INSERT INTO category (id, title) VALUES (5000, 'TV'); +INSERT INTO category (id, title) VALUES (6000, 'XXX'); +INSERT INTO category (id, title) VALUES (7000, 'Books'); +INSERT INTO category (id, title) VALUES (8000, 'Other'); -INSERT INTO category (ID, title, parentID) VALUES (1010, 'NDS', 1000); -INSERT INTO category (ID, title, parentID) VALUES (1020, 'PSP', 1000); -INSERT INTO category (ID, title, parentID) VALUES (1030, 'Wii', 1000); -INSERT INTO category (ID, title, parentID) VALUES (1040, 'Xbox', 1000); -INSERT INTO category (ID, title, parentID) VALUES (1050, 'Xbox 360', 1000); -INSERT INTO category (ID, title, parentID) VALUES (1060, 'WiiWare/VC', 1000); -INSERT INTO category (ID, title, parentID) VALUES (1070, 'XBOX 360 DLC', 1000); -INSERT INTO category (ID, title, parentID) VALUES (1080, 'PS3', 1000); -INSERT INTO category (ID, title, parentID) VALUES (1090, 'Other', 1000); -INSERT INTO category (ID, title, parentID) VALUES (1110, '3DS', 1000); -INSERT INTO category (ID, title, parentID) VALUES (1120, 'PS Vita', 1000); -INSERT INTO category (ID, title, parentID) VALUES (1130, 'WiiU', 1000); -INSERT INTO category (ID, title, parentID) VALUES (1140, 'Xbox One', 1000); -INSERT INTO category (ID, title, parentID) VALUES (1180, 'PS4', 1000); +INSERT INTO category (id, title, parentID) VALUES (1010, 'NDS', 1000); +INSERT INTO category (id, title, parentID) VALUES (1020, 'PSP', 1000); +INSERT INTO category (id, title, parentID) VALUES (1030, 'Wii', 1000); +INSERT INTO category (id, title, parentID) VALUES (1040, 'Xbox', 1000); +INSERT INTO category (id, title, parentID) VALUES (1050, 'Xbox 360', 1000); +INSERT INTO category (id, title, parentID) VALUES (1060, 'WiiWare/VC', 1000); +INSERT INTO category (id, title, parentID) VALUES (1070, 'XBOX 360 DLC', 1000); +INSERT INTO category (id, title, parentID) VALUES (1080, 'PS3', 1000); +INSERT INTO category (id, title, parentID) VALUES (1090, 'Other', 1000); +INSERT INTO category (id, title, parentID) VALUES (1110, '3DS', 1000); +INSERT INTO category (id, title, parentID) VALUES (1120, 'PS Vita', 1000); +INSERT INTO category (id, title, parentID) VALUES (1130, 'WiiU', 1000); +INSERT INTO category (id, title, parentID) VALUES (1140, 'Xbox One', 1000); +INSERT INTO category (id, title, parentID) VALUES (1180, 'PS4', 1000); -INSERT INTO category (ID, title, parentID) VALUES (2010, 'Foreign', 2000); -INSERT INTO category (ID, title, parentID) VALUES (2020, 'Other', 2000); -INSERT INTO category (ID, title, parentID) VALUES (2030, 'SD', 2000); -INSERT INTO category (ID, title, parentID) VALUES (2040, 'HD', 2000); -INSERT INTO category (ID, title, parentID) VALUES (2050, '3D', 2000); -INSERT INTO category (ID, title, parentID) VALUES (2060, 'BluRay', 2000); -INSERT INTO category (ID, title, parentID) VALUES (2070, 'DVD', 2000); +INSERT INTO category (id, title, parentID) VALUES (2010, 'Foreign', 2000); +INSERT INTO category (id, title, parentID) VALUES (2020, 'Other', 2000); +INSERT INTO category (id, title, parentID) VALUES (2030, 'SD', 2000); +INSERT INTO category (id, title, parentID) VALUES (2040, 'HD', 2000); +INSERT INTO category (id, title, parentID) VALUES (2050, '3D', 2000); +INSERT INTO category (id, title, parentID) VALUES (2060, 'BluRay', 2000); +INSERT INTO category (id, title, parentID) VALUES (2070, 'DVD', 2000); -INSERT INTO category (ID, title, parentID) VALUES (3010, 'MP3', 3000); -INSERT INTO category (ID, title, parentID) VALUES (3020, 'Video', 3000); -INSERT INTO category (ID, title, parentID) VALUES (3030, 'Audiobook', 3000); -INSERT INTO category (ID, title, parentID) VALUES (3040, 'Lossless', 3000); -INSERT INTO category (ID, title, parentID) VALUES (3050, 'Other', 3000); -INSERT INTO category (ID, title, parentID) VALUES (3060, 'Foreign', 3000); +INSERT INTO category (id, title, parentID) VALUES (3010, 'MP3', 3000); +INSERT INTO category (id, title, parentID) VALUES (3020, 'Video', 3000); +INSERT INTO category (id, title, parentID) VALUES (3030, 'Audiobook', 3000); +INSERT INTO category (id, title, parentID) VALUES (3040, 'Lossless', 3000); +INSERT INTO category (id, title, parentID) VALUES (3050, 'Other', 3000); +INSERT INTO category (id, title, parentID) VALUES (3060, 'Foreign', 3000); -INSERT INTO category (ID, title, parentID) VALUES (4010, '0day', 4000); -INSERT INTO category (ID, title, parentID) VALUES (4020, 'ISO', 4000); -INSERT INTO category (ID, title, parentID) VALUES (4030, 'Mac', 4000); -INSERT INTO category (ID, title, parentID) VALUES (4040, 'Mobile-Other', 4000); -INSERT INTO category (ID, title, parentID) VALUES (4050, 'Games', 4000); -INSERT INTO category (ID, title, parentID) VALUES (4060, 'Mobile-iOS', 4000); -INSERT INTO category (ID, title, parentID) VALUES (4070, 'Mobile-Android', 4000); +INSERT INTO category (id, title, parentID) VALUES (4010, '0day', 4000); +INSERT INTO category (id, title, parentID) VALUES (4020, 'ISO', 4000); +INSERT INTO category (id, title, parentID) VALUES (4030, 'Mac', 4000); +INSERT INTO category (id, title, parentID) VALUES (4040, 'Mobile-Other', 4000); +INSERT INTO category (id, title, parentID) VALUES (4050, 'Games', 4000); +INSERT INTO category (id, title, parentID) VALUES (4060, 'Mobile-iOS', 4000); +INSERT INTO category (id, title, parentID) VALUES (4070, 'Mobile-Android', 4000); -INSERT INTO category (ID, title, parentID) VALUES (5010, 'WEB-DL', 5000); -INSERT INTO category (ID, title, parentID) VALUES (5020, 'Foreign', 5000); -INSERT INTO category (ID, title, parentID) VALUES (5030, 'SD', 5000); -INSERT INTO category (ID, title, parentID) VALUES (5040, 'HD', 5000); -INSERT INTO category (ID, title, parentID) VALUES (5050, 'Other', 5000); -INSERT INTO category (ID, title, parentID) VALUES (5060, 'Sport', 5000); -INSERT INTO category (ID, title, parentID) VALUES (5070, 'Anime', 5000); -INSERT INTO category (ID, title, parentID) VALUES (5080, 'Documentary', 5000); +INSERT INTO category (id, title, parentID) VALUES (5010, 'WEB-DL', 5000); +INSERT INTO category (id, title, parentID) VALUES (5020, 'Foreign', 5000); +INSERT INTO category (id, title, parentID) VALUES (5030, 'SD', 5000); +INSERT INTO category (id, title, parentID) VALUES (5040, 'HD', 5000); +INSERT INTO category (id, title, parentID) VALUES (5050, 'Other', 5000); +INSERT INTO category (id, title, parentID) VALUES (5060, 'Sport', 5000); +INSERT INTO category (id, title, parentID) VALUES (5070, 'Anime', 5000); +INSERT INTO category (id, title, parentID) VALUES (5080, 'Documentary', 5000); -INSERT INTO category (ID, title, parentID) VALUES (6010, 'DVD', 6000); -INSERT INTO category (ID, title, parentID) VALUES (6020, 'WMV', 6000); -INSERT INTO category (ID, title, parentID) VALUES (6030, 'XviD', 6000); -INSERT INTO category (ID, title, parentID) VALUES (6040, 'x264', 6000); -INSERT INTO category (ID, title, parentID) VALUES (6050, 'Pack', 6000); -INSERT INTO category (ID, title, parentID) VALUES (6060, 'ImgSet', 6000); -INSERT INTO category (ID, title, parentID) VALUES (6070, 'Other', 6000); +INSERT INTO category (id, title, parentID) VALUES (6010, 'DVD', 6000); +INSERT INTO category (id, title, parentID) VALUES (6020, 'WMV', 6000); +INSERT INTO category (id, title, parentID) VALUES (6030, 'XviD', 6000); +INSERT INTO category (id, title, parentID) VALUES (6040, 'x264', 6000); +INSERT INTO category (id, title, parentID) VALUES (6050, 'Pack', 6000); +INSERT INTO category (id, title, parentID) VALUES (6060, 'ImgSet', 6000); +INSERT INTO category (id, title, parentID) VALUES (6070, 'Other', 6000); -INSERT INTO category (ID, title, parentID) VALUES (7010, 'Mags', 7000); -INSERT INTO category (ID, title, parentID) VALUES (7020, 'Ebook', 7000); -INSERT INTO category (ID, title, parentID) VALUES (7030, 'Comics', 7000); -INSERT INTO category (ID, title, parentID) VALUES (7040, 'Technical', 7000); -INSERT INTO category (ID, title, parentID) VALUES (7050, 'Other', 7000); -INSERT INTO category (ID, title, parentID) VALUES (7060, 'Foreign', 7000); +INSERT INTO category (id, title, parentID) VALUES (7010, 'Mags', 7000); +INSERT INTO category (id, title, parentID) VALUES (7020, 'Ebook', 7000); +INSERT INTO category (id, title, parentID) VALUES (7030, 'Comics', 7000); +INSERT INTO category (id, title, parentID) VALUES (7040, 'Technical', 7000); +INSERT INTO category (id, title, parentID) VALUES (7050, 'Other', 7000); +INSERT INTO category (id, title, parentID) VALUES (7060, 'Foreign', 7000); -INSERT INTO category (ID, title, parentID) VALUES (8010, 'Misc', 8000); -INSERT INTO category (ID, title, parentID) VALUES (8020, 'Hashed', 8000); +INSERT INTO category (id, title, parentID) VALUES (8010, 'Misc', 8000); +INSERT INTO category (id, title, parentID) VALUES (8020, 'Hashed', 8000); DROP TABLE IF EXISTS sharing_sites; CREATE TABLE sharing_sites ( - ID INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, + id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, site_name VARCHAR(255) NOT NULL DEFAULT '', site_guid VARCHAR(40) NOT NULL DEFAULT '', last_time DATETIME DEFAULT NULL, first_time DATETIME DEFAULT NULL, enabled TINYINT(1) NOT NULL DEFAULT '0', comments MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (ID) + PRIMARY KEY (id) ) ENGINE =InnoDB DEFAULT CHARACTER SET utf8 @@ -1194,7 +1194,7 @@ CREATE TABLE predbhash ( COLLATE =utf8mb4_unicode_ci; INSERT INTO predbhash (pre_id, hashes) (SELECT - ID, + id, CONCAT_WS(',', MD5(title), MD5(MD5(title)), SHA1(title)) FROM prehash); @@ -1220,14 +1220,14 @@ ALTER TABLE animetitles CHANGE createddate unixtime INT(12) UNSIGNED NOT NULL; DROP TRIGGER IF EXISTS insert_hashes; DELIMITER $$ -CREATE TRIGGER insert_hashes AFTER INSERT ON prehash FOR EACH ROW BEGIN INSERT INTO predbhash (pre_id, hashes) VALUES (NEW.ID, CONCAT_WS(',', MD5(NEW.title), MD5(MD5(NEW.title)), SHA1(NEW.title)));END; +CREATE TRIGGER insert_hashes AFTER INSERT ON prehash FOR EACH ROW BEGIN INSERT INTO predbhash (pre_id, hashes) VALUES (NEW.id, CONCAT_WS(',', MD5(NEW.title), MD5(MD5(NEW.title)), SHA1(NEW.title)));END; $$ DELIMITER ; DROP TRIGGER IF EXISTS update_hashes; DELIMITER $$ -CREATE TRIGGER update_hashes AFTER UPDATE ON prehash FOR EACH ROW BEGIN IF NEW.title != OLD.title THEN UPDATE predbhash SET hashes = CONCAT_WS(',', MD5(NEW.title), MD5(MD5(NEW.title)), SHA1(NEW.title)) WHERE pre_id = OLD.ID; END IF; +CREATE TRIGGER update_hashes AFTER UPDATE ON prehash FOR EACH ROW BEGIN IF NEW.title != OLD.title THEN UPDATE predbhash SET hashes = CONCAT_WS(',', MD5(NEW.title), MD5(MD5(NEW.title)), SHA1(NEW.title)) WHERE pre_id = OLD.id; END IF; END; $$ DELIMITER ; @@ -1235,7 +1235,7 @@ DELIMITER ; DROP TRIGGER IF EXISTS delete_hashes; DELIMITER $$ -CREATE TRIGGER delete_hashes AFTER DELETE ON prehash FOR EACH ROW BEGIN DELETE FROM predbhash WHERE pre_id = OLD.ID; END; +CREATE TRIGGER delete_hashes AFTER DELETE ON prehash FOR EACH ROW BEGIN DELETE FROM predbhash WHERE pre_id = OLD.id; END; $$ DELIMITER ; @@ -1262,14 +1262,14 @@ CREATE TRIGGER check_update BEFORE UPDATE ON releases FOR EACH ROW BEGIN IF NEW. ELSEIF NEW.name REGEXP '^\\[ ?([[:digit:]]{4,6}) ?\\]|^REQ\s*([[:digit:]]{4,6})|^([[:digit:]]{4,6})-[[:digit:]]{1}\\[' THEN SET NEW.isrequestid = 1;END IF; END; $$ -CREATE TRIGGER insert_search AFTER INSERT ON releases FOR EACH ROW BEGIN INSERT INTO releasesearch (releaseID, guid, name, searchname) VALUES (NEW.ID, NEW.guid, NEW.name, NEW.searchname); +CREATE TRIGGER insert_search AFTER INSERT ON releases FOR EACH ROW BEGIN INSERT INTO releasesearch (releaseid, guid, name, searchname) VALUES (NEW.id, NEW.guid, NEW.name, NEW.searchname); END; $$ -CREATE TRIGGER update_search AFTER UPDATE ON releases FOR EACH ROW BEGIN IF NEW.guid != OLD.guid THEN UPDATE releasesearch SET guid = NEW.guid WHERE releaseID = OLD.ID; END IF; -IF NEW.name != OLD.name THEN UPDATE releasesearch SET name = NEW.name WHERE releaseID = OLD.ID; END IF; IF NEW.searchname != OLD.searchname THEN UPDATE releasesearch SET searchname = NEW.searchname WHERE releaseID = OLD.ID; END IF; +CREATE TRIGGER update_search AFTER UPDATE ON releases FOR EACH ROW BEGIN IF NEW.guid != OLD.guid THEN UPDATE releasesearch SET guid = NEW.guid WHERE releaseid = OLD.id; END IF; +IF NEW.name != OLD.name THEN UPDATE releasesearch SET name = NEW.name WHERE releaseid = OLD.id; END IF; IF NEW.searchname != OLD.searchname THEN UPDATE releasesearch SET searchname = NEW.searchname WHERE releaseid = OLD.id; END IF; END; $$ -CREATE TRIGGER delete_search AFTER DELETE ON releases FOR EACH ROW BEGIN DELETE FROM releasesearch WHERE releaseID = OLD.ID; END; +CREATE TRIGGER delete_search AFTER DELETE ON releases FOR EACH ROW BEGIN DELETE FROM releasesearch WHERE releaseid = OLD.id; END; $$ DELIMITER ; diff --git a/lib/DB/patches/0008_releases.sql b/lib/DB/patches/0008_releases.sql index afc0e996a..df3af6e57 100644 --- a/lib/DB/patches/0008_releases.sql +++ b/lib/DB/patches/0008_releases.sql @@ -1,3 +1,3 @@ -ALTER TABLE `releases` ADD `prehashID` INT(12) NULL DEFAULT NULL; +ALTER TABLE `releases` ADD `prehashid` INT(12) NULL DEFAULT NULL; UPDATE `tmux` set `value` = '8' where `setting` = 'sqlpatch'; \ No newline at end of file diff --git a/lib/DB/patches/0009_releases.sql b/lib/DB/patches/0009_releases.sql index b449eed2a..912b67608 100644 --- a/lib/DB/patches/0009_releases.sql +++ b/lib/DB/patches/0009_releases.sql @@ -1,2 +1,2 @@ -ALTER TABLE `releases` CHANGE COLUMN `prehashID` `prehashID` INT UNSIGNED NOT NULL DEFAULT '0'; +ALTER TABLE `releases` CHANGE COLUMN `prehashid` `prehashid` INT UNSIGNED NOT NULL DEFAULT '0'; UPDATE `tmux` set `value` = '9' where `setting` = 'sqlpatch'; \ No newline at end of file diff --git a/lib/DB/patches/0010_releases.sql b/lib/DB/patches/0010_releases.sql index c6911f711..a342cca19 100644 --- a/lib/DB/patches/0010_releases.sql +++ b/lib/DB/patches/0010_releases.sql @@ -1,2 +1,2 @@ -ALTER TABLE `releases` ADD INDEX `ix_releases_prehashid_searchname` (`prehashID`, `searchname`); +ALTER TABLE `releases` ADD INDEX `ix_releases_prehashid_searchname` (`prehashid`, `searchname`); UPDATE `tmux` set `value` = '10' where `setting` = 'sqlpatch'; \ No newline at end of file diff --git a/lib/DB/patches/0015_sharing.sql b/lib/DB/patches/0015_sharing.sql index c3646e3da..1810b8dd4 100644 --- a/lib/DB/patches/0015_sharing.sql +++ b/lib/DB/patches/0015_sharing.sql @@ -1,13 +1,13 @@ DROP TABLE IF EXISTS sharing_sites; CREATE TABLE sharing_sites ( - ID INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, + id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, site_name VARCHAR(255) NOT NULL DEFAULT '', site_guid VARCHAR(40) NOT NULL DEFAULT '', last_time DATETIME DEFAULT NULL, first_time DATETIME DEFAULT NULL, enabled TINYINT(1) NOT NULL DEFAULT '0', comments MEDIUMINT UNSIGNED NOT NULL DEFAULT '0', - PRIMARY KEY (ID) + PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci AUTO_INCREMENT=1 ; DROP TABLE IF EXISTS sharing; diff --git a/lib/DB/patches/0019_sharing.sql b/lib/DB/patches/0019_sharing.sql index afcecf879..e1b58359c 100644 --- a/lib/DB/patches/0019_sharing.sql +++ b/lib/DB/patches/0019_sharing.sql @@ -1,4 +1,4 @@ -UPDATE releasecomment SET username = (SELECT username FROM users WHERE users.ID = releasecomment.userID); +UPDATE releasecomment SET username = (SELECT username FROM users WHERE users.id = releasecomment.userID); DELETE FROM users WHERE email = 'sharing@nZEDb.com' AND role = 0; diff --git a/lib/DB/patches/0022_releases.sql b/lib/DB/patches/0022_releases.sql index f1a7013a4..83a028d39 100644 --- a/lib/DB/patches/0022_releases.sql +++ b/lib/DB/patches/0022_releases.sql @@ -1,3 +1,3 @@ -ALTER TABLE `releases` ADD INDEX `ix_releases_releasenfoID` (`releasenfoID`); +ALTER TABLE `releases` ADD INDEX `ix_releases_releasenfoID` (`releasenfoid`); UPDATE `tmux` set `value` = '22' where `setting` = 'sqlpatch'; \ No newline at end of file diff --git a/lib/DB/patches/0029_releases.sql b/lib/DB/patches/0029_releases.sql index 0773c8ff0..b7cb1a3fe 100644 --- a/lib/DB/patches/0029_releases.sql +++ b/lib/DB/patches/0029_releases.sql @@ -1,7 +1,7 @@ ALTER TABLE `releases` ADD COLUMN `nzbstatus` TINYINT(1) NOT NULL DEFAULT 1; ALTER TABLE `releases` ADD COLUMN `nzb_guid` VARCHAR(50) NULL; ALTER TABLE `releases` DROP INDEX `ix_releases_status`; -ALTER TABLE `releases` ADD INDEX `ix_releases_status` (`nzbstatus`, `iscategorized`, `isrenamed`, `nfostatus`, `ishashed`, `passwordstatus`, `dehashstatus`, `releasenfoID`, `musicinfoID`, `consoleinfoID`, `bookinfoID`, `haspreview`, `categoryID`, `imdbID`, `rageID`); +ALTER TABLE `releases` ADD INDEX `ix_releases_status` (`nzbstatus`, `iscategorized`, `isrenamed`, `nfostatus`, `ishashed`, `passwordstatus`, `dehashstatus`, `releasenfoid`, `musicinfoid`, `consoleinfoid`, `bookinfoid`, `haspreview`, `categoryid`, `imdbid`, `rageid`); CREATE INDEX `ix_releases_nzb_guid` ON `releases` (`nzb_guid`); UPDATE `releases` SET nzbstatus = 1 WHERE nzbstatus = 0; diff --git a/lib/DB/patches/0032_releases.sql b/lib/DB/patches/0032_releases.sql index 0c04c3e29..f8ab3093b 100644 --- a/lib/DB/patches/0032_releases.sql +++ b/lib/DB/patches/0032_releases.sql @@ -2,8 +2,8 @@ DROP TRIGGER IF EXISTS check_insert; DROP TRIGGER IF EXISTS check_update; DELIMITER $$ -CREATE TRIGGER check_insert BEFORE INSERT ON releases FOR EACH ROW BEGIN IF NEW.searchname REGEXP '[a-fA-F0-9]{32}' OR NEW.name REGEXP '[a-fA-F0-9]{32}' THEN SET NEW.ishashed = 1;ELSEIF NEW.name REGEXP '^\[ ?([[:digit:]]{4,6}) ?\]|^REQ\s*([[:digit:]]{4,6})|^([[:digit:]]{4,6})-[[:digit:]]{1}\\[' THEN SET NEW.isrequestid = 1;ELSEIF NEW.releasenfoID = 0 THEN SET NEW.nfostatus = -1; END IF; END;$$ -CREATE TRIGGER check_update BEFORE UPDATE ON releases FOR EACH ROW BEGIN IF NEW.searchname REGEXP '[a-fA-F0-9]{32}' OR NEW.name REGEXP '[a-fA-F0-9]{32}' THEN SET NEW.ishashed = 1;ELSEIF NEW.name REGEXP '^\[ ?([[:digit:]]{4,6}) ?\]|^REQ\s*([[:digit:]]{4,6})|^([[:digit:]]{4,6})-[[:digit:]]{1}\\[' THEN SET NEW.isrequestid = 1;ELSEIF NEW.releasenfoID = 0 THEN SET NEW.nfostatus = -1; END IF; END;$$ +CREATE TRIGGER check_insert BEFORE INSERT ON releases FOR EACH ROW BEGIN IF NEW.searchname REGEXP '[a-fA-F0-9]{32}' OR NEW.name REGEXP '[a-fA-F0-9]{32}' THEN SET NEW.ishashed = 1;ELSEIF NEW.name REGEXP '^\[ ?([[:digit:]]{4,6}) ?\]|^REQ\s*([[:digit:]]{4,6})|^([[:digit:]]{4,6})-[[:digit:]]{1}\\[' THEN SET NEW.isrequestid = 1;ELSEIF NEW.releasenfoid = 0 THEN SET NEW.nfostatus = -1; END IF; END;$$ +CREATE TRIGGER check_update BEFORE UPDATE ON releases FOR EACH ROW BEGIN IF NEW.searchname REGEXP '[a-fA-F0-9]{32}' OR NEW.name REGEXP '[a-fA-F0-9]{32}' THEN SET NEW.ishashed = 1;ELSEIF NEW.name REGEXP '^\[ ?([[:digit:]]{4,6}) ?\]|^REQ\s*([[:digit:]]{4,6})|^([[:digit:]]{4,6})-[[:digit:]]{1}\\[' THEN SET NEW.isrequestid = 1;ELSEIF NEW.releasenfoid = 0 THEN SET NEW.nfostatus = -1; END IF; END;$$ DELIMITER ; UPDATE `tmux` set `value` = '32' where `setting` = 'sqlpatch'; \ No newline at end of file diff --git a/lib/DB/patches/0033_releases.sql b/lib/DB/patches/0033_releases.sql index 062ae93fc..e984cbf24 100644 --- a/lib/DB/patches/0033_releases.sql +++ b/lib/DB/patches/0033_releases.sql @@ -1,8 +1,8 @@ DROP TRIGGER IF EXISTS check_insert; DROP TRIGGER IF EXISTS check_update; -CREATE TRIGGER check_insert BEFORE INSERT ON releases FOR EACH ROW BEGIN IF NEW.searchname REGEXP '[a-fA-F0-9]{32}' OR NEW.name REGEXP '[a-fA-F0-9]{32}' THEN SET NEW.ishashed = 1;ELSEIF NEW.name REGEXP '^\\[ ?([[:digit:]]{4,6}) ?\\]|^REQ\s*([[:digit:]]{4,6})|^([[:digit:]]{4,6})-[[:digit:]]{1}\\[' THEN SET NEW.isrequestid = 1;ELSEIF NEW.releasenfoID = 0 THEN SET NEW.nfostatus = -1; END IF; END; -CREATE TRIGGER check_update BEFORE UPDATE ON releases FOR EACH ROW BEGIN IF NEW.searchname REGEXP '[a-fA-F0-9]{32}' OR NEW.name REGEXP '[a-fA-F0-9]{32}' THEN SET NEW.ishashed = 1;ELSEIF NEW.name REGEXP '^\\[ ?([[:digit:]]{4,6}) ?\\]|^REQ\s*([[:digit:]]{4,6})|^([[:digit:]]{4,6})-[[:digit:]]{1}\\[' THEN SET NEW.isrequestid = 1;ELSEIF NEW.releasenfoID = 0 THEN SET NEW.nfostatus = -1; END IF; END; +CREATE TRIGGER check_insert BEFORE INSERT ON releases FOR EACH ROW BEGIN IF NEW.searchname REGEXP '[a-fA-F0-9]{32}' OR NEW.name REGEXP '[a-fA-F0-9]{32}' THEN SET NEW.ishashed = 1;ELSEIF NEW.name REGEXP '^\\[ ?([[:digit:]]{4,6}) ?\\]|^REQ\s*([[:digit:]]{4,6})|^([[:digit:]]{4,6})-[[:digit:]]{1}\\[' THEN SET NEW.isrequestid = 1;ELSEIF NEW.releasenfoid = 0 THEN SET NEW.nfostatus = -1; END IF; END; +CREATE TRIGGER check_update BEFORE UPDATE ON releases FOR EACH ROW BEGIN IF NEW.searchname REGEXP '[a-fA-F0-9]{32}' OR NEW.name REGEXP '[a-fA-F0-9]{32}' THEN SET NEW.ishashed = 1;ELSEIF NEW.name REGEXP '^\\[ ?([[:digit:]]{4,6}) ?\\]|^REQ\s*([[:digit:]]{4,6})|^([[:digit:]]{4,6})-[[:digit:]]{1}\\[' THEN SET NEW.isrequestid = 1;ELSEIF NEW.releasenfoid = 0 THEN SET NEW.nfostatus = -1; END IF; END; UPDATE releases set isrequestid = 1 WHERE name REGEXP '^\\[ ?([[:digit:]]{4,6}) ?\\]|^REQ\s*([[:digit:]]{4,6})|^([[:digit:]]{4,6})-[[:digit:]]{1}\\[' diff --git a/lib/DB/patches/0038_releasesearch.sql b/lib/DB/patches/0038_releasesearch.sql index dc673bac0..657f26bfd 100644 --- a/lib/DB/patches/0038_releasesearch.sql +++ b/lib/DB/patches/0038_releasesearch.sql @@ -1,24 +1,24 @@ DROP TABLE IF EXISTS releasesearch; CREATE TABLE releasesearch ( - ID INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, - releaseID INT(11) UNSIGNED NOT NULL, + id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, + releaseid INT(11) UNSIGNED NOT NULL, guid VARCHAR(50) NOT NULL, name VARCHAR(255) NOT NULL DEFAULT '', searchname VARCHAR(255) NOT NULL DEFAULT '', - PRIMARY KEY (ID) + PRIMARY KEY (id) ) ENGINE =MyISAM DEFAULT CHARSET =utf8 COLLATE =utf8_unicode_ci AUTO_INCREMENT =1; CREATE FULLTEXT INDEX ix_releasesearch_name_searchname_ft ON releasesearch (name, searchname); -CREATE INDEX ix_releasesearch_releaseid ON releasesearch (releaseID); +CREATE INDEX ix_releasesearch_releaseid ON releasesearch (releaseid); CREATE INDEX ix_releasesearch_guid ON releasesearch (guid); ALTER TABLE `releases` ADD `proc_filenames` BIT NOT NULL DEFAULT 0; DELIMITER $$ -CREATE TRIGGER insert_search AFTER INSERT ON releases FOR EACH ROW BEGIN INSERT INTO releasesearch (releaseID, guid, name, searchname) VALUES (NEW.ID, NEW.guid, NEW.name, NEW.searchname);END;$$ -CREATE TRIGGER update_search AFTER UPDATE ON releases FOR EACH ROW BEGIN IF NEW.guid != OLD.guid THEN UPDATE releasesearch SET guid = NEW.guid WHERE releaseID = OLD.ID; END IF; IF NEW.name != OLD.name THEN UPDATE releasesearch SET name = NEW.name WHERE releaseID = OLD.ID; END IF; IF NEW.searchname != OLD.searchname THEN UPDATE releasesearch SET searchname = NEW.searchname WHERE releaseID = OLD.ID; END IF;END;$$ -CREATE TRIGGER delete_search AFTER DELETE ON releases FOR EACH ROW BEGIN DELETE FROM releasesearch WHERE releaseID = OLD.ID;END;$$ +CREATE TRIGGER insert_search AFTER INSERT ON releases FOR EACH ROW BEGIN INSERT INTO releasesearch (releaseid, guid, name, searchname) VALUES (NEW.id, NEW.guid, NEW.name, NEW.searchname);END;$$ +CREATE TRIGGER update_search AFTER UPDATE ON releases FOR EACH ROW BEGIN IF NEW.guid != OLD.guid THEN UPDATE releasesearch SET guid = NEW.guid WHERE releaseid = OLD.id; END IF; IF NEW.name != OLD.name THEN UPDATE releasesearch SET name = NEW.name WHERE releaseid = OLD.id; END IF; IF NEW.searchname != OLD.searchname THEN UPDATE releasesearch SET searchname = NEW.searchname WHERE releaseid = OLD.id; END IF;END;$$ +CREATE TRIGGER delete_search AFTER DELETE ON releases FOR EACH ROW BEGIN DELETE FROM releasesearch WHERE releaseid = OLD.id;END;$$ DELIMITER ; UPDATE `tmux` SET value = '38' WHERE `setting` = 'sqlpatch'; diff --git a/lib/DB/patches/0041_predbhash.sql b/lib/DB/patches/0041_predbhash.sql index 33f9c46db..cd84d124c 100644 --- a/lib/DB/patches/0041_predbhash.sql +++ b/lib/DB/patches/0041_predbhash.sql @@ -10,7 +10,7 @@ CREATE TABLE predbhash ( COLLATE =utf8mb4_unicode_ci; INSERT INTO predbhash (pre_id, hashes) (SELECT - ID, + id, CONCAT_WS(',', MD5(title), MD5(MD5(title)), SHA1(title)) FROM prehash); @@ -21,7 +21,7 @@ DROP TRIGGER IF EXISTS insert_hashes; DELIMITER $$ CREATE TRIGGER insert_hashes AFTER INSERT ON prehash FOR EACH ROW BEGIN INSERT INTO predbhash (pre_id, hashes) -VALUES (NEW.ID, CONCAT_WS(',', MD5(NEW.title), MD5(MD5(NEW.title)), SHA1(NEW.title))); +VALUES (NEW.id, CONCAT_WS(',', MD5(NEW.title), MD5(MD5(NEW.title)), SHA1(NEW.title))); END; $$ DELIMITER ; @@ -40,7 +40,7 @@ DROP TRIGGER IF EXISTS delete_hashes; DELIMITER $$ CREATE TRIGGER delete_hashes AFTER DELETE ON prehash FOR EACH ROW BEGIN DELETE FROM predbhash -WHERE pre_id = OLD.ID; +WHERE pre_id = OLD.id; END; $$ DELIMITER ; diff --git a/lib/DB/patches/0042_predbhash.sql b/lib/DB/patches/0042_predbhash.sql index 1f3302359..fc9ae3c54 100644 --- a/lib/DB/patches/0042_predbhash.sql +++ b/lib/DB/patches/0042_predbhash.sql @@ -3,7 +3,7 @@ DELIMITER $$ CREATE TRIGGER update_hashes AFTER UPDATE ON prehash FOR EACH ROW BEGIN IF NEW.title != OLD.title THEN UPDATE predbhash SET hashes = CONCAT_WS(',', MD5(NEW.title), MD5(MD5(NEW.title)), SHA1(NEW.title)) -WHERE pre_id = OLD.ID; END IF; +WHERE pre_id = OLD.id; END IF; END; $$ DELIMITER ; diff --git a/lib/DB/patches/0044_releasecomment.sql b/lib/DB/patches/0044_releasecomment.sql index c64fcf867..aa4733108 100644 --- a/lib/DB/patches/0044_releasecomment.sql +++ b/lib/DB/patches/0044_releasecomment.sql @@ -1,5 +1,5 @@ ALTER TABLE releasecomment MODIFY text varchar(255); DROP INDEX ix_releasecomment_text_releaseID ON releasecomment; -CREATE UNIQUE INDEX ix_releasecomment_text_releaseID ON releasecomment (text, releaseID); +CREATE UNIQUE INDEX ix_releasecomment_text_releaseID ON releasecomment (text, releaseid); UPDATE `tmux` SET value = '44' WHERE `setting` = 'sqlpatch'; diff --git a/lib/DB/patches/0046_releasecomment.sql b/lib/DB/patches/0046_releasecomment.sql index 601477a00..881821860 100644 --- a/lib/DB/patches/0046_releasecomment.sql +++ b/lib/DB/patches/0046_releasecomment.sql @@ -3,5 +3,5 @@ DROP TRIGGER IF EXISTS insert_MD5; CREATE TRIGGER insert_MD5 BEFORE INSERT ON releasecomment FOR EACH ROW SET NEW.text_hash = MD5(NEW.text); UPDATE releasecomment SET text_hash = MD5(text); -ALTER IGNORE TABLE releasecomment ADD UNIQUE INDEX ix_releasecomment_hash_releaseID (text_hash, releaseID); +ALTER IGNORE TABLE releasecomment ADD UNIQUE INDEX ix_releasecomment_hash_releaseID (text_hash, releaseid); UPDATE `tmux` SET `value` = '46' WHERE `setting` = 'sqlpatch'; \ No newline at end of file diff --git a/lib/DB/patches/0050_category.sql b/lib/DB/patches/0050_category.sql index a4adb48ba..1df8222c2 100644 --- a/lib/DB/patches/0050_category.sql +++ b/lib/DB/patches/0050_category.sql @@ -1,7 +1,7 @@ DROP TABLE IF EXISTS `category`; CREATE TABLE category ( - `ID` INT PRIMARY KEY NOT NULL AUTO_INCREMENT, + `id` INT PRIMARY KEY NOT NULL AUTO_INCREMENT, `title` VARCHAR(255) NOT NULL, `parentID` INT NULL, `status` INT NOT NULL DEFAULT '1', @@ -15,79 +15,79 @@ CREATE TABLE category COLLATE utf8_unicode_ci AUTO_INCREMENT =100000; -INSERT INTO category (ID, title) VALUES (1000, 'Console'); -INSERT INTO category (ID, title) VALUES (2000, 'Movies'); -INSERT INTO category (ID, title) VALUES (3000, 'Audio'); -INSERT INTO category (ID, title) VALUES (4000, 'PC'); -INSERT INTO category (ID, title) VALUES (5000, 'TV'); -INSERT INTO category (ID, title) VALUES (6000, 'XXX'); -INSERT INTO category (ID, title) VALUES (7000, 'Books'); -INSERT INTO category (ID, title) VALUES (8000, 'Other'); +INSERT INTO category (id, title) VALUES (1000, 'Console'); +INSERT INTO category (id, title) VALUES (2000, 'Movies'); +INSERT INTO category (id, title) VALUES (3000, 'Audio'); +INSERT INTO category (id, title) VALUES (4000, 'PC'); +INSERT INTO category (id, title) VALUES (5000, 'TV'); +INSERT INTO category (id, title) VALUES (6000, 'XXX'); +INSERT INTO category (id, title) VALUES (7000, 'Books'); +INSERT INTO category (id, title) VALUES (8000, 'Other'); -INSERT INTO category (ID, title, parentID) VALUES (1010, 'NDS', 1000); -INSERT INTO category (ID, title, parentID) VALUES (1020, 'PSP', 1000); -INSERT INTO category (ID, title, parentID) VALUES (1030, 'Wii', 1000); -INSERT INTO category (ID, title, parentID) VALUES (1040, 'Xbox', 1000); -INSERT INTO category (ID, title, parentID) VALUES (1050, 'Xbox 360', 1000); -INSERT INTO category (ID, title, parentID) VALUES (1060, 'WiiWare/VC', 1000); -INSERT INTO category (ID, title, parentID) VALUES (1070, 'XBOX 360 DLC', 1000); -INSERT INTO category (ID, title, parentID) VALUES (1080, 'PS3', 1000); -INSERT INTO category (ID, title, parentID) VALUES (1090, 'Other', 1000); -INSERT INTO category (ID, title, parentID) VALUES (1110, '3DS', 1000); -INSERT INTO category (ID, title, parentID) VALUES (1120, 'PS Vita', 1000); -INSERT INTO category (ID, title, parentID) VALUES (1130, 'WiiU', 1000); -INSERT INTO category (ID, title, parentID) VALUES (1140, 'Xbox One', 1000); -INSERT INTO category (ID, title, parentID) VALUES (1180, 'PS4', 1000); +INSERT INTO category (id, title, parentID) VALUES (1010, 'NDS', 1000); +INSERT INTO category (id, title, parentID) VALUES (1020, 'PSP', 1000); +INSERT INTO category (id, title, parentID) VALUES (1030, 'Wii', 1000); +INSERT INTO category (id, title, parentID) VALUES (1040, 'Xbox', 1000); +INSERT INTO category (id, title, parentID) VALUES (1050, 'Xbox 360', 1000); +INSERT INTO category (id, title, parentID) VALUES (1060, 'WiiWare/VC', 1000); +INSERT INTO category (id, title, parentID) VALUES (1070, 'XBOX 360 DLC', 1000); +INSERT INTO category (id, title, parentID) VALUES (1080, 'PS3', 1000); +INSERT INTO category (id, title, parentID) VALUES (1090, 'Other', 1000); +INSERT INTO category (id, title, parentID) VALUES (1110, '3DS', 1000); +INSERT INTO category (id, title, parentID) VALUES (1120, 'PS Vita', 1000); +INSERT INTO category (id, title, parentID) VALUES (1130, 'WiiU', 1000); +INSERT INTO category (id, title, parentID) VALUES (1140, 'Xbox One', 1000); +INSERT INTO category (id, title, parentID) VALUES (1180, 'PS4', 1000); -INSERT INTO category (ID, title, parentID) VALUES (2010, 'Foreign', 2000); -INSERT INTO category (ID, title, parentID) VALUES (2020, 'Other', 2000); -INSERT INTO category (ID, title, parentID) VALUES (2030, 'SD', 2000); -INSERT INTO category (ID, title, parentID) VALUES (2040, 'HD', 2000); -INSERT INTO category (ID, title, parentID) VALUES (2050, '3D', 2000); -INSERT INTO category (ID, title, parentID) VALUES (2060, 'BluRay', 2000); -INSERT INTO category (ID, title, parentID) VALUES (2070, 'DVD', 2000); -INSERT INTO category (ID, title, parentID) VALUES (2080, 'WEB-DL', 2000); +INSERT INTO category (id, title, parentID) VALUES (2010, 'Foreign', 2000); +INSERT INTO category (id, title, parentID) VALUES (2020, 'Other', 2000); +INSERT INTO category (id, title, parentID) VALUES (2030, 'SD', 2000); +INSERT INTO category (id, title, parentID) VALUES (2040, 'HD', 2000); +INSERT INTO category (id, title, parentID) VALUES (2050, '3D', 2000); +INSERT INTO category (id, title, parentID) VALUES (2060, 'BluRay', 2000); +INSERT INTO category (id, title, parentID) VALUES (2070, 'DVD', 2000); +INSERT INTO category (id, title, parentID) VALUES (2080, 'WEB-DL', 2000); -INSERT INTO category (ID, title, parentID) VALUES (3010, 'MP3', 3000); -INSERT INTO category (ID, title, parentID) VALUES (3020, 'Video', 3000); -INSERT INTO category (ID, title, parentID) VALUES (3030, 'Audiobook', 3000); -INSERT INTO category (ID, title, parentID) VALUES (3040, 'Lossless', 3000); -INSERT INTO category (ID, title, parentID) VALUES (3050, 'Other', 3000); -INSERT INTO category (ID, title, parentID) VALUES (3060, 'Foreign', 3000); +INSERT INTO category (id, title, parentID) VALUES (3010, 'MP3', 3000); +INSERT INTO category (id, title, parentID) VALUES (3020, 'Video', 3000); +INSERT INTO category (id, title, parentID) VALUES (3030, 'Audiobook', 3000); +INSERT INTO category (id, title, parentID) VALUES (3040, 'Lossless', 3000); +INSERT INTO category (id, title, parentID) VALUES (3050, 'Other', 3000); +INSERT INTO category (id, title, parentID) VALUES (3060, 'Foreign', 3000); -INSERT INTO category (ID, title, parentID) VALUES (4010, '0day', 4000); -INSERT INTO category (ID, title, parentID) VALUES (4020, 'ISO', 4000); -INSERT INTO category (ID, title, parentID) VALUES (4030, 'Mac', 4000); -INSERT INTO category (ID, title, parentID) VALUES (4040, 'Mobile-Other', 4000); -INSERT INTO category (ID, title, parentID) VALUES (4050, 'Games', 4000); -INSERT INTO category (ID, title, parentID) VALUES (4060, 'Mobile-iOS', 4000); -INSERT INTO category (ID, title, parentID) VALUES (4070, 'Mobile-Android', 4000); +INSERT INTO category (id, title, parentID) VALUES (4010, '0day', 4000); +INSERT INTO category (id, title, parentID) VALUES (4020, 'ISO', 4000); +INSERT INTO category (id, title, parentID) VALUES (4030, 'Mac', 4000); +INSERT INTO category (id, title, parentID) VALUES (4040, 'Mobile-Other', 4000); +INSERT INTO category (id, title, parentID) VALUES (4050, 'Games', 4000); +INSERT INTO category (id, title, parentID) VALUES (4060, 'Mobile-iOS', 4000); +INSERT INTO category (id, title, parentID) VALUES (4070, 'Mobile-Android', 4000); -INSERT INTO category (ID, title, parentID) VALUES (5010, 'WEB-DL', 5000); -INSERT INTO category (ID, title, parentID) VALUES (5020, 'Foreign', 5000); -INSERT INTO category (ID, title, parentID) VALUES (5030, 'SD', 5000); -INSERT INTO category (ID, title, parentID) VALUES (5040, 'HD', 5000); -INSERT INTO category (ID, title, parentID) VALUES (5050, 'Other', 5000); -INSERT INTO category (ID, title, parentID) VALUES (5060, 'Sport', 5000); -INSERT INTO category (ID, title, parentID) VALUES (5070, 'Anime', 5000); -INSERT INTO category (ID, title, parentID) VALUES (5080, 'Documentary', 5000); +INSERT INTO category (id, title, parentID) VALUES (5010, 'WEB-DL', 5000); +INSERT INTO category (id, title, parentID) VALUES (5020, 'Foreign', 5000); +INSERT INTO category (id, title, parentID) VALUES (5030, 'SD', 5000); +INSERT INTO category (id, title, parentID) VALUES (5040, 'HD', 5000); +INSERT INTO category (id, title, parentID) VALUES (5050, 'Other', 5000); +INSERT INTO category (id, title, parentID) VALUES (5060, 'Sport', 5000); +INSERT INTO category (id, title, parentID) VALUES (5070, 'Anime', 5000); +INSERT INTO category (id, title, parentID) VALUES (5080, 'Documentary', 5000); -INSERT INTO category (ID, title, parentID) VALUES (6010, 'DVD', 6000); -INSERT INTO category (ID, title, parentID) VALUES (6020, 'WMV', 6000); -INSERT INTO category (ID, title, parentID) VALUES (6030, 'XviD', 6000); -INSERT INTO category (ID, title, parentID) VALUES (6040, 'x264', 6000); -INSERT INTO category (ID, title, parentID) VALUES (6050, 'Pack', 6000); -INSERT INTO category (ID, title, parentID) VALUES (6060, 'ImgSet', 6000); -INSERT INTO category (ID, title, parentID) VALUES (6070, 'Other', 6000); +INSERT INTO category (id, title, parentID) VALUES (6010, 'DVD', 6000); +INSERT INTO category (id, title, parentID) VALUES (6020, 'WMV', 6000); +INSERT INTO category (id, title, parentID) VALUES (6030, 'XviD', 6000); +INSERT INTO category (id, title, parentID) VALUES (6040, 'x264', 6000); +INSERT INTO category (id, title, parentID) VALUES (6050, 'Pack', 6000); +INSERT INTO category (id, title, parentID) VALUES (6060, 'ImgSet', 6000); +INSERT INTO category (id, title, parentID) VALUES (6070, 'Other', 6000); -INSERT INTO category (ID, title, parentID) VALUES (7010, 'Mags', 7000); -INSERT INTO category (ID, title, parentID) VALUES (7020, 'Ebook', 7000); -INSERT INTO category (ID, title, parentID) VALUES (7030, 'Comics', 7000); -INSERT INTO category (ID, title, parentID) VALUES (7040, 'Technical', 7000); -INSERT INTO category (ID, title, parentID) VALUES (7050, 'Other', 7000); -INSERT INTO category (ID, title, parentID) VALUES (7060, 'Foreign', 7000); +INSERT INTO category (id, title, parentID) VALUES (7010, 'Mags', 7000); +INSERT INTO category (id, title, parentID) VALUES (7020, 'Ebook', 7000); +INSERT INTO category (id, title, parentID) VALUES (7030, 'Comics', 7000); +INSERT INTO category (id, title, parentID) VALUES (7040, 'Technical', 7000); +INSERT INTO category (id, title, parentID) VALUES (7050, 'Other', 7000); +INSERT INTO category (id, title, parentID) VALUES (7060, 'Foreign', 7000); -INSERT INTO category (ID, title, parentID) VALUES (8010, 'Misc', 8000); -INSERT INTO category (ID, title, parentID) VALUES (8020, 'Hashed', 8000); +INSERT INTO category (id, title, parentID) VALUES (8010, 'Misc', 8000); +INSERT INTO category (id, title, parentID) VALUES (8020, 'Hashed', 8000); UPDATE `tmux` SET `value` = '50' WHERE `setting` = 'sqlpatch'; \ No newline at end of file diff --git a/lib/DB/patches/0054~releases.sql b/lib/DB/patches/0054~releases.sql index 3e59e2db5..948ea1e66 100644 --- a/lib/DB/patches/0054~releases.sql +++ b/lib/DB/patches/0054~releases.sql @@ -1,3 +1,3 @@ -ALTER TABLE releases ADD COLUMN gamesinfo_id INT AFTER consoleinfoID; +ALTER TABLE releases ADD COLUMN gamesinfo_id INT AFTER consoleinfoid; CREATE INDEX ix_releases_gamesinfo_id ON releases (gamesinfo_id); UPDATE `tmux` SET `value` = '54' WHERE `setting` = 'sqlpatch'; \ No newline at end of file diff --git a/lib/DB/patches/0066~genres.sql b/lib/DB/patches/0066~genres.sql index e94ff0df1..ad313c0a4 100644 --- a/lib/DB/patches/0066~genres.sql +++ b/lib/DB/patches/0066~genres.sql @@ -1,13 +1,13 @@ DROP TABLE IF EXISTS `genres`; CREATE TABLE IF NOT EXISTS `genres` ( - `ID` int(11) NOT NULL AUTO_INCREMENT, + `id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `type` int(4) DEFAULT NULL, `disabled` tinyint(1) NOT NULL DEFAULT '0', - PRIMARY KEY (`ID`) + PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC AUTO_INCREMENT=635; -INSERT IGNORE INTO `genres` (`ID`, `title`, `type`, `disabled`) VALUES +INSERT IGNORE INTO `genres` (`id`, `title`, `type`, `disabled`) VALUES (150, 'Blues', 3000, 0), (151, 'Classic Rock', 3000, 0), (152, 'Country', 3000, 0), diff --git a/lib/DB/patches/0072~site.sql b/lib/DB/patches/0072~site.sql index fa38c25ef..2ea46b68e 100644 --- a/lib/DB/patches/0072~site.sql +++ b/lib/DB/patches/0072~site.sql @@ -8,16 +8,16 @@ DROP TRIGGER IF EXISTS check_update; DROP TRIGGER IF EXISTS insert_MD5; DELIMITER $$ -CREATE TRIGGER insert_hashes AFTER INSERT ON prehash FOR EACH ROW BEGIN INSERT INTO predbhash (pre_id, hashes) VALUES (NEW.ID, CONCAT_WS(',', MD5(NEW.title), MD5(MD5(NEW.title)), SHA1(NEW.title)));END;$$ -CREATE TRIGGER update_hashes AFTER UPDATE ON prehash FOR EACH ROW BEGIN IF NEW.title != OLD.title THEN UPDATE predbhash SET hashes = CONCAT_WS(',', MD5(NEW.title), MD5(MD5(NEW.title)), SHA1(NEW.title)) WHERE pre_id = OLD.ID; END IF;END;$$ -CREATE TRIGGER delete_hashes AFTER DELETE ON prehash FOR EACH ROW BEGIN DELETE FROM predbhash WHERE pre_id = OLD.ID; END;$$ +CREATE TRIGGER insert_hashes AFTER INSERT ON prehash FOR EACH ROW BEGIN INSERT INTO predbhash (pre_id, hashes) VALUES (NEW.id, CONCAT_WS(',', MD5(NEW.title), MD5(MD5(NEW.title)), SHA1(NEW.title)));END;$$ +CREATE TRIGGER update_hashes AFTER UPDATE ON prehash FOR EACH ROW BEGIN IF NEW.title != OLD.title THEN UPDATE predbhash SET hashes = CONCAT_WS(',', MD5(NEW.title), MD5(MD5(NEW.title)), SHA1(NEW.title)) WHERE pre_id = OLD.id; END IF;END;$$ +CREATE TRIGGER delete_hashes AFTER DELETE ON prehash FOR EACH ROW BEGIN DELETE FROM predbhash WHERE pre_id = OLD.id; END;$$ CREATE TRIGGER check_rfinsert BEFORE INSERT ON releasefiles FOR EACH ROW BEGIN IF NEW.name REGEXP '[a-fA-F0-9]{32}'THEN SET NEW.ishashed = 1; END IF;END;$$ CREATE TRIGGER check_rfupdate BEFORE UPDATE ON releasefiles FOR EACH ROW BEGIN IF NEW.name REGEXP '[a-fA-F0-9]{32}' THEN SET NEW.ishashed = 1; END IF; END;$$ CREATE TRIGGER check_insert BEFORE INSERT ON releases FOR EACH ROW BEGIN IF NEW.searchname REGEXP '[a-fA-F0-9]{32}' OR NEW.name REGEXP '[a-fA-F0-9]{32}' THEN SET NEW.ishashed = 1;ELSEIF NEW.name REGEXP '^\\[ ?([[:digit:]]{4,6}) ?\\]|^REQ\s*([[:digit:]]{4,6})|^([[:digit:]]{4,6})-[[:digit:]]{1}\\[' THEN SET NEW.isrequestid = 1; END IF; END;$$ CREATE TRIGGER check_update BEFORE UPDATE ON releases FOR EACH ROW BEGIN IF NEW.searchname REGEXP '[a-fA-F0-9]{32}' OR NEW.name REGEXP '[a-fA-F0-9]{32}' THEN SET NEW.ishashed = 1;ELSEIF NEW.name REGEXP '^\\[ ?([[:digit:]]{4,6}) ?\\]|^REQ\s*([[:digit:]]{4,6})|^([[:digit:]]{4,6})-[[:digit:]]{1}\\[' THEN SET NEW.isrequestid = 1;END IF;END;$$ -CREATE TRIGGER insert_search AFTER INSERT ON releases FOR EACH ROW BEGIN INSERT INTO releasesearch (releaseID, guid, name, searchname) VALUES (NEW.ID, NEW.guid, NEW.name, NEW.searchname);END;$$ -CREATE TRIGGER update_search AFTER UPDATE ON releases FOR EACH ROW BEGIN IF NEW.guid != OLD.guid THEN UPDATE releasesearch SET guid = NEW.guid WHERE releaseID = OLD.ID; END IF;IF NEW.name != OLD.name THEN UPDATE releasesearch SET name = NEW.name WHERE releaseID = OLD.ID; END IF; IF NEW.searchname != OLD.searchname THEN UPDATE releasesearch SET searchname = NEW.searchname WHERE releaseID = OLD.ID; END IF;END;$$ -CREATE TRIGGER delete_search AFTER DELETE ON releases FOR EACH ROW BEGIN DELETE FROM releasesearch WHERE releaseID = OLD.ID; END;$$ +CREATE TRIGGER insert_search AFTER INSERT ON releases FOR EACH ROW BEGIN INSERT INTO releasesearch (releaseid, guid, name, searchname) VALUES (NEW.id, NEW.guid, NEW.name, NEW.searchname);END;$$ +CREATE TRIGGER update_search AFTER UPDATE ON releases FOR EACH ROW BEGIN IF NEW.guid != OLD.guid THEN UPDATE releasesearch SET guid = NEW.guid WHERE releaseid = OLD.id; END IF;IF NEW.name != OLD.name THEN UPDATE releasesearch SET name = NEW.name WHERE releaseid = OLD.id; END IF; IF NEW.searchname != OLD.searchname THEN UPDATE releasesearch SET searchname = NEW.searchname WHERE releaseid = OLD.id; END IF;END;$$ +CREATE TRIGGER delete_search AFTER DELETE ON releases FOR EACH ROW BEGIN DELETE FROM releasesearch WHERE releaseid = OLD.id; END;$$ CREATE TRIGGER insert_MD5 BEFORE INSERT ON releasecomment FOR EACH ROW SET NEW.text_hash = MD5(NEW.text);$$ DELIMITER ; diff --git a/lib/DB/patches/0086~category.sql b/lib/DB/patches/0086~category.sql index 49e3733a6..48b4bafb7 100644 --- a/lib/DB/patches/0086~category.sql +++ b/lib/DB/patches/0086~category.sql @@ -1,2 +1,2 @@ -INSERT INTO category (ID, title, parentID) VALUES (2080, 'WEB-DL', 2000); +INSERT INTO category (id, title, parentID) VALUES (2080, 'WEB-DL', 2000); UPDATE `tmux` SET `value` = '86' WHERE `setting` = 'sqlpatch'; \ No newline at end of file diff --git a/lib/DB/patches/0091~releasesearch.sql b/lib/DB/patches/0091~releasesearch.sql index 5c96eac56..cd4b0ac74 100644 --- a/lib/DB/patches/0091~releasesearch.sql +++ b/lib/DB/patches/0091~releasesearch.sql @@ -1,5 +1,5 @@ ALTER TABLE releasesearch ADD COLUMN fromname VARCHAR(255) COLLATE utf8_unicode_ci DEFAULT NULL; -UPDATE releasesearch rs INNER JOIN releases r ON rs.releaseID = r.ID SET rs.fromname = r.fromname; +UPDATE releasesearch rs INNER JOIN releases r ON rs.releaseid = r.id SET rs.fromname = r.fromname; ALTER TABLE releasesearch DROP INDEX ix_releasesearch_name_searchname_ft; ALTER TABLE releasesearch ADD FULLTEXT INDEX ix_releasesearch_name_ft (name); @@ -9,7 +9,7 @@ ALTER TABLE releasesearch ADD FULLTEXT INDEX ix_releasesearch_fromname_ft (fromn DROP TRIGGER IF EXISTS insert_search; DROP TRIGGER IF EXISTS update_search; -CREATE TRIGGER insert_search AFTER INSERT ON releases FOR EACH ROW BEGIN INSERT INTO releasesearch (releaseID, guid, name, searchname, fromname) VALUES (NEW.ID, NEW.guid, NEW.name, NEW.searchname, NEW.fromname); END; -CREATE TRIGGER update_search AFTER UPDATE ON releases FOR EACH ROW BEGIN IF NEW.guid != OLD.guid THEN UPDATE releasesearch SET guid = NEW.guid WHERE releaseID = OLD.ID; END IF; IF NEW.name != OLD.name THEN UPDATE releasesearch SET name = NEW.name WHERE releaseID = OLD.ID; END IF; IF NEW.searchname != OLD.searchname THEN UPDATE releasesearch SET searchname = NEW.searchname WHERE releaseID = OLD.ID; END IF; IF NEW.fromname != OLD.fromname THEN UPDATE releasesearch SET fromname = NEW.fromname WHERE releaseID = OLD.ID; END IF; END; +CREATE TRIGGER insert_search AFTER INSERT ON releases FOR EACH ROW BEGIN INSERT INTO releasesearch (releaseid, guid, name, searchname, fromname) VALUES (NEW.id, NEW.guid, NEW.name, NEW.searchname, NEW.fromname); END; +CREATE TRIGGER update_search AFTER UPDATE ON releases FOR EACH ROW BEGIN IF NEW.guid != OLD.guid THEN UPDATE releasesearch SET guid = NEW.guid WHERE releaseid = OLD.id; END IF; IF NEW.name != OLD.name THEN UPDATE releasesearch SET name = NEW.name WHERE releaseid = OLD.id; END IF; IF NEW.searchname != OLD.searchname THEN UPDATE releasesearch SET searchname = NEW.searchname WHERE releaseid = OLD.id; END IF; IF NEW.fromname != OLD.fromname THEN UPDATE releasesearch SET fromname = NEW.fromname WHERE releaseid = OLD.id; END IF; END; UPDATE `tmux` SET `value` = '91' WHERE `setting` = 'sqlpatch'; \ No newline at end of file diff --git a/lib/DB/patches/0093~anidb.sql b/lib/DB/patches/0093~anidb.sql index 7893c952a..1b69be901 100644 --- a/lib/DB/patches/0093~anidb.sql +++ b/lib/DB/patches/0093~anidb.sql @@ -1,7 +1,7 @@ DROP TABLE IF EXISTS anidb_episodes; CREATE TABLE anidb_episodes ( anidbid INT(10) UNSIGNED NOT NULL - COMMENT 'ID of title from AniDB', + COMMENT 'id of title from AniDB', episodeid INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'anidb id for this episode', episode_no SMALLINT(5) UNSIGNED NOT NULL @@ -20,7 +20,7 @@ CREATE TABLE anidb_episodes ( DROP TABLE IF EXISTS anidb_info; CREATE TABLE anidb_info ( anidbid INT(10) UNSIGNED NOT NULL - COMMENT 'ID of title from AniDB', + COMMENT 'id of title from AniDB', type VARCHAR(32) COLLATE utf8_unicode_ci DEFAULT NULL, startdate DATE DEFAULT NULL, @@ -53,7 +53,7 @@ CREATE TABLE anidb_info ( DROP TABLE IF EXISTS anidb_titles; CREATE TABLE anidb_titles ( anidbid INT(10) UNSIGNED NOT NULL - COMMENT 'ID of title from AniDB', + COMMENT 'id of title from AniDB', type VARCHAR(25) COLLATE utf8_unicode_ci NOT NULL COMMENT 'type of title.', diff --git a/lib/DB/patches/0099~releases.sql b/lib/DB/patches/0099~releases.sql index 6df5b6d43..5531fdd92 100644 --- a/lib/DB/patches/0099~releases.sql +++ b/lib/DB/patches/0099~releases.sql @@ -23,12 +23,12 @@ DROP INDEX ix_releases_nzb_guid ON releases; DROP INDEX ix_releases_prehashid_searchname ON releases; DROP INDEX idx_releases_multi_name_fromname_size ON releases; -ALTER TABLE releases MODIFY ID INT(11) UNSIGNED NOT NULL; +ALTER TABLE releases MODIFY id INT(11) UNSIGNED NOT NULL; ALTER TABLE releases DROP PRIMARY KEY; -ALTER TABLE releases ADD PRIMARY KEY (ID, categoryID); -ALTER TABLE releases MODIFY ID INT(11) UNSIGNED NOT NULL AUTO_INCREMENT; +ALTER TABLE releases ADD PRIMARY KEY (id, categoryid); +ALTER TABLE releases MODIFY id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT; -ALTER TABLE releases PARTITION BY RANGE (categoryID) ( +ALTER TABLE releases PARTITION BY RANGE (categoryid) ( PARTITION unused VALUES LESS THAN (1000), PARTITION console VALUES LESS THAN (2000), PARTITION movies VALUES LESS THAN (3000), @@ -40,21 +40,21 @@ PARTITION books VALUES LESS THAN (8000), PARTITION misc VALUES LESS THAN (9000) ); ALTER TABLE releases ADD INDEX ix_releases_adddate (adddate); -ALTER TABLE releases ADD INDEX ix_releases_rageid (rageID); -ALTER TABLE releases ADD INDEX ix_releases_imdbid (imdbID); +ALTER TABLE releases ADD INDEX ix_releases_rageid (rageid); +ALTER TABLE releases ADD INDEX ix_releases_imdbid (imdbid); ALTER TABLE releases ADD INDEX ix_releases_guid (guid); ALTER TABLE releases ADD INDEX ix_releases_name (name); -ALTER TABLE releases ADD INDEX ix_releases_groupid (groupID); +ALTER TABLE releases ADD INDEX ix_releases_groupid (groupid); ALTER TABLE releases ADD INDEX ix_releases_dehashstatus (dehashstatus); ALTER TABLE releases ADD INDEX ix_releases_reqidstatus (reqidstatus); ALTER TABLE releases ADD INDEX ix_releases_nfostatus (nfostatus); -ALTER TABLE releases ADD INDEX ix_releases_musicinfoid (musicinfoID); -ALTER TABLE releases ADD INDEX ix_releases_consoleinfoid (consoleinfoID); -ALTER TABLE releases ADD INDEX ix_releases_bookinfoid (bookinfoID); +ALTER TABLE releases ADD INDEX ix_releases_musicinfoid (musicinfoid); +ALTER TABLE releases ADD INDEX ix_releases_consoleinfoid (consoleinfoid); +ALTER TABLE releases ADD INDEX ix_releases_bookinfoid (bookinfoid); ALTER TABLE releases ADD INDEX ix_releases_haspreview_passwordstatus (haspreview, passwordstatus); -ALTER TABLE releases ADD INDEX ix_releases_status (nzbstatus, iscategorized, isrenamed, nfostatus, ishashed, isrequestid, passwordstatus, dehashstatus, reqidstatus, musicinfoID, consoleinfoID, bookinfoID, haspreview, categoryID, imdbID, rageID); +ALTER TABLE releases ADD INDEX ix_releases_status (nzbstatus, iscategorized, isrenamed, nfostatus, ishashed, isrequestid, passwordstatus, dehashstatus, reqidstatus, musicinfoid, consoleinfoid, bookinfoid, haspreview, categoryid, imdbid, rageid); ALTER TABLE releases ADD INDEX ix_releases_postdate_searchname (postdate, searchname); ALTER TABLE releases ADD INDEX ix_releases_nzb_guid (nzb_guid); -ALTER TABLE releases ADD INDEX ix_releases_prehash_searchname (prehashID, searchname); +ALTER TABLE releases ADD INDEX ix_releases_prehash_searchname (prehashid, searchname); UPDATE tmux set value = '99' where setting = 'sqlpatch'; diff --git a/lib/DB/patches/0100~binaries.sql b/lib/DB/patches/0100~binaries.sql index f1dc636ff..7fdba70d3 100644 --- a/lib/DB/patches/0100~binaries.sql +++ b/lib/DB/patches/0100~binaries.sql @@ -1,5 +1,5 @@ DROP TRIGGER IF EXISTS delete_binaries; -CREATE TRIGGER delete_binaries BEFORE DELETE ON binaries FOR EACH ROW BEGIN DELETE FROM parts WHERE binaryID = OLD.ID; END; +CREATE TRIGGER delete_binaries BEFORE DELETE ON binaries FOR EACH ROW BEGIN DELETE FROM parts WHERE binaryID = OLD.id; END; UPDATE tmux set value = '100' where setting = 'sqlpatch'; \ No newline at end of file diff --git a/lib/DB/patches/0106~category.sql b/lib/DB/patches/0106~category.sql index e34d61e4e..01cd49db6 100644 --- a/lib/DB/patches/0106~category.sql +++ b/lib/DB/patches/0106~category.sql @@ -1,2 +1,2 @@ -INSERT INTO category (ID, title, parentID) VALUES (6080, 'SD', 6000); +INSERT INTO category (id, title, parentID) VALUES (6080, 'SD', 6000); UPDATE `tmux` SET `value` = '106' WHERE `setting` = 'sqlpatch'; \ No newline at end of file diff --git a/lib/DB/patches/0110~category.sql b/lib/DB/patches/0110~category.sql index 72d6068d0..8c42f9d10 100644 --- a/lib/DB/patches/0110~category.sql +++ b/lib/DB/patches/0110~category.sql @@ -1,3 +1,3 @@ -INSERT INTO category (ID, title, parentID) VALUES (6041, 'HD Clips', 6000); -INSERT INTO category (ID, title, parentID) VALUES (6042, 'SD Clips', 6000); +INSERT INTO category (id, title, parentID) VALUES (6041, 'HD Clips', 6000); +INSERT INTO category (id, title, parentID) VALUES (6042, 'SD Clips', 6000); UPDATE `tmux` SET `value` = '110' WHERE `setting` = 'sqlpatch'; \ No newline at end of file diff --git a/lib/DB/patches/0112~category.sql b/lib/DB/patches/0112~category.sql index a227b0d63..b7440a98b 100644 --- a/lib/DB/patches/0112~category.sql +++ b/lib/DB/patches/0112~category.sql @@ -1,2 +1,2 @@ -INSERT INTO category (ID, title, parentID) VALUES (6090, 'WEB-DL', 6000); +INSERT INTO category (id, title, parentID) VALUES (6090, 'WEB-DL', 6000); UPDATE `tmux` SET `value` = '112' WHERE `setting` = 'sqlpatch'; \ No newline at end of file diff --git a/lib/DB/patches/0113~releases.sql b/lib/DB/patches/0113~releases.sql index ce369418c..f5ccd4713 100644 --- a/lib/DB/patches/0113~releases.sql +++ b/lib/DB/patches/0113~releases.sql @@ -1,2 +1,2 @@ -ALTER TABLE releases ADD INDEX ix_releases_preid_searchname (preID, searchname); +ALTER TABLE releases ADD INDEX ix_releases_preid_searchname (preid, searchname); UPDATE `tmux` SET `value` = '113' WHERE `setting` = 'sqlpatch'; \ No newline at end of file diff --git a/lib/Film.php b/lib/Film.php index 9be10691b..c14d59ac9 100644 --- a/lib/Film.php +++ b/lib/Film.php @@ -192,7 +192,7 @@ class Film */ public function getMovieInfo($imdbId) { - return $this->pdo->queryOneRow(sprintf("SELECT * FROM movieinfo WHERE imdbID = %d", $imdbId)); + return $this->pdo->queryOneRow(sprintf("SELECT * FROM movieinfo WHERE imdbid = %d", $imdbId)); } /** @@ -206,10 +206,10 @@ class Film { return $this->pdo->query( sprintf(" - SELECT DISTINCT movieinfo.*, releases.imdbID AS relimdb + SELECT DISTINCT movieinfo.*, releases.imdbid AS relimdb FROM movieinfo - LEFT OUTER JOIN releases ON releases.imdbID = movieinfo.imdbID - WHERE movieinfo.imdbID IN (%s)", + LEFT OUTER JOIN releases ON releases.imdbid = movieinfo.imdbid + WHERE movieinfo.imdbid IN (%s)", str_replace( ',,', ',', @@ -250,7 +250,7 @@ class Film */ public function getCount() { - $res = $this->pdo->queryOneRow('SELECT COUNT(ID) AS num FROM movieinfo'); + $res = $this->pdo->queryOneRow('SELECT COUNT(id) AS num FROM movieinfo'); return ($res === false ? 0 : $res['num']); } @@ -272,11 +272,11 @@ class Film $res = $this->pdo->queryOneRow( sprintf(" - SELECT COUNT(DISTINCT r.imdbID) AS num + SELECT COUNT(DISTINCT r.imdbid) AS num FROM releases r - INNER JOIN movieinfo m ON m.imdbID = r.imdbID + INNER JOIN movieinfo m ON m.imdbid = r.imdbid WHERE r.nzbstatus = 1 - AND r.imdbID != '0000000' + AND r.imdbid != '0000000' AND m.cover = 1 AND m.title != '' AND r.passwordstatus <= %d @@ -285,7 +285,7 @@ class Film $this->getBrowseBy(), $catsrch, ($maxAge > 0 ? 'AND r.postdate > NOW() - INTERVAL ' . $maxAge . ' DAY' : ''), - (count($excludedCats) > 0 ? ' AND r.categoryID NOT IN (' . implode(',', $excludedCats) . ')' : '') + (count($excludedCats) > 0 ? ' AND r.categoryid NOT IN (' . implode(',', $excludedCats) . ')' : '') ) ); @@ -314,12 +314,12 @@ class Film $order = $this->getMovieOrder($orderBy); $sql = sprintf(" SELECT - GROUP_CONCAT(r.ID ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_id, + GROUP_CONCAT(r.id ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_id, GROUP_CONCAT(r.rarinnerfilecount ORDER BY r.postdate DESC SEPARATOR ',') as grp_rarinnerfilecount, GROUP_CONCAT(r.haspreview ORDER BY r.postdate DESC SEPARATOR ',') AS grp_haspreview, GROUP_CONCAT(r.passwordstatus ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_password, GROUP_CONCAT(r.guid ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_guid, - GROUP_CONCAT(rn.ID ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_nfoid, + GROUP_CONCAT(rn.id ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_nfoid, GROUP_CONCAT(groups.name ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_grpname, GROUP_CONCAT(r.searchname ORDER BY r.postdate DESC SEPARATOR '#') AS grp_release_name, GROUP_CONCAT(r.postdate ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_postdate, @@ -327,14 +327,14 @@ class Film GROUP_CONCAT(r.totalpart ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_totalparts, GROUP_CONCAT(r.comments ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_comments, GROUP_CONCAT(r.grabs ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_grabs, - m.*, groups.name AS group_name, rn.ID as nfoid FROM releases r - LEFT OUTER JOIN groups ON groups.ID = r.groupID - LEFT OUTER JOIN releasenfo rn ON rn.releaseID = r.ID - INNER JOIN movieinfo m ON m.imdbID = r.imdbID - WHERE r.nzbstatus = 1 AND r.imdbID != '0000000' + m.*, groups.name AS group_name, rn.id as nfoid FROM releases r + LEFT OUTER JOIN groups ON groups.id = r.groupid + LEFT OUTER JOIN releasenfo rn ON rn.releaseid = r.id + INNER JOIN movieinfo m ON m.imdbid = r.imdbid + WHERE r.nzbstatus = 1 AND r.imdbid != '0000000' AND m.title != '' AND r.passwordstatus <= %d AND %s %s %s %s - GROUP BY m.imdbID ORDER BY %s %s %s", + GROUP BY m.imdbid ORDER BY %s %s %s", $this->showPasswords, $this->getBrowseBy(), $catsrch, @@ -342,7 +342,7 @@ class Film ? 'AND r.postdate > NOW() - INTERVAL ' . $maxAge . 'DAY ' : '' ), - (count($excludedCats) > 0 ? ' AND r.categoryID NOT IN (' . implode(',', $excludedCats) . ')' : ''), + (count($excludedCats) > 0 ? ' AND r.categoryid NOT IN (' . implode(',', $excludedCats) . ')' : ''), $order[0], $order[1], ($start === false ? '' : ' LIMIT ' . $num . ' OFFSET ' . $start) @@ -466,7 +466,7 @@ class Film sprintf(" UPDATE movieinfo SET %s, %s, %s, %s, %s, %s, %s, %s, %s, %d, %d, updateddate = NOW() - WHERE imdbID = %d", + WHERE imdbid = %d", (empty($title) ? '' : 'title = ' . $this->pdo->escapeString($title)), (empty($tagLine) ? '' : 'tagline = ' . $this->pdo->escapeString($tagLine)), (empty($plot) ? '' : 'plot = ' . $this->pdo->escapeString($plot)), @@ -527,7 +527,7 @@ class Film public function updateMovieInfo($imdbId) { if ($this->echooutput && $this->service !== '') { - $this->pdo->log->doEcho($this->pdo->log->primary("Fetching IMDB info from TMDB using IMDB ID: " . $imdbId)); + $this->pdo->log->doEcho($this->pdo->log->primary("Fetching IMDB info from TMDB using IMDB id: " . $imdbId)); } // Check TMDB for IMDB info. @@ -611,12 +611,12 @@ class Film $movieID = $this->pdo->queryInsert( sprintf(" INSERT INTO movieinfo - (imdbID, tmdbID, title, rating, tagline, plot, year, genre, type, + (imdbid, tmdbID, title, rating, tagline, plot, year, genre, type, director, actors, language, cover, backdrop, createddate, updateddate) VALUES (%d, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %d, %d, NOW(), NOW()) ON DUPLICATE KEY UPDATE - imdbID = %d, tmdbID = %s, title = %s, rating = %s, tagline = %s, plot = %s, year = %s, genre = %s, + imdbid = %d, tmdbID = %s, title = %s, rating = %s, tagline = %s, plot = %s, year = %s, genre = %s, type = %s, director = %s, actors = %s, language = %s, cover = %d, backdrop = %d, updateddate = NOW()", $mov['imdbid'], $mov['tmdbid'], @@ -883,7 +883,7 @@ class Film * * @param string $buffer Data to parse a IMDB id from. * @param string $service Method that called this method. - * @param int $id ID of the release. + * @param int $id id of the release. * @param int $processImdb To get IMDB info on this IMDB id or not. * * @return string @@ -901,14 +901,14 @@ class Film $this->pdo->log->doEcho($this->pdo->log->headerOver($service . ' found IMDBid: ') . $this->pdo->log->primary('tt' . $imdbID)); } - $this->pdo->queryExec(sprintf('UPDATE releases SET imdbID = %s WHERE ID = %d', $this->pdo->escapeString($imdbID), $id)); + $this->pdo->queryExec(sprintf('UPDATE releases SET imdbid = %s WHERE id = %d', $this->pdo->escapeString($imdbID), $id)); // If set, scan for imdb info. if ($processImdb == 1) { $movCheck = $this->getMovieInfo($imdbID); if ($movCheck === false || (isset($movCheck['updateddate']) && (time() - strtotime($movCheck['updateddate'])) > 2592000)) { if ($this->updateMovieInfo($imdbID) === false) { - $this->pdo->queryExec(sprintf('UPDATE releases SET imdbID = %s WHERE ID = %d', 0000000, $id)); + $this->pdo->queryExec(sprintf('UPDATE releases SET imdbid = %s WHERE id = %d', 0000000, $id)); } } } @@ -917,9 +917,9 @@ class Film } /** - * Process releases with no IMDB ID's. + * Process releases with no IMDB id's. * - * @param string $groupID (Optional) ID of a group to work on. + * @param string $groupID (Optional) id of a group to work on. * @param string $guidChar (Optional) First letter of a release GUID to use to get work. * @param int $lookupIMDB (Optional) 0 Don't lookup IMDB, 1 lookup IMDB, 2 lookup IMDB on releases that were renamed. */ @@ -933,14 +933,14 @@ class Film // Get all releases without an IMDB id. $res = $this->pdo->query( sprintf(" - SELECT r.searchname, r.ID + SELECT r.searchname, r.id FROM releases r - WHERE r.imdbID IS NULL + WHERE r.imdbid IS NULL AND r.nzbstatus = 1 - AND r.categoryID BETWEEN 2000 AND 2999 + AND r.categoryid BETWEEN 2000 AND 2999 %s %s %s LIMIT %d", - ($groupID === '' ? '' : ('AND r.groupID = ' . $groupID)), + ($groupID === '' ? '' : ('AND r.groupid = ' . $groupID)), ($guidChar === '' ? '' : ('AND r.guid ' . $this->pdo->likeString($guidChar, false, true))), ($lookupIMDB == 2 ? 'AND r.isrenamed = 1' : ''), $this->movieqty @@ -958,11 +958,11 @@ class Film // Try to get a name/year. if ($this->parseMovieSearchName($arr['searchname']) === false) { //We didn't find a name, so set to all 0's so we don't parse again. - $this->pdo->queryExec(sprintf("UPDATE releases SET imdbID = 0000000 WHERE ID = %d", $arr["ID"])); + $this->pdo->queryExec(sprintf("UPDATE releases SET imdbid = 0000000 WHERE id = %d", $arr["id"])); continue; } else { - $this->currentRelID = $arr['ID']; + $this->currentRelID = $arr['id']; $movieName = $this->currentTitle; if ($this->currentYear !== false) { @@ -977,7 +977,7 @@ class Film $getIMDBid = $this->localIMDBsearch(); if ($getIMDBid !== false) { - $imdbID = $this->doMovieUpdate('tt' . $getIMDBid, 'Local DB', $arr['ID']); + $imdbID = $this->doMovieUpdate('tt' . $getIMDBid, 'Local DB', $arr['id']); if ($imdbID !== false) { continue; } @@ -996,8 +996,8 @@ class Film if ($buffer !== false) { $getIMDBid = json_decode($buffer); - if (isset($getIMDBid->imdbID)) { - $imdbID = $this->doMovieUpdate($getIMDBid->imdbID, 'OMDbAPI', $arr['ID']); + if (isset($getIMDBid->imdbid)) { + $imdbID = $this->doMovieUpdate($getIMDBid->imdbid, 'OMDbAPI', $arr['id']); if ($imdbID !== false) { continue; } @@ -1007,7 +1007,7 @@ class Film // Check on trakt. $getIMDBid = $trakTv->traktMoviesummary($movieName); if ($getIMDBid !== false) { - $imdbID = $this->doMovieUpdate($getIMDBid, 'Trakt', $arr['ID']); + $imdbID = $this->doMovieUpdate($getIMDBid, 'Trakt', $arr['id']); if ($imdbID !== false) { continue; } @@ -1021,7 +1021,7 @@ class Film } // We failed to get an IMDB id from all sources. - $this->pdo->queryExec(sprintf("UPDATE releases SET imdbID = 0000000 WHERE ID = %d", $arr["ID"])); + $this->pdo->queryExec(sprintf("UPDATE releases SET imdbid = 0000000 WHERE id = %d", $arr["id"])); } } } @@ -1030,11 +1030,11 @@ class Film /** * Try to fetch an IMDB id locally. * - * @return int|bool Int, the imdbID when true, Bool when false. + * @return int|bool Int, the imdbid when true, Bool when false. */ protected function localIMDBsearch() { - $query = 'SELECT imdbID FROM movieinfo'; + $query = 'SELECT imdbid FROM movieinfo'; $andYearIn = ''; //If we found a year, try looking in a 4 year range. @@ -1094,8 +1094,8 @@ class Film return ( ($IMDBCheck === false ? false - : (is_numeric($IMDBCheck['imdbID']) - ? (int)$IMDBCheck['imdbID'] + : (is_numeric($IMDBCheck['imdbid']) + ? (int)$IMDBCheck['imdbid'] : false ) ) diff --git a/lib/IRCScraper.php b/lib/IRCScraper.php index cd2404ee1..6cda5d4c1 100644 --- a/lib/IRCScraper.php +++ b/lib/IRCScraper.php @@ -23,7 +23,7 @@ class IRCScraper extends IRCClient protected $_curPre; /** - * List of groups and their ID's + * List of groups and their id's * @var array * @access protected */ @@ -286,8 +286,8 @@ class IRCScraper extends IRCClient $query .= (!empty($this->_curPre['source']) ? 'source, ' : ''); $query .= (!empty($this->_curPre['reason']) ? 'nukereason, ' : ''); $query .= (!empty($this->_curPre['files']) ? 'files, ' : ''); - $query .= (!empty($this->_curPre['reqid']) ? 'requestID, ' : ''); - $query .= (!empty($this->_curPre['group_id']) ? 'groupID, ' : ''); + $query .= (!empty($this->_curPre['reqid']) ? 'requestid, ' : ''); + $query .= (!empty($this->_curPre['group_id']) ? 'groupid, ' : ''); $query .= (!empty($this->_curPre['nuked']) ? 'nuked, ' : ''); $query .= (!empty($this->_curPre['filename']) ? 'filename, ' : ''); @@ -335,8 +335,8 @@ class IRCScraper extends IRCClient $query .= (!empty($this->_curPre['source']) ? 'source = ' . $this->_pdo->escapeString($this->_curPre['source']) . ', ' : ''); $query .= (!empty($this->_curPre['files']) ? 'files = ' . $this->_pdo->escapeString($this->_curPre['files']) . ', ' : ''); $query .= (!empty($this->_curPre['reason']) ? 'nukereason = ' . $this->_pdo->escapeString($this->_curPre['reason']) . ', ' : ''); - $query .= (!empty($this->_curPre['reqid']) ? 'requestID = ' . $this->_curPre['reqid'] . ', ' : ''); - $query .= (!empty($this->_curPre['group_id']) ? 'groupID = ' . $this->_curPre['group_id'] . ', ' : ''); + $query .= (!empty($this->_curPre['reqid']) ? 'requestid = ' . $this->_curPre['reqid'] . ', ' : ''); + $query .= (!empty($this->_curPre['group_id']) ? 'groupid = ' . $this->_curPre['group_id'] . ', ' : ''); $query .= (!empty($this->_curPre['predate']) ? 'predate = ' . $this->_curPre['predate'] . ', ' : ''); $query .= (!empty($this->_curPre['nuked']) ? 'nuked = ' . $this->_curPre['nuked'] . ', ' : ''); $query .= (!empty($this->_curPre['filename']) ? 'filename = ' . $this->_pdo->escapeString($this->_curPre['filename']) . ', ' : ''); @@ -418,7 +418,7 @@ class IRCScraper extends IRCClient } /** - * Get a group ID for a group name. + * Get a group id for a group name. * * @param string $groupName * @@ -429,8 +429,8 @@ class IRCScraper extends IRCClient protected function _getGroupID($groupName) { if (!isset($this->_groupList[$groupName])) { - $group = $this->_pdo->queryOneRow(sprintf('SELECT ID FROM groups WHERE name = %s', $this->_pdo->escapeString($groupName))); - $this->_groupList[$groupName] = $group['ID']; + $group = $this->_pdo->queryOneRow(sprintf('SELECT id FROM groups WHERE name = %s', $this->_pdo->escapeString($groupName))); + $this->_groupList[$groupName] = $group['id']; } return $this->_groupList[$groupName]; } diff --git a/lib/Info.php b/lib/Info.php index c3bb7c179..01e1259bf 100644 --- a/lib/Info.php +++ b/lib/Info.php @@ -107,10 +107,10 @@ class Info } /** - * Look for a TvRage ID in a string. + * Look for a TvRage id in a string. * - * @param string $str The string with a TvRage ID. - * @return string The TVRage ID on success. + * @param string $str The string with a TvRage id. + * @return string The TVRage id on success. * * @return bool False on failure. * @@ -204,20 +204,20 @@ class Info */ public function addAlternateNfo(&$nfo, $release, $nntp) { - if ($release['ID'] > 0 && $this->isNFO($nfo, $release['guid'])) { + if ($release['id'] > 0 && $this->isNFO($nfo, $release['guid'])) { - $check = $this->pdo->queryOneRow(sprintf('SELECT ID FROM releasenfo WHERE releaseID = %d', $release['ID'])); + $check = $this->pdo->queryOneRow(sprintf('SELECT id FROM releasenfo WHERE releaseid = %d', $release['id'])); if ($check === false) { $this->pdo->queryInsert( - sprintf('INSERT INTO releasenfo (nfo, releaseID) VALUES (compress(%s), %d)', + sprintf('INSERT INTO releasenfo (nfo, releaseid) VALUES (compress(%s), %d)', $this->pdo->escapeString($nfo), - $release['ID'] + $release['id'] ) ); } - $this->pdo->queryExec(sprintf('UPDATE releases SET nfostatus = %d WHERE ID = %d', self::NFO_FOUND, $release['ID'])); + $this->pdo->queryExec(sprintf('UPDATE releases SET nfostatus = %d WHERE id = %d', self::NFO_FOUND, $release['id'])); if (!isset($release['completion'])) { $release['completion'] = 0; @@ -233,7 +233,7 @@ class Info 'PostProcess' => new PProcess(['Echo' => $this->echo, 'Settings' => $this->pdo, 'Nfo' => $this]) ] ); - $nzbContents->parseNZB($release['guid'], $release['ID'], $release['groupID']); + $nzbContents->parseNZB($release['guid'], $release['id'], $release['groupid']); } return true; } @@ -274,7 +274,7 @@ class Info * Attempt to find NFO files inside the NZB's of releases. * * @param object $nntp Instance of class NNTP. - * @param string $groupID (optional) Group ID. + * @param string $groupID (optional) Group id. * @param string $guidChar (optional) First character of the release GUID (used for multi-processing). * @param int $processImdb (optional) Attempt to find IMDB id's in the NZB? * @param int $processTvrage (optional) Attempt to find TvRage id's in the NZB? @@ -287,12 +287,12 @@ class Info { $ret = 0; $guidCharQuery = ($guidChar === '' ? '' : 'AND r.guid ' . $this->pdo->likeString($guidChar, false, true)); - $groupIDQuery = ($groupID === '' ? '' : 'AND r.groupID = ' . $groupID); + $groupIDQuery = ($groupID === '' ? '' : 'AND r.groupid = ' . $groupID); $optionsQuery = self::NfoQueryString($this->pdo); $res = $this->pdo->query( sprintf(' - SELECT r.ID, r.guid, r.groupID, r.name + SELECT r.id, r.guid, r.groupid, r.name FROM releases r WHERE 1=1 %s %s %s ORDER BY r.nfostatus ASC, r.postdate DESC @@ -354,19 +354,19 @@ class Info $tvRage = new TvAnger(['Echo' => $this->echo, 'Settings' => $this->pdo]); foreach ($res as $arr) { - $fetchedBinary = $nzbContents->getNFOfromNZB($arr['guid'], $arr['ID'], $arr['groupID'], $groups->getByNameByID($arr['groupID'])); + $fetchedBinary = $nzbContents->getNFOfromNZB($arr['guid'], $arr['id'], $arr['groupid'], $groups->getByNameByID($arr['groupid'])); if ($fetchedBinary !== false) { // Insert nfo into database. $cp = 'COMPRESS(%s)'; $nc = $this->pdo->escapeString($fetchedBinary); - $ckreleaseid = $this->pdo->queryOneRow(sprintf('SELECT ID FROM releasenfo WHERE releaseID = %d', $arr['ID'])); - if (!isset($ckreleaseid['ID'])) { - $this->pdo->queryInsert(sprintf('INSERT INTO releasenfo (nfo, releaseID) VALUES (' . $cp . ', %d)', $nc, $arr['ID'])); + $ckreleaseid = $this->pdo->queryOneRow(sprintf('SELECT id FROM releasenfo WHERE releaseid = %d', $arr['id'])); + if (!isset($ckreleaseid['id'])) { + $this->pdo->queryInsert(sprintf('INSERT INTO releasenfo (nfo, releaseid) VALUES (' . $cp . ', %d)', $nc, $arr['id'])); } - $this->pdo->queryExec(sprintf('UPDATE releases SET nfostatus = %d WHERE ID = %d', self::NFO_FOUND, $arr['ID'])); + $this->pdo->queryExec(sprintf('UPDATE releases SET nfostatus = %d WHERE id = %d', self::NFO_FOUND, $arr['id'])); $ret++; - $movie->doMovieUpdate($fetchedBinary, 'nfo', $arr['ID'], $processImdb); + $movie->doMovieUpdate($fetchedBinary, 'nfo', $arr['id'], $processImdb); // If set scan for tvrage info. if ($processTvrage == 1) { @@ -375,12 +375,12 @@ class Info $show = $tvRage->parseNameEpSeason($arr['name']); if (is_array($show) && $show['name'] != '') { // Update release with season, ep, and air date info (if available) from release title. - $tvRage->updateEpInfo($show, $arr['ID']); + $tvRage->updateEpInfo($show, $arr['id']); $rid = $tvRage->getByRageID($rageId); if (!$rid) { $tvrShow = $tvRage->getRageInfoFromService($rageId); - $tvRage->updateRageInfo($rageId, $show, $tvrShow, $arr['ID']); + $tvRage->updateRageInfo($rageId, $show, $tvrShow, $arr['id']); } } } @@ -392,7 +392,7 @@ class Info // Remove nfo that we cant fetch after 5 attempts. $releases = $this->pdo->queryDirect( sprintf( - 'SELECT r.ID + 'SELECT r.id FROM releases r WHERE r.nzbstatus = %d AND r.nfostatus < %d %s %s', @@ -406,7 +406,7 @@ class Info if ($releases instanceof Traversable) { foreach ($releases as $release) { $this->pdo->queryExec( - sprintf('DELETE FROM releasenfo WHERE nfo IS NULL AND releaseID = %d', $release['ID']) + sprintf('DELETE FROM releasenfo WHERE nfo IS NULL AND releaseid = %d', $release['id']) ); } } diff --git a/lib/Konsole.php b/lib/Konsole.php index 1cbceba48..0aadab4b0 100644 --- a/lib/Konsole.php +++ b/lib/Konsole.php @@ -93,7 +93,7 @@ class Konsole { return $this->pdo->queryOneRow( sprintf( - "SELECT consoleinfo.*, genres.title AS genres FROM consoleinfo LEFT OUTER JOIN genres ON genres.ID = consoleinfo.genreID WHERE consoleinfo.ID = %d ", + "SELECT consoleinfo.*, genres.title AS genres FROM consoleinfo LEFT OUTER JOIN genres ON genres.id = consoleinfo.genreID WHERE consoleinfo.id = %d ", $id ) ); @@ -122,7 +122,7 @@ class Konsole public function getCount() { - $res = $this->pdo->queryOneRow("SELECT COUNT(ID) AS num FROM consoleinfo"); + $res = $this->pdo->queryOneRow("SELECT COUNT(id) AS num FROM consoleinfo"); return ($res === false ? 0 : $res['num']); } @@ -135,16 +135,16 @@ class Konsole $res = $this->pdo->queryOneRow( sprintf(" - SELECT COUNT(DISTINCT r.consoleinfoID) AS num + SELECT COUNT(DISTINCT r.consoleinfoid) AS num FROM releases r - INNER JOIN consoleinfo con ON con.ID = r.consoleinfoID AND con.title != '' AND con.cover = 1 + INNER JOIN consoleinfo con ON con.id = r.consoleinfoid AND con.title != '' AND con.cover = 1 WHERE r.nzbstatus = 1 AND r.passwordstatus <= (SELECT value FROM site WHERE setting='showpasswordedrelease') AND %s %s %s %s", $this->getBrowseBy(), $catsrch, ($maxage > 0 ? sprintf(' AND r.postdate > NOW() - INTERVAL %d DAY ', $maxage) : ''), - (count($excludedcats) > 0 ? (' AND r.categoryID NOT IN (' . implode(',', $excludedcats) . ')') : '') + (count($excludedcats) > 0 ? (' AND r.categoryid NOT IN (' . implode(',', $excludedcats) . ')') : '') ) ); return ($res === false ? 0 : $res["num"]); @@ -168,18 +168,18 @@ class Konsole $exccatlist = ""; if (count($excludedcats) > 0) { - $exccatlist = " AND r.categoryID NOT IN (" . implode(",", $excludedcats) . ")"; + $exccatlist = " AND r.categoryid NOT IN (" . implode(",", $excludedcats) . ")"; } $order = $this->getConsoleOrder($orderby); return $this->pdo->query( sprintf( - "SELECT GROUP_CONCAT(r.ID ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_id, " + "SELECT GROUP_CONCAT(r.id ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_id, " . "GROUP_CONCAT(r.rarinnerfilecount ORDER BY r.postdate DESC SEPARATOR ',') as grp_rarinnerfilecount, " . "GROUP_CONCAT(r.haspreview ORDER BY r.postdate DESC SEPARATOR ',') AS grp_haspreview, " . "GROUP_CONCAT(r.passwordstatus ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_password, " . "GROUP_CONCAT(r.guid ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_guid, " - . "GROUP_CONCAT(rn.ID ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_nfoid, " + . "GROUP_CONCAT(rn.id ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_nfoid, " . "GROUP_CONCAT(groups.name ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_grpname, " . "GROUP_CONCAT(r.searchname ORDER BY r.postdate DESC SEPARATOR '#') AS grp_release_name, " . "GROUP_CONCAT(r.postdate ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_postdate, " @@ -187,15 +187,15 @@ class Konsole . "GROUP_CONCAT(r.totalpart ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_totalparts, " . "GROUP_CONCAT(r.comments ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_comments, " . "GROUP_CONCAT(r.grabs ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_grabs, " - . "con.*, r.consoleinfoID, groups.name AS group_name, rn.ID as nfoid FROM releases r " - . "LEFT OUTER JOIN groups ON groups.ID = r.groupID " - . "LEFT OUTER JOIN releasenfo rn ON rn.releaseID = r.ID " - . "INNER JOIN consoleinfo con ON con.ID = r.consoleinfoID " - . "INNER JOIN genres ON con.genreID = genres.ID " + . "con.*, r.consoleinfoid, groups.name AS group_name, rn.id as nfoid FROM releases r " + . "LEFT OUTER JOIN groups ON groups.id = r.groupid " + . "LEFT OUTER JOIN releasenfo rn ON rn.releaseid = r.id " + . "INNER JOIN consoleinfo con ON con.id = r.consoleinfoid " + . "INNER JOIN genres ON con.genreID = genres.id " . "WHERE r.nzbstatus = 1 AND con.title != '' AND " . "r.passwordstatus <= (SELECT value FROM site WHERE setting='showpasswordedrelease') AND %s %s %s " - . "GROUP BY con.ID ORDER BY %s %s" . $limit, $browseby, $catsrch, $exccatlist, $order[0], $order[1] + . "GROUP BY con.id ORDER BY %s %s" . $limit, $browseby, $catsrch, $exccatlist, $order[0], $order[1] ) ); } @@ -283,7 +283,7 @@ class Konsole SET title = %s, asin = %s, url = %s, salesrank = %s, platform = %s, publisher = %s, releasedate= %s, esrb = %s, cover = %d, genreID = %d, review = %s, updateddate = NOW() - WHERE ID = %d", + WHERE id = %d", $this->pdo->escapeString($title), $this->pdo->escapeString($asin), $this->pdo->escapeString($url), @@ -525,7 +525,7 @@ class Konsole $defaultGenres = $gen->getGenres(\Genres::CONSOLE_TYPE); $genreassoc = array(); foreach ($defaultGenres as $dg) { - $genreassoc[$dg['ID']] = strtolower($dg['title']); + $genreassoc[$dg['id']] = strtolower($dg['title']); } return $genreassoc; } @@ -603,7 +603,7 @@ class Konsole $check = $this->pdo->queryOneRow( sprintf(' - SELECT ID + SELECT id FROM consoleinfo WHERE asin = %s', $this->pdo->escapeString($con['asin']) @@ -662,11 +662,11 @@ class Konsole { $res = $this->pdo->queryDirect( sprintf(' - SELECT searchname, ID + SELECT searchname, id FROM releases WHERE nzbstatus = %d %s - AND consoleinfoID IS NULL - AND categoryID BETWEEN 1000 AND 1999 + AND consoleinfoid IS NULL + AND categoryid BETWEEN 1000 AND 1999 ORDER BY postdate DESC LIMIT %d', \NZB::NZB_ADDED, @@ -713,7 +713,7 @@ class Konsole PHP_EOL ); } - $gameId = $gameCheck['ID']; + $gameId = $gameCheck['id']; } } elseif ($this->echooutput) { @@ -724,10 +724,10 @@ class Konsole $this->pdo->queryExec( sprintf(' UPDATE releases - SET consoleinfoID = %d - WHERE ID = %d', + SET consoleinfoid = %d + WHERE id = %d', $gameId, - $arr['ID'] + $arr['id'] ) ); @@ -803,7 +803,7 @@ class Konsole array_map("trim", $result); /* Make sure we got a title and platform otherwise the resulting lookup will probably be shit. - Other option is to pass the $release->categoryID here if we don't find a platform but that + Other option is to pass the $release->categoryid here if we don't find a platform but that would require an extra lookup to determine the name. In either case we should have a title at the minimum. */ return (isset($result['title']) && !empty($result['title']) && isset($result['platform'])) ? $result : false; diff --git a/lib/MiscSorter.php b/lib/MiscSorter.php index cc32c0e16..c210b79d5 100644 --- a/lib/MiscSorter.php +++ b/lib/MiscSorter.php @@ -57,19 +57,19 @@ class MiscSorter // Main function that determines which operation(s) should be run based on the releases NFO file public function nfosorter($category = 0, $id = 0) { - $idarr = ($id != 0 ? sprintf('AND r.ID = %d', $id) : ''); - $cat = ($category = 0 ? sprintf('AND r.categoryID = %d', Category::CAT_MISC) : sprintf('AND r.categoryID = %d', $category)); + $idarr = ($id != 0 ? sprintf('AND r.id = %d', $id) : ''); + $cat = ($category = 0 ? sprintf('AND r.categoryid = %d', Category::CAT_MISC) : sprintf('AND r.categoryid = %d', $category)); $res = $this->pdo->queryDirect( sprintf(" SELECT UNCOMPRESS(rn.nfo) AS nfo, - r.ID, r.name, r.searchname + r.id, r.name, r.searchname FROM releasenfo rn - INNER JOIN releases r ON rn.releaseID = r.ID - INNER JOIN groups g ON r.groupID = g.ID + INNER JOIN releases r ON rn.releaseid = r.id + INNER JOIN groups g ON r.groupid = g.id WHERE rn.nfo IS NOT NULL AND r.proc_sorter = %d - AND r.prehashID = 0 %s", + AND r.prehashid = 0 %s", self::PROC_SORTER_NONE, ($idarr = '' ? $cat : $idarr) ) @@ -257,14 +257,14 @@ class MiscSorter case 'iphone': case 'ipad': case 'ipod': - $ok = $this->doOS($nfo, $row['ID']); + $ok = $this->doOS($nfo, $row['id']); break; case 'game': $set = preg_split('/\>(.*)\dodbupdate($row['ID'], $this->cleanname($set[1])); + $ok = $this->dodbupdate($row['id'], $this->cleanname($set[1])); } else { - $ok = $this->doOS($nfo, $row['ID']); + $ok = $this->doOS($nfo, $row['id']); } break; case 'imdb': @@ -282,7 +282,7 @@ class MiscSorter break; case 'comicbook': case 'comix': - $ok = $this->dodbupdate($row['ID'], $this->cleanname($row['searchname'])); + $ok = $this->dodbupdate($row['id'], $this->cleanname($row['searchname'])); break; case "asin": case "isbn": @@ -292,20 +292,20 @@ class MiscSorter if (strlen($set[1]) <= 13) { $set[2] = $set[1]; $set[1] = "com"; - $ok = $this->doAmazon($row['name'], $row['ID'], $nfo, $set[2], $set[1], $case, $row); + $ok = $this->doAmazon($row['name'], $row['id'], $nfo, $set[2], $set[1], $case, $row); } } break; case "amazon.": if (preg_match('/amazon\.([a-z]*?\.?[a-z]{2,3}?)\/.*\/dp\/([a-zA-Z0-9]{8,10}?)/iU', $nfo, $set)) { - $ok = $this->doAmazon($row['name'], $row['ID'], $nfo, $set[2], $set[1], 'asin', $row); + $ok = $this->doAmazon($row['name'], $row['id'], $nfo, $set[2], $set[1], 'asin', $row); } break; case "upc": if (preg_match('/UPC\:?? *?([a-zA-Z0-9]*?)/iU', $nfo, $set)) { $set[2] = $set[1]; $set[1] = "All"; - $ok = $this->doAmazon($row['name'], $row['ID'], $nfo, $set[2], $set[1], $case, $row); + $ok = $this->doAmazon($row['name'], $row['id'], $nfo, $set[2], $set[1], $case, $row); } break; } @@ -340,7 +340,7 @@ class MiscSorter $artist[1] = $artist[3]; } if (isset($title[1]) && isset($artist[1])) { - return $this->dodbupdate($row['ID'], $this->cleanname($artist[1] . " - " . $title[1]), null, 'audioNFO'); + return $this->dodbupdate($row['id'], $this->cleanname($artist[1] . " - " . $title[1]), null, 'audioNFO'); } } @@ -353,10 +353,10 @@ class MiscSorter $release = $this->pdo->queryOneRow( sprintf(" - SELECT r.ID AS releaseID, r.searchname AS searchname, - r.name AS name, r.categoryID, r.groupID + SELECT r.id AS releaseid, r.searchname AS searchname, + r.name AS name, r.categoryid, r.groupid FROM releases r - WHERE r.ID = %d", + WHERE r.id = %d", $id ) ); @@ -368,12 +368,12 @@ class MiscSorter $this->_setProcSorter(self::PROC_SORTER_DONE, $id); } - if ($type !== '' && in_array($type, ['bookinfoID', 'consoleinfoID', 'imdbID', 'musicinfoID'])) { + if ($type !== '' && in_array($type, ['bookinfoid', 'consoleinfoid', 'imdbid', 'musicinfoid'])) { $this->pdo->queryExec( sprintf(' UPDATE releases SET %s = %d - WHERE ID = %d', + WHERE id = %d', $type, $typeid, $id @@ -390,7 +390,7 @@ class MiscSorter sprintf(' UPDATE releases SET proc_sorter = %d - WHERE ID = %d', + WHERE id = %d', $status, $id ) @@ -457,9 +457,9 @@ class MiscSorter private function _matchNfoImdb($nfo, $row) { - $imdb = $this->movie->doMovieUpdate($nfo, "sorter", $row['ID']); + $imdb = $this->movie->doMovieUpdate($nfo, "sorter", $row['id']); if (isset($imdb) && $imdb > 0) { - return $this->dodbupdate($row['ID'], $this->moviename($row['ID'], $row['searchname']), $imdb, 'imdbID'); + return $this->dodbupdate($row['id'], $this->moviename($row['id'], $row['searchname']), $imdb, 'imdbid'); } return false; @@ -522,13 +522,13 @@ class MiscSorter $title = preg_split('/(?:t\s?i\s?t\s?l\s?e\b|b\s?o\s?o\s?k\b)+? *?(?!(?:[^\s\.\:\}\]\*\xb0-\x{3000}\?] ?){2,}?\b)(?:[\*\?\-\=\|\;\:\.\[\}\]\(\s\xb0-\x{3000}\?]+?)[\s\.\>\:\(\)]((?!\:) ?[a-z0-9\&].+)(?:\s\s\s|$|\.\.\.)/Uuim', $nfo, 0, PREG_SPLIT_DELIM_CAPTURE); if (isset($author[1]) && isset($title[1])) { - return $this->dodbupdate($row['ID'], Category::CAT_MUSIC_AUDIOBOOK, $this->cleanname($author[1] . " - " . $title[1])); + return $this->dodbupdate($row['id'], Category::CAT_MUSIC_AUDIOBOOK, $this->cleanname($author[1] . " - " . $title[1])); } else if (preg_match('/[\h\_\.\:\xb0-\x{3000}]{2,}?([a-z].+) \- (.+)(?:[\s\_\.\:\xb0-\x{3000}]{2,}|$)/iu', $nfo, $matches)) { $pos = $this->nfopos($this->_cleanStrForPos($nfo), $this->_cleanStrForPos($matches[1] . " - " . $matches[2])); if ($pos !== false && $pos < 0.4 && !preg_match('/\:\d\d$/', $matches[2]) && strlen($matches[1]) < 48 && strlen($matches[2]) < 48 && strpos('title', $matches[1]) === false && strpos('title', $matches[2]) === false ) { - return $this->dodbupdate($row['ID'], $this->cleanname($matches[1] . " - " . $matches[2]), null, 'bookNFO'); + return $this->dodbupdate($row['id'], $this->cleanname($matches[1] . " - " . $matches[2]), null, 'bookNFO'); } } @@ -608,7 +608,7 @@ class MiscSorter $bookId = $this->book->updateBookInfo('', $amaz); unset($book); } else { - $bookId = $rel['ID']; + $bookId = $rel['id']; } if ($audiobook) { @@ -626,7 +626,7 @@ class MiscSorter { return $this->pdo->queryOneRow( sprintf(' - SELECT ID + SELECT id FROM %s WHERE asin = %s', $table, @@ -635,7 +635,7 @@ class MiscSorter ); } - // tries to derive the IMDB ID from release NFO + // tries to derive the IMDB id from release NFO private function _doAmazonMusic($amaz = array(), $id = 0) { @@ -648,10 +648,10 @@ class MiscSorter $rel = $this->_doAmazonLocal('musicinfo', (string)$amaz->Items->Item->ASIN); if ($rel !== false) { - $ok = $this->dodbupdate($id, $name, $rel['ID'], 'musicinfoID'); + $ok = $this->dodbupdate($id, $name, $rel['id'], 'musicinfoid'); } else { $musicId = $this->music->updateMusicInfo('', '', $amaz); - $ok = $this->dodbupdate($id, $name, $musicId, 'musicinfoID'); + $ok = $this->dodbupdate($id, $name, $musicId, 'musicinfoid'); } return $ok; @@ -679,7 +679,7 @@ class MiscSorter $rel = $this->_doAmazonLocal('consoleinfo', (string)$amaz->Items->Item->ASIN); if ($rel !== false) { - $ok = $this->dodbupdate($id, $name, $rel['ID'], 'consoleinfoID'); + $ok = $this->dodbupdate($id, $name, $rel['id'], 'consoleinfoid'); } else { $consoleId = $this->console-> updateConsoleInfo([ @@ -688,7 +688,7 @@ class MiscSorter 'platform' => (string)$amaz->Items->Item->ItemAttributes->Platform ] ); - $ok = $this->dodbupdate($id, $name, $consoleId, 'consoleinfoID'); + $ok = $this->dodbupdate($id, $name, $consoleId, 'consoleinfoid'); } return $ok; diff --git a/lib/NZBGet.php b/lib/NZBGet.php index 8ecfd1b51..3b0616702 100644 --- a/lib/NZBGet.php +++ b/lib/NZBGet.php @@ -41,7 +41,7 @@ class NZBGet protected $fullURL = ''; /** - * User ID. + * User id. * @var int * @access protected */ @@ -84,7 +84,7 @@ class NZBGet public function __construct(&$page) { $this->serverurl = $page->serverurl; - $this->uid = $page->userdata['ID']; + $this->uid = $page->userdata['id']; $this->rsstoken = $page->userdata['rsstoken']; if (!empty($page->userdata['nzbgeturl'])) { diff --git a/lib/Pprocess.php b/lib/Pprocess.php index 6bafe14d5..d2a19855a 100644 --- a/lib/Pprocess.php +++ b/lib/Pprocess.php @@ -209,7 +209,7 @@ class PProcess /** * Lookup imdb if enabled. * - * @param string $groupID (Optional) ID of a group to work on. + * @param string $groupID (Optional) id of a group to work on. * @param string $guidChar (Optional) First letter of a release GUID to use to get work. * @param int|string $processMovies (Optional) 0 Don't process, 1 process all releases, * 2 process renamed releases only, '' check site setting @@ -240,7 +240,7 @@ class PProcess * Process nfo files. * * @param NNTP $nntp - * @param string $groupID (Optional) ID of a group to work on. + * @param string $groupID (Optional) id of a group to work on. * @param string $guidChar (Optional) First letter of a release GUID to use to get work. * * @return void @@ -286,7 +286,7 @@ class PProcess /** * Process all TV related releases which will assign their series/episode/rage data. * - * @param string $groupID (Optional) ID of a group to work on. + * @param string $groupID (Optional) id of a group to work on. * @param string $guidChar (Optional) First letter of a release GUID to use to get work. * @param string|int $processTV (Optional) 0 Don't process, 1 process all releases, * 2 process renamed releases only, '' check site setting @@ -326,7 +326,7 @@ class PProcess * @note Called externally by tmux/bin/update_per_group and update/postprocess.php * * @param NNTP $nntp Class NNTP - * @param int|string $groupID (Optional) ID of a group to work on. + * @param int|string $groupID (Optional) id of a group to work on. * @param string $guidChar (Optional) First char of release GUID, can be used to select work. * * @return void @@ -342,8 +342,8 @@ class PProcess * @note Called from NZBContents.php * * @param string $messageID MessageID from NZB file. - * @param int $relID ID of the release. - * @param int $groupID Group ID of the release. + * @param int $relID id of the release. + * @param int $groupID Group id of the release. * @param NNTP $nntp Class NNTP * @param int $show Only show result or apply iy. * @@ -357,10 +357,10 @@ class PProcess $query = $this->pdo->queryOneRow( sprintf(' - SELECT ID, groupID, categoryID, name, searchname, UNIX_TIMESTAMP(postdate) AS post_date, ID AS releaseID + SELECT id, groupid, categoryid, name, searchname, UNIX_TIMESTAMP(postdate) AS post_date, id AS releaseid FROM releases WHERE isrenamed = 0 - AND ID = %d', + AND id = %d', $relID ) ); @@ -372,7 +372,7 @@ class PProcess // Only get a new name if the category is OTHER. $foundName = true; if (!in_array( - (int)$query['categoryID'], + (int)$query['categoryid'], array( Category::CAT_BOOK_OTHER, Category::CAT_GAME_OTHER, @@ -424,9 +424,9 @@ class PProcess if ($filesAdded < 11 && $this->pdo->queryOneRow( sprintf(' - SELECT ID + SELECT id FROM releasefiles - WHERE releaseID = %d + WHERE releaseid = %d AND name = %s', $relID, $this->pdo->escapeString($file['name']) @@ -461,7 +461,7 @@ class PProcess sprintf(' UPDATE releases SET rarinnerfilecount = rarinnerfilecount + %d - WHERE ID = %d', + WHERE id = %d', $filesAdded, $relID ) diff --git a/lib/ProcessAdditional.php b/lib/ProcessAdditional.php index d62b48c12..0f9b36533 100644 --- a/lib/ProcessAdditional.php +++ b/lib/ProcessAdditional.php @@ -356,11 +356,11 @@ Class ProcessAdditional $this->_queryLimit = ($this->site->maxaddprocessed != '') ? (int)$this->site->maxaddprocessed : 25; - // Maximum message ID's to download per file type in the NZB (video, jpg, etc). + // Maximum message id's to download per file type in the NZB (video, jpg, etc). $this->_segmentsToDownload = ($this->site->segmentstodownload != '') ? (int)$this->site->segmentstodownload : 2; - // Maximum message ID's to download for a RAR file. + // Maximum message id's to download for a RAR file. $this->_maximumRarSegments = ($this->site->maxpartsprocessed != '') ? (int)$this->site->maxpartsprocessed : 3; @@ -380,7 +380,7 @@ Class ProcessAdditional (string)($this->site->minsizetopostprocess != '') ? $this->site->minsizetopostprocess : 1; $this->_minSize = ($this->_minSize === 0 ? '' : 'AND r.size > ' . ($this->_minSize * 1048576)); - // Use the alternate NNTP provider for downloading Message-ID's ? + // Use the alternate NNTP provider for downloading Message-id's ? $this->_alternateNNTP = ($this->site->alternate_nntp == 1 ? true : false); $this->_ffMPEGDuration = ($this->site->ffmpeg_duration != '') ? (int)$this->site->ffmpeg_duration : 5; @@ -417,7 +417,7 @@ Class ProcessAdditional /** * Main method. * - * @param int|string $groupID (Optional) ID of a group to work on. + * @param int|string $groupID (Optional) id of a group to work on. * @param string $guidChar (Optional) First char of release GUID, can be used to select work. * * @void @@ -466,7 +466,7 @@ Class ProcessAdditional $this->_mainTmpPath .= DS; } - // If we are doing per group, use the groupID has a inner path, so other scripts don't delete the files we are working on. + // If we are doing per group, use the groupid has a inner path, so other scripts don't delete the files we are working on. if ($groupID !== '') { $this->_mainTmpPath .= ($groupID . DS); } else if ($guidChar !== '') { @@ -521,9 +521,9 @@ Class ProcessAdditional $this->_releases = $this->pdo->query( sprintf( ' - SELECT r.ID, r.guid, r.name, c.disablepreview, r.size, r.groupID, r.nfostatus, r.completion, r.categoryID, r.searchname, r.prehashID + SELECT r.id, r.guid, r.name, c.disablepreview, r.size, r.groupid, r.nfostatus, r.completion, r.categoryid, r.searchname, r.prehashid FROM releases r - LEFT JOIN category c ON c.ID = r.categoryID + LEFT JOIN category c ON c.id = r.categoryid WHERE r.nzbstatus = 1 %s %s %s %s AND r.passwordstatus BETWEEN -6 AND -1 @@ -533,7 +533,7 @@ Class ProcessAdditional LIMIT %d', $this->_maxSize, $this->_minSize, - ($groupID === '' ? '' : 'AND r.groupID = ' . $groupID), + ($groupID === '' ? '' : 'AND r.groupid = ' . $groupID), ($guidChar === '' ? '' : 'AND r.guid ' . $this->pdo->likeString($guidChar, false, true)), $this->_queryLimit ) @@ -576,14 +576,14 @@ Class ProcessAdditional { foreach ($this->_releases as $this->_release) { $this->_echo( - PHP_EOL . '[' . $this->_release['ID'] . '][' . + PHP_EOL . '[' . $this->_release['id'] . '][' . $this->_readableBytesString($this->_release['size']) . ']', 'primaryOver', false ); if ($this->_showCLIReleaseID) { - cli_set_process_title($this->_showCLIReleaseID . $this->_release['ID']); + cli_set_process_title($this->_showCLIReleaseID . $this->_release['id']); } // Create folder to store temporary files. @@ -615,7 +615,7 @@ Class ProcessAdditional $this->_processVideo === true ) { - // Process usenet Message-ID downloads. + // Process usenet Message-id downloads. $this->_processMessageIDDownloads(); // Process compressed (RAR/ZIP) files inside the NZB. @@ -740,8 +740,8 @@ Class ProcessAdditional { $this->pdo->queryExec( sprintf( - 'UPDATE releases SET passwordstatus = passwordstatus - 1 WHERE ID = %d', - $this->_release['ID'] + 'UPDATE releases SET passwordstatus = passwordstatus - 1 WHERE id = %d', + $this->_release['id'] ) ); return $return; @@ -760,7 +760,7 @@ Class ProcessAdditional protected $_NZBHasCompressedFile; /** - * Process the files inside the NZB, find Message-ID's to download. + * Process the files inside the NZB, find Message-id's to download. * If we find files with book extensions, return the amount. * * @return int @@ -1089,16 +1089,16 @@ Class ProcessAdditional $this->pdo->queryOneRow( sprintf( ' - SELECT ID FROM releasefiles - WHERE releaseID = %d + SELECT id FROM releasefiles + WHERE releaseid = %d AND name = %s AND size = %d', - $this->_release['ID'], $this->pdo->escapeString($file['name']), $file['size'] + $this->_release['id'], $this->pdo->escapeString($file['name']), $file['size'] ) ) === false ) { - if ($this->_releaseFiles->add($this->_release['ID'], $file['name'], $file['size'], $file['date'], $file['pass'])) { + if ($this->_releaseFiles->add($this->_release['id'], $file['name'], $file['size'], $file['date'], $file['pass'])) { $this->_addedFileInfo++; if ($this->_echoCLI) { @@ -1115,7 +1115,7 @@ Class ProcessAdditional } //Run a PreDB filename check on insert to try and match the release else if (strpos($file['name'], '.') != 0 && strlen($file['name']) > 0) { $this->_release['filename'] = $file['name']; - $this->_release['releaseID'] = $this->_release['ID']; + $this->_release['releaseid'] = $this->_release['id']; $this->_nameFixer->matchPredbFiles($this->_release, 1, 1, true, 1); } } @@ -1210,7 +1210,7 @@ Class ProcessAdditional } // Check if it's alt.binaries.u4e file. else if (in_array($this->_releaseGroupName, ['alt.binaries.u4e', 'alt.binaries.mom']) && preg_match('/Linux_2rename\.sh/i', $file) && - ($this->_release['categoryID'] == \Category::CAT_MISC_HASHED || $this->_release['categoryID'] == \Category::CAT_MISC_OTHER) + ($this->_release['categoryid'] == \Category::CAT_MISC_HASHED || $this->_release['categoryid'] == \Category::CAT_MISC_OTHER) ) { $this->_processU4ETitle($file); } @@ -1466,9 +1466,9 @@ Class ProcessAdditional ' UPDATE releases SET jpgstatus = %d - WHERE ID = %d', + WHERE id = %d', 1, - $this->_release['ID'] + $this->_release['id'] ) ); @@ -1510,11 +1510,11 @@ Class ProcessAdditional $releaseFiles = $this->pdo->queryOneRow( sprintf( ' - SELECT COUNT(releasefiles.releaseID) AS count, + SELECT COUNT(releasefiles.releaseid) AS count, SUM(releasefiles.size) AS size FROM releasefiles - WHERE releaseID = %d', - $this->_release['ID'] + WHERE releaseid = %d', + $this->_release['id'] ) ); @@ -1535,12 +1535,12 @@ Class ProcessAdditional ' UPDATE releases SET passwordstatus = passwordstatus - 1, rarinnerfilecount = %d %s %s %s - WHERE ID = %d', + WHERE id = %d', $releaseFiles['count'], $iSQL, $vSQL, $jSQL, - $this->_release['ID'] + $this->_release['id'] ); } // Else update the release with the password status (if the admin enabled the setting). else { @@ -1548,13 +1548,13 @@ Class ProcessAdditional ' UPDATE releases SET passwordstatus = %d, rarinnerfilecount = %d %s %s %s - WHERE ID = %d', + WHERE id = %d', ($this->_processPasswords === true ? $this->_passwordStatus : Releases::PASSWD_NONE), $releaseFiles['count'], $iSQL, $vSQL, $jSQL, - $this->_release['ID'] + $this->_release['id'] ); } @@ -1621,8 +1621,8 @@ Class ProcessAdditional // Make sure the category is music or other. $rQuery = $this->pdo->queryOneRow( sprintf( - 'SELECT searchname, categoryID AS id, groupID FROM releases WHERE proc_pp = 0 AND ID = %d', - $this->_release['ID'] + 'SELECT searchname, categoryid AS id, groupid FROM releases WHERE proc_pp = 0 AND id = %d', + $this->_release['id'] ) ); @@ -1661,7 +1661,7 @@ Class ProcessAdditional if (isset($track['Album']) && isset($track['Performer'])) { - if (NN_RENAME_MUSIC_MEDIAINFO && $this->_release['prehashID'] == 0) { + if (NN_RENAME_MUSIC_MEDIAINFO && $this->_release['prehashid'] == 0) { // Make the extension upper case. $ext = strtoupper($fileExtension); @@ -1678,7 +1678,7 @@ Class ProcessAdditional } else if ($ext === 'FLAC') { $newCat = Category::CAT_MUSIC_LOSSLESS; } else { - $newCat = $this->_categorize->determineCategory($rQuery['groupID'],$newName); + $newCat = $this->_categorize->determineCategory($rQuery['groupid'],$newName); } $newTitle = $this->pdo->escapeString(substr($newName, 0, 255)); @@ -1687,14 +1687,14 @@ Class ProcessAdditional sprintf( ' UPDATE releases - SET searchname = %s, categoryID = %d, iscategorized = 1, isrenamed = 1, proc_pp = 1 - WHERE ID = %d', + SET searchname = %s, categoryid = %d, iscategorized = 1, isrenamed = 1, proc_pp = 1 + WHERE id = %d', $newTitle, $newCat, - $this->_release['ID'] + $this->_release['id'] ) ); - $this->sphinx->updateReleaseSearchName($this->_release['ID'], $newTitle); + $this->sphinx->updateReleaseSearchName($this->_release['id'], $newTitle); // Echo the changed name. if ($this->_echoCLI) { @@ -1704,8 +1704,8 @@ Class ProcessAdditional 'old_name' => $rQuery['searchname'], 'new_category' => $newCat, 'old_category' => $rQuery['id'], - 'group' => $rQuery['groupID'], - 'release_id' => $this->_release['ID'], + 'group' => $rQuery['groupid'], + 'release_id' => $this->_release['id'], 'method' => 'ProcessAdditional->_getAudioInfo' ) ); @@ -1713,7 +1713,7 @@ Class ProcessAdditional } // Add the media info. - $this->_releaseExtra->addFromXml($this->_release['ID'], $xmlArray); + $this->_releaseExtra->addFromXml($this->_release['id'], $xmlArray); $retVal = true; $this->_foundAudioInfo = true; @@ -1772,8 +1772,8 @@ Class ProcessAdditional ' UPDATE releases SET audiostatus = 1 - WHERE ID = %d', - $this->_release['ID'] + WHERE id = %d', + $this->_release['id'] ) ); @@ -1811,9 +1811,9 @@ Class ProcessAdditional ' UPDATE releases SET jpgstatus = %d - WHERE ID = %d', + WHERE id = %d', 1, - $this->_release['ID'] + $this->_release['id'] ) ); } @@ -2081,8 +2081,8 @@ Class ProcessAdditional } // Insert it into the DB. - $this->_releaseExtra->addFull($this->_release['ID'], $xmlArray); - $this->_releaseExtra->addFromXml($this->_release['ID'], $xmlArray); + $this->_releaseExtra->addFull($this->_release['id'], $xmlArray); + $this->_releaseExtra->addFromXml($this->_release['id'], $xmlArray); if ($this->_echoCLI) { $this->_echo('m', 'primaryOver', false); @@ -2111,8 +2111,8 @@ Class ProcessAdditional ' SELECT UNIX_TIMESTAMP(postdate) AS postdate, proc_pp FROM releases - WHERE ID = %d', - $this->_release['ID'] + WHERE id = %d', + $this->_release['id'] ) ); @@ -2125,7 +2125,7 @@ Class ProcessAdditional if (NN_RENAME_PAR2 && $releaseInfo['proc_pp'] == 0 && in_array( - ((int)$this->_release['categoryID']), + ((int)$this->_release['categoryid']), array( Category::CAT_BOOK_OTHER, Category::CAT_GAME_OTHER, @@ -2161,14 +2161,14 @@ Class ProcessAdditional if ($filesAdded < 11 && $this->pdo->queryOneRow( sprintf( - 'SELECT ID FROM releasefiles WHERE releaseID = %d AND name = %s', - $this->_release['ID'], $this->pdo->escapeString($file['name']) + 'SELECT id FROM releasefiles WHERE releaseid = %d AND name = %s', + $this->_release['id'], $this->pdo->escapeString($file['name']) ) ) === false ) { // Try to add the files to the DB. - if ($this->_releaseFiles->add($this->_release['ID'], $file['name'], $file['size'], $releaseInfo['postdate'], 0)) { + if ($this->_releaseFiles->add($this->_release['id'], $file['name'], $file['size'], $releaseInfo['postdate'], 0)) { $filesAdded++; } } @@ -2179,7 +2179,7 @@ Class ProcessAdditional // Try to get a new name. if ($foundName === false) { $this->_release['textstring'] = $file['name']; - $this->_release['releaseID'] = $this->_release['ID']; + $this->_release['releaseid'] = $this->_release['id']; if ($this->_nameFixer->checkName($this->_release, ($this->_echoCLI ? 1 : 0), 'PAR2, ', 1, 1) === true) { $foundName = true; } @@ -2188,9 +2188,9 @@ Class ProcessAdditional // Update the file count with the new file count + old file count. $this->pdo->queryExec( sprintf( - 'UPDATE releases SET rarinnerfilecount = rarinnerfilecount + %d WHERE ID = %d', + 'UPDATE releases SET rarinnerfilecount = rarinnerfilecount + %d WHERE id = %d', $filesAdded, - $this->_release['ID'] + $this->_release['id'] ) ); $this->_foundPAR2Info = true; @@ -2263,8 +2263,8 @@ Class ProcessAdditional continue; } - // Get a new category ID. - $newCategory = $this->_categorize->determineCategory($this->_release['groupID'], $newName); + // Get a new category id. + $newCategory = $this->_categorize->determineCategory($this->_release['groupid'], $newName); $newTitle = $this->pdo->escapeString(substr($newName, 0, 255)); // Update the release with the data. @@ -2272,17 +2272,17 @@ Class ProcessAdditional sprintf( ' UPDATE releases - SET rageID = -1, seriesfull = NULL, season = NULL, episode = NULL, - tvtitle = NULL, tvairdate = NULL, imdbID = NULL, musicinfoID = NULL, - consoleinfoID = NULL, bookinfoID = NULL, anidbid = NULL, prehashID = 0, - searchname = %s, isrenamed = 1, iscategorized = 1, proc_files = 1, categoryID = %d - WHERE ID = %d', + SET rageid = -1, seriesfull = NULL, season = NULL, episode = NULL, + tvtitle = NULL, tvairdate = NULL, imdbid = NULL, musicinfoid = NULL, + consoleinfoid = NULL, bookinfoid = NULL, anidbid = NULL, prehashid = 0, + searchname = %s, isrenamed = 1, iscategorized = 1, proc_files = 1, categoryid = %d + WHERE id = %d', $newTitle, $newCategory, - $this->_release['ID'] + $this->_release['id'] ) ); - $this->sphinx->updateReleaseSearchName($this->_release['ID'], $newTitle); + $this->sphinx->updateReleaseSearchName($this->_release['id'], $newTitle); // Echo the changed name to CLI. if ($this->_echoCLI) { @@ -2291,9 +2291,9 @@ Class ProcessAdditional 'new_name' => $newName, 'old_name' => $this->_release['searchname'], 'new_category' => $newCategory, - 'old_category' => $this->_release['categoryID'], - 'group' => $this->_release['groupID'], - 'release_id' => $this->_release['ID'], + 'old_category' => $this->_release['categoryid'], + 'group' => $this->_release['groupid'], + 'release_id' => $this->_release['id'], 'method' => 'ProcessAdditional->_processU4ETitle' ) ); @@ -2437,7 +2437,7 @@ Class ProcessAdditional protected $_foundPAR2Info; /** - * Message ID's for found content to download. + * Message id's for found content to download. * @var array */ protected $_sampleMessageIDs; @@ -2507,7 +2507,7 @@ Class ProcessAdditional $this->_passwordStatus = array(Releases::PASSWD_NONE); $this->_releaseHasPassword = false; - $this->_releaseGroupName = $this->_groups->getByNameByID($this->_release['groupID']); + $this->_releaseGroupName = $this->_groups->getByNameByID($this->_release['groupid']); $this->_releaseHasNoNFO = false; // Make sure we don't already have an nfo. diff --git a/lib/ReleaseRemover.php b/lib/ReleaseRemover.php index 7349f4414..ac6f789c2 100644 --- a/lib/ReleaseRemover.php +++ b/lib/ReleaseRemover.php @@ -164,7 +164,7 @@ class ReleaseRemover $this->timeStart = TIME(); // Start forming the query. - $this->query = 'SELECT ID, guid, searchname FROM releases WHERE 1=1'; + $this->query = 'SELECT id, guid, searchname FROM releases WHERE 1=1'; // Keep forming the query based on the user's criteria, return if any errors. foreach ($arguments as $arg) { @@ -228,7 +228,7 @@ class ReleaseRemover $this->blacklistID = ''; if (isset($blacklistID) && is_numeric($blacklistID)) { - $this->blacklistID = sprintf("AND ID = %d", $blacklistID); + $this->blacklistID = sprintf("AND id = %d", $blacklistID); } $time = trim($time); @@ -347,12 +347,12 @@ class ReleaseRemover { $this->method = 'Gibberish'; $this->query = sprintf( - "SELECT r.guid, r.searchname, r.ID + "SELECT r.guid, r.searchname, r.id FROM releases r WHERE r.nfostatus = 0 AND r.iscategorized = 1 AND r.rarinnerfilecount = 0 - AND r.categoryID NOT IN (%d) + AND r.categoryid NOT IN (%d) AND r.searchname REGEXP '^[a-zA-Z0-9]{15,}$' %s", \Category::CAT_MISC_HASHED, @@ -375,12 +375,12 @@ class ReleaseRemover { $this->method = 'Hashed'; $this->query = sprintf( - "SELECT r.guid, r.searchname, r.ID + "SELECT r.guid, r.searchname, r.id FROM releases r WHERE r.nfostatus = 0 AND r.iscategorized = 1 AND r.rarinnerfilecount = 0 - AND r.categoryID NOT IN (%d, %d) + AND r.categoryid NOT IN (%d, %d) AND r.searchname REGEXP '[a-zA-Z0-9]{25,}' %s", \Category::CAT_MISC_OTHER, \Category::CAT_MISC_HASHED, $this->crapTime @@ -402,12 +402,12 @@ class ReleaseRemover { $this->method = 'Short'; $this->query = sprintf( - "SELECT r.guid, r.searchname, r.ID + "SELECT r.guid, r.searchname, r.id FROM releases r WHERE r.nfostatus = 0 AND r.iscategorized = 1 AND r.rarinnerfilecount = 0 - AND r.categoryID NOT IN (%d) + AND r.categoryid NOT IN (%d) AND r.searchname REGEXP '^[a-zA-Z0-9]{0,5}$' %s", \Category::CAT_MISC_OTHER, $this->crapTime @@ -429,12 +429,12 @@ class ReleaseRemover { $this->method = 'Executable'; $this->query = sprintf( - "SELECT r.guid, r.searchname, r.ID + "SELECT r.guid, r.searchname, r.id FROM releases r - INNER JOIN releasefiles rf ON rf.releaseID = r.ID + INNER JOIN releasefiles rf ON rf.releaseid = r.id WHERE r.searchname NOT LIKE %s AND rf.name LIKE %s - AND r.categoryID NOT IN (%d, %d, %d, %d, %d, %d) %s", + AND r.categoryid NOT IN (%d, %d, %d, %d, %d, %d) %s", "'%.exes%'", "'%.exe%'", \Category::CAT_PC_0DAY, @@ -462,9 +462,9 @@ class ReleaseRemover { $this->method = 'Install.bin'; $this->query = sprintf( - "SELECT r.guid, r.searchname, r.ID + "SELECT r.guid, r.searchname, r.id FROM releases r - INNER JOIN releasefiles rf ON rf.releaseID = r.ID + INNER JOIN releasefiles rf ON rf.releaseid = r.id WHERE rf.name LIKE %s %s", "'%install.bin%'", $this->crapTime @@ -486,9 +486,9 @@ class ReleaseRemover { $this->method = 'Password.url'; $this->query = sprintf( - "SELECT r.guid, r.searchname, r.ID + "SELECT r.guid, r.searchname, r.id FROM releases r - INNER JOIN releasefiles rf ON rf.releaseID = r.ID + INNER JOIN releasefiles rf ON rf.releaseid = r.id WHERE rf.name LIKE %s %s", "'%password.url%'", $this->crapTime @@ -510,7 +510,7 @@ class ReleaseRemover { $this->method = 'Passworded'; $this->query = sprintf( - "SELECT r.guid, r.searchname, r.ID + "SELECT r.guid, r.searchname, r.id FROM releases r WHERE r.searchname LIKE %s AND r.searchname NOT LIKE %s @@ -520,7 +520,7 @@ class ReleaseRemover AND r.searchname NOT LIKE %s AND r.searchname NOT LIKE %s AND r.nzbstatus = 1 - AND r.categoryID NOT IN (%d, %d, %d, %d, %d, %d, %d, %d, %d) %s", + AND r.categoryid NOT IN (%d, %d, %d, %d, %d, %d, %d, %d, %d) %s", // Matches passwort / passworded / etc also. "'%passwor%'", "'%advanced%'", @@ -557,11 +557,11 @@ class ReleaseRemover { $this->method = 'Size'; $this->query = sprintf( - "SELECT r.guid, r.searchname, r.ID + "SELECT r.guid, r.searchname, r.id FROM releases r WHERE r.totalpart = 1 AND r.size < 2097152 - AND r.categoryID NOT IN (%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d) %s", + AND r.categoryid NOT IN (%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d) %s", \Category::CAT_MUSIC_MP3, \Category::CAT_BOOK_COMICS, \Category::CAT_BOOK_EBOOK, @@ -592,7 +592,7 @@ class ReleaseRemover { $this->method = 'Huge'; $this->query = sprintf( - "SELECT r.guid, r.searchname, r.ID + "SELECT r.guid, r.searchname, r.id FROM releases r WHERE r.totalpart = 1 AND r.size > 209715200 %s", @@ -615,12 +615,12 @@ class ReleaseRemover { $this->method = 'Sample'; $this->query = sprintf( - "SELECT r.guid, r.searchname, r.ID + "SELECT r.guid, r.searchname, r.id FROM releases r WHERE r.totalpart > 1 AND r.size < 40000000 AND r.name LIKE %s - AND r.categoryID IN (%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d) %s", + AND r.categoryid IN (%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d) %s", "'%sample%'", \Category::CAT_TV_ANIME, \Category::CAT_TV_DOCU, @@ -656,9 +656,9 @@ class ReleaseRemover { $this->method = '.scr'; $this->query = sprintf( - "SELECT r.guid, r.searchname, r.ID + "SELECT r.guid, r.searchname, r.id FROM releases r - LEFT JOIN releasefiles rf on rf.releaseID = r.ID + LEFT JOIN releasefiles rf on rf.releaseid = r.id WHERE (rf.name REGEXP '[.]scr[$ \"]' OR r.name REGEXP '[.]scr[$ \"]') %s", $this->crapTime @@ -686,7 +686,7 @@ class ReleaseRemover $regexList = $this->pdo->query( sprintf( - 'SELECT regex, ID, groupname, msgcol + 'SELECT regex, id, groupname, msgcol FROM binaryblacklist WHERE optype = %d %s %s', \Binaries::OPTYPE_BLACKLIST, @@ -797,12 +797,12 @@ class ReleaseRemover continue; } - // Get the group ID if the regex is set to work against a group. + // Get the group id if the regex is set to work against a group. $groupID = ''; if (strtolower($regex['groupname']) !== 'alt.binaries.*') { $groupIDs = $this->pdo->query( - 'SELECT ID FROM groups WHERE name REGEXP ' . + 'SELECT id FROM groups WHERE name REGEXP ' . $this->pdo->escapeString($regex['groupname']) ); @@ -810,18 +810,18 @@ class ReleaseRemover if ($groupIDCount === 0) { continue; } elseif ($groupIDCount === 1) { - $groupIDs = $groupIDs[0]['ID']; + $groupIDs = $groupIDs[0]['id']; } else { $string = ''; foreach ($groupIDs as $ID) { - $string .= $ID['ID'] . ','; + $string .= $ID['id'] . ','; } $groupIDs = (substr($string, 0, -1)); } - $groupID = ' AND r.groupID in (' . $groupIDs . ') '; + $groupID = ' AND r.groupid in (' . $groupIDs . ') '; } - $this->method = 'Blacklist [' . $regex['ID'] . ']'; + $this->method = 'Blacklist [' . $regex['id'] . ']'; // Check if using FT Match and declare for echo if ($ftMatch !== '' && $opTypeName == "Subject") { @@ -839,13 +839,13 @@ class ReleaseRemover ); if ($opTypeName == 'Subject') { - $join = (NN_RELEASE_SEARCH_TYPE == \ReleaseSearch::SPHINX ? 'INNER JOIN releases_se rse ON rse.id = r.ID' : 'INNER JOIN releasesearch rs ON rs.releaseid = r.ID'); + $join = (NN_RELEASE_SEARCH_TYPE == \ReleaseSearch::SPHINX ? 'INNER JOIN releases_se rse ON rse.id = r.id' : 'INNER JOIN releasesearch rs ON rs.releaseid = r.id'); } else { $join = ''; } $this->query = sprintf(" - SELECT r.guid, r.searchname, r.ID + SELECT r.guid, r.searchname, r.id FROM releases r %s %s %s %s", $join, $regexSQL, @@ -860,7 +860,7 @@ class ReleaseRemover } } else { - echo $this->pdo->log->error("No regular expressions were selected for blacklist removal. Make sure you have activated REGEXPs in Site Edit and you're specifying a valid ID.\n"); + echo $this->pdo->log->error("No regular expressions were selected for blacklist removal. Make sure you have activated REGEXPs in Site Edit and you're specifying a valid id.\n"); } return true; @@ -875,7 +875,7 @@ class ReleaseRemover { $allRegex = $this->pdo->query( sprintf( - 'SELECT regex, ID, groupname + 'SELECT regex, id, groupname FROM binaryblacklist WHERE status = %d AND optype = %d @@ -890,7 +890,7 @@ class ReleaseRemover foreach ($allRegex as $regex) { - $regexSQL = sprintf("LEFT JOIN releasefiles rf ON r.ID = rf.releaseID + $regexSQL = sprintf("LEFT JOIN releasefiles rf ON r.id = rf.releaseid WHERE rf.name REGEXP %s ", $this->pdo->escapeString($regex['regex']) ); @@ -898,32 +898,32 @@ class ReleaseRemover continue; } - // Get the group ID if the regex is set to work against a group. + // Get the group id if the regex is set to work against a group. $groupID = ''; if (strtolower($regex['groupname']) !== 'alt.binaries.*') { $groupIDs = $this->pdo->query( - 'SELECT ID FROM groups WHERE name REGEXP ' . + 'SELECT id FROM groups WHERE name REGEXP ' . $this->pdo->escapeString($regex['groupname']) ); $groupIDCount = count($groupIDs); if ($groupIDCount === 0) { continue; } elseif ($groupIDCount === 1) { - $groupIDs = $groupIDs[0]['ID']; + $groupIDs = $groupIDs[0]['id']; } else { $string = ''; foreach ($groupIDs as $fID) { - $string .= $fID['ID'] . ','; + $string .= $fID['id'] . ','; } $groupIDs = (substr($string, 0, -1)); } - $groupID = ' AND r.groupID in (' . $groupIDs . ') '; + $groupID = ' AND r.groupid in (' . $groupIDs . ') '; } - $this->method = 'Blacklist ' . $regex['ID']; + $this->method = 'Blacklist ' . $regex['id']; $this->query = sprintf( - "SELECT r.guid, r.searchname, r.ID + "SELECT r.guid, r.searchname, r.id FROM releases r %s %s %s", $regexSQL, $groupID, $this->crapTime ); @@ -956,7 +956,7 @@ class ReleaseRemover $frenchv = '%Lisez moi si le film ne demarre pas.txt%'; $nl = '%lees me als de film niet spelen.txt%'; $german = '%Lesen Sie mir wenn der Film nicht abgespielt.txt%'; - $categories = sprintf("r.categoryID IN (%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d) AND", + $categories = sprintf("r.categoryid IN (%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d) AND", \Category::CAT_MOVIE_3D, \Category::CAT_MOVIE_BLURAY, \Category::CAT_MOVIE_DVD, @@ -969,13 +969,13 @@ class ReleaseRemover \Category::CAT_XXX_XVID, \Category::CAT_XXX_OTHER ); - $codeclike = sprintf("UNION SELECT r.guid, r.searchname, r.ID FROM releases r - LEFT JOIN releasefiles rf ON r.ID = rf.releaseID + $codeclike = sprintf("UNION SELECT r.guid, r.searchname, r.id FROM releases r + LEFT JOIN releasefiles rf ON r.id = rf.releaseid WHERE %s rf.name LIKE '%s' OR rf.name LIKE '%s' OR rf.name LIKE '%s' OR rf.name LIKE '%s' OR rf.name LIKE '%s' OR rf.name LIKE '%s'", $categories, $codec, $iferror, $ifnotplaying, $frenchv, $nl, $german ); $this->query = sprintf( - "SELECT r.guid, r.searchname, r.ID FROM releases - r INNER JOIN releasefiles rf ON (rf.releaseID = r.ID) + "SELECT r.guid, r.searchname, r.id FROM releases + r INNER JOIN releasefiles rf ON (rf.releaseid = r.id) WHERE %s %s OR %s %s %s %s", $categories, $regex, $regex2, $this->crapTime, $codeclike, $this->crapTime ); @@ -994,7 +994,7 @@ class ReleaseRemover $deletedCount = 0; foreach ($this->result as $release) { if ($this->delete) { - $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['ID']], $this->nzb, $this->releaseImage); + $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['id']], $this->nzb, $this->releaseImage); if ($this->echoCLI) { echo $this->pdo->log->primary('Deleting: ' . $this->method . ': ' . $release['searchname']); } @@ -1059,7 +1059,7 @@ class ReleaseRemover case 'categoryid': switch ($args[1]) { case 'equals': - return ' AND categoryID = ' . $args[2]; + return ' AND categoryid = ' . $args[2]; default: break; } @@ -1068,10 +1068,10 @@ class ReleaseRemover switch ($args[1]) { case 'equals': if ($args[2] === 'NULL') { - return ' AND imdbID IS NULL '; + return ' AND imdbid IS NULL '; } else { - return ' AND imdbID = ' . $args[2]; + return ' AND imdbid = ' . $args[2]; } default: break; @@ -1088,7 +1088,7 @@ class ReleaseRemover case 'rageid': switch ($args[1]) { case 'equals': - return ' AND rageID = ' . $args[2]; + return ' AND rageid = ' . $args[2]; default: break; } @@ -1116,22 +1116,22 @@ class ReleaseRemover case 'groupname': switch ($args[1]) { case 'equals': - $group = $this->pdo->queryOneRow('SELECT ID FROM groups WHERE name = ' . $this->pdo->escapeString($args[2])); + $group = $this->pdo->queryOneRow('SELECT id FROM groups WHERE name = ' . $this->pdo->escapeString($args[2])); if ($group === false) { $this->error = 'This group was not found in your database: ' . $args[2] . PHP_EOL; break; } - return ' AND groupID = ' . $group['ID']; + return ' AND groupid = ' . $group['id']; case 'like': - $groups = $this->pdo->query('SELECT ID FROM groups WHERE name ' . $this->formatLike($args[2], 'name')); + $groups = $this->pdo->query('SELECT id FROM groups WHERE name ' . $this->formatLike($args[2], 'name')); if (count($groups) === 0) { $this->error = 'No groups were found with this pattern in your database: ' . $args[2] . PHP_EOL; break; } - $gQuery = ' AND groupID IN ('; + $gQuery = ' AND groupid IN ('; foreach ($groups as $group) { - $gQuery .= $group['ID'] . ','; + $gQuery .= $group['id'] . ','; } $gQuery = substr($gQuery, 0, strlen($gQuery) - 1) . ')'; diff --git a/lib/Sharing.php b/lib/Sharing.php index 2b626837a..87e79c108 100644 --- a/lib/Sharing.php +++ b/lib/Sharing.php @@ -13,7 +13,7 @@ Class Sharing * -------------------------------------------- * sharing_sites table (contains remote sites): * -------------------------------------------- - * id ID of the site. + * id id of the site. * site_name Name of the site. * site_guid Unique hash identifier for the site. * last_time Newest comment time for this site. @@ -168,10 +168,10 @@ Class Sharing // Get all comments that we have no posted yet. $newComments = $this->pdo->query( sprintf( - 'SELECT rc.text, rc.ID, %s, u.username, r.nzb_guid + 'SELECT rc.text, rc.id, %s, u.username, r.nzb_guid FROM releasecomment rc - INNER JOIN users u ON rc.userID = u.ID - INNER JOIN releases r on rc.releaseID = r.ID + INNER JOIN users u ON rc.userID = u.id + INNER JOIN releases r on rc.releaseid = r.id WHERE rc.shared = 0 LIMIT %d', $this->pdo->unix_timestamp_column('rc.createddate'), $this->siteSettings['max_push'] @@ -208,7 +208,7 @@ Class Sharing $sid = sha1($row['unix_time'] . $row['text'] . $row['nzb_guid']); // Check if the comment is already shared. - $check = $this->pdo->queryOneRow(sprintf('SELECT ID FROM releasecomment WHERE shareID = %s', $this->pdo->escapeString($sid))); + $check = $this->pdo->queryOneRow(sprintf('SELECT id FROM releasecomment WHERE shareID = %s', $this->pdo->escapeString($sid))); if ($check === false) { // Example of a subject. @@ -238,9 +238,9 @@ Class Sharing sprintf(' UPDATE releasecomment SET shared = 1, shareID = %s - WHERE ID = %d', + WHERE id = %d', $this->pdo->escapeString($sid), - $row['ID'] + $row['id'] ) ); @@ -249,7 +249,7 @@ Class Sharing } } else { // Update the DB to say it's shared. - $this->pdo->queryExec(sprintf('UPDATE releasecomment SET shared = 1 WHERE ID = %d', $row['ID'])); + $this->pdo->queryExec(sprintf('UPDATE releasecomment SET shared = 1 WHERE id = %d', $row['id'])); } } @@ -259,10 +259,10 @@ Class Sharing protected function matchComments() { $res = $this->pdo->query(' - SELECT r.ID, r.nzb_guid + SELECT r.id, r.nzb_guid FROM releases r INNER JOIN releasecomment rc ON rc.nzb_guid = r.nzb_guid - WHERE rc.releaseID = 0' + WHERE rc.releaseid = 0' ); $found = count($res); @@ -270,12 +270,12 @@ Class Sharing foreach ($res as $row) { $this->pdo->queryExec( sprintf( - "UPDATE releasecomment SET releaseID = %d WHERE nzb_guid = %s", - $row['ID'], + "UPDATE releasecomment SET releaseid = %d WHERE nzb_guid = %s", + $row['id'], $this->pdo->escapeString($row['nzb_guid']) ) ); - $this->pdo->queryExec(sprintf('UPDATE releases SET comments = comments + 1 WHERE ID = %d', $row['ID'])); + $this->pdo->queryExec(sprintf('UPDATE releases SET comments = comments + 1 WHERE id = %d', $row['id'])); } echo '(Sharing) Matched ' . $found . ' comments.' . PHP_EOL; @@ -363,7 +363,7 @@ Class Sharing // Check if we already have the comment. $check = $this->pdo->queryOneRow( - sprintf('SELECT ID FROM releasecomment WHERE shareID = %s', + sprintf('SELECT id FROM releasecomment WHERE shareID = %s', $this->pdo->escapeString($matches['sid']) ) ); @@ -412,7 +412,7 @@ Class Sharing } // Insert the comment, if we got it, update the site to increment comment count. - if ($this->insertNewComment($header['Message-ID'], $matches['guid'])) { + if ($this->insertNewComment($header['Message-id'], $matches['guid'])) { $this->pdo->queryExec( sprintf(' UPDATE sharing_sites SET comments = comments + 1, last_time = NOW(), site_name = %s WHERE site_guid = %s', @@ -453,8 +453,8 @@ Class Sharing /** * Fetch a comment and insert it. * - * @param string $messageID Message-ID for the article. - * @param string $siteID ID of the site. + * @param string $messageID Message-id for the article. + * @param string $siteID id of the site. * * @return bool */ @@ -490,7 +490,7 @@ Class Sharing if ($this->pdo->queryExec( sprintf(' INSERT IGNORE INTO releasecomment - (text, createddate, issynced, shareID, cid, gid, nzb_guid, siteID, username, userID, releaseID, shared, host, sourceID) + (text, createddate, issynced, shareID, cid, gid, nzb_guid, siteID, username, userID, releaseid, shared, host, sourceID) VALUES (%s, %s, 1, %s, %s, %s, %s, %s, %s, 0, 0, 2, "", 999)', $this->pdo->escapeString($body['BODY']), $this->pdo->from_unixtime(($body['TIME'] > time() ? time() : $body['TIME'])), diff --git a/lib/TvAnger.php b/lib/TvAnger.php index fbe630259..a84fbe5f2 100644 --- a/lib/TvAnger.php +++ b/lib/TvAnger.php @@ -53,7 +53,7 @@ class TvAnger } /** - * Get rage info for a ID. + * Get rage info for a id. * * @param int $id * @@ -61,11 +61,11 @@ class TvAnger */ public function getByID($id) { - return $this->pdo->queryOneRow(sprintf("SELECT * FROM tvrage WHERE ID = %d", $id)); + return $this->pdo->queryOneRow(sprintf("SELECT * FROM tvrage WHERE id = %d", $id)); } /** - * Get rage info for a rage ID. + * Get rage info for a rage id. * * @param int $id * @@ -73,7 +73,7 @@ class TvAnger */ public function getByRageID($id) { - return $this->pdo->query(sprintf("SELECT * FROM tvrage WHERE rageID = %d", $id)); + return $this->pdo->query(sprintf("SELECT * FROM tvrage WHERE rageid = %d", $id)); } /** @@ -89,25 +89,25 @@ class TvAnger $string = '"\'"'; // Check if we already have an entry for this show. - $res = $this->pdo->queryOneRow(sprintf("SELECT rageID FROM tvrage WHERE LOWER(releasetitle) = LOWER(%s)", $this->pdo->escapeString($title))); - if (isset($res['rageID'])) { - return $res['rageID']; + $res = $this->pdo->queryOneRow(sprintf("SELECT rageid FROM tvrage WHERE LOWER(releasetitle) = LOWER(%s)", $this->pdo->escapeString($title))); + if (isset($res['rageid'])) { + return $res['rageid']; } $title2 = str_replace(' and ', ' & ', $title); if ($title != $title2) { - $res = $this->pdo->queryOneRow(sprintf("SELECT rageID FROM tvrage WHERE LOWER(releasetitle) = LOWER(%s)", $this->pdo->escapeString($title2))); - if (isset($res['rageID'])) { - return $res['rageID']; + $res = $this->pdo->queryOneRow(sprintf("SELECT rageid FROM tvrage WHERE LOWER(releasetitle) = LOWER(%s)", $this->pdo->escapeString($title2))); + if (isset($res['rageid'])) { + return $res['rageid']; } $pieces = explode(' ', $title2); $title4 = '%'; foreach ($pieces as $piece) { $title4 .= str_replace(array("'", "!"), "", $piece) . '%'; } - $res = $this->pdo->queryOneRow(sprintf("SELECT rageID FROM tvrage WHERE replace(replace(releasetitle, %s, ''), '!', '') LIKE %s", $string ,$this->pdo->escapeString($title4))); - if (isset($res['rageID'])) { - return $res['rageID']; + $res = $this->pdo->queryOneRow(sprintf("SELECT rageid FROM tvrage WHERE replace(replace(releasetitle, %s, ''), '!', '') LIKE %s", $string ,$this->pdo->escapeString($title4))); + if (isset($res['rageid'])) { + return $res['rageid']; } } @@ -115,18 +115,18 @@ class TvAnger // example theatre and theater $title3 = str_replace('er', 're', $title); if ($title != $title3) { - $res = $this->pdo->queryOneRow(sprintf("SELECT rageID FROM tvrage WHERE LOWER(releasetitle) = LOWER(%s)", $this->pdo->escapeString($title3))); - if (isset($res['rageID'])) { - return $res['rageID']; + $res = $this->pdo->queryOneRow(sprintf("SELECT rageid FROM tvrage WHERE LOWER(releasetitle) = LOWER(%s)", $this->pdo->escapeString($title3))); + if (isset($res['rageid'])) { + return $res['rageid']; } $pieces = explode(' ', $title3); $title4 = '%'; foreach ($pieces as $piece) { $title4 .= str_replace(array("'", "!"), "", $piece) . '%'; } - $res = $this->pdo->queryOneRow(sprintf("SELECT rageID FROM tvrage WHERE replace(replace(releasetitle, %s, ''), '!', '') LIKE %s", $string ,$this->pdo->escapeString($title4))); - if (isset($res['rageID'])) { - return $res['rageID']; + $res = $this->pdo->queryOneRow(sprintf("SELECT rageid FROM tvrage WHERE replace(replace(releasetitle, %s, ''), '!', '') LIKE %s", $string ,$this->pdo->escapeString($title4))); + if (isset($res['rageid'])) { + return $res['rageid']; } } @@ -139,9 +139,9 @@ class TvAnger foreach ($pieces as $piece) { $title4 .= str_replace(array("'", "!"), "", $piece) . '%'; } - $res = $this->pdo->queryOneRow(sprintf("SELECT rageID FROM tvrage WHERE replace(replace(releasetitle, %s, ''), '!', '') LIKE %s", $string, $this->pdo->escapeString($title4))); - if (isset($res['rageID'])) { - return $res['rageID']; + $res = $this->pdo->queryOneRow(sprintf("SELECT rageid FROM tvrage WHERE replace(replace(releasetitle, %s, ''), '!', '') LIKE %s", $string, $this->pdo->escapeString($title4))); + if (isset($res['rageid'])) { + return $res['rageid']; } } @@ -174,15 +174,15 @@ class TvAnger $country = $this->countryCode($country); if ($rageID != -2) { - $ckid = $this->pdo->queryOneRow('SELECT ID FROM tvrage WHERE rageID = ' . $rageID); + $ckid = $this->pdo->queryOneRow('SELECT id FROM tvrage WHERE rageid = ' . $rageID); } else { - $ckid = $this->pdo->queryOneRow('SELECT ID FROM tvrage WHERE releasetitle = ' . $this->pdo->escapeString($releasename)); + $ckid = $this->pdo->queryOneRow('SELECT id FROM tvrage WHERE releasetitle = ' . $this->pdo->escapeString($releasename)); } - if (!isset($ckid['ID'])) { - $this->pdo->queryExec(sprintf('INSERT INTO tvrage (rageID, releasetitle, description, genre, country, createddate, imgdata) VALUES (%s, %s, %s, %s, %s, NOW(), %s)', $rageID, $this->pdo->escapeString($releasename), $this->pdo->escapeString(substr($desc, 0, 10000)), $this->pdo->escapeString(substr($genre, 0, 64)), $this->pdo->escapeString($country), $this->pdo->escapeString($imgbytes))); + if (!isset($ckid['id'])) { + $this->pdo->queryExec(sprintf('INSERT INTO tvrage (rageid, releasetitle, description, genre, country, createddate, imgdata) VALUES (%s, %s, %s, %s, %s, NOW(), %s)', $rageID, $this->pdo->escapeString($releasename), $this->pdo->escapeString(substr($desc, 0, 10000)), $this->pdo->escapeString(substr($genre, 0, 64)), $this->pdo->escapeString($country), $this->pdo->escapeString($imgbytes))); } else { - $this->pdo->queryExec(sprintf('UPDATE tvrage SET releasetitle = %s, description = %s, genre = %s, country = %s, createddate = NOW(), imgdata = %sWHERE ID = %d', $this->pdo->escapeString($releasename), $this->pdo->escapeString(substr($desc, 0, 10000)), $this->pdo->escapeString(substr($genre, 0, 64)), $this->pdo->escapeString($country), $this->pdo->escapeString($imgbytes), $ckid['ID'])); + $this->pdo->queryExec(sprintf('UPDATE tvrage SET releasetitle = %s, description = %s, genre = %s, country = %s, createddate = NOW(), imgdata = %sWHERE id = %d', $this->pdo->escapeString($releasename), $this->pdo->escapeString(substr($desc, 0, 10000)), $this->pdo->escapeString(substr($genre, 0, 64)), $this->pdo->escapeString($country), $this->pdo->escapeString($imgbytes), $ckid['id'])); } } @@ -193,12 +193,12 @@ class TvAnger $imgbytes = ', imgdata = ' . $this->pdo->escapeString($imgbytes); } - $this->pdo->queryExec(sprintf('UPDATE tvrage SET rageID = %d, releasetitle = %s, description = %s, genre = %s, country = %s %sWHERE ID = %d', $rageID, $this->pdo->escapeString($releasename), $this->pdo->escapeString(substr($desc, 0, 10000)), $this->pdo->escapeString($genre), $this->pdo->escapeString($country), $imgbytes, $id)); + $this->pdo->queryExec(sprintf('UPDATE tvrage SET rageid = %d, releasetitle = %s, description = %s, genre = %s, country = %s %sWHERE id = %d', $rageID, $this->pdo->escapeString($releasename), $this->pdo->escapeString(substr($desc, 0, 10000)), $this->pdo->escapeString($genre), $this->pdo->escapeString($country), $imgbytes, $id)); } public function delete($id) { - return $this->pdo->queryExec(sprintf("DELETE FROM tvrage WHERE ID = %d", $id)); + return $this->pdo->queryExec(sprintf("DELETE FROM tvrage WHERE id = %d", $id)); } public function fetchShowQuickInfo($show, array $options = array()) @@ -222,8 +222,8 @@ class TvAnger $val = trim($val); switch ($sec) { - case 'Show ID': - $ret['rageID'] = $val; + case 'Show id': + $ret['rageid'] = $val; break; case 'Show Name': $ret['name'] = $val; @@ -295,7 +295,7 @@ class TvAnger $rsql .= sprintf("AND tvrage.releasetitle LIKE %s ", $this->pdo->escapeString("%" . $ragename . "%")); } - return $this->pdo->query(sprintf("SELECT ID, rageID, releasetitle, description, createddate FROM tvrage WHERE 1=1 %s ORDER BY rageID ASC" . $limit, $rsql)); + return $this->pdo->query(sprintf("SELECT id, rageid, releasetitle, description, createddate FROM tvrage WHERE 1=1 %s ORDER BY rageid ASC" . $limit, $rsql)); } public function getCount($ragename = "") @@ -335,14 +335,14 @@ class TvAnger return $this->pdo->query( sprintf(" - SELECT tvrage.ID, tvrage.rageID, tvrage.releasetitle, tvrage.genre, tvrage.country, tvrage.createddate, tvrage.prevdate, tvrage.nextdate, - userseries.ID AS userseriesid + SELECT tvrage.id, tvrage.rageid, tvrage.releasetitle, tvrage.genre, tvrage.country, tvrage.createddate, tvrage.prevdate, tvrage.nextdate, + userseries.id AS userseriesid FROM tvrage LEFT OUTER JOIN userseries ON userseries.userID = %d - AND userseries.rageID = tvrage.rageID - WHERE tvrage.rageID IN (SELECT DISTINCT rageID FROM releases WHERE categoryID BETWEEN 5000 AND 5999 AND rageID > 0) - AND tvrage.rageID > 0 %s %s - GROUP BY tvrage.rageID + AND userseries.rageid = tvrage.rageid + WHERE tvrage.rageid IN (SELECT DISTINCT rageid FROM releases WHERE categoryid BETWEEN 5000 AND 5999 AND rageid > 0) + AND tvrage.rageid > 0 %s %s + GROUP BY tvrage.rageid ORDER BY tvrage.releasetitle ASC", $uid, $rsql, @@ -354,10 +354,10 @@ class TvAnger public function updateSchedule() { $countries = $this->pdo->query("SELECT DISTINCT(country) AS country FROM tvrage WHERE country != ''"); - $showsindb = $this->pdo->query("SELECT DISTINCT(rageID) AS rageID FROM tvrage"); + $showsindb = $this->pdo->query("SELECT DISTINCT(rageid) AS rageid FROM tvrage"); $showarray = array(); foreach ($showsindb as $show) { - $showarray[] = $show['rageID']; + $showarray[] = $show['rageid']; } foreach ($countries as $country) { if ($this->echooutput) { @@ -391,14 +391,14 @@ class TvAnger // Only stick current shows and new shows in there. if (in_array($currShowId, $showarray)) { - $this->pdo->queryExec(sprintf("INSERT INTO tvrageepisodes (rageID, showtitle, fullep, airdate, link, eptitle) VALUES (%d, %s, %s, %s, %s, %s) ON DUPLICATE KEY UPDATE airdate = %s, link = %s ,eptitle = %s, showtitle = %s", $sShow->sid, $this->pdo->escapeString($currShowName), $this->pdo->escapeString($sShow->ep), $this->pdo->escapeString(date("Y-m-d H:i:s", $day_time)), $this->pdo->escapeString($sShow->link), $this->pdo->escapeString($sShow->title), $this->pdo->escapeString(date("Y-m-d H:i:s", $day_time)), $this->pdo->escapeString($sShow->link), $this->pdo->escapeString($sShow->title), $this->pdo->escapeString($currShowName))); + $this->pdo->queryExec(sprintf("INSERT INTO tvrageepisodes (rageid, showtitle, fullep, airdate, link, eptitle) VALUES (%d, %s, %s, %s, %s, %s) ON DUPLICATE KEY UPDATE airdate = %s, link = %s ,eptitle = %s, showtitle = %s", $sShow->sid, $this->pdo->escapeString($currShowName), $this->pdo->escapeString($sShow->ep), $this->pdo->escapeString(date("Y-m-d H:i:s", $day_time)), $this->pdo->escapeString($sShow->link), $this->pdo->escapeString($sShow->title), $this->pdo->escapeString(date("Y-m-d H:i:s", $day_time)), $this->pdo->escapeString($sShow->link), $this->pdo->escapeString($sShow->title), $this->pdo->escapeString($currShowName))); } } } } // Update series info. foreach ($xmlSchedule as $showId => $epInfo) { - $res = $this->pdo->query(sprintf("SELECT * FROM tvrage WHERE rageID = %d", $showId)); + $res = $this->pdo->query(sprintf("SELECT * FROM tvrage WHERE rageid = %d", $showId)); if (sizeof($res) > 0) { foreach ($res as $arr) { $prev_ep = $next_ep = ""; @@ -413,7 +413,7 @@ class TvAnger // Next episode. if (isset($epInfo['next']) && $epInfo['next']['episode'] != '') { if ($prev_ep == "" && $arr['nextinfo'] != '' && $epInfo['next']['day_time'] > strtotime($arr["nextdate"]) && strtotime(date('Y-m-d', strtotime($arr["nextdate"]))) < $yesterday) { - $this->pdo->queryExec(sprintf("UPDATE tvrage SET prevdate = nextdate, previnfo = nextinfo WHERE ID = %d", $arr['ID'])); + $this->pdo->queryExec(sprintf("UPDATE tvrage SET prevdate = nextdate, previnfo = nextinfo WHERE id = %d", $arr['id'])); $prev_ep = "SWAPPED with: " . $arr['nextinfo'] . " - " . date("r", strtotime($arr["nextdate"])); } $next_ep = $epInfo['next']['episode'] . ', "' . $epInfo['next']['title'] . '"'; @@ -437,7 +437,7 @@ class TvAnger // Update info. if (count($query) > 0) { $sql = join(", ", $query); - $sql = sprintf("UPDATE tvrage SET {$sql} WHERE ID = %d", $arr['ID']); + $sql = sprintf("UPDATE tvrage SET {$sql} WHERE id = %d", $arr['id']); $this->pdo->queryExec($sql); } } @@ -553,7 +553,7 @@ class TvAnger } $tvairdate = (isset($show['airdate']) && !empty($show['airdate'])) ? $this->pdo->escapeString($this->checkDate($show['airdate'])) : "NULL"; - $this->pdo->queryExec(sprintf("UPDATE releases SET seriesfull = %s, season = %s, episode = %s, tvairdate = %s WHERE ID = %d", $this->pdo->escapeString($show['seriesfull']), $this->pdo->escapeString($show['season']), $this->pdo->escapeString($show['episode']), $tvairdate, $relid)); + $this->pdo->queryExec(sprintf("UPDATE releases SET seriesfull = %s, season = %s, episode = %s, tvairdate = %s WHERE id = %d", $this->pdo->escapeString($show['seriesfull']), $this->pdo->escapeString($show['season']), $this->pdo->escapeString($show['episode']), $tvairdate, $relid)); } public function updateRageInfo($rageID, $show, $tvrShow, $relid) @@ -564,9 +564,9 @@ class TvAnger $tvairdate = (!empty($epinfo['airdate'])) ? $this->pdo->escapeString($epinfo['airdate']) : "NULL"; $tvtitle = (!empty($epinfo['title'])) ? $this->pdo->escapeString($epinfo['title']) : "NULL"; - $this->pdo->queryExec(sprintf("UPDATE releases set tvtitle = %s, tvairdate = %s, rageID = %d where ID = %d", $this->pdo->escapeString(trim($tvtitle)), $tvairdate, $tvrShow['showid'], $relid)); + $this->pdo->queryExec(sprintf("UPDATE releases set tvtitle = %s, tvairdate = %s, rageid = %d where id = %d", $this->pdo->escapeString(trim($tvtitle)), $tvairdate, $tvrShow['showid'], $relid)); } else { - $this->pdo->queryExec(sprintf("UPDATE releases SET rageID = %d WHERE ID = %d", $tvrShow['showid'], $relid)); + $this->pdo->queryExec(sprintf("UPDATE releases SET rageid = %d WHERE id = %d", $tvrShow['showid'], $relid)); } $genre = ''; @@ -609,9 +609,9 @@ class TvAnger if ($epinfo !== false) { $tvairdate = (!empty($epinfo['airdate'])) ? $this->pdo->escapeString($epinfo['airdate']) : "NULL"; $tvtitle = (!empty($epinfo['title'])) ? $this->pdo->escapeString($epinfo['title']) : "NULL"; - $this->pdo->queryExec(sprintf("UPDATE releases SET tvtitle = %s, tvairdate = %s, rageID = %d WHERE ID = %d", $this->pdo->escapeString(trim($tvtitle)), $tvairdate, $traktArray['show']['tvrage_id'], $relid)); + $this->pdo->queryExec(sprintf("UPDATE releases SET tvtitle = %s, tvairdate = %s, rageid = %d WHERE id = %d", $this->pdo->escapeString(trim($tvtitle)), $tvairdate, $traktArray['show']['tvrage_id'], $relid)); } else { - $this->pdo->queryExec(sprintf("UPDATE releases SET rageID = %d WHERE ID = %d", $traktArray['show']['tvrage_id'], $relid)); + $this->pdo->queryExec(sprintf("UPDATE releases SET rageid = %d WHERE id = %d", $traktArray['show']['tvrage_id'], $relid)); } $genre = ''; @@ -652,20 +652,20 @@ class TvAnger } $trakt = new \TraktTv(['Settings' => $this->pdo]); - // Get all releases without a rageID which are in a tv category. + // Get all releases without a rageid which are in a tv category. $res = $this->pdo->query( sprintf(" - SELECT r.searchname, r.ID + SELECT r.searchname, r.id FROM releases r WHERE r.nzbstatus = 1 - AND r.rageID = -1 + AND r.rageid = -1 AND r.size > 1048576 - AND r.categoryID BETWEEN 5000 AND 5999 + AND r.categoryid BETWEEN 5000 AND 5999 %s %s %s ORDER BY r.postdate DESC LIMIT %d", - ($groupID === '' ? '' : 'AND r.groupID = ' . $groupID), + ($groupID === '' ? '' : 'AND r.groupid = ' . $groupID), ($guidChar === '' ? '' : 'AND r.guid ' . $this->pdo->likeString($guidChar, false, true)), ($lookupTvRage == 2 ? 'AND r.isrenamed = 1' : ''), $this->rageqty @@ -681,9 +681,9 @@ class TvAnger $show = $this->parseNameEpSeason($arr['searchname']); if (is_array($show) && $show['name'] != '') { // Update release with season, ep, and airdate info (if available) from releasetitle. - $this->updateEpInfo($show, $arr['ID']); + $this->updateEpInfo($show, $arr['id']); - // Find the rageID. + // Find the rageid. $id = $this->getByTitle($show['cleanname']); // Force local lookup only @@ -694,29 +694,29 @@ class TvAnger if ($id === false && $lookupTvRage) { // If it doesnt exist locally and lookups are allowed lets try to get it. if ($this->echooutput) { - echo $this->pdo->log->primaryOver("TVRage ID for ") . $this->pdo->log->headerOver($show['cleanname']) . $this->pdo->log->primary(" not found in local db, checking web."); + echo $this->pdo->log->primaryOver("TVRage id for ") . $this->pdo->log->headerOver($show['cleanname']) . $this->pdo->log->primary(" not found in local db, checking web."); } $tvrShow = $this->getRageMatch($show); if ($tvrShow !== false && is_array($tvrShow)) { // Get all tv info and add show. - $this->updateRageInfo($tvrShow['showid'], $show, $tvrShow, $arr['ID']); + $this->updateRageInfo($tvrShow['showid'], $show, $tvrShow, $arr['id']); } else if ($tvrShow === false) { // If tvrage fails, try trakt. $traktArray = $trakt->traktTVSEsummary($show['name'], $show['season'], $show['episode']); if ($traktArray !== false) { if (isset($traktArray['show']['tvrage_id']) && $traktArray['show']['tvrage_id'] !== 0) { if ($this->echooutput) { - echo $this->pdo->log->primary('Found TVRage ID on trakt:' . $traktArray['show']['tvrage_id']); + echo $this->pdo->log->primary('Found TVRage id on trakt:' . $traktArray['show']['tvrage_id']); } - $this->updateRageInfoTrakt($traktArray['show']['tvrage_id'], $show, $traktArray, $arr['ID']); + $this->updateRageInfoTrakt($traktArray['show']['tvrage_id'], $show, $traktArray, $arr['id']); } - // No match, add to tvrage with rageID = -2 and $show['cleanname'] title only. + // No match, add to tvrage with rageid = -2 and $show['cleanname'] title only. else { $this->add(-2, $show['cleanname'], '', '', '', ''); } } - // No match, add to tvrage with rageID = -2 and $show['cleanname'] title only. + // No match, add to tvrage with rageid = -2 and $show['cleanname'] title only. else { $this->add(-2, $show['cleanname'], '', '', '', ''); } @@ -744,17 +744,17 @@ class TvAnger } } if ($tvairdate == "NULL") { - $this->pdo->queryExec(sprintf('UPDATE releases SET tvtitle = %s, rageID = %d WHERE ID = %d', $tvtitle, $id, $arr['ID'])); + $this->pdo->queryExec(sprintf('UPDATE releases SET tvtitle = %s, rageid = %d WHERE id = %d', $tvtitle, $id, $arr['id'])); } else { - $this->pdo->queryExec(sprintf('UPDATE releases SET tvtitle = %s, tvairdate = %s, rageID = %d WHERE ID = %d', $tvtitle, $tvairdate, $id, $arr['ID'])); + $this->pdo->queryExec(sprintf('UPDATE releases SET tvtitle = %s, tvairdate = %s, rageid = %d WHERE id = %d', $tvtitle, $tvairdate, $id, $arr['id'])); } - // Cant find rageID, so set rageID to n/a. + // Cant find rageid, so set rageid to n/a. } else { - $this->pdo->queryExec(sprintf('UPDATE releases SET rageID = -2 WHERE ID = %d', $arr['ID'])); + $this->pdo->queryExec(sprintf('UPDATE releases SET rageid = -2 WHERE id = %d', $arr['id'])); } - // Not a tv episode, so set rageID to n/a. + // Not a tv episode, so set rageid to n/a. } else { - $this->pdo->queryExec(sprintf('UPDATE releases SET rageID = -2 WHERE ID = %d', $arr['ID'])); + $this->pdo->queryExec(sprintf('UPDATE releases SET rageid = -2 WHERE id = %d', $arr['id'])); } $ret++; } diff --git a/lib/copy_this/misc/sphinxsearch/sphinx.conf b/lib/copy_this/misc/sphinxsearch/sphinx.conf index debae5393..0d6e18503 100644 --- a/lib/copy_this/misc/sphinxsearch/sphinx.conf +++ b/lib/copy_this/misc/sphinxsearch/sphinx.conf @@ -137,7 +137,7 @@ searchd # !*: http://sphinxsearch.com/docs/current.html#conf-max-children # max_children = 0 - # PID file, searchd process ID file name + # PID file, searchd process id file name # mandatory # !*: Sphinx will not start if this folder does not exist. # !*: http://sphinxsearch.com/docs/current.html#conf-pid-file diff --git a/lib/copy_this/misc/sphinxsearch/toggle_search_type.php b/lib/copy_this/misc/sphinxsearch/toggle_search_type.php index 57bb1184b..17ed8f767 100644 --- a/lib/copy_this/misc/sphinxsearch/toggle_search_type.php +++ b/lib/copy_this/misc/sphinxsearch/toggle_search_type.php @@ -64,17 +64,17 @@ function revertToStandard($pdo) $pdo->queryExec( sprintf(" CREATE TABLE releasesearch ( - ID INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, - releaseID INT(11) UNSIGNED NOT NULL, + id INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, + releaseid INT(11) UNSIGNED NOT NULL, guid VARCHAR(50) NOT NULL, name VARCHAR(255) NOT NULL DEFAULT '', searchname VARCHAR(255) NOT NULL DEFAULT '', fromname VARCHAR(255) DEFAULT NULL, - PRIMARY KEY (ID), + PRIMARY KEY (id), FULLTEXT INDEX ix_releasesearch_name_ft (name), FULLTEXT INDEX ix_releasesearch_searchname_ft (searchname), FULLTEXT INDEX ix_releasesearch_fromname_ft (fromname), - INDEX ix_releasesearch_releaseid (releaseID), + INDEX ix_releasesearch_releaseid (releaseid), INDEX ix_releasesearch_guid (guid) ) %s @@ -86,8 +86,8 @@ function revertToStandard($pdo) ); echo $pdo->log->info('Populating the releasearch table with initial data. (Slow)' . PHP_EOL); - $pdo->queryInsert('INSERT INTO releasesearch (releaseID, guid, name, searchname, fromname) - SELECT ID, guid, name, searchname, fromname FROM releases'); + $pdo->queryInsert('INSERT INTO releasesearch (releaseid, guid, name, searchname, fromname) + SELECT id, guid, name, searchname, fromname FROM releases'); echo $pdo->log->info('Adding the auto-population triggers. (Quick)' . PHP_EOL); @@ -96,8 +96,8 @@ function revertToStandard($pdo) $pdo->exec(' CREATE TRIGGER insert_search AFTER INSERT ON releases FOR EACH ROW BEGIN - INSERT INTO releasesearch (releaseID, guid, name, searchname, fromname) - VALUES (NEW.ID, NEW.guid, NEW.name, NEW.searchname, NEW.fromname); + INSERT INTO releasesearch (releaseid, guid, name, searchname, fromname) + VALUES (NEW.id, NEW.guid, NEW.name, NEW.searchname, NEW.fromname); END; CREATE TRIGGER update_search AFTER UPDATE ON releases FOR EACH ROW @@ -105,24 +105,24 @@ function revertToStandard($pdo) IF NEW.guid != OLD.guid THEN UPDATE releasesearch SET guid = NEW.guid - WHERE releaseID = OLD.ID; + WHERE releaseid = OLD.id; END IF; IF NEW.name != OLD.name THEN UPDATE releasesearch SET name = NEW.name - WHERE releaseID = OLD.ID; + WHERE releaseid = OLD.id; END IF; IF NEW.fromname != OLD.fromname THEN UPDATE releasesearch SET fromname = NEW.fromname - WHERE releaseID = OLD.id; + WHERE releaseid = OLD.id; END IF; END; CREATE TRIGGER delete_search AFTER DELETE ON releases FOR EACH ROW BEGIN DELETE FROM releasesearch - WHERE releaseID = OLD.ID; + WHERE releaseid = OLD.id; END;' ); echo $pdo->log->header('Standard search should once again be available.' . PHP_EOL); diff --git a/lib/copy_this/misc/update_scripts/import.php b/lib/copy_this/misc/update_scripts/import.php index 9a18e3deb..bd322ba4c 100644 --- a/lib/copy_this/misc/update_scripts/import.php +++ b/lib/copy_this/misc/update_scripts/import.php @@ -35,9 +35,9 @@ if (empty($argc) || $argc <= 1) { $categoryoverride = $argv[5]; } -$groups = $db->query("SELECT ID, name FROM groups"); +$groups = $db->query("SELECT id, name FROM groups"); foreach ($groups as $group) - $siteGroups[$group["name"]] = $group["ID"]; + $siteGroups[$group["name"]] = $group["id"]; echo "\nUsage: php import.php [path(string)] [usefilename(true/false)] [dupecheck(true/false)] [movefiles(true/false)] [overridecategory(number)]\n"; @@ -101,7 +101,7 @@ foreach ($filestoprocess as $nzbFile) { $name = $releases->cleanReleaseName(str_replace(".nzb", "", basename($nzbFile))); $catId = $cat->determineCategory($groupName, $name); $relid = $releases->insertRelease($name, $nzbInfo->filecount, $groupID, $relguid, $catId, "", date("Y-m-d H:i:s", $nzbInfo->postedlast), $nzbInfo->poster, "", $page->site); - $db->queryExec(sprintf("update releases set totalpart = %d, size = %s, completion = %d, GID=%s where ID = %d", $nzbInfo->filecount, $nzbInfo->filesize, $nzbInfo->completion, $db->escapeString($nzbInfo->gid), $relid)); + $db->queryExec(sprintf("update releases set totalpart = %d, size = %s, completion = %d, GID=%s where id = %d", $nzbInfo->filecount, $nzbInfo->filesize, $nzbInfo->completion, $db->escapeString($nzbInfo->gid), $relid)); $nzbfilename = $nzb->NZBPath($relguid, $page->site->nzbpath, true); $fp = gzopen($nzbfilename, "w"); @@ -141,8 +141,8 @@ foreach ($filestoprocess as $nzbFile) { $relparts = explode("/", $regexMatches['parts']); $regexMatches['regcatid'] = ($categoryoverride != -1 ? $categoryoverride : $regexMatches['regcatid']); - $sql = sprintf("INSERT INTO binaries (name, fromname, date, xref, totalParts, groupID, binaryhash, dateadded, - categoryID, regexID, reqID, procstat, relpart, reltotalpart, relname) + $sql = sprintf("INSERT INTO binaries (name, fromname, date, xref, totalParts, groupid, binaryhash, dateadded, + categoryid, regexid, reqid, procstat, relpart, reltotalpart, relname) values (%s, %s, %s, %s, %d, %d, %s, NOW(), %s, %d, %s, %d, %d, %d, %s )", $db->escapeString($postFile["subject"]), $db->escapeString($postFile["poster"]), $db->escapeString(date("Y-m-d H:i:s", $postFile["posted"])), @@ -150,7 +150,7 @@ foreach ($filestoprocess as $nzbFile) { $postFile["segmenttotal"], $groupID, $db->escapeString(md5($postFile["subject"] . $postFile["poster"] . $groupID)), $regexMatches['regcatid'], - $regexMatches['regexID'], $db->escapeString($regexMatches['reqID']), + $regexMatches['regexid'], $db->escapeString($regexMatches['reqid']), Releases::PROCSTAT_TITLEMATCHED, $relparts[0], $relparts[1], $db->escapeString(str_replace('_', ' ', $regexMatches['name'])) ); $binaryId = $db->queryInsert($sql); @@ -167,7 +167,7 @@ foreach ($filestoprocess as $nzbFile) { } } if ($binaryId != 0) { - echo sprintf("%0" . $digits . "d %.2f%% Imported %s (%d:%s-%d/%d)\n", $items - $num, $num / $items * 100, basename($nzbFile), $regexMatches['regcatid'], $regexMatches['regexID'], $numbins, $numparts); + echo sprintf("%0" . $digits . "d %.2f%% Imported %s (%d:%s-%d/%d)\n", $items - $num, $num / $items * 100, basename($nzbFile), $regexMatches['regcatid'], $regexMatches['regexid'], $numbins, $numparts); if ($movefiles) { if (!file_exists($importedpath)) mkdir($importedpath); if (!file_exists($importedpath . basename($nzbFile))) rename($nzbFile, $importedpath . basename($nzbFile)); diff --git a/lib/copy_this/misc/update_scripts/nix_scripts/multiprocessing/.do_not_run/switch.php b/lib/copy_this/misc/update_scripts/nix_scripts/multiprocessing/.do_not_run/switch.php index c2b87f08d..22ce15d7d 100644 --- a/lib/copy_this/misc/update_scripts/nix_scripts/multiprocessing/.do_not_run/switch.php +++ b/lib/copy_this/misc/update_scripts/nix_scripts/multiprocessing/.do_not_run/switch.php @@ -94,10 +94,10 @@ switch ($options[1]) { ); $columns[2] = sprintf('last_record = %s', $return['lastArticleNumber']); $query = sprintf( - 'UPDATE groups SET %s, %s, last_updated = NOW() WHERE ID = %d AND last_record < %s', + 'UPDATE groups SET %s, %s, last_updated = NOW() WHERE id = %d AND last_record < %s', $columns[1], $columns[2], - $groupMySQL['ID'], + $groupMySQL['id'], $return['lastArticleNumber'] ); break; @@ -113,10 +113,10 @@ switch ($options[1]) { ); $columns[2] = sprintf('first_record = %s', $return['firstArticleNumber']); $query = sprintf( - 'UPDATE groups SET %s, %s, last_updated = NOW() WHERE ID = %d AND first_record > %s', + 'UPDATE groups SET %s, %s, last_updated = NOW() WHERE id = %d AND first_record > %s', $columns[1], $columns[2], - $groupMySQL['ID'], + $groupMySQL['id'], $return['firstArticleNumber'] ); break; @@ -146,7 +146,7 @@ switch ($options[1]) { break; // Process releases. - // $options[2] => (string)groupCount, number of groups terminated by _ | (int)groupID, group to work on + // $options[2] => (string)groupCount, number of groups terminated by _ | (int)groupid, group to work on case 'releases': $pdo = new \DB(); $releases = new ProcessReleases(['Settings' => $pdo]); @@ -175,8 +175,8 @@ switch ($options[1]) { } break; - // Process all local requestID for a single group. - // $options[2] => (int)groupID, group to work on + // Process all local requestid for a single group. + // $options[2] => (int)groupid, group to work on case 'requestid': if (is_numeric($options[2])) { (new \RequestIDLocal(['Echo' => true]))->lookupRequestIDs(['GroupID' => $options[2], 'limit' => 5000]); @@ -197,17 +197,17 @@ switch ($options[1]) { // Do a single group (update_binaries/backFill/update_releases/postprocess). - // $options[2] => (int)groupID, group to work on + // $options[2] => (int)groupid, group to work on case 'update_per_group': if (is_numeric($options[2])) { $pdo = new \DB(); // Get the group info from MySQL. - $groupMySQL = $pdo->queryOneRow(sprintf('SELECT * FROM groups WHERE ID = %d', $options[2])); + $groupMySQL = $pdo->queryOneRow(sprintf('SELECT * FROM groups WHERE id = %d', $options[2])); if ($groupMySQL === false) { - exit('ERROR: Group not found with ID ' . $options[2] . PHP_EOL); + exit('ERROR: Group not found with id ' . $options[2] . PHP_EOL); } // Connect to NNTP. @@ -274,7 +274,7 @@ switch ($options[1]) { } /** - * Create / process releases for a groupID. + * Create / process releases for a groupid. * * @param \ProcessReleases $releases * @param int $groupID @@ -312,7 +312,7 @@ function charCheck($char) */ function collectionCheck(&$pdo, $groupID) { - if ($pdo->queryOneRow(sprintf('SELECT ID FROM collections_%d LIMIT 1', $groupID)) === false) { + if ($pdo->queryOneRow(sprintf('SELECT id FROM collections_%d LIMIT 1', $groupID)) === false) { exit(); } } diff --git a/lib/copy_this/misc/update_scripts/nix_scripts/multiprocessing/Forking.php b/lib/copy_this/misc/update_scripts/nix_scripts/multiprocessing/Forking.php index 6841148ba..46e8de57b 100644 --- a/lib/copy_this/misc/update_scripts/nix_scripts/multiprocessing/Forking.php +++ b/lib/copy_this/misc/update_scripts/nix_scripts/multiprocessing/Forking.php @@ -16,8 +16,8 @@ require_once(NN_TMUX . 'lib' . DS . 'Pprocess.php'); * * This forks various newznab scripts. * - * For example, you get all the ID's of the active groups in the groups table, you then iterate over them and spawn - * processes of misc/update_binaries.php passing the group ID's. + * For example, you get all the id's of the active groups in the groups table, you then iterate over them and spawn + * processes of misc/update_binaries.php passing the group id's. * * @package nzedb\libraries */ @@ -493,7 +493,7 @@ class Forking extends \fork_daemon $groupby = "GROUP BY guidchar"; $orderby = "ORDER BY guidchar ASC"; $rowLimit = "LIMIT 16"; - $extrawhere = "AND r.prehashID = 0 AND r.nzbstatus = 1"; + $extrawhere = "AND r.prehashid = 0 AND r.nzbstatus = 1"; $select = "DISTINCT LEFT(r.guid, 1) AS guidchar, COUNT(*) AS count"; @@ -505,7 +505,7 @@ class Forking extends \fork_daemon } switch($this->workTypeOptions[0]) { case "md5": - $join = "LEFT OUTER JOIN releasefiles rf ON r.ID = rf.releaseID AND rf.ishashed = 1"; + $join = "LEFT OUTER JOIN releasefiles rf ON r.id = rf.releaseid AND rf.ishashed = 1"; $where = "r.ishashed = 1 AND r.dehashstatus BETWEEN -6 AND 0"; break; @@ -514,7 +514,7 @@ class Forking extends \fork_daemon break; case "filename": - $join = "INNER JOIN releasefiles rf ON r.ID = rf.releaseID"; + $join = "INNER JOIN releasefiles rf ON r.id = rf.releaseid"; $where = "r.proc_files = 0"; break; @@ -578,12 +578,12 @@ class Forking extends \fork_daemon $this->tablePerGroup = ($this->site->tablepergroup == 1 ? true : false); if ($this->tablePerGroup === true) { - $groups = $this->pdo->queryDirect('SELECT ID FROM groups WHERE (active = 1 OR backfill = 1)'); + $groups = $this->pdo->queryDirect('SELECT id FROM groups WHERE (active = 1 OR backfill = 1)'); if ($groups instanceof \Traversable) { foreach($groups as $group) { - if ($this->pdo->queryOneRow(sprintf('SELECT ID FROM binaries_%d LIMIT 1',$group['ID'])) !== false) { - $this->work[] = ['ID' => $group['ID']]; + if ($this->pdo->queryOneRow(sprintf('SELECT id FROM binaries_%d LIMIT 1',$group['id'])) !== false) { + $this->work[] = ['id' => $group['id']]; } } } @@ -599,7 +599,7 @@ class Forking extends \fork_daemon foreach ($groups as $group) { if ($this->tablePerGroup === true) { $this->_executeCommand( - $this->dnr_path . 'releases ' . $group['ID'] . '"' + $this->dnr_path . 'releases ' . $group['id'] . '"' ); } else { $this->_executeCommand( @@ -635,7 +635,7 @@ class Forking extends \fork_daemon if ($type !== '') { $this->_executeCommand( - $this->dnr_path . $type . $group['ID'] . (isset($group['renamed']) ? (' ' . $group['renamed']) : '') . '"' + $this->dnr_path . $type . $group['id'] . (isset($group['renamed']) ? (' ' . $group['renamed']) : '') . '"' ); } } @@ -659,9 +659,9 @@ class Forking extends \fork_daemon return ( $this->pdo->queryOneRow( sprintf(' - SELECT r.ID + SELECT r.id FROM releases r - LEFT JOIN category c ON c.ID = r.categoryID + LEFT JOIN category c ON c.id = r.categoryid WHERE r.nzbstatus = %d AND r.passwordstatus BETWEEN -6 AND -1 AND r.haspreview = -1 @@ -684,9 +684,9 @@ class Forking extends \fork_daemon $this->register_child_run([0 => $this, 1 => 'postProcessChildWorker']); $this->work = $this->pdo->query( sprintf(' - SELECT LEFT(r.guid, 1) AS ID + SELECT LEFT(r.guid, 1) AS id FROM releases r - LEFT JOIN category c ON c.ID = r.categoryID + LEFT JOIN category c ON c.id = r.categoryid WHERE r.nzbstatus = %d AND r.passwordstatus BETWEEN -6 AND -1 AND r.haspreview = -1 @@ -717,7 +717,7 @@ class Forking extends \fork_daemon return ( $this->pdo->queryOneRow( sprintf( - 'SELECT r.ID FROM releases r WHERE 1=1 %s LIMIT 1', + 'SELECT r.id FROM releases r WHERE 1=1 %s LIMIT 1', $this->nfoQueryString ) ) === false ? false : true @@ -734,7 +734,7 @@ class Forking extends \fork_daemon $this->register_child_run([0 => $this, 1 => 'postProcessChildWorker']); $this->work = $this->pdo->query( sprintf(' - SELECT LEFT(r.guid, 1) AS ID + SELECT LEFT(r.guid, 1) AS id FROM releases r WHERE 1=1 %s GROUP BY LEFT(r.guid, 1) @@ -757,11 +757,11 @@ class Forking extends \fork_daemon return ( $this->pdo->queryOneRow( sprintf(' - SELECT ID + SELECT id FROM releases WHERE nzbstatus = %d - AND imdbID IS NULL - AND categoryID BETWEEN 2000 AND 2999 + AND imdbid IS NULL + AND categoryid BETWEEN 2000 AND 2999 %s %s LIMIT 1', \NZB::NZB_ADDED, @@ -782,11 +782,11 @@ class Forking extends \fork_daemon $this->register_child_run([0 => $this, 1 => 'postProcessChildWorker']); $this->work = $this->pdo->query( sprintf(' - SELECT LEFT(guid, 1) AS ID, %d AS renamed + SELECT LEFT(guid, 1) AS id, %d AS renamed FROM releases WHERE nzbstatus = %d - AND imdbID IS NULL - AND categoryID BETWEEN 2000 AND 2999 + AND imdbid IS NULL + AND categoryid BETWEEN 2000 AND 2999 %s %s GROUP BY LEFT(guid, 1) LIMIT 16', @@ -811,12 +811,12 @@ class Forking extends \fork_daemon return ( $this->pdo->queryOneRow( sprintf(' - SELECT ID + SELECT id FROM releases WHERE nzbstatus = %d AND size > 1048576 - AND rageID = -1 - AND categoryID BETWEEN 5000 AND 5999 + AND rageid = -1 + AND categoryid BETWEEN 5000 AND 5999 %s %s LIMIT 1', \NZB::NZB_ADDED, @@ -837,12 +837,12 @@ class Forking extends \fork_daemon $this->register_child_run([0 => $this, 1 => 'postProcessChildWorker']); $this->work = $this->pdo->query( sprintf(' - SELECT LEFT(guid, 1) AS ID, %d AS renamed + SELECT LEFT(guid, 1) AS id, %d AS renamed FROM releases WHERE nzbstatus = %d - AND rageID = -1 + AND rageid = -1 AND size > 1048576 - AND categoryID BETWEEN 5000 AND 5999 + AND categoryid BETWEEN 5000 AND 5999 %s %s GROUP BY LEFT(guid, 1) LIMIT 16', @@ -893,7 +893,7 @@ class Forking extends \fork_daemon } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////////////////////////////////////// All requestID code goes here //////////////////////////////////////////////// + ////////////////////////////////////// All requestid code goes here //////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private function requestIDMainMethod() @@ -901,12 +901,12 @@ class Forking extends \fork_daemon $this->register_child_run([0 => $this, 1 => 'requestIDChildWorker']); $this->work = $this->pdo->query( sprintf(' - SELECT DISTINCT(g.ID) + SELECT DISTINCT(g.id) FROM groups g - INNER JOIN releases r ON r.groupID = g.ID + INNER JOIN releases r ON r.groupid = g.id WHERE g.active = 1 AND r.nzbstatus = %d - AND r.prehashID = 0 + AND r.prehashid = 0 AND r.isrequestid = 1 AND r.reqidstatus = %d', \NZB::NZB_ADDED, @@ -920,7 +920,7 @@ class Forking extends \fork_daemon { foreach ($groups as $group) { $this->_executeCommand( - $this->dnr_path . 'requestid ' . $group['ID'] . '"' + $this->dnr_path . 'requestid ' . $group['id'] . '"' ); } } @@ -932,7 +932,7 @@ class Forking extends \fork_daemon private function updatePerGroupMainMethod() { $this->register_child_run([0 => $this, 1 => 'updatePerGroupChildWorker']); - $this->work = $this->pdo->query('SELECT ID FROM groups WHERE (active = 1 OR backfill = 1)'); + $this->work = $this->pdo->query('SELECT id FROM groups WHERE (active = 1 OR backfill = 1)'); return $this->site->releasethreads; } @@ -940,7 +940,7 @@ class Forking extends \fork_daemon { foreach ($groups as $group) { $this->_executeCommand( - $this->dnr_path . 'update_per_group ' . $group['ID'] . '"' + $this->dnr_path . 'update_per_group ' . $group['id'] . '"' ); } } @@ -1020,7 +1020,7 @@ class Forking extends \fork_daemon if (NN_ECHOCLI) { $this->_colorCLI->doEcho( $this->_colorCLI->header( - 'Process ID #' . $pid . ' has completed.' . PHP_EOL . + 'Process id #' . $pid . ' has completed.' . PHP_EOL . 'There are ' . ($this->forked_children_count - 1) . ' process(es) still active with ' . (--$this->_workCount) . ' job(s) left in the queue.' . PHP_EOL ) diff --git a/lib/copy_this/misc/update_scripts/nix_scripts/multiprocessing/README.md b/lib/copy_this/misc/update_scripts/nix_scripts/multiprocessing/README.md index 0e4c98e30..54d031838 100644 --- a/lib/copy_this/misc/update_scripts/nix_scripts/multiprocessing/README.md +++ b/lib/copy_this/misc/update_scripts/nix_scripts/multiprocessing/README.md @@ -8,12 +8,12 @@ You can pass a argument, a number to limit the max amount of new headers to down ####releases.php This is identical to the python releases_threaded.py -This will create new releases/delete unwanted releases, process requestID's, categorize releases by group +This will create new releases/delete unwanted releases, process requestid's, categorize releases by group using your release threads site setting. ####update_per_group.php: This is identical to the python update_threaded.py This will download new headers for all active groups, backfill 20k headers from all backfill enabled groups, -create new releases/delete unwanted releases, process requestID's, categorize releases, process additional and NFO +create new releases/delete unwanted releases, process requestid's, categorize releases, process additional and NFO by group using your release threads site setting. \ No newline at end of file diff --git a/lib/copy_this/www/admin/ajax_sharing_settings.php b/lib/copy_this/www/admin/ajax_sharing_settings.php index b8a27f3ef..41cb2331f 100644 --- a/lib/copy_this/www/admin/ajax_sharing_settings.php +++ b/lib/copy_this/www/admin/ajax_sharing_settings.php @@ -9,7 +9,7 @@ $admin = new AdminPage; $db = new DB(); if (isset($_GET['site_ID']) && isset($_GET['site_status'])) { - $db->queryExec(sprintf('UPDATE sharing_sites SET enabled = %d WHERE ID = %d', $_GET['site_status'], $_GET['site_ID'])); + $db->queryExec(sprintf('UPDATE sharing_sites SET enabled = %d WHERE id = %d', $_GET['site_status'], $_GET['site_ID'])); if ($_GET['site_status'] == 1) { print 'Activated site ' . $_GET['site_ID']; } else { @@ -84,19 +84,19 @@ else if (isset($_GET['reset_settings'])) { } else if (isset($_GET['purge_site'])) { - $guid = $db->queryOneRow(sprintf('SELECT site_guid FROM sharing_sites WHERE ID = %d', $_GET['purge_site'])); + $guid = $db->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 = $db->query(sprintf('SELECT ID FROM releasecomment WHERE siteID = %s', $db->escapeString($guid['site_guid']))); + $ids = $db->query(sprintf('SELECT id FROM releasecomment WHERE siteID = %s', $db->escapeString($guid['site_guid']))); $total = count($ids); if ($total > 0) { $rc = new ReleaseComments(); foreach ($ids as $id) { - $rc->deleteComment($id['ID']); + $rc->deleteComment($id['id']); } } - $db->queryExec(sprintf('UPDATE sharing_sites SET comments = 0 WHERE ID = %d', $_GET['purge_site'])); + $db->queryExec(sprintf('UPDATE sharing_sites SET comments = 0 WHERE id = %d', $_GET['purge_site'])); print 'Deleted ' . $total . ' comments for site ' . $_GET['purge_site']; } } \ No newline at end of file diff --git a/lib/copy_this/www/admin/sharing.php b/lib/copy_this/www/admin/sharing.php index 462485ddd..7dee3a966 100644 --- a/lib/copy_this/www/admin/sharing.php +++ b/lib/copy_this/www/admin/sharing.php @@ -10,7 +10,7 @@ $db = new DB(); $offset = (isset($_GET['offset']) ? $_GET['offset'] : 0); -$allSites = $db->query(sprintf('SELECT * FROM sharing_sites ORDER BY ID LIMIT %d OFFSET %d', 25, $offset)); +$allSites = $db->query(sprintf('SELECT * FROM sharing_sites ORDER BY id LIMIT %d OFFSET %d', 25, $offset)); if (count($allSites) === 0) { $allSites = false; } diff --git a/lib/copy_this/www/admin/site-edit.php b/lib/copy_this/www/admin/site-edit.php index 3a60a929e..5c64958d0 100644 --- a/lib/copy_this/www/admin/site-edit.php +++ b/lib/copy_this/www/admin/site-edit.php @@ -47,7 +47,7 @@ switch($action) { $site = $ret; $returnid = $site->id; - header("Location:".WWW_TOP."/site-edit.php?ID=".$returnid); + header("Location:".WWW_TOP."/site-edit.php?id=".$returnid); } else { @@ -122,14 +122,14 @@ $page->smarty->assign('lookup_reqids_ids', array(0,1,2)); $page->smarty->assign('lookup_reqids_names', array('Disabled', 'Lookup Request IDs', 'Lookup Request IDs Threaded')); // return a list of audiobooks, ebooks, technical and foreign books -$result = $page->settings->query("SELECT ID, title FROM category WHERE ID in (3030, 7010, 7040, 7060)"); +$result = $page->settings->query("SELECT id, title FROM category WHERE id in (3030, 7010, 7040, 7060)"); // setup the display lists for these categories, this could have been static, but then if names changed they would be wrong $book_reqids_ids = array(); $book_reqids_names = array(); foreach ($result as $bookcategory) { - $book_reqids_ids[] = $bookcategory["ID"]; + $book_reqids_ids[] = $bookcategory["id"]; $book_reqids_names[] = $bookcategory["title"]; } diff --git a/lib/copy_this/www/admin/user-edit.php b/lib/copy_this/www/admin/user-edit.php index d90afbd00..cd150367b 100644 --- a/lib/copy_this/www/admin/user-edit.php +++ b/lib/copy_this/www/admin/user-edit.php @@ -17,9 +17,9 @@ $roles = array(); $defaultrole = Users::ROLE_USER; $defaultinvites = Users::DEFAULT_INVITES; foreach ($userroles as $r) { - $roles[$r['ID']] = $r['name']; + $roles[$r['id']] = $r['name']; if ($r['isdefault'] == 1) { - $defaultrole = $r['ID']; + $defaultrole = $r['id']; $defaultinvites = $r['defaultinvites']; } } @@ -43,7 +43,7 @@ switch ($action) { if ($_POST["id"] == "") { $invites = $defaultinvites; foreach ($userroles as $role) { - if ($role['ID'] == $_POST['role']) + if ($role['id'] == $_POST['role']) $invites = $role['defaultinvites']; } $ret = $users->signup($_POST["username"], $_POST["password"], $_POST["email"], '', $_POST["role"], $_POST["notes"], $invites, "", true, false, false, true); @@ -77,7 +77,7 @@ switch ($action) { break; } $user = array(); - $user["ID"] = $_POST["id"]; + $user["id"] = $_POST["id"]; $user["username"] = $_POST["username"]; $user["email"] = $_POST["email"]; $user["grabs"] = (isset($_POST["grabs"]) ? $_POST["grabs"] : "0"); diff --git a/lib/copy_this/www/lib/Books.php b/lib/copy_this/www/lib/Books.php index 3db38aaee..f1c94cda6 100644 --- a/lib/copy_this/www/lib/Books.php +++ b/lib/copy_this/www/lib/Books.php @@ -92,7 +92,7 @@ class Books public function getBookInfo($id) { - return $this->pdo->queryOneRow(sprintf('SELECT bookinfo.* FROM bookinfo WHERE bookinfo.ID = %d', $id)); + return $this->pdo->queryOneRow(sprintf('SELECT bookinfo.* FROM bookinfo WHERE bookinfo.id = %d', $id)); } public function getBookInfoByName($author, $title) @@ -113,7 +113,7 @@ class Books public function getCount() { - $res = $this->pdo->queryOneRow('SELECT COUNT(ID) AS num FROM bookinfo'); + $res = $this->pdo->queryOneRow('SELECT COUNT(id) AS num FROM bookinfo'); return $res['num']; } @@ -136,13 +136,13 @@ class Books $exccatlist = ''; if (count($excludedcats) > 0) { - $exccatlist = ' AND r.categoryID NOT IN (' . implode(',', $excludedcats) . ')'; + $exccatlist = ' AND r.categoryid NOT IN (' . implode(',', $excludedcats) . ')'; } $res = $this->pdo->queryOneRow( sprintf( - "SELECT COUNT(DISTINCT r.bookinfoID) AS num FROM releases r " - . "INNER JOIN bookinfo boo ON boo.ID = r.bookinfoID AND boo.title != '' and boo.cover = 1 " + "SELECT COUNT(DISTINCT r.bookinfoid) AS num FROM releases r " + . "INNER JOIN bookinfo boo ON boo.id = r.bookinfoid AND boo.title != '' and boo.cover = 1 " . "WHERE r.nzbstatus = 1 AND r.passwordstatus <= (SELECT value FROM site WHERE setting='showpasswordedrelease') " . "AND %s %s %s %s", $browseby, $catsrch, $maxage, $exccatlist ) @@ -173,17 +173,17 @@ class Books $exccatlist = ''; if (count($excludedcats) > 0) { - $exccatlist = ' AND r.categoryID NOT IN (' . implode(',', $excludedcats) . ')'; + $exccatlist = ' AND r.categoryid NOT IN (' . implode(',', $excludedcats) . ')'; } $order = $this->getBookOrder($orderby); $sql = sprintf( - "SELECT GROUP_CONCAT(r.ID ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_id, " + "SELECT GROUP_CONCAT(r.id ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_id, " . "GROUP_CONCAT(r.rarinnerfilecount ORDER BY r.postdate DESC SEPARATOR ',') as grp_rarinnerfilecount, " . "GROUP_CONCAT(r.haspreview ORDER BY r.postdate DESC SEPARATOR ',') AS grp_haspreview, " . "GROUP_CONCAT(r.passwordstatus ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_password, " . "GROUP_CONCAT(r.guid ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_guid, " - . "GROUP_CONCAT(rn.ID ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_nfoid, " + . "GROUP_CONCAT(rn.id ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_nfoid, " . "GROUP_CONCAT(groups.name ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_grpname, " . "GROUP_CONCAT(r.searchname ORDER BY r.postdate DESC SEPARATOR '#') AS grp_release_name, " . "GROUP_CONCAT(r.postdate ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_postdate, " @@ -191,13 +191,13 @@ class Books . "GROUP_CONCAT(r.totalpart ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_totalparts, " . "GROUP_CONCAT(r.comments ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_comments, " . "GROUP_CONCAT(r.grabs ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_grabs, " - . "boo.*, r.bookinfoID, groups.name AS group_name, rn.ID as nfoid FROM releases r " - . "LEFT OUTER JOIN groups ON groups.ID = r.groupID " - . "LEFT OUTER JOIN releasenfo rn ON rn.releaseid = r.ID " - . "INNER JOIN bookinfo boo ON boo.ID = r.bookinfoID " + . "boo.*, r.bookinfoid, groups.name AS group_name, rn.id as nfoid FROM releases r " + . "LEFT OUTER JOIN groups ON groups.id = r.groupid " + . "LEFT OUTER JOIN releasenfo rn ON rn.releaseid = r.id " + . "INNER JOIN bookinfo boo ON boo.id = r.bookinfoid " . "WHERE r.nzbstatus = 1 AND boo.cover = 1 AND boo.title != '' AND " . "r.passwordstatus <= (SELECT value FROM site WHERE setting='showpasswordedrelease') AND %s %s %s %s " - . "GROUP BY boo.ID ORDER BY %s %s" . $limit, $browseby, $catsrch, $maxage, $exccatlist, $order[0], $order[1] + . "GROUP BY boo.id ORDER BY %s %s" . $limit, $browseby, $catsrch, $maxage, $exccatlist, $order[0], $order[1] ); return $this->pdo->queryDirect($sql); @@ -304,11 +304,11 @@ class Books $this->processBookReleasesHelper( $this->pdo->queryDirect( sprintf(' - SELECT searchname, ID, categoryID + SELECT searchname, id, categoryid FROM releases WHERE nzbstatus = 1 %s - AND bookinfoID IS NULL - AND categoryID in (%s) + AND bookinfoid IS NULL + AND categoryid in (%s) ORDER BY postdate DESC LIMIT %d', $this->renamed, $bookids[$i], $this->bookqty) ), $bookids[$i] @@ -328,19 +328,19 @@ class Books { if ($res instanceof \Traversable && $res->rowCount() > 0) { if ($this->echooutput) { - $this->pdo->log->doEcho($this->pdo->log->header("\nProcessing " . $res->rowCount() . ' book release(s) for category ID ' . $categoryID)); + $this->pdo->log->doEcho($this->pdo->log->header("\nProcessing " . $res->rowCount() . ' book release(s) for category id ' . $categoryID)); } foreach ($res as $arr) { $startTime = microtime(true); $usedAmazon = false; // audiobooks are also books and should be handled in an identical manor, even though it falls under a music category - if ($arr['categoryID'] == '3030') { + if ($arr['categoryid'] == '3030') { // audiobook - $bookInfo = $this->parseTitle($arr['searchname'], $arr['ID'], 'audiobook'); + $bookInfo = $this->parseTitle($arr['searchname'], $arr['id'], 'audiobook'); } else { // ebook - $bookInfo = $this->parseTitle($arr['searchname'], $arr['ID'], 'ebook'); + $bookInfo = $this->parseTitle($arr['searchname'], $arr['id'], 'ebook'); } if ($bookInfo !== false) { @@ -358,13 +358,13 @@ class Books $bookId = -2; } } else { - $bookId = $bookCheck['ID']; + $bookId = $bookCheck['id']; } // Update release. - $this->pdo->queryExec(sprintf('UPDATE releases SET bookinfoID = %d WHERE ID = %d', $bookId, $arr['ID'])); + $this->pdo->queryExec(sprintf('UPDATE releases SET bookinfoid = %d WHERE id = %d', $bookId, $arr['id'])); } else { // Could not parse release title. - $this->pdo->queryExec(sprintf('UPDATE releases SET bookinfoID = %d WHERE ID = %d', -2, $arr['ID'])); + $this->pdo->queryExec(sprintf('UPDATE releases SET bookinfoid = %d WHERE id = %d', -2, $arr['id'])); if ($this->echooutput) { echo '.'; } @@ -401,7 +401,7 @@ class Books $this->pdo->log->headerOver('Changing category to misc books: ') . $this->pdo->log->primary($releasename) ); } - $this->pdo->queryExec(sprintf('UPDATE releases SET categoryID = %d WHERE ID = %d', 7050, $releaseID)); + $this->pdo->queryExec(sprintf('UPDATE releases SET categoryid = %d WHERE id = %d', 7050, $releaseID)); return false; } else if (preg_match('/^([a-z0-9ü!]+ ){1,2}(N|Vol)?\d{1,4}(a|b|c)?$|^([a-z0-9]+ ){1,2}(Jan( |unar|$)|Feb( |ruary|$)|Mar( |ch|$)|Apr( |il|$)|May(?![a-z0-9])|Jun( |e|$)|Jul( |y|$)|Aug( |ust|$)|Sep( |tember|$)|O(c|k)t( |ober|$)|Nov( |ember|$)|De(c|z)( |ember|$))/i', $releasename) && !preg_match('/Part \d+/i', $releasename)) { @@ -410,7 +410,7 @@ class Books $this->pdo->log->headerOver('Changing category to magazines: ') . $this->pdo->log->primary($releasename) ); } - $this->pdo->queryExec(sprintf('UPDATE releases SET categoryID = %d WHERE ID = %d', 7030, $releaseID)); + $this->pdo->queryExec(sprintf('UPDATE releases SET categoryid = %d WHERE id = %d', 7030, $releaseID)); return false; } else if (!empty($releasename) && !preg_match('/^[a-z0-9]+$|^([0-9]+ ){1,}$|Part \d+/i', $releasename)) { return $releasename; @@ -505,7 +505,7 @@ class Books $book['cover'] = 0; } - $check = $this->pdo->queryOneRow(sprintf('SELECT ID FROM bookinfo WHERE asin = %s', $this->pdo->escapeString($book['asin']))); + $check = $this->pdo->queryOneRow(sprintf('SELECT id FROM bookinfo WHERE asin = %s', $this->pdo->escapeString($book['asin']))); if ($check === false) { $bookId = $this->pdo->queryInsert( sprintf(" @@ -523,13 +523,13 @@ class Books ) ); } else { - $bookId = $check['ID']; + $bookId = $check['id']; $this->pdo->queryExec( sprintf(' UPDATE bookinfo SET title = %s, author = %s, asin = %s, isbn = %s, ean = %s, url = %s, salesrank = %s, publisher = %s, publishdate = %s, pages = %s, overview = %s, genre = %s, cover = %d, updateddate = NOW() - WHERE ID = %d', + WHERE id = %d', $this->pdo->escapeString($book['title']), $this->pdo->escapeString($book['author']), $this->pdo->escapeString($book['asin']), $this->pdo->escapeString($book['isbn']), $this->pdo->escapeString($book['ean']), $this->pdo->escapeString($book['url']), diff --git a/lib/copy_this/www/lib/Categorize.php b/lib/copy_this/www/lib/Categorize.php index a085c090e..d6bd742a3 100644 --- a/lib/copy_this/www/lib/Categorize.php +++ b/lib/copy_this/www/lib/Categorize.php @@ -33,7 +33,7 @@ class Categorize extends Category public $releaseName; /** - * Group ID of the releasename we are sorting through. + * Group id of the releasename we are sorting through. * @var int|string */ public $groupID; @@ -65,14 +65,14 @@ class Categorize extends Category * Returns Category::CAT_MISC_OTHER if no category is appropriate. * * @param string $releaseName The name to parse. - * @param int|string $groupID The groupID. + * @param int|string $groupID The groupid. * - * @return int The categoryID. + * @return int The categoryid. */ public function determineCategory($groupID, $releaseName = '') { $this->releaseName = $releaseName; - $this->groupID = $groupID; + $this->groupid = $groupID; $this->tmpCat = \Category::CAT_MISC_OTHER; switch (true) { @@ -94,24 +94,24 @@ class Categorize extends Category } /** - * Cache of group names for group ID's. + * Cache of group names for group id's. * @var array */ private $groups = []; /** - * Sets/Gets a group name for the current group ID in the buffer. + * Sets/Gets a group name for the current group id in the buffer. * * @return string Group Name. */ private function groupName() { - if (!isset($this->groups[$this->groupID])) { - $group = $this->pdo->queryOneRow(sprintf('SELECT LOWER(name) AS name FROM groups WHERE id = %d', $this->groupID)); - $this->groups[$this->groupID] = ($group === false ? false : $group['name']); + if (!isset($this->groups[$this->groupid])) { + $group = $this->pdo->queryOneRow(sprintf('SELECT LOWER(name) AS name FROM groups WHERE id = %d', $this->groupid)); + $this->groups[$this->groupid] = ($group === false ? false : $group['name']); } - return $this->groups[$this->groupID]; + return $this->groups[$this->groupid]; } /** diff --git a/lib/copy_this/www/lib/CollectionsCleaning.php b/lib/copy_this/www/lib/CollectionsCleaning.php index f40c87970..3fd08c491 100644 --- a/lib/copy_this/www/lib/CollectionsCleaning.php +++ b/lib/copy_this/www/lib/CollectionsCleaning.php @@ -85,7 +85,7 @@ class CollectionsCleaning } /** - * Cleans a usenet subject returning a string that can be used to "merge" files together, a pretty subject, a categoryID and the name status. + * Cleans a usenet subject returning a string that can be used to "merge" files together, a pretty subject, a categoryid and the name status. * * @param string $subject Subject to parse. * @param string $groupName Group to work in. diff --git a/lib/copy_this/www/lib/Enzebe.php b/lib/copy_this/www/lib/Enzebe.php index 2f40b4538..b927fb5dd 100644 --- a/lib/copy_this/www/lib/Enzebe.php +++ b/lib/copy_this/www/lib/Enzebe.php @@ -29,7 +29,7 @@ class Enzebe private $siteNzbPath; /** - * Group ID when writing NZBs. + * Group id when writing NZBs. * @var int * @access protected */ @@ -104,15 +104,15 @@ class Enzebe */ public function initiateForWrite($groupID) { - $this->groupID = $groupID; + $this->groupid = $groupID; $site = new Sites(); // Set table names if ($this->tablePerGroup === true) { - if ($this->groupID == '') { - exit("$this->groupID is missing\n"); + if ($this->groupid == '') { + exit("$this->groupid is missing\n"); } - $bName = 'binaries_' . $this->groupID; - $pName = 'parts_' . $this->groupID; + $bName = 'binaries_' . $this->groupid; + $pName = 'parts_' . $this->groupid; } else { $bName = 'binaries'; $pName = 'parts'; @@ -121,8 +121,8 @@ class Enzebe $this->_binariesQuery = sprintf( 'SELECT %s.*, UNIX_TIMESTAMP(%s.date) AS udate, groups.name AS groupname FROM %s - INNER JOIN groups ON %s.groupID = groups.ID - WHERE %s.releaseID = ', + INNER JOIN groups ON %s.groupid = groups.id + WHERE %s.releaseid = ', $bName, $bName, $bName, @@ -143,7 +143,7 @@ class Enzebe /** * Write an NZB to the hard drive for a single release. * - * @param int $relID The ID of the release in the DB. + * @param int $relID The id of the release in the DB. * @param string $relGuid The guid of the release. * @param string $name The name of the release. * @param string $cTitle The name of the category this release is in. @@ -181,7 +181,7 @@ class Enzebe // Buffer segment writes, increases performance. $string = ''; - $parts = $this->pdo->queryDirect(sprintf($this->_partsQuery, $bin['ID'])); + $parts = $this->pdo->queryDirect(sprintf($this->_partsQuery, $bin['id'])); if ($parts instanceof \Traversable) { @@ -217,7 +217,7 @@ class Enzebe if (is_file($path)) { $this->pdo->queryExec( sprintf(' - UPDATE releases SET nzbstatus = %d %s WHERE ID = %d', + UPDATE releases SET nzbstatus = %d %s WHERE id = %d', \NZB::NZB_ADDED, ($nzb_guid === '' ? '' : ', nzb_guid = ' . $this->pdo->escapestring(md5($nzb_guid))), $relID diff --git a/lib/copy_this/www/lib/Games.php b/lib/copy_this/www/lib/Games.php index d6cc29a8c..789783fbb 100644 --- a/lib/copy_this/www/lib/Games.php +++ b/lib/copy_this/www/lib/Games.php @@ -15,11 +15,11 @@ require_once(WWW_DIR . "/lib/ColorCLI.php"); class Games { - const REQID_FOUND = 1; // Request ID found and release was updated. - const REQID_NO_LOCAL = -1; // Request ID was not found via local lookup. - const REQID_NONE = -3; // The Request ID was not found locally or via web lookup. + const REQID_FOUND = 1; // Request id found and release was updated. + const REQID_NO_LOCAL = -1; // Request id was not found via local lookup. + const REQID_NONE = -3; // The Request id was not found locally or via web lookup. const REQID_UNPROCESSED = 0; // Release has not been processed. - const REQID_ZERO = -2; // The Request ID was 0. + const REQID_ZERO = -2; // The Request id was 0. /** * @var string @@ -134,7 +134,7 @@ class Games sprintf(" SELECT gamesinfo.*, genres.title AS genres FROM gamesinfo - LEFT OUTER JOIN genres ON genres.ID = gamesinfo.genre_id + LEFT OUTER JOIN genres ON genres.id = gamesinfo.genre_id WHERE gamesinfo.id = %d", $id ) @@ -157,7 +157,7 @@ class Games { return $this->pdo->query( sprintf( - "SELECT gi.*, g.title AS genretitle FROM gamesinfo gi INNER JOIN genres g ON gi.genre_id = g.ID ORDER BY createddate DESC %s", + "SELECT gi.*, g.title AS genretitle FROM gamesinfo gi INNER JOIN genres g ON gi.genre_id = g.id ORDER BY createddate DESC %s", ($start === false ? '' : 'LIMIT ' . $num . ' OFFSET ' . $start) ) ); @@ -189,7 +189,7 @@ class Games $this->getBrowseBy(), $catsrch, ($maxage > 0 ? sprintf(' AND r.postdate > NOW() - INTERVAL %d DAY ', $maxage) : ''), - (count($excludedcats) > 0 ? " AND r.categoryID NOT IN (" . implode(",", $excludedcats) . ")" : '') + (count($excludedcats) > 0 ? " AND r.categoryid NOT IN (" . implode(",", $excludedcats) . ")" : '') ) ); @@ -219,19 +219,19 @@ class Games $exccatlist = ""; if (count($excludedcats) > 0) { - $exccatlist = " AND r.categoryID NOT IN (" . implode(",", $excludedcats) . ")"; + $exccatlist = " AND r.categoryid NOT IN (" . implode(",", $excludedcats) . ")"; } $order = $this->getGamesOrder($orderby); return $this->pdo->query( sprintf( - "SELECT GROUP_CONCAT(r.ID ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_id, " + "SELECT GROUP_CONCAT(r.id ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_id, " . "GROUP_CONCAT(r.rarinnerfilecount ORDER BY r.postdate DESC SEPARATOR ',') as grp_rarinnerfilecount, " . "GROUP_CONCAT(r.haspreview ORDER BY r.postdate DESC SEPARATOR ',') AS grp_haspreview, " . "GROUP_CONCAT(r.passwordstatus ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_password, " . "GROUP_CONCAT(r.guid ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_guid, " - . "GROUP_CONCAT(rn.ID ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_nfoid, " + . "GROUP_CONCAT(rn.id ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_nfoid, " . "GROUP_CONCAT(groups.name ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_grpname, " . "GROUP_CONCAT(r.searchname ORDER BY r.postdate DESC SEPARATOR '#') AS grp_release_name, " . "GROUP_CONCAT(r.postdate ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_postdate, " @@ -240,9 +240,9 @@ class Games . "GROUP_CONCAT(r.comments ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_comments, " . "GROUP_CONCAT(r.grabs ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_grabs, " . "con.*, YEAR (con.releasedate) as year, r.gamesinfo_id, groups.name AS group_name, - rn.ID as nfoid FROM releases r " - . "LEFT OUTER JOIN groups ON groups.ID = r.groupID " - . "LEFT OUTER JOIN releasenfo rn ON rn.releaseid = r.ID " + rn.id as nfoid FROM releases r " + . "LEFT OUTER JOIN groups ON groups.id = r.groupid " + . "LEFT OUTER JOIN releasenfo rn ON rn.releaseid = r.id " . "INNER JOIN gamesinfo con ON con.id = r.gamesinfo_id " . "WHERE r.nzbstatus = 1 AND con.title != '' AND " . "r.passwordstatus <= (SELECT value FROM site WHERE setting='showpasswordedrelease') AND %s %s %s %s " @@ -600,7 +600,7 @@ class Games $defaultGenres = $gen->getGenres(\Genres::GAME_TYPE); $genreassoc = array(); foreach ($defaultGenres as $dg) { - $genreassoc[$dg['ID']] = strtolower($dg['title']); + $genreassoc[$dg['id']] = strtolower($dg['title']); } // Prepare database values. @@ -733,7 +733,7 @@ class Games } /** - * Get Giantbomb ID from title + * Get Giantbomb id from title * * @param string $title * @@ -811,11 +811,11 @@ class Games { $res = $this->pdo->queryDirect( sprintf(' - SELECT searchname, ID + SELECT searchname, id FROM releases WHERE nzbstatus = 1 %s AND gamesinfo_id = 0 - AND categoryID = 4050 + AND categoryid = 4050 ORDER BY postdate DESC LIMIT %d', $this->renamed, @@ -863,10 +863,10 @@ class Games $gameId = $gameCheck['id']; } // Update release. - $this->pdo->queryExec(sprintf('UPDATE releases SET gamesinfo_id = %d WHERE ID = %d', $gameId, $arr['ID'])); + $this->pdo->queryExec(sprintf('UPDATE releases SET gamesinfo_id = %d WHERE id = %d', $gameId, $arr['id'])); } else { // Could not parse release title. - $this->pdo->queryExec(sprintf('UPDATE releases SET gamesinfo_id = %d WHERE ID = %d', -2, $arr['ID'])); + $this->pdo->queryExec(sprintf('UPDATE releases SET gamesinfo_id = %d WHERE id = %d', -2, $arr['id'])); if ($this->echoOutput) { echo '.'; diff --git a/lib/copy_this/www/lib/GiantBombAPI.php b/lib/copy_this/www/lib/GiantBombAPI.php index 96ba3d650..9f01a8876 100644 --- a/lib/copy_this/www/lib/GiantBombAPI.php +++ b/lib/copy_this/www/lib/GiantBombAPI.php @@ -158,7 +158,7 @@ class GiantBomb * Get information about given object type * * @param string $type - * @param string $id string ID to request + * @param string $id string id to request * @param array $field_list array list of fields to response * * @return array response @@ -184,7 +184,7 @@ class GiantBomb * @param $filter array filter by given values - no "," accepted * @param $limit integer limit result count by given limit * @param $offset integer offset of results - * @param $platform integer ID of platform to limit + * @param $platform integer id of platform to limit * @param $sort array list of keys to sort, format key => asc/desc, * @param $field_list array list of field to result * @@ -209,7 +209,7 @@ class GiantBomb /** * Get information about a game * - * @param $id string ID to request + * @param $id string id to request * @param $field_list array list of fields to response * * @return array response @@ -225,7 +225,7 @@ class GiantBomb * @param $filter array filter by given values - no "," accepted * @param $limit integer limit result count by given limit * @param $offset integer offset of results - * @param $platform integer ID of platform to limit + * @param $platform integer id of platform to limit * @param $sort array list of keys to sort, format key => asc/desc, * @param $field_list array list of field to result * @@ -240,7 +240,7 @@ class GiantBomb /** * Get review by id * - * @param $review_id string ID to request + * @param $review_id string id to request * @param $field_list array list of fields to response * * @return array response @@ -253,7 +253,7 @@ class GiantBomb /** * Get game_rating by id * - * @param $rating_id string ID to request + * @param $rating_id string id to request * @param $field_list array list of fields to response * * @return array response @@ -266,7 +266,7 @@ class GiantBomb /** * Get company by id * - * @param $company_id string ID to request + * @param $company_id string id to request * @param $field_list array list of fields to response * * @return array response @@ -279,7 +279,7 @@ class GiantBomb /** * Get character by id * - * @param $character_id string ID to request + * @param $character_id string id to request * @param $field_list array list of fields to response * * @return array response diff --git a/lib/copy_this/www/lib/Logger.php b/lib/copy_this/www/lib/Logger.php index 4ab77eef8..b12fe39ac 100644 --- a/lib/copy_this/www/lib/Logger.php +++ b/lib/copy_this/www/lib/Logger.php @@ -656,7 +656,7 @@ class Logger // Resource usage (user time, system time, major page faults, memory swaps). (($this->showResourceUsage && !$this->isWindows) ? ' [' . $this->getResUsage() . ']' : '') . - // Running process ID. + // Running process id. ($pid ? ' [PID:' . $pid . ']' : '') . // The class/function. diff --git a/lib/copy_this/www/lib/Musik.php b/lib/copy_this/www/lib/Musik.php index a8caedc72..d7afcf52e 100644 --- a/lib/copy_this/www/lib/Musik.php +++ b/lib/copy_this/www/lib/Musik.php @@ -92,7 +92,7 @@ class Musik */ public function getMusicInfo($id) { - return $this->pdo->queryOneRow(sprintf("SELECT musicinfo.*, genres.title AS genres FROM musicinfo LEFT OUTER JOIN genres ON genres.ID = musicinfo.genreID WHERE musicinfo.ID = %d ", $id)); + return $this->pdo->queryOneRow(sprintf("SELECT musicinfo.*, genres.title AS genres FROM musicinfo LEFT OUTER JOIN genres ON genres.id = musicinfo.genreID WHERE musicinfo.id = %d ", $id)); } /** @@ -131,7 +131,7 @@ class Musik public function getCount() { - $res = $this->pdo->queryOneRow("SELECT COUNT(ID) AS num FROM musicinfo"); + $res = $this->pdo->queryOneRow("SELECT COUNT(id) AS num FROM musicinfo"); return $res["num"]; } @@ -161,10 +161,10 @@ class Musik $exccatlist = ""; if (count($excludedcats) > 0) { - $exccatlist = " AND r.categoryID NOT IN (" . implode(",", $excludedcats) . ")"; + $exccatlist = " AND r.categoryid NOT IN (" . implode(",", $excludedcats) . ")"; } - $sql = sprintf("SELECT COUNT(DISTINCT r.musicinfoID) AS num FROM releases r INNER JOIN musicinfo m ON m.ID = r.musicinfoID AND m.title != '' AND m.cover = 1 WHERE nzbstatus = 1 AND r.passwordstatus <= (SELECT value FROM site WHERE setting='showpasswordedrelease') AND %s %s %s %s", $browseby, $catsrch, $maxage, $exccatlist); + $sql = sprintf("SELECT COUNT(DISTINCT r.musicinfoid) AS num FROM releases r INNER JOIN musicinfo m ON m.id = r.musicinfoid AND m.title != '' AND m.cover = 1 WHERE nzbstatus = 1 AND r.passwordstatus <= (SELECT value FROM site WHERE setting='showpasswordedrelease') AND %s %s %s %s", $browseby, $catsrch, $maxage, $exccatlist); $res = $this->pdo->queryOneRow($sql); return $res["num"]; } @@ -197,16 +197,16 @@ class Musik $exccatlist = ""; if (count($excludedcats) > 0) { - $exccatlist = " AND r.categoryID NOT IN (" . implode(",", $excludedcats) . ")"; + $exccatlist = " AND r.categoryid NOT IN (" . implode(",", $excludedcats) . ")"; } $order = $this->getMusicOrder($orderby); - return $this->pdo->query(sprintf("SELECT GROUP_CONCAT(r.ID ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_id, " + return $this->pdo->query(sprintf("SELECT GROUP_CONCAT(r.id ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_id, " . "GROUP_CONCAT(r.rarinnerfilecount ORDER BY r.postdate DESC SEPARATOR ',') as grp_rarinnerfilecount, " . "GROUP_CONCAT(r.haspreview ORDER BY r.postdate DESC SEPARATOR ',') AS grp_haspreview, " . "GROUP_CONCAT(r.passwordstatus ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_password, " . "GROUP_CONCAT(r.guid ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_guid, " - . "GROUP_CONCAT(rn.ID ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_nfoid, " + . "GROUP_CONCAT(rn.id ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_nfoid, " . "GROUP_CONCAT(groups.name ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_grpname, " . "GROUP_CONCAT(r.searchname ORDER BY r.postdate DESC SEPARATOR '#') AS grp_release_name, " . "GROUP_CONCAT(r.postdate ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_postdate, " @@ -214,13 +214,13 @@ class Musik . "GROUP_CONCAT(r.totalpart ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_totalparts, " . "GROUP_CONCAT(r.comments ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_comments, " . "GROUP_CONCAT(r.grabs ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_grabs, " - . "m.*, r.musicinfoID, groups.name AS group_name, rn.ID as nfoid FROM releases r " - . "LEFT OUTER JOIN groups ON groups.ID = r.groupID " - . "LEFT OUTER JOIN releasenfo rn ON rn.releaseID = r.ID " - . "INNER JOIN musicinfo m ON m.ID = r.musicinfoID " + . "m.*, r.musicinfoid, groups.name AS group_name, rn.id as nfoid FROM releases r " + . "LEFT OUTER JOIN groups ON groups.id = r.groupid " + . "LEFT OUTER JOIN releasenfo rn ON rn.releaseid = r.id " + . "INNER JOIN musicinfo m ON m.id = r.musicinfoid " . "WHERE r.nzbstatus = 1 AND m.title != '' AND " . "r.passwordstatus <= (SELECT value FROM site WHERE setting='showpasswordedrelease') AND %s %s %s " - . "GROUP BY m.ID ORDER BY %s %s" . $limit, $browseby, $catsrch, $exccatlist, $order[0], $order[1])); + . "GROUP BY m.id ORDER BY %s %s" . $limit, $browseby, $catsrch, $exccatlist, $order[0], $order[1])); } /** @@ -338,7 +338,7 @@ class Musik UPDATE musicinfo SET title = %s, asin = %s, url = %s, salesrank = %s, artist = %s, publisher = %s, releasedate = %s, year = %s, tracks = %s, cover = %d, genreID = %d, updateddate = NOW() - WHERE ID = %d", + WHERE id = %d", $this->pdo->escapeString($title), $this->pdo->escapeString($asin), $this->pdo->escapeString($url), $salesrank, $this->pdo->escapeString($artist), $this->pdo->escapeString($publisher), $this->pdo->escapeString($releasedate), @@ -386,7 +386,7 @@ class Musik $defaultGenres = $gen->getGenres(\Genres::MUSIC_TYPE); $genreassoc = array(); foreach ($defaultGenres as $dg) { - $genreassoc[$dg['ID']] = strtolower($dg['title']); + $genreassoc[$dg['id']] = strtolower($dg['title']); } // Get album properties. @@ -489,7 +489,7 @@ class Musik $musicId = $check['id']; $this->pdo->queryExec(sprintf('UPDATE musicinfo SET title = %s, asin = %s, url = %s, salesrank = %s, artist = %s, ' . 'publisher = %s, releasedate = %s, review = %s, year = %s, genreID = %s, tracks = %s, cover = %s, ' - . 'updateddate = NOW() WHERE ID = %d', $this->pdo->escapeString($mus['title']), $this->pdo->escapeString($mus['asin']), $this->pdo->escapeString($mus['url']), $mus['salesrank'], $this->pdo->escapeString($mus['artist']), $this->pdo->escapeString($mus['publisher']), $mus['releasedate'], $this->pdo->escapeString($mus['review']), $this->pdo->escapeString($mus['year']), ($mus['musicgenreid'] == -1 ? "null" : $mus['musicgenreid']), $this->pdo->escapeString($mus['tracks']), $mus['cover'], $musicId)); + . 'updateddate = NOW() WHERE id = %d', $this->pdo->escapeString($mus['title']), $this->pdo->escapeString($mus['asin']), $this->pdo->escapeString($mus['url']), $mus['salesrank'], $this->pdo->escapeString($mus['artist']), $this->pdo->escapeString($mus['publisher']), $mus['releasedate'], $this->pdo->escapeString($mus['review']), $this->pdo->escapeString($mus['year']), ($mus['musicgenreid'] == -1 ? "null" : $mus['musicgenreid']), $this->pdo->escapeString($mus['tracks']), $mus['cover'], $musicId)); } if ($musicId) { @@ -582,8 +582,8 @@ class Musik */ public function processMusicReleases($local = false) { - $res = $this->pdo->queryDirect(sprintf('SELECT searchname, ID FROM releases ' - . 'WHERE musicinfoID IS NULL AND nzbstatus = 1 %s AND categoryID IN (3010, 3040, 3050) ' + $res = $this->pdo->queryDirect(sprintf('SELECT searchname, id FROM releases ' + . 'WHERE musicinfoid IS NULL AND nzbstatus = 1 %s AND categoryid IN (3010, 3040, 3050) ' . 'ORDER BY postdate DESC LIMIT %d', $this->renamed, $this->musicqty)); if ($res instanceof \Traversable && $res->rowCount() > 0) { if ($this->echooutput) { @@ -614,14 +614,14 @@ class Musik $albumId = -2; } } else { - $albumId = $musicCheck['ID']; + $albumId = $musicCheck['id']; } // Update release. - $this->pdo->queryExec(sprintf("UPDATE releases SET musicinfoID = %d WHERE ID = %d", $albumId, $arr["ID"])); + $this->pdo->queryExec(sprintf("UPDATE releases SET musicinfoid = %d WHERE id = %d", $albumId, $arr["id"])); } // No album found. else { - $this->pdo->queryExec(sprintf("UPDATE releases SET musicinfoID = %d WHERE ID = %d", -2, $arr["ID"])); + $this->pdo->queryExec(sprintf("UPDATE releases SET musicinfoid = %d WHERE id = %d", -2, $arr["id"])); echo '.'; } @@ -683,7 +683,7 @@ class Musik public function getGenres($activeOnly = false) { if ($activeOnly) { - return $this->pdo->query("SELECT musicgenre.* FROM musicgenre INNER JOIN (SELECT DISTINCT musicgenreid FROM musicinfo) x ON x.musicgenreID = musicgenre.ID ORDER BY title"); + return $this->pdo->query("SELECT musicgenre.* FROM musicgenre INNER JOIN (SELECT DISTINCT musicgenreid FROM musicinfo) x ON x.musicgenreID = musicgenre.id ORDER BY title"); } else { return $this->pdo->query("SELECT * FROM musicgenre ORDER BY title"); } diff --git a/lib/copy_this/www/lib/NZBImport.php b/lib/copy_this/www/lib/NZBImport.php index fa637ebb3..15e8cfcc8 100644 --- a/lib/copy_this/www/lib/NZBImport.php +++ b/lib/copy_this/www/lib/NZBImport.php @@ -284,14 +284,14 @@ class NZBImport } // Make a fake message array to use to check the blacklist. - $msg = array("Subject" => (string) $file->attributes()->subject, "From" => (string) $file->attributes()->poster, "Message-ID" => ""); + $msg = array("Subject" => (string) $file->attributes()->subject, "From" => (string) $file->attributes()->poster, "Message-id" => ""); - // Get the group names, groupID, check if it's blacklisted. + // Get the group names, groupid, check if it's blacklisted. $groupArr = array(); foreach ($file->groups->group as $group) { $group = (string) $group; - // If groupID is -1 try to get a groupID. + // If groupid is -1 try to get a groupid. if ($groupID === -1) { if (array_key_exists($group, $this->allGroups)) { $groupID = $this->allGroups[$group]; @@ -339,7 +339,7 @@ class NZBImport 'useFName' => $useNzbName, 'postDate' => (empty($postDate) ? date("Y-m-d H:i:s") : $postDate), 'from' => (empty($posterName) ? '' : $posterName), - 'groupID' => $groupID, + 'groupid' => $groupID, 'groupName' => $groupName, 'totalFiles' => $totalFiles, 'totalSize' => $totalSize @@ -386,7 +386,7 @@ class NZBImport // Look for a duplicate on name, poster and size. $dupeCheck = $this->pdo->queryOneRow( sprintf( - 'SELECT ID FROM releases WHERE name = %s AND fromname = %s AND size BETWEEN %s AND %s', + 'SELECT id FROM releases WHERE name = %s AND fromname = %s AND size BETWEEN %s AND %s', $escapedSubject, $escapedFromName, $this->pdo->escapeString($nzbDetails['totalSize'] * 0.99), @@ -402,18 +402,18 @@ class NZBImport 'name' => $escapedSubject, 'searchname' => $escapedSearchName, 'totalpart' => $nzbDetails['totalFiles'], - 'groupID' => $nzbDetails['groupID'], + 'groupid' => $nzbDetails['groupid'], 'guid' => $this->pdo->escapeString($this->relGuid), - 'regexID' => NULL, + 'regexid' => NULL, 'postdate' => $this->pdo->escapeString($nzbDetails['postDate']), 'fromname' => $escapedFromName, - 'reqID' => NULL, + 'reqid' => NULL, 'passwordstatus' => ($this->site->checkpasswordedrar > 0 ? -1 : 0), 'size' => $this->pdo->escapeString($nzbDetails['totalSize']), - 'categoryID' => $this->category->determineCategory($nzbDetails['groupID'], $cleanName), + 'categoryid' => $this->category->determineCategory($nzbDetails['groupid'], $cleanName), 'isrenamed' => $renamed, 'reqidstatus' => 0, - 'prehashID' => 0, + 'prehashid' => 0, 'nzbstatus' => \NZB::NZB_ADDED ] ); @@ -437,9 +437,9 @@ class NZBImport protected function getAllGroups() { $this->allGroups = []; - $groups = $this->pdo->query("SELECT ID, name FROM groups"); + $groups = $this->pdo->query("SELECT id, name FROM groups"); foreach ($groups as $group) { - $this->allGroups[$group["name"]] = $group["ID"]; + $this->allGroups[$group["name"]] = $group["id"]; } if (count($this->allGroups) === 0) { diff --git a/lib/copy_this/www/lib/Net_NNTP/NNTP/Client.php b/lib/copy_this/www/lib/Net_NNTP/NNTP/Client.php index 09977752f..882b8ae0f 100644 --- a/lib/copy_this/www/lib/Net_NNTP/NNTP/Client.php +++ b/lib/copy_this/www/lib/Net_NNTP/NNTP/Client.php @@ -295,7 +295,7 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client switch ($_ret) { case -1: - return array('Number' => (int)$response[0], 'Message-ID' => (string)$response[1]); + return array('Number' => (int)$response[0], 'Message-id' => (string)$response[1]); case 0: return (int)$response[0]; case 1: @@ -335,7 +335,7 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client switch ($_ret) { case -1: - return array('Number' => (int)$response[0], 'Message-ID' => (string)$response[1]); + return array('Number' => (int)$response[0], 'Message-id' => (string)$response[1]); case 0: return (int)$response[0]; case 1: @@ -372,7 +372,7 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client switch ($_ret) { case -1: - return array('Number' => (int)$response[0], 'Message-ID' => (string)$response[1]); + return array('Number' => (int)$response[0], 'Message-id' => (string)$response[1]); break; case 0: return (int)$response[0]; @@ -868,7 +868,7 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client * - 'Subject' - header content. * - 'From' - header content. * - 'Date' - header content. - * - 'Message-ID' - header content. + * - 'Message-id' - header content. * - 'References' - header content. * - ':bytes' - metadata item. * - ':lines' - metadata item. @@ -924,8 +924,8 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client // Rename 'Number' field into 'number' $article = array_merge(array('number' => array_shift($article)), $article); - // Use 'Message-ID' field as key - $articles[$article['Message-ID']] = $article; + // Use 'Message-id' field as key + $articles[$article['Message-id']] = $article; } return $articles; } @@ -1039,7 +1039,7 @@ class Net_NNTP_Client extends Net_NNTP_Protocol_Client 'Subject' => false, 'From' => false, 'Date' => false, - 'Message-ID' => false, + 'Message-id' => false, 'References' => false, ':bytes' => false, ':lines' => false diff --git a/lib/copy_this/www/lib/Net_NNTP/NNTP/Protocol/Client.php b/lib/copy_this/www/lib/Net_NNTP/NNTP/Protocol/Client.php index 9f360dd70..7d165514e 100644 --- a/lib/copy_this/www/lib/Net_NNTP/NNTP/Protocol/Client.php +++ b/lib/copy_this/www/lib/Net_NNTP/NNTP/Protocol/Client.php @@ -1120,7 +1120,7 @@ class Net_NNTP_Protocol_Client extends PEAR /** * Tell the news server we want to upload an article, the server will check if it has the message-id first. * - * @param string $id Message-ID. + * @param string $id Message-id. * * @return mixed (bool) true on success * (object) pear_error on failure diff --git a/lib/copy_this/www/lib/Regexes.php b/lib/copy_this/www/lib/Regexes.php index b71a146e4..6161915bf 100644 --- a/lib/copy_this/www/lib/Regexes.php +++ b/lib/copy_this/www/lib/Regexes.php @@ -355,7 +355,7 @@ Class Regexes $returnString .= $value; // Concatenate the string to return. break; case 'category_regexes': - $returnString = $this->_categoryID; // Regex matched, so return the category ID. + $returnString = $this->_categoryID; // Regex matched, so return the category id. break 2; } } diff --git a/lib/copy_this/www/lib/ReleaseCleaning.php b/lib/copy_this/www/lib/ReleaseCleaning.php index 7554762c7..747dea689 100644 --- a/lib/copy_this/www/lib/ReleaseCleaning.php +++ b/lib/copy_this/www/lib/ReleaseCleaning.php @@ -105,7 +105,7 @@ class ReleaseCleaning $matches)) { foreach ($matches as $match) { foreach ($match as $val) { - $title = $this->pdo->queryOneRow("SELECT title, ID from prehash WHERE title = " . + $title = $this->pdo->queryOneRow("SELECT title, id from prehash WHERE title = " . $this->pdo->escapeString(trim($val))); // don't match against ab.teevee if title is for just the season if ($this->groupName == 'alt.binaries.teevee' and preg_match('/\.S\d\d\./', $title['title'], $match)) { @@ -116,14 +116,14 @@ class ReleaseCleaning "cleansubject" => $title['title'], "properlynamed" => true, "increment" => false, - "predb" => $title['ID'], - "requestID" => false + "predb" => $title['id'], + "requestid" => false ); } } } } - // Get pre style name from requestID + // Get pre style name from requestid if (preg_match('/^\[ ?(\d{4,6}) ?\]/', $this->subject, $match) || preg_match('/^REQ\s*(\d{4,6})/i', $this->subject, $match) || preg_match('/^(\d{4,6})-\d{1}\[/', $this->subject, $match) || @@ -131,7 +131,7 @@ class ReleaseCleaning ) { $title = $this->pdo->queryOneRow( sprintf( - 'SELECT p.title , p.ID from prehash p INNER JOIN groups g on g.ID = p.groupID WHERE p.requestID = %d and g.name = %s', + 'SELECT p.title , p.id from prehash p INNER JOIN groups g on g.id = p.groupid WHERE p.requestid = %d and g.name = %s', $match[1], $this->pdo->escapeString($this->groupName) ) @@ -161,8 +161,8 @@ class ReleaseCleaning if ($title === false && !empty($reqGname)) { $title = $this->pdo->queryOneRow( sprintf( - "SELECT p.title as title, p.ID as ID from prehash p INNER JOIN groups g on g.ID = p.groupID - WHERE p.requestID = %d and g.name = %s", + "SELECT p.title as title, p.id as id from prehash p INNER JOIN groups g on g.id = p.groupid + WHERE p.requestid = %d and g.name = %s", $match[1], $this->pdo->escapeString($reqGname) ) @@ -177,8 +177,8 @@ class ReleaseCleaning "cleansubject" => $title['title'], "properlynamed" => true, "increment" => false, - "predb" => $title['ID'], - "requestID" => true + "predb" => $title['id'], + "requestid" => true ); } } diff --git a/lib/copy_this/www/lib/ReleaseSearch.php b/lib/copy_this/www/lib/ReleaseSearch.php index 860780472..2a79cf7cf 100644 --- a/lib/copy_this/www/lib/ReleaseSearch.php +++ b/lib/copy_this/www/lib/ReleaseSearch.php @@ -33,11 +33,11 @@ class ReleaseSearch $this->fullTextJoinString = ''; break; case self::SPHINX: - $this->fullTextJoinString = 'INNER JOIN releases_se rse ON rse.id = r.ID'; + $this->fullTextJoinString = 'INNER JOIN releases_se rse ON rse.id = r.id'; break; case self::FULLTEXT: default: - $this->fullTextJoinString = 'INNER JOIN releasesearch rs on rs.releaseID = r.ID'; + $this->fullTextJoinString = 'INNER JOIN releasesearch rs on rs.releaseid = r.id'; break; } diff --git a/lib/copy_this/www/lib/RequestID.php b/lib/copy_this/www/lib/RequestID.php index fe9ad9bc9..2ae04a8c0 100644 --- a/lib/copy_this/www/lib/RequestID.php +++ b/lib/copy_this/www/lib/RequestID.php @@ -7,13 +7,13 @@ require_once (NN_LIB . 'SphinxSearch.php'); abstract class RequestID { - // Request ID. + // Request id. const REQID_OLD = -4; // We rechecked the web a second time and didn't find a title so don't process it again. - const REQID_NONE = -3; // The Request ID was not found locally or via web lookup. - const REQID_ZERO = -2; // The Request ID was 0. - const REQID_NOLL = -1; // Request ID was not found via local lookup. + const REQID_NONE = -3; // The Request id was not found locally or via web lookup. + const REQID_ZERO = -2; // The Request id was 0. + const REQID_NOLL = -1; // Request id was not found via local lookup. const REQID_UPROC = 0; // Release has not been processed. - const REQID_FOUND = 1; // Request ID found and release was updated. + const REQID_FOUND = 1; // Request id found and release was updated. /** * @var Groups @@ -44,11 +44,11 @@ abstract class RequestID } /** - * Look up request ID's for releases. + * Look up request id's for releases. * * @param array $options * - * @return int Quantity of releases matched to a request ID. + * @return int Quantity of releases matched to a request id. */ public function lookupRequestIDs(array $options = array()) { @@ -89,19 +89,19 @@ abstract class RequestID } /** - * Fetch releases with requestID's from MySQL. + * Fetch releases with requestid's from MySQL. */ protected function _getReleases() { } /** - * Process releases for requestID's. + * Process releases for requestid's. * * @return int How many did we rename? */ protected function _processReleases() { } /** - * No request ID was found, update the release. + * No request id was found, update the release. * * @param int $releaseID * @param int $status @@ -114,14 +114,14 @@ abstract class RequestID $this->pdo->queryExec( sprintf(' - UPDATE releases SET reqidstatus = %d WHERE ID = %d', + UPDATE releases SET reqidstatus = %d WHERE id = %d', $status, $releaseID ) ); } /** - * Get a new title / pre ID for a release. + * Get a new title / pre id for a release. * * @return array|bool */ @@ -174,19 +174,19 @@ abstract class RequestID protected $colorCLI; /** - * The found request ID for the release. + * The found request id for the release. * @var int */ protected $_requestID = self::REQID_ZERO; /** - * The title found from a request ID lookup. + * The title found from a request id lookup. * @var bool|string|array */ protected $_newTitle = false; /** - * Releases with potential Request ID's we can work on. + * Releases with potential Request id's we can work on. * @var \PDOStatement|bool */ protected $_releases; diff --git a/lib/copy_this/www/lib/RequestIDLocal.php b/lib/copy_this/www/lib/RequestIDLocal.php index c79f825c8..5f3abe373 100644 --- a/lib/copy_this/www/lib/RequestIDLocal.php +++ b/lib/copy_this/www/lib/RequestIDLocal.php @@ -2,7 +2,7 @@ require_once (NN_LIB . 'RequestID.php'); /** - * Attempts to find a PRE name for a release using a request ID from our local pre database, + * Attempts to find a PRE name for a release using a request id from our local pre database, * or internet request id database using a Standalone -- more intensive methods * * Class RequestIDLocal @@ -18,21 +18,21 @@ class RequestIDLocal extends RequestID } /** - * Fetch releases with requestID's from MySQL. + * Fetch releases with requestid's from MySQL. */ protected function _getReleases() { $query = ( - 'SELECT r.ID, r.name, r.categoryID, r.reqidstatus, g.name AS groupname, g.ID as gid + 'SELECT r.id, r.name, r.categoryid, r.reqidstatus, g.name AS groupname, g.id as gid FROM releases r - INNER JOIN groups g ON r.groupID = g.ID + INNER JOIN groups g ON r.groupid = g.id WHERE r.nzbstatus = 1 - AND r.prehashID = 0 + AND r.prehashid = 0 AND r.isrequestID = 1' ); $query .= ($this->_charGUID === '' ? '' : ' AND r.guid ' . $this->pdo->likeString($this->_charGUID, false, true)); - $query .= ($this->_groupID === '' ? '' : ' AND r.groupID = ' . $this->_groupID); + $query .= ($this->_groupID === '' ? '' : ' AND r.groupid = ' . $this->_groupID); $query .= ($this->_maxTime === 0 ? '' : sprintf(' AND r.adddate > NOW() - INTERVAL %d HOUR', $this->_maxTime)); switch ($this->_limit) { @@ -61,7 +61,7 @@ class RequestIDLocal extends RequestID } /** - * Process releases for requestID's. + * Process releases for requestid's. * * @return int How many did we rename? */ @@ -79,7 +79,7 @@ class RequestIDLocal extends RequestID $this->_updateRelease(); $renamed++; } else { - $this->_requestIdNotFound($this->_release['ID'], ($this->_release['reqidstatus'] == self::REQID_UPROC ? self::REQID_NOLL : self::REQID_NONE)); + $this->_requestIdNotFound($this->_release['id'], ($this->_release['reqidstatus'] == self::REQID_UPROC ? self::REQID_NOLL : self::REQID_NONE)); } if ($this->echoOutput && $this->_show === 0) { @@ -96,7 +96,7 @@ class RequestIDLocal extends RequestID } /** - * Get a new title / pre ID for a release. + * Get a new title / pre id for a release. * * @return array|bool */ @@ -108,7 +108,7 @@ class RequestIDLocal extends RequestID $check = $this->pdo->queryDirect( sprintf( - 'SELECT ID, title FROM prehash WHERE requestID = %d AND groupID = %d', + 'SELECT id, title FROM prehash WHERE requestid = %d AND groupid = %d', $this->_requestID, $this->_release['gid'] ) @@ -120,7 +120,7 @@ class RequestIDLocal extends RequestID if (preg_match('/s\d+/i', $row['title']) && !preg_match('/s\d+e\d+/i', $row['title'])) { return false; } - return array('title' => $row['title'], 'id' => $row['ID']); + return array('title' => $row['title'], 'id' => $row['id']); } } else { //Prevents multiple releases with the same request id/group from being renamed to the same Pre. @@ -128,7 +128,7 @@ class RequestIDLocal extends RequestID } } else { $result = $this->_singleAltLookup(); - if (is_array($result) && is_numeric($result['ID']) && $result['title'] !== '') { + if (is_array($result) && is_numeric($result['id']) && $result['title'] !== '') { return $result; } else { return $this->_multiLookup(); @@ -165,7 +165,7 @@ class RequestIDLocal extends RequestID case preg_match($regex2, $this->_release['name'], $matches): $check = $this->pdo->queryOneRow( sprintf( - "SELECT ID, title FROM prehash WHERE title = %s OR filename = %s %s", + "SELECT id, title FROM prehash WHERE title = %s OR filename = %s %s", $this->pdo->escapeString($matches['title']), $this->pdo->escapeString($matches['title']), ( @@ -181,7 +181,7 @@ class RequestIDLocal extends RequestID ) ); if ($check !== false) { - return array('title' => $check['title'], 'id' => $check['ID']); + return array('title' => $check['title'], 'id' => $check['id']); } continue; default: @@ -193,7 +193,7 @@ class RequestIDLocal extends RequestID private $groupIDCache = array(); /** - * Attempts to remap the release groupID by extracting the new group name from the release usenet name. + * Attempts to remap the release groupid by extracting the new group name from the release usenet name. * * @return array|bool */ @@ -237,55 +237,55 @@ class RequestIDLocal extends RequestID } $check = $this->pdo->queryOneRow( sprintf(" - SELECT ID, title FROM prehash WHERE requestID = %d AND groupID = %d", + SELECT id, title FROM prehash WHERE requestid = %d AND groupid = %d", $this->_requestID, ($groupID === '' ? 0 : $groupID) ) ); if ($check !== false) { - return array('title' => $check['title'], 'id' => $check['ID']); + return array('title' => $check['title'], 'id' => $check['id']); } return false; } /** - * Updates release information when a proper Request ID match is found. + * Updates release information when a proper Request id match is found. */ protected function _updateRelease() { $determinedCat = $this->category->determineCategory($this->_release['gid'], $this->_newTitle['title']); - if ($determinedCat == $this->_release['categoryID']) { + if ($determinedCat == $this->_release['categoryid']) { $newTitle = $this->pdo->escapeString($this->_newTitle['title']); $this->pdo->queryExec( sprintf(' UPDATE releases - SET prehashID = %d, reqidstatus = %d, isrenamed = 1, iscategorized = 1, searchname = %s - WHERE ID = %d', + SET prehashid = %d, reqidstatus = %d, isrenamed = 1, iscategorized = 1, searchname = %s + WHERE id = %d', $this->_newTitle['id'], self::REQID_FOUND, $newTitle, - $this->_release['ID'] + $this->_release['id'] ) ); - $this->sphinx->updateReleaseSearchName($this->_release['ID'], $newTitle); + $this->sphinx->updateReleaseSearchName($this->_release['id'], $newTitle); } else { $newTitle = $this->pdo->escapeString($this->_newTitle['title']); $this->pdo->queryExec( sprintf(' UPDATE releases SET - rageID = -1, seriesfull = NULL, season = NULL, episode = NULL, tvtitle = NULL, - tvairdate = NULL, imdbID = NULL, musicinfoID = NULL, consoleinfoID = NULL, - bookinfoID = NULL, anidbid = NULL, prehashID = %d, reqidstatus = %d, isrenamed = 1, - iscategorized = 1, searchname = %s, categoryID = %d - WHERE ID = %d', + rageid = -1, seriesfull = NULL, season = NULL, episode = NULL, tvtitle = NULL, + tvairdate = NULL, imdbid = NULL, musicinfoid = NULL, consoleinfoid = NULL, + bookinfoid = NULL, anidbid = NULL, prehashid = %d, reqidstatus = %d, isrenamed = 1, + iscategorized = 1, searchname = %s, categoryid = %d + WHERE id = %d', $this->_newTitle['id'], self::REQID_FOUND, $newTitle, $determinedCat, - $this->_release['ID'] + $this->_release['id'] ) ); - $this->sphinx->updateReleaseSearchName($this->_release['ID'], $newTitle); + $this->sphinx->updateReleaseSearchName($this->_release['id'], $newTitle); } if ($this->_release['name'] !== $this->_newTitle['title'] && $this->_show == 1) { @@ -294,9 +294,9 @@ class RequestIDLocal extends RequestID 'new_name' => $this->_newTitle['title'], 'old_name' => $this->_release['name'], 'new_category' => $this->category->getNameByID($determinedCat), - 'old_category' => $this->category->getNameByID($this->_release['categoryID']), + 'old_category' => $this->category->getNameByID($this->_release['categoryid']), 'group' => $this->_release['groupname'], - 'release_id' => $this->_release['ID'], + 'release_id' => $this->_release['id'], 'method' => 'RequestIDLocal' ) ); diff --git a/lib/copy_this/www/lib/RequestIDWeb.php b/lib/copy_this/www/lib/RequestIDWeb.php index 3b09ce496..356440e67 100644 --- a/lib/copy_this/www/lib/RequestIDWeb.php +++ b/lib/copy_this/www/lib/RequestIDWeb.php @@ -4,17 +4,17 @@ require_once (NN_LIB . 'util.php'); require_once (NN_LIB . 'RequestID.php'); /** - * Attempts to find a PRE name for a release using a request ID from our local pre database, + * Attempts to find a PRE name for a release using a request id from our local pre database, * or internet request id database. * * Class RequestIDWeb */ class RequestIDWeb extends RequestID { - const MAX_WEB_LOOKUPS = 100; // Please don't exceed this, not to be to harsh on the Request ID server. + const MAX_WEB_LOOKUPS = 100; // Please don't exceed this, not to be to harsh on the Request id server. /** - * The ID of the PRE entry the found request ID belongs to. + * The id of the PRE entry the found request id belongs to. * @var bool|int */ protected $_preDbID = false; @@ -38,17 +38,17 @@ class RequestIDWeb extends RequestID } /** - * Get all results from the releases table that have request ID's to be processed. + * Get all results from the releases table that have request id's to be processed. */ protected function _getReleases() { $this->_releases = $this->pdo->queryDirect( sprintf (' - SELECT r.ID, r.name, r.searchname, g.name AS groupname, r.groupID, r.categoryID + SELECT r.id, r.name, r.searchname, g.name AS groupname, r.groupid, r.categoryid FROM releases r - INNER JOIN groups g ON r.groupID = g.ID + INNER JOIN groups g ON r.groupid = g.id WHERE r.nzbstatus = 1 - AND r.prehashID = 0 + AND r.prehashid = 0 AND r.isrequestID = 1 AND ( r.reqidstatus = %d @@ -60,7 +60,7 @@ class RequestIDWeb extends RequestID self::REQID_NOLL, self::REQID_NONE, $this->_request_hours, - (empty($this->_groupID) ? '' : ('AND r.groupID = ' . $this->_groupID)), + (empty($this->_groupID) ? '' : ('AND r.groupid = ' . $this->_groupID)), $this->_getReqIdGroups(), ($this->_maxTime === '' ? '' : sprintf(' AND r.adddate > NOW() - INTERVAL %d HOUR', $this->_maxTime)), $this->_limit @@ -69,8 +69,8 @@ class RequestIDWeb extends RequestID } /** - * Create "AND" part of query for request ID groups. - * Less load on the request ID web server, by limiting results. + * Create "AND" part of query for request id groups. + * Less load on the request id web server, by limiting results. * * @return string */ @@ -102,7 +102,7 @@ class RequestIDWeb extends RequestID } /** - * Process releases for requestID's. + * Process releases for requestid's. * * @return int How many did we rename? */ @@ -116,12 +116,12 @@ class RequestIDWeb extends RequestID foreach($this->_releases as $release) { $this->_release['name'] = $release['name']; - // Try to find a request ID for the release. + // Try to find a request id for the release. $requestId = $this->_siftReqId(); // If there's none, update the release and continue. if ($requestId === self::REQID_ZERO) { - $this->_requestIdNotFound($release['ID'], self::REQID_NONE); + $this->_requestIdNotFound($release['id'], self::REQID_NONE); if ($this->echoOutput) { echo '-'; } @@ -133,10 +133,10 @@ class RequestIDWeb extends RequestID $release['groupname'] = 'alt.binaries.teevee'; } - // Send the release ID so we can track the return data. - $requestArray[$release['ID']] = array( + // Send the release id so we can track the return data. + $requestArray[$release['id']] = array( 'reqid' => $requestId, - 'ident' => $release['ID'], + 'ident' => $release['id'], 'group' => $release['groupname'], 'sname' => $release['searchname'] ); @@ -174,24 +174,24 @@ class RequestIDWeb extends RequestID if (isset($result['name']) && isset($result['ident']) && (int)$result['ident'] > 0) { $this->_newTitle['title'] = (string)$result['name']; $this->_requestID = (int)$result['reqid']; - $this->_release['ID'] = (int)$result['ident']; + $this->_release['id'] = (int)$result['ident']; - // Buffer groupID queries. + // Buffer groupid queries. $this->_release['groupname'] = $requestArray[(int)$result['ident']]['group']; if (isset($groupIDarray[$this->_release['groupname']])) { - $this->_release['groupID'] = $groupIDArray[$this->_release['groupname']]; + $this->_release['groupid'] = $groupIDArray[$this->_release['groupname']]; } else { - $this->_release['groupID'] = $this->groups->getIDByName($this->_release['groupname']); - $groupIDArray[$this->_release['groupname']] = $this->_release['groupID']; + $this->_release['groupid'] = $this->groups->getIDByName($this->_release['groupname']); + $groupIDArray[$this->_release['groupname']] = $this->_release['groupid']; } - $this->_release['gid'] = $this->_release['groupID']; + $this->_release['gid'] = $this->_release['groupid']; $this->_release['searchname'] = $requestArray[(int)$result['ident']]['sname']; $this->_insertIntoPreDB(); if ($this->_preDbID === false) { $this->_preDbID = 0; } - $this->_newTitle['ID'] = $this->_preDbID; + $this->_newTitle['id'] = $this->_preDbID; $this->_updateRelease(); $renamed++; if ($this->echoOutput) { @@ -215,7 +215,7 @@ class RequestIDWeb extends RequestID $addDate = $this->pdo->queryOneRow( sprintf( - 'SELECT UNIX_TIMESTAMP(adddate) AS adddate FROM releases WHERE ID = %d', $request['ident'] + 'SELECT UNIX_TIMESTAMP(adddate) AS adddate FROM releases WHERE id = %d', $request['ident'] ) ); @@ -242,13 +242,13 @@ class RequestIDWeb extends RequestID } /** - * If we found a request ID on the internet, check if our PRE database has it, insert it if not. + * If we found a request id on the internet, check if our PRE database has it, insert it if not. */ protected function _insertIntoPreDB() { $dupeCheck = $this->pdo->queryOneRow( sprintf(' - SELECT ID AS prehashID, requestID, groupID + SELECT id AS prehashid, requestid, groupid FROM prehash WHERE title = %s', $this->pdo->escapeString($this->_newTitle['title']) @@ -258,23 +258,23 @@ class RequestIDWeb extends RequestID if ($dupeCheck === false) { $this->_preDbID = (int)$this->pdo->queryInsert( sprintf(" - INSERT INTO prehash (title, source, requestID, groupID, predate) + INSERT INTO prehash (title, source, requestid, groupid, predate) VALUES (%s, %s, %d, %d, NOW())", $this->pdo->escapeString($this->_newTitle['title']), $this->pdo->escapeString('requestWEB'), $this->_requestID, - $this->_release['groupID'] + $this->_release['groupid'] ) ); } else { - $this->_preDbID = $dupeCheck['prehashID']; + $this->_preDbID = $dupeCheck['prehashid']; $this->pdo->queryExec( sprintf(' UPDATE prehash - SET requestID = %d, groupID = %d - WHERE ID = %d', + SET requestid = %d, groupid = %d + WHERE id = %d', $this->_requestID, - $this->_release['groupID'], + $this->_release['groupid'], $this->_preDbID ) ); @@ -286,24 +286,24 @@ class RequestIDWeb extends RequestID */ protected function _updateRelease() { - $determinedCategory = $this->category->determineCategory($this->_release['groupID'], $this->_newTitle['title']); + $determinedCategory = $this->category->determineCategory($this->_release['groupid'], $this->_newTitle['title']); $newTitle = $this->pdo->escapeString($this->_newTitle['title']); $this->pdo->queryExec( sprintf(' UPDATE releases - SET rageID = -1, seriesfull = NULL, season = NULL, episode = NULL, tvtitle = NULL, - tvairdate = NULL, imdbID = NULL, musicinfoID = NULL, consoleinfoID = NULL, bookinfoID = NULL, anidbid = NULL, - reqidstatus = %d, isrenamed = 1, proc_files = 1, searchname = %s, categoryID = %d, - prehashID = %d - WHERE ID = %d', + SET rageid = -1, seriesfull = NULL, season = NULL, episode = NULL, tvtitle = NULL, + tvairdate = NULL, imdbid = NULL, musicinfoid = NULL, consoleinfoid = NULL, bookinfoid = NULL, anidbid = NULL, + reqidstatus = %d, isrenamed = 1, proc_files = 1, searchname = %s, categoryid = %d, + prehashid = %d + WHERE id = %d', self::REQID_FOUND, $newTitle, $determinedCategory, $this->_preDbID, - $this->_release['ID'] + $this->_release['id'] ) ); - $this->sphinx->updateReleaseSearchName($this->_release['ID'], $newTitle); + $this->sphinx->updateReleaseSearchName($this->_release['id'], $newTitle); if ($this->echoOutput) { \NameFixer::echoChangedReleaseName(array( @@ -312,7 +312,7 @@ class RequestIDWeb extends RequestID 'new_category' => $this->category->getNameByID($determinedCategory), 'old_category' => '', 'group' => $this->_release['groupname'], - 'release_id' => $this->_release['ID'], + 'release_id' => $this->_release['id'], 'method' => 'RequestID->updateRelease' ) ); diff --git a/lib/copy_this/www/lib/SphinxSearch.php b/lib/copy_this/www/lib/SphinxSearch.php index c670679cd..8a89bd5b1 100644 --- a/lib/copy_this/www/lib/SphinxSearch.php +++ b/lib/copy_this/www/lib/SphinxSearch.php @@ -66,7 +66,7 @@ class SphinxSearch if (!is_null($this->sphinxQL)) { if ($identifiers['i'] === false) { $identifiers['i'] = $pdo->queryOneRow( - sprintf('SELECT ID FROM releases WHERE guid = %s', $pdo->escapeString($identifiers['g'])) + sprintf('SELECT id FROM releases WHERE guid = %s', $pdo->escapeString($identifiers['g'])) ); if ($identifiers['i'] !== false) { $identifiers['i'] = $identifiers['i']['id']; diff --git a/lib/copy_this/www/lib/Tmux.php b/lib/copy_this/www/lib/Tmux.php index ce48c4570..e5488e76d 100644 --- a/lib/copy_this/www/lib/Tmux.php +++ b/lib/copy_this/www/lib/Tmux.php @@ -382,20 +382,20 @@ class Tmux switch ((int) $qry) { case 1: return sprintf("SELECT - (SELECT COUNT(*) FROM releases WHERE nzbstatus = 1 AND categoryID BETWEEN 5000 AND 5999 AND rageID = -1) AS processtvrage, - (SELECT COUNT(*) FROM releases WHERE nzbstatus = 1 AND categoryID = 5070 AND anidbid IS NULL) AS processanime, - (SELECT COUNT(*) FROM releases WHERE nzbstatus = 1 AND categoryID BETWEEN 2000 AND 2999 AND imdbID IS NULL) AS processmovies, - (SELECT COUNT(*) FROM releases WHERE nzbstatus = 1 AND categoryID IN (3010, 3040, 3050) AND musicinfoID IS NULL) AS processmusic, - (SELECT COUNT(*) FROM releases WHERE nzbstatus = 1 AND categoryID BETWEEN 1000 AND 1999 AND consoleinfoID IS NULL) AS processconsole, - (SELECT COUNT(*) FROM releases WHERE nzbstatus = 1 AND categoryID IN (%s) AND bookinfoID IS NULL) AS processbooks, - (SELECT COUNT(*) FROM releases WHERE nzbstatus = 1 AND categoryID = 4050 AND gamesinfo_id = 0) AS processgames, - (SELECT COUNT(*) FROM releases WHERE nzbstatus = 1 AND categoryID BETWEEN 6000 AND 6040 AND xxxinfo_id = 0) AS processxxx, + (SELECT COUNT(*) FROM releases WHERE nzbstatus = 1 AND categoryid BETWEEN 5000 AND 5999 AND rageid = -1) AS processtvrage, + (SELECT COUNT(*) FROM releases WHERE nzbstatus = 1 AND categoryid = 5070 AND anidbid IS NULL) AS processanime, + (SELECT COUNT(*) FROM releases WHERE nzbstatus = 1 AND categoryid BETWEEN 2000 AND 2999 AND imdbid IS NULL) AS processmovies, + (SELECT COUNT(*) FROM releases WHERE nzbstatus = 1 AND categoryid IN (3010, 3040, 3050) AND musicinfoid IS NULL) AS processmusic, + (SELECT COUNT(*) FROM releases WHERE nzbstatus = 1 AND categoryid BETWEEN 1000 AND 1999 AND consoleinfoid IS NULL) AS processconsole, + (SELECT COUNT(*) FROM releases WHERE nzbstatus = 1 AND categoryid IN (%s) AND bookinfoid IS NULL) AS processbooks, + (SELECT COUNT(*) FROM releases WHERE nzbstatus = 1 AND categoryid = 4050 AND gamesinfo_id = 0) AS processgames, + (SELECT COUNT(*) FROM releases WHERE nzbstatus = 1 AND categoryid BETWEEN 6000 AND 6040 AND xxxinfo_id = 0) AS processxxx, (SELECT COUNT(*) FROM releases r WHERE 1=1 %s) AS processnfo", $bookreqids, \Info::NfoQueryString($this->pdo)); case 2: return "SELECT (SELECT COUNT(*) FROM releases WHERE nzbstatus = 1 AND nfostatus = 1) AS nfo, (SELECT COUNT(*) FROM releases r - INNER JOIN category c ON c.ID = r.categoryID + INNER JOIN category c ON c.id = r.categoryid WHERE r.nzbstatus = 1 AND r.passwordstatus BETWEEN -6 AND -1 AND r.haspreview = -1 AND c.disablepreview = 0 ) AS work, @@ -403,17 +403,17 @@ class Tmux (SELECT COUNT(*) FROM groups WHERE name IS NOT NULL) AS all_groups"; case 3: return sprintf("SELECT - (SELECT COUNT(*) FROM releases WHERE nzbstatus = 1 AND isrequestid = 1 AND prehashID = 0 AND reqidstatus = 0) + - (SELECT COUNT(*) FROM releases WHERE nzbstatus = 1 AND isrequestid = 1 AND prehashID = 0 AND reqidstatus = -1) + + (SELECT COUNT(*) FROM releases WHERE nzbstatus = 1 AND isrequestid = 1 AND prehashid = 0 AND reqidstatus = 0) + + (SELECT COUNT(*) FROM releases WHERE nzbstatus = 1 AND isrequestid = 1 AND prehashid = 0 AND reqidstatus = -1) + (SELECT COUNT(*) FROM releases WHERE nzbstatus = 1 - AND isrequestid = 1 AND prehashID = 0 AND reqidstatus = -3 AND adddate > NOW() - INTERVAL %s HOUR + AND isrequestid = 1 AND prehashid = 0 AND reqidstatus = -3 AND adddate > NOW() - INTERVAL %s HOUR ) AS requestid_inprogress, - (SELECT COUNT(*) FROM releases WHERE prehashID > 0 AND nzbstatus = 1 AND isrequestid = 1 AND reqidstatus = 1) AS requestid_matched, - (SELECT COUNT(*) FROM releases WHERE prehashID > 0 AND searchname IS NOT NULL) AS prehash_matched, + (SELECT COUNT(*) FROM releases WHERE prehashid > 0 AND nzbstatus = 1 AND isrequestid = 1 AND reqidstatus = 1) AS requestid_matched, + (SELECT COUNT(*) FROM releases WHERE prehashid > 0 AND searchname IS NOT NULL) AS prehash_matched, (SELECT COUNT(*) FROM releases WHERE preid > 0 AND searchname IS NOT NULL) AS predb_matched, (SELECT COUNT(DISTINCT(preid)) FROM releases WHERE preid > 0 AND searchname IS NOT NULL) AS distinct_predb_matched, - (SELECT COUNT(DISTINCT(prehashID)) FROM releases WHERE prehashID > 0 AND searchname IS NOT NULL) AS distinct_prehash_matched", $request_hours); + (SELECT COUNT(DISTINCT(prehashid)) FROM releases WHERE prehashid > 0 AND searchname IS NOT NULL) AS distinct_prehash_matched", $request_hours); case 4: return sprintf(" SELECT @@ -433,11 +433,11 @@ class Tmux ); case 6: return "SELECT - (SELECT searchname FROM releases ORDER BY ID DESC LIMIT 1) AS newestrelname, + (SELECT searchname FROM releases ORDER BY id DESC LIMIT 1) AS newestrelname, (SELECT UNIX_TIMESTAMP(MIN(dateadded)) FROM collections) AS oldestcollection, (SELECT UNIX_TIMESTAMP(MAX(predate)) FROM prehash) AS newestprehash, (SELECT UNIX_TIMESTAMP(MAX(ctime)) FROM predb) AS newestpredb, - (SELECT UNIX_TIMESTAMP(adddate) FROM releases ORDER BY ID DESC LIMIT 1) AS newestrelease"; + (SELECT UNIX_TIMESTAMP(adddate) FROM releases ORDER BY id DESC LIMIT 1) AS newestrelease"; default: return false; } diff --git a/lib/copy_this/www/lib/TmuxOutput.php b/lib/copy_this/www/lib/TmuxOutput.php index fbdddec71..d3e5747af 100644 --- a/lib/copy_this/www/lib/TmuxOutput.php +++ b/lib/copy_this/www/lib/TmuxOutput.php @@ -248,7 +248,7 @@ class TmuxOutput extends Tmux ) ); $buffer .= sprintf($this->tmpMasks[4], - "requestID", + "requestid", sprintf( "%s(%s)", number_format($this->runVar['counts']['now']['requestid_inprogress']), diff --git a/lib/copy_this/www/lib/XXX.php b/lib/copy_this/www/lib/XXX.php index 61d1132e9..e1c192cfa 100644 --- a/lib/copy_this/www/lib/XXX.php +++ b/lib/copy_this/www/lib/XXX.php @@ -168,7 +168,7 @@ class XXX ? 'AND r.postdate > NOW() - INTERVAL ' . $maxAge . 'DAY ' : '' ), - (count($excludedCats) > 0 ? ' AND r.categoryID NOT IN (' . implode(',', $excludedCats) . ')' : '') + (count($excludedCats) > 0 ? ' AND r.categoryid NOT IN (' . implode(',', $excludedCats) . ')' : '') ) ); return ($res === false ? 0 : $res['num']); @@ -196,12 +196,12 @@ class XXX $order = $this->getXXXOrder($orderBy); $sql = sprintf(" SELECT - GROUP_CONCAT(r.ID ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_id, + GROUP_CONCAT(r.id ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_id, GROUP_CONCAT(r.rarinnerfilecount ORDER BY r.postdate DESC SEPARATOR ',') as grp_rarinnerfilecount, GROUP_CONCAT(r.haspreview ORDER BY r.postdate DESC SEPARATOR ',') AS grp_haspreview, GROUP_CONCAT(r.passwordstatus ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_password, GROUP_CONCAT(r.guid ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_guid, - GROUP_CONCAT(rn.ID ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_nfoid, + GROUP_CONCAT(rn.id ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_nfoid, GROUP_CONCAT(groups.name ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_grpname, GROUP_CONCAT(r.searchname ORDER BY r.postdate DESC SEPARATOR '#') AS grp_release_name, GROUP_CONCAT(r.postdate ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_postdate, @@ -209,9 +209,9 @@ class XXX GROUP_CONCAT(r.totalpart ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_totalparts, GROUP_CONCAT(r.comments ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_comments, GROUP_CONCAT(r.grabs ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_grabs, - xxx.*, UNCOMPRESS(xxx.plot) AS plot, groups.name AS group_name, rn.ID as nfoid FROM releases r - LEFT OUTER JOIN groups ON groups.ID = r.groupID - LEFT OUTER JOIN releasenfo rn ON rn.releaseID = r.ID + xxx.*, UNCOMPRESS(xxx.plot) AS plot, groups.name AS group_name, rn.id as nfoid FROM releases r + LEFT OUTER JOIN groups ON groups.id = r.groupid + LEFT OUTER JOIN releasenfo rn ON rn.releaseid = r.id INNER JOIN xxxinfo xxx ON xxx.id = r.xxxinfo_id WHERE r.nzbstatus = 1 AND xxx.title != '' @@ -224,7 +224,7 @@ class XXX ? 'AND r.postdate > NOW() - INTERVAL ' . $maxAge . 'DAY ' : '' ), - (count($excludedCats) > 0 ? ' AND r.categoryID NOT IN (' . implode(',', $excludedCats) . ')' : ''), + (count($excludedCats) > 0 ? ' AND r.categoryid NOT IN (' . implode(',', $excludedCats) . ')' : ''), $order[0], $order[1], ($start === false ? '' : ' LIMIT ' . $num . ' OFFSET ' . $start) @@ -553,11 +553,11 @@ class XXX public function processXXXReleases() { $res = $this->pdo->query(sprintf(" - SELECT r.searchname, r.ID + SELECT r.searchname, r.id FROM releases r WHERE r.nzbstatus = 1 AND r.xxxinfo_id = 0 - AND r.categoryID IN (6010, 6020, 6030, 6040, 6041, 6042, 6080, 6090) + AND r.categoryid IN (6010, 6020, 6030, 6040, 6041, 6042, 6080, 6090) LIMIT %d", $this->movieqty ) @@ -579,7 +579,7 @@ class XXX if ($this->parseXXXSearchName($arr['searchname']) !== false) { $check = $this->checkXXXInfoExists($this->currentTitle); if ($check === false) { - $this->currentRelID = $arr['ID']; + $this->currentRelID = $arr['id']; $movieName = $this->currentTitle; if ($this->debug && $this->echooutput) { $this->pdo->log->doEcho("DB name: " . $arr['searchname'], true); @@ -595,7 +595,7 @@ class XXX } else { $this->pdo->log->doEcho(".", true); } - $this->pdo->queryExec(sprintf('UPDATE releases SET xxxinfo_id = %d WHERE ID = %d', $idcheck, $arr['ID'])); + $this->pdo->queryExec(sprintf('UPDATE releases SET xxxinfo_id = %d WHERE id = %d', $idcheck, $arr['id'])); } } elseif ($this->echooutput) { $this->pdo->log->doEcho($this->pdo->log->header('No xxx releases to process.')); @@ -679,7 +679,7 @@ class XXX } /** - * Get Genres for activeonly and/or an ID + * Get Genres for activeonly and/or an id * * @param bool $activeOnly * @param null $gid @@ -702,7 +702,7 @@ class XXX } /** - * Get Genre ID's Of the title + * Get Genre id's Of the title * * @param $arr - Array or String * @@ -713,16 +713,16 @@ class XXX $ret = null; if (!is_array($arr)) { - $res = $this->pdo->queryOneRow("SELECT ID FROM genres WHERE title = " . $this->pdo->escapeString($arr)); + $res = $this->pdo->queryOneRow("SELECT id FROM genres WHERE title = " . $this->pdo->escapeString($arr)); if ($res !== false) { - return $res["ID"]; + return $res["id"]; } } foreach ($arr as $key => $value) { - $res = $this->pdo->queryOneRow("SELECT ID FROM genres WHERE title = " . $this->pdo->escapeString($value)); + $res = $this->pdo->queryOneRow("SELECT id FROM genres WHERE title = " . $this->pdo->escapeString($value)); if ($res !== false) { - $ret .= "," . $res["ID"]; + $ret .= "," . $res["id"]; } else { $ret .= "," . $this->insertGenre($value); } @@ -733,7 +733,7 @@ class XXX } /** - * Inserts Genre and returns last affected row (Genre ID) + * Inserts Genre and returns last affected row (Genre id) * * @param $genre * diff --git a/lib/copy_this/www/lib/anidb.php b/lib/copy_this/www/lib/anidb.php index 55c627c39..78bc00af4 100644 --- a/lib/copy_this/www/lib/anidb.php +++ b/lib/copy_this/www/lib/anidb.php @@ -178,7 +178,7 @@ class AniDB } /** - * Retrieves all info for a specific AniDB ID + * Retrieves all info for a specific AniDB id * * @param int $anidbID * @return diff --git a/lib/copy_this/www/lib/backfill.php b/lib/copy_this/www/lib/backfill.php index 6513e0471..b7653680e 100644 --- a/lib/copy_this/www/lib/backfill.php +++ b/lib/copy_this/www/lib/backfill.php @@ -349,10 +349,10 @@ class Backfill sprintf(' UPDATE groups SET first_record_postdate = %s, first_record = %s, last_updated = NOW() - WHERE ID = %d', + WHERE id = %d', $this->pdo->from_unixtime($newdate), $this->pdo->escapeString($first), - $groupArr['ID']) + $groupArr['id']) ); if ($first == $targetpost) { $done = true; diff --git a/lib/copy_this/www/lib/binaries.php b/lib/copy_this/www/lib/binaries.php index 0eb34b71f..2ed8ae4ad 100644 --- a/lib/copy_this/www/lib/binaries.php +++ b/lib/copy_this/www/lib/binaries.php @@ -299,7 +299,7 @@ class Binaries SET first_record_postdate = %s WHERE id = %d', $this->_pdo->from_unixtime($groupMySQL['first_record_postdate']), - $groupMySQL['ID'] + $groupMySQL['id'] ) ); } @@ -429,7 +429,7 @@ class Binaries WHERE id = %d', $scanSummary['firstArticleNumber'], $this->_pdo->from_unixtime($this->_pdo->escapeString($groupMySQL['first_record_postdate'])), - $groupMySQL['ID'] + $groupMySQL['id'] ) ); } @@ -447,7 +447,7 @@ class Binaries WHERE id = %d', $this->_pdo->escapeString($scanSummary['lastArticleNumber']), $this->_pdo->from_unixtime($scanSummary['lastArticleDate']), - $groupMySQL['ID'] + $groupMySQL['id'] ) ); } else { @@ -458,7 +458,7 @@ class Binaries SET last_record = %s, last_updated = NOW() WHERE id = %d', $this->_pdo->escapeString($last), - $groupMySQL['ID'] + $groupMySQL['id'] ) ); } @@ -507,7 +507,7 @@ class Binaries $startLoop = microtime(true); // Check if MySQL tables exist, create if they do not, get their names at the same time. - $tableNames = $this->_groups->getCBPTableNames($this->_tablePerGroup, $groupMySQL['ID']); + $tableNames = $this->_groups->getCBPTableNames($this->_tablePerGroup, $groupMySQL['id']); $returnArray = []; @@ -530,7 +530,7 @@ class Binaries $this->_pdo->queryExec( sprintf( 'UPDATE partrepair SET attempts = attempts + 1 WHERE group_id = %d AND numberid %s', - $groupMySQL['ID'], + $groupMySQL['id'], ($first == $last ? '= ' . $first : 'IN (' . implode(',', range($first, $last)) . ')') ) ); @@ -691,7 +691,7 @@ class Binaries $header['CollectionKey'] = ( $this->_collectionsCleaning->collectionsCleaner($matches[1], $groupMySQL['name']) . $header['From'] . - $groupMySQL['ID'] . + $groupMySQL['id'] . $fileCount[3] ); @@ -717,7 +717,7 @@ class Binaries $this->_pdo->escapeString(utf8_encode($header['From'])), (is_numeric($header['Date']) ? ($header['Date'] > $now ? $now : $header['Date']) : $now), $this->_pdo->escapeString(substr($header['Xref'], 0, 255)), - $groupMySQL['ID'], + $groupMySQL['id'], $fileCount[3], sha1($header['CollectionKey']), bin2hex(openssl_random_pseudo_bytes(16)) @@ -743,7 +743,7 @@ class Binaries VALUES ('%s', %s, %d, %d, 1, %d, %d) ON DUPLICATE KEY UPDATE currentparts = currentparts + 1, partsize = partsize + %d", $tableNames['bname'], - md5($matches[1] . $header['From'] . $groupMySQL['ID']), + md5($matches[1] . $header['From'] . $groupMySQL['id']), $this->_pdo->escapeString(utf8_encode($matches[1])), $collectionID, $matches[3], @@ -776,10 +776,10 @@ class Binaries } // Strip the < and >, saves space in DB. - $header['Message-ID'][0] = "'"; + $header['Message-id'][0] = "'"; $partsQuery .= - '(' . $binaryID . ',' . $header['Number'] . ',' . rtrim($header['Message-ID'], '>') . "'," . + '(' . $binaryID . ',' . $header['Number'] . ',' . rtrim($header['Message-id'], '>') . "'," . $matches[2] . ',' . $header['Bytes'] . ',' . $collectionID . '),'; } @@ -840,14 +840,14 @@ class Binaries $timeInsert = number_format($startPR - $startUpdate, 2); if ($partRepair && count($headersRepaired) > 0) { - $this->removeRepairedParts($headersRepaired, $tableNames['prname'], $groupMySQL['ID']); + $this->removeRepairedParts($headersRepaired, $tableNames['prname'], $groupMySQL['id']); } if ($addToPartRepair) { $notInsertedCount = count($headersNotInserted); if ($notInsertedCount > 0) { - $this->addMissingParts($headersNotInserted, $tableNames['prname'], $groupMySQL['ID']); + $this->addMissingParts($headersNotInserted, $tableNames['prname'], $groupMySQL['id']); $this->log( $notInsertedCount . ' articles failed to insert!', @@ -864,7 +864,7 @@ class Binaries $notReceivedCount = count($rangeNotReceived); if ($notReceivedCount > 0) { - $this->addMissingParts($rangeNotReceived, $tableNames['prname'], $groupMySQL['ID']); + $this->addMissingParts($rangeNotReceived, $tableNames['prname'], $groupMySQL['id']); if ($this->_echoCLI) { $this->_colorCLI->doEcho( @@ -925,7 +925,7 @@ class Binaries */ public function partRepair($groupArr) { - $tableNames = $this->_groups->getCBPTableNames($this->_tablePerGroup, $groupArr['ID']); + $tableNames = $this->_groups->getCBPTableNames($this->_tablePerGroup, $groupArr['id']); // Get all parts in partrepair table. $missingParts = $this->_pdo->query( sprintf(' @@ -933,7 +933,7 @@ class Binaries WHERE group_id = %d AND attempts < %d ORDER BY numberid ASC LIMIT %d', $tableNames['prname'], - $groupArr['ID'], + $groupArr['id'], $this->_partRepairMaxTries, $this->_partRepairLimit ) @@ -1000,7 +1000,7 @@ class Binaries WHERE group_id = %d AND numberid <= %d', $tableNames['prname'], - $groupArr['ID'], + $groupArr['id'], $missingParts[$missingCount - 1]['numberid'] ) ); @@ -1019,7 +1019,7 @@ class Binaries WHERE group_id = %d AND numberid <= %d', $tableNames['prname'], - $groupArr['ID'], + $groupArr['id'], $missingParts[$missingCount - 1]['numberid'] ) ); @@ -1042,7 +1042,7 @@ class Binaries 'DELETE FROM %s WHERE attempts >= %d AND group_id = %d', $tableNames['prname'], $this->_partRepairMaxTries, - $groupArr['ID'] + $groupArr['id'] ) ); } @@ -1262,7 +1262,7 @@ class Binaries * * @param array $numbers The article numbers of the missing headers. * @param string $tableName Name of the partrepair table to insert into. - * @param int $groupID The ID of this groups. + * @param int $groupID The id of this groups. * * @return bool */ @@ -1280,7 +1280,7 @@ class Binaries * * @param array $numbers The article numbers. * @param string $tableName Name of the part repair table to work on. - * @param int $groupID The ID of the group. + * @param int $groupID The id of the group. * * @return void */ @@ -1339,7 +1339,7 @@ class Binaries $field = [ self::BLACKLIST_FIELD_SUBJECT => $msg['Subject'], self::BLACKLIST_FIELD_FROM => $msg['From'], - self::BLACKLIST_FIELD_MESSAGEID => $msg['Message-ID'] + self::BLACKLIST_FIELD_MESSAGEID => $msg['Message-id'] ]; // Try white lists first. @@ -1411,7 +1411,7 @@ class Binaries /** * Return the specified blacklist. * - * @param int $id The blacklist ID. + * @param int $id The blacklist id. * * @return array|bool */ @@ -1423,7 +1423,7 @@ class Binaries /** * Delete a blacklist. * - * @param int $id The ID of the blacklist. + * @param int $id The id of the blacklist. * * @return bool */ @@ -1486,9 +1486,9 @@ class Binaries } /** - * Delete Collections/Binaries/Parts for a Collection ID. + * Delete Collections/Binaries/Parts for a Collection id. * - * @param int $collectionID Collections table ID + * @param int $collectionID Collections table id * * @note A trigger automatically deletes the parts/binaries. * @@ -1500,9 +1500,9 @@ class Binaries } /** - * Delete all Collections/Binaries/Parts for a group ID. + * Delete all Collections/Binaries/Parts for a group id. * - * @param int $groupID The ID of the group. + * @param int $groupID The id of the group. * * @note A trigger automatically deletes the parts/binaries. * diff --git a/lib/copy_this/www/lib/book.php b/lib/copy_this/www/lib/book.php index c3f7adbeb..690561edd 100644 --- a/lib/copy_this/www/lib/book.php +++ b/lib/copy_this/www/lib/book.php @@ -29,12 +29,12 @@ class Book } /** - * Get bookinfo row for ID. + * Get bookinfo row for id. */ public function getBookInfo($id) { $db = new DB(); - return $db->queryOneRow(sprintf("SELECT bookinfo.*, genres.title as genres FROM bookinfo left outer join genres on genres.ID = bookinfo.genreID where bookinfo.ID = %d ", $id)); + return $db->queryOneRow(sprintf("SELECT bookinfo.*, genres.title as genres FROM bookinfo left outer join genres on genres.id = bookinfo.genreID where bookinfo.id = %d ", $id)); } /** @@ -67,7 +67,7 @@ class Book public function getCount() { $db = new DB(); - $res = $db->queryOneRow("select count(ID) as num from bookinfo"); + $res = $db->queryOneRow("select count(id) as num from bookinfo"); return $res["num"]; } @@ -85,7 +85,7 @@ class Book else $maxage = ""; - $sql = sprintf("select count(distinct r.bookinfoID) as num from releases r inner join bookinfo b on b.ID = r.bookinfoID and b.title != '' where r.passwordstatus <= (select value from site where setting='showpasswordedrelease') %s %s", $browseby, $maxage); + $sql = sprintf("select count(distinct r.bookinfoid) as num from releases r inner join bookinfo b on b.id = r.bookinfoid and b.title != '' where r.passwordstatus <= (select value from site where setting='showpasswordedrelease') %s %s", $browseby, $maxage); $res = $db->queryOneRow($sql, true); return $res["num"]; @@ -110,7 +110,7 @@ class Book $maxagesql = sprintf(" and r.postdate > now() - interval %d day ", $maxage); $order = $this->getBrowseOrder($orderby); - $sql = sprintf(" SELECT r.bookinfoID, max(postdate), b.* from releases r inner join bookinfo b on b.ID = r.bookinfoID and b.title != '' where r.passwordstatus <= (select value from site where setting='showpasswordedrelease') %s %s group by r.bookinfoID order by %s %s".$limit, $browseby, $maxagesql, $order[0], $order[1]); + $sql = sprintf(" SELECT r.bookinfoid, max(postdate), b.* from releases r inner join bookinfo b on b.id = r.bookinfoid and b.title != '' where r.passwordstatus <= (select value from site where setting='showpasswordedrelease') %s %s group by r.bookinfoid order by %s %s".$limit, $browseby, $maxagesql, $order[0], $order[1]); $rows = $db->query($sql, true); // @@ -118,7 +118,7 @@ class Book // $ids = ""; foreach ($rows as $row) - $ids .= $row["bookinfoID"]. ", "; + $ids .= $row["bookinfoid"]. ", "; if (strlen($ids) > 0) { @@ -127,7 +127,7 @@ class Book // // get all releases matching these ids // - $sql = sprintf("select r.*, releasenfo.ID as nfoID, groups.name as grpname from releases r left outer join releasenfo on releasenfo.releaseID = r.ID left outer join groups on groups.ID = r.groupID where bookinfoID in (%s) %s order by r.postdate desc", $ids, $maxagesql); + $sql = sprintf("select r.*, releasenfo.id as nfoID, groups.name as grpname from releases r left outer join releasenfo on releasenfo.releaseid = r.id left outer join groups on groups.id = r.groupid where bookinfoid in (%s) %s order by r.postdate desc", $ids, $maxagesql); $allrows = $db->query($sql, true); $arr = array(); @@ -136,20 +136,20 @@ class Book // foreach ($allrows as &$allrow) { - $arr[$allrow["bookinfoID"]]["ID"] = (isset($arr[$allrow["bookinfoID"]]["ID"]) ? $arr[$allrow["bookinfoID"]]["ID"] : "") . $allrow["ID"] . ","; - $arr[$allrow["bookinfoID"]]["rarinnerfilecount"] = (isset($arr[$allrow["bookinfoID"]]["rarinnerfilecount"]) ? $arr[$allrow["bookinfoID"]]["rarinnerfilecount"] : "") . $allrow["rarinnerfilecount"] . ","; - $arr[$allrow["bookinfoID"]]["haspreview"] = (isset($arr[$allrow["bookinfoID"]]["haspreview"]) ? $arr[$allrow["bookinfoID"]]["haspreview"] : "") . $allrow["haspreview"] . ","; - $arr[$allrow["bookinfoID"]]["passwordstatus"] = (isset($arr[$allrow["bookinfoID"]]["passwordstatus"]) ? $arr[$allrow["bookinfoID"]]["passwordstatus"] : "") . $allrow["passwordstatus"] . ","; - $arr[$allrow["bookinfoID"]]["guid"] = (isset($arr[$allrow["bookinfoID"]]["guid"]) ? $arr[$allrow["bookinfoID"]]["guid"] : "") . $allrow["guid"] . ","; - $arr[$allrow["bookinfoID"]]["nfoID"] = (isset($arr[$allrow["bookinfoID"]]["nfoID"]) ? $arr[$allrow["bookinfoID"]]["nfoID"] : "") . $allrow["nfoID"] . ","; - $arr[$allrow["bookinfoID"]]["grpname"] = (isset($arr[$allrow["bookinfoID"]]["grpname"]) ? $arr[$allrow["bookinfoID"]]["grpname"] : "") . $allrow["grpname"] . ","; - $arr[$allrow["bookinfoID"]]["searchname"] = (isset($arr[$allrow["bookinfoID"]]["searchname"]) ? $arr[$allrow["bookinfoID"]]["searchname"] : "") . $allrow["searchname"] . "#"; - $arr[$allrow["bookinfoID"]]["postdate"] = (isset($arr[$allrow["bookinfoID"]]["postdate"]) ? $arr[$allrow["bookinfoID"]]["postdate"] : "") . $allrow["postdate"] . ","; - $arr[$allrow["bookinfoID"]]["size"] = (isset($arr[$allrow["bookinfoID"]]["size"]) ? $arr[$allrow["bookinfoID"]]["size"] : "") . $allrow["size"] . ","; - $arr[$allrow["bookinfoID"]]["totalpart"] = (isset($arr[$allrow["bookinfoID"]]["totalpart"]) ? $arr[$allrow["bookinfoID"]]["totalpart"] : "") . $allrow["totalpart"] . ","; - $arr[$allrow["bookinfoID"]]["comments"] = (isset($arr[$allrow["bookinfoID"]]["comments"]) ? $arr[$allrow["bookinfoID"]]["comments"] : "") . $allrow["comments"] . ","; - $arr[$allrow["bookinfoID"]]["grabs"] = (isset($arr[$allrow["bookinfoID"]]["grabs"]) ? $arr[$allrow["bookinfoID"]]["grabs"] : "") . $allrow["grabs"] . ","; - $arr[$allrow["bookinfoID"]]["categoryID"] = (isset($arr[$allrow["bookinfoID"]]["categoryID"]) ? $arr[$allrow["bookinfoID"]]["categoryID"] : "") . $allrow["categoryID"] . ","; + $arr[$allrow["bookinfoid"]]["id"] = (isset($arr[$allrow["bookinfoid"]]["id"]) ? $arr[$allrow["bookinfoid"]]["id"] : "") . $allrow["id"] . ","; + $arr[$allrow["bookinfoid"]]["rarinnerfilecount"] = (isset($arr[$allrow["bookinfoid"]]["rarinnerfilecount"]) ? $arr[$allrow["bookinfoid"]]["rarinnerfilecount"] : "") . $allrow["rarinnerfilecount"] . ","; + $arr[$allrow["bookinfoid"]]["haspreview"] = (isset($arr[$allrow["bookinfoid"]]["haspreview"]) ? $arr[$allrow["bookinfoid"]]["haspreview"] : "") . $allrow["haspreview"] . ","; + $arr[$allrow["bookinfoid"]]["passwordstatus"] = (isset($arr[$allrow["bookinfoid"]]["passwordstatus"]) ? $arr[$allrow["bookinfoid"]]["passwordstatus"] : "") . $allrow["passwordstatus"] . ","; + $arr[$allrow["bookinfoid"]]["guid"] = (isset($arr[$allrow["bookinfoid"]]["guid"]) ? $arr[$allrow["bookinfoid"]]["guid"] : "") . $allrow["guid"] . ","; + $arr[$allrow["bookinfoid"]]["nfoID"] = (isset($arr[$allrow["bookinfoid"]]["nfoID"]) ? $arr[$allrow["bookinfoid"]]["nfoID"] : "") . $allrow["nfoID"] . ","; + $arr[$allrow["bookinfoid"]]["grpname"] = (isset($arr[$allrow["bookinfoid"]]["grpname"]) ? $arr[$allrow["bookinfoid"]]["grpname"] : "") . $allrow["grpname"] . ","; + $arr[$allrow["bookinfoid"]]["searchname"] = (isset($arr[$allrow["bookinfoid"]]["searchname"]) ? $arr[$allrow["bookinfoid"]]["searchname"] : "") . $allrow["searchname"] . "#"; + $arr[$allrow["bookinfoid"]]["postdate"] = (isset($arr[$allrow["bookinfoid"]]["postdate"]) ? $arr[$allrow["bookinfoid"]]["postdate"] : "") . $allrow["postdate"] . ","; + $arr[$allrow["bookinfoid"]]["size"] = (isset($arr[$allrow["bookinfoid"]]["size"]) ? $arr[$allrow["bookinfoid"]]["size"] : "") . $allrow["size"] . ","; + $arr[$allrow["bookinfoid"]]["totalpart"] = (isset($arr[$allrow["bookinfoid"]]["totalpart"]) ? $arr[$allrow["bookinfoid"]]["totalpart"] : "") . $allrow["totalpart"] . ","; + $arr[$allrow["bookinfoid"]]["comments"] = (isset($arr[$allrow["bookinfoid"]]["comments"]) ? $arr[$allrow["bookinfoid"]]["comments"] : "") . $allrow["comments"] . ","; + $arr[$allrow["bookinfoid"]]["grabs"] = (isset($arr[$allrow["bookinfoid"]]["grabs"]) ? $arr[$allrow["bookinfoid"]]["grabs"] : "") . $allrow["grabs"] . ","; + $arr[$allrow["bookinfoid"]]["categoryid"] = (isset($arr[$allrow["bookinfoid"]]["categoryid"]) ? $arr[$allrow["bookinfoid"]]["categoryid"] : "") . $allrow["categoryid"] . ","; } // @@ -157,20 +157,20 @@ class Book // foreach ($rows as &$row) { - $row["grp_release_id"] = substr($arr[$row["bookinfoID"]]["ID"], 0, -1); - $row["grp_rarinnerfilecount"] = substr($arr[$row["bookinfoID"]]["rarinnerfilecount"], 0, -1); - $row["grp_haspreview"] = substr($arr[$row["bookinfoID"]]["haspreview"], 0, -1); - $row["grp_release_password"] = substr($arr[$row["bookinfoID"]]["passwordstatus"], 0, -1); - $row["grp_release_guid"] = substr($arr[$row["bookinfoID"]]["guid"], 0, -1); - $row["grp_release_nfoID"] = substr($arr[$row["bookinfoID"]]["nfoID"], 0, -1); - $row["grp_release_grpname"] = substr($arr[$row["bookinfoID"]]["grpname"], 0, -1); - $row["grp_release_name"] = substr($arr[$row["bookinfoID"]]["searchname"], 0, -1); - $row["grp_release_postdate"] = substr($arr[$row["bookinfoID"]]["postdate"], 0, -1); - $row["grp_release_size"] = substr($arr[$row["bookinfoID"]]["size"], 0, -1); - $row["grp_release_totalparts"] = substr($arr[$row["bookinfoID"]]["totalpart"], 0, -1); - $row["grp_release_comments"] = substr($arr[$row["bookinfoID"]]["comments"], 0, -1); - $row["grp_release_grabs"] = substr($arr[$row["bookinfoID"]]["grabs"], 0, -1); - $row["grp_release_categoryID"] = substr($arr[$row["bookinfoID"]]["categoryID"], 0, -1); + $row["grp_release_id"] = substr($arr[$row["bookinfoid"]]["id"], 0, -1); + $row["grp_rarinnerfilecount"] = substr($arr[$row["bookinfoid"]]["rarinnerfilecount"], 0, -1); + $row["grp_haspreview"] = substr($arr[$row["bookinfoid"]]["haspreview"], 0, -1); + $row["grp_release_password"] = substr($arr[$row["bookinfoid"]]["passwordstatus"], 0, -1); + $row["grp_release_guid"] = substr($arr[$row["bookinfoid"]]["guid"], 0, -1); + $row["grp_release_nfoID"] = substr($arr[$row["bookinfoid"]]["nfoID"], 0, -1); + $row["grp_release_grpname"] = substr($arr[$row["bookinfoid"]]["grpname"], 0, -1); + $row["grp_release_name"] = substr($arr[$row["bookinfoid"]]["searchname"], 0, -1); + $row["grp_release_postdate"] = substr($arr[$row["bookinfoid"]]["postdate"], 0, -1); + $row["grp_release_size"] = substr($arr[$row["bookinfoid"]]["size"], 0, -1); + $row["grp_release_totalparts"] = substr($arr[$row["bookinfoid"]]["totalpart"], 0, -1); + $row["grp_release_comments"] = substr($arr[$row["bookinfoid"]]["comments"], 0, -1); + $row["grp_release_grabs"] = substr($arr[$row["bookinfoid"]]["grabs"], 0, -1); + $row["grp_release_categoryID"] = substr($arr[$row["bookinfoid"]]["categoryid"], 0, -1); } } return $rows; @@ -250,7 +250,7 @@ class Book { $db = new DB(); - $db->queryExec(sprintf("update bookinfo SET title=%s, asin=%s, url=%s, author=%s, publisher=%s, publishdate='%s', cover=%d, updateddate=NOW() WHERE ID = %d", + $db->queryExec(sprintf("update bookinfo SET title=%s, asin=%s, url=%s, author=%s, publisher=%s, publishdate='%s', cover=%d, updateddate=NOW() WHERE id = %d", $db->escapeString($title), $db->escapeString($asin), $db->escapeString($url), $db->escapeString($author), $db->escapeString($publisher), $publishdate, $cover, $id)); } @@ -371,7 +371,7 @@ class Book $db = new DB(); $numlookedup = 0; - $res = $db->queryDirect(sprintf("SELECT searchname, ID from releases where bookinfoID IS NULL and categoryID = %d ORDER BY postdate DESC LIMIT 100", Category::CAT_BOOK_EBOOK)); + $res = $db->queryDirect(sprintf("SELECT searchname, id from releases where bookinfoid IS NULL and categoryid = %d ORDER BY postdate DESC LIMIT 100", Category::CAT_BOOK_EBOOK)); if ($db->getNumRows($res) > 0) { if ($this->echooutput) @@ -406,10 +406,10 @@ class Book } else { - $bookId = $bookCheck["ID"]; + $bookId = $bookCheck["id"]; } } - $db->queryExec(sprintf("update releases SET bookinfoID = %d WHERE ID = %d", $bookId, $arr["ID"])); + $db->queryExec(sprintf("update releases SET bookinfoid = %d WHERE id = %d", $bookId, $arr["id"])); } } } diff --git a/lib/copy_this/www/lib/category.php b/lib/copy_this/www/lib/category.php index 3179dd92a..d5d6da9b6 100644 --- a/lib/copy_this/www/lib/category.php +++ b/lib/copy_this/www/lib/category.php @@ -103,14 +103,14 @@ class Category $children = $this->getChildren($category); foreach ($children as $child) { - $chlist .= ', ' . $child['ID']; + $chlist .= ', ' . $child['id']; } } if ($chlist != '-99') { - $catsrch .= ' r.categoryID IN (' . $chlist . ') OR '; + $catsrch .= ' r.categoryid IN (' . $chlist . ') OR '; } else { - $catsrch .= sprintf(' r.categoryID = %d OR ', $category); + $catsrch .= sprintf(' r.categoryid = %d OR ', $category); } $catsrch .= '1=2 )'; } @@ -124,7 +124,7 @@ class Category public function isParent($cid) { $db = new DB(); - $ret = $db->queryOneRow(sprintf("select count(*) as count from category where ID = %d and parentID is null", $cid), true); + $ret = $db->queryOneRow(sprintf("select count(*) as count from category where id = %d and parentID is null", $cid), true); if ($ret['count']) return true; else @@ -151,7 +151,7 @@ class Category if ($activeonly) $act = sprintf(" where c.status = %d ", Category::STATUS_ACTIVE); - return $db->query("select c.*, (SELECT title FROM category WHERE ID=c.parentID) AS parentName from category c " . $act . " ORDER BY c.ID"); + return $db->query("select c.*, (SELECT title FROM category WHERE id=c.parentID) AS parentName from category c " . $act . " ORDER BY c.id"); } /** @@ -167,7 +167,7 @@ class Category } /** - * Returns category ID's for site disabled categories. + * Returns category id's for site disabled categories. * * @return array */ @@ -175,23 +175,23 @@ class Category { $db = new DB(); - return $db->query("SELECT ID FROM category WHERE status = 2 OR parentID IN (SELECT ID FROM category WHERE status = 2 AND parentID IS NULL)"); + return $db->query("SELECT id FROM category WHERE status = 2 OR parentID IN (SELECT id FROM category WHERE status = 2 AND parentID IS NULL)"); } /** - * Get a category row by its ID. + * Get a category row by its id. */ public function getById($id) { $db = new DB(); - return $db->queryOneRow(sprintf("SELECT c.disablepreview, c.ID, c.description, c.minsizetoformrelease, c.maxsizetoformrelease, CONCAT(COALESCE(cp.title,'') , CASE WHEN cp.title IS NULL THEN '' ELSE ' > ' END , c.title) as title, c.status, c.parentID from category c left outer join category cp on cp.ID = c.parentID where c.ID = %d", $id)); + return $db->queryOneRow(sprintf("SELECT c.disablepreview, c.id, c.description, c.minsizetoformrelease, c.maxsizetoformrelease, CONCAT(COALESCE(cp.title,'') , CASE WHEN cp.title IS NULL THEN '' ELSE ' > ' END , c.title) as title, c.status, c.parentID from category c left outer join category cp on cp.id = c.parentID where c.id = %d", $id)); } public function getSizeRangeById($id) { $db = new DB(); $res = $db->queryOneRow(sprintf("SELECT c.minsizetoformrelease, c.maxsizetoformrelease, cp.minsizetoformrelease as p_minsizetoformrelease, cp.maxsizetoformrelease as p_maxsizetoformrelease" . - " from category c left outer join category cp on cp.ID = c.parentID where c.ID = %d", $id + " from category c left outer join category cp on cp.id = c.parentID where c.id = %d", $id ) ); if (!$res) @@ -237,14 +237,14 @@ class Category { $db = new DB(); - return $db->query(sprintf("SELECT concat(cp.title, ' > ',c.title) as title from category c inner join category cp on cp.ID = c.parentID where c.ID in (%s)", implode(',', $ids))); + return $db->query(sprintf("SELECT concat(cp.title, ' > ',c.title) as title from category c inner join category cp on cp.id = c.parentID where c.id in (%s)", implode(',', $ids))); } public function getNameByID($ID) { $db = new DB(); - $parent = $db->queryOneRow(sprintf("SELECT title FROM category WHERE ID = %d", substr($ID, 0, 1) . "000")); - $cat = $db->queryOneRow(sprintf("SELECT title FROM category WHERE ID = %d", $ID)); + $parent = $db->queryOneRow(sprintf("SELECT title FROM category WHERE id = %d", substr($ID, 0, 1) . "000")); + $cat = $db->queryOneRow(sprintf("SELECT title FROM category WHERE id = %d", $ID)); return $parent["title"] . " " . $cat["title"]; } @@ -256,7 +256,7 @@ class Category { $db = new DB(); - return $db->queryExec(sprintf("update category set disablepreview = %d, status = %d, minsizetoformrelease = %d, maxsizetoformrelease = %d, description = %s where ID = %d", $disablepreview, $status, $minsize, $maxsize, $db->escapeString($desc), $id)); + return $db->queryExec(sprintf("update category set disablepreview = %d, status = %d, minsizetoformrelease = %d, maxsizetoformrelease = %d, description = %s where id = %d", $disablepreview, $status, $minsize, $maxsize, $db->escapeString($desc), $id)); } /** @@ -269,7 +269,7 @@ class Category $exccatlist = ""; if (count($excludedcats) > 0) - $exccatlist = " and ID not in (" . implode(",", $excludedcats) . ")"; + $exccatlist = " and id not in (" . implode(",", $excludedcats) . ")"; $arr = $db->query(sprintf("select * from category where status = %d %s", Category::STATUS_ACTIVE, $exccatlist), true); foreach ($arr as $a) @@ -280,7 +280,7 @@ class Category $subcatlist = array(); $subcatnames = array(); foreach ($arr as $a) { - if ($a["parentID"] == $parent["ID"]) { + if ($a["parentID"] == $parent["id"]) { $subcatlist[] = $a; $subcatnames[] = $a["title"]; } @@ -310,7 +310,7 @@ class Category } foreach ($categories as $category) - $temp_array[$category["ID"]] = $category["title"]; + $temp_array[$category["id"]] = $category["title"]; return $temp_array; } @@ -324,7 +324,7 @@ class Category $exccatlist = ""; if (count($excludedcats) > 0) - $exccatlist = " and c.ID not in (" . implode(",", $excludedcats) . ")"; + $exccatlist = " and c.id not in (" . implode(",", $excludedcats) . ")"; $act = ""; if ($activeonly) @@ -333,7 +333,7 @@ class Category if ($exccatlist != "") $act .= $exccatlist; - return $db->query("select c.ID, concat(cp.title, ' > ',c.title) as title, cp.ID as parentID, c.status from category c inner join category cp on cp.ID = c.parentID " . $act . " ORDER BY c.ID", true); + return $db->query("select c.id, concat(cp.title, ' > ',c.title) as title, cp.id as parentID, c.status from category c inner join category cp on cp.id = c.parentID " . $act . " ORDER BY c.id", true); } } \ No newline at end of file diff --git a/lib/copy_this/www/lib/console.php b/lib/copy_this/www/lib/console.php index 5adc2a28f..fcd6aab97 100644 --- a/lib/copy_this/www/lib/console.php +++ b/lib/copy_this/www/lib/console.php @@ -31,12 +31,12 @@ class Console } /** - * Get consoleinfo row by ID. + * Get consoleinfo row by id. */ public function getConsoleInfo($id) { $db = new DB(); - return $db->queryOneRow(sprintf("SELECT consoleinfo.*, genres.title as genres FROM consoleinfo left outer join genres on genres.ID = consoleinfo.genreID where consoleinfo.ID = %d ", $id)); + return $db->queryOneRow(sprintf("SELECT consoleinfo.*, genres.title as genres FROM consoleinfo left outer join genres on genres.id = consoleinfo.genreID where consoleinfo.id = %d ", $id)); } /** @@ -69,7 +69,7 @@ class Console public function getCount() { $db = new DB(); - $res = $db->queryOneRow("select count(ID) as num from consoleinfo"); + $res = $db->queryOneRow("select count(id) as num from consoleinfo"); return $res["num"]; } @@ -96,14 +96,14 @@ class Console $children = $categ->getChildren($category); $chlist = "-99"; foreach ($children as $child) - $chlist.=", ".$child["ID"]; + $chlist.=", ".$child["id"]; if ($chlist != "-99") - $catsrch .= " r.categoryID in (".$chlist.") or "; + $catsrch .= " r.categoryid in (".$chlist.") or "; } else { - $catsrch .= sprintf(" r.categoryID = %d or ", $category); + $catsrch .= sprintf(" r.categoryid = %d or ", $category); } } } @@ -117,9 +117,9 @@ class Console $exccatlist = ""; if (count($excludedcats) > 0) - $exccatlist = " and r.categoryID not in (".implode(",", $excludedcats).")"; + $exccatlist = " and r.categoryid not in (".implode(",", $excludedcats).")"; - $sql = sprintf("select count(r.ID) as num from releases r inner join consoleinfo con on con.ID = r.consoleinfoID and con.title != '' where r.passwordstatus <= (select value from site where setting='showpasswordedrelease') and %s %s %s %s", $browseby, $catsrch, $maxage, $exccatlist); + $sql = sprintf("select count(r.id) as num from releases r inner join consoleinfo con on con.id = r.consoleinfoid and con.title != '' where r.passwordstatus <= (select value from site where setting='showpasswordedrelease') and %s %s %s %s", $browseby, $catsrch, $maxage, $exccatlist); $res = $db->queryOneRow($sql, true); return $res["num"]; } @@ -152,14 +152,14 @@ class Console $children = $categ->getChildren($category); $chlist = "-99"; foreach ($children as $child) - $chlist.=", ".$child["ID"]; + $chlist.=", ".$child["id"]; if ($chlist != "-99") - $catsrch .= " r.categoryID in (".$chlist.") or "; + $catsrch .= " r.categoryid in (".$chlist.") or "; } else { - $catsrch .= sprintf(" r.categoryID = %d or ", $category); + $catsrch .= sprintf(" r.categoryid = %d or ", $category); } } } @@ -172,10 +172,10 @@ class Console $exccatlist = ""; if (count($excludedcats) > 0) - $exccatlist = " and r.categoryID not in (".implode(",", $excludedcats).")"; + $exccatlist = " and r.categoryid not in (".implode(",", $excludedcats).")"; $order = $this->getConsoleOrder($orderby); - $sql = sprintf(" SELECT r.*, r.ID as releaseID, con.*, g.title as genre, groups.name as group_name, concat(cp.title, ' > ', c.title) as category_name, concat(cp.ID, ',', c.ID) as category_ids, rn.ID as nfoID from releases r left outer join groups on groups.ID = r.groupID inner join consoleinfo con on con.ID = r.consoleinfoID left outer join releasenfo rn on rn.releaseID = r.ID and rn.nfo is not null left outer join category c on c.ID = r.categoryID left outer join category cp on cp.ID = c.parentID left outer join genres g on g.ID = con.genreID where r.passwordstatus <= (select value from site where setting='showpasswordedrelease') and %s %s %s %s order by %s %s".$limit, $browseby, $catsrch, $maxagesql, $exccatlist, $order[0], $order[1]); + $sql = sprintf(" SELECT r.*, r.id as releaseid, con.*, g.title as genre, groups.name as group_name, concat(cp.title, ' > ', c.title) as category_name, concat(cp.id, ',', c.id) as category_ids, rn.id as nfoID from releases r left outer join groups on groups.id = r.groupid inner join consoleinfo con on con.id = r.consoleinfoid left outer join releasenfo rn on rn.releaseid = r.id and rn.nfo is not null left outer join category c on c.id = r.categoryid left outer join category cp on cp.id = c.parentID left outer join genres g on g.id = con.genreID where r.passwordstatus <= (select value from site where setting='showpasswordedrelease') and %s %s %s %s order by %s %s".$limit, $browseby, $catsrch, $maxagesql, $exccatlist, $order[0], $order[1]); return $db->query($sql, true); } @@ -258,7 +258,7 @@ class Console { $db = new DB(); - $db->queryExec(sprintf("update consoleinfo SET title=%s, asin=%s, url=%s, salesrank=%s, platform=%s, publisher=%s, releasedate='%s', esrb=%s, cover=%d, genreID=%d, updateddate=NOW() WHERE ID = %d", + $db->queryExec(sprintf("update consoleinfo SET title=%s, asin=%s, url=%s, salesrank=%s, platform=%s, publisher=%s, releasedate='%s', esrb=%s, cover=%d, genreID=%d, updateddate=NOW() WHERE id = %d", $db->escapeString($title), $db->escapeString($asin), $db->escapeString($url), $salesrank, $db->escapeString($platform), $db->escapeString($publisher), $releasedate, $db->escapeString($esrb), $cover, $genreID, $id)); } @@ -280,7 +280,7 @@ class Console $defaultGenres = $gen->getGenres(Genres::CONSOLE_TYPE); $genreassoc = array(); foreach($defaultGenres as $dg) { - $genreassoc[$dg['ID']] = strtolower($dg['title']); + $genreassoc[$dg['id']] = strtolower($dg['title']); } // @@ -523,7 +523,7 @@ class Console $db = new DB(); $numlookedup = 0; - $res = $db->queryDirect(sprintf("SELECT searchname, ID from releases where consoleinfoID IS NULL and categoryID in ( select ID from category where parentID = %d ) ORDER BY postdate DESC LIMIT 100", Category::CAT_PARENT_GAME)); + $res = $db->queryDirect(sprintf("SELECT searchname, id from releases where consoleinfoid IS NULL and categoryid in ( select id from category where parentID = %d ) ORDER BY postdate DESC LIMIT 100", Category::CAT_PARENT_GAME)); if ( $db->getNumRows($res) > 0) { if ($this->echooutput) @@ -555,16 +555,16 @@ class Console } else { - $gameId = $gameCheck["ID"]; + $gameId = $gameCheck["id"]; } //update release - $db->queryExec(sprintf("update releases SET consoleinfoID = %d WHERE ID = %d", $gameId, $arr["ID"])); + $db->queryExec(sprintf("update releases SET consoleinfoid = %d WHERE id = %d", $gameId, $arr["id"])); } else { //could not parse release title - $db->queryExec(sprintf("update releases SET consoleinfoID = %d WHERE ID = %d", -2, $arr["ID"])); + $db->queryExec(sprintf("update releases SET consoleinfoid = %d WHERE id = %d", -2, $arr["id"])); } } } @@ -624,7 +624,7 @@ class Console $result['release'] = $releasename; array_map("trim", $result); //make sure we got a title and platform otherwise the resulting lookup will probably be shit - //other option is to pass the $release->categoryID here if we dont find a platform but that would require an extra lookup to determine the name + //other option is to pass the $release->categoryid here if we dont find a platform but that would require an extra lookup to determine the name //in either case we should have a title at the minimum return (isset($result['title']) && !empty($result['title']) && isset($result['platform'])) ? $result : false; } diff --git a/lib/copy_this/www/lib/content.php b/lib/copy_this/www/lib/content.php index 6975b571b..0727348f7 100644 --- a/lib/copy_this/www/lib/content.php +++ b/lib/copy_this/www/lib/content.php @@ -80,7 +80,7 @@ class Contents } /** - * Get a content row by its ID. + * Get a content row by its id. */ public function getByID($id, $role) { diff --git a/lib/copy_this/www/lib/episode.php b/lib/copy_this/www/lib/episode.php index c579965bb..00d5d0f59 100644 --- a/lib/copy_this/www/lib/episode.php +++ b/lib/copy_this/www/lib/episode.php @@ -7,12 +7,12 @@ require_once(WWW_DIR."/lib/framework/db.php"); class Episode { /** - * Get an episodeinfo row by ID. + * Get an episodeinfo row by id. */ public function getEpisodeInfoByID($episodeinfoID) { $db = new DB(); - return $db->queryOneRow(sprintf('SELECT * FROM episodeinfo WHERE ID = %d', $episodeinfoID)); + return $db->queryOneRow(sprintf('SELECT * FROM episodeinfo WHERE id = %d', $episodeinfoID)); } /** diff --git a/lib/copy_this/www/lib/forum.php b/lib/copy_this/www/lib/forum.php index 8d8c12d9b..72b7dcac5 100644 --- a/lib/copy_this/www/lib/forum.php +++ b/lib/copy_this/www/lib/forum.php @@ -22,7 +22,7 @@ class Forum if ($par == false) return -1; - $db->queryExec(sprintf("update forumpost set replies = replies + 1, updateddate = now() where ID = %d", $parentid)); + $db->queryExec(sprintf("update forumpost set replies = replies + 1, updateddate = now() where id = %d", $parentid)); } $db->queryInsert(sprintf("INSERT INTO `forumpost` (`forumID`,`parentID`,`userID`,`subject`,`message`, `locked`, `sticky`, `replies`, `createddate`, `updateddate`) VALUES ( 1, %d, %d, %s, %s, %d, %d, %d,NOW(), NOW())", @@ -35,7 +35,7 @@ class Forum public function getParent($parent) { $db = new DB(); - return $db->queryOneRow(sprintf(" SELECT forumpost.*, users.username from forumpost left outer join users on users.ID = forumpost.userID where forumpost.ID = %d ", $parent)); + return $db->queryOneRow(sprintf(" SELECT forumpost.*, users.username from forumpost left outer join users on users.id = forumpost.userID where forumpost.id = %d ", $parent)); } /** @@ -44,7 +44,7 @@ class Forum public function getRecentPosts($limit) { $db = new DB(); - return $db->query(sprintf("select forumpost.*, users.username from forumpost join (select case when parentID = 0 then ID else parentID end as ID, max(createddate) from forumpost group by case when parentID = 0 then ID else parentID end order by max(createddate) desc) x on x.ID = forumpost.ID inner join users on userID = users.ID limit %d", $limit)); + return $db->query(sprintf("select forumpost.*, users.username from forumpost join (select case when parentID = 0 then id else parentID end as id, max(createddate) from forumpost group by case when parentID = 0 then id else parentID end order by max(createddate) desc) x on x.id = forumpost.id inner join users on userID = users.id limit %d", $limit)); } @@ -54,16 +54,16 @@ class Forum public function getPosts($parent) { $db = new DB(); - return $db->query(sprintf(" SELECT forumpost.*, CASE WHEN role=%d THEN 1 ELSE 0 END AS 'isadmin', users.username from forumpost left outer join users on users.ID = forumpost.userID where forumpost.ID = %d or parentID = %d order by createddate asc limit 250", Users::ROLE_ADMIN, $parent, $parent)); + return $db->query(sprintf(" SELECT forumpost.*, CASE WHEN role=%d THEN 1 ELSE 0 END AS 'isadmin', users.username from forumpost left outer join users on users.id = forumpost.userID where forumpost.id = %d or parentID = %d order by createddate asc limit 250", Users::ROLE_ADMIN, $parent, $parent)); } /** - * Get a forumpost by its ID. + * Get a forumpost by its id. */ public function getPost($id) { $db = new DB(); - return $db->queryOneRow(sprintf(" SELECT * from forumpost where ID = %d", $id)); + return $db->queryOneRow(sprintf(" SELECT * from forumpost where id = %d", $id)); } /** @@ -72,7 +72,7 @@ class Forum public function getBrowseCount() { $db = new DB(); - $res = $db->queryOneRow(sprintf("select count(ID) as num from forumpost where parentID = 0")); + $res = $db->queryOneRow(sprintf("select count(id) as num from forumpost where parentID = 0")); return $res["num"]; } @@ -88,7 +88,7 @@ class Forum else $limit = " LIMIT ".$start.",".$num; - return $db->query(sprintf(" SELECT forumpost.*, users.username from forumpost left outer join users on users.ID = forumpost.userID where parentID = 0 order by updateddate desc".$limit )); + return $db->query(sprintf(" SELECT forumpost.*, users.username from forumpost left outer join users on users.id = forumpost.userID where parentID = 0 order by updateddate desc".$limit )); } /** @@ -97,7 +97,7 @@ class Forum public function deleteParent($parent) { $db = new DB(); - $db->queryExec(sprintf("DELETE from forumpost where ID = %d or parentID = %d", $parent, $parent)); + $db->queryExec(sprintf("DELETE from forumpost where id = %d or parentID = %d", $parent, $parent)); } /** @@ -112,7 +112,7 @@ class Forum if ($post["parentID"] == "0") $this->deleteParent($id); else - $db->queryExec(sprintf("DELETE from forumpost where ID = %d", $id)); + $db->queryExec(sprintf("DELETE from forumpost where id = %d", $id)); } } @@ -131,7 +131,7 @@ class Forum public function getCountForUser($uid) { $db = new DB(); - $res = $db->queryOneRow(sprintf("select count(ID) as num from forumpost where userID = %d", $uid)); + $res = $db->queryOneRow(sprintf("select count(id) as num from forumpost where userID = %d", $uid)); return $res["num"]; } @@ -147,6 +147,6 @@ class Forum else $limit = " LIMIT ".$start.",".$num; - return $db->query(sprintf(" SELECT forumpost.*, users.username FROM forumpost LEFT OUTER JOIN users ON users.ID = forumpost.userID where userID = %d order by forumpost.createddate desc ".$limit, $uid)); + return $db->query(sprintf(" SELECT forumpost.*, users.username FROM forumpost LEFT OUTER JOIN users ON users.id = forumpost.userID where userID = %d order by forumpost.createddate desc ".$limit, $uid)); } } \ No newline at end of file diff --git a/lib/copy_this/www/lib/framework/basepage.php b/lib/copy_this/www/lib/framework/basepage.php index 1112cb991..b8d9e3eb9 100644 --- a/lib/copy_this/www/lib/framework/basepage.php +++ b/lib/copy_this/www/lib/framework/basepage.php @@ -103,7 +103,7 @@ class BasePage //update lastlogin every 15 mins if (strtotime($this->userdata['now'])-900 > strtotime($this->userdata['lastlogin'])) - $users->updateSiteAccessed($this->userdata['ID']); + $users->updateSiteAccessed($this->userdata['id']); $this->smarty->assign('userdata',$this->userdata); $this->smarty->assign('loggedin',"true"); diff --git a/lib/copy_this/www/lib/genres.php b/lib/copy_this/www/lib/genres.php index 50843c79a..d97f14729 100644 --- a/lib/copy_this/www/lib/genres.php +++ b/lib/copy_this/www/lib/genres.php @@ -48,19 +48,19 @@ class Genres FROM genres g INNER JOIN (SELECT DISTINCT genreID FROM musicinfo) x - ON x.genreID = g.ID %1\$s + ON x.genreID = g.id %1\$s UNION SELECT g.* FROM genres g INNER JOIN (SELECT DISTINCT genreID FROM consoleinfo) x - ON x.genreID = g.ID %1\$s + ON x.genreID = g.id %1\$s UNION SELECT g.* FROM genres g INNER JOIN (SELECT DISTINCT genre_id FROM gamesinfo) x - ON x.genre_id = g.ID %1\$s + ON x.genre_id = g.id %1\$s ORDER BY title", $typesql ); @@ -92,23 +92,23 @@ class Genres FROM genres g INNER JOIN (SELECT DISTINCT genreID FROM musicinfo) x - ON x.genreID = g.ID %1\$s + ON x.genreID = g.id %1\$s + SELECT COUNT(*) AS num FROM genres g INNER JOIN (SELECT DISTINCT genreID FROM consoleinfo) y - ON y.genreID = g.ID %1\$s + ON y.genreID = g.id %1\$s + SELECT COUNT(*) AS num FROM genres g INNER JOIN (SELECT DISTINCT genre_id FROM gamesinfo) x - ON x.genre_id = g.ID %1\$s", + ON x.genre_id = g.id %1\$s", $typesql ); else - $sql = sprintf("SELECT COUNT(g.ID) AS num FROM genres g WHERE 1 %s ORDER BY g.title", $typesql); + $sql = sprintf("SELECT COUNT(g.id) AS num FROM genres g WHERE 1 %s ORDER BY g.title", $typesql); $res = $this->pdo->queryOneRow($sql); @@ -117,16 +117,16 @@ class Genres public function getById($id) { - return $this->pdo->queryOneRow(sprintf("SELECT * FROM genres WHERE ID = %d", $id)); + return $this->pdo->queryOneRow(sprintf("SELECT * FROM genres WHERE id = %d", $id)); } public function update($id, $disabled) { - return $this->pdo->queryExec(sprintf("UPDATE genres SET disabled = %d WHERE ID = %d", $disabled, $id)); + return $this->pdo->queryExec(sprintf("UPDATE genres SET disabled = %d WHERE id = %d", $disabled, $id)); } public function getDisabledIDs() { - return $this->pdo->query("SELECT ID FROM genres WHERE disabled = 1"); + return $this->pdo->query("SELECT id FROM genres WHERE disabled = 1"); } } \ No newline at end of file diff --git a/lib/copy_this/www/lib/groups.php b/lib/copy_this/www/lib/groups.php index 6107c9336..6f4d7d217 100644 --- a/lib/copy_this/www/lib/groups.php +++ b/lib/copy_this/www/lib/groups.php @@ -62,7 +62,7 @@ class Groups return $this->pdo->query(sprintf("SELECT groups.*, COALESCE(rel.num, 0) AS num_releases FROM groups LEFT OUTER JOIN - ( SELECT groupID, COUNT(ID) AS num FROM releases group by groupID ) rel ON rel.groupID = groups.ID + ( SELECT groupid, COUNT(id) AS num FROM releases group by groupid ) rel ON rel.groupid = groups.id ORDER BY %s", $orderby ) ); @@ -86,13 +86,13 @@ class Groups } /** - * Get a group row by its ID. + * Get a group row by its id. */ public function getByID($id) { - return $this->pdo->queryOneRow(sprintf("select * from groups where ID = %d ", $id)); + return $this->pdo->queryOneRow(sprintf("select * from groups where id = %d ", $id)); } /** @@ -115,16 +115,16 @@ class Groups } /** - * Get a group name using its ID. + * Get a group name using its id. * - * @param int|string $id The group ID. + * @param int|string $id The group id. * * @return string Empty string on failure, groupName on success. */ public function getByNameByID($id) { - $res = $this->pdo->queryOneRow(sprintf("SELECT name FROM groups WHERE ID = %d ", $id)); + $res = $this->pdo->queryOneRow(sprintf("SELECT name FROM groups WHERE id = %d ", $id)); return ($res === false ? '' : $res["name"]); } @@ -133,13 +133,13 @@ class Groups * * @param string $name The group name. * - * @return string Empty string on failure, groupID on success. + * @return string Empty string on failure, groupid on success. */ public function getIDByName($name) { - $res = $this->pdo->queryOneRow(sprintf("SELECT ID FROM groups WHERE name = %s", $this->pdo->escapeString($name))); - return ($res === false ? '' : $res["ID"]); + $res = $this->pdo->queryOneRow(sprintf("SELECT id FROM groups WHERE name = %s", $this->pdo->escapeString($name))); + return ($res === false ? '' : $res["id"]); } /** @@ -156,7 +156,7 @@ class Groups if ($activeonly == true) $grpsql .= "and active=1 "; - $res = $this->pdo->queryOneRow(sprintf("select count(ID) as num from groups where 1=1 %s", $grpsql)); + $res = $this->pdo->queryOneRow(sprintf("select count(id) as num from groups where 1=1 %s", $grpsql)); return $res["num"]; } @@ -182,8 +182,8 @@ class Groups FROM groups LEFT OUTER JOIN ( - SELECT groupID, COUNT(ID) AS num FROM releases group by groupID - ) rel ON rel.groupID = groups.ID WHERE 1=1 %s ORDER BY groups.name " . $limit, $grpsql + SELECT groupid, COUNT(id) AS num FROM releases group by groupid + ) rel ON rel.groupid = groups.id WHERE 1=1 %s ORDER BY groups.name " . $limit, $grpsql ); return $this->pdo->query($sql); @@ -296,13 +296,13 @@ class Groups public function delete($id) { - return $this->pdo->queryExec(sprintf("DELETE from groups where ID = %d", $id)); + return $this->pdo->queryExec(sprintf("DELETE from groups where id = %d", $id)); } /** * Reset a group. * - * @param string|int $id The group ID. + * @param string|int $id The group id. * * @return bool */ @@ -383,10 +383,10 @@ class Groups foreach ($groups AS $group) { if (preg_match($regfilter, $group['group']) > 0) { - $res = $this->pdo->queryOneRow(sprintf("SELECT ID FROM groups WHERE name = %s ", $this->pdo->escapeString($group['group']))); + $res = $this->pdo->queryOneRow(sprintf("SELECT id FROM groups WHERE name = %s ", $this->pdo->escapeString($group['group']))); if ($res) { - $this->pdo->queryExec(sprintf("update groups SET active = %d where ID = %d", $active, $res["ID"])); + $this->pdo->queryExec(sprintf("update groups SET active = %d where id = %d", $active, $res["id"])); $ret[] = array('group' => $group['group'], 'msg' => 'Updated'); } else { $desc = ""; @@ -408,7 +408,7 @@ class Groups */ public function updateGroupStatus($id, $status = 0) { - $this->pdo->queryExec(sprintf("UPDATE groups SET active = %d WHERE ID = %d", $status, $id)); + $this->pdo->queryExec(sprintf("UPDATE groups SET active = %d WHERE id = %d", $status, $id)); return "Group $id has been " . (($status == 0) ? 'deactivated' : 'activated') . '.'; } @@ -420,7 +420,7 @@ class Groups */ public function updateBackfillStatus($id, $status = 0) { - $this->pdo->queryExec(sprintf("UPDATE groups SET backfill = %d WHERE ID = %d", $status, $id)); + $this->pdo->queryExec(sprintf("UPDATE groups SET backfill = %d WHERE id = %d", $status, $id)); return "Group $id has been " . (($status == 0) ? 'deactivated' : 'activated') . '.'; } @@ -450,7 +450,7 @@ class Groups * If TPG is on, try to create new tables for the group_id, if we fail, log the error and exit. * * @param bool $tpgSetting false, tpg is off in site setting, true tpg is on in site setting. - * @param int $groupID ID of the group. + * @param int $groupID id of the group. * * @return array The table names. */ @@ -475,7 +475,7 @@ class Groups } if ($this->createNewTPGTables($groupID) === false && NN_ECHOCLI) { - exit('There is a problem creating new TPG tables for this group ID: ' . $groupID . PHP_EOL); + exit('There is a problem creating new TPG tables for this group id: ' . $groupID . PHP_EOL); } $groupEnding = '_' . $groupID; @@ -496,7 +496,7 @@ class Groups */ public function getActiveIDs() { - return $this->pdo->query("SELECT ID FROM groups WHERE active = 1 ORDER BY name"); + return $this->pdo->query("SELECT id FROM groups WHERE active = 1 ORDER BY name"); } /** @@ -541,7 +541,7 @@ class Groups /** * Purge a single group or all groups. * - * @param int|string|bool $id The group ID. If false, purge all groups. + * @param int|string|bool $id The group id. If false, purge all groups. */ public function purge($id = false) { @@ -552,7 +552,7 @@ class Groups } $releaseArray = $this->pdo->queryDirect( - sprintf("SELECT ID, guid FROM releases %s", ($id === false ? '' : 'WHERE groupID = ' . $id)) + sprintf("SELECT id, guid FROM releases %s", ($id === false ? '' : 'WHERE groupid = ' . $id)) ); if ($releaseArray instanceof \Traversable) { @@ -560,7 +560,7 @@ class Groups $nzb = new \NZB($this->pdo); $releaseImage = new \ReleaseImage($this->pdo); foreach ($releaseArray as $release) { - $releases->deleteSingle(['g' => $release['guid'], 'i' => $release['ID']], $nzb, $releaseImage); + $releases->deleteSingle(['g' => $release['guid'], 'i' => $release['id']], $nzb, $releaseImage); } } } @@ -574,7 +574,7 @@ class Groups { $res = $this->pdo->queryOneRow( sprintf(" - SELECT COUNT(ID) AS num + SELECT COUNT(id) AS num FROM groups WHERE 1 = 1 %s AND active = 1", @@ -600,7 +600,7 @@ class Groups { $res = $this->pdo->queryOneRow( sprintf(" - SELECT COUNT(ID) AS num + SELECT COUNT(id) AS num FROM groups WHERE 1 = 1 %s AND active = 0", @@ -631,11 +631,11 @@ class Groups SELECT groups.*, COALESCE(rel.num, 0) AS num_releases FROM groups LEFT OUTER JOIN - (SELECT groupID, COUNT(ID) AS num + (SELECT groupid, COUNT(id) AS num FROM releases - GROUP BY groupID + GROUP BY groupid ) rel - ON rel.groupID = groups.ID + ON rel.groupid = groups.id WHERE 1 = 1 %s AND active = 1 ORDER BY groups.name " . ($start === false ? '' : " LIMIT " . $num . " OFFSET " .$start), @@ -665,11 +665,11 @@ class Groups SELECT groups.*, COALESCE(rel.num, 0) AS num_releases FROM groups LEFT OUTER JOIN - (SELECT groupID, COUNT(ID) AS num + (SELECT groupid, COUNT(id) AS num FROM releases - GROUP BY groupID + GROUP BY groupid ) rel - ON rel.groupID = groups.ID + ON rel.groupid = groups.id WHERE 1 = 1 %s AND active = 0 ORDER BY groups.name " . ($start === false ? '' : " LIMIT ".$num." OFFSET ".$start), diff --git a/lib/copy_this/www/lib/menu.php b/lib/copy_this/www/lib/menu.php index fd3669325..b88ff7f16 100644 --- a/lib/copy_this/www/lib/menu.php +++ b/lib/copy_this/www/lib/menu.php @@ -51,12 +51,12 @@ class Menu } /** - * Get a menu row by its ID. + * Get a menu row by its id. */ public function getById($id) { $db = new DB(); - return $db->queryOneRow(sprintf("select * from menu where ID = %d", $id)); + return $db->queryOneRow(sprintf("select * from menu where id = %d", $id)); } /** @@ -65,7 +65,7 @@ class Menu public function delete($id) { $db = new DB(); - return $db->queryExec(sprintf("DELETE from menu where ID = %d", $id)); + return $db->queryExec(sprintf("DELETE from menu where id = %d", $id)); } /** @@ -84,6 +84,6 @@ class Menu public function update($menu) { $db = new DB(); - return $db->queryExec(sprintf("update menu set href = %s, title = %s, tooltip = %s, role = %d, ordinal = %d, menueval = %s, newwindow=%d where ID = %d ", $db->escapeString($menu["href"]), $db->escapeString($menu["title"]), $db->escapeString($menu["tooltip"]), $menu["role"] , $menu["ordinal"], $db->escapeString($menu["menueval"]), $menu["newwindow"], $menu["id"] )); + return $db->queryExec(sprintf("update menu set href = %s, title = %s, tooltip = %s, role = %d, ordinal = %d, menueval = %s, newwindow=%d where id = %d ", $db->escapeString($menu["href"]), $db->escapeString($menu["title"]), $db->escapeString($menu["tooltip"]), $menu["role"] , $menu["ordinal"], $db->escapeString($menu["menueval"]), $menu["newwindow"], $menu["id"] )); } } \ No newline at end of file diff --git a/lib/copy_this/www/lib/movie.php b/lib/copy_this/www/lib/movie.php index ce91f7038..344ffe13b 100644 --- a/lib/copy_this/www/lib/movie.php +++ b/lib/copy_this/www/lib/movie.php @@ -34,12 +34,12 @@ class Movie } /** - * Get a movieinfo row by its imdbID. + * Get a movieinfo row by its imdbid. */ public function getMovieInfo($imdbId) { $db = new DB(); - return $db->queryOneRow(sprintf("SELECT * FROM movieinfo where imdbID = %d", $imdbId)); + return $db->queryOneRow(sprintf("SELECT * FROM movieinfo where imdbid = %d", $imdbId)); } /** @@ -49,19 +49,19 @@ class Movie { $db = new DB(); $allids = implode(",", array_filter($imdbIds)); - $sql = sprintf("SELECT DISTINCT movieinfo.*, releases.imdbID AS relimdb FROM movieinfo LEFT OUTER JOIN releases ON releases.imdbID = movieinfo.imdbID WHERE movieinfo.imdbID IN (%s)", $allids); + $sql = sprintf("SELECT DISTINCT movieinfo.*, releases.imdbid AS relimdb FROM movieinfo LEFT OUTER JOIN releases ON releases.imdbid = movieinfo.imdbid WHERE movieinfo.imdbid IN (%s)", $allids); return $db->query($sql); } /** - * Delete movieinfo row by its imdbID. + * Delete movieinfo row by its imdbid. */ public function delete($imdbId) { $db = new DB(); @unlink($this->imgSavePath.$imdbId.'-cover.jpg'); @unlink($this->imgSavePath.$imdbId.'-backdrop.jpg'); - return $db->queryOneRow(sprintf("delete FROM movieinfo where imdbID = %d", $imdbId)); + return $db->queryOneRow(sprintf("delete FROM movieinfo where imdbid = %d", $imdbId)); } /** @@ -105,7 +105,7 @@ class Movie if ($moviename != "") $rsql .= sprintf("and movieinfo.title like %s ", $db->escapeString("%".$moviename."%")); - $res = $db->queryOneRow(sprintf("select count(ID) as num from movieinfo where 1=1 %s ", $rsql)); + $res = $db->queryOneRow(sprintf("select count(id) as num from movieinfo where 1=1 %s ", $rsql)); return $res["num"]; } @@ -132,14 +132,14 @@ class Movie $children = $categ->getChildren($category); $chlist = "-99"; foreach ($children as $child) - $chlist.=", ".$child["ID"]; + $chlist.=", ".$child["id"]; if ($chlist != "-99") - $catsrch .= " r.categoryID in (".$chlist.") or "; + $catsrch .= " r.categoryid in (".$chlist.") or "; } else { - $catsrch .= sprintf(" r.categoryID = %d or ", $category); + $catsrch .= sprintf(" r.categoryid = %d or ", $category); } } } @@ -155,9 +155,9 @@ class Movie $exccatlist = ""; if (count($excludedcats) > 0) - $exccatlist = " and r.categoryID not in (".implode(",", $excludedcats).")"; + $exccatlist = " and r.categoryid not in (".implode(",", $excludedcats).")"; - $sql = sprintf("select count(distinct r.imdbID) as num from releases r inner join movieinfo m on m.imdbID = r.imdbID and m.title != '' where r.passwordstatus <= (select value from site where setting='showpasswordedrelease') and %s %s %s %s ", $browseby, $catsrch, $maxage, $exccatlist); + $sql = sprintf("select count(distinct r.imdbid) as num from releases r inner join movieinfo m on m.imdbid = r.imdbid and m.title != '' where r.passwordstatus <= (select value from site where setting='showpasswordedrelease') and %s %s %s %s ", $browseby, $catsrch, $maxage, $exccatlist); $res = $db->queryOneRow($sql, true); return $res["num"]; } @@ -190,14 +190,14 @@ class Movie $children = $categ->getChildren($category); $chlist = "-99"; foreach ($children as $child) - $chlist.=", ".$child["ID"]; + $chlist.=", ".$child["id"]; if ($chlist != "-99") - $catsrch .= " r.categoryID in (".$chlist.") or "; + $catsrch .= " r.categoryid in (".$chlist.") or "; } else { - $catsrch .= sprintf(" r.categoryID = %d or ", $category); + $catsrch .= sprintf(" r.categoryid = %d or ", $category); } } } @@ -212,10 +212,10 @@ class Movie $exccatlist = ""; if (count($excludedcats) > 0) - $exccatlist = " and r.categoryID not in (".implode(",", $excludedcats).")"; + $exccatlist = " and r.categoryid not in (".implode(",", $excludedcats).")"; $order = $this->getMovieOrder($orderby); - $sql = sprintf(" SELECT r.imdbID, max(r.postdate) as postdate, m.* from releases r inner join movieinfo m on m.imdbID = r.imdbID where r.passwordstatus <= (select value from site where setting='showpasswordedrelease') and m.title != '' and r.imdbID != 0000000 and %s %s %s %s group by r.imdbID order by %s %s".$limit, $browseby, $catsrch, $maxagesql, $exccatlist, $order[0], $order[1]); + $sql = sprintf(" SELECT r.imdbid, max(r.postdate) as postdate, m.* from releases r inner join movieinfo m on m.imdbid = r.imdbid where r.passwordstatus <= (select value from site where setting='showpasswordedrelease') and m.title != '' and r.imdbid != 0000000 and %s %s %s %s group by r.imdbid order by %s %s".$limit, $browseby, $catsrch, $maxagesql, $exccatlist, $order[0], $order[1]); $rows = $db->query($sql, true); // @@ -223,7 +223,7 @@ class Movie // $imdbds = ""; foreach ($rows as $row) - $imdbds .= $row["imdbID"]. ", "; + $imdbds .= $row["imdbid"]. ", "; if (strlen($imdbds) > 0) { @@ -232,7 +232,7 @@ class Movie // // get all releases matching these ids // - $sql = sprintf("select r.*, releasenfo.ID as nfoID, groups.name as grpname, concat(cp.title, ' > ', c.title) as categoryName from releases r left outer join category c on c.ID = r.categoryID left outer join category cp on cp.ID = c.parentID left outer join releasenfo on releasenfo.releaseID = r.ID left outer join groups on groups.ID = r.groupID where imdbID in (%s) and %s %s %s order by r.postdate desc", $imdbds, $catsrch, $maxagesql, $exccatlist); + $sql = sprintf("select r.*, releasenfo.id as nfoID, groups.name as grpname, concat(cp.title, ' > ', c.title) as categoryName from releases r left outer join category c on c.id = r.categoryid left outer join category cp on cp.id = c.parentID left outer join releasenfo on releasenfo.releaseid = r.id left outer join groups on groups.id = r.groupid where imdbid in (%s) and %s %s %s order by r.postdate desc", $imdbds, $catsrch, $maxagesql, $exccatlist); $allrows = $db->query($sql, true); $arr = array(); @@ -241,21 +241,21 @@ class Movie // foreach ($allrows as &$allrow) { - $arr[$allrow["imdbID"]]["ID"] = (isset($arr[$allrow["imdbID"]]["ID"]) ? $arr[$allrow["imdbID"]]["ID"] : "") . $allrow["ID"] . ","; - $arr[$allrow["imdbID"]]["rarinnerfilecount"] = (isset($arr[$allrow["imdbID"]]["rarinnerfilecount"]) ? $arr[$allrow["imdbID"]]["rarinnerfilecount"] : "") . $allrow["rarinnerfilecount"] . ","; - $arr[$allrow["imdbID"]]["haspreview"] = (isset($arr[$allrow["imdbID"]]["haspreview"]) ? $arr[$allrow["imdbID"]]["haspreview"] : "") . $allrow["haspreview"] . ","; - $arr[$allrow["imdbID"]]["passwordstatus"] = (isset($arr[$allrow["imdbID"]]["passwordstatus"]) ? $arr[$allrow["imdbID"]]["passwordstatus"] : "") . $allrow["passwordstatus"] . ","; - $arr[$allrow["imdbID"]]["guid"] = (isset($arr[$allrow["imdbID"]]["guid"]) ? $arr[$allrow["imdbID"]]["guid"] : "") . $allrow["guid"] . ","; - $arr[$allrow["imdbID"]]["nfoID"] = (isset($arr[$allrow["imdbID"]]["nfoID"]) ? $arr[$allrow["imdbID"]]["nfoID"] : "") . $allrow["nfoID"] . ","; - $arr[$allrow["imdbID"]]["grpname"] = (isset($arr[$allrow["imdbID"]]["grpname"]) ? $arr[$allrow["imdbID"]]["grpname"] : "") . $allrow["grpname"] . ","; - $arr[$allrow["imdbID"]]["searchname"] = (isset($arr[$allrow["imdbID"]]["searchname"]) ? $arr[$allrow["imdbID"]]["searchname"] : "") . $allrow["searchname"] . "#"; - $arr[$allrow["imdbID"]]["postdate"] = (isset($arr[$allrow["imdbID"]]["postdate"]) ? $arr[$allrow["imdbID"]]["postdate"] : "") . $allrow["postdate"] . ","; - $arr[$allrow["imdbID"]]["size"] = (isset($arr[$allrow["imdbID"]]["size"]) ? $arr[$allrow["imdbID"]]["size"] : "") . $allrow["size"] . ","; - $arr[$allrow["imdbID"]]["totalpart"] = (isset($arr[$allrow["imdbID"]]["totalpart"]) ? $arr[$allrow["imdbID"]]["totalpart"] : "") . $allrow["totalpart"] . ","; - $arr[$allrow["imdbID"]]["comments"] = (isset($arr[$allrow["imdbID"]]["comments"]) ? $arr[$allrow["imdbID"]]["comments"] : "") . $allrow["comments"] . ","; - $arr[$allrow["imdbID"]]["grabs"] = (isset($arr[$allrow["imdbID"]]["grabs"]) ? $arr[$allrow["imdbID"]]["grabs"] : "") . $allrow["grabs"] . ","; - $arr[$allrow["imdbID"]]["categoryID"] = (isset($arr[$allrow["imdbID"]]["categoryID"]) ? $arr[$allrow["imdbID"]]["categoryID"] : "") . $allrow["categoryID"] . ","; - $arr[$allrow["imdbID"]]["categoryName"] = (isset($arr[$allrow["imdbID"]]["categoryName"]) ? $arr[$allrow["imdbID"]]["categoryName"] : "") . $allrow["categoryName"] . ","; + $arr[$allrow["imdbid"]]["id"] = (isset($arr[$allrow["imdbid"]]["id"]) ? $arr[$allrow["imdbid"]]["id"] : "") . $allrow["id"] . ","; + $arr[$allrow["imdbid"]]["rarinnerfilecount"] = (isset($arr[$allrow["imdbid"]]["rarinnerfilecount"]) ? $arr[$allrow["imdbid"]]["rarinnerfilecount"] : "") . $allrow["rarinnerfilecount"] . ","; + $arr[$allrow["imdbid"]]["haspreview"] = (isset($arr[$allrow["imdbid"]]["haspreview"]) ? $arr[$allrow["imdbid"]]["haspreview"] : "") . $allrow["haspreview"] . ","; + $arr[$allrow["imdbid"]]["passwordstatus"] = (isset($arr[$allrow["imdbid"]]["passwordstatus"]) ? $arr[$allrow["imdbid"]]["passwordstatus"] : "") . $allrow["passwordstatus"] . ","; + $arr[$allrow["imdbid"]]["guid"] = (isset($arr[$allrow["imdbid"]]["guid"]) ? $arr[$allrow["imdbid"]]["guid"] : "") . $allrow["guid"] . ","; + $arr[$allrow["imdbid"]]["nfoID"] = (isset($arr[$allrow["imdbid"]]["nfoID"]) ? $arr[$allrow["imdbid"]]["nfoID"] : "") . $allrow["nfoID"] . ","; + $arr[$allrow["imdbid"]]["grpname"] = (isset($arr[$allrow["imdbid"]]["grpname"]) ? $arr[$allrow["imdbid"]]["grpname"] : "") . $allrow["grpname"] . ","; + $arr[$allrow["imdbid"]]["searchname"] = (isset($arr[$allrow["imdbid"]]["searchname"]) ? $arr[$allrow["imdbid"]]["searchname"] : "") . $allrow["searchname"] . "#"; + $arr[$allrow["imdbid"]]["postdate"] = (isset($arr[$allrow["imdbid"]]["postdate"]) ? $arr[$allrow["imdbid"]]["postdate"] : "") . $allrow["postdate"] . ","; + $arr[$allrow["imdbid"]]["size"] = (isset($arr[$allrow["imdbid"]]["size"]) ? $arr[$allrow["imdbid"]]["size"] : "") . $allrow["size"] . ","; + $arr[$allrow["imdbid"]]["totalpart"] = (isset($arr[$allrow["imdbid"]]["totalpart"]) ? $arr[$allrow["imdbid"]]["totalpart"] : "") . $allrow["totalpart"] . ","; + $arr[$allrow["imdbid"]]["comments"] = (isset($arr[$allrow["imdbid"]]["comments"]) ? $arr[$allrow["imdbid"]]["comments"] : "") . $allrow["comments"] . ","; + $arr[$allrow["imdbid"]]["grabs"] = (isset($arr[$allrow["imdbid"]]["grabs"]) ? $arr[$allrow["imdbid"]]["grabs"] : "") . $allrow["grabs"] . ","; + $arr[$allrow["imdbid"]]["categoryid"] = (isset($arr[$allrow["imdbid"]]["categoryid"]) ? $arr[$allrow["imdbid"]]["categoryid"] : "") . $allrow["categoryid"] . ","; + $arr[$allrow["imdbid"]]["categoryName"] = (isset($arr[$allrow["imdbid"]]["categoryName"]) ? $arr[$allrow["imdbid"]]["categoryName"] : "") . $allrow["categoryName"] . ","; } // @@ -263,21 +263,21 @@ class Movie // foreach ($rows as &$row) { - $row["grp_release_id"] = substr($arr[$row["imdbID"]]["ID"], 0, -1); - $row["grp_rarinnerfilecount"] = substr($arr[$row["imdbID"]]["rarinnerfilecount"], 0, -1); - $row["grp_haspreview"] = substr($arr[$row["imdbID"]]["haspreview"], 0, -1); - $row["grp_release_password"] = substr($arr[$row["imdbID"]]["passwordstatus"], 0, -1); - $row["grp_release_guid"] = substr($arr[$row["imdbID"]]["guid"], 0, -1); - $row["grp_release_nfoID"] = substr($arr[$row["imdbID"]]["nfoID"], 0, -1); - $row["grp_release_grpname"] = substr($arr[$row["imdbID"]]["grpname"], 0, -1); - $row["grp_release_name"] = substr($arr[$row["imdbID"]]["searchname"], 0, -1); - $row["grp_release_postdate"] = substr($arr[$row["imdbID"]]["postdate"], 0, -1); - $row["grp_release_size"] = substr($arr[$row["imdbID"]]["size"], 0, -1); - $row["grp_release_totalparts"] = substr($arr[$row["imdbID"]]["totalpart"], 0, -1); - $row["grp_release_comments"] = substr($arr[$row["imdbID"]]["comments"], 0, -1); - $row["grp_release_grabs"] = substr($arr[$row["imdbID"]]["grabs"], 0, -1); - $row["grp_release_categoryID"] = substr($arr[$row["imdbID"]]["categoryID"], 0, -1); - $row["grp_release_categoryName"] = substr($arr[$row["imdbID"]]["categoryName"], 0, -1); + $row["grp_release_id"] = substr($arr[$row["imdbid"]]["id"], 0, -1); + $row["grp_rarinnerfilecount"] = substr($arr[$row["imdbid"]]["rarinnerfilecount"], 0, -1); + $row["grp_haspreview"] = substr($arr[$row["imdbid"]]["haspreview"], 0, -1); + $row["grp_release_password"] = substr($arr[$row["imdbid"]]["passwordstatus"], 0, -1); + $row["grp_release_guid"] = substr($arr[$row["imdbid"]]["guid"], 0, -1); + $row["grp_release_nfoID"] = substr($arr[$row["imdbid"]]["nfoID"], 0, -1); + $row["grp_release_grpname"] = substr($arr[$row["imdbid"]]["grpname"], 0, -1); + $row["grp_release_name"] = substr($arr[$row["imdbid"]]["searchname"], 0, -1); + $row["grp_release_postdate"] = substr($arr[$row["imdbid"]]["postdate"], 0, -1); + $row["grp_release_size"] = substr($arr[$row["imdbid"]]["size"], 0, -1); + $row["grp_release_totalparts"] = substr($arr[$row["imdbid"]]["totalpart"], 0, -1); + $row["grp_release_comments"] = substr($arr[$row["imdbid"]]["comments"], 0, -1); + $row["grp_release_grabs"] = substr($arr[$row["imdbid"]]["grabs"], 0, -1); + $row["grp_release_categoryID"] = substr($arr[$row["imdbid"]]["categoryid"], 0, -1); + $row["grp_release_categoryName"] = substr($arr[$row["imdbid"]]["categoryName"], 0, -1); } } return $rows; @@ -340,7 +340,7 @@ class Movie $bbv = stripslashes($_REQUEST[$bb]); if ($bb == 'rating') { $bbv .= '.'; } if ($bb == 'imdb') { - $browseby .= "m.{$bb}ID = $bbv AND "; + $browseby .= "m.{$bb}id = $bbv AND "; } else { $browseby .= "m.$bb LIKE(".$db->escapeString('%'.$bbv.'%').") AND "; } @@ -375,7 +375,7 @@ class Movie { $db = new DB(); - $db->queryExec(sprintf("update movieinfo SET title=%s, tagline=%s, plot=%s, year=%s, rating=%s, genre=%s, director=%s, actors=%s, language=%s, cover=%d, backdrop=%d, updateddate=NOW() WHERE imdbID = %d", + $db->queryExec(sprintf("update movieinfo SET title=%s, tagline=%s, plot=%s, year=%s, rating=%s, genre=%s, director=%s, actors=%s, language=%s, cover=%d, backdrop=%d, updateddate=NOW() WHERE imdbid = %d", $db->escapeString($title), $db->escapeString($tagline), $db->escapeString($plot), $db->escapeString($year), $db->escapeString($rating), $db->escapeString($genre), $db->escapeString($director), $db->escapeString($actors), $db->escapeString($language), $cover, $backdrop, $id)); } @@ -495,11 +495,11 @@ class Movie $db = new DB(); $query = sprintf(" INSERT INTO movieinfo - (imdbID, tmdbID, title, rating, tagline, trailer, plot, year, genre, director, actors, language, cover, backdrop, createddate, updateddate) + (imdbid, tmdbID, title, rating, tagline, trailer, plot, year, genre, director, actors, language, cover, backdrop, createddate, updateddate) VALUES (%d, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %d, %d, NOW(), NOW()) ON DUPLICATE KEY UPDATE - imdbID=%d, tmdbID=%s, title=%s, rating=%s, tagline=%s, trailer=%s, plot=%s, year=%s, genre=%s, director=%s, actors=%s, language=%s, cover=%d, backdrop=%d, updateddate=NOW()", + imdbid=%d, tmdbID=%s, title=%s, rating=%s, tagline=%s, trailer=%s, plot=%s, year=%s, genre=%s, director=%s, actors=%s, language=%s, cover=%d, backdrop=%d, updateddate=NOW()", $mov['imdb_id'], $mov['tmdb_id'], $db->escapeString($mov['title']), $db->escapeString($mov['rating']), $db->escapeString($mov['tagline']), $db->escapeString($mov['trailer']), $db->escapeString($mov['plot']), $db->escapeString($mov['year']), $db->escapeString($mov['genre']), $db->escapeString($mov['director']), $db->escapeString($mov['actors']), $db->escapeString($mov['language']), $mov['cover'], $mov['backdrop'], $mov['imdb_id'], $mov['tmdb_id'], $db->escapeString($mov['title']), $db->escapeString($mov['rating']), $db->escapeString($mov['tagline']), $db->escapeString($mov['trailer']), $db->escapeString($mov['plot']), $db->escapeString($mov['year']), $db->escapeString($mov['genre']), $db->escapeString($mov['director']), $db->escapeString($mov['actors']), $db->escapeString($mov['language']), $mov['cover'], $mov['backdrop']); @@ -509,7 +509,7 @@ class Movie } /** - * Lookup a movie on tmdb by ID + * Lookup a movie on tmdb by id */ public function fetchTmdbProperties($id, $isImdbId=true) { @@ -671,7 +671,7 @@ class Movie $db = new DB(); $nfo = new Nfo(); - $res = $db->queryDirect(sprintf("SELECT searchname, ID from releases where imdbID IS NULL and categoryID in ( select ID from category where parentID = %d ) ORDER BY postdate DESC LIMIT 100", Category::CAT_PARENT_MOVIE)); + $res = $db->queryDirect(sprintf("SELECT searchname, id from releases where imdbid IS NULL and categoryid in ( select id from category where parentID = %d ) ORDER BY postdate DESC LIMIT 100", Category::CAT_PARENT_MOVIE)); if ($db->getNumRows($res) > 0) { if ($this->echooutput) @@ -680,14 +680,14 @@ class Movie while ($arr = $db->getAssocArray($res)) { $imdbID = false; - /* Preliminary IMDB ID Detection from NFO file */ + /* Preliminary IMDB id Detection from NFO file */ $rawnfo = ''; - if($nfo->getNfo($arr['ID'], $rawnfo)) + if($nfo->getNfo($arr['id'], $rawnfo)) $imdbID = $this->parseImdbFromNfo($rawnfo); if($imdbID !== false){ // Set IMDB (if found in nfo) and move along - $db->queryExec(sprintf("update releases set imdbID = %s where ID = %d", $db->escapeString($imdbID), $arr["ID"])); + $db->queryExec(sprintf("update releases set imdbid = %s where id = %d", $db->escapeString($imdbID), $arr["id"])); //check for existing movie entry $movCheck = $this->getMovieInfo($imdbID); if ($movCheck === false || (isset($movCheck['updateddate']) && (time() - strtotime($movCheck['updateddate'])) > 2592000)) @@ -713,7 +713,7 @@ class Movie if ($imdbId !== false) { //update release with imdb id - $db->queryExec(sprintf("update releases SET imdbID = %s WHERE ID = %d", $db->escapeString($imdbId), $arr["ID"])); + $db->queryExec(sprintf("update releases SET imdbid = %s WHERE id = %d", $db->escapeString($imdbId), $arr["id"])); //check for existing movie entry $movCheck = $this->getMovieInfo($imdbId); @@ -724,7 +724,7 @@ class Movie } else { //no imdb id found, set to all zeros so we dont process again - $db->queryExec(sprintf("update releases SET imdbID = %d WHERE ID = %d", 0, $arr["ID"])); + $db->queryExec(sprintf("update releases SET imdbid = %d WHERE id = %d", 0, $arr["id"])); } } else { @@ -734,7 +734,7 @@ class Movie } else { //no valid movie name found, set to all zeros so we dont process again - $db->queryExec(sprintf("update releases SET imdbID = %d WHERE ID = %d", 0, $arr["ID"])); + $db->queryExec(sprintf("update releases SET imdbid = %d WHERE id = %d", 0, $arr["id"])); } } } diff --git a/lib/copy_this/www/lib/music.php b/lib/copy_this/www/lib/music.php index 51a4c3da5..4add8e97f 100644 --- a/lib/copy_this/www/lib/music.php +++ b/lib/copy_this/www/lib/music.php @@ -30,12 +30,12 @@ class Music } /** - * Get musicinfo row by ID. + * Get musicinfo row by id. */ public function getMusicInfo($id) { $db = new DB(); - return $db->queryOneRow(sprintf("SELECT musicinfo.*, genres.title as genres FROM musicinfo left outer join genres on genres.ID = musicinfo.genreID where musicinfo.ID = %d ", $id)); + return $db->queryOneRow(sprintf("SELECT musicinfo.*, genres.title as genres FROM musicinfo left outer join genres on genres.id = musicinfo.genreID where musicinfo.id = %d ", $id)); } /** @@ -68,7 +68,7 @@ class Music public function getCount() { $db = new DB(); - $res = $db->queryOneRow("select count(ID) as num from musicinfo"); + $res = $db->queryOneRow("select count(id) as num from musicinfo"); return $res["num"]; } @@ -95,14 +95,14 @@ class Music $children = $categ->getChildren($category); $chlist = "-99"; foreach ($children as $child) - $chlist.=", ".$child["ID"]; + $chlist.=", ".$child["id"]; if ($chlist != "-99") - $catsrch .= " r.categoryID in (".$chlist.") or "; + $catsrch .= " r.categoryid in (".$chlist.") or "; } else { - $catsrch .= sprintf(" r.categoryID = %d or ", $category); + $catsrch .= sprintf(" r.categoryid = %d or ", $category); } } } @@ -116,9 +116,9 @@ class Music $exccatlist = ""; if (count($excludedcats) > 0) - $exccatlist = " and r.categoryID not in (".implode(",", $excludedcats).")"; + $exccatlist = " and r.categoryid not in (".implode(",", $excludedcats).")"; - $sql = sprintf("select count(r.ID) as num from releases r inner join musicinfo m on m.ID = r.musicinfoID and m.title != '' where r.passwordstatus <= (select value from site where setting='showpasswordedrelease') and %s %s %s %s", $browseby, $catsrch, $maxage, $exccatlist); + $sql = sprintf("select count(r.id) as num from releases r inner join musicinfo m on m.id = r.musicinfoid and m.title != '' where r.passwordstatus <= (select value from site where setting='showpasswordedrelease') and %s %s %s %s", $browseby, $catsrch, $maxage, $exccatlist); $res = $db->queryOneRow($sql, true); return $res["num"]; } @@ -151,14 +151,14 @@ class Music $children = $categ->getChildren($category); $chlist = "-99"; foreach ($children as $child) - $chlist.=", ".$child["ID"]; + $chlist.=", ".$child["id"]; if ($chlist != "-99") - $catsrch .= " r.categoryID in (".$chlist.") or "; + $catsrch .= " r.categoryid in (".$chlist.") or "; } else { - $catsrch .= sprintf(" r.categoryID = %d or ", $category); + $catsrch .= sprintf(" r.categoryid = %d or ", $category); } } } @@ -171,11 +171,11 @@ class Music $exccatlist = ""; if (count($excludedcats) > 0) - $exccatlist = " and r.categoryID not in (".implode(",", $excludedcats).")"; + $exccatlist = " and r.categoryid not in (".implode(",", $excludedcats).")"; $order = $this->getMusicOrder($orderby); // query modified to join to musicinfo after limiting releases as performance issue prevented sane sql. - $sql = sprintf(" SELECT r.*, r.ID as releaseID, m.*, g.title as genre, groups.name as group_name, concat(cp.title, ' > ', c.title) as category_name, concat(cp.ID, ',', c.ID) as category_ids, rn.ID as nfoID from releases r left outer join groups on groups.ID = r.groupID inner join musicinfo m on m.ID = r.musicinfoID and m.title != '' left outer join releasenfo rn on rn.releaseID = r.ID and rn.nfo is not null left outer join category c on c.ID = r.categoryID left outer join category cp on cp.ID = c.parentID left outer join genres g on g.ID = m.genreID inner join (select r.ID from releases r inner join musicinfo m ON m.ID = r.musicinfoID and m.title != '' where r.musicinfoID > 0 and r.passwordstatus <= (select value from site where setting='showpasswordedrelease') and %s %s %s %s order by %s %s %s) x on x.ID = r.ID order by %s %s", $browseby, $catsrch, $maxagesql, $exccatlist, $order[0], $order[1], $limit, $order[0], $order[1]); + $sql = sprintf(" SELECT r.*, r.id as releaseid, m.*, g.title as genre, groups.name as group_name, concat(cp.title, ' > ', c.title) as category_name, concat(cp.id, ',', c.id) as category_ids, rn.id as nfoID from releases r left outer join groups on groups.id = r.groupid inner join musicinfo m on m.id = r.musicinfoid and m.title != '' left outer join releasenfo rn on rn.releaseid = r.id and rn.nfo is not null left outer join category c on c.id = r.categoryid left outer join category cp on cp.id = c.parentID left outer join genres g on g.id = m.genreID inner join (select r.id from releases r inner join musicinfo m ON m.id = r.musicinfoid and m.title != '' where r.musicinfoid > 0 and r.passwordstatus <= (select value from site where setting='showpasswordedrelease') and %s %s %s %s order by %s %s %s) x on x.id = r.id order by %s %s", $browseby, $catsrch, $maxagesql, $exccatlist, $order[0], $order[1], $limit, $order[0], $order[1]); return $db->query($sql, true); } @@ -260,7 +260,7 @@ class Music { $db = new DB(); - $db->queryExec(sprintf("update musicinfo SET title=%s, asin=%s, url=%s, salesrank=%s, artist=%s, publisher=%s, releasedate='%s', year=%s, tracks=%s, cover=%d, genreID=%d, updateddate=NOW() WHERE ID = %d", + $db->queryExec(sprintf("update musicinfo SET title=%s, asin=%s, url=%s, salesrank=%s, artist=%s, publisher=%s, releasedate='%s', year=%s, tracks=%s, cover=%d, genreID=%d, updateddate=NOW() WHERE id = %d", $db->escapeString($title), $db->escapeString($asin), $db->escapeString($url), $salesrank, $db->escapeString($artist), $db->escapeString($publisher), $releasedate, $db->escapeString($year), $db->escapeString($tracks), $cover, $genreID, $id)); } @@ -284,7 +284,7 @@ class Music $defaultGenres = $gen->getGenres(Genres::MUSIC_TYPE); $genreassoc = array(); foreach($defaultGenres as $dg) { - $genreassoc[$dg['ID']] = strtolower($dg['title']); + $genreassoc[$dg['id']] = strtolower($dg['title']); } // @@ -438,7 +438,7 @@ class Music $db = new DB(); $numlookedup = 0; - $res = $db->queryDirect(sprintf("SELECT searchname, ID from releases where musicinfoID IS NULL and categoryID in ( select ID from category where parentID = %d ) ORDER BY postdate DESC LIMIT 1000", Category::CAT_PARENT_MUSIC)); + $res = $db->queryDirect(sprintf("SELECT searchname, id from releases where musicinfoid IS NULL and categoryid in ( select id from category where parentID = %d ) ORDER BY postdate DESC LIMIT 1000", Category::CAT_PARENT_MUSIC)); if ($db->getNumRows($res) > 0) { if ($this->echooutput) @@ -473,11 +473,11 @@ class Music } else { - $albumId = $albumCheck["ID"]; + $albumId = $albumCheck["id"]; } } - $db->queryExec(sprintf("update releases SET musicinfoID = %d WHERE ID = %d", $albumId, $arr["ID"])); + $db->queryExec(sprintf("update releases SET musicinfoid = %d WHERE id = %d", $albumId, $arr["id"])); } } } @@ -555,12 +555,12 @@ class Music } /** - * Process all releases tagged as musicinfoID -2 to attempt to retrieve properties from mediainfo xml. + * Process all releases tagged as musicinfoid -2 to attempt to retrieve properties from mediainfo xml. */ public function processMusicReleaseFromMediaInfo() { $db = new DB(); - $res = $db->query("SELECT r.searchname, ref.releaseID, ref.mediainfo FROM releaseextrafull ref INNER JOIN releases r ON r.ID = ref.releaseID WHERE r.musicinfoID = -2"); + $res = $db->query("SELECT r.searchname, ref.releaseid, ref.mediainfo FROM releaseextrafull ref INNER JOIN releases r ON r.id = ref.releaseid WHERE r.musicinfoid = -2"); $rescount = sizeof($res); if ($rescount > 0) @@ -573,7 +573,7 @@ class Music $defaultGenres = $gen->getGenres(Genres::MUSIC_TYPE); $genreassoc = array(); foreach($defaultGenres as $dg) - $genreassoc[$dg['ID']] = strtolower($dg['title']); + $genreassoc[$dg['id']] = strtolower($dg['title']); foreach($res as $rel) { @@ -601,11 +601,11 @@ class Music } else { - $albumId = $albumCheck["ID"]; + $albumId = $albumCheck["id"]; } } - $sql = sprintf("update releases set musicinfoID = %d where ID = %d", $albumId, $rel["releaseID"]); + $sql = sprintf("update releases set musicinfoid = %d where id = %d", $albumId, $rel["releaseid"]); $db->queryExec($sql); } diff --git a/lib/copy_this/www/lib/nfo.php b/lib/copy_this/www/lib/nfo.php index 68fbb7046..00562c46f 100644 --- a/lib/copy_this/www/lib/nfo.php +++ b/lib/copy_this/www/lib/nfo.php @@ -227,14 +227,14 @@ class Nfo $db = new DB(); foreach($blobhash as $uid => $blob){ $query = sprintf( - "REPLACE INTO releasenfo (ID, releaseID, binaryID, nfo) ". + "REPLACE INTO releasenfo (id, releaseid, binaryID, nfo) ". "VALUES (NULL, %d, 0, compress(%s));", $uid, $db->escapeString($blob)); $id = $db->queryInsert($query); if(!$id){ if($this->verbose) echo "!"; }else{ - $query = sprintf("UPDATE releases SET releasenfoID = %d WHERE ID = %d LIMIT 1", + $query = sprintf("UPDATE releases SET releasenfoid = %d WHERE id = %d LIMIT 1", $id, $uid); $res = $db->queryExec($query); if($this->verbose) echo "s"; @@ -260,12 +260,12 @@ class Nfo // $nfoblob is expected as follows // // $nfoblob = array( - // [] = array( + // [] = array( // [0] = , // [1] = , // ... // ), - // [] = array( + // [] = array( // [0] = , // ), // ... @@ -273,7 +273,7 @@ class Nfo // // Meanwhile, $nfometa is expected as follows: // $nfometa = array( - // [] = array( + // [] = array( // [groups] = array( // "alt.binaries.mygroupa", // "alt.binaries.mygroupb", @@ -287,7 +287,7 @@ class Nfo // ... // ) // ), - // [] = array( + // [] = array( // [groups] = array( // "alt.binaries.mygroupa", // ... @@ -383,7 +383,7 @@ class Nfo // back of the array // // $nfometa = array( - // [] = array( + // [] = array( // [groups] = array( // "alt.binaries.mygroupa", // "alt.binaries.mygroupb", @@ -397,7 +397,7 @@ class Nfo // ... // ) // ), - // [] = array( + // [] = array( // [groups] = array( // "alt.binaries.mygroupa", // ... @@ -498,8 +498,8 @@ class Nfo $nfometa = array(); // Missing NFO Query (oldest first so they don't expire on us) - $mnfo = "SELECT ID,guid, name FROM releases r ". - "WHERE r.releasenfoID = ".Nfo::FLAG_NFO_PENDING. + $mnfo = "SELECT id,guid, name FROM releases r ". + "WHERE r.releasenfoid = ".Nfo::FLAG_NFO_PENDING. " ORDER BY postdate DESC"; if ($limit !==Null and $limit > 0) @@ -511,8 +511,8 @@ class Nfo $nzbfile = $nzb->NZBPath($r["guid"]); if(!is_file($nzbfile)){ if($this->verbose) echo sprintf("%s Missing NZB File: %d/%s ...\n", - 'NfoProc', intval($r["ID"]), $r["name"]); - $this->setNfoMissing($r["ID"]); + 'NfoProc', intval($r["id"]), $r["name"]); + $this->setNfoMissing($r["id"]); continue; } @@ -520,8 +520,8 @@ class Nfo if (!$nzbInfo->loadFromFile($nzbfile)) { if($this->verbose) echo sprintf("%s Unable to parse NZB File: %d/%s ...\n", - 'NfoProc', intval($r["ID"]), $r["name"]); - $this->setNfoMissing($r["ID"]); + 'NfoProc', intval($r["id"]), $r["name"]); + $this->setNfoMissing($r["id"]); continue; } @@ -535,19 +535,19 @@ class Nfo if(is_array($matches)){ if(!count($matches)){ if($this->verbose) echo "nfo missing.\n"; - $this->setNfoMissing($r["ID"]); + $this->setNfoMissing($r["id"]); continue; } }else{ if($this->verbose) echo "corrupt nzb.\n"; - $this->setNfoMissing($r["ID"]); + $this->setNfoMissing($r["id"]); continue; } if($this->verbose) echo count($matches)." possible nfo(s).\n"; $processed++; - // Hash Matches by Release ID - $nfometa[(string)$r["ID"]] = $matches; + // Hash Matches by Release id + $nfometa[(string)$r["id"]] = $matches; if(!($processed%$batch)) { @@ -588,7 +588,7 @@ class Nfo public function deleteReleaseNfo($relid) { $db = new DB(); - return $db->queryExec(sprintf("DELETE from releasenfo where releaseID = %d", $relid)); + return $db->queryExec(sprintf("DELETE from releasenfo where releaseid = %d", $relid)); } /** @@ -597,8 +597,8 @@ class Nfo private function setNfoMissing($relid) { $db = new DB(); - $q = sprintf("UPDATE releases SET releasenfoID = %d ". - "WHERE ID = %d", Nfo::FLAG_NFO_MISSING, $relid); + $q = sprintf("UPDATE releases SET releasenfoid = %d ". + "WHERE id = %d", Nfo::FLAG_NFO_MISSING, $relid); return $db->queryExec($q); } @@ -610,8 +610,8 @@ class Nfo $db = new DB(); // Has NFO Query $mnfo = "SELECT uncompress(rn.nfo) as nfo FROM releases r ". - "INNER JOIN releasenfo rn ON rn.releaseID = r.ID AND rn.ID = r.releasenfoID ". - "WHERE rn.nfo IS NOT NULL AND r.ID = %d LIMIT 1"; + "INNER JOIN releasenfo rn ON rn.releaseid = r.id AND rn.id = r.releasenfoid ". + "WHERE rn.nfo IS NOT NULL AND r.id = %d LIMIT 1"; $res = $db->queryOneRow(sprintf($mnfo, $relid)); if($res && isset($res['nfo'])) { diff --git a/lib/copy_this/www/lib/nntp.php b/lib/copy_this/www/lib/nntp.php index 700ebc318..400a63bd7 100644 --- a/lib/copy_this/www/lib/nntp.php +++ b/lib/copy_this/www/lib/nntp.php @@ -420,7 +420,7 @@ class NNTP extends Net_NNTP_Client * 'Subject' => string(18) "This is an example" * 'From' => string(19) "Example@example.com" * 'Date' => string(24) "26 Jun 2014 13:08:22 GMT" - * 'Message-ID' => string(57) "" + * 'Message-id' => string(57) "" * 'References' => string(0) "" * 'Bytes' => string(3) "123" * 'Lines' => string(1) "9" @@ -432,7 +432,7 @@ class NNTP extends Net_NNTP_Client * Range of article numbers: "679871775-679999999" * All newer than article number: "679871775-" * All older than article number: "-679871775" - * Message-ID: "" + * Message-id: "" * * @return array|object Multi-dimensional Array of headers on success, PEAR object on failure. */ @@ -534,9 +534,9 @@ class NNTP extends Net_NNTP_Client * Download multiple article bodies and string them together. * * @param string $groupName The name of the group the articles are in. - * @param mixed $identifiers (string) Message-ID. + * @param mixed $identifiers (string) Message-id. * (int) Article number. - * (array) Article numbers or Message-ID's (can contain both in the same array) + * (array) Article numbers or Message-id's (can contain both in the same array) * @param bool $alternate Use the alternate NNTP provider? * * @return mixed On success : (string) The article bodies. @@ -562,7 +562,7 @@ class NNTP extends Net_NNTP_Client $loops = $messageSize = 0; - // Loop over the message-ID's or article numbers. + // Loop over the message-id's or article numbers. foreach ($identifiers as $wanted) { /* This is to attempt to prevent string size overflow. @@ -632,7 +632,7 @@ class NNTP extends Net_NNTP_Client } } - // If it's a string check if it's a valid message-ID. + // If it's a string check if it's a valid message-id. } else if (is_string($identifiers) || is_numeric($identifiers)) { $body = $this->_getMessage($groupName, $identifiers); if ($alternate === true && $this->isError($body)) { @@ -662,7 +662,7 @@ class NNTP extends Net_NNTP_Client * associated values, optionally decode the body using yEnc. * * @param string $groupName The name of the group the article is in. - * @param mixed $identifier (string)The message-ID of the article to download. + * @param mixed $identifier (string)The message-id of the article to download. * (int) The article number. * @param bool $yEnc Attempt to yEnc decode the body. * @@ -691,9 +691,9 @@ class NNTP extends Net_NNTP_Client } } - // Check if it's an article number or message-ID. + // Check if it's an article number or message-id. if (!is_numeric($identifier)) { - // If it's a message-ID, check if it has the required triangular brackets. + // If it's a message-id, check if it has the required triangular brackets. $identifier = $this->_formatMessageID($identifier); } @@ -746,7 +746,7 @@ class NNTP extends Net_NNTP_Client * Download a full article header. * * @param string $groupName The name of the group the article is in. - * @param mixed $identifier (string) The message-ID of the article to download. + * @param mixed $identifier (string) The message-id of the article to download. * (int) The article number. * * @return mixed On success : (array) The header. @@ -1462,11 +1462,11 @@ class NNTP extends Net_NNTP_Client } /** - * Check if the Message-ID has the required opening and closing brackets. + * Check if the Message-id has the required opening and closing brackets. * - * @param string $messageID The Message-ID with or without brackets. + * @param string $messageID The Message-id with or without brackets. * - * @return string Message-ID with brackets. + * @return string Message-id with brackets. * * @access protected */ @@ -1493,7 +1493,7 @@ class NNTP extends Net_NNTP_Client * Download an article body (an article without the header). * * @param string $groupName The name of the group the article is in. - * @param mixed $identifier (string) The message-ID of the article to download. + * @param mixed $identifier (string) The message-id of the article to download. * (int) The article number. * * @return mixed On success : (string) The article's body. diff --git a/lib/copy_this/www/lib/nzb.php b/lib/copy_this/www/lib/nzb.php index 7978400e1..8e2756a29 100644 --- a/lib/copy_this/www/lib/nzb.php +++ b/lib/copy_this/www/lib/nzb.php @@ -29,7 +29,7 @@ class NZB private $siteNzbPath; /** - * Group ID when writing NZBs. + * Group id when writing NZBs. * @var int * @access protected */ @@ -111,16 +111,16 @@ class NZB */ public function initiateForWrite($groupID) { - $this->groupID = $groupID; + $this->groupid = $groupID; $site = new Sites(); // Set table names if ($this->tablePerGroup === true) { - if ($this->groupID == '') { - exit("$this->groupID is missing\n"); + if ($this->groupid == '') { + exit("$this->groupid is missing\n"); } - $cName = 'collections_' .$this->groupID; - $bName = 'binaries_' . $this->groupID; - $pName = 'parts_' . $this->groupID; + $cName = 'collections_' .$this->groupid; + $bName = 'binaries_' . $this->groupid; + $pName = 'parts_' . $this->groupid; } else { $cName = 'collections'; $bName = 'binaries'; @@ -155,7 +155,7 @@ class NZB /** * Write an NZB to the hard drive for a single release. * - * @param int $relID The ID of the release in the DB. + * @param int $relID The id of the release in the DB. * @param string $relGuid The guid of the release. * @param string $name The name of the release. * @param string $cTitle The name of the category this release is in. diff --git a/lib/copy_this/www/lib/nzbvortex.php b/lib/copy_this/www/lib/nzbvortex.php index eab364004..d1fcec437 100644 --- a/lib/copy_this/www/lib/nzbvortex.php +++ b/lib/copy_this/www/lib/nzbvortex.php @@ -7,7 +7,7 @@ final class NZBVortex { protected $nonce = null; protected $session = null; - + public function __construct() { if (is_null($this->session)) @@ -16,7 +16,7 @@ final class NZBVortex $this->login(); } } - + /** * get text for state * @param int $code @@ -52,11 +52,11 @@ final class NZBVortex 23 => 'Move failed', 24 => 'Badly encoded download (uuencoded)' ); - + return (isset($states[$code])) ? $states[$code] : -1; } - + /** * get overview of NZB's in queue * @return array @@ -70,10 +70,10 @@ final class NZBVortex $nzb['original_state'] = $nzb['state']; $nzb['state'] = (1 == $nzb['isPaused']) ? 'Paused' : $this->getState($nzb['state']); } - + return $response; } - + /** * add NZB to queue @@ -86,21 +86,21 @@ final class NZBVortex { $page = new Page; $user = new Users; - + $host = $page->serverurl; $data = $user->getById($user->currentUserId()); - $url = sprintf("%sgetnzb/%s.nzb&i=%s&r=%s", $host, $nzb, $data['ID'], $data['rsstoken']); - + $url = sprintf("%sgetnzb/%s.nzb&i=%s&r=%s", $host, $nzb, $data['id'], $data['rsstoken']); + $params = array ( 'sessionid' => $this->session, 'url' => $url ); - + $response = $this->sendRequest('nzb/add', $params); } } - + /** * resume NZB @@ -132,13 +132,13 @@ final class NZBVortex $response = $this->sendRequest(sprintf('nzb/%s/pause', $id), $params); } } - + /** * move NZB up in queue * @param int $id * @return void - */ + */ public function moveUp($id = 0) { if ($id > 0) @@ -148,8 +148,8 @@ final class NZBVortex $response = $this->sendRequest(sprintf('nzb/%s/moveup', $id), $params); } } - - + + /** * move NZB down in queue * @param int $id @@ -196,7 +196,7 @@ final class NZBVortex $response = $this->sendRequest(sprintf('nzb/%s/cancelDelete', $id), $params); } } - + /** * move NZB to top of queue @@ -212,8 +212,8 @@ final class NZBVortex $response = $this->sendRequest(sprintf('nzb/%s/movetop', $id), $params); } } - - + + /** * get filelist for nzb * @param int $id @@ -228,11 +228,11 @@ final class NZBVortex $response = $this->sendRequest(sprintf('file/%s', $id), $params); return $response; } - + return false; } - - + + /** * get /auth/nonce * @return void @@ -245,7 +245,7 @@ final class NZBVortex /** * @return void - */ + */ protected function login() { $user = new Users(); @@ -253,22 +253,22 @@ final class NZBVortex $cnonce = generateUuid(); $hash = hash('sha256', sprintf("%s:%s:%s", $this->nonce, $cnonce, $data['nzbvortex_api_key']), true); $hash = base64_encode($hash); - + $params = array ( 'nonce' => $this->nonce, 'cnonce' => $cnonce, 'hash' => $hash ); - + $response = $this->sendRequest('auth/login', $params); if ('successful' == $response['loginResult']) $this->session = $response['sessionID']; - + if ('failed' == $response['loginResult']) { } } - + /** * sendRequest() * @return array @@ -277,44 +277,44 @@ final class NZBVortex { $user = new Users; $data = $user->getById($user->currentUserId()); - + $url = sprintf('%s/api', $data['nzbvortex_server_url']); $params = http_build_query($params); $ch = curl_init(sprintf("%s/%s?%s", $url, $path, $params)); - + curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); - + #curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1); #curl_setopt($ch, CURLOPT_PROXY, 'localhost:8888'); - + $response = curl_exec($ch); $response = json_decode($response, true); $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); $error = curl_error($ch); - + curl_close($ch); - + switch ($status) { case 0: throw new Exception(sprintf('Unable to connect. Is NZBVortex running? Is your API key correct? Is something blocking ports? (Err: %s)', $error)); break; - + case 200: return $response; break; - + case 403: throw new Exception('Unable to login. Is your API key correct?'); break; - + default: throw new Exception(sprintf("%s (%s): %s", $path, $status, $response['result'])); break; - } + } } } \ No newline at end of file diff --git a/lib/copy_this/www/lib/parsing.php b/lib/copy_this/www/lib/parsing.php index 79173cdbc..ec01b33ca 100644 --- a/lib/copy_this/www/lib/parsing.php +++ b/lib/copy_this/www/lib/parsing.php @@ -45,17 +45,17 @@ class Parsing $db = new DB(); // Default query for both full db and last 4 hours. - $sql = "SELECT r.searchname, r.name, r.fromname, r.ID as RID, r.categoryID, r.guid, r.postdate, - rn.ID as nfoID, + $sql = "SELECT r.searchname, r.name, r.fromname, r.id as RID, r.categoryid, r.guid, r.postdate, + rn.id as nfoID, g.name as groupname, GROUP_CONCAT(rf.name) as filenames FROM releases r - LEFT JOIN releasenfo rn ON (rn.releaseID = r.ID) - LEFT JOIN groups g ON (g.ID = r.groupID) - LEFT JOIN releasefiles rf ON (rf.releaseID = r.ID) - WHERE r.categoryID in (" . Category::CAT_TV_OTHER . "," . Category::CAT_MOVIE_OTHER . "," . Category::CAT_MISC_OTHER . "," . Category::CAT_XXX_OTHER . ") + LEFT JOIN releasenfo rn ON (rn.releaseid = r.id) + LEFT JOIN groups g ON (g.id = r.groupid) + LEFT JOIN releasefiles rf ON (rf.releaseid = r.id) + WHERE r.categoryid in (" . Category::CAT_TV_OTHER . "," . Category::CAT_MOVIE_OTHER . "," . Category::CAT_MISC_OTHER . "," . Category::CAT_XXX_OTHER . ") %s - GROUP BY r.ID"; + GROUP BY r.id"; $res = $db->query(sprintf($sql, $this->limited ? "AND r.adddate BETWEEN NOW() - INTERVAL 4 HOUR AND NOW()" : "")); $this->releasestocheck = sizeof($res); @@ -90,7 +90,7 @@ class Parsing /// ///Use the Nfo to try to get the proper Releasename. /// - $nfo = $db->queryOneRow(sprintf("select uncompress(nfo) as nfo from releasenfo where releaseID = %d", $rel['RID'])); + $nfo = $db->queryOneRow(sprintf("select uncompress(nfo) as nfo from releasenfo where releaseid = %d", $rel['RID'])); if ($nfo && $foundName == "") { $this->nfosprocessed++; $nfo = $nfo['nfo']; @@ -799,7 +799,7 @@ class Parsing if (($methodused == 'a.b.hdtv.x264') && ($rel['groupname'] == 'alt.binaries.hdtv.x264')) { $categoryID = Category::CAT_MOVIE_HD; } - if (($categoryID == $rel['categoryID'] || $categoryID == '7900') || ($foundName == $rel['name'] || $foundName == $rel['searchname'])) { + if (($categoryID == $rel['categoryid'] || $categoryID == '7900') || ($foundName == $rel['name'] || $foundName == $rel['searchname'])) { $foundName = null; $methodused = null; } else { @@ -813,14 +813,14 @@ class Parsing echo ' Old SearchName: ' . $rel['searchname'] . "\n"; echo ' New Name: ' . $name . "\n"; echo ' New SearchName: ' . $searchname . "\n"; - echo ' Old Cat: ' . $rel['categoryID'] . "\n"; + echo ' Old Cat: ' . $rel['categoryid'] . "\n"; echo ' New Cat: ' . $categoryID . "\n"; echo ' Method: ' . $methodused . "\n"; echo " Status: Release changed\n\n"; } if (!$this->echoonly) { $db = new DB(); - $db->queryExec(sprintf("update releases SET name = %s, searchname = %s, categoryID = %d, imdbID = NULL, rageID = -1, bookinfoID = NULL, musicinfoID = NULL, consoleinfoID = NULL WHERE releases.ID = %d", $db->escapeString($name), $db->escapeString($searchname), $categoryID, $rel['RID'])); + $db->queryExec(sprintf("update releases SET name = %s, searchname = %s, categoryid = %d, imdbid = NULL, rageid = -1, bookinfoid = NULL, musicinfoid = NULL, consoleinfoid = NULL WHERE releases.id = %d", $db->escapeString($name), $db->escapeString($searchname), $categoryID, $rel['RID'])); } $this->numupdated++; } @@ -834,10 +834,10 @@ class Parsing echo "PostPrc : Performing cleanup \n"; $db = new Db; - $catsql = "select ID from groups"; + $catsql = "select id from groups"; $res = $db->query($catsql); foreach ($res as $r2) { - $sql = sprintf("select r.ID, name, searchname, categoryID, size, totalpart, musicinfoID, preID, groupID, rn.id as nfoID from releases r left outer join releasenfo rn ON rn.releaseID = r.ID where groupid = %d", $r2['ID']) . " %s "; + $sql = sprintf("select r.id, name, searchname, categoryid, size, totalpart, musicinfoid, preid, groupid, rn.id as nfoID from releases r left outer join releasenfo rn ON rn.releaseid = r.id where groupid = %d", $r2['id']) . " %s "; $unbuf = $db->queryDirect(sprintf($sql, ($this->limited ? " and r.adddate BETWEEN NOW() - INTERVAL 1 DAY AND NOW() " : ""))); while ($r = $db->getAssocArray($unbuf)) { @@ -871,7 +871,7 @@ class Parsing //Remove releases if it starts with a IMDBID. if (preg_match('/^tt\d{6}/i', $r['name'])) { - $this->handleClean($r, "Modifying Release because it starts with a IMDB ID: " . $r['name'] . " - "); + $this->handleClean($r, "Modifying Release because it starts with a IMDB id: " . $r['name'] . " - "); continue; } @@ -883,7 +883,7 @@ class Parsing //Remove releases if the name contains http(s): . // try stripos, its faster than preg_match - if (preg_match('/sample/i', $r['name']) && $r['categoryID'] > 5000 && $r['categoryID'] < 5999) { + if (preg_match('/sample/i', $r['name']) && $r['categoryid'] > 5000 && $r['categoryid'] < 5999) { $this->handleClean($r, "Modifying Release because it contains Sample in the Release Name: " . $r['name'] . " - ", true); continue; } @@ -896,14 +896,14 @@ class Parsing ///This section will cleanup releases based on the category and things such as release size and release name length /// - switch ($r['categoryID']) { + switch ($r['categoryid']) { //CONSOLE case Category::CAT_GAME_NDS: //NDS if ($r['size'] < 2000000) { $this->handleClean($r, "Modifying Release Due to NDS Size: " . $r['name'] . " - ", true); continue; } - if (strlen($r['name']) < 11 && !preg_match('/\([a-z]{2,3}\)/i', $r['name']) && !$r['preID']) { + if (strlen($r['name']) < 11 && !preg_match('/\([a-z]{2,3}\)/i', $r['name']) && !$r['preid']) { $this->handleClean($r, "Modifying Release Due to NDS Release Length: " . $r['name'] . " - "); continue; } @@ -914,7 +914,7 @@ class Parsing $this->handleClean($r, "Modifying Release Due to PSP Size: " . $r['name'] . " - ", true); continue; } - if (strlen($r['name']) < 13 && !$r['preID']) { + if (strlen($r['name']) < 13 && !$r['preid']) { $this->handleClean($r, "Modifying Release PSP Due to Release Length: " . $r['name'] . " - "); continue; } @@ -925,7 +925,7 @@ class Parsing $this->handleClean($r, "Modifying Release Wii Size: " . $r['name'] . " - ", true); continue; } - if (strlen($r['name']) < 14 && !$r['preID']) { + if (strlen($r['name']) < 14 && !$r['preid']) { $this->handleClean($r, "Modifying Release Wii ReleaseLEN: " . $r['name'] . " - "); continue; } @@ -936,7 +936,7 @@ class Parsing $this->handleClean($r, "Modifying Release Xbox Size: " . $r['name'] . " - ", true); continue; } - if (strlen($r['name']) < 14 && !$r['preID']) { + if (strlen($r['name']) < 14 && !$r['preid']) { $this->handleClean($r, "Modifying Release Xbox ReleaseLEN: " . $r['name'] . " - "); continue; } @@ -947,7 +947,7 @@ class Parsing $this->handleClean($r, "Modifying Release Xbox360 Size: " . $r['name'] . " - ", true); continue; } - if (strlen($r['name']) < 14 && !$r['preID']) { + if (strlen($r['name']) < 14 && !$r['preid']) { $this->handleClean($r, "Modifying Release Xbox360 ReleaseLEN: " . $r['name'] . " - "); continue; } @@ -958,7 +958,7 @@ class Parsing $this->handleClean($r, "Modifying Release Wiiware Size: " . $r['name'] . " - ", true); continue; } - if (strlen($r['name']) < 14 && !$r['preID']) { + if (strlen($r['name']) < 14 && !$r['preid']) { $this->handleClean($r, "Modifying Release Wiiware ReleaseLEN: " . $r['name'] . " - "); continue; } @@ -970,7 +970,7 @@ class Parsing //handleClean($r,true); continue; } - if (strlen($r['name']) < 16 && !$r['preID']) { + if (strlen($r['name']) < 16 && !$r['preid']) { $this->handleClean($r, "Modifying Release Xbox 360 DLC ReleaseLEN: " . $r['name'] . " - "); continue; } @@ -981,7 +981,7 @@ class Parsing $this->handleClean($r, "Modifying Release Due to PS3 Size: " . $r['name'] . " - ", true); continue; } - if (strlen($r['name']) < 14 && !$r['preID']) { + if (strlen($r['name']) < 14 && !$r['preid']) { $this->handleClean($r, "Modifying Release PS3 Due to Release Length: " . $r['name'] . " - "); continue; } @@ -993,7 +993,7 @@ class Parsing $this->handleClean($r, "Modifying Release Foreign Movie Size: " . $r['name'] . " - ", true); continue; } - if (strlen($r['name']) < 16 && !preg_match('/(fix|pack|\b((19|20)\d{2})\b)/i', $r['name']) && !$r['preID']) { + if (strlen($r['name']) < 16 && !preg_match('/(fix|pack|\b((19|20)\d{2})\b)/i', $r['name']) && !$r['preid']) { $this->handleClean($r, "Modifying Release Foreign Movies ReleaseLEN: " . $r['name'] . " - "); continue; } @@ -1004,7 +1004,7 @@ class Parsing $this->handleClean($r, "Modifying Release Other Movies Size: " . $r['name'] . " - ", true); continue; } - if (strlen($r['name']) < 24 && !preg_match('/(fix|pack|\b((19|20)\d{2})\b)/i', $r['name']) && !$r['preID']) { + if (strlen($r['name']) < 24 && !preg_match('/(fix|pack|\b((19|20)\d{2})\b)/i', $r['name']) && !$r['preid']) { $this->handleClean($r, "Modifying Release Other Movies ReleaseLEN: " . $r['name'] . " - "); continue; } @@ -1015,7 +1015,7 @@ class Parsing $this->handleClean($r, "Modifying Release SD Movie Size: " . $r['name'] . " - ", true); continue; } - if (strlen($r['name']) < 21 && !preg_match('/(fix|pack|\b((19|20)\d{2})\b)/i', $r['name']) && !$r['preID']) { + if (strlen($r['name']) < 21 && !preg_match('/(fix|pack|\b((19|20)\d{2})\b)/i', $r['name']) && !$r['preid']) { $this->handleClean($r, "Modifying Release SD Movies ReleaseLEN: " . $r['name'] . " - "); continue; } @@ -1026,7 +1026,7 @@ class Parsing $this->handleClean($r, "Modifying Release HD Movie Size: " . $r['name'] . " - ", true); continue; } - if (strlen($r['name']) < 21 && !preg_match('/(fix|pack|\b((19|20)\d{2})\b)/i', $r['name']) && !$r['preID']) { + if (strlen($r['name']) < 21 && !preg_match('/(fix|pack|\b((19|20)\d{2})\b)/i', $r['name']) && !$r['preid']) { $this->handleClean($r, "Modifying Release HD Movies ReleaseLEN: " . $r['name'] . " - "); continue; } @@ -1037,7 +1037,7 @@ class Parsing $this->handleClean($r, "Modifying Release Bluray Movie Size: " . $r['name'] . " - ", true); continue; } - if (strlen($r['name']) < 21 && !preg_match('/(fix|pack|\b((19|20)\d{2})\b)/i', $r['name']) && !$r['preID']) { + if (strlen($r['name']) < 21 && !preg_match('/(fix|pack|\b((19|20)\d{2})\b)/i', $r['name']) && !$r['preid']) { $this->handleClean($r, "Modifying Release Bluray Movies ReleaseLEN: " . $r['name'] . " - "); continue; } @@ -1048,7 +1048,7 @@ class Parsing $this->handleClean($r, true); continue; } - if (strlen($r['name']) < 15 && !preg_match('/(fix|pack|\b((19|20)\d{2})\b)/i', $r['name']) && !$r['preID']) { + if (strlen($r['name']) < 15 && !preg_match('/(fix|pack|\b((19|20)\d{2})\b)/i', $r['name']) && !$r['preid']) { $this->handleClean($r, "Modifying Release 3D Movies ReleaseLEN: " . $r['name'] . " - "); continue; } @@ -1064,7 +1064,7 @@ class Parsing $this->handleClean($r, "Modifying Release Audio MP3 Size: " . $r['name'] . " - ", true); continue; } - if (strlen($r['name']) < 25 && !preg_match('/(discography|\b((19|20)\d{2})\b)/i', $r['name']) && $r['musicinfoID'] == '-2' && !$r['preID']) { + if (strlen($r['name']) < 25 && !preg_match('/(discography|\b((19|20)\d{2})\b)/i', $r['name']) && $r['musicinfoid'] == '-2' && !$r['preid']) { $this->handleClean($r, "Modifying Release Audio MP3 ReleaseLEN: " . $r['name'] . " - "); continue; } @@ -1075,7 +1075,7 @@ class Parsing $this->handleClean($r, "Modifying Release Audio Video Size: " . $r['name'] . " - ", true); continue; } - if (strlen($r['name']) < 20 && !preg_match('/(discography|\b((19|20)\d{2})\b)/i', $r['name']) && $r['musicinfoID'] == '-2' && !$r['preID']) { + if (strlen($r['name']) < 20 && !preg_match('/(discography|\b((19|20)\d{2})\b)/i', $r['name']) && $r['musicinfoid'] == '-2' && !$r['preid']) { //echo "Modifying Release Audio Video ReleaseLEN: ".$r['name']." - "; //handleClean($r); not sure what to continue; @@ -1087,7 +1087,7 @@ class Parsing $this->handleClean($r, "Modifying Release Audiobook Size: " . $r['name'] . " - ", true); continue; } - if (strlen($r['name']) < 20 && !preg_match('/(discography|\b((19|20)\d{2})\b)/i', $r['name']) && $r['musicinfoID'] == '-2' && !$r['preID']) { + if (strlen($r['name']) < 20 && !preg_match('/(discography|\b((19|20)\d{2})\b)/i', $r['name']) && $r['musicinfoid'] == '-2' && !$r['preid']) { $this->handleClean($r, "Modifying Release Audiobook ReleaseLEN: " . $r['name'] . " - "); continue; } @@ -1099,7 +1099,7 @@ class Parsing //handleClean($r,true); continue; } - if (strlen($r['name']) < 20 && !preg_match('/(discography|\b((19|20)\d{2})\b)/i', $r['name']) && $r['musicinfoID'] == '-2' && !$r['preID']) { + if (strlen($r['name']) < 20 && !preg_match('/(discography|\b((19|20)\d{2})\b)/i', $r['name']) && $r['musicinfoid'] == '-2' && !$r['preid']) { //echo "Modifying Release Audio Lossless ReleaseLEN: ".$r['name']." - "; //handleClean($r); continue; @@ -1112,7 +1112,7 @@ class Parsing $this->handleClean($r, "Modifying Release PC 0Day Size: " . $r['name'] . " - ", true); continue; } - if (strlen($r['name']) < 20 && $r['nfoID'] == null && !$r['preID']) { + if (strlen($r['name']) < 20 && $r['nfoID'] == null && !$r['preid']) { $this->handleClean($r, "Modifying Release PC 0Day ReleaseLEN: " . $r['name'] . " - "); continue; } @@ -1123,7 +1123,7 @@ class Parsing $this->handleClean($r, "Modifying Release PC ISO Size: " . $r['name'] . " - ", true); continue; } - if (strlen($r['name']) < 20 && !$r['preID']) { + if (strlen($r['name']) < 20 && !$r['preid']) { $this->handleClean($r, "Modifying Release PC ISO ReleaseLEN: " . $r['name'] . " - "); continue; } @@ -1134,7 +1134,7 @@ class Parsing $this->handleClean($r, "Modifying Release PC Mac Size: " . $r['name'] . " - ", true); continue; } - if (strlen($r['name']) < 15 && !$r['preID']) { + if (strlen($r['name']) < 15 && !$r['preid']) { //echo "Modifying Release PC Mac ReleaseLEN: ".$r['name']." - "; //handleClean($r); Not sure about this yet continue; @@ -1146,7 +1146,7 @@ class Parsing $this->handleClean($r, "Modifying Release PC Mobile Other Size: " . $r['name'] . " - ", true); continue; } - if (strlen($r['name']) < 20 && !$r['preID']) { + if (strlen($r['name']) < 20 && !$r['preid']) { $this->handleClean($r, "Modifying Release PC Mobile Other ReleaseLEN: " . $r['name'] . " - "); continue; } @@ -1157,7 +1157,7 @@ class Parsing $this->handleClean($r, "Modifying Release PC Games Size: " . $r['name'] . " - ", true); continue; } - if (strlen($r['name']) < 15 && !$r['preID']) { + if (strlen($r['name']) < 15 && !$r['preid']) { //echo "Modifying Release PC Games ReleaseLEN: ".$r['name']." - "; //handleClean($r); Not sure about this yet @@ -1170,7 +1170,7 @@ class Parsing $this->handleClean($r, "Modifying Release PC Ios Size: " . $r['name'] . " - ", true); continue; } - if (strlen($r['name']) < 21 && !$r['preID']) { + if (strlen($r['name']) < 21 && !$r['preid']) { $this->handleClean($r, "Modifying Release PC Ios ReleaseLEN: " . $r['name'] . " - "); continue; } @@ -1181,7 +1181,7 @@ class Parsing $this->handleClean($r, "Modifying Release PC Android Size: " . $r['name'] . " - ", true); continue; } - if (strlen($r['name']) < 15 && !$r['preID']) { + if (strlen($r['name']) < 15 && !$r['preid']) { //echo "Modifying Release PC Android ReleaseLEN: ".$r['name']." - "; //handleClean($r); Not sure about this yet continue; @@ -1194,7 +1194,7 @@ class Parsing $this->handleClean($r, "Modifying Release TV Foreign Size: " . $r['name'] . " - ", true); continue; } - if (strlen($r['name']) < 18 && !$r['preID']) { + if (strlen($r['name']) < 18 && !$r['preid']) { $this->handleClean($r, "Modifying Release TV Foreign ReleaseLEN: " . $r['name'] . " - "); continue; } @@ -1205,7 +1205,7 @@ class Parsing $this->handleClean($r, "Modifying Release TV SD Size: " . $r['name'] . " - ", true); continue; } - if (strlen($r['name']) < 20 && !$r['preID']) { + if (strlen($r['name']) < 20 && !$r['preid']) { $this->handleClean($r, "Modifying Release TV SD ReleaseLEN: " . $r['name'] . " - "); continue; } @@ -1216,7 +1216,7 @@ class Parsing $this->handleClean($r, "Modifying Release TV HD Size: " . $r['name'] . " - ", true); continue; } - if (strlen($r['name']) < 15 && !$r['preID']) { + if (strlen($r['name']) < 15 && !$r['preid']) { $this->handleClean($r, "Modifying Release TV HD ReleaseLEN: " . $r['name'] . " - "); continue; } @@ -1227,7 +1227,7 @@ class Parsing $this->handleClean($r, "Modifying Release TV Other Size: " . $r['name'] . " - ", true); continue; } - if (strlen($r['name']) < 15 && !$r['preID']) { + if (strlen($r['name']) < 15 && !$r['preid']) { $this->handleClean($r, "Modifying Release TV Other ReleaseLEN: " . $r['name'] . " - "); continue; } @@ -1238,7 +1238,7 @@ class Parsing $this->handleClean($r, "Modifying Release TV Sport Size: " . $r['name'] . " - ", true); continue; } - if (strlen($r['name']) < 19 && !$r['preID']) { + if (strlen($r['name']) < 19 && !$r['preid']) { $this->handleClean($r, "Modifying Release TV Sport ReleaseLEN: " . $r['name'] . " - "); continue; } @@ -1249,7 +1249,7 @@ class Parsing $this->handleClean($r, "Modifying Release TV Anime Size: " . $r['name'] . " - ", true); continue; } - if (strlen($r['name']) < 15 && !$r['preID']) { + if (strlen($r['name']) < 15 && !$r['preid']) { $this->handleClean($r, "Modifying Release TV Anime ReleaseLEN: " . $r['name'] . " - "); continue; } @@ -1260,7 +1260,7 @@ class Parsing $this->handleClean($r, "Modifying Release TV Docu Size: " . $r['name'] . " - ", true); continue; } - if (strlen($r['name']) < 15 && !$r['preID']) { + if (strlen($r['name']) < 15 && !$r['preid']) { $this->handleClean($r, "Modifying Release TV Docu ReleaseLEN: " . $r['name'] . " - "); continue; } @@ -1272,7 +1272,7 @@ class Parsing $this->handleClean($r, "Modifying Release XXX DVD Size: " . $r['name'] . " - ", true); continue; } - if (strlen($r['name']) < 20 && !$r['preID']) { + if (strlen($r['name']) < 20 && !$r['preid']) { $this->handleClean($r, "Modifying Release XXX DVD ReleaseLEN: " . $r['name'] . " - "); continue; } @@ -1283,7 +1283,7 @@ class Parsing $this->handleClean($r, "Modifying Release XXX WMV Size: " . $r['name'] . " - ", true); continue; } - if (strlen($r['name']) < 20 && !$r['preID']) { + if (strlen($r['name']) < 20 && !$r['preid']) { $this->handleClean($r, "Modifying Release XXX WMV ReleaseLEN: " . $r['name'] . " - "); continue; } @@ -1294,7 +1294,7 @@ class Parsing $this->handleClean($r, "Modifying Release XXX XVID Size: " . $r['name'] . " - ", true); continue; } - if (strlen($r['name']) < 14 && !$r['preID']) { + if (strlen($r['name']) < 14 && !$r['preid']) { $this->handleClean($r, "Modifying Release XXX XVID ReleaseLEN: " . $r['name'] . " - "); continue; } @@ -1305,7 +1305,7 @@ class Parsing $this->handleClean($r, "Modifying Release XXX X264 Size: " . $r['name'] . " - ", true); continue; } - if (strlen($r['name']) < 15 && !$r['preID']) { + if (strlen($r['name']) < 15 && !$r['preid']) { $this->handleClean($r, "Modifying Release XXX X264 ReleaseLEN: " . $r['name'] . " - "); continue; } @@ -1316,7 +1316,7 @@ class Parsing $this->handleClean($r, "Modifying Release XXX PACK Size: " . $r['name'] . " - ", true); continue; } - if (strlen($r['name']) < 15 && !$r['preID']) { + if (strlen($r['name']) < 15 && !$r['preid']) { $this->handleClean($r, "Modifying Release XXX PACK ReleaseLEN: " . $r['name'] . " - "); continue; } @@ -1327,7 +1327,7 @@ class Parsing $this->handleClean($r, "Modifying Release XXX IMAGESET Size: " . $r['name'] . " - ", true); continue; } - if (strlen($r['name']) < 15 && !$r['preID']) { + if (strlen($r['name']) < 15 && !$r['preid']) { $this->handleClean($r, "Modifying Release XXX IMAGESET ReleaseLEN: " . $r['name'] . " - "); continue; } @@ -1338,7 +1338,7 @@ class Parsing $this->handleClean($r, "Modifying Release Misc Ebook Size: " . $r['name'] . " - ", true); continue; } - if (strlen($r['name']) < 12 && !$r['preID']) { + if (strlen($r['name']) < 12 && !$r['preid']) { $this->handleClean($r, "Modifying Release Misc Ebook ReleaseLEN: " . $r['name'] . " - "); continue; } @@ -1350,7 +1350,7 @@ class Parsing //handleClean($r,true); continue; } - if (strlen($r['name']) < 7 && !$r['preID']) { + if (strlen($r['name']) < 7 && !$r['preid']) { //echo "Modifying Release MISC Comic ReleaseLEN: ".$r['name']." - "; //handleClean($r); continue; @@ -1363,7 +1363,7 @@ class Parsing $this->handleClean($r, "Modifying Release Misc Other Size: " . $r['name'] . " - ", true); continue; } - if (strlen($r['name']) < 15 && !$r['preID']) { + if (strlen($r['name']) < 15 && !$r['preid']) { //echo "Modifying Release MISC Other ReleaseLEN: ".$r['name']." - "; //handleClean($r); Not sure what to do with this continue; @@ -1387,10 +1387,10 @@ class Parsing private function handleClean($row, $reason = "", $forceNuke = false) { if (!$forceNuke) { - $this->cleanup['misc'][$row['ID']] = true; + $this->cleanup['misc'][$row['id']] = true; if ($this->verbose) echo $reason . "Moving to Misc Other\n"; } else { - $this->cleanup['nuke'][$row['ID']] = true; + $this->cleanup['nuke'][$row['id']] = true; if ($this->verbose) echo $reason . "Removing Release\n"; } } @@ -1412,7 +1412,7 @@ class Parsing } if (count($this->cleanup['misc'])) { - $sql = 'update releases set categoryID = ' . Category::CAT_MISC_OTHER . ' where categoryID != ' . Category::CAT_MISC_OTHER . ' and id in (' . implode(array_keys($this->cleanup['misc']), ',') . ')'; + $sql = 'update releases set categoryid = ' . Category::CAT_MISC_OTHER . ' where categoryid != ' . Category::CAT_MISC_OTHER . ' and id in (' . implode(array_keys($this->cleanup['misc']), ',') . ')'; $db->queryExec($sql); } } @@ -1427,7 +1427,7 @@ class Parsing { $db = new Db; - $sql = "select ID, searchname from releases where 1 = 1 "; + $sql = "select id, searchname from releases where 1 = 1 "; $sql .= ($this->limited ? "AND adddate BETWEEN NOW() - INTERVAL 1 DAY AND NOW()" : ""); $sql .= " order by postdate desc"; @@ -1439,43 +1439,43 @@ class Parsing while (preg_match('/^(\:|\"|\-| |\_)+/', $r['searchname'])) { $r['searchname'] = substr($r['searchname'], 1); } - $this->updateName($db, $r['ID'], $oldname, $r['searchname']); + $this->updateName($db, $r['id'], $oldname, $r['searchname']); } if (preg_match('/^000\-/', $r['searchname'])) { while (preg_match('/^000\-/', $r['searchname'])) { $r['searchname'] = substr($r['searchname'], 4); } - $this->updateName($db, $r['ID'], $oldname, $r['searchname']); + $this->updateName($db, $r['id'], $oldname, $r['searchname']); } if (preg_match('/(\:|\"|\-| |\/)$/', $r['searchname'])) { while (preg_match('/(\:|\"|\-| |\/)$/', $r['searchname'])) { $r['searchname'] = substr($r['searchname'], 0, -1); } - $this->updateName($db, $r['ID'], $oldname, $r['searchname']); + $this->updateName($db, $r['id'], $oldname, $r['searchname']); } if (preg_match('/\"/', $r['searchname'])) { while (preg_match('/\"/', $r['searchname'])) { $r['searchname'] = str_replace('"', '', $r['searchname']); } - $this->updateName($db, $r['ID'], $oldname, $r['searchname']); + $this->updateName($db, $r['id'], $oldname, $r['searchname']); } if (preg_match('/\-\d{1}$/', $r['searchname'])) { while (preg_match('/\-\d{1}$/', $r['searchname'])) { $r['searchname'] = preg_replace('/\-\d{1}$/', '', $r['searchname']); } - $this->updateName($db, $r['ID'], $oldname, $r['searchname']); + $this->updateName($db, $r['id'], $oldname, $r['searchname']); } if (preg_match('/\!+.*?mom.*?\!+/i', $r['searchname'])) { while (preg_match('/\!+.*?mom.*?\!+/i', $r['searchname'])) { $r['searchname'] = preg_replace('/\!+.*?mom.*?\!+/i', '', $r['searchname']); } - $this->updateName($db, $r['ID'], $oldname, $r['searchname']); + $this->updateName($db, $r['id'], $oldname, $r['searchname']); } if (preg_match('/(\\/)/i', $r['searchname'])) { while (preg_match('/(\\/)/i', $r['searchname'])) { $r['searchname'] = preg_replace('/(\\/)/i', '', $r['searchname']); } - $this->updateName($db, $r['ID'], $oldname, $r['searchname']); + $this->updateName($db, $r['id'], $oldname, $r['searchname']); } } } @@ -1489,6 +1489,6 @@ class Parsing echo sprintf("OLD : %s\nNEW : %s\n\n", $oldname, $newname); if (!$this->echoonly) - $db->queryExec(sprintf("update releases set name=%s, searchname = %s WHERE ID = %d", $db->escapeString($newname), $db->escapeString($newname), $id)); + $db->queryExec(sprintf("update releases set name=%s, searchname = %s WHERE id = %d", $db->escapeString($newname), $db->escapeString($newname), $id)); } } diff --git a/lib/copy_this/www/lib/postprocess.php b/lib/copy_this/www/lib/postprocess.php index 8bc5d907a..5f98ec789 100644 --- a/lib/copy_this/www/lib/postprocess.php +++ b/lib/copy_this/www/lib/postprocess.php @@ -72,9 +72,9 @@ class PostProcess if($this->site->deletepasswordedrelease == 1) { echo "PostPrc : Removing unwanted releases\n"; - $result = $db->query("select ID from releases where passwordstatus > 0"); + $result = $db->query("select id from releases where passwordstatus > 0"); foreach ($result as $row) - $r->delete($row["ID"]); + $r->delete($row["id"]); } // @@ -84,9 +84,9 @@ class PostProcess { echo "PostPrc : Deleting releases older than ".$this->site->releaseretentiondays." days\n"; - $result = $db->query(sprintf("select ID from releases where postdate < %s - interval %d day", $db->escapeString($currTime_ori["now"]), $this->site->releaseretentiondays)); + $result = $db->query(sprintf("select id from releases where postdate < %s - interval %d day", $db->escapeString($currTime_ori["now"]), $this->site->releaseretentiondays)); foreach ($result as $row) - $r->delete($row["ID"]); + $r->delete($row["id"]); } // @@ -94,7 +94,7 @@ class PostProcess // if($this->site->audiopreviewprune > 0) { - $result = $db->query(sprintf("select guid from releases where categoryID in (select ID from category where parentID = ".Category::CAT_PARENT_MUSIC.") and haspreview = 2 and adddate < %s - interval %d day", $db->escapeString($currTime_ori["now"]), $this->site->audiopreviewprune)); + $result = $db->query(sprintf("select guid from releases where categoryid in (select id from category where parentID = ".Category::CAT_PARENT_MUSIC.") and haspreview = 2 and adddate < %s - interval %d day", $db->escapeString($currTime_ori["now"]), $this->site->audiopreviewprune)); if (sizeof($result) > 0) { @@ -117,7 +117,7 @@ class PostProcess // // all releases where the only file inside the rars is *.exe and they are not in the PC category // - $sql = "select releasefiles.releaseID as ID from releasefiles inner join ( select releaseID, count(*) as totnum from releasefiles group by releaseID ) x on x.releaseID = releasefiles.releaseID and x.totnum = 1 inner join releases on releases.ID = releasefiles.releaseID left join releasenfo on releasenfo.releaseID = releases.ID where (releasefiles.name like '%.exe' or releasefiles.name like '%.scr') and (releases.categoryID not in (select ID from category where parentID = ".Category::CAT_PARENT_PC.") or (releases.categoryID in (select ID from category where parentID = ".Category::CAT_PARENT_PC.") and releasenfo.ID is null)) group by releasefiles.releaseID"; + $sql = "select releasefiles.releaseid as id from releasefiles inner join ( select releaseid, count(*) as totnum from releasefiles group by releaseid ) x on x.releaseid = releasefiles.releaseid and x.totnum = 1 inner join releases on releases.id = releasefiles.releaseid left join releasenfo on releasenfo.releaseid = releases.id where (releasefiles.name like '%.exe' or releasefiles.name like '%.scr') and (releases.categoryid not in (select id from category where parentID = ".Category::CAT_PARENT_PC.") or (releases.categoryid in (select id from category where parentID = ".Category::CAT_PARENT_PC.") and releasenfo.id is null)) group by releasefiles.releaseid"; $result = $db->query($sql); $spamIDs = array_merge($result, $spamIDs); @@ -126,7 +126,7 @@ class PostProcess // if ($this->site->exepermittedcategories != '') { - $sql = sprintf("select releasefiles.releaseID as ID from releasefiles inner join releases on releases.ID = releasefiles.releaseID left join releasenfo on releasenfo.releaseID = releases.ID where releasefiles.name like '%%.exe' and releases.categoryID not in (%s) group by releasefiles.releaseID", $this->site->exepermittedcategories); + $sql = sprintf("select releasefiles.releaseid as id from releasefiles inner join releases on releases.id = releasefiles.releaseid left join releasenfo on releasenfo.releaseid = releases.id where releasefiles.name like '%%.exe' and releases.categoryid not in (%s) group by releasefiles.releaseid", $this->site->exepermittedcategories); $result = $db->query($sql); $spamIDs = array_merge($result, $spamIDs); } @@ -134,21 +134,21 @@ class PostProcess // // delete all releases which contain a file with password.url in it // - $sql = "select distinct releasefiles.releaseID as ID from releasefiles where name = 'password.url'"; + $sql = "select distinct releasefiles.releaseid as id from releasefiles where name = 'password.url'"; $result = $db->query($sql); $spamIDs = array_merge($result, $spamIDs); // // all releases where the only file inside the rars is *.rar // - $sql = "select releasefiles.releaseID as ID from releasefiles inner join ( select releaseID, count(*) as totnum from releasefiles group by releaseID ) x on x.releaseID = releasefiles.releaseID and x.totnum = 1 inner join releases on releases.ID = releasefiles.releaseID where releasefiles.name like '%.rar' group by releasefiles.releaseID"; + $sql = "select releasefiles.releaseid as id from releasefiles inner join ( select releaseid, count(*) as totnum from releasefiles group by releaseid ) x on x.releaseid = releasefiles.releaseid and x.totnum = 1 inner join releases on releases.id = releasefiles.releaseid where releasefiles.name like '%.rar' group by releasefiles.releaseid"; $result = $db->query($sql); $spamIDs = array_merge($result, $spamIDs); // // all audio which contains a file with .exe in // - $sql = "select distinct r.ID from releasefiles rf inner join releases r on r.id = rf.releaseID and r.categoryID in (select ID from category where parentID = ".Category::CAT_PARENT_MUSIC.") where (rf.name like '%.exe' or rf.name like '%.bin')"; + $sql = "select distinct r.id from releasefiles rf inner join releases r on r.id = rf.releaseid and r.categoryid in (select id from category where parentID = ".Category::CAT_PARENT_MUSIC.") where (rf.name like '%.exe' or rf.name like '%.bin')"; $result = $db->query($sql); $spamIDs = array_merge($result, $spamIDs); @@ -156,7 +156,7 @@ class PostProcess { echo "PostPrc : Deleting ".count($spamIDs)." spam releases\n" ; foreach ($spamIDs as $row) - $r->delete($row["ID"]); + $r->delete($row["id"]); } } } @@ -244,20 +244,20 @@ class PostProcess public function processUnknownCategory() { $db = new DB(); - $sql = sprintf("select ID from releases where categoryID = %d", Category::CAT_NOT_DETERMINED); + $sql = sprintf("select id from releases where categoryid = %d", Category::CAT_NOT_DETERMINED); $result = $db->query($sql); $rescount = sizeof($result); if ($rescount > 0) { echo "PostPrc : Attempting to fix ".$rescount." uncategorised release(s)\n"; - $sql = sprintf("update releases inner join releasevideo rv on rv.releaseID = releases.ID set releases.categoryID = %d where imdbid is not null and categoryid = %d and videocodec = 'XVID'", Category::CAT_MOVIE_SD, Category::CAT_NOT_DETERMINED); + $sql = sprintf("update releases inner join releasevideo rv on rv.releaseid = releases.id set releases.categoryid = %d where imdbid is not null and categoryid = %d and videocodec = 'XVID'", Category::CAT_MOVIE_SD, Category::CAT_NOT_DETERMINED); $db->queryExec($sql); - $sql = sprintf("update releases inner join releasevideo rv on rv.releaseID = releases.ID set releases.categoryID = %d where imdbid is not null and categoryid = %d and videocodec = 'V_MPEG4/ISO/AVC'", Category::CAT_MOVIE_HD, Category::CAT_NOT_DETERMINED); + $sql = sprintf("update releases inner join releasevideo rv on rv.releaseid = releases.id set releases.categoryid = %d where imdbid is not null and categoryid = %d and videocodec = 'V_MPEG4/ISO/AVC'", Category::CAT_MOVIE_HD, Category::CAT_NOT_DETERMINED); $db->queryExec($sql); - $sql = sprintf("update releases set categoryID = %d where categoryID = %d", Category::CAT_MISC_OTHER, Category::CAT_NOT_DETERMINED); + $sql = sprintf("update releases set categoryid = %d where categoryid = %d", Category::CAT_MISC_OTHER, Category::CAT_NOT_DETERMINED); $db->queryExec($sql); } } @@ -343,8 +343,8 @@ class PostProcess // // Get out all releases which have not been checked more than max attempts for password. // - $sql = sprintf("select r.ID, r.guid, r.name, c.disablepreview from releases r - left join category c on c.ID = r.categoryID + $sql = sprintf("select r.id, r.guid, r.name, c.disablepreview from releases r + left join category c on c.id = r.categoryid where (r.passwordstatus between %d and -1) or (r.haspreview = -1 and c.disablepreview = 0) order by r.postdate desc limit %d ", ($maxattemptstocheckpassworded + 1) * -1, $numtoProcess); $result = $db->query($sql); @@ -365,7 +365,7 @@ class PostProcess $blnTookSample = ($rel['disablepreview'] == 1) ? true : false; //only attempt sample if not disabled if ($blnTookSample) - $db->queryExec(sprintf("update releases set haspreview = 0 where id = %d", $rel['ID'])); + $db->queryExec(sprintf("update releases set haspreview = 0 where id = %d", $rel['id'])); // // Go through the binaries for this release looking for a rar, a sample, and a mediafile @@ -446,7 +446,7 @@ class PostProcess } if ($processMediainfo) - $blnTookMediainfo = $this->getMediainfo($tmpPath, $this->site->mediainfopath, $rel['ID']); + $blnTookMediainfo = $this->getMediainfo($tmpPath, $this->site->mediainfopath, $rel['id']); unlink($mediafile); } @@ -478,7 +478,7 @@ class PostProcess $this->updateReleaseHasPreview($rel['guid'], 2); if ($processMediainfo) - $blnTookMediainfo = $this->getMediainfo($tmpPath, $this->site->mediainfopath, $rel['ID']); + $blnTookMediainfo = $this->getMediainfo($tmpPath, $this->site->mediainfopath, $rel['id']); if ($this->site->lamepath != "") $this->lameAudioSample($this->site->lamepath, $rel['guid']); @@ -511,12 +511,12 @@ class PostProcess if ($fetchedBinary === false) { //echo "\nPostPrc : Failed fetching rar file\n"; - $db->queryExec(sprintf("update releases set passwordstatus = passwordstatus - 1 where ID = %d", $rel['ID'])); + $db->queryExec(sprintf("update releases set passwordstatus = passwordstatus - 1 where id = %d", $rel['id'])); continue; } else { - $relFiles = $this->processReleaseFiles($fetchedBinary, $rel['ID']); + $relFiles = $this->processReleaseFiles($fetchedBinary, $rel['id']); if ($this->site->checkpasswordedrar > 0 && $processPasswords) { @@ -553,7 +553,7 @@ class PostProcess if ($processMediainfo && $blnTookMediainfo === false) { - $blnTookMediainfo = $this->getMediainfo($tmpPath, $this->site->mediainfopath, $rel['ID']); + $blnTookMediainfo = $this->getMediainfo($tmpPath, $this->site->mediainfopath, $rel['id']); } // @@ -583,7 +583,7 @@ class PostProcess if (!$blnTookSample) $hpsql = ', haspreview = 0'; - $sql = sprintf("update releases set passwordstatus = %d %s where ID = %d", max($passStatus), $hpsql, $rel["ID"]); + $sql = sprintf("update releases set passwordstatus = %d %s where id = %d", max($passStatus), $hpsql, $rel["id"]); $db->queryExec($sql); } //end foreach result diff --git a/lib/copy_this/www/lib/powerprocess.php b/lib/copy_this/www/lib/powerprocess.php index c3c5a46b8..880d4862f 100644 --- a/lib/copy_this/www/lib/powerprocess.php +++ b/lib/copy_this/www/lib/powerprocess.php @@ -1,25 +1,25 @@ - * @link https://github.com/lordgnu/PowerProcess * @license MIT License * @version 2.0 - * + * * @copyright * Copyright (c) 2011 Don Bauer * Permission is hereby granted, free of charge, to any person obtaining a copy @@ -28,13 +28,13 @@ declare(ticks = 1); * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE @@ -46,243 +46,243 @@ class PowerProcess { const CALLBACK_CONTINUE = 1; const CALLBACK_SHUTDOWN = 2; const CALLBACK_RESTART = 3; - + /** * Current PowerProcess version - * + * * @var string */ public static $version = '2.1'; - + /** * Data store for data that is to be passed to the child process which is to be spawned - * + * * @var mixed */ public $threadData; - + /** * Boolean variable which determines whether or not to shutdown the control process (parent) - * + * * @var boolean */ public $complete; - + /** * Callback array for setting callback functions based on signals that can be sent to the parent process - * + * * @var array */ public $callbacks; - + /** * The name of the current thread. Used by WhoAmI() - * + * * @var string */ public $currentThread; - - /** + + /** * Whether to log internal debug message - * + * * @var boolean */ public $debugLogging; - + /** * The maximum number of concurrent threads that can be running at any given time. - * + * * This setting has an impact on performance for PowerProcess so play * with it on the system you are on to determine a good value. * 10 is a good place to start - * + * * @var integer */ public $maxThreads; - + /** * Array which stores the thread data for the control process (parent) to manage running child threads - * + * * @var array */ public $myThreads; - + /** - * Session ID of parent session when process is daemonized - * + * Session id of parent session when process is daemonized + * * @var integer */ public $parentSID; - - /** + + /** * The pid of the parent process - * + * * Used after a process is forked to * determine whether the new thread is to run the thread code - * + * * @var integer */ public $parentPID; - + /** * Sleep timer in micro seconds for the parent process to sleep between status checks using Tick() - * + * * @var integer */ public $tickCount = 100; - + /** * Whether to add a timestamp to log output - * + * * @var boolean */ public $timeStampLogs = true; - + /** * The maximum number of seconds a thread will be allowed to run. - * + * * Set to 0 to disable a time limit (use with caution) - * + * * @var integer */ public $threadTimeLimit; - + /** - * Location to log information messages to. - * + * Location to log information messages to. + * * Can be a file or php://stdout, php://stderr. * Set to false to disable - * + * * @var mixed */ public $logTo; - + /** * When logging is enabled, this points to the socket in which to write log messages. - * + * * @var resource */ public $logSocket; - + /** - * Signals to install for SignalDispatcher. - * + * Signals to install for SignalDispatcher. + * * You can use any signal constant PNCTL supports * @link http://us3.php.net/manual/en/pcntl.constants.php - * + * * @var array */ public $signalArray = array( SIGUSR1, // User-Defined 1 SIGUSR2 // User-Defined 2 ); - + static public function SignalName($signal) { switch ($signal) { - case SIGHUP: + case SIGHUP: return 'SIGHUP'; - case SIGINT: + case SIGINT: return 'SIGINT'; - case SIGQUIT: + case SIGQUIT: return 'SIGQUIT'; - case SIGILL: + case SIGILL: return 'SIGILL'; - case SIGTRAP: + case SIGTRAP: return 'SIGTRAP'; - case SIGABRT: + case SIGABRT: return 'SIGABRT'; - case SIGIOT: + case SIGIOT: return 'SIGIOT'; - case SIGBUS: + case SIGBUS: return 'SIGBUS'; - case SIGFPE: + case SIGFPE: return 'SIGFPE'; - case SIGUSR1: + case SIGUSR1: return 'SIGUSR1'; - case SIGSEGV: + case SIGSEGV: return 'SIGSEGV'; - case SIGUSR2: + case SIGUSR2: return 'SIGUSR2'; - case SIGPIPE: + case SIGPIPE: return 'SIGPIPE'; - case SIGALRM: + case SIGALRM: return 'SIGALRM'; - case SIGTERM: + case SIGTERM: return 'SIGTERM'; - case SIGSTKFLT: + case SIGSTKFLT: return 'SIGSTKFLT'; - case SIGCLD: + case SIGCLD: return 'SIGCLD'; - case SIGCHLD: + case SIGCHLD: return 'SIGCHLD'; - case SIGCONT: + case SIGCONT: return 'SIGCONT'; - case SIGTSTP: + case SIGTSTP: return 'SIGTSTP'; - case SIGTTIN: + case SIGTTIN: return 'SIGTTIN'; - case SIGTTOU: + case SIGTTOU: return 'SIGTTOU'; - case SIGURG: + case SIGURG: return 'SIGURG'; - case SIGXCPU: + case SIGXCPU: return 'SIGXCPU'; - case SIGXFSZ: + case SIGXFSZ: return 'SIGXFSZ'; - case SIGVTALRM: + case SIGVTALRM: return 'SIGVTALRM'; - case SIGPROF: + case SIGPROF: return 'SIGPROF'; - case SIGWINCH: + case SIGWINCH: return 'SIGWINCH'; - case SIGPOLL: + case SIGPOLL: return 'SIGPOLL'; - case SIGIO: + case SIGIO: return 'SIGIO'; - case SIGPWR: + case SIGPWR: return 'SIGPWR'; - case SIGSYS: + case SIGSYS: return 'SIGSYS'; - case SIGBABY: + case SIGBABY: return 'SIGBABY'; - case SIG_BLOCK: + case SIG_BLOCK: return 'SIG_BLOCK'; - case SIG_UNBLOCK: + case SIG_UNBLOCK: return 'SIG_UNBLOCK'; - case SIG_SETMASK: + case SIG_SETMASK: return 'SIG_SETMASK'; default: return "Signal # {$signal}"; } } - + /** - * PowerProcess constructor. - * + * PowerProcess constructor. + * * Returns an instanced PowerProcess object or dies on failure - * + * * @param integer $maxThreads Max number of concurrent threads to allow at any given time * @param integer $threadTimeLimit Maximum number of seconds a thread is allowed to live * @param boolean $daemon Whether to start as a deamon or just a normal script * @param string $logTo What stream to log output to * @param boolean $debugLogging Whether to enable debug logging - * + * * @return object Instanced PowerProcess object */ public function __construct($maxThreads = 10, $threadTimeLimit = 300, $daemon = false, $logTo = false, $debugLogging = false) { if (function_exists('pcntl_fork') && function_exists('posix_getpid')) { // Set the current thread name $this->currentThread = 'CONTROL'; - + // Set the max threads setting $this->SetMaxThreads($maxThreads); - + // Set the thread time limit setting $this->SetThreadTimeLimit($threadTimeLimit); - + // Init the logger $this->InitializeLogger($logTo, $debugLogging); - + if ($daemon) { // Attempt to daemonize if (!$this->Daemonize()) { @@ -296,39 +296,39 @@ class PowerProcess { $this->parentSID = false; $this->Log("Parent PID detected as {$this->parentPID}",true); } - + // The the complete flag to false $this->complete = false; - + // Install the signal handler $this->InstallSignalHandler(); - + // Init the Thread Queue $this->myThreads = array(); - + // Log completion of startup $this->Log("Startup process complete",true); } else { die("PowerProcess requires both the POSIX and PCNTL extensions to operate.\n"); } } - + /** * Frees up memory */ public function __destruct() { unset($this->callbacks); unset($this->myThreads); - + // Handle any remaining signals pcntl_signal_dispatch(); - + $this->RemoveLogger(); } - + /** * Executes specified program in the current process space - * + * * @param string $process Path to the binary process to execute * @param array $args Array of argument strings to pass to the program */ @@ -339,28 +339,28 @@ class PowerProcess { pcntl_exec($process, $args); } } - + /** * Returns the PID of the current process - * + * * @return integer */ public function GetPID() { return posix_getpid(); } - + /** * Returns the PID of the process that spawned this one - * + * * @return integer */ public function GetControlPID() { return posix_getppid(); } - + /** * Get the status of a running thread by name or PID - * + * * @param string|integer $name The name or PID of the process for which you want status information * @return array|boolean */ @@ -372,19 +372,19 @@ class PowerProcess { return false; } } - + /** * Determine whether the control process is daemonized - * + * * @return boolean */ public function IsDaemon() { return $this->parentSID !== false; } - + /** * Log a message - * + * * @param string $msg The message to log * @param boolean $internal Whether this is an internal debug logging message */ @@ -399,7 +399,7 @@ class PowerProcess { } } } - + /** * Restarts the control process */ @@ -412,48 +412,48 @@ class PowerProcess { $this->Log("Can not restart - Shutting down", true); return $this->Shutdown(); } - + // Wait for threads to complete while ($this->ThreadCount()) { $this->CheckThreads(); $this->Tick(); } - + // Remove the first arg if this is a stand-alone if ($cmd == $_SERVER['argv'][0]) unset($_SERVER['argv'][0]); - + // Execute Restart $this->Exec($cmd, $_SERVER['argv']); $this->Shutdown(true); return self::CALLBACK_IGNORE; } - + /** * Registers a callback function for the signal dispatcher or for special signals used by PowerProcess - * + * * Special signals are: * - 'shutdown' : Triggered on completion of the Shutdown() method * - 'threadotl' : Triggered on killing a thread due to exceeding time limit - * + * * @param int|string $signal The signal to register a callback for * @param callback $callback The callback function */ public function RegisterCallback($signal, $callback = false) { if ($callback !== false) $this->callbacks[$signal][] = $callback; - + // Register with PCNTL if (is_int($signal)) { $this->Log("Registering signal {$signal} with dispatcher",true); pcntl_signal($signal, array(&$this, 'SignalDispatch')); - + // Unblock the Signal pcntl_sigprocmask(SIG_UNBLOCK,array($signal)); } } - + /** * Determines whether we should be running the control code or the thread code - * + * * @return boolean */ public function RunControlCode() { @@ -465,19 +465,19 @@ class PowerProcess { return false; } } - + /** * Determines whether we should be running the child code - * + * * @return boolean */ public function RunThreadCode() { return !$this->ControlCheck(); } - + /** * Send a signal to a process - * + * * @param integer $pid * @param integer $signal */ @@ -488,65 +488,65 @@ class PowerProcess { return false; } } - + /** * Set the max number of threads that can be running concurrently - * + * * @param integer $maxThreads The max number of threads to run concurrently */ public function SetMaxThreads($maxThreads = 10) { $this->maxThreads = $maxThreads; } - + /** * Set the max number of seconds a thread can run before being terminated - * + * * @param integer $threadTimeLimit The max number of seconds a thread can run */ public function SetThreadTimeLimit($threadTimeLimit = 300) { $this->threadTimeLimit = $threadTimeLimit; } - + /** * Initiates the shutdown procedure for PowerProcess - * + * * @param boolean $exit When set to true, Shutdown causes the script to exit */ public function Shutdown($exit = false) { $this->Log("Initiating shutdown",true); - + while ($this->ThreadCount()) { $this->CheckThreads(); $this->Tick(); } - + $this->complete = true; - + // Send custom shutdown signal $this->SignalDispatch('shutdown'); - + $this->Log("Shutdown Complete"); if ($exit) exit; - + return self::CALLBACK_IGNORE; } - + /** * Determines if a new process can be spawned - * + * * @return boolean */ public function SpawnReady() { $this->Tick(); return ($this->ThreadCount() < $this->maxThreads); } - + /** * Spawn a new thread - * + * * @param string $name The name of the thread to be spawned * @param boolean $returnPid Whether to return the pid instead of boolean - * + * * @return boolean|integer */ public function SpawnThread($name = false, $returnPid = false) { @@ -556,7 +556,7 @@ class PowerProcess { $this->Tick(); return false; } - + if ($name !== false) { // Check to make sure there is not already a named thread with this name if ($this->GetThreadStatus($name) !== false) { @@ -565,9 +565,9 @@ class PowerProcess { return false; } } - + $pid = pcntl_fork(); - + if ($pid) { // We are the control thread so log the child in a queue $index = ($name === false) ? $pid : $name; @@ -586,43 +586,43 @@ class PowerProcess { return ($returnPid) ? $pid : true; } } - + /** * Get the count of running threads - * + * * @return integer */ public function ThreadCount() { return count($this->myThreads); } - + /** * Process signals to be dispatched and sleep for a number of microseconds */ public function Tick() { // Dispatch Pending Signals pcntl_signal_dispatch(); - + // Check Running Threads if ($this->parentPID == $this->GetPID()) $this->CheckThreads(); - + // Tick usleep($this->tickCount); } - + /** * Get the name of the current thread - * + * * @return string The name of the current thread */ public function WhoAmI() { return $this->currentThread; } - + // All Private Functions Below Here /** * Checks all running threads to make sure they are still running and their time limit has not been exceeded - * + * * If a thread has exceeded it's time limit, this method will kill that process * and dispatch the special signal 'threadotl' */ @@ -642,46 +642,46 @@ class PowerProcess { } } } - + /** * Check if the current process is the control process - * + * * @return boolean */ private function ControlCheck() { return $this->parentPID == $this->GetPID(); } - + /** * Attempts to daemonize the current process - * + * * @return integer */ private function Daemonize() { $this->Log("Attempting to Daemonize",true); - + // First need to fork $pid = pcntl_fork(); - + // Tick to catch signals $this->Tick(); - + if ($pid < 0) exit; // Error if ($pid) exit; // Parent - + $this->parentSID = posix_setsid(); - + // Need to reset the parent PID $this->parentPID = $this->GetPID(); $this->Log("Parent PID {$this->parentPID}",true); $this->Log("Parent SID {$this->parentSID}",true); - + return ($this->parentSID > 0); } - + /** * Initialize the logging stream if enabled - * + * * @param string|boolean $logTo The path or stream to log to or false to disable */ private function InitializeLogger($logTo, $debugLogging) { @@ -693,7 +693,7 @@ class PowerProcess { $this->debugLogging = false; } } - + /** * Installs the default signal handlers */ @@ -701,34 +701,34 @@ class PowerProcess { // Register the callback for thread completion $this->RegisterCallback(SIGCHLD, array($this,'CheckThreads')); $this->Log("SIGCHLD callback registered",true); - + // Register the callback for restart requests $this->RegisterCallback(SIGHUP, array($this, 'Restart')); $this->Log("SIGHUP callback registered",true); - + // Register the callback for shutdown requests $this->RegisterCallback(SIGTERM, array($this, 'Shutdown')); $this->Log("SIGTERM callback registered",true); - + // Install the signal handler foreach ($this->signalArray as $signal) $this->RegisterCallback($signal); $this->Log("Signal Dispatcher installed",true); } - + /** * Kill a thread by PID - * + * * @param integer $pid The PID of the thread to kill */ private function KillThread($pid = 0) { $this->SendSignal($pid, SIGTERM); } - + /** * Determine whether a child pid has exited - * + * * Returns the PID of child which exited or 0 - * + * * @param integer $pid The PID to check * @return integer */ @@ -739,7 +739,7 @@ class PowerProcess { return 0; } } - + /** * Closes the logging stream */ @@ -748,36 +748,36 @@ class PowerProcess { @fclose($this->logSocket); } } - + /** * Handles dispatching of signals to user-defined callbacks - * + * * @param integer|string $signal */ public function SignalDispatch($signal) { // Log Dispatch $signalName = self::SignalName($signal); $this->Log("Received signal: {$signalName}",true); - + // Check the callback array for this signal number if (isset($this->callbacks[$signal])) { // Execute the callback $callStack = $this->callbacks[$signal]; - + // Run last added callbacks first (FILO) $i = count($callStack); while ($callback = array_pop($callStack)) { $this->Log("Running Callback[{$i}] for signal: {$signalName}", true); --$i; $status = call_user_func($callback); - + // Check if we should continue if ($status == self::CALLBACK_STOP_PROPOGATION) { // Break out of loop $this->Log("Callback[{$i}] for signal '{$signalName}' has stopped propogation of further callbacks", true); break; } - + // OK, now switch on the status switch ($status) { case self::CALLBACK_RESTART: @@ -793,16 +793,16 @@ class PowerProcess { default: $this->Log("Callback[{$i}] for signal '{$signalName}' did not return a valid status"); } - + // Continue the loop } } else { // No callback registered $this->Log("There is no callback registered for signal {$signalName}",true); } - + // Handle SIGTERM for threads if ($signal == 15) exit(0); } - + } diff --git a/lib/copy_this/www/lib/predb.php b/lib/copy_this/www/lib/predb.php index ed7735a1b..74e9a8f72 100644 --- a/lib/copy_this/www/lib/predb.php +++ b/lib/copy_this/www/lib/predb.php @@ -17,12 +17,12 @@ class PreDB } /** - * Get a predb row by ID. + * Get a predb row by id. */ public function getByID($preID) { $db = new DB(); - $predbQuery = $db->query(sprintf("SELECT * FROM predb WHERE ID = %s LIMIT %d", $preID, 1)); + $predbQuery = $db->query(sprintf("SELECT * FROM predb WHERE id = %s LIMIT %d", $preID, 1)); return isset($predbQuery[0]) ? $predbQuery[0] : false; } @@ -63,7 +63,7 @@ class PreDB $dirname = empty($dirname) ? '' : sprintf("WHERE dirname LIKE %s", $db->escapeString('%'.$dirname.'%')); $category = empty($category) ? '' : sprintf((empty($dirname) ? 'WHERE' : ' AND')." category = %s", $db->escapeString($category)); - $predbQuery = $db->queryOneRow(sprintf('SELECT COUNT(ID) AS num FROM predb %s %s', $dirname, $category), true); + $predbQuery = $db->queryOneRow(sprintf('SELECT COUNT(id) AS num FROM predb %s %s', $dirname, $category), true); return $predbQuery['num']; } @@ -93,7 +93,7 @@ class PreDB $dirname = empty($dirname) ? '' : sprintf('WHERE dirname LIKE %s', $db->escapeString('%'.$dirname.'%')); $category = empty($category) ? '' : sprintf((empty($dirname) ? 'WHERE' : ' AND')." category = %s", $db->escapeString($category)); - $sql = sprintf('SELECT p.*, r.guid FROM predb p left outer join releases r on p.ID = r.preID %s %s ORDER BY ctime DESC LIMIT %d,%d', $dirname, $category, $start, $num); + $sql = sprintf('SELECT p.*, r.guid FROM predb p left outer join releases r on p.id = r.preid %s %s ORDER BY ctime DESC LIMIT %d,%d', $dirname, $category, $start, $num); return $db->query($sql, true); } @@ -109,16 +109,16 @@ class PreDB echo "Predb : Updating releases with pre data\n"; $matched = 0; - $releasesQuery = $db->queryDirect(sprintf('SELECT ID, searchname FROM releases WHERE preID IS NULL AND adddate > DATE_SUB(NOW(), INTERVAL %d DAY)', $daysback)); + $releasesQuery = $db->queryDirect(sprintf('SELECT id, searchname FROM releases WHERE preid IS NULL AND adddate > DATE_SUB(NOW(), INTERVAL %d DAY)', $daysback)); while($arr = $db->getAssocArray($releasesQuery)) { $arr['searchname'] = str_replace(' ', '_', $arr['searchname']); - $sql = sprintf("SELECT ID FROM predb WHERE dirname = %s LIMIT 1", $db->escapeString($arr['searchname'])); + $sql = sprintf("SELECT id FROM predb WHERE dirname = %s LIMIT 1", $db->escapeString($arr['searchname'])); $predbQuery = $db->queryOneRow($sql); if($predbQuery) { - $db->queryExec(sprintf('UPDATE releases SET preID = %d WHERE ID = %d', $predbQuery['ID'], $arr['ID'])); + $db->queryExec(sprintf('UPDATE releases SET preid = %d WHERE id = %d', $predbQuery['id'], $arr['id'])); $matched++; } @@ -242,7 +242,7 @@ class PreDB $cnt--; if(preg_match('/^'.$site->nzpresubject.'$/', $groupMsg['Subject']) && preg_match('/^'.$site->nzpreposter.'$/', $groupMsg['From'])) { - $ret = $msgHeader = $nntp->getHeader($groupMsg['Message-ID']); + $ret = $msgHeader = $nntp->getHeader($groupMsg['Message-id']); if($nntp->isError($ret)) continue; diff --git a/lib/copy_this/www/lib/releasecomments.php b/lib/copy_this/www/lib/releasecomments.php index 2ce8c4934..4c9cc98c0 100644 --- a/lib/copy_this/www/lib/releasecomments.php +++ b/lib/copy_this/www/lib/releasecomments.php @@ -8,12 +8,12 @@ require_once(WWW_DIR."/lib/site.php"); class ReleaseComments { /** - * Get a comment by ID. + * Get a comment by id. */ public function getCommentById($id) { $db = new DB(); - return $db->queryOneRow(sprintf("SELECT * FROM releasecomment WHERE ID = %d", $id)); + return $db->queryOneRow(sprintf("SELECT * FROM releasecomment WHERE id = %d", $id)); } /** @@ -22,7 +22,7 @@ class ReleaseComments public function getCommentsByGid($gid) { $db = new DB(); - return $db->query(sprintf("SELECT rc.id, text, createddate, sourceid, CASE WHEN sourceid = 0 THEN (SELECT username FROM users WHERE id = userid) ELSE username END AS username, CASE WHEN sourceid = 0 THEN (SELECT role FROM users WHERE id = userid) ELSE '-1' END AS role, CASE WHEN sourceid =0 THEN (SELECT r.name AS rolename FROM users AS u LEFT JOIN userroles AS r ON r.ID = u.role WHERE u.id = userid) ELSE (SELECT description AS rolename FROM spotnabsources WHERE ID = sourceid) END AS rolename FROM releasecomment rc WHERE isvisible = 1 AND gid = %s AND (userID IN (SELECT id FROM users) OR rc.username IS NOT NULL) ORDER BY createddate DESC LIMIT 100", $db->escapeString($gid))); + return $db->query(sprintf("SELECT rc.id, text, createddate, sourceid, CASE WHEN sourceid = 0 THEN (SELECT username FROM users WHERE id = userid) ELSE username END AS username, CASE WHEN sourceid = 0 THEN (SELECT role FROM users WHERE id = userid) ELSE '-1' END AS role, CASE WHEN sourceid =0 THEN (SELECT r.name AS rolename FROM users AS u LEFT JOIN userroles AS r ON r.id = u.role WHERE u.id = userid) ELSE (SELECT description AS rolename FROM spotnabsources WHERE id = sourceid) END AS rolename FROM releasecomment rc WHERE isvisible = 1 AND gid = %s AND (userID IN (SELECT id FROM users) OR rc.username IS NOT NULL) ORDER BY createddate DESC LIMIT 100", $db->escapeString($gid))); } /** @@ -53,7 +53,7 @@ class ReleaseComments } } - $q = "SELECT count(ID) AS num FROM releasecomment"; + $q = "SELECT count(id) AS num FROM releasecomment"; $clause = array(); if($refdate !== Null) $clause[] = "createddate >= '$refdate'"; @@ -89,7 +89,7 @@ class ReleaseComments } /** - * Delete all comments for a release.ID. + * Delete all comments for a release.id. */ public function deleteCommentsForRelease($id) { @@ -103,7 +103,7 @@ class ReleaseComments } /** - * Delete all comments for a users.ID. + * Delete all comments for a users.id. */ public function deleteCommentsForUser($id) { @@ -115,7 +115,7 @@ class ReleaseComments $comments = $this->getCommentsForUserRange($id, 0, $numcomments); foreach ($comments as $comment) { - $this->deleteComment($comment["ID"]); + $this->deleteComment($comment["id"]); $this->updateReleaseCommentCount($comment["gid"]); } } @@ -136,7 +136,7 @@ class ReleaseComments if ($s->storeuserips != "1") $host = ""; - $comid = $db->queryInsert(sprintf("INSERT INTO releasecomment (releaseID, gid, text, userID, createddate, host) VALUES (%d, %s, %s, %d, now(), %s)", $id, $db->escapeString($gid), $db->escapeString($text), $userid, $db->escapeString($host))); + $comid = $db->queryInsert(sprintf("INSERT INTO releasecomment (releaseid, gid, text, userID, createddate, host) VALUES (%d, %s, %s, %d, now(), %s)", $id, $db->escapeString($gid), $db->escapeString($text), $userid, $db->escapeString($host))); $this->updateReleaseCommentCount($gid); return $comid; } @@ -153,7 +153,7 @@ class ReleaseComments else $limit = " LIMIT ".$start.",".$num; - $sql = "SELECT rc.ID, userID, guid, text, createddate, sourceid, CASE WHEN sourceID = 0 THEN (SELECT username FROM users WHERE id = userID) ELSE username END AS username, CASE WHEN sourceid = 0 THEN (SELECT role FROM users WHERE id = userid) ELSE '-1' END AS role, CASE WHEN sourceid =0 THEN (SELECT r.name AS rolename FROM users AS u LEFT JOIN userroles AS r ON r.ID = u.role WHERE u.id = userid) ELSE (SELECT description AS rolename FROM spotnabsources WHERE ID = sourceid) END AS rolename FROM releasecomment rc LEFT JOIN releases r ON r.gid = rc.gid WHERE isvisible = 1 AND (userID IN (SELECT id FROM users) OR rc.username IS NOT NULL) ORDER BY createddate DESC ".$limit; + $sql = "SELECT rc.id, userID, guid, text, createddate, sourceid, CASE WHEN sourceID = 0 THEN (SELECT username FROM users WHERE id = userID) ELSE username END AS username, CASE WHEN sourceid = 0 THEN (SELECT role FROM users WHERE id = userid) ELSE '-1' END AS role, CASE WHEN sourceid =0 THEN (SELECT r.name AS rolename FROM users AS u LEFT JOIN userroles AS r ON r.id = u.role WHERE u.id = userid) ELSE (SELECT description AS rolename FROM spotnabsources WHERE id = sourceid) END AS rolename FROM releasecomment rc LEFT JOIN releases r ON r.gid = rc.gid WHERE isvisible = 1 AND (userID IN (SELECT id FROM users) OR rc.username IS NOT NULL) ORDER BY createddate DESC ".$limit; return $db->query($sql); } @@ -164,7 +164,7 @@ class ReleaseComments { $db = new DB(); $db->queryExec(sprintf("update releases - SET comments = (SELECT count(ID) FROM releasecomment WHERE releasecomment.gid = releases.gid AND isvisible = 1) + SET comments = (SELECT count(id) FROM releasecomment WHERE releasecomment.gid = releases.gid AND isvisible = 1) WHERE releases.gid = %s", $db->escapeString($gid) )); } @@ -174,7 +174,7 @@ class ReleaseComments public function getCommentCountForUser($uid) { $db = new DB(); - $res = $db->queryOneRow(sprintf("SELECT count(ID) AS num FROM releasecomment WHERE userID = %d AND isvisible = 1", $uid)); + $res = $db->queryOneRow(sprintf("SELECT count(id) AS num FROM releasecomment WHERE userID = %d AND isvisible = 1", $uid)); return $res["num"]; } @@ -190,6 +190,6 @@ class ReleaseComments else $limit = " LIMIT ".$start.",".$num; - return $db->query(sprintf("SELECT releasecomment.*, r.guid, r.searchname, users.username FROM releasecomment INNER JOIN releases r ON r.ID = releasecomment.releaseID LEFT OUTER JOIN users ON users.ID = releasecomment.userID WHERE userID = %d ORDER BY releasecomment.createddate DESC ".$limit, $uid)); + return $db->query(sprintf("SELECT releasecomment.*, r.guid, r.searchname, users.username FROM releasecomment INNER JOIN releases r ON r.id = releasecomment.releaseid LEFT OUTER JOIN users ON users.id = releasecomment.userID WHERE userID = %d ORDER BY releasecomment.createddate DESC ".$limit, $uid)); } } diff --git a/lib/copy_this/www/lib/releaseextra.php b/lib/copy_this/www/lib/releaseextra.php index c969d913e..240e09c4f 100644 --- a/lib/copy_this/www/lib/releaseextra.php +++ b/lib/copy_this/www/lib/releaseextra.php @@ -42,23 +42,23 @@ class ReleaseExtra { $db = new DB(); - return $db->query(sprintf("select * from releaseaudio where releaseID = %d order by audioID ASC", $id)); + return $db->query(sprintf("select * from releaseaudio where releaseid = %d order by audioID ASC", $id)); } public function getBriefByGuid($guid) { $db = new DB(); - return $db->queryOneRow(sprintf("select containerformat,videocodec,videoduration,videoaspect, concat(releasevideo.videowidth,'x',releasevideo.videoheight,' @',format(videoframerate,0),'fps') as size, group_concat(distinct releaseaudio.audiolanguage SEPARATOR ', ') as audio, group_concat(distinct releaseaudio.audiobitrate SEPARATOR ', ') as audiobitrate, group_concat(distinct releaseaudio.audioformat SEPARATOR ', ') as audioformat, group_concat(distinct releaseaudio.audiomode SEPARATOR ', ') as audiomode, group_concat(distinct releaseaudio.audiobitratemode SEPARATOR ', ') as audiobitratemode, group_concat(distinct releasesubs.subslanguage SEPARATOR ', ') as subs from releaseaudio left outer join releasesubs on releaseaudio.releaseID = releasesubs.releaseID left outer join releasevideo on releasevideo.releaseID = releaseaudio.releaseID inner join releases r on r.ID = releaseaudio.releaseID where r.guid = %s group by r.ID", $db->escapeString($guid))); + return $db->queryOneRow(sprintf("select containerformat,videocodec,videoduration,videoaspect, concat(releasevideo.videowidth,'x',releasevideo.videoheight,' @',format(videoframerate,0),'fps') as size, group_concat(distinct releaseaudio.audiolanguage SEPARATOR ', ') as audio, group_concat(distinct releaseaudio.audiobitrate SEPARATOR ', ') as audiobitrate, group_concat(distinct releaseaudio.audioformat SEPARATOR ', ') as audioformat, group_concat(distinct releaseaudio.audiomode SEPARATOR ', ') as audiomode, group_concat(distinct releaseaudio.audiobitratemode SEPARATOR ', ') as audiobitratemode, group_concat(distinct releasesubs.subslanguage SEPARATOR ', ') as subs from releaseaudio left outer join releasesubs on releaseaudio.releaseid = releasesubs.releaseid left outer join releasevideo on releasevideo.releaseid = releaseaudio.releaseid inner join releases r on r.id = releaseaudio.releaseid where r.guid = %s group by r.id", $db->escapeString($guid))); } public function delete($id) { $db = new DB(); - $db->queryExec(sprintf("DELETE from releaseaudio where releaseID = %d", $id)); - $db->queryExec(sprintf("DELETE from releasesubs where releaseID = %d", $id)); - $db->queryExec(sprintf("DELETE from releaseextrafull where releaseID = %d", $id)); - $db->queryExec(sprintf("DELETE from releasevideo where releaseID = %d", $id)); + $db->queryExec(sprintf("DELETE from releaseaudio where releaseid = %d", $id)); + $db->queryExec(sprintf("DELETE from releasesubs where releaseid = %d", $id)); + $db->queryExec(sprintf("DELETE from releaseextrafull where releaseid = %d", $id)); + $db->queryExec(sprintf("DELETE from releasevideo where releaseid = %d", $id)); } /** @@ -177,7 +177,7 @@ class ReleaseExtra $videoframerate = 0.0; $sql = sprintf("insert into releasevideo - (releaseID, containerformat, overallbitrate, videoduration, + (releaseid, containerformat, overallbitrate, videoduration, videoformat, videocodec, videowidth, videoheight, videoaspect, videoframerate, videolibrary, definition) values ( %d, %s, %s, %s, %s, %s, %d, %d, %s, %s, %s, %d )", @@ -193,7 +193,7 @@ class ReleaseExtra { $db = new DB(); - return $db->queryOneRow(sprintf("select * from releasevideo where releaseID = %d", $id)); + return $db->queryOneRow(sprintf("select * from releasevideo where releaseid = %d", $id)); } /** @@ -246,7 +246,7 @@ class ReleaseExtra return -1; $sql = sprintf("insert into releaseaudio - (releaseID, audioID,audioformat,audiomode, audiobitratemode, audiobitrate, + (releaseid, audioID,audioformat,audiomode, audiobitratemode, audiobitrate, audiochannels,audiosamplerate,audiolibrary,audiolanguage,audiotitle) values ( %d, %d, %s, %s, %s, %s, %s, %s, %s, %s, %s )", $releaseID, $audioID, $db->escapeString($audioformat), $db->escapeString($audiomode), $db->escapeString($audiobitratemode), @@ -261,7 +261,7 @@ class ReleaseExtra { $db = new DB(); - return $db->queryOneRow(sprintf("select * from releaseaudio where releaseID = %d and audioID = %d", $rid, $aid)); + return $db->queryOneRow(sprintf("select * from releaseaudio where releaseid = %d and audioID = %d", $rid, $aid)); } public function addSubs($releaseID, $subsID, $subslanguage) @@ -271,7 +271,7 @@ class ReleaseExtra if ($row) return -1; - $sql = sprintf("insert into releasesubs (releaseID, subsID, subslanguage) values ( %d, %d, %s)", $releaseID, $subsID, $db->escapeString($subslanguage)); + $sql = sprintf("insert into releasesubs (releaseid, subsID, subslanguage) values ( %d, %d, %s)", $releaseID, $subsID, $db->escapeString($subslanguage)); return $db->queryInsert($sql); } @@ -280,14 +280,14 @@ class ReleaseExtra { $db = new DB(); - return $db->queryOneRow(sprintf("SELECT group_concat(subslanguage SEPARATOR ', ') as subs FROM `releasesubs` WHERE `releaseID` = %d ORDER BY `subsID` ASC", $id)); + return $db->queryOneRow(sprintf("SELECT group_concat(subslanguage SEPARATOR ', ') as subs FROM `releasesubs` WHERE `releaseid` = %d ORDER BY `subsID` ASC", $id)); } public function deleteFull($id) { $db = new DB(); - return $db->queryExec(sprintf("DELETE from releaseextrafull where releaseID = %d", $id)); + return $db->queryExec(sprintf("DELETE from releaseextrafull where releaseid = %d", $id)); } public function addFull($id, $xml) @@ -297,13 +297,13 @@ class ReleaseExtra if ($row) return -1; - return $db->queryInsert(sprintf("insert into releaseextrafull (releaseID, mediainfo) values (%d, %s)", $id, $db->escapeString($xml))); + return $db->queryInsert(sprintf("insert into releaseextrafull (releaseid, mediainfo) values (%d, %s)", $id, $db->escapeString($xml))); } public function getFull($id) { $db = new DB(); - return $db->queryOneRow(sprintf("select * from releaseextrafull where releaseID = %d", $id)); + return $db->queryOneRow(sprintf("select * from releaseextrafull where releaseid = %d", $id)); } } \ No newline at end of file diff --git a/lib/copy_this/www/lib/releasefiles.php b/lib/copy_this/www/lib/releasefiles.php index ec95fb823..df5f23049 100644 --- a/lib/copy_this/www/lib/releasefiles.php +++ b/lib/copy_this/www/lib/releasefiles.php @@ -7,12 +7,12 @@ require_once(WWW_DIR."/lib/framework/db.php"); class ReleaseFiles { /** - * Get releasefiles row by ID. + * Get releasefiles row by id. */ public function get($id) { $db = new DB(); - return $db->query(sprintf("select * from releasefiles where releaseID = %d order by releasefiles.name ", $id)); + return $db->query(sprintf("select * from releasefiles where releaseid = %d order by releasefiles.name ", $id)); } /** @@ -21,7 +21,7 @@ class ReleaseFiles public function getByGuid($guid) { $db = new DB(); - return $db->query(sprintf("select releasefiles.* from releasefiles inner join releases r on r.ID = releasefiles.releaseID where r.guid = %s order by releasefiles.name ", $db->escapeString($guid))); + return $db->query(sprintf("select releasefiles.* from releasefiles inner join releases r on r.id = releasefiles.releaseid where r.guid = %s order by releasefiles.name ", $db->escapeString($guid))); } /** @@ -30,7 +30,7 @@ class ReleaseFiles public function delete($id) { $db = new DB(); - return $db->queryExec(sprintf("DELETE from releasefiles where releaseID = %d", $id)); + return $db->queryExec(sprintf("DELETE from releasefiles where releaseid = %d", $id)); } /** @@ -39,7 +39,7 @@ class ReleaseFiles public function add($id, $name, $size, $createddate, $passworded) { $db = new DB(); - $sql = sprintf("INSERT INTO releasefiles (releaseID, name, size, createddate, passworded) VALUES (%d, %s, %s, from_unixtime(%d), %d)", $id, $db->escapeString($name), $db->escapeString($size), $createddate, $passworded ); + $sql = sprintf("INSERT INTO releasefiles (releaseid, name, size, createddate, passworded) VALUES (%d, %s, %s, from_unixtime(%d), %d)", $id, $db->escapeString($name), $db->escapeString($size), $createddate, $passworded ); return $db->queryInsert($sql); } } \ No newline at end of file diff --git a/lib/copy_this/www/lib/releaseregex.php b/lib/copy_this/www/lib/releaseregex.php index 464672dc1..6c37ac573 100644 --- a/lib/copy_this/www/lib/releaseregex.php +++ b/lib/copy_this/www/lib/releaseregex.php @@ -37,23 +37,23 @@ class ReleaseRegex $where .= sprintf(" and releaseregex.groupname = %s", $db->escapeString($groupname)); if ($userReleaseRegex === true) { - $where .= ' AND releaseregex.ID >= 100000'; + $where .= ' AND releaseregex.id >= 100000'; } else if ($userReleaseRegex === false) { - $where .= ' AND releaseregex.ID < 100000'; + $where .= ' AND releaseregex.id < 100000'; } $relcountjoin = ""; $relcountcol = ""; if ($blnIncludeReleaseCount) { $relcountcol = " , coalesce(x.count, 0) as num_releases, coalesce(x.adddate, 'n/a') as max_releasedate "; - $relcountjoin = " left outer join ( select regexID, max(adddate) adddate, count(ID) as count from releases group by regexID) x on x.regexID = releaseregex.ID "; + $relcountjoin = " left outer join ( select regexid, max(adddate) adddate, count(id) as count from releases group by regexid) x on x.regexid = releaseregex.id "; } - $this->regexes = $db->query("SELECT releaseregex.ID, releaseregex.categoryID, category.title as categoryTitle, releaseregex.status, releaseregex.description, releaseregex.groupname AS groupname, releaseregex.regex, - groups.ID AS groupID, releaseregex.ordinal " . $relcountcol . " + $this->regexes = $db->query("SELECT releaseregex.id, releaseregex.categoryid, category.title as categoryTitle, releaseregex.status, releaseregex.description, releaseregex.groupname AS groupname, releaseregex.regex, + groups.id AS groupid, releaseregex.ordinal " . $relcountcol . " FROM releaseregex left outer JOIN groups ON groups.name = releaseregex.groupname - left outer join category on category.ID = releaseregex.categoryID + left outer join category on category.id = releaseregex.categoryid " . $relcountjoin . " where 1=1 " . $where . " ORDER BY groupname LIKE '%*' ASC, coalesce(groupname,'zzz') DESC, ordinal ASC" @@ -81,17 +81,17 @@ class ReleaseRegex } /** - * Get a releaseregex row by ID. + * Get a releaseregex row by id. */ public function getByID($id) { $db = new DB(); - return $db->queryOneRow(sprintf("select * from releaseregex where ID = %d ", $id)); + return $db->queryOneRow(sprintf("select * from releaseregex where id = %d ", $id)); } /** - * Get a releaseregex row by ID. + * Get a releaseregex row by id. */ public function getForGroup($groupname) { @@ -103,7 +103,7 @@ class ReleaseRegex if ($outcome) $ret[] = $groupRegex; elseif ($outcome === false) - echo "ERROR: " . ($groupRegex["ID"] < 10000 ? "System" : "Custom") . " release regex '" . $groupRegex["ID"] . "'. Group name '" . $groupRegex["groupname"] . "' should be a valid regex.\n"; + echo "ERROR: " . ($groupRegex["id"] < 10000 ? "System" : "Custom") . " release regex '" . $groupRegex["id"] . "'. Group name '" . $groupRegex["groupname"] . "' should be a valid regex.\n"; } } @@ -117,7 +117,7 @@ class ReleaseRegex { $db = new DB(); - return $db->queryExec(sprintf("DELETE from releaseregex where ID = %d", $id)); + return $db->queryExec(sprintf("DELETE from releaseregex where id = %d", $id)); } /** @@ -139,7 +139,7 @@ class ReleaseRegex else $catid = sprintf("%d", $regex["category"]); - $db->queryExec(sprintf("update releaseregex set groupname=%s, regex=%s, ordinal=%d, status=%d, description=%s, categoryID=%s where ID = %d ", + $db->queryExec(sprintf("update releaseregex set groupname=%s, regex=%s, ordinal=%d, status=%d, description=%s, categoryid=%s where id = %d ", $groupname, $db->escapeString($regex["regex"]), $regex["ordinal"], $regex["status"], $db->escapeString($regex["description"]), $catid, $regex["id"] ) ); @@ -164,7 +164,7 @@ class ReleaseRegex else $catid = sprintf("%d", $regex["category"]); - return $db->queryInsert(sprintf("insert into releaseregex (groupname, regex, ordinal, status, description, categoryID) values (%s, %s, %d, %d, %s, %s) ", + return $db->queryInsert(sprintf("insert into releaseregex (groupname, regex, ordinal, status, description, categoryid) values (%s, %s, %d, %d, %s, %s) ", $groupname, $db->escapeString($regex["regex"]), $regex["ordinal"], $regex["status"], $db->escapeString($regex["description"]), $catid ) ); @@ -177,9 +177,9 @@ class ReleaseRegex $outcome = @preg_match($regexArr["regex"], $binarySubject, $matches); if ($outcome === false) { - echo "ERROR: " . ($regexArr["ID"] < 10000 ? "System" : "Custom") . " release regex '" . $regexArr["ID"] . "' is not a valid regex.\n"; + echo "ERROR: " . ($regexArr["id"] < 10000 ? "System" : "Custom") . " release regex '" . $regexArr["id"] . "' is not a valid regex.\n"; $db = new DB(); - $db->queryExec(sprintf("update releaseregex set status=0 where ID = %d and status=1", $regexArr["ID"])); + $db->queryExec(sprintf("update releaseregex set status=0 where id = %d and status=1", $regexArr["id"])); return $ret; } @@ -194,7 +194,7 @@ class ReleaseRegex // Check that the regex provided the correct parameters if (!isset($matches['name']) || empty($matches['name'])) { - //echo "ERROR: Regex applied which didnt return right number of capture groups - '".$regexArr["ID"]."'\n"; + //echo "ERROR: Regex applied which didnt return right number of capture groups - '".$regexArr["id"]."'\n"; return $ret; } @@ -208,8 +208,8 @@ class ReleaseRegex } $regcatid = "null "; - if ($regexArr["categoryID"] != "") - $regcatid = $regexArr["categoryID"]; + if ($regexArr["categoryid"] != "") + $regcatid = $regexArr["categoryid"]; //override if ($regcatid == Category::CAT_PC_0DAY) { if ($cat->isPhone($matches['name'])) @@ -238,8 +238,8 @@ class ReleaseRegex } $matches['regcatid'] = $regcatid; - $matches['regexID'] = $regexArr['ID']; - $matches['reqID'] = $reqID; + $matches['regexid'] = $regexArr['id']; + $matches['reqid'] = $reqID; $ret = $matches; } @@ -265,17 +265,17 @@ class ReleaseRegex $groupname = '.*'; if ($matchagainstbins !== '') - $sql = sprintf("select b.*, '0' as size, '0' as blacklistID, g.name as groupname from %s b left join groups g on g.ID = b.groupID where b.groupID IN (select g.ID from groups g where g.name REGEXP %s) order by b.date desc", $group['bname'], $db->escapeString('^' . $groupname . '$')); + $sql = sprintf("select b.*, '0' as size, '0' as blacklistID, g.name as groupname from %s b left join groups g on g.id = b.groupid where b.groupid IN (select g.id from groups g where g.name REGEXP %s) order by b.date desc", $group['bname'], $db->escapeString('^' . $groupname . '$')); else $sql = sprintf("select rrt.* from releaseregextesting rrt where rrt.groupname REGEXP %s order by rrt.date desc", $db->escapeString('^' . $groupname . '$')); $resbin = $db->queryDirect($sql); while ($rowbin = $db->getAssocArray($resbin)) { - if ($ignorematched !== '' && ($rowbin['regexID'] != '' || $rowbin['blacklistID'] == 1)) + if ($ignorematched !== '' && ($rowbin['regexid'] != '' || $rowbin['blacklistID'] == 1)) continue; - $regexarr = array("ID" => "", 'regex' => $regex, 'poster' => $poster, "categoryID" => ""); + $regexarr = array("id" => "", 'regex' => $regex, 'poster' => $poster, "categoryid" => ""); $regexCheck = $this->performMatch($regexarr, $rowbin['name'], $rowbin['fromname']); if ($regexCheck !== false) { @@ -294,7 +294,7 @@ class ReleaseRegex $matches[$relname]['relparts'][$relparts[1]] = $relparts[1]; $matches[$relname]['reltotalparts'] = array_sum($matches[$relname]['relparts']); - $matches[$relname]['regexID'] = $regexCheck['regexID']; + $matches[$relname]['regexid'] = $regexCheck['regexid']; if (ctype_digit($regexCheck['regcatid'])) $matches[$relname]['catname'] = $catList[$regexCheck['regcatid']]; @@ -396,7 +396,7 @@ class ReleaseRegex $headers[$subject]['Subject'] = $subject; $headers[$subject]['From'] = $msg['From']; $headers[$subject]['Date'] = strtotime($msg['Date']); - $headers[$subject]['Message-ID'] = $msg['Message-ID']; + $headers[$subject]['Message-id'] = $msg['Message-id']; $headers[$subject]['Size'] = $msg['Bytes']; } else $headers[$subject]['Size'] += $msg['Bytes']; @@ -416,9 +416,9 @@ class ReleaseRegex 'date' => $data['Date'], 'binaryhash' => md5($subject . $data['From'] . $group), 'groupname' => $group, - 'regexID' => "null", - 'categoryID' => "null", - 'reqID' => "null", + 'regexid' => "null", + 'categoryid' => "null", + 'reqid' => "null", 'blacklistID' => 0, 'size' => $data['Size'], 'relname' => "null", @@ -439,9 +439,9 @@ class ReleaseRegex if ($regexCheck !== false) { $regexMatches = $regexCheck; - $binData['regexID'] = $regexCheck['regexID']; - $binData['categoryID'] = $regexCheck['regcatid']; - $binData['reqID'] = empty($regexCheck['reqID']) ? "null" : $regexCheck['reqID']; + $binData['regexid'] = $regexCheck['regexid']; + $binData['categoryid'] = $regexCheck['regcatid']; + $binData['reqid'] = empty($regexCheck['reqid']) ? "null" : $regexCheck['reqid']; $binData['relname'] = $regexCheck['name']; break; } @@ -455,9 +455,9 @@ class ReleaseRegex foreach ($binChunks as $binChunk) { foreach ($binChunk as $chunk) { - $binParams[] = sprintf("(%s, %s, FROM_UNIXTIME(%s), %s, %s, %s, %s, %s, %d, %d, now())", $db->escapeString($chunk['name']), $db->escapeString($chunk['fromname']), $db->escapeString($chunk['date']), $db->escapeString($chunk['binaryhash']), $db->escapeString($chunk['groupname']), $chunk['regexID'], $chunk['categoryID'], $chunk['reqID'], $chunk['blacklistID'], $chunk['size']); + $binParams[] = sprintf("(%s, %s, FROM_UNIXTIME(%s), %s, %s, %s, %s, %s, %d, %d, now())", $db->escapeString($chunk['name']), $db->escapeString($chunk['fromname']), $db->escapeString($chunk['date']), $db->escapeString($chunk['binaryhash']), $db->escapeString($chunk['groupname']), $chunk['regexid'], $chunk['categoryid'], $chunk['reqid'], $chunk['blacklistID'], $chunk['size']); } - $binSql = "INSERT IGNORE INTO releaseregextesting (name, fromname, date, binaryhash, groupname, regexID, categoryID, reqID, blacklistID, size, dateadded) VALUES " . implode(', ', $binParams); + $binSql = "INSERT IGNORE INTO releaseregextesting (name, fromname, date, binaryhash, groupname, regexid, categoryid, reqid, blacklistID, size, dateadded) VALUES " . implode(', ', $binParams); //echo $binSql; $db->queryExec($binSql); } diff --git a/lib/copy_this/www/lib/releases.php b/lib/copy_this/www/lib/releases.php index 3991e53b5..c425ac05e 100644 --- a/lib/copy_this/www/lib/releases.php +++ b/lib/copy_this/www/lib/releases.php @@ -68,7 +68,7 @@ class Releases } /** - * Insert a single release returning the ID on success or false on failure. + * Insert a single release returning the id on success or false on failure. * * @param array $parameters Insert parameters, must be escaped if string. * @@ -79,24 +79,24 @@ class Releases $parameters['id'] = $this->pdo->queryInsert( sprintf( "INSERT INTO releases - (name, searchname, totalpart, groupID, adddate, guid, rageID, postdate, fromname, - size, passwordstatus, haspreview, categoryID, nfostatus, nzbstatus, - isrenamed, iscategorized, reqidstatus, prehashID) + (name, searchname, totalpart, groupid, adddate, guid, rageid, postdate, fromname, + size, passwordstatus, haspreview, categoryid, nfostatus, nzbstatus, + isrenamed, iscategorized, reqidstatus, prehashid) VALUES (%s, %s, %d, %d, NOW(), %s, -1, %s, %s, %s, %d, -1, %d, -1, %d, %d, 1, %d, %d)", $parameters['name'], $parameters['searchname'], $parameters['totalpart'], - $parameters['groupID'], + $parameters['groupid'], $parameters['guid'], $parameters['postdate'], $parameters['fromname'], $parameters['size'], $this->passwordStatus, - $parameters['categoryID'], + $parameters['categoryid'], $parameters['nzbstatus'], $parameters['isrenamed'], $parameters['reqidstatus'], - $parameters['prehashID'] + $parameters['prehashid'] ) ); $this->sphinxSearch->insertRelease($parameters); @@ -121,8 +121,8 @@ class Releases sprintf( 'SELECT r.*, g.name AS group_name, c.title AS category_name FROM releases r - INNER JOIN category c ON c.ID = r.categoryID - INNER JOIN groups g ON g.ID = r.groupID + INNER JOIN category c ON c.id = r.categoryid + INNER JOIN groups g ON g.id = r.groupid WHERE r.nzbstatus = %d', NZB::NZB_ADDED ) @@ -143,8 +143,8 @@ class Releases sprintf( "SELECT r.*, CONCAT(cp.title, ' > ', c.title) AS category_name FROM releases r - INNER JOIN category c ON c.ID = r.categoryID - INNER JOIN category cp ON cp.ID = c.parentID + INNER JOIN category c ON c.id = r.categoryid + INNER JOIN category cp ON cp.id = c.parentID WHERE r.nzbstatus = %d ORDER BY r.postdate DESC %s", NZB::NZB_ADDED, @@ -167,19 +167,19 @@ class Releases { return $this->getPagerCount( sprintf( - 'SELECT r.ID + 'SELECT r.id FROM releases r %s WHERE r.nzbstatus = %d AND r.passwordstatus %s %s %s %s %s', - ($groupName != '' ? 'INNER JOIN groups g ON g.ID = r.groupID' : ''), + ($groupName != '' ? 'INNER JOIN groups g ON g.id = r.groupid' : ''), NZB::NZB_ADDED, $this->showPasswords(), ($groupName != '' ? sprintf(' AND g.name = %s', $this->pdo->escapeString($groupName)) : ''), $this->categorySQL($cat), ($maxAge > 0 ? (' AND r.postdate > NOW() - INTERVAL ' . $maxAge . ' DAY ') : ''), - (count($excludedCats) ? (' AND r.categoryID NOT IN (' . implode(',', $excludedCats) . ')') : '') + (count($excludedCats) ? (' AND r.categoryid NOT IN (' . implode(',', $excludedCats) . ')') : '') ) ); } @@ -204,16 +204,16 @@ class Releases sprintf( "SELECT r.*, CONCAT(cp.title, ' > ', c.title) AS category_name, - CONCAT(cp.ID, ',', c.ID) AS category_ids, + CONCAT(cp.id, ',', c.id) AS category_ids, g.name AS group_name, - rn.ID AS nfoid, - re.releaseID AS reid + rn.id AS nfoid, + re.releaseid AS reid FROM releases r - STRAIGHT_JOIN groups g ON g.ID = r.groupID - STRAIGHT_JOIN category c ON c.ID = r.categoryID - INNER JOIN category cp ON cp.ID = c.parentID - LEFT OUTER JOIN releasevideo re ON re.releaseID = r.ID - LEFT OUTER JOIN releasenfo rn ON rn.releaseID = r.ID + STRAIGHT_JOIN groups g ON g.id = r.groupid + STRAIGHT_JOIN category c ON c.id = r.categoryid + INNER JOIN category cp ON cp.id = c.parentID + LEFT OUTER JOIN releasevideo re ON re.releaseid = r.id + LEFT OUTER JOIN releasenfo rn ON rn.releaseid = r.id AND rn.nfo IS NOT NULL WHERE r.nzbstatus = %d AND r.passwordstatus %s @@ -223,7 +223,7 @@ class Releases $this->showPasswords(), $this->categorySQL($cat), ($maxAge > 0 ? (" AND postdate > NOW() - INTERVAL " . $maxAge . ' DAY ') : ''), - (count($excludedCats) ? (' AND r.categoryID NOT IN (' . implode(',', $excludedCats) . ')') : ''), + (count($excludedCats) ? (' AND r.categoryid NOT IN (' . implode(',', $excludedCats) . ')') : ''), ($groupName != '' ? sprintf(' AND g.name = %s ', $this->pdo->escapeString($groupName)) : ''), $orderBy[0], $orderBy[1], @@ -281,7 +281,7 @@ class Releases $orderArr = explode('_', ($orderBy == '' ? 'posted_desc' : $orderBy)); switch ($orderArr[0]) { case 'cat': - $orderField = 'categoryID'; + $orderField = 'categoryid'; break; case 'name': $orderField = 'searchname'; @@ -331,7 +331,7 @@ class Releases * * @param string $postFrom (optional) Date in this format : 01/01/2014 * @param string $postTo (optional) Date in this format : 01/01/2014 - * @param string $groupID (optional) Group ID. + * @param string $groupID (optional) Group id. * * @return array */ @@ -341,15 +341,15 @@ class Releases sprintf( "SELECT searchname, guid, groups.name AS gname, CONCAT(cp.title,'_',category.title) AS catName FROM releases r - INNER JOIN category ON r.categoryID = category.ID - INNER JOIN groups ON r.groupID = groups.ID - INNER JOIN category cp ON cp.ID = category.parentID + INNER JOIN category ON r.categoryid = category.id + INNER JOIN groups ON r.groupid = groups.id + INNER JOIN category cp ON cp.id = category.parentID WHERE r.nzbstatus = %d %s %s %s", NZB::NZB_ADDED, $this->exportDateString($postFrom), $this->exportDateString($postTo, false), - (($groupID != '' && $groupID != '-1') ? sprintf(' AND groupID = %d ', $groupID) : '') + (($groupID != '' && $groupID != '-1') ? sprintf(' AND groupid = %d ', $groupID) : '') ) ); } @@ -416,9 +416,9 @@ class Releases public function getReleasedGroupsForSelect($blnIncludeAll = true) { $groups = $this->pdo->query( - 'SELECT DISTINCT g.ID, g.name + 'SELECT DISTINCT g.id, g.name FROM releases r - INNER JOIN groups g ON g.ID = r.groupID' + INNER JOIN groups g ON g.id = r.groupid' ); $temp_array = []; @@ -448,11 +448,11 @@ class Releases { $catSearch = $cartSearch = ''; - $catLimit = "AND r.categoryID BETWEEN 5000 AND 5999"; + $catLimit = "AND r.categoryid BETWEEN 5000 AND 5999"; if (count($cat)) { if ($cat[0] == -2) { - $cartSearch = sprintf(' INNER JOIN usercart ON usercart.userID = %d AND usercart.releaseID = r.ID ', $userID); + $cartSearch = sprintf(' INNER JOIN usercart ON usercart.userID = %d AND usercart.releaseid = r.id ', $userID); } else if ($cat[0] != -1) { $catSearch = ' AND ('; $Category = new \Category(['Settings' => $this->pdo]); @@ -466,10 +466,10 @@ class Releases } if ($childList != '-99') { - $catSearch .= ' r.categoryID IN (' . $childList . ') OR '; + $catSearch .= ' r.categoryid IN (' . $childList . ') OR '; } } else { - $catSearch .= sprintf(' r.categoryID = %d OR ', $category); + $catSearch .= sprintf(' r.categoryid = %d OR ', $category); } } } @@ -479,11 +479,11 @@ class Releases return $this->pdo->query( sprintf( - "SELECT r.*, m.cover, m.imdbID, m.rating, m.plot, + "SELECT r.*, m.cover, m.imdbid, m.rating, m.plot, m.year, m.genre, m.director, m.actors, g.name AS group_name, CONCAT(cp.title, ' > ', c.title) AS category_name, - CONCAT(cp.ID, ',', c.ID) AS category_ids, - COALESCE(cp.ID,0) AS parentCategoryid, + CONCAT(cp.id, ',', c.id) AS category_ids, + COALESCE(cp.id,0) AS parentCategoryid, mu.title AS mu_title, mu.url AS mu_url, mu.artist AS mu_artist, mu.publisher AS mu_publisher, mu.releasedate AS mu_releasedate, mu.review AS mu_review, mu.tracks AS mu_tracks, mu.cover AS mu_cover, @@ -491,14 +491,14 @@ class Releases co.publisher AS co_publisher, co.releasedate AS co_releasedate, co.review AS co_review, co.cover AS co_cover, cog.title AS co_genre FROM releases r - INNER JOIN category c ON c.ID = r.categoryID - INNER JOIN category cp ON cp.ID = c.parentID - INNER JOIN groups g ON g.ID = r.groupID - LEFT OUTER JOIN movieinfo m ON m.imdbID = r.imdbID AND m.title != '' - LEFT OUTER JOIN musicinfo mu ON mu.ID = r.musicinfoID - LEFT OUTER JOIN genres mug ON mug.ID = mu.genreID - LEFT OUTER JOIN consoleinfo co ON co.ID = r.consoleinfoID - LEFT OUTER JOIN genres cog ON cog.ID = co.genreID %s + INNER JOIN category c ON c.id = r.categoryid + INNER JOIN category cp ON cp.id = c.parentID + INNER JOIN groups g ON g.id = r.groupid + LEFT OUTER JOIN movieinfo m ON m.imdbid = r.imdbid AND m.title != '' + LEFT OUTER JOIN musicinfo mu ON mu.id = r.musicinfoid + LEFT OUTER JOIN genres mug ON mug.id = mu.genreID + LEFT OUTER JOIN consoleinfo co ON co.id = r.consoleinfoid + LEFT OUTER JOIN genres cog ON cog.id = co.genreID %s WHERE r.passwordstatus %s AND r.nzbstatus = %d %s %s %s %s @@ -507,8 +507,8 @@ class Releases $this->showPasswords(), NZB::NZB_ADDED, $catSearch, - ($rageID > -1 ? sprintf(' AND r.rageID = %d %s ', $rageID, ($catSearch == '' ? $catLimit : '')) : ''), - ($aniDbID > -1 ? sprintf(' AND r.anidbID = %d %s ', $aniDbID, ($catSearch == '' ? $catLimit : '')) : ''), + ($rageID > -1 ? sprintf(' AND r.rageid = %d %s ', $rageID, ($catSearch == '' ? $catLimit : '')) : ''), + ($aniDbID > -1 ? sprintf(' AND r.anidbid = %d %s ', $aniDbID, ($catSearch == '' ? $catLimit : '')) : ''), ($airDate > -1 ? sprintf(' AND r.tvairdate >= DATE_SUB(CURDATE(), INTERVAL %d DAY) ', $airDate) : ''), (' LIMIT 0,' . ($offset > 100 ? 100 : $offset)) ) @@ -529,22 +529,22 @@ class Releases { return $this->pdo->query( sprintf(" - SELECT r.*, tvr.rageID, tvr.releasetitle, g.name AS group_name, + SELECT r.*, tvr.rageid, tvr.releasetitle, g.name AS group_name, CONCAT(cp.title, '-', c.title) AS category_name, - CONCAT(cp.ID, ',', c.ID) AS category_ids, - COALESCE(cp.ID,0) AS parentCategoryid + CONCAT(cp.id, ',', c.id) AS category_ids, + COALESCE(cp.id,0) AS parentCategoryid FROM releases r - INNER JOIN category c ON c.ID = r.categoryID - INNER JOIN category cp ON cp.ID = c.parentID - INNER JOIN groups g ON g.ID = r.groupID - LEFT OUTER JOIN tvrage tvr ON tvr.rageID = r.rageID + INNER JOIN category c ON c.id = r.categoryid + INNER JOIN category cp ON cp.id = c.parentID + INNER JOIN groups g ON g.id = r.groupid + LEFT OUTER JOIN tvrage tvr ON tvr.rageid = r.rageid WHERE %s %s %s AND r.nzbstatus = %d - AND r.categoryID BETWEEN 5000 AND 5999 + AND r.categoryid BETWEEN 5000 AND 5999 AND r.passwordstatus %s ORDER BY postdate DESC %s", - $this->uSQL($this->pdo->query(sprintf('SELECT rageID, categoryID FROM userseries WHERE userID = %d', $userID), true), 'rageID'), - (count($excludedCats) ? ' AND r.categoryID NOT IN (' . implode(',', $excludedCats) . ')' : ''), + $this->uSQL($this->pdo->query(sprintf('SELECT rageid, categoryid FROM userseries WHERE userID = %d', $userID), true), 'rageid'), + (count($excludedCats) ? ' AND r.categoryid NOT IN (' . implode(',', $excludedCats) . ')' : ''), ($airDate > -1 ? sprintf(' AND r.tvairdate >= DATE_SUB(CURDATE(), INTERVAL %d DAY) ', $airDate) : ''), NZB::NZB_ADDED, $this->showPasswords(), @@ -568,20 +568,20 @@ class Releases sprintf(" SELECT r.*, mi.title AS releasetitle, g.name AS group_name, CONCAT(cp.title, '-', c.title) AS category_name, - CONCAT(cp.ID, ',', c.ID) AS category_ids, - COALESCE(cp.ID,0) AS parentCategoryid + CONCAT(cp.id, ',', c.id) AS category_ids, + COALESCE(cp.id,0) AS parentCategoryid FROM releases r - INNER JOIN category c ON c.ID = r.categoryID - INNER JOIN category cp ON cp.ID = c.parentID - INNER JOIN groups g ON g.ID = r.groupID - LEFT OUTER JOIN movieinfo mi ON mi.imdbID = r.imdbID + INNER JOIN category c ON c.id = r.categoryid + INNER JOIN category cp ON cp.id = c.parentID + INNER JOIN groups g ON g.id = r.groupid + LEFT OUTER JOIN movieinfo mi ON mi.imdbid = r.imdbid WHERE %s %s AND r.nzbstatus = %d - AND r.categoryID BETWEEN 2000 AND 2999 + AND r.categoryid BETWEEN 2000 AND 2999 AND r.passwordstatus %s ORDER BY postdate DESC %s", - $this->uSQL($this->pdo->query(sprintf('SELECT imdbID, categoryID FROM usermovies WHERE userID = %d', $userID), true), 'imdbID'), - (count($excludedCats) ? ' AND r.categoryID NOT IN (' . implode(',', $excludedCats) . ')' : ''), + $this->uSQL($this->pdo->query(sprintf('SELECT imdbid, categoryid FROM usermovies WHERE userID = %d', $userID), true), 'imdbid'), + (count($excludedCats) ? ' AND r.categoryid NOT IN (' . implode(',', $excludedCats) . ')' : ''), NZB::NZB_ADDED, $this->showPasswords(), (' LIMIT ' . ($limit > 100 ? 100 : $limit) . ' OFFSET 0') @@ -607,22 +607,22 @@ class Releases return $this->pdo->query( sprintf( "SELECT r.*, CONCAT(cp.title, '-', c.title) AS category_name, - CONCAT(cp.ID, ',', c.ID) AS category_ids, groups.name AS group_name, - rn.ID AS nfoid, re.releaseID AS reid + CONCAT(cp.id, ',', c.id) AS category_ids, groups.name AS group_name, + rn.id AS nfoid, re.releaseid AS reid FROM releases r - LEFT OUTER JOIN releasevideo re ON re.releaseID = r.ID - INNER JOIN groups ON groups.ID = r.groupID - LEFT OUTER JOIN releasenfo rn ON rn.releaseID = r.ID AND rn.nfo IS NOT NULL - INNER JOIN category c ON c.ID = r.categoryID - INNER JOIN category cp ON cp.ID = c.parentID + LEFT OUTER JOIN releasevideo re ON re.releaseid = r.id + INNER JOIN groups ON groups.id = r.groupid + LEFT OUTER JOIN releasenfo rn ON rn.releaseid = r.id AND rn.nfo IS NOT NULL + INNER JOIN category c ON c.id = r.categoryid + INNER JOIN category cp ON cp.id = c.parentID WHERE %s %s AND r.nzbstatus = %d - AND r.categoryID BETWEEN 5000 AND 5999 + AND r.categoryid BETWEEN 5000 AND 5999 AND r.passwordstatus %s %s ORDER BY %s %s %s", - $this->uSQL($userShows, 'rageID'), - (count($excludedCats) ? ' AND r.categoryID NOT IN (' . implode(',', $excludedCats) . ')' : ''), + $this->uSQL($userShows, 'rageid'), + (count($excludedCats) ? ' AND r.categoryid NOT IN (' . implode(',', $excludedCats) . ')' : ''), NZB::NZB_ADDED, $this->showPasswords(), ($maxAge > 0 ? sprintf(' AND r.postdate > NOW() - INTERVAL %d DAY ', $maxAge) : ''), @@ -646,15 +646,15 @@ class Releases { return $this->getPagerCount( sprintf( - 'SELECT r.ID + 'SELECT r.id FROM releases r WHERE %s %s AND r.nzbstatus = %d - AND r.categoryID BETWEEN 5000 AND 5999 + AND r.categoryid BETWEEN 5000 AND 5999 AND r.passwordstatus %s %s', - $this->uSQL($userShows, 'rageID'), - (count($excludedCats) ? ' AND r.categoryID NOT IN (' . implode(',', $excludedCats) . ')' : ''), + $this->uSQL($userShows, 'rageid'), + (count($excludedCats) ? ' AND r.categoryid NOT IN (' . implode(',', $excludedCats) . ')' : ''), NZB::NZB_ADDED, $this->showPasswords(), ($maxAge > 0 ? sprintf(' AND r.postdate > NOW() - INTERVAL %d DAY ', $maxAge) : '') @@ -669,15 +669,15 @@ class Releases */ public function getCount() { - $res = $this->pdo->queryOneRow('SELECT COUNT(ID) AS num FROM releases'); + $res = $this->pdo->queryOneRow('SELECT COUNT(id) AS num FROM releases'); return ($res === false ? 0 : $res['num']); } /** - * Delete multiple releases, or a single by ID. + * Delete multiple releases, or a single by id. * - * @param array|int|string $list Array of GUID or ID of releases to delete. - * @param bool $isGUID Are the identifiers GUID or ID? + * @param array|int|string $list Array of GUID or id of releases to delete. + * @param bool $isGUID Are the identifiers GUID or id? */ public function deleteMultiple($list, $isGUID = false) { @@ -692,7 +692,7 @@ class Releases if ($isGUID) { $this->deleteSingle(['g' => $identifier, 'i' => false], $nzb, $releaseImage); } else { - $release = $this->pdo->queryOneRow(sprintf('SELECT guid FROM releases WHERE ID = %d', $identifier)); + $release = $this->pdo->queryOneRow(sprintf('SELECT guid FROM releases WHERE id = %d', $identifier)); if ($release === false) { continue; } @@ -704,7 +704,7 @@ class Releases /** * Deletes a single release by GUID, and all the corresponding files. * - * @param array $identifiers ['g' => Release GUID(mandatory), 'id => releaseID(optional, pass false)] + * @param array $identifiers ['g' => Release GUID(mandatory), 'id => releaseid(optional, pass false)] * @param NZB $nzb * @param ReleaseImage $releaseImage */ @@ -727,14 +727,14 @@ class Releases sprintf(' DELETE r, rn, rc, uc, rf, ra, rs, rv, re FROM releases r - LEFT OUTER JOIN releasenfo rn ON rn.releaseID = r.ID - LEFT OUTER JOIN releasecomment rc ON rc.releaseID = r.ID - LEFT OUTER JOIN usercart uc ON uc.releaseID = r.ID - LEFT OUTER JOIN releasefiles rf ON rf.releaseID = r.ID - LEFT OUTER JOIN releaseaudio ra ON ra.releaseID = r.ID - LEFT OUTER JOIN releasesubs rs ON rs.releaseID = r.ID - LEFT OUTER JOIN releasevideo rv ON rv.releaseID = r.ID - LEFT OUTER JOIN releaseextrafull re ON re.releaseID = r.ID + LEFT OUTER JOIN releasenfo rn ON rn.releaseid = r.id + LEFT OUTER JOIN releasecomment rc ON rc.releaseid = r.id + LEFT OUTER JOIN usercart uc ON uc.releaseid = r.id + LEFT OUTER JOIN releasefiles rf ON rf.releaseid = r.id + LEFT OUTER JOIN releaseaudio ra ON ra.releaseid = r.id + LEFT OUTER JOIN releasesubs rs ON rs.releaseid = r.id + LEFT OUTER JOIN releasevideo rv ON rv.releaseid = r.id + LEFT OUTER JOIN releaseextrafull re ON re.releaseid = r.id WHERE r.guid = %s', $this->pdo->escapeString($identifiers['g']) ) @@ -769,9 +769,9 @@ class Releases $this->pdo->queryExec( sprintf( 'UPDATE releases - SET name = %s, searchname = %s, fromname = %s, categoryID = %d, - totalpart = %d, grabs = %d, size = %s, postdate = %s, adddate = %s, rageID = %d, - seriesfull = %s, season = %s, episode = %s, imdbID = %d, anidbID = %d + SET name = %s, searchname = %s, fromname = %s, categoryid = %d, + totalpart = %d, grabs = %d, size = %s, postdate = %s, adddate = %s, rageid = %d, + seriesfull = %s, season = %s, episode = %s, imdbid = %d, anidbid = %d WHERE id = %d', $this->pdo->escapeString($name), $this->pdo->escapeString($searchName), @@ -813,11 +813,11 @@ class Releases } $update = [ - 'categoryID' => (($category == '-1') ? '' : $category), + 'categoryid' => (($category == '-1') ? '' : $category), 'grabs' => $grabs, - 'rageID' => $rageID, + 'rageid' => $rageID, 'season' => $season, - 'imdbID' => $imdDbID + 'imdbid' => $imdDbID ]; $updateSql = []; @@ -858,12 +858,12 @@ class Releases $sql = '(1=2 '; foreach ($userQuery as $query) { $sql .= sprintf('OR (r.%s = %d', $type, $query[$type]); - if ($query['categoryID'] != '') { - $catsArr = explode('|', $query['categoryID']); + if ($query['categoryid'] != '') { + $catsArr = explode('|', $query['categoryid']); if (count($catsArr) > 1) { - $sql .= sprintf(' AND r.categoryID IN (%s)', implode(',', $catsArr)); + $sql .= sprintf(' AND r.categoryid IN (%s)', implode(',', $catsArr)); } else { - $sql .= sprintf(' AND r.categoryID = %d', $catsArr[0]); + $sql .= sprintf(' AND r.categoryid = %d', $catsArr[0]); } } $sql .= ') '; @@ -874,7 +874,7 @@ class Releases } /** - * Creates part of a query for searches requiring the categoryID's. + * Creates part of a query for searches requiring the categoryid's. * * @param array $categories * @@ -892,14 +892,14 @@ class Releases $children = $Category->getChildren($category); $childList = '-99'; foreach ($children as $child) { - $childList .= ', ' . $child['ID']; + $childList .= ', ' . $child['id']; } if ($childList != '-99') { - $sql .= ' r.categoryID IN (' . $childList . ') OR '; + $sql .= ' r.categoryid IN (' . $childList . ') OR '; } } else { - $sql .= sprintf(' r.categoryID = %d OR ', $category); + $sql .= sprintf(' r.categoryid = %d OR ', $category); } } } @@ -966,32 +966,32 @@ class Releases $this->showPasswords(), NZB::NZB_ADDED, ($maxAge > 0 ? sprintf(' AND r.postdate > (NOW() - INTERVAL %d DAY) ', $maxAge) : ''), - ($groupName != -1 ? sprintf(' AND r.groupID = %d ', $this->groups->getIDByName($groupName)) : ''), + ($groupName != -1 ? sprintf(' AND r.groupid = %d ', $this->groups->getIDByName($groupName)) : ''), (in_array($sizeFrom, $sizeRange) ? ' AND r.size > ' . (string)(104857600 * (int)$sizeFrom) . ' ' : ''), (in_array($sizeTo, $sizeRange) ? ' AND r.size < ' . (string)(104857600 * (int)$sizeTo) . ' ' : ''), ($hasNfo != 0 ? ' AND r.nfostatus = 1 ' : ''), ($hasComments != 0 ? ' AND r.comments > 0 ' : ''), - ($type !== 'advanced' ? $this->categorySQL($cat) : ($cat[0] != '-1' ? sprintf(' AND (r.categoryID = %d) ', $cat[0]) : '')), + ($type !== 'advanced' ? $this->categorySQL($cat) : ($cat[0] != '-1' ? sprintf(' AND (r.categoryid = %d) ', $cat[0]) : '')), ($daysNew != -1 ? sprintf(' AND r.postdate < (NOW() - INTERVAL %d DAY) ', $daysNew) : ''), ($daysOld != -1 ? sprintf(' AND r.postdate > (NOW() - INTERVAL %d DAY) ', $daysOld) : ''), - (count($excludedCats) > 0 ? ' AND r.categoryID NOT IN (' . implode(',', $excludedCats) . ')' : ''), + (count($excludedCats) > 0 ? ' AND r.categoryid NOT IN (' . implode(',', $excludedCats) . ')' : ''), (count($searchOptions) > 0 ? $this->releaseSearch->getSearchSQL($searchOptions) : '') ); $baseSql = sprintf( "SELECT r.*, CONCAT(cp.title, ' > ', c.title) AS category_name, - CONCAT(cp.ID, ',', c.ID) AS category_ids, + CONCAT(cp.id, ',', c.id) AS category_ids, groups.name AS group_name, - rn.ID AS nfoid, - re.releaseID AS reid, - cp.ID AS categoryparentid + rn.id AS nfoid, + re.releaseid AS reid, + cp.id AS categoryparentid FROM releases r - LEFT OUTER JOIN releasevideo re ON re.releaseID = r.ID - LEFT OUTER JOIN releasenfo rn ON rn.releaseID = r.ID - INNER JOIN groups ON groups.ID = r.groupID - INNER JOIN category c ON c.ID = r.categoryID - INNER JOIN category cp ON cp.ID = c.parentID + LEFT OUTER JOIN releasevideo re ON re.releaseid = r.id + LEFT OUTER JOIN releasenfo rn ON rn.releaseid = r.id + INNER JOIN groups ON groups.id = r.groupid + INNER JOIN category c ON c.id = r.categoryid + INNER JOIN category cp ON cp.id = c.parentID %s", $whereSql ); @@ -1031,13 +1031,13 @@ class Releases { $whereSql = sprintf( "%s - WHERE r.categoryID BETWEEN 5000 AND 5999 + WHERE r.categoryid BETWEEN 5000 AND 5999 AND r.nzbstatus = %d AND r.passwordstatus %s %s %s %s %s %s %s", ($name !== '' ? $this->releaseSearch->getFullTextJoinString() : ''), NZB::NZB_ADDED, $this->showPasswords(), - ($rageId != -1 ? sprintf(' AND rageID = %d ', $rageId) : ''), + ($rageId != -1 ? sprintf(' AND rageid = %d ', $rageId) : ''), ($series != '' ? sprintf(' AND UPPER(r.season) = UPPER(%s)', $this->pdo->escapeString(((is_numeric($series) && strlen($series) != 4) ? sprintf('S%02d', $series) : $series))) : ''), ($episode != '' ? sprintf(' AND r.episode %s', $this->pdo->likeString((is_numeric($episode) ? sprintf('E%02d', $episode) : $episode))) : ''), ($name !== '' ? $this->releaseSearch->getSearchSQL(['searchname' => $name]) : ''), @@ -1048,16 +1048,16 @@ class Releases $baseSql = sprintf( "SELECT r.*, concat(cp.title, ' > ', c.title) AS category_name, - CONCAT(cp.ID, ',', c.ID) AS category_ids, + CONCAT(cp.id, ',', c.id) AS category_ids, groups.name AS group_name, - rn.ID AS nfoid, - re.releaseID AS reid + rn.id AS nfoid, + re.releaseid AS reid FROM releases r - INNER JOIN category c ON c.ID = r.categoryID - INNER JOIN groups ON groups.ID = r.groupID - LEFT OUTER JOIN releasevideo re ON re.releaseID = r.ID - LEFT OUTER JOIN releasenfo rn ON rn.releaseID = r.ID AND rn.nfo IS NOT NULL - INNER JOIN category cp ON cp.ID = c.parentID + INNER JOIN category c ON c.id = r.categoryid + INNER JOIN groups ON groups.id = r.groupid + LEFT OUTER JOIN releasevideo re ON re.releaseid = r.id + LEFT OUTER JOIN releasenfo rn ON rn.releaseid = r.id AND rn.nfo IS NOT NULL + INNER JOIN category cp ON cp.id = c.parentID %s", $whereSql ); @@ -1096,7 +1096,7 @@ class Releases ($name !== '' ? $this->releaseSearch->getFullTextJoinString() : ''), $this->showPasswords(), NZB::NZB_ADDED, - ($aniDbID > -1 ? sprintf(' AND anidbID = %d ', $aniDbID) : ''), + ($aniDbID > -1 ? sprintf(' AND anidbid = %d ', $aniDbID) : ''), (is_numeric($episodeNumber) ? sprintf(" AND r.episode '%s' ", $this->pdo->likeString($episodeNumber)) : ''), ($name !== '' ? $this->releaseSearch->getSearchSQL(['searchname' => $name]) : ''), $this->categorySQL($cat), @@ -1106,14 +1106,14 @@ class Releases $baseSql = sprintf( "SELECT r.*, CONCAT(cp.title, ' > ', c.title) AS category_name, - CONCAT(cp.ID, ',', c.ID) AS category_ids, + CONCAT(cp.id, ',', c.id) AS category_ids, groups.name AS group_name, - rn.ID AS nfoid + rn.id AS nfoid FROM releases r - INNER JOIN category c ON c.ID = r.categoryID - INNER JOIN groups ON groups.ID = r.groupID - LEFT OUTER JOIN releasenfo rn ON rn.releaseID = r.ID AND rn.nfo IS NOT NULL - INNER JOIN category cp ON cp.ID = c.parentID + INNER JOIN category c ON c.id = r.categoryid + INNER JOIN groups ON groups.id = r.groupid + LEFT OUTER JOIN releasenfo rn ON rn.releaseid = r.id AND rn.nfo IS NOT NULL + INNER JOIN category cp ON cp.id = c.parentID %s", $whereSql ); @@ -1147,7 +1147,7 @@ class Releases { $whereSql = sprintf( "%s - WHERE r.categoryID BETWEEN 2000 AND 2999 + WHERE r.categoryid BETWEEN 2000 AND 2999 AND r.nzbstatus = %d AND r.passwordstatus %s %s %s %s %s", @@ -1155,7 +1155,7 @@ class Releases NZB::NZB_ADDED, $this->showPasswords(), ($name !== '' ? $this->releaseSearch->getSearchSQL(['searchname' => $name]) : ''), - (($imDbId != '-1' && is_numeric($imDbId)) ? sprintf(' AND imdbID = %d ', str_pad($imDbId, 7, '0', STR_PAD_LEFT)) : ''), + (($imDbId != '-1' && is_numeric($imDbId)) ? sprintf(' AND imdbid = %d ', str_pad($imDbId, 7, '0', STR_PAD_LEFT)) : ''), $this->categorySQL($cat), ($maxAge > 0 ? sprintf(' AND r.postdate > NOW() - INTERVAL %d DAY ', $maxAge) : '') ); @@ -1163,14 +1163,14 @@ class Releases $baseSql = sprintf( "SELECT r.*, concat(cp.title, ' > ', c.title) AS category_name, - CONCAT(cp.ID, ',', c.ID) AS category_ids, + CONCAT(cp.id, ',', c.id) AS category_ids, g.name AS group_name, - rn.ID AS nfoid + rn.id AS nfoid FROM releases r - INNER JOIN groups g ON g.ID = r.groupID - INNER JOIN category c ON c.ID = r.categoryID - LEFT OUTER JOIN releasenfo rn ON rn.releaseID = r.ID AND rn.nfo IS NOT NULL - INNER JOIN category cp ON cp.ID = c.parentID + INNER JOIN groups g ON g.id = r.groupid + INNER JOIN category c ON c.id = r.categoryid + LEFT OUTER JOIN releasenfo rn ON rn.releaseid = r.id AND rn.nfo IS NOT NULL + INNER JOIN category cp ON cp.id = c.parentID %s", $whereSql ); @@ -1202,7 +1202,7 @@ class Releases $count = $this->pdo->queryOneRow( sprintf( 'SELECT COUNT(*) AS count FROM (%s LIMIT %s) z', - preg_replace('/SELECT.+?FROM\s+releases/is', 'SELECT r.ID FROM releases', $query), + preg_replace('/SELECT.+?FROM\s+releases/is', 'SELECT r.id FROM releases', $query), NN_MAX_PAGER_RESULTS ) ); @@ -1224,7 +1224,7 @@ class Releases { // Get the category for the parent of this release. $currRow = $this->getById($currentID); - $catRow = (new \Category(['Settings' => $this->pdo]))->getById($currRow['categoryID']); + $catRow = (new \Category(['Settings' => $this->pdo]))->getById($currRow['categoryid']); $parentCat = $catRow['parentID']; $results = $this->search( @@ -1236,7 +1236,7 @@ class Releases $ret = []; foreach ($results as $res) { - if ($res['ID'] != $currentID && $res['categoryparentid'] == $parentCat) { + if ($res['id'] != $currentID && $res['categoryparentid'] == $parentCat) { $ret[] = $res; } } @@ -1270,11 +1270,11 @@ class Releases $gSql = sprintf('r.guid = %s', $this->pdo->escapeString($guid)); } $sql = sprintf( - "SELECT r.*, CONCAT(cp.title, ' > ', c.title) AS category_name, CONCAT(cp.ID, ',', c.ID) AS category_ids, + "SELECT r.*, CONCAT(cp.title, ' > ', c.title) AS category_name, CONCAT(cp.id, ',', c.id) AS category_ids, g.name AS group_name FROM releases r - INNER JOIN groups g ON g.ID = r.groupID - INNER JOIN category c ON c.ID = r.categoryID - INNER JOIN category cp ON cp.ID = c.parentID + INNER JOIN groups g ON g.id = r.groupid + INNER JOIN category c ON c.id = r.categoryid + INNER JOIN category cp ON cp.id = c.parentID WHERE %s", $gSql ); @@ -1343,12 +1343,12 @@ class Releases "SELECT r.*, CONCAT(cp.title, ' > ', c.title) AS category_name, groups.name AS group_name FROM releases r - INNER JOIN groups ON groups.ID = r.groupID - INNER JOIN category c ON c.ID = r.categoryID - INNER JOIN category cp ON cp.ID = c.parentID - WHERE r.categoryID BETWEEN 5000 AND 5999 + INNER JOIN groups ON groups.id = r.groupid + INNER JOIN category c ON c.id = r.categoryid + INNER JOIN category cp ON cp.id = c.parentID + WHERE r.categoryid BETWEEN 5000 AND 5999 AND r.passwordstatus %s - AND rageID = %d %s %s", + AND rageid = %d %s %s", $this->showPasswords(), $rageID, $series, @@ -1365,10 +1365,10 @@ class Releases public function removeRageIdFromReleases($rageID) { $res = $this->pdo->queryOneRow( - sprintf('SELECT COUNT(r.ID) AS num FROM releases r WHERE rageID = %d', $rageID) + sprintf('SELECT COUNT(r.id) AS num FROM releases r WHERE rageid = %d', $rageID) ); $this->pdo->queryExec( - sprintf('UPDATE releases SET rageID = -1, seriesfull = NULL, season = NULL, episode = NULL WHERE rageID = %d', $rageID) + sprintf('UPDATE releases SET rageid = -1, seriesfull = NULL, season = NULL, episode = NULL WHERE rageid = %d', $rageID) ); return ($res === false ? 0 : $res['num']); @@ -1382,10 +1382,10 @@ class Releases public function removeAnidbIdFromReleases($anidbID) { $res = $this->pdo->queryOneRow( - sprintf('SELECT COUNT(r.ID) AS num FROM releases r WHERE anidbID = %d', $anidbID) + sprintf('SELECT COUNT(r.id) AS num FROM releases r WHERE anidbid = %d', $anidbID) ); $this->pdo->queryExec( - sprintf('UPDATE releases SET anidbID = -1, episode = NULL, tvtitle = NULL, tvairdate = NULL WHERE anidbID = %d', $anidbID) + sprintf('UPDATE releases SET anidbid = -1, episode = NULL, tvtitle = NULL, tvairdate = NULL WHERE anidbid = %d', $anidbID) ); return ($res === false ? 0 : $res['num']); @@ -1402,8 +1402,8 @@ class Releases sprintf( 'SELECT r.*, g.name AS group_name FROM releases r - INNER JOIN groups g ON g.ID = r.groupID - WHERE r.ID = %d', + INNER JOIN groups g ON g.id = r.groupid + WHERE r.id = %d', $id ) ); @@ -1419,7 +1419,7 @@ class Releases { return $this->pdo->queryOneRow( sprintf( - 'SELECT ID, releaseID %s FROM releasenfo WHERE releaseID = %d AND nfo IS NOT NULL', + 'SELECT id, releaseid %s FROM releasenfo WHERE releaseid = %d AND nfo IS NOT NULL', ($getNfoString ? ", UNCOMPRESS(nfo) AS nfo" : ''), $id ) @@ -1444,10 +1444,10 @@ class Releases public function getTopDownloads() { return $this->pdo->query( - 'SELECT ID, searchname, guid, adddate, SUM(grabs) AS grabs + 'SELECT id, searchname, guid, adddate, SUM(grabs) AS grabs FROM releases WHERE grabs > 0 - GROUP BY ID, searchname, adddate + GROUP BY id, searchname, adddate HAVING SUM(grabs) > 0 ORDER BY grabs DESC LIMIT 10' @@ -1460,10 +1460,10 @@ class Releases public function getTopComments() { return $this->pdo->query( - 'SELECT ID, guid, searchname, adddate, SUM(comments) AS comments + 'SELECT id, guid, searchname, adddate, SUM(comments) AS comments FROM releases WHERE comments > 0 - GROUP BY ID, searchname, adddate + GROUP BY id, searchname, adddate HAVING SUM(comments) > 0 ORDER BY comments DESC LIMIT 10' @@ -1475,8 +1475,8 @@ class Releases return $this->pdo->query( "SELECT CONCAT(cp.title, ' > ', category.title) AS title, COUNT(*) AS count FROM category - INNER JOIN category cp on cp.ID = category.parentID - INNER JOIN releases r ON r.categoryID = category.ID + INNER JOIN category cp on cp.id = category.parentID + INNER JOIN releases r ON r.categoryid = category.id WHERE r.adddate > NOW() - INTERVAL 1 WEEK GROUP BY concat(cp.title, ' > ', category.title) ORDER BY COUNT(*) DESC" @@ -1491,15 +1491,15 @@ class Releases public function getNewestMovies() { return $this->pdo->queryDirect( - "SELECT r.imdbID, r.guid, r.name, r.searchname, r.size, r.completion, - postdate, categoryID, comments, grabs, + "SELECT r.imdbid, r.guid, r.name, r.searchname, r.size, r.completion, + postdate, categoryid, comments, grabs, m.cover FROM releases r - INNER JOIN movieinfo m USING (imdbID) - WHERE r.categoryID BETWEEN 2000 AND 2999 - AND m.imdbID > 0 + INNER JOIN movieinfo m USING (imdbid) + WHERE r.categoryid BETWEEN 2000 AND 2999 + AND m.imdbid > 0 AND m.cover = 1 - AND r.ID in (select max(ID) from releases where imdbID > 0 group by imdbID) + AND r.id in (select max(id) from releases where imdbid > 0 group by imdbid) ORDER BY r.postdate DESC LIMIT 24" ); @@ -1514,14 +1514,14 @@ class Releases { return $this->pdo->queryDirect( "SELECT r.xxxinfo_id, r.guid, r.name, r.searchname, r.size, r.completion, - r.postdate, r.categoryID, r.comments, r.grabs, + r.postdate, r.categoryid, r.comments, r.grabs, xxx.cover, xxx.title FROM releases r - INNER JOIN xxxinfo xxx ON r.xxxinfo_id = xxx.ID - WHERE r.categoryID BETWEEN 6000 AND 6999 - AND xxx.ID > 0 + INNER JOIN xxxinfo xxx ON r.xxxinfo_id = xxx.id + WHERE r.categoryid BETWEEN 6000 AND 6999 + AND xxx.id > 0 AND xxx.cover = 1 - AND r.ID in (select max(ID) from releases where xxxinfo_id > 0 group by xxxinfo_id) + AND r.id in (select max(id) from releases where xxxinfo_id > 0 group by xxxinfo_id) ORDER BY r.postdate DESC LIMIT 24" ); @@ -1535,15 +1535,15 @@ class Releases public function getNewestConsole() { return $this->pdo->queryDirect( - "SELECT r.consoleinfoID, r.guid, r.name, r.searchname, r.size, r.completion, - r.postdate, r.categoryID, r.comments, r.grabs, + "SELECT r.consoleinfoid, r.guid, r.name, r.searchname, r.size, r.completion, + r.postdate, r.categoryid, r.comments, r.grabs, con.cover FROM releases r - INNER JOIN consoleinfo con ON r.consoleinfoID = con.ID - WHERE r.categoryID BETWEEN 1000 AND 1999 - AND con.ID > 0 + INNER JOIN consoleinfo con ON r.consoleinfoid = con.id + WHERE r.categoryid BETWEEN 1000 AND 1999 + AND con.id > 0 AND con.cover > 0 - AND r.ID in (select max(ID) from releases where consoleinfoID > 0 group by consoleinfoID) + AND r.id in (select max(id) from releases where consoleinfoid > 0 group by consoleinfoid) ORDER BY r.postdate DESC LIMIT 35" ); @@ -1558,14 +1558,14 @@ class Releases { return $this->pdo->queryDirect( "SELECT r.gamesinfo_id, r.guid, r.name, r.searchname, r.size, r.completion, - r.postdate, r.categoryID, r.comments, r.grabs, + r.postdate, r.categoryid, r.comments, r.grabs, gi.cover FROM releases r INNER JOIN gamesinfo gi ON r.gamesinfo_id = gi.id - WHERE r.categoryID = 4050 + WHERE r.categoryid = 4050 AND gi.id > 0 AND gi.cover > 0 - AND r.ID in (select max(ID) from releases where gamesinfo_id > 0 group by gamesinfo_id) + AND r.id in (select max(id) from releases where gamesinfo_id > 0 group by gamesinfo_id) ORDER BY r.postdate DESC LIMIT 35" ); @@ -1579,16 +1579,16 @@ class Releases public function getNewestMP3s() { return $this->pdo->queryDirect( - "SELECT r.musicinfoID, r.guid, r.name, r.searchname, r.size, r.completion, - r.postdate, r.categoryID, r.comments, r.grabs, + "SELECT r.musicinfoid, r.guid, r.name, r.searchname, r.size, r.completion, + r.postdate, r.categoryid, r.comments, r.grabs, m.cover FROM releases r - INNER JOIN musicinfo m ON r.musicinfoID = m.ID - WHERE r.categoryID BETWEEN 3000 AND 3999 - AND r.categoryID != 3030 - AND m.ID > 0 + INNER JOIN musicinfo m ON r.musicinfoid = m.id + WHERE r.categoryid BETWEEN 3000 AND 3999 + AND r.categoryid != 3030 + AND m.id > 0 AND m.cover > 0 - AND r.ID in (select max(ID) from releases where musicinfoID > 0 group by musicinfoID) + AND r.id in (select max(id) from releases where musicinfoid > 0 group by musicinfoid) ORDER BY r.postdate DESC LIMIT 24" ); @@ -1602,16 +1602,16 @@ class Releases public function getNewestBooks() { return $this->pdo->queryDirect( - "SELECT r.bookinfoID, r.guid, r.name, r.searchname, r.size, r.completion, - r.postdate, r.categoryID, r.comments, r.grabs, + "SELECT r.bookinfoid, r.guid, r.name, r.searchname, r.size, r.completion, + r.postdate, r.categoryid, r.comments, r.grabs, b.url, b.cover, b.title as booktitle, b.author FROM releases r - INNER JOIN bookinfo b ON r.bookinfoID = b.ID - WHERE r.categoryID BETWEEN 8000 AND 8999 - OR r.categoryID = 3030 - AND b.ID > 0 + INNER JOIN bookinfo b ON r.bookinfoid = b.id + WHERE r.categoryid BETWEEN 8000 AND 8999 + OR r.categoryid = 3030 + AND b.id > 0 AND b.cover > 0 - AND r.ID in (select max(ID) from releases where bookinfoID > 0 group by bookinfoID) + AND r.id in (select max(id) from releases where bookinfoid > 0 group by bookinfoid) ORDER BY r.postdate DESC LIMIT 24" ); @@ -1625,15 +1625,15 @@ class Releases public function getNewestTV() { return $this->pdo->queryDirect( - "SELECT r.rageID, r.guid, r.name, r.searchname, r.size, r.completion, - r.postdate, r.categoryID, r.comments, r.grabs, - tv.ID as tvid, tv.imgdata, tv.releasetitle as tvtitle + "SELECT r.rageid, r.guid, r.name, r.searchname, r.size, r.completion, + r.postdate, r.categoryid, r.comments, r.grabs, + tv.id as tvid, tv.imgdata, tv.releasetitle as tvtitle FROM releases r - INNER JOIN tvrage tv USING (rageID) - WHERE r.categoryID BETWEEN 5000 AND 5999 - AND tv.rageID > 0 + INNER JOIN tvrage tv USING (rageid) + WHERE r.categoryid BETWEEN 5000 AND 5999 + AND tv.rageid > 0 AND length(tv.imgdata) > 0 - GROUP BY tv.rageID + GROUP BY tv.rageid ORDER BY r.postdate DESC LIMIT 24" ); diff --git a/lib/copy_this/www/lib/rottentomato.php b/lib/copy_this/www/lib/rottentomato.php index 0c18348c3..159f8a2e4 100644 --- a/lib/copy_this/www/lib/rottentomato.php +++ b/lib/copy_this/www/lib/rottentomato.php @@ -146,7 +146,7 @@ class RottenTomato * Detailed information on a specific movie specified by Id. * You can use the movies search endpoint or peruse the lists of movies/dvds to get the urls to movies. * - * @param int $ID The RT ID. + * @param int $ID The RT id. * * @return string */ @@ -159,7 +159,7 @@ class RottenTomato * Retrieves the reviews for a movie. * Results are paginated if they go past the specified page limit. * - * @param int $ID The RT ID. + * @param int $ID The RT id. * @param string $type Three different review types are possible: * "all", "top_critic" and "dvd". * "top_critic" shows all the Rotten Tomatoes designated top critics. @@ -188,7 +188,7 @@ class RottenTomato /** * Pulls the complete movie cast for a movie. * - * @param int $ID The RT ID. + * @param int $ID The RT id. * * @return string */ diff --git a/lib/copy_this/www/lib/sabnzbd.php b/lib/copy_this/www/lib/sabnzbd.php index 417fc075f..25e76c2d2 100644 --- a/lib/copy_this/www/lib/sabnzbd.php +++ b/lib/copy_this/www/lib/sabnzbd.php @@ -60,7 +60,7 @@ class SABnzbd public $integratedBool = false; /** - * ID of the current user, to send to SAB when downloading a NZB. + * id of the current user, to send to SAB when downloading a NZB. * * @var string */ @@ -85,7 +85,7 @@ class SABnzbd */ public function __construct(&$page) { - $this->uid = $page->userdata['ID']; + $this->uid = $page->userdata['id']; $this->rsstoken = $page->userdata['rsstoken']; $this->serverurl = $page->serverurl; diff --git a/lib/copy_this/www/lib/smarty/sysplugins/smarty_cacheresource_keyvaluestore.php b/lib/copy_this/www/lib/smarty/sysplugins/smarty_cacheresource_keyvaluestore.php index b2fd08c74..b0906c1ce 100644 --- a/lib/copy_this/www/lib/smarty/sysplugins/smarty_cacheresource_keyvaluestore.php +++ b/lib/copy_this/www/lib/smarty/sysplugins/smarty_cacheresource_keyvaluestore.php @@ -172,7 +172,7 @@ abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource } /** - * Get template's unique ID + * Get template's unique id * * @param Smarty $smarty Smarty object * @param string $resource_name template name diff --git a/lib/copy_this/www/lib/smarty/sysplugins/smarty_internal_configfileparser.php b/lib/copy_this/www/lib/smarty/sysplugins/smarty_internal_configfileparser.php index e480e500c..439c79879 100644 --- a/lib/copy_this/www/lib/smarty/sysplugins/smarty_internal_configfileparser.php +++ b/lib/copy_this/www/lib/smarty/sysplugins/smarty_internal_configfileparser.php @@ -374,7 +374,7 @@ class Smarty_Internal_Configfileparser #line 80 "smarty_internal_configfileparse public $yyTokenName = array( '$', 'OPENB', 'SECTION', 'CLOSEB', - 'DOT', 'ID', 'EQUAL', 'FLOAT', + 'DOT', 'id', 'EQUAL', 'FLOAT', 'INT', 'BOOL', 'SINGLE_QUOTED_STRING', 'DOUBLE_QUOTED_STRING', 'TRIPPLE_QUOTES', 'TRIPPLE_TEXT', 'TRIPPLE_QUOTES_END', 'NAKED_STRING', 'OTHER', 'NEWLINE', 'COMMENTSTART', 'error', @@ -402,7 +402,7 @@ class Smarty_Internal_Configfileparser #line 80 "smarty_internal_configfileparse /* 8 */ "var_list ::=", /* 9 */ - "var ::= ID EQUAL value", + "var ::= id EQUAL value", /* 10 */ "value ::= FLOAT", /* 11 */ diff --git a/lib/copy_this/www/lib/smarty/sysplugins/smarty_internal_template.php b/lib/copy_this/www/lib/smarty/sysplugins/smarty_internal_template.php index 996f1f79f..c2d18333e 100644 --- a/lib/copy_this/www/lib/smarty/sysplugins/smarty_internal_template.php +++ b/lib/copy_this/www/lib/smarty/sysplugins/smarty_internal_template.php @@ -678,7 +678,7 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase throw new SmartyException('Missing template name'); } $this->source = Smarty_Resource::source($this); - // cache template object under a unique ID + // cache template object under a unique id // do not cache eval resources if ($this->source->type != 'eval') { if ($this->smarty->allow_ambiguous_resources) { diff --git a/lib/copy_this/www/lib/smarty/sysplugins/smarty_internal_templatelexer.php b/lib/copy_this/www/lib/smarty/sysplugins/smarty_internal_templatelexer.php index bc10e0231..a6f5f2ae7 100644 --- a/lib/copy_this/www/lib/smarty/sysplugins/smarty_internal_templatelexer.php +++ b/lib/copy_this/www/lib/smarty/sysplugins/smarty_internal_templatelexer.php @@ -64,7 +64,7 @@ class Smarty_Internal_Templatelexer 'COMMA' => '","', 'ANDSYM' => '"&"', 'QMARK' => '"?"', - 'ID' => 'identifier', + 'id' => 'identifier', 'TEXT' => 'text', 'FAKEPHPSTARTTAG' => 'Fake PHP start tag', 'PHPSTARTTAG' => 'PHP start tag', diff --git a/lib/copy_this/www/lib/smarty/sysplugins/smarty_internal_templateparser.php b/lib/copy_this/www/lib/smarty/sysplugins/smarty_internal_templateparser.php index 5b330c285..ccf8ee63c 100644 --- a/lib/copy_this/www/lib/smarty/sysplugins/smarty_internal_templateparser.php +++ b/lib/copy_this/www/lib/smarty/sysplugins/smarty_internal_templateparser.php @@ -2144,7 +2144,7 @@ class Smarty_Internal_Templateparser #line 80 "smarty_internal_templateparser.ph 'ASPENDTAG', 'FAKEPHPSTARTTAG', 'XMLTAG', 'TEXT', 'STRIPON', 'STRIPOFF', 'BLOCKSOURCE', 'LITERALSTART', 'LITERALEND', 'LITERAL', 'LDEL', 'DOLLAR', - 'ID', 'EQUAL', 'PTR', 'LDELIF', + 'id', 'EQUAL', 'PTR', 'LDELIF', 'LDELFOR', 'SEMICOLON', 'INCDEC', 'TO', 'STEP', 'LDELFOREACH', 'SPACE', 'AS', 'APTR', 'LDELSETFILTER', 'SMARTYBLOCKCHILDPARENT', 'LDELSLASH', @@ -2240,23 +2240,23 @@ class Smarty_Internal_Templateparser #line 80 "smarty_internal_templateparser.ph /* 32 */ "smartytag ::= LDEL expr attributes", /* 33 */ - "smartytag ::= LDEL DOLLAR ID EQUAL value", + "smartytag ::= LDEL DOLLAR id EQUAL value", /* 34 */ - "smartytag ::= LDEL DOLLAR ID EQUAL expr", + "smartytag ::= LDEL DOLLAR id EQUAL expr", /* 35 */ - "smartytag ::= LDEL DOLLAR ID EQUAL expr attributes", + "smartytag ::= LDEL DOLLAR id EQUAL expr attributes", /* 36 */ "smartytag ::= LDEL varindexed EQUAL expr attributes", /* 37 */ - "smartytag ::= LDEL ID attributes", + "smartytag ::= LDEL id attributes", /* 38 */ - "smartytag ::= LDEL ID", + "smartytag ::= LDEL id", /* 39 */ - "smartytag ::= LDEL ID PTR ID attributes", + "smartytag ::= LDEL id PTR id attributes", /* 40 */ - "smartytag ::= LDEL ID modifierlist attributes", + "smartytag ::= LDEL id modifierlist attributes", /* 41 */ - "smartytag ::= LDEL ID PTR ID modifierlist attributes", + "smartytag ::= LDEL id PTR id modifierlist attributes", /* 42 */ "smartytag ::= LDELIF expr", /* 43 */ @@ -2286,19 +2286,19 @@ class Smarty_Internal_Templateparser #line 80 "smarty_internal_templateparser.ph /* 55 */ "smartytag ::= LDELFOREACH SPACE expr AS DOLLAR varvar APTR DOLLAR varvar attributes", /* 56 */ - "smartytag ::= LDELSETFILTER ID modparameters", + "smartytag ::= LDELSETFILTER id modparameters", /* 57 */ - "smartytag ::= LDELSETFILTER ID modparameters modifierlist", + "smartytag ::= LDELSETFILTER id modparameters modifierlist", /* 58 */ "smartytag ::= LDEL SMARTYBLOCKCHILDPARENT", /* 59 */ - "smartytag ::= LDELSLASH ID", + "smartytag ::= LDELSLASH id", /* 60 */ - "smartytag ::= LDELSLASH ID modifierlist", + "smartytag ::= LDELSLASH id modifierlist", /* 61 */ - "smartytag ::= LDELSLASH ID PTR ID", + "smartytag ::= LDELSLASH id PTR id", /* 62 */ - "smartytag ::= LDELSLASH ID PTR ID modifierlist", + "smartytag ::= LDELSLASH id PTR id modifierlist", /* 63 */ "attributes ::= attributes attribute", /* 64 */ @@ -2306,13 +2306,13 @@ class Smarty_Internal_Templateparser #line 80 "smarty_internal_templateparser.ph /* 65 */ "attributes ::=", /* 66 */ - "attribute ::= SPACE ID EQUAL ID", + "attribute ::= SPACE id EQUAL id", /* 67 */ "attribute ::= ATTR expr", /* 68 */ "attribute ::= ATTR value", /* 69 */ - "attribute ::= SPACE ID", + "attribute ::= SPACE id", /* 70 */ "attribute ::= SPACE expr", /* 71 */ @@ -2334,7 +2334,7 @@ class Smarty_Internal_Templateparser #line 80 "smarty_internal_templateparser.ph /* 79 */ "expr ::= ternary", /* 80 */ - "expr ::= DOLLAR ID COLON ID", + "expr ::= DOLLAR id COLON id", /* 81 */ "expr ::= expr MATH value", /* 82 */ @@ -2374,11 +2374,11 @@ class Smarty_Internal_Templateparser #line 80 "smarty_internal_templateparser.ph /* 99 */ "expr ::= expr ISNOTODDBY expr", /* 100 */ - "expr ::= value INSTANCEOF ID", + "expr ::= value INSTANCEOF id", /* 101 */ "expr ::= value INSTANCEOF value", /* 102 */ - "ternary ::= OPENP expr CLOSEP QMARK DOLLAR ID COLON expr", + "ternary ::= OPENP expr CLOSEP QMARK DOLLAR id COLON expr", /* 103 */ "ternary ::= OPENP expr CLOSEP QMARK expr COLON expr", /* 104 */ @@ -2402,7 +2402,7 @@ class Smarty_Internal_Templateparser #line 80 "smarty_internal_templateparser.ph /* 113 */ "value ::= DOT INTEGER", /* 114 */ - "value ::= ID", + "value ::= id", /* 115 */ "value ::= function", /* 116 */ @@ -2412,7 +2412,7 @@ class Smarty_Internal_Templateparser #line 80 "smarty_internal_templateparser.ph /* 118 */ "value ::= doublequoted_with_quotes", /* 119 */ - "value ::= ID DOUBLECOLON static_class_access", + "value ::= id DOUBLECOLON static_class_access", /* 120 */ "value ::= varindexed DOUBLECOLON static_class_access", /* 121 */ @@ -2422,13 +2422,13 @@ class Smarty_Internal_Templateparser #line 80 "smarty_internal_templateparser.ph /* 123 */ "variable ::= varindexed", /* 124 */ - "variable ::= DOLLAR varvar AT ID", + "variable ::= DOLLAR varvar AT id", /* 125 */ "variable ::= object", /* 126 */ - "variable ::= HATCH ID HATCH", + "variable ::= HATCH id HATCH", /* 127 */ - "variable ::= HATCH ID HATCH arrayindex", + "variable ::= HATCH id HATCH arrayindex", /* 128 */ "variable ::= HATCH variable HATCH", /* 129 */ @@ -2442,17 +2442,17 @@ class Smarty_Internal_Templateparser #line 80 "smarty_internal_templateparser.ph /* 133 */ "indexdef ::= DOT DOLLAR varvar", /* 134 */ - "indexdef ::= DOT DOLLAR varvar AT ID", + "indexdef ::= DOT DOLLAR varvar AT id", /* 135 */ - "indexdef ::= DOT ID", + "indexdef ::= DOT id", /* 136 */ "indexdef ::= DOT INTEGER", /* 137 */ "indexdef ::= DOT LDEL expr RDEL", /* 138 */ - "indexdef ::= OPENB ID CLOSEB", + "indexdef ::= OPENB id CLOSEB", /* 139 */ - "indexdef ::= OPENB ID DOT ID CLOSEB", + "indexdef ::= OPENB id DOT id CLOSEB", /* 140 */ "indexdef ::= OPENB expr CLOSEB", /* 141 */ @@ -2462,7 +2462,7 @@ class Smarty_Internal_Templateparser #line 80 "smarty_internal_templateparser.ph /* 143 */ "varvar ::= varvar varvarele", /* 144 */ - "varvarele ::= ID", + "varvarele ::= id", /* 145 */ "varvarele ::= LDEL expr RDEL", /* 146 */ @@ -2472,21 +2472,21 @@ class Smarty_Internal_Templateparser #line 80 "smarty_internal_templateparser.ph /* 148 */ "objectchain ::= objectchain objectelement", /* 149 */ - "objectelement ::= PTR ID arrayindex", + "objectelement ::= PTR id arrayindex", /* 150 */ "objectelement ::= PTR DOLLAR varvar arrayindex", /* 151 */ "objectelement ::= PTR LDEL expr RDEL arrayindex", /* 152 */ - "objectelement ::= PTR ID LDEL expr RDEL arrayindex", + "objectelement ::= PTR id LDEL expr RDEL arrayindex", /* 153 */ "objectelement ::= PTR method", /* 154 */ - "function ::= ID OPENP params CLOSEP", + "function ::= id OPENP params CLOSEP", /* 155 */ - "method ::= ID OPENP params CLOSEP", + "method ::= id OPENP params CLOSEP", /* 156 */ - "method ::= DOLLAR ID OPENP params CLOSEP", + "method ::= DOLLAR id OPENP params CLOSEP", /* 157 */ "params ::= params COMMA expr", /* 158 */ @@ -2498,9 +2498,9 @@ class Smarty_Internal_Templateparser #line 80 "smarty_internal_templateparser.ph /* 161 */ "modifierlist ::= modifier modparameters", /* 162 */ - "modifier ::= VERT AT ID", + "modifier ::= VERT AT id", /* 163 */ - "modifier ::= VERT ID", + "modifier ::= VERT id", /* 164 */ "modparameters ::= modparameters modparameter", /* 165 */ @@ -2514,11 +2514,11 @@ class Smarty_Internal_Templateparser #line 80 "smarty_internal_templateparser.ph /* 169 */ "static_class_access ::= method objectchain", /* 170 */ - "static_class_access ::= ID", + "static_class_access ::= id", /* 171 */ - "static_class_access ::= DOLLAR ID arrayindex", + "static_class_access ::= DOLLAR id arrayindex", /* 172 */ - "static_class_access ::= DOLLAR ID arrayindex objectchain", + "static_class_access ::= DOLLAR id arrayindex objectchain", /* 173 */ "ifcond ::= EQUALS", /* 174 */ @@ -2554,7 +2554,7 @@ class Smarty_Internal_Templateparser #line 80 "smarty_internal_templateparser.ph /* 189 */ "arrayelement ::= value APTR expr", /* 190 */ - "arrayelement ::= ID APTR expr", + "arrayelement ::= id APTR expr", /* 191 */ "arrayelement ::= expr", /* 192 */ diff --git a/lib/copy_this/www/lib/smarty/sysplugins/smarty_resource.php b/lib/copy_this/www/lib/smarty/sysplugins/smarty_resource.php index 06b7aaa72..34af28dbe 100644 --- a/lib/copy_this/www/lib/smarty/sysplugins/smarty_resource.php +++ b/lib/copy_this/www/lib/smarty/sysplugins/smarty_resource.php @@ -653,7 +653,7 @@ class Smarty_Template_Source public $template_parser_class = null; /** - * Unique Template ID + * Unique Template id * * @var string */ diff --git a/lib/copy_this/www/lib/sphinx.php b/lib/copy_this/www/lib/sphinx.php index a49bed2d5..c36e3d099 100644 --- a/lib/copy_this/www/lib/sphinx.php +++ b/lib/copy_this/www/lib/sphinx.php @@ -512,14 +512,14 @@ class Sphinx * in real time. * * If ``$startingID`` is negative, then the last successfully indexed - * release will be identified and this will resume indexing from that ID - * onwards. If this is a positive value, then only releases with an ID + * release will be identified and this will resume indexing from that id + * onwards. If this is a positive value, then only releases with an id * larger than or equal to this will be indexed. In order to re-index * everything, pass 0. * * Returns the number of of NZBs that were successfully indexed. * - * @param int $startingID The ID of the first release to index. + * @param int $startingID The id of the first release to index. * @return int * */ @@ -560,15 +560,15 @@ class Sphinx } // Get the number of NZBs to do - $sql = "SELECT COUNT(ID) as num FROM releases WHERE ID >= %d"; + $sql = "SELECT COUNT(id) as num FROM releases WHERE id >= %d"; $row = $ndb->queryOneRow(sprintf($sql, $startingID)); $recordCount = (int)$row["num"]; // Start looping over the releases and build the NZB index - printf("starting from ID %d\n", $startingID); + printf("starting from id %d\n", $startingID); $numIndexed = 0; - $sql = "SELECT ID, guid FROM releases " - . "WHERE ID >= %d ORDER BY ID ASC"; + $sql = "SELECT id, guid FROM releases " + . "WHERE id >= %d ORDER BY id ASC"; $result = $ndb->queryDirect(sprintf($sql, $startingID)); $startTime = microtime(true); while ($row = $ndb->getAssocArray($result)) { @@ -586,7 +586,7 @@ class Sphinx } } $sql = sprintf("REPLACE INTO nzbs VALUES (%d, %s, %d)", - $row['ID'], $ndb->escapeString($fileNames), + $row['id'], $ndb->escapeString($fileNames), $fileCount); if (!mysqli_query($sdb, $sql)) { printf("error indexing NZB: %s\n", mysqli_error($sdb)); @@ -616,7 +616,7 @@ class Sphinx * be the data from the index--this is not guaranteed to be the most recent * data that is in the MySQL database. If you absolutely need the most * recent data from MySQL, then ``$lookupQuery`` should be a valid SQL - * query that has contains "releases.ID IN (%s)". + * query that has contains "releases.id IN (%s)". * * @param string $sphinxQuery The raw SphinxQL query. * @param string $lookupQuery The SQL to use to lookup the results. @@ -733,7 +733,7 @@ class Sphinx if ($lookup) { // Since we're going to look up the data from MySQL, we don't need // to get all the fields from Sphinx. - $select = "ID, name "; + $select = "id, name "; } else { $select = "* "; } @@ -824,8 +824,8 @@ class Sphinx // Inlcude all children $children = $categ->getChildren($category); foreach ($children as $child) { - if (!in_array($child["ID"], $categoryIDs)) { - $categoryIDs[] = $child["ID"]; + if (!in_array($child["id"], $categoryIDs)) { + $categoryIDs[] = $child["id"]; } } } @@ -835,7 +835,7 @@ class Sphinx // Only include the category filter if we created one. if ($categoryIDs) { - $where[] = sprintf("categoryID IN (%s)", implode(",", $categoryIDs)); + $where[] = sprintf("categoryid IN (%s)", implode(",", $categoryIDs)); } // Filter on postdate. @@ -846,7 +846,7 @@ class Sphinx // Categories to exclude. if (count($excludedcats) > 0) { - $where[] = sprintf("categoryID NOT IN (%s)", implode(",", + $where[] = sprintf("categoryid NOT IN (%s)", implode(",", $excludedcats)); } @@ -854,15 +854,15 @@ class Sphinx if ($grp) { foreach($grp as $i => $g) { if (strpos($g, "a.b.") !== false) { - $sql = sprintf("SELECT ID FROM groups " + $sql = sprintf("SELECT id FROM groups " ."WHERE name = %s", $ndb->escapeString(str_replace("a.b.", "alt.binaries.", $g))); $row = $ndb->queryOneRow($sql); - $grp[$i] = $row["ID"]; + $grp[$i] = $row["id"]; } } - $where[] = sprintf("groupID IN (%s)", implode(",", $grp)); + $where[] = sprintf("groupid IN (%s)", implode(",", $grp)); } // Order the results. @@ -927,29 +927,29 @@ class Sphinx if ($lookup) { $lookupQuery .= "SELECT releases.*, " . "CONCAT(cp.title, ' > ', c.title) AS category_name, " - . "CONCAT(cp.ID, ',', c.ID) AS category_ids, " - . "groups.name as group_name, rn.ID AS nfoID, " - . "re.releaseID as reID, cp.ID AS categoryParentID, " + . "CONCAT(cp.id, ',', c.id) AS category_ids, " + . "groups.name as group_name, rn.id AS nfoID, " + . "re.releaseid as reID, cp.id AS categoryParentID, " . "pre.ctime, pre.nuketype, " - . "COALESCE(movieinfo.ID, 0) AS movieinfoID " + . "COALESCE(movieinfo.id, 0) AS movieinfoID " . "FROM releases " . "LEFT OUTER JOIN movieinfo " - . "ON movieinfo.imdbID = releases.imdbID " + . "ON movieinfo.imdbid = releases.imdbid " . "LEFT OUTER JOIN releasevideo re " - . "ON re.releaseID = releases.ID " + . "ON re.releaseid = releases.id " . "LEFT OUTER JOIN releasenfo rn " - . "ON rn.releaseID = releases.ID AND rn.nfo IS NOT NULL " + . "ON rn.releaseid = releases.id AND rn.nfo IS NOT NULL " . "LEFT OUTER JOIN groups " - . "ON groups.ID = releases.groupID " + . "ON groups.id = releases.groupid " . "LEFT OUTER JOIN category c " - . "ON c.ID = releases.categoryID " + . "ON c.id = releases.categoryid " . "LEFT OUTER JOIN category cp " - . "ON cp.ID = c.parentID " + . "ON cp.id = c.parentID " . "LEFT OUTER JOIN predb pre " - . "ON pre.ID = releases.preID " + . "ON pre.id = releases.preid " . "WHERE releases.passwordstatus <= (SELECT value " . "FROM site WHERE setting='showpasswordedrelease') " - . "AND releases.ID IN (%s)"; + . "AND releases.id IN (%s)"; } $where = array(); @@ -1008,23 +1008,23 @@ class Sphinx if ($lookup) { $lookupQuery .= "SELECT releases.*, " . "CONCAT(cp.title, ' > ', c.title) AS category_name, " - . "CONCAT(cp.ID, ',', c.ID) AS category_ids, " - . "groups.name AS group_name, rn.ID AS nfoID, " - . "re.releaseID AS reID " + . "CONCAT(cp.id, ',', c.id) AS category_ids, " + . "groups.name AS group_name, rn.id AS nfoID, " + . "re.releaseid AS reID " . "FROM releases " . "LEFT OUTER JOIN category c " - . "ON c.ID = releases.categoryID " + . "ON c.id = releases.categoryid " . "LEFT OUTER JOIN groups " - . "ON groups.ID = releases.groupID " + . "ON groups.id = releases.groupid " . "LEFT OUTER JOIN releasevideo re " - . "ON re.releaseID = releases.ID " + . "ON re.releaseid = releases.id " . "LEFT OUTER JOIN releasenfo rn " - . "ON rn.releaseID = releases.ID AND rn.nfo IS NOT NULL " + . "ON rn.releaseid = releases.id AND rn.nfo IS NOT NULL " . "LEFT OUTER JOIN category cp " - . "ON cp.ID = c.parentID " + . "ON cp.id = c.parentID " . "WHERE releases.passwordstatus <= (SELECT value " . "FROM site WHERE setting='showpasswordedrelease') " - . "AND releases.ID IN (%s)"; + . "AND releases.id IN (%s)"; } $sphinxQuery = $this->buildQuery($search, $cat, $offset, $limit, $order, $maxage, array(), array(), $indexes, @@ -1045,7 +1045,7 @@ class Sphinx $order = array("postdate", "desc"); $where = array(); if ($imdbId != "-1" && is_numeric($imdbId)) { - // Pad ID with zeros just in case. + // Pad id with zeros just in case. $imdbId = str_pad($imdbId, 7, "0", STR_PAD_LEFT); $where[] = sprintf("imdbid = %d", $imdbId); } else { @@ -1075,22 +1075,22 @@ class Sphinx . "movieinfo.cover AS moi_cover, " . "movieinfo.backdrop AS moi_backdrop, " . "CONCAT(cp.title, ' > ', c.title) AS category_name, " - . "CONCAT(cp.ID, ',', c.ID) AS category_ids, " + . "CONCAT(cp.id, ',', c.id) AS category_ids, " . "groups.name AS group_name, " - . "rn.ID AS nfoID FROM releases " + . "rn.id AS nfoID FROM releases " . "LEFT OUTER JOIN groups " - . "ON groups.ID = releases.groupID " + . "ON groups.id = releases.groupid " . "LEFT OUTER JOIN category c " - . "ON c.ID = releases.categoryID " + . "ON c.id = releases.categoryid " . "LEFT OUTER JOIN releasenfo rn " - . "ON rn.releaseID = releases.ID AND rn.nfo IS NOT NULL " + . "ON rn.releaseid = releases.id AND rn.nfo IS NOT NULL " . "LEFT OUTER JOIN category cp " - . "ON cp.ID = c.parentID " + . "ON cp.id = c.parentID " . "LEFT OUTER JOIN movieinfo " - . "ON releases.imdbID = movieinfo.imdbID " + . "ON releases.imdbid = movieinfo.imdbid " . "WHERE releases.passwordstatus <= (SELECT value " . "FROM site WHERE setting='showpasswordedrelease') " - . "AND releases.ID IN (%s)"; + . "AND releases.id IN (%s)"; } $sphinxQuery = $this->buildQuery($search, $cat, $offset, $limit, $order, $maxage, array(), array(), $indexes, @@ -1151,24 +1151,24 @@ class Sphinx . "musicinfo.artist AS mi_artist, " . "genres.title AS music_genrename, " . "CONCAT(cp.title, ' > ', c.title) AS category_name, " - . "CONCAT(cp.ID, ',', c.ID) AS category_ids, " + . "CONCAT(cp.id, ',', c.id) AS category_ids, " . "groups.name AS group_name, " - . "rn.ID AS nfoID FROM releases " + . "rn.id AS nfoID FROM releases " . "LEFT OUTER JOIN musicinfo " - . "ON musicinfo.ID = releases.musicinfoID " + . "ON musicinfo.id = releases.musicinfoid " . "LEFT JOIN genres " - . "ON genres.ID = musicinfo.genreID " + . "ON genres.id = musicinfo.genreID " . "LEFT OUTER JOIN groups " - . "ON groups.ID = releases.groupID " + . "ON groups.id = releases.groupid " . "LEFT OUTER JOIN category c " - . "ON c.ID = releases.categoryID " + . "ON c.id = releases.categoryid " . "LEFT OUTER JOIN releasenfo rn " - . "ON rn.releaseID = releases.ID AND rn.nfo IS NOT NULL " + . "ON rn.releaseid = releases.id AND rn.nfo IS NOT NULL " . "LEFT OUTER JOIN category cp " - . "ON cp.ID = c.parentID " + . "ON cp.id = c.parentID " . "WHERE releases.passwordstatus <= (SELECT value " . "FROM site WHERE setting='showpasswordedrelease') " - . "AND releases.ID IN (%s)"; + . "AND releases.id IN (%s)"; } $sphinxQuery = $this->buildQuery($search, $cat, $offset, $limit, $order, $maxage, array(), array(), $indexes, @@ -1211,25 +1211,25 @@ class Sphinx . "bookinfo.author AS bi_author, " . "genres.title AS book_genrename, " . "concat(cp.title, ' > ', c.title) AS category_name, " - . "concat(cp.ID, ',', c.ID) AS category_ids, " + . "concat(cp.id, ',', c.id) AS category_ids, " . "groups.name AS group_name, " - . "rn.ID AS nfoID " + . "rn.id AS nfoID " . "FROM releases " . "LEFT OUTER JOIN bookinfo " - . "ON bookinfo.ID = releases.bookinfoID " + . "ON bookinfo.id = releases.bookinfoid " . "LEFT JOIN genres " - . "ON genres.ID = bookinfo.genreID " + . "ON genres.id = bookinfo.genreID " . "LEFT OUTER JOIN groups " - . "ON groups.ID = releases.groupID " + . "ON groups.id = releases.groupid " . "LEFT OUTER JOIN category c " - . "ON c.ID = releases.categoryID " + . "ON c.id = releases.categoryid " . "LEFT OUTER JOIN releasenfo rn " - . "ON rn.releaseID = releases.ID AND rn.nfo IS NOT NULL " + . "ON rn.releaseid = releases.id AND rn.nfo IS NOT NULL " . "LEFT OUTER JOIN category cp " - . "ON cp.ID = c.parentID " + . "ON cp.id = c.parentID " . "WHERE releases.passwordstatus <= (SELECT value " . "FROM site WHERE setting='showpasswordedrelease')" - . "AND releases.ID IN (%s)"; + . "AND releases.id IN (%s)"; } $sphinxQuery = $this->buildQuery($search, array(-1), $offset, $limit, @@ -1267,21 +1267,21 @@ class Sphinx if ($lookup) { $lookupQuery .= "SELECT releases.*, " . "CONCAT(cp.title, ' > ', c.title) AS category_name, " - . "CONCAT(cp.ID, ',', c.ID) AS category_ids, " + . "CONCAT(cp.id, ',', c.id) AS category_ids, " . "groups.name AS group_name, " - . "rn.ID AS nfoID " + . "rn.id AS nfoID " . "FROM releases " . "LEFT OUTER JOIN category c " - . "ON c.ID = releases.categoryID " + . "ON c.id = releases.categoryid " . "LEFT OUTER JOIN groups " - . "ON groups.ID = releases.groupID " + . "ON groups.id = releases.groupid " . "LEFT OUTER JOIN releasenfo rn " - . "ON rn.releaseID = releases.ID AND rn.nfo IS NOT NULL " + . "ON rn.releaseid = releases.id AND rn.nfo IS NOT NULL " . "LEFT OUTER JOIN category cp " - . "ON cp.ID = c.parentID " + . "ON cp.id = c.parentID " . "WHERE releases.passwordstatus <= (SELECT value " . "FROM site WHERE setting='showpasswordedrelease')" - . "AND releases.ID IN (%s)"; + . "AND releases.id IN (%s)"; } $sphinxQuery = $this->buildQuery($search, array(-1), $offset, $limit, $order, $maxage, array(), array(), @@ -1307,8 +1307,8 @@ class Sphinx $lookupQuery = "SELECT predb.*, r.guid " . "FROM predb " . "LEFT OUTER JOIN releases r " - . "ON r.preID = predb.ID " - . "WHERE predb.ID IN (%s) " + . "ON r.preid = predb.id " + . "WHERE predb.id IN (%s) " . "ORDER BY predb.ctime DESC"; return $this->searchDirect($sphinxQuery, $lookupQuery, 120); } diff --git a/lib/copy_this/www/lib/spotnab.php b/lib/copy_this/www/lib/spotnab.php index 1d3d38878..49251613b 100644 --- a/lib/copy_this/www/lib/spotnab.php +++ b/lib/copy_this/www/lib/spotnab.php @@ -70,7 +70,7 @@ class SpotNab { const FETCH_DISCOVERY_SUBJECT_REGEX = '/^(?P[0-9a-z]{40})-(?P[0-9]{14})$/i'; - // The Message ID can be parsed as follows + // The Message id can be parsed as follows const FETCH_MSGID_REGEX = '/^<(?P[a-z0-9]{30})\.(?P[0-9]{2})\.(?P[0-9]+)[^@]*@(?P.*)>$/i'; @@ -285,7 +285,7 @@ class SpotNab { // comments they do not have a release for... Makes sense :) $offset = 0; $sql = "SELECT DISTINCT(GID) as GID FROM releasecomment " - ."WHERE releaseID = 0 " + ."WHERE releaseid = 0 " ."AND createddate < NOW() - INTERVAL $max_days DAY " ."ORDER BY createddate " ."LIMIT %d,%d"; @@ -704,7 +704,7 @@ class SpotNab { // Initialize our article start point $group_article_start[$ghash] = 0; - // Initialize ID Hash + // Initialize id Hash $id_hash[$ghash] = array(); } @@ -735,12 +735,12 @@ class SpotNab { $article:$group_article_start[$ghash]; } - // Store ID - $id_hash[$ghash][] = $source['ID']; + // Store id + $id_hash[$ghash][] = $source['id']; // Store Source Details $group_hash[$ghash][] = array( - 'ID' => $source['ID'], + 'id' => $source['id'], 'key' => $this->decompstr(trim($source['publickey'])), 'user' => trim($source['username']), 'email' => trim($source['useremail']), @@ -887,11 +887,11 @@ class SpotNab { } } /*$sql = sprintf("UPDATE spotnabsources " - ."SET lastarticle = %d WHERE ID IN (%s)", + ."SET lastarticle = %d WHERE id IN (%s)", $last, implode(",", $id_hash[$group]));*/ $db->queryExec(sprintf('UPDATE spotnabsources ' - .'SET lastarticle = %d WHERE ID IN (%s)', + .'SET lastarticle = %d WHERE id IN (%s)', $last, implode(",", $id_hash[$group]))); echo "\n"; @@ -918,9 +918,9 @@ class SpotNab { // We need an offset for tracking unhandled issues $offset = 0; - $fsql = 'SELECT ID, name, guid FROM releases ' + $fsql = 'SELECT id, name, guid FROM releases ' .'WHERE GID IS NULL ORDER BY adddate DESC LIMIT %d,%d'; - $usql = "UPDATE releases SET GID = '%s' WHERE ID = %d"; + $usql = "UPDATE releases SET GID = '%s' WHERE id = %d"; while(1){ // finish @@ -943,7 +943,7 @@ class SpotNab { { if($delete_broken_releases){ $release = new Releases(); - $release->delete($r['ID']); + $release->delete($r['id']); // Free the variable in an attempt to recover memory unset($release); echo '-'; @@ -962,7 +962,7 @@ class SpotNab { if(!$gid){ if($delete_broken_releases){ $release = new Releases(); - $release->delete($r['ID']); + $release->delete($r['id']); unset($release); echo '-'; }else{ @@ -973,7 +973,7 @@ class SpotNab { } // Update DB With Global Identifer - $ures = $db->queryExec(sprintf($usql, $gid, $r['ID'])); + $ures = $db->queryExec(sprintf($usql, $gid, $r['id'])); if($ures < 0){ printf("\nPostPrc : Failed to update: %s\n", $r['name']); } @@ -986,7 +986,7 @@ class SpotNab { # Batch update for comment table $usql = 'UPDATE releasecomment, releases ' .'SET releasecomment.GID = releases.GID ' - .'WHERE releases.ID = releasecomment.releaseID ' + .'WHERE releases.id = releasecomment.releaseid ' .'AND releasecomment.GID IS NULL ' .'AND releases.GID IS NOT NULL '; @@ -1285,7 +1285,7 @@ class SpotNab { * 'Subject': * 'From': * 'Date': - * 'Message-ID': + * 'Message-id': * 'Bytes': * 'Lines': * 'Epoch': @@ -1298,14 +1298,14 @@ class SpotNab { * A group_hash() record looks like this: * array( * array( - * 'ID': , + * 'id': , * 'key': , * 'user': , * 'email': , * 'ref': , * ), * array( - * 'ID': , + * 'id': , * 'key': , * 'user': , * 'email': , @@ -1328,18 +1328,18 @@ class SpotNab { // Comments $sql_new_cmt = "INSERT INTO releasecomment (". - "ID, sourceID, username, userID, gid, cid, isvisible, ". - "releaseID, `text`, createddate, issynced) VALUES (". + "id, sourceID, username, userID, gid, cid, isvisible, ". + "releaseid, `text`, createddate, issynced) VALUES (". "NULL, %d, %s, 0, %s, %s, %d, 0, %s, %s, 1)"; $sql_upd_cmt = "UPDATE releasecomment SET ". "isvisible = %d, `text` = %s". "WHERE sourceID = %d AND gid = %s AND cid = %s"; - $sql_fnd_cmt = "SELECT count(ID) as cnt FROM releasecomment ". + $sql_fnd_cmt = "SELECT count(id) as cnt FROM releasecomment ". "WHERE sourceID = %d AND gid = %s AND cid = %s"; // Sync Times $sql_sync = "UPDATE spotnabsources SET lastupdate = %s ". - "WHERE ID = %d"; + "WHERE id = %d"; $matches = Null; $processed = 0; @@ -1349,7 +1349,7 @@ class SpotNab { // Preform some general scanning the header to determine // if it could possibly be a valid post. if(!preg_match(SpotNab::FETCH_MSGID_REGEX, - $header['Message-ID'], $matches)){ + $header['Message-id'], $matches)){ continue; } if($matches['domain'] != SpotNab::SEGID_DOMAIN) @@ -1410,7 +1410,7 @@ class SpotNab { if($save){ // Download Body $body = $this->_get_body($header['Group'], - $header['Message-ID']); + $header['Message-id']); if($body === false){ continue; } @@ -1459,7 +1459,7 @@ class SpotNab { // Check that comment doesn't already exist $res = $db->queryOneRow(sprintf($sql_fnd_cmt, - $hash['ID'], + $hash['id'], $db->escapeString($comment['gid']), $db->escapeString($comment['cid']))); @@ -1470,7 +1470,7 @@ class SpotNab { $updates += ($db->queryExec(sprintf($sql_upd_cmt, $is_visible, $db->escapeString($comment['comment']), - $hash['ID'], + $hash['id'], $db->escapeString($comment['gid']), $db->escapeString($comment['cid']) ))>0)?1:0; @@ -1479,7 +1479,7 @@ class SpotNab { echo '+'; // Perform Insert $res = $db->queryInsert(sprintf($sql_new_cmt, - $hash['ID'], + $hash['id'], $db->escapeString($comment['username']), $db->escapeString($comment['gid']), $db->escapeString($comment['cid']), @@ -1500,7 +1500,7 @@ class SpotNab { $db->queryExec(sprintf($sql_sync, $db->escapeString( $this->utc2local($body['postdate_utc'])), - $hash['ID'] + $hash['id'] ) ); }else{ @@ -1531,7 +1531,7 @@ class SpotNab { * 'Subject': * 'From': * 'Date': - * 'Message-ID': + * 'Message-id': * 'Bytes': * 'Lines': * 'Epoch': @@ -1551,13 +1551,13 @@ class SpotNab { // Spotnab Sources $sql_new_cmt = "INSERT INTO spotnabsources (". - "ID, username, useremail, usenetgroup, publickey, ". + "id, username, useremail, usenetgroup, publickey, ". "active, description, lastupdate, lastbroadcast, dateadded) VALUES (". "NULL, %s, %s, %s, %s, $auto_enable, %s, NULL, %s, NOW())"; $sql_upd_cmt = "UPDATE spotnabsources SET ". "lastbroadcast = %s ". "WHERE username = %s AND useremail = %s AND usenetgroup = %s"; - $sql_fnd_cmt = "SELECT count(ID) as cnt FROM spotnabsources ". + $sql_fnd_cmt = "SELECT count(id) as cnt FROM spotnabsources ". "WHERE username = %s AND useremail = %s AND usenetgroup = %s"; $matches = Null; @@ -1571,7 +1571,7 @@ class SpotNab { // Now we check the subject line; it provides the first part of // the key to determining if we should handle the message or not if(!preg_match(SpotNab::FETCH_MSGID_REGEX, - $header['Message-ID'], $matches)){ + $header['Message-id'], $matches)){ continue; } if($matches['domain'] != SpotNab::SEGID_DOMAIN) @@ -1625,7 +1625,7 @@ class SpotNab { if($save){ // Download Body $body = $this->_get_body($header['Group'], - $header['Message-ID']); + $header['Message-id']); if($body === false){ continue; } @@ -1719,14 +1719,14 @@ class SpotNab { // *********************************************************************** protected function _get_body($group, $id, $retries=3){ /* - * Fetch the body of a given Message-ID taken from the headers + * Fetch the body of a given Message-id taken from the headers * The function then returns the raw content */ $matches = Null; if(preg_match("/^\s*<(.*)>\s*$/", $id, $matches)) // Ensure we're always dealing with a properly - // formatted ID + // formatted id $id = $matches[1]; // The returned result will be stored in $raw @@ -1780,7 +1780,7 @@ class SpotNab { // Header parsing for associative array returned $min_headers = array('Number', 'Subject', 'From', 'Date', - 'Message-ID', 'Bytes', 'Lines'); + 'Message-id', 'Bytes', 'Lines'); do { $msgs = $this->_nntp->getOverview($range, true, false); @@ -1884,7 +1884,7 @@ class SpotNab { $db = new DB(); $sql = sprintf("UPDATE releasecomment " - ."SET issynced = 1 WHERE ID IN (%s)", + ."SET issynced = 1 WHERE id IN (%s)", implode(",", $data['ids'])); // Generate keys if one doesn't exist @@ -1929,7 +1929,7 @@ class SpotNab { private function _postArticle ($article, $retries=3) { // Extract message id - if(!preg_match('/Message-ID: <(?P[^>]+)>/', $article[0], $matches)){ + if(!preg_match('/Message-id: <(?P[^>]+)>/', $article[0], $matches)){ // we couldn't extract the message id return false; } @@ -2006,14 +2006,14 @@ class SpotNab { // // Okay we have headers to scan (we'll work back from the end to // // the front to speed the process up) // for($i=count($headers)-1; $i >0; $i--){ - // if(!array_key_exists('Message-ID', $headers[$i])) + // if(!array_key_exists('Message-id', $headers[$i])) // continue; - // if ($headers[$i]['Message-ID'] == "<$msg_id>") + // if ($headers[$i]['Message-id'] == "<$msg_id>") // // Great! we found the post we just posted // return true; // } - // // Otherwise we didn't find the Message-ID so we fail + // // Otherwise we didn't find the Message-id so we fail // return false; // Restore handler @@ -2175,7 +2175,7 @@ class SpotNab { // Prepare Header // - // Checksum ID + // Checksum id $checksum = sha1($message); // Prepare Subject @@ -2195,7 +2195,7 @@ class SpotNab { $header = "Subject: " . $subject . "\r\n"; $header .= "Newsgroups: " . $group . "\r\n"; - $header .= "Message-ID: $msgid\r\n"; + $header .= "Message-id: $msgid\r\n"; $header .= "X-Newsreader: NewzNab v" . $s->version() ."\r\n"; $header .= "X-No-Archive: yes\r\n"; @@ -2216,7 +2216,7 @@ class SpotNab { 'From' => sprintf('%s <%s>', $user, $email), 'Date' => date(DATE_RFC822, strtotime( $this->utc2local($reftime))), - 'Message-ID' => $msgid, + 'Message-id' => $msgid, 'Bytes' => strlen($message), 'Lines' => '1', 'Epoch' => strtotime($this->utc2local($reftime)), @@ -2239,11 +2239,11 @@ class SpotNab { $db = new DB(); // Now we fetch for any new posts since reference point - $sql = sprintf("SELECT r.gid, rc.ID, rc.text, u.username, " + $sql = sprintf("SELECT r.gid, rc.id, rc.text, u.username, " ."rc.isvisible, rc.createddate, rc.host " ."FROM releasecomment rc " - ."JOIN releases r ON r.ID = rc.releaseID AND rc.releaseID != 0 " - ."JOIN users u ON rc.userID = u.ID AND rc.userID != 0 " + ."JOIN releases r ON r.id = rc.releaseid AND rc.releaseid != 0 " + ."JOIN users u ON rc.userID = u.id AND rc.userID != 0 " ."WHERE r.gid IS NOT NULL " ."AND sourceID = 0 AND issynced = 0 " ."LIMIT %d", $limit); @@ -2273,17 +2273,17 @@ class SpotNab { else $username = $comment['username']; - // Hash a unique Comment ID to associate with this message - $cid = md5($comment['ID'].$comment['username'].$comment['createddate'].$comment['host']); + // Hash a unique Comment id to associate with this message + $cid = md5($comment['id'].$comment['username'].$comment['createddate'].$comment['host']); // Keep list of IDs (required for cleanup) - $ids[] = $comment['ID']; + $ids[] = $comment['id']; // Build Comment $comments[] = array( - // Release Global ID + // Release Global id 'gid' => $comment['gid'], - // Comment ID + // Comment id 'cid' => $cid, // Store comment 'comment' => $comment['text'], @@ -2480,8 +2480,8 @@ class SpotNab { public function getSources() { $db = new DB(); - return $db->query("SELECT ID, lastupdate,lastbroadcast, active, description, " - ."(SELECT count(ID) from releasecomment where sourceid = s.ID)" + return $db->query("SELECT id, lastupdate,lastbroadcast, active, description, " + ."(SELECT count(id) from releasecomment where sourceid = s.id)" ." AS comments FROM spotnabsources s"); } @@ -2511,7 +2511,7 @@ class SpotNab { return $db->queryExec( sprintf("UPDATE spotnabsources SET " ."description = %s, username = %s, useremail = %s," - ." usenetgroup = %s, publickey = %s WHERE ID= %d", + ." usenetgroup = %s, publickey = %s WHERE id= %d", $db->escapeString($description), $db->escapeString($username), $db->escapeString($usermail), $db->escapeString($usenetgroup), $db->escapeString($publickey), $id)); diff --git a/lib/copy_this/www/lib/thetvdb.php b/lib/copy_this/www/lib/thetvdb.php index 201cf43cc..39362bc42 100644 --- a/lib/copy_this/www/lib/thetvdb.php +++ b/lib/copy_this/www/lib/thetvdb.php @@ -40,11 +40,11 @@ class TheTVDB $rating = "null"; $db->queryInsert(sprintf("INSERT INTO thetvdb - (tvdbID, actors, airsday, airstime, contentrating, firstaired, genre, imdbID, network, overview, rating, ratingcount, runtime, seriesname, status, createddate) + (tvdbid, actors, airsday, airstime, contentrating, firstaired, genre, imdbid, network, overview, rating, ratingcount, runtime, seriesname, status, createddate) VALUES (%d, %s, %s, %s, %s, %s, %s, %d, %s, %s, %F, %d, %d, %s, %s, now())", - $TheTVDBAPIArray['tvdbID'], $db->escapeString($TheTVDBAPIArray['actors']), $db->escapeString($TheTVDBAPIArray['airsday']), + $TheTVDBAPIArray['tvdbid'], $db->escapeString($TheTVDBAPIArray['actors']), $db->escapeString($TheTVDBAPIArray['airsday']), $airstime, $db->escapeString($TheTVDBAPIArray['contentrating']), $firstaired, - $db->escapeString($TheTVDBAPIArray['genre']), $TheTVDBAPIArray['imdbID'], $db->escapeString($TheTVDBAPIArray['network']), $db->escapeString($TheTVDBAPIArray['overview']), + $db->escapeString($TheTVDBAPIArray['genre']), $TheTVDBAPIArray['imdbid'], $db->escapeString($TheTVDBAPIArray['network']), $db->escapeString($TheTVDBAPIArray['overview']), $rating, $TheTVDBAPIArray['ratingcount'], $TheTVDBAPIArray['runtime'], $db->escapeString($TheTVDBAPIArray['seriesname']), $db->escapeString($TheTVDBAPIArray['status']))); } @@ -59,10 +59,10 @@ class TheTVDB continue; $db->queryInsert(sprintf('INSERT INTO episodeinfo - (rageID, tvdbID, imdbID, showtitle, airdate, fullep, eptitle, director, gueststars, overview, rating, writer, epabsolute) + (rageid, tvdbid, imdbid, showtitle, airdate, fullep, eptitle, director, gueststars, overview, rating, writer, epabsolute) VALUES (0, %d, %d, %s, %s, %s, %s, %s, %s, %s, %F, %s, %d) ON DUPLICATE KEY UPDATE - tvdbID=%1$d, imdbID=%2$d, showtitle=%3$s, airdate=%4$s, fullep=%5$s, eptitle=%6$s, director=%7$s, + tvdbid=%1$d, imdbid=%2$d, showtitle=%3$s, airdate=%4$s, fullep=%5$s, eptitle=%6$s, director=%7$s, gueststars=%8$s, overview=%9$s, rating=%10$F, writer=%11$s, epabsolute=%12$s', $TheTVDBAPIArray['episodetvdbID'][$i], $TheTVDBAPIArray['episodeimdbID'][$i], $db->escapeString($TheTVDBAPIArray['seriesname']), $db->escapeString($airdate), $db->escapeString(str_pad($TheTVDBAPIArray['episodeseason'][$i], 2, '0', STR_PAD_LEFT).'x'.str_pad($TheTVDBAPIArray['episodenumber'][$i], 2, '0', STR_PAD_LEFT)), @@ -91,9 +91,9 @@ class TheTVDB $rating = "null"; $sql = sprintf('UPDATE thetvdb - SET actors=%s, airsday=%s, airstime=%s, contentrating=%s, firstaired=%s, genre=%s, imdbID=%d, network=%s, + SET actors=%s, airsday=%s, airstime=%s, contentrating=%s, firstaired=%s, genre=%s, imdbid=%d, network=%s, overview=%s, rating=%s, ratingcount=%d, runtime=%d, seriesname=%s, status=%s, createddate=now() - WHERE tvdbID = %d', $db->escapeString($actors), $db->escapeString($airsday), $airstime, $db->escapeString($contentrating), + WHERE tvdbid = %d', $db->escapeString($actors), $db->escapeString($airsday), $airstime, $db->escapeString($contentrating), $firstaired, $db->escapeString($genre), $imdbID, $db->escapeString($network), $db->escapeString($overview), $rating, $ratingcount, $runtime, $db->escapeString($seriesname), $db->escapeString($status), $tvdbID); @@ -104,20 +104,20 @@ class TheTVDB { $db = new DB(); - $db->queryExec(sprintf("DELETE FROM thetvdb WHERE tvdbID = %d", $tvdbID)); + $db->queryExec(sprintf("DELETE FROM thetvdb WHERE tvdbid = %d", $tvdbID)); } public function addEmptySeries($seriesname) { $db = new DB(); - $db->queryInsert(sprintf("INSERT INTO thetvdb (tvdbID, seriesname, createddate) VALUES (0, %s, now())", $db->escapeString($seriesname))); + $db->queryInsert(sprintf("INSERT INTO thetvdb (tvdbid, seriesname, createddate) VALUES (0, %s, now())", $db->escapeString($seriesname))); } public function getSeriesInfoByID($tvdbID) { $db = new DB(); - return $db->queryOneRow(sprintf("SELECT * FROM thetvdb WHERE tvdbID = %d", $tvdbID)); + return $db->queryOneRow(sprintf("SELECT * FROM thetvdb WHERE tvdbid = %d", $tvdbID)); } public function getSeriesInfoByName($seriesname) @@ -136,7 +136,7 @@ class TheTVDB if ($seriesname != '') $rsql .= sprintf("AND thetvdb.seriesname LIKE %s ", $db->escapeString("%".$seriesname."%")); - return $db->query(sprintf(" SELECT ID, tvdbID, seriesname, overview FROM thetvdb WHERE 1=1 %s AND tvdbID > %d ORDER BY tvdbID ASC".$limit, $rsql, 0)); + return $db->query(sprintf(" SELECT id, tvdbid, seriesname, overview FROM thetvdb WHERE 1=1 %s AND tvdbid > %d ORDER BY tvdbid ASC".$limit, $rsql, 0)); } public function getSeriesCount($seriesname='') @@ -147,7 +147,7 @@ class TheTVDB if ($seriesname != '') $rsql .= sprintf("AND thetvdb.seriesname LIKE %s ", $db->escapeString("%".$seriesname."%")); - $res = $db->queryOneRow(sprintf("SELECT count(ID) AS num FROM thetvdb WHERE 1=1 %s ", $rsql)); + $res = $db->queryOneRow(sprintf("SELECT count(id) AS num FROM thetvdb WHERE 1=1 %s ", $rsql)); return $res["num"]; } @@ -180,14 +180,14 @@ class TheTVDB echo 'TheTVDB : '.$seriesName.' '.$fullep." Not found\n"; $db = new DB(); - $db->queryExec(sprintf('UPDATE releases SET episodeinfoID = -2 WHERE ID = %d', $releaseID)); + $db->queryExec(sprintf('UPDATE releases SET episodeinfoid = -2 WHERE id = %d', $releaseID)); } public function processReleases() { $db = new DB(); - $results = $db->queryDirect(sprintf("SELECT ID, searchname, rageID, anidbid, seriesfull, season, episode, tvtitle FROM releases WHERE episodeinfoID IS NULL AND categoryID IN ( SELECT ID FROM category WHERE parentID = %d ) LIMIT 150", Category::CAT_PARENT_TV)); + $results = $db->queryDirect(sprintf("SELECT id, searchname, rageid, anidbid, seriesfull, season, episode, tvtitle FROM releases WHERE episodeinfoid IS NULL AND categoryid IN ( SELECT id FROM category WHERE parentID = %d ) LIMIT 150", Category::CAT_PARENT_TV)); if ($db->getNumRows($results) > 0) { @@ -199,8 +199,8 @@ class TheTVDB unset($TheTVDBAPIArray, $episodeArray, $fullep, $epabsolute, $additionalSql); $seriesName = ''; - if($arr['rageID'] > 0) { - $seriesName = $db->queryOneRow(sprintf('SELECT releasetitle AS seriesName FROM tvrage WHERE rageID = %d', $arr['rageID'])); + if($arr['rageid'] > 0) { + $seriesName = $db->queryOneRow(sprintf('SELECT releasetitle AS seriesName FROM tvrage WHERE rageid = %d', $arr['rageid'])); } elseif($arr['anidbid'] > 0) { $seriesName = $db->queryOneRow(sprintf('SELECT title AS seriesName FROM anidb WHERE anidbid = %d', $arr['anidbid'])); @@ -208,7 +208,7 @@ class TheTVDB if(empty($seriesName) || !$seriesName) { - $this->notFound($seriesName, "", $arr['ID'], false); + $this->notFound($seriesName, "", $arr['id'], false); continue; } @@ -233,30 +233,30 @@ class TheTVDB else { $this->addEmptySeries($seriesName); - $this->notFound($seriesName, $fullep, $arr['ID']); + $this->notFound($seriesName, $fullep, $arr['id']); continue; } } else { $this->addEmptySeries($seriesName); - $this->notFound($seriesName, $fullep, $arr['ID']); + $this->notFound($seriesName, $fullep, $arr['id']); continue; } } - else if($TheTVDBAPIArray['tvdbID'] > 0 && ((time() - strtotime($TheTVDBAPIArray['createddate'])) > 604800)) + else if($TheTVDBAPIArray['tvdbid'] > 0 && ((time() - strtotime($TheTVDBAPIArray['createddate'])) > 604800)) { - $TheTVDBAPIArray = $this->TheTVDBAPI($TheTVDBAPIArray['tvdbID'], $seriesName); + $TheTVDBAPIArray = $this->TheTVDBAPI($TheTVDBAPIArray['tvdbid'], $seriesName); - $this->updateSeries($TheTVDBAPIArray['tvdbID'], $TheTVDBAPIArray['actors'], $TheTVDBAPIArray['airsday'], + $this->updateSeries($TheTVDBAPIArray['tvdbid'], $TheTVDBAPIArray['actors'], $TheTVDBAPIArray['airsday'], $TheTVDBAPIArray['airstime'], $TheTVDBAPIArray['contentrating'], $TheTVDBAPIArray['firstaired'], $TheTVDBAPIArray['genre'], - $TheTVDBAPIArray['imdbID'], $TheTVDBAPIArray['network'], $TheTVDBAPIArray['overview'], $TheTVDBAPIArray['rating'], + $TheTVDBAPIArray['imdbid'], $TheTVDBAPIArray['network'], $TheTVDBAPIArray['overview'], $TheTVDBAPIArray['rating'], $TheTVDBAPIArray['ratingcount'], $TheTVDBAPIArray['runtime'], $TheTVDBAPIArray['seriesname'], $TheTVDBAPIArray['status']); $this->addEpisodes($TheTVDBAPIArray); } - if($TheTVDBAPIArray['tvdbID'] > 0) + if($TheTVDBAPIArray['tvdbid'] > 0) { $epabsolute = '0'; if($arr['anidbid'] > 0) @@ -274,13 +274,13 @@ class TheTVDB $episodeArray = $Episode->getEpisodeInfoByName($seriesName, $fullep, (string) $epabsolute); if(!$episodeArray) { - $this->notFound($seriesName, $fullep, $arr['ID']); + $this->notFound($seriesName, $fullep, $arr['id']); continue; } } else { - $this->notFound($seriesName, $fullep, $arr['ID']); + $this->notFound($seriesName, $fullep, $arr['id']); continue; } @@ -293,12 +293,12 @@ class TheTVDB $db->escapeString($episodeArray['airdate'])); } - $db->queryExec(sprintf('UPDATE releases SET tvdbID = %d, episodeinfoID = %d %s WHERE ID = %d', - $TheTVDBAPIArray['tvdbID'], $episodeArray['ID'], $additionalSql, $arr['ID'])); + $db->queryExec(sprintf('UPDATE releases SET tvdbid = %d, episodeinfoid = %d %s WHERE id = %d', + $TheTVDBAPIArray['tvdbid'], $episodeArray['id'], $additionalSql, $arr['id'])); if($this->echooutput) { - echo 'TheTVDB : '.$seriesName.' '.$fullep." returned ".$episodeArray['tvdbID']."\n"; + echo 'TheTVDB : '.$seriesName.' '.$fullep." returned ".$episodeArray['tvdbid']."\n"; } } } @@ -331,14 +331,14 @@ class TheTVDB } $TheTVDBAPIArray = array( - 'tvdbID' => $seriesid, + 'tvdbid' => $seriesid, 'actors' => preg_replace('/^\||\|$/', '', (string) $TheTVDBAPIXML->Series->Actors), 'airsday' => preg_replace('/^\||\|$/', '', (string) $TheTVDBAPIXML->Series->Airs_DayOfWeek), 'airstime' => preg_replace('/^\||\|$/', '', (string) $TheTVDBAPIXML->Series->Airs_Time), 'contentrating' => (string) $TheTVDBAPIXML->Series->ContentRating, 'firstaired' => (string) $TheTVDBAPIXML->Series->FirstAired, 'genre' => preg_replace('/^\||\|$/', '', (string) $TheTVDBAPIXML->Series->Genre), - 'imdbID' => (int) preg_replace('/^[^\d]+/', '', (string) $TheTVDBAPIXML->Series->IMDB_ID), + 'imdbid' => (int) preg_replace('/^[^\d]+/', '', (string) $TheTVDBAPIXML->Series->IMDB_ID), 'network' => (string) $TheTVDBAPIXML->Series->Network, 'overview' => (string) $TheTVDBAPIXML->Series->Overview, 'rating' => (float) $TheTVDBAPIXML->Series->Rating, diff --git a/lib/copy_this/www/lib/tvrage.php b/lib/copy_this/www/lib/tvrage.php index f4bd8b9f3..e4fe7e9a3 100644 --- a/lib/copy_this/www/lib/tvrage.php +++ b/lib/copy_this/www/lib/tvrage.php @@ -36,23 +36,23 @@ class TvRage public function getByID($id) { $db = new DB(); - return $db->queryOneRow(sprintf("select * from tvrage where ID = %d", $id )); + return $db->queryOneRow(sprintf("select * from tvrage where id = %d", $id )); } public function getByRageID($id) { $db = new DB(); - return $db->query(sprintf("select * from tvrage where rageID = %d", $id )); + return $db->query(sprintf("select * from tvrage where rageid = %d", $id )); } public function getByTitle($title) { // check if we already have an entry for this show $db = new DB(); - $sql = sprintf("SELECT rageID from tvrage where (releasetitle = %s or releasetitle = %s)", $db->escapeString($title), $db->escapeString(str_replace(' and ', ' & ', $title))); + $sql = sprintf("SELECT rageid from tvrage where (releasetitle = %s or releasetitle = %s)", $db->escapeString($title), $db->escapeString(str_replace(' and ', ' & ', $title))); $res = $db->queryOneRow($sql); if ($res) - return $res["rageID"]; + return $res["rageid"]; return false; } @@ -62,7 +62,7 @@ class TvRage $releasename = str_replace(array('.','_'), array(' ',' '), $releasename); $db = new DB(); - return $db->queryInsert(sprintf("insert into tvrage (rageID, releasetitle, description, genre, country, createddate, imgdata) values (%d, %s, %s, %s, %s, now(), %s)", + return $db->queryInsert(sprintf("insert into tvrage (rageid, releasetitle, description, genre, country, createddate, imgdata) values (%d, %s, %s, %s, %s, now(), %s)", $rageid, $db->escapeString($releasename), $db->escapeString($desc), $db->escapeString($genre), $db->escapeString($country), $db->escapeString($imgbytes))); } @@ -73,14 +73,14 @@ class TvRage if ($imgbytes != "") $imgbytes = sprintf(", imgdata = %s", $db->escapeString($imgbytes)); - $db->queryExec(sprintf("update tvrage set rageID = %d, releasetitle = %s, description = %s, genre = %s, country = %s %s where ID = %d", + $db->queryExec(sprintf("update tvrage set rageid = %d, releasetitle = %s, description = %s, genre = %s, country = %s %s where id = %d", $rageid, $db->escapeString($releasename), $db->escapeString($desc), $db->escapeString($genre), $db->escapeString($country), $imgbytes, $id )); } public function delete($id) { $db = new DB(); - return $db->queryExec(sprintf("DELETE from tvrage where ID = %d",$id)); + return $db->queryExec(sprintf("DELETE from tvrage where id = %d",$id)); } public function getRange($start, $num, $ragename="") @@ -96,7 +96,7 @@ class TvRage if ($ragename != "") $rsql .= sprintf("and tvrage.releasetitle like %s ", $db->escapeString("%".$ragename."%")); - return $db->query(sprintf(" SELECT ID, rageID, releasetitle, description, createddate from tvrage where 1=1 %s order by rageID asc".$limit, $rsql)); + return $db->query(sprintf(" SELECT id, rageid, releasetitle, description, createddate from tvrage where 1=1 %s order by rageid asc".$limit, $rsql)); } public function getCount($ragename="") @@ -107,7 +107,7 @@ class TvRage if ($ragename != "") $rsql .= sprintf("and tvrage.releasetitle like %s ", $db->escapeString("%".$ragename."%")); - $res = $db->queryOneRow(sprintf("select count(ID) as num from tvrage where 1=1 %s ", $rsql)); + $res = $db->queryOneRow(sprintf("select count(id) as num from tvrage where 1=1 %s ", $rsql)); return $res["num"]; } @@ -116,7 +116,7 @@ class TvRage $db = new DB(); if(!preg_match('/\d{4}-\d{2}-\d{2}/',$date)) $date = date("Y-m-d"); - $sql = sprintf("SELECT * FROM episodeinfo WHERE rageID > %d AND DATE(airdate) = %s order by airdate asc ", 0, $db->escapeString($date)); + $sql = sprintf("SELECT * FROM episodeinfo WHERE rageid > %d AND DATE(airdate) = %s order by airdate asc ", 0, $db->escapeString($date)); return $db->query($sql); } @@ -138,7 +138,7 @@ class TvRage $tsql .= sprintf("and tvrage.releasetitle like %s", $db->escapeString("%".$ragename."%")); } - $sql = sprintf(" SELECT tvrage.ID, tvrage.rageID, tvrage.releasetitle, tvrage.genre, tvrage.country, tvrage.createddate, tvrage.prevdate, tvrage.nextdate, userseries.ID as userseriesID from tvrage left outer join userseries on userseries.userID = %d and userseries.rageID = tvrage.rageID where tvrage.rageID > 0 %s %s group by tvrage.rageID order by tvrage.releasetitle asc", $uid, $rsql, $tsql); + $sql = sprintf(" SELECT tvrage.id, tvrage.rageid, tvrage.releasetitle, tvrage.genre, tvrage.country, tvrage.createddate, tvrage.prevdate, tvrage.nextdate, userseries.id as userseriesID from tvrage left outer join userseries on userseries.userID = %d and userseries.rageid = tvrage.rageid where tvrage.rageid > 0 %s %s group by tvrage.rageid order by tvrage.releasetitle asc", $uid, $rsql, $tsql); return $db->query($sql); } @@ -216,8 +216,8 @@ class TvRage $fullep = $db->escapeString($sShow->ep); $link = $db->escapeString($sShow->link); $airdate = $db->escapeString(date("Y-m-d H:i:s", $day_time)); - $sql = sprintf('INSERT into episodeinfo (rageID,showtitle,fullep,airdate,link,eptitle) VALUES (%d,%s,%s,%s,%s,%s) - ON DUPLICATE KEY UPDATE rageID = %1$d, airdate = %4$s, link = %5$s, eptitle = %6$s, showtitle = %2$s', + $sql = sprintf('INSERT into episodeinfo (rageid,showtitle,fullep,airdate,link,eptitle) VALUES (%d,%s,%s,%s,%s,%s) + ON DUPLICATE KEY UPDATE rageid = %1$d, airdate = %4$s, link = %5$s, eptitle = %6$s, showtitle = %2$s', $sShow->sid,$showname,$fullep,$airdate,$link,$title); $db->queryInsert($sql); } @@ -227,7 +227,7 @@ class TvRage // update series info foreach ($xmlSchedule as $showId=>$epInfo) { - $res = $db->query(sprintf("select *, UNIX_TIMESTAMP(nextdate) as nextDateU, UNIX_TIMESTAMP(DATE(nextdate)) as nextDateDay from tvrage where rageID = %d", $showId)); + $res = $db->query(sprintf("select *, UNIX_TIMESTAMP(nextdate) as nextDateU, UNIX_TIMESTAMP(DATE(nextdate)) as nextDateDay from tvrage where rageid = %d", $showId)); if (sizeof($res) > 0) { foreach ($res as $arr) @@ -247,7 +247,7 @@ class TvRage { if ($prev_ep == "" && $arr['nextinfo'] != '' && $epInfo['next']['day_time'] > $arr['nextDateU'] && $arr['nextDateDay'] < $yesterday) { - $db->queryExec(sprintf("update tvrage set prevdate = nextdate, previnfo = nextinfo where ID = %d", $arr['ID'])); + $db->queryExec(sprintf("update tvrage set prevdate = nextdate, previnfo = nextinfo where id = %d", $arr['id'])); $prev_ep = "SWAPPED with: ".$arr['nextinfo']." - ".date("r", $arr['nextDateU']); } $next_ep = $epInfo['next']['episode'].', "'.$epInfo['next']['title'].'"'; @@ -272,7 +272,7 @@ class TvRage if (count($query) > 0) { $sql = str_ireplace("%", "%%", join(", ", $query)); - $sql = sprintf("update tvrage set {$sql} where ID = %d", $arr['ID']); + $sql = sprintf("update tvrage set {$sql} where id = %d", $arr['id']); $db->queryExec($sql); } } @@ -397,14 +397,14 @@ class TvRage } else { $tvairdate = $db->escapestring($show['airdate']); } - $db->queryExec(sprintf("update releases set seriesfull = %s, season = %s, episode = %s, tvairdate=%s where ID = %d", + $db->queryExec(sprintf("update releases set seriesfull = %s, season = %s, episode = %s, tvairdate=%s where id = %d", $db->escapeString($show['seriesfull']), $db->escapeString($show['season']), $db->escapeString($show['episode']), $tvairdate, $relid)); } public function refreshRageInfo($id) { $row = $this->getByID($id); - $rageid = $row["rageID"]; + $rageid = $row["rageid"]; $rInfo = $this->getRageInfoFromPage($rageid); $desc = ''; @@ -440,11 +440,11 @@ class TvRage //check local releases to see if we already have the data if ($idCheck && sizeof($idCheck) > 0) { - $epinfo = $db->queryOneRow(sprintf("select tvtitle as title, tvairdate as airdate from releases where tvairdate is not null and season = %s and episode = %s and rageID = %d", $db->escapeString($show['season']), $db->escapeString($show['episode']), $idCheck[0]['rageID'])); + $epinfo = $db->queryOneRow(sprintf("select tvtitle as title, tvairdate as airdate from releases where tvairdate is not null and season = %s and episode = %s and rageid = %d", $db->escapeString($show['season']), $db->escapeString($show['episode']), $idCheck[0]['rageid'])); //check tvdb episodeinfo data if ($epinfo == false) - $epinfo = $db->queryOneRow(sprintf("select eptitle as title, airdate as airdate from episodeinfo where airdate is not null and fullep = %s and rageID = %d", $db->escapeString(str_replace('S', '', $show['season']).'x'.str_replace('E', '', $show['episode'])), $idCheck[0]['rageID'])); + $epinfo = $db->queryOneRow(sprintf("select eptitle as title, airdate as airdate from episodeinfo where airdate is not null and fullep = %s and rageid = %d", $db->escapeString(str_replace('S', '', $show['season']).'x'.str_replace('E', '', $show['episode'])), $idCheck[0]['rageid'])); } // try and get the episode specific info from tvrage if its not available locally @@ -456,11 +456,11 @@ class TvRage $tvairdate = (!empty($epinfo['airdate'])) ? $db->escapeString($epinfo['airdate']) : "null"; $tvtitle = (!empty($epinfo['title'])) ? $db->escapeString($epinfo['title']) : "null"; - $db->queryExec(sprintf("update releases set tvtitle=trim(%s), tvairdate=%s, rageID = %d where ID = %d", $tvtitle, $tvairdate, $tvrShow['showid'], $relid)); + $db->queryExec(sprintf("update releases set tvtitle=trim(%s), tvairdate=%s, rageid = %d where id = %d", $tvtitle, $tvairdate, $tvrShow['showid'], $relid)); } else { - $db->queryExec(sprintf("update releases set rageID = %d where ID = %d", $tvrShow['showid'], $relid)); + $db->queryExec(sprintf("update releases set rageid = %d where id = %d", $tvrShow['showid'], $relid)); } $genre = ''; @@ -503,7 +503,7 @@ class TvRage $nfo = new Nfo(); // get all releases without a rageid which are in a tv category. - $result = $db->queryDirect(sprintf("SELECT searchname, ID from releases where rageID = -1 and categoryID in ( select ID from category where parentID = %d ) order by postdate desc limit %d ", Category::CAT_PARENT_TV, $numtoProcess)); + $result = $db->queryDirect(sprintf("SELECT searchname, id from releases where rageid = -1 and categoryid in ( select id from category where parentID = %d ) order by postdate desc limit %d ", Category::CAT_PARENT_TV, $numtoProcess)); if ($db->getNumRows($result) > 0) { @@ -513,17 +513,17 @@ class TvRage while ($arr = $db->getAssocArray($result)) { $rageID = false; - /* Preliminary Rage ID Detection from NFO file */ + /* Preliminary Rage id Detection from NFO file */ $rawnfo = ''; - if($nfo->getNfo($arr['ID'], $rawnfo)) + if($nfo->getNfo($arr['id'], $rawnfo)) $rageID = $this->parseRageIdFromNfo($rawnfo); if($rageID){ // Set RageID (if matched db) and move along - $res = $db->query(sprintf("SELECT count(ID) as cnt from tvrage where rageID = %d", $rageID)); + $res = $db->query(sprintf("SELECT count(id) as cnt from tvrage where rageid = %d", $rageID)); if(count($res) >= 1 && intval($res[0]['cnt']) > 1) { - $db->queryExec(sprintf("update releases set rageID = %d where ID = %d", $rageID, $arr["ID"])); + $db->queryExec(sprintf("update releases set rageid = %d where id = %d", $rageID, $arr["id"])); continue; } } @@ -532,9 +532,9 @@ class TvRage if (is_array($show) && $show['name'] != '') { // update release with season, ep, and airdate info (if available) from releasetitle - $this->updateEpInfo($show, $arr['ID']); + $this->updateEpInfo($show, $arr['id']); - // find the rageID + // find the rageid $id = $this->getByTitle($show['cleanname']); if ($id === false && $lookupTvRage) @@ -547,12 +547,12 @@ class TvRage if ($tvrShow !== false && is_array($tvrShow)) { // get all tv info and add show - $this->updateRageInfo($tvrShow['showid'], $show, $tvrShow, $arr['ID']); + $this->updateRageInfo($tvrShow['showid'], $show, $tvrShow, $arr['id']); } elseif ($tvrShow === false) { // no match - //add to tvrage with rageID = -2 and $show['cleanname'] title only + //add to tvrage with rageid = -2 and $show['cleanname'] title only $this->add(-2, $show['cleanname'], '', '', '', ''); } else @@ -574,12 +574,12 @@ class TvRage { //check local releases to see if we already have the data - $epinfo = $db->queryOneRow(sprintf("select tvtitle as title, tvairdate as airdate from releases where tvairdate is not null and season = %s and episode = %s and rageID = %d", $db->escapeString($show['season']), $db->escapeString($show['episode']), $id)); + $epinfo = $db->queryOneRow(sprintf("select tvtitle as title, tvairdate as airdate from releases where tvairdate is not null and season = %s and episode = %s and rageid = %d", $db->escapeString($show['season']), $db->escapeString($show['episode']), $id)); //check tvdb episodeinfo data if ($epinfo == false) { - $sql = sprintf("select eptitle as title, airdate as airdate from episodeinfo where airdate is not null and fullep = %s and rageID = %d", $db->escapeString(str_replace('S', '', $show['season']).'x'.str_replace('E', '', $show['episode'])), $id); + $sql = sprintf("select eptitle as title, airdate as airdate from episodeinfo where airdate is not null and fullep = %s and rageid = %d", $db->escapeString(str_replace('S', '', $show['season']).'x'.str_replace('E', '', $show['episode'])), $id); $epinfo = $db->queryOneRow($sql); } @@ -596,18 +596,18 @@ class TvRage } } } - $db->queryExec(sprintf("update releases set tvtitle=trim(%s), tvairdate=%s, rageID = %d where ID = %d", $tvtitle, $tvairdate, $id, $arr["ID"])); + $db->queryExec(sprintf("update releases set tvtitle=trim(%s), tvairdate=%s, rageid = %d where id = %d", $tvtitle, $tvairdate, $id, $arr["id"])); } else { // cant find rageid, so set rageid to n/a - $db->queryExec(sprintf("update releases set rageID = -2 where ID = %d", $arr["ID"])); + $db->queryExec(sprintf("update releases set rageid = -2 where id = %d", $arr["id"])); } } else { // not a tv episode, so set rageid to n/a - $db->queryExec(sprintf("update releases set rageID = -2 where ID = %d", $arr["ID"])); + $db->queryExec(sprintf("update releases set rageid = -2 where id = %d", $arr["id"])); } $ret++; } diff --git a/lib/copy_this/www/lib/usermovies.php b/lib/copy_this/www/lib/usermovies.php index a063d7ff7..eb50c4dc9 100644 --- a/lib/copy_this/www/lib/usermovies.php +++ b/lib/copy_this/www/lib/usermovies.php @@ -9,27 +9,27 @@ class UserMovies $catid = (!empty($catid)) ? $db->escapeString(implode('|', $catid)) : "null"; - $sql = sprintf("insert into usermovies (userID, imdbID, categoryID, createddate) values (%d, %d, %s, now())", $uid, $imdbid, $catid); + $sql = sprintf("insert into usermovies (userID, imdbid, categoryid, createddate) values (%d, %d, %s, now())", $uid, $imdbid, $catid); return $db->queryInsert($sql); } public function getMovies($uid) { $db = new DB(); - $sql = sprintf("select usermovies.*, movieinfo.year, movieinfo.plot, movieinfo.cover, movieinfo.title from usermovies left outer join movieinfo on movieinfo.imdbID = usermovies.imdbID where userID = %d order by movieinfo.title asc", $uid); + $sql = sprintf("select usermovies.*, movieinfo.year, movieinfo.plot, movieinfo.cover, movieinfo.title from usermovies left outer join movieinfo on movieinfo.imdbid = usermovies.imdbid where userID = %d order by movieinfo.title asc", $uid); return $db->query($sql); } public function delMovie($uid, $imdbid) { $db = new DB(); - $db->queryExec(sprintf("DELETE from usermovies where userID = %d and imdbID = %d ", $uid, $imdbid)); + $db->queryExec(sprintf("DELETE from usermovies where userID = %d and imdbid = %d ", $uid, $imdbid)); } public function getMovie($uid, $imdbid) { $db = new DB(); - $sql = sprintf("select usermovies.*, movieinfo.title from usermovies left outer join movieinfo on movieinfo.imdbID = usermovies.imdbID where usermovies.userID = %d and usermovies.imdbID = %d ", $uid, $imdbid); + $sql = sprintf("select usermovies.*, movieinfo.title from usermovies left outer join movieinfo on movieinfo.imdbid = usermovies.imdbid where usermovies.userID = %d and usermovies.imdbid = %d ", $uid, $imdbid); return $db->queryOneRow($sql); } @@ -45,7 +45,7 @@ class UserMovies $catid = (!empty($catid)) ? $db->escapeString(implode('|', $catid)) : "null"; - $sql = sprintf("update usermovies set categoryID = %s where userID = %d and imdbID = %d", $catid, $uid, $imdbid); + $sql = sprintf("update usermovies set categoryid = %s where userID = %d and imdbid = %d", $catid, $uid, $imdbid); $db->queryExec($sql); } } \ No newline at end of file diff --git a/lib/copy_this/www/lib/users.php b/lib/copy_this/www/lib/users.php index 54d5c8196..500aca83d 100644 --- a/lib/copy_this/www/lib/users.php +++ b/lib/copy_this/www/lib/users.php @@ -73,7 +73,7 @@ class Users $forum = new Forum(); $forum->deleteUser($id); - $db->exec(sprintf("DELETE from users where ID = %d", $id)); + $db->exec(sprintf("DELETE from users where id = %d", $id)); } public function delCartForUser($uid) @@ -129,7 +129,7 @@ class Users $order = $this->getBrowseOrder($orderby); - return $db->query(sprintf(" SELECT users.*, userroles.name as rolename from users inner join userroles on userroles.ID = users.role where 1=1 %s %s %s %s AND email != 'sharing@nZEDb.com' order by %s %s" . $limit, $usql, $esql, $hsql, $rsql, $order[0], $order[1])); + return $db->query(sprintf(" SELECT users.*, userroles.name as rolename from users inner join userroles on userroles.id = users.role where 1=1 %s %s %s %s AND email != 'sharing@nZEDb.com' order by %s %s" . $limit, $usql, $esql, $hsql, $rsql, $order[0], $order[1])); } public function getBrowseOrder($orderby) @@ -173,7 +173,7 @@ class Users public function getCount() { $db = new DB(); - $res = $db->queryOneRow("select count(ID) as num from users WHERE email != 'sharing@nZEDb.com'"); + $res = $db->queryOneRow("select count(id) as num from users WHERE email != 'sharing@nZEDb.com'"); return $res["num"]; } @@ -193,12 +193,12 @@ class Users $res = $this->getByUsername($uname); if ($res) - if ($res["ID"] != $id) + if ($res["id"] != $id) return Users::ERR_SIGNUP_UNAMEINUSE; $res = $this->getByEmail($email); if ($res) - if ($res["ID"] != $id) + if ($res["id"] != $id) return Users::ERR_SIGNUP_EMAILINUSE; $sql = array(); @@ -278,7 +278,7 @@ class Users { $db = new DB(); - return $db->queryOneRow(sprintf("select users.*, userroles.name as rolename, userroles.apirequests, userroles.downloadrequests from users inner join userroles on userroles.ID = users.role where username = %s ", $db->escapeString($uname))); + return $db->queryOneRow(sprintf("select users.*, userroles.name as rolename, userroles.apirequests, userroles.downloadrequests from users inner join userroles on userroles.id = users.role where username = %s ", $db->escapeString($uname))); } public function getByEmail($email) @@ -299,7 +299,7 @@ class Users public function updateUserRoleChangeDate($uid, $date) { $db = new DB(); - $db->exec(sprintf("update users SET rolechangedate = '%s' WHERE ID = %d", $date, $uid)); + $db->exec(sprintf("update users SET rolechangedate = '%s' WHERE id = %d", $date, $uid)); return Users::SUCCESS; } @@ -311,10 +311,10 @@ class Users $site = new Sites; $s = $site->get(); - $data = $db->query(sprintf("select ID,email from users WHERE role = %d and rolechangedate < now()", $uprole)); + $data = $db->query(sprintf("select id,email from users WHERE role = %d and rolechangedate < now()", $uprole)); foreach ($data as $u) { Utility::sendEmail($u["email"], $msgsubject, $msgbody, $s->email); - $db->exec(sprintf("update users SET role = %d, rolechangedate=null WHERE ID = %d", $downrole, $u["ID"])); + $db->exec(sprintf("update users SET role = %d, rolechangedate=null WHERE id = %d", $downrole, $u["id"])); } return Users::SUCCESS; @@ -392,7 +392,7 @@ class Users public function getById($id) { $db = new DB(); - $sql = sprintf("select users.*, userroles.name as rolename, userroles.hideads, userroles.canpreview, userroles.canpre, userroles.apirequests, userroles.downloadrequests, NOW() as now from users inner join userroles on userroles.ID = users.role where users.id = %d ", $id); + $sql = sprintf("select users.*, userroles.name as rolename, userroles.hideads, userroles.canpreview, userroles.canpre, userroles.apirequests, userroles.downloadrequests, NOW() as now from users inner join userroles on userroles.id = users.role where users.id = %d ", $id); return $db->queryOneRow($sql); } @@ -401,7 +401,7 @@ class Users { $db = new DB(); - return $db->queryOneRow(sprintf("select users.*, userroles.apirequests, userroles.downloadrequests, NOW() as now from users inner join userroles on userroles.ID = users.role where users.rsstoken = %s ", $db->escapeString($rsstoken))); + return $db->queryOneRow(sprintf("select users.*, userroles.apirequests, userroles.downloadrequests, NOW() as now from users inner join userroles on userroles.id = users.role where users.rsstoken = %s ", $db->escapeString($rsstoken))); } public function getBrowseOrdering() @@ -518,7 +518,7 @@ class Users return -1; $db = new DB(); - $db->exec(sprintf("update users set invites = case when invites <= 0 then 0 else invites-1 end where ID = %d ", $invite["userID"])); + $db->exec(sprintf("update users set invites = case when invites <= 0 then 0 else invites-1 end where id = %d ", $invite["userID"])); $this->deleteInvite($invitecode); return $invite["userID"]; @@ -604,7 +604,7 @@ class Users if ($host != '') $hostSql = sprintf(', host = %s', $db->escapeString($host)); - $db->exec(sprintf("update users set lastlogin = now() %s where ID = %d ", $hostSql, $uid)); + $db->exec(sprintf("update users set lastlogin = now() %s where id = %d ", $hostSql, $uid)); } public function setCookies($uid) @@ -637,7 +637,7 @@ class Users public function addCart($uid, $releaseid) { $db = new DB(); - $sql = sprintf("insert into usercart (userID, releaseID, createddate) values (%d, %d, now())", $uid, $releaseid); + $sql = sprintf("insert into usercart (userID, releaseid, createddate) values (%d, %d, now())", $uid, $releaseid); return $db->queryInsert($sql); } @@ -646,9 +646,9 @@ class Users { $db = new DB(); if ($releaseid != "") - $releaseid = " and releases.ID = " . $db->escapeString($releaseid); + $releaseid = " and releases.id = " . $db->escapeString($releaseid); - return $db->query(sprintf("select usercart.*, releases.searchname,releases.guid from usercart inner join releases on releases.ID = usercart.releaseID where userID = %d %s", $uid, $releaseid)); + return $db->query(sprintf("select usercart.*, releases.searchname,releases.guid from usercart inner join releases on releases.id = usercart.releaseid where userID = %d %s", $uid, $releaseid)); } public function delCartByGuid($guids, $uid) @@ -664,22 +664,22 @@ class Users $del[] = $id; } - $sql = sprintf("delete from usercart where userID = %d and releaseID IN (select ID from releases where guid IN (%s)) ", $uid, implode(',', $del)); + $sql = sprintf("delete from usercart where userID = %d and releaseid IN (select id from releases where guid IN (%s)) ", $uid, implode(',', $del)); $db->query($sql); } public function delCartByUserAndRelease($guid, $uid) { $db = new DB(); - $rel = $db->queryOneRow(sprintf("select ID from releases where guid = %s", $db->escapeString($guid))); + $rel = $db->queryOneRow(sprintf("select id from releases where guid = %s", $db->escapeString($guid))); if ($rel) - $db->exec(sprintf("DELETE FROM usercart WHERE userID = %d AND releaseID = %d", $uid, $rel["ID"])); + $db->exec(sprintf("DELETE FROM usercart WHERE userID = %d AND releaseid = %d", $uid, $rel["id"])); } public function delCartForRelease($rid) { $db = new DB(); - $db->exec(sprintf("DELETE from usercart where releaseID = %d", $rid)); + $db->exec(sprintf("DELETE from usercart where releaseid = %d", $rid)); } public function addCategoryExclusions($uid, $catids) @@ -688,7 +688,7 @@ class Users $this->delUserCategoryExclusions($uid); if (count($catids) > 0) { foreach ($catids as $catid) { - $db->queryInsert(sprintf("insert into userexcat (userID, categoryID, createddate) values (%d, %d, now())", $uid, $catid)); + $db->queryInsert(sprintf("insert into userexcat (userID, categoryid, createddate) values (%d, %d, now())", $uid, $catid)); } } } @@ -697,9 +697,9 @@ class Users { $db = new DB(); $ret = array(); - $data = $db->query(sprintf("select categoryID from roleexcat where role = %d", $role)); + $data = $db->query(sprintf("select categoryid from roleexcat where role = %d", $role)); foreach ($data as $d) - $ret[] = $d["categoryID"]; + $ret[] = $d["categoryid"]; return $ret; } @@ -710,7 +710,7 @@ class Users $this->delRoleCategoryExclusions($role); if (count($catids) > 0) { foreach ($catids as $catid) { - $db->queryInsert(sprintf("insert into roleexcat (role, categoryID, createddate) values (%d, %d, now())", $role, $catid)); + $db->queryInsert(sprintf("insert into roleexcat (role, categoryid, createddate) values (%d, %d, now())", $role, $catid)); } } } @@ -741,9 +741,9 @@ class Users { $db = new DB(); $ret = array(); - $data = $db->query(sprintf("select categoryID from userexcat where userID = %d union distinct select categoryID from roleexcat inner join users on users.role = roleexcat.role where users.ID = %d", $uid, $uid)); + $data = $db->query(sprintf("select categoryid from userexcat where userID = %d union distinct select categoryid from roleexcat inner join users on users.role = roleexcat.role where users.id = %d", $uid, $uid)); foreach ($data as $d) - $ret[] = $d["categoryID"]; + $ret[] = $d["categoryid"]; return $ret; } @@ -751,7 +751,7 @@ class Users public function delCategoryExclusion($uid, $catid) { $db = new DB(); - $db->exec(sprintf("DELETE from userexcat where userID = %d and categoryID = %d", $uid, $catid)); + $db->exec(sprintf("DELETE from userexcat where userID = %d and categoryid = %d", $uid, $catid)); } public function sendInvite($sitetitle, $siteemail, $serverurl, $uid, $emailto) @@ -778,8 +778,8 @@ class Users { $db = new DB(); - return $db->query("SELECT ID, username, SUM(grabs) as grabs FROM users - GROUP BY ID, username + return $db->query("SELECT id, username, SUM(grabs) as grabs FROM users + GROUP BY id, username HAVING SUM(grabs) > 0 ORDER BY grabs DESC LIMIT 10" @@ -818,9 +818,9 @@ class Users $sql = sprintf("select hosthash, group_concat(userID) as user_string, group_concat(username) as user_names from ( - select hosthash, userID, username from userdownloads left outer join users on users.ID = userdownloads.userID where hosthash is not null and hosthash not in %s group by hosthash, userID + select hosthash, userID, username from userdownloads left outer join users on users.id = userdownloads.userID where hosthash is not null and hosthash not in %s group by hosthash, userID union distinct - select hosthash, userID, username from userrequests left outer join users on users.ID = userrequests.userID where hosthash is not null and hosthash not in %s group by hosthash, userID + select hosthash, userID, username from userrequests left outer join users on users.id = userrequests.userID where hosthash is not null and hosthash not in %s group by hosthash, userID ) x group by hosthash having CAST((LENGTH(group_concat(userID)) - LENGTH(REPLACE(group_concat(userID), ',', ''))) / LENGTH(',') AS UNSIGNED) < 9 @@ -846,10 +846,10 @@ class Users { $db = new DB(); - return $db->query("select ur.name, count(u.ID) as num from users u - inner join userroles ur on ur.ID = u.role + return $db->query("select ur.name, count(u.id) as num from users u + inner join userroles ur on ur.id = u.role group by ur.name - order by count(u.ID) desc;" + order by count(u.id) desc;" ); } @@ -887,7 +887,7 @@ class Users public function getRoleById($id) { $db = new DB(); - $sql = sprintf("select * from userroles where ID = %d", $id); + $sql = sprintf("select * from userroles where id = %d", $id); return $db->queryOneRow($sql); } @@ -906,23 +906,23 @@ class Users if ($isdefault == 1) $db->exec("update userroles set isdefault=0"); - return $db->exec(sprintf("update userroles set name=%s, apirequests=%d, downloadrequests=%d, defaultinvites=%d, isdefault=%d, canpreview=%d, canpre=%d, hideads=%d WHERE ID=%d", $db->escapeString($name), $apirequests, $downloadrequests, $defaultinvites, $isdefault, $canpreview, $canpre, $hideads, $id)); + return $db->exec(sprintf("update userroles set name=%s, apirequests=%d, downloadrequests=%d, defaultinvites=%d, isdefault=%d, canpreview=%d, canpre=%d, hideads=%d WHERE id=%d", $db->escapeString($name), $apirequests, $downloadrequests, $defaultinvites, $isdefault, $canpreview, $canpre, $hideads, $id)); } public function deleteRole($id) { $db = new DB(); - $res = $db->query(sprintf("select ID from users where role = %d", $id)); + $res = $db->query(sprintf("select id from users where role = %d", $id)); if (sizeof($res) > 0) { $userids = array(); foreach ($res as $user) - $userids[] = $user['ID']; + $userids[] = $user['id']; $defaultrole = $this->getDefaultRole(); - $db->exec(sprintf("update users set role=%d where ID IN (%s)", $defaultrole['ID'], implode(',', $userids))); + $db->exec(sprintf("update users set role=%d where id IN (%s)", $defaultrole['id'], implode(',', $userids))); } - return $db->exec(sprintf("DELETE from userroles WHERE ID=%d", $id)); + return $db->exec(sprintf("DELETE from userroles WHERE id=%d", $id)); } public function getDefaultRole() @@ -939,7 +939,7 @@ class Users //$db->exec(sprintf("DELETE FROM userrequests WHERE (userID = %d AND timestamp < DATE_SUB(NOW(), INTERVAL 1 DAY))", $userid)); $db->exec(sprintf("DELETE FROM userrequests WHERE timestamp < DATE_SUB(NOW(), INTERVAL 1 DAY)", $userid)); - $sql = sprintf("select COUNT(ID) as num, TIME_TO_SEC(TIMEDIFF(DATE_ADD(MIN(TIMESTAMP), INTERVAL 1 DAY), NOW())) AS nextrequest FROM userrequests WHERE userID = %d AND timestamp > DATE_SUB(NOW(), INTERVAL 1 DAY)", $userid); + $sql = sprintf("select COUNT(id) as num, TIME_TO_SEC(TIMEDIFF(DATE_ADD(MIN(TIMESTAMP), INTERVAL 1 DAY), NOW())) AS nextrequest FROM userrequests WHERE userID = %d AND timestamp > DATE_SUB(NOW(), INTERVAL 1 DAY)", $userid); return $db->queryOneRow($sql); } @@ -965,7 +965,7 @@ class Users $db = new DB(); if ($days == 0) { $days = 1; - $db->exec("update userdownloads set releaseID = null"); + $db->exec("update userdownloads set releaseid = null"); } $db->exec(sprintf("DELETE from userrequests where timestamp < DATE_SUB(NOW(), INTERVAL %d DAY)", $days)); @@ -984,9 +984,9 @@ class Users } $ipsql = "(" . $ipsql . " '-1')"; - $sql = sprintf("select COUNT(ID) as num, TIME_TO_SEC(TIMEDIFF(DATE_ADD(MIN(TIMESTAMP), INTERVAL 1 DAY), NOW())) AS nextdl FROM userdownloads WHERE hosthash = %s AND timestamp > DATE_SUB(NOW(), INTERVAL 1 DAY) and hosthash not in %s", $db->escapeString($hosthash), $ipsql); + $sql = sprintf("select COUNT(id) as num, TIME_TO_SEC(TIMEDIFF(DATE_ADD(MIN(TIMESTAMP), INTERVAL 1 DAY), NOW())) AS nextdl FROM userdownloads WHERE hosthash = %s AND timestamp > DATE_SUB(NOW(), INTERVAL 1 DAY) and hosthash not in %s", $db->escapeString($hosthash), $ipsql); } else { - $sql = sprintf("select COUNT(ID) as num, TIME_TO_SEC(TIMEDIFF(DATE_ADD(MIN(TIMESTAMP), INTERVAL 1 DAY), NOW())) AS nextdl FROM userdownloads WHERE userID = %d AND timestamp > DATE_SUB(NOW(), INTERVAL 1 DAY)", $userid); + $sql = sprintf("select COUNT(id) as num, TIME_TO_SEC(TIMEDIFF(DATE_ADD(MIN(TIMESTAMP), INTERVAL 1 DAY), NOW())) AS nextdl FROM userdownloads WHERE userID = %d AND timestamp > DATE_SUB(NOW(), INTERVAL 1 DAY)", $userid); } return $db->queryOneRow($sql); @@ -1004,7 +1004,7 @@ class Users $hashsql .= " 1=2 "; - $sql = sprintf("select userdownloads.*, releases.guid, releases.searchname from userdownloads left outer join releases on releases.ID = userdownloads.releaseID where userdownloads.userID = %d or %s order by userdownloads.timestamp desc", $userid, $hashsql); + $sql = sprintf("select userdownloads.*, releases.guid, releases.searchname from userdownloads left outer join releases on releases.id = userdownloads.releaseid where userdownloads.userID = %d or %s order by userdownloads.timestamp desc", $userid, $hashsql); return $db->query($sql); } @@ -1014,7 +1014,7 @@ class Users $db = new DB(); $hosthash = ($hosthash != "" ? $db->escapeString($hosthash) : "null"); - $sql = sprintf("insert into userdownloads (userID, timestamp, hosthash, releaseID) VALUES (%d, now(), %s, (select ID from releases where guid = %s))", $userid, $hosthash, $db->escapeString($relGuid)); + $sql = sprintf("insert into userdownloads (userID, timestamp, hosthash, releaseid) VALUES (%d, now(), %s, (select id from releases where guid = %s))", $userid, $hosthash, $db->escapeString($relGuid)); return $db->queryInsert($sql); } @@ -1023,6 +1023,6 @@ class Users { $db = new DB(); - return $db->queryInsert(sprintf("delete from userdownloads where releaseID = %d", $releaseID)); + return $db->queryInsert(sprintf("delete from userdownloads where releaseid = %d", $releaseID)); } } \ No newline at end of file diff --git a/lib/copy_this/www/lib/userseries.php b/lib/copy_this/www/lib/userseries.php index 40065513d..92ab9788e 100644 --- a/lib/copy_this/www/lib/userseries.php +++ b/lib/copy_this/www/lib/userseries.php @@ -9,27 +9,27 @@ class UserSeries $catid = (!empty($catid)) ? $db->escapeString(implode('|', $catid)) : "null"; - $sql = sprintf("insert into userseries (userID, rageID, categoryID, createddate) values (%d, %d, %s, now())", $uid, $rageid, $catid); + $sql = sprintf("insert into userseries (userID, rageid, categoryid, createddate) values (%d, %d, %s, now())", $uid, $rageid, $catid); return $db->queryInsert($sql); } public function getShows($uid) { $db = new DB(); - $sql = sprintf("select userseries.*, tvrage.releasetitle from userseries inner join (SELECT ID, releasetitle, rageid FROM tvrage GROUP BY rageid) tvrage on tvrage.rageID = userseries.rageID where userID = %d order by tvrage.releasetitle asc", $uid); + $sql = sprintf("select userseries.*, tvrage.releasetitle from userseries inner join (SELECT id, releasetitle, rageid FROM tvrage GROUP BY rageid) tvrage on tvrage.rageid = userseries.rageid where userID = %d order by tvrage.releasetitle asc", $uid); return $db->query($sql); } public function delShow($uid, $rageid) { $db = new DB(); - $db->queryExec(sprintf("DELETE from userseries where userID = %d and rageID = %d ", $uid, $rageid)); + $db->queryExec(sprintf("DELETE from userseries where userID = %d and rageid = %d ", $uid, $rageid)); } public function getShow($uid, $rageid) { $db = new DB(); - $sql = sprintf("select userseries.*, tvrage.releasetitle from userseries left outer join (SELECT ID, releasetitle, rageid FROM tvrage GROUP BY rageid) tvrage on tvrage.rageID = userseries.rageID where userseries.userID = %d and userseries.rageID = %d ", $uid, $rageid); + $sql = sprintf("select userseries.*, tvrage.releasetitle from userseries left outer join (SELECT id, releasetitle, rageid FROM tvrage GROUP BY rageid) tvrage on tvrage.rageid = userseries.rageid where userseries.userID = %d and userseries.rageid = %d ", $uid, $rageid); return $db->queryOneRow($sql); } @@ -42,7 +42,7 @@ class UserSeries public function delShowForSeries($sid) { $db = new DB(); - $db->queryExec(sprintf("DELETE from userseries where rageID = %d", $sid)); + $db->queryExec(sprintf("DELETE from userseries where rageid = %d", $sid)); } public function updateShow($uid, $rageid, $catid=array()) @@ -51,7 +51,7 @@ class UserSeries $catid = (!empty($catid)) ? $db->escapeString(implode('|', $catid)) : "null"; - $sql = sprintf("update userseries set categoryID = %s where userID = %d and rageID = %d", $catid, $uid, $rageid); + $sql = sprintf("update userseries set categoryid = %s where userID = %d and rageid = %d", $catid, $uid, $rageid); $db->queryExec($sql); } } \ No newline at end of file diff --git a/lib/copy_this/www/lib/util.php b/lib/copy_this/www/lib/util.php index 197b6b776..03e4c717c 100644 --- a/lib/copy_this/www/lib/util.php +++ b/lib/copy_this/www/lib/util.php @@ -428,7 +428,7 @@ class Utility public static function getCoverURL(array $options = []) { $defaults = [ - 'ID' => null, + 'id' => null, 'suffix' => '-cover.jpg', 'type' => '', ]; @@ -436,9 +436,9 @@ class Utility $fileSpecTemplate = '%s/%s%s'; $fileSpec = ''; - if (!empty($options['ID']) && in_array($options['type'], + if (!empty($options['id']) && in_array($options['type'], ['anime', 'audio', 'audiosample', 'book', 'console', 'games', 'movies', 'music', 'preview', 'sample', 'tvrage', 'video', 'xxx'])) { - $fileSpec = sprintf($fileSpecTemplate, $options['type'], $options['ID'], $options['suffix']); + $fileSpec = sprintf($fileSpecTemplate, $options['type'], $options['id'], $options['suffix']); $fileSpec = file_exists(NN_COVERS . $fileSpec) ? $fileSpec : sprintf($fileSpecTemplate, $options['type'], 'no', $options['suffix']); } diff --git a/lib/copy_this/www/pages/api.php b/lib/copy_this/www/pages/api.php index 265e1e6e6..12d07ffdd 100644 --- a/lib/copy_this/www/pages/api.php +++ b/lib/copy_this/www/pages/api.php @@ -76,7 +76,7 @@ $catExclusions = []; $maxRequests = 0; // Page is accessible only by the apikey, or logged in users. if ($users->isLoggedIn()) { - $uid = $page->userdata['ID']; + $uid = $page->userdata['id']; $apiKey = $page->userdata['rsstoken']; $catExclusions = $page->userdata['categoryexclusions']; $maxRequests = $page->userdata['apirequests']; @@ -92,7 +92,7 @@ if ($users->isLoggedIn()) { showApiError(100, 'Incorrect user credentials (wrong API key)'); } - $uid = $res['ID']; + $uid = $res['id']; $catExclusions = $users->getCategoryExclusion($uid); // // A hash of the users ip to record against the api hit @@ -138,7 +138,7 @@ switch ($function) { verifyEmptyParameter('q'); $maxAge = maxAge(); $users->addApiRequest($uid, $_SERVER['REQUEST_URI'], $hosthash); - $categoryID = categoryID(); + $categoryID = categoryid(); $limit = limit(); $offset = offset(); @@ -174,7 +174,7 @@ switch ($function) { $offset, limit(), (isset($_GET['q']) ? $_GET['q'] : ''), - categoryID(), + categoryid(), $maxAge ); @@ -195,7 +195,7 @@ switch ($function) { if (!$reldata) showApiError(300); - $nfo = $releases->getReleaseNfo($reldata["ID"], true); + $nfo = $releases->getReleaseNfo($reldata["id"], true); if (!$nfo) showApiError(300); @@ -262,7 +262,7 @@ switch ($function) { $reldata = $releases->getByGuid($_GET["id"]); if ($reldata) { - $ret = $rc->addComment($reldata["ID"], $reldata["gid"], $_GET["text"], $uid, $_SERVER['REMOTE_ADDR']); + $ret = $rc->addComment($reldata["id"], $reldata["gid"], $_GET["text"], $uid, $_SERVER['REMOTE_ADDR']); $content = "\n"; $content.= "\n"; @@ -376,13 +376,13 @@ switch ($function) { $offset, limit(), (isset($_GET['q']) ? $_GET['q'] : ''), - categoryID(), + categoryid(), $maxAge ); addCoverURL($relData, function ($release) { - return Utility::getCoverURL(['type' => 'movies', 'ID' => $release['imdbID']]); + return Utility::getCoverURL(['type' => 'movies', 'id' => $release['imdbid']]); } ); @@ -454,7 +454,7 @@ switch ($function) { // Check email isn't taken. $ret = $users->getByEmail($_GET['email']); - if (isset($ret['ID'])) { + if (isset($ret['id'])) { showApiError(105); } @@ -465,7 +465,7 @@ switch ($function) { // Register. $userDefault = $users->getDefaultRole(); $uid = $users->signup( - $username, $password, $_GET['email'], $_SERVER['REMOTE_ADDR'], $userDefault['ID'], "", $userDefault['defaultinvites'], "", false, false, false, true + $username, $password, $_GET['email'], $_SERVER['REMOTE_ADDR'], $userDefault['id'], "", $userDefault['defaultinvites'], "", false, false, false, true ); // Check if it succeeded. @@ -572,12 +572,12 @@ function maxAge() * Verify cat parameter. * @return array */ -function categoryID() +function categoryid() { $categoryID[] = -1; if (isset($_GET['cat'])) { $categoryIDs = $_GET['cat']; - // Append Web-DL category ID if HD present for SickBeard / NZBDrone compatibility. + // Append Web-DL category id if HD present for SickBeard / NZBDrone compatibility. if (strpos($_GET['cat'], (string)Category::CAT_TV_HD) !== false && strpos($_GET['cat'], (string)Category::CAT_TV_WEBDL) === false) { $categoryIDs .= (',' . Category::CAT_TV_WEBDL); @@ -665,8 +665,8 @@ function addLanguage(&$releases, DB $settings) { if ($releases && count($releases)) { foreach ($releases as $key => $release) { - if (isset($release['ID'])) { - $language = $settings->queryOneRow(sprintf('SELECT audiolanguage FROM releaseaudio WHERE releaseID = %d', $release['ID'])); + if (isset($release['id'])) { + $language = $settings->queryOneRow(sprintf('SELECT audiolanguage FROM releaseaudio WHERE releaseid = %d', $release['id'])); if ($language !== false) { $releases[$key]['searchname'] = $releases[$key]['searchname'] . ' ' . $language['audiolanguage']; } diff --git a/lib/copy_this/www/pages/browse.php b/lib/copy_this/www/pages/browse.php index e5876310f..b2ab4fe76 100644 --- a/lib/copy_this/www/pages/browse.php +++ b/lib/copy_this/www/pages/browse.php @@ -46,17 +46,17 @@ if ($category == -1 && $grp == "") { $cdata = $cat->getById($category); if ($cdata) { $page->smarty->assign('catname', $cdata["title"]); - if ($cdata['parentID'] == Category::CAT_PARENT_GAME || $cdata['ID'] == Category::CAT_PARENT_GAME) { + if ($cdata['parentID'] == Category::CAT_PARENT_GAME || $cdata['id'] == Category::CAT_PARENT_GAME) { $covgroup = 'console'; - } elseif ($cdata['parentID'] == Category::CAT_PARENT_MOVIE || $cdata['ID'] == Category::CAT_PARENT_MOVIE) { + } elseif ($cdata['parentID'] == Category::CAT_PARENT_MOVIE || $cdata['id'] == Category::CAT_PARENT_MOVIE) { $covgroup = 'movies'; - } elseif ($cdata['parentID'] == Category::CAT_PARENT_XXX || $cdata['ID'] == Category::CAT_PARENT_XXX) { + } elseif ($cdata['parentID'] == Category::CAT_PARENT_XXX || $cdata['id'] == Category::CAT_PARENT_XXX) { $covgroup = 'xxx'; - } elseif ($cdata['parentID'] == Category::CAT_PARENT_PC || $cdata['ID'] == Category::CAT_PC_GAMES) { + } elseif ($cdata['parentID'] == Category::CAT_PARENT_PC || $cdata['id'] == Category::CAT_PC_GAMES) { $covgroup = 'games'; - } elseif ($cdata['parentID'] == Category::CAT_PARENT_MUSIC || $cdata['ID'] == Category::CAT_PARENT_MUSIC) { + } elseif ($cdata['parentID'] == Category::CAT_PARENT_MUSIC || $cdata['id'] == Category::CAT_PARENT_MUSIC) { $covgroup = 'music'; - } elseif ($cdata['parentID'] == Category::CAT_PARENT_BOOK || $cdata['ID'] == Category::CAT_PARENT_BOOK) { + } elseif ($cdata['parentID'] == Category::CAT_PARENT_BOOK || $cdata['id'] == Category::CAT_PARENT_BOOK) { $covgroup = 'books'; } } else { diff --git a/lib/copy_this/www/pages/console.php b/lib/copy_this/www/pages/console.php index 810f9de07..743e43293 100644 --- a/lib/copy_this/www/pages/console.php +++ b/lib/copy_this/www/pages/console.php @@ -14,7 +14,7 @@ if (!$users->isLoggedIn()) $concats = $cat->getChildren(Category::CAT_PARENT_GAME); $ctmp = array(); foreach($concats as $ccat) { - $ctmp[$ccat['ID']] = $ccat; + $ctmp[$ccat['id']] = $ccat; } $category = Category::CAT_PARENT_GAME; if (isset($_REQUEST["t"]) && array_key_exists($_REQUEST['t'], $ctmp)) @@ -56,7 +56,7 @@ $page->smarty->assign('title', $title); $genres = $gen->getGenres(Genres::CONSOLE_TYPE, true, true); $tmpgnr = array(); foreach($genres as $gn) { - $tmpgnr[$gn['ID']] = $gn['title']; + $tmpgnr[$gn['id']] = $gn['title']; } $genre = (isset($_REQUEST['genre']) && array_key_exists($_REQUEST['genre'], $tmpgnr)) ? $_REQUEST['genre'] : ''; $page->smarty->assign('genres', $genres); diff --git a/lib/copy_this/www/pages/details.php b/lib/copy_this/www/pages/details.php index 59fe7c537..de7fbd90e 100644 --- a/lib/copy_this/www/pages/details.php +++ b/lib/copy_this/www/pages/details.php @@ -32,18 +32,18 @@ if (isset($_GET["id"])) if ($page->isPostBack()) $rc->addComment($data["id"], $data["gid"], $_POST["txtAddComment"], $users->currentUserId(), $_SERVER['REMOTE_ADDR']); - $nfo = $releases->getReleaseNfo($data["ID"], false); - $reVideo = $re->getVideo($data["ID"]); - $reAudio = $re->getAudio($data["ID"]); - $reSubs = $re->getSubs($data["ID"]); + $nfo = $releases->getReleaseNfo($data["id"], false); + $reVideo = $re->getVideo($data["id"]); + $reAudio = $re->getAudio($data["id"]); + $reSubs = $re->getSubs($data["id"]); $comments = $rc->getCommentsByGid($data["gid"]); $rage = ''; - if ($data["rageID"] != '') + if ($data["rageid"] != '') { $tvrage = new TvAnger(); - $rageinfo = $tvrage->getByRageID($data["rageID"]); + $rageinfo = $tvrage->getByRageID($data["rageid"]); if (count($rageinfo) > 0) { $seriesnames = $seriesdescription = $seriescountry = $seriesgenre = $seriesimg = $seriesid = array(); @@ -61,7 +61,7 @@ if (isset($_GET["id"])) if (!empty($r['imgdata'])) { $seriesimg[] = $r['imgdata']; - $seriesid[] = $r['ID']; + $seriesid[] = $r['id']; } } $rage = array( @@ -70,25 +70,25 @@ if (isset($_GET["id"])) 'country' => array_shift($seriescountry), 'genre' => array_shift($seriesgenre), 'imgdata' => array_shift($seriesimg), - 'ID'=>array_shift($seriesid) + 'id'=>array_shift($seriesid) ); } } $episodeArray = ''; - if ($data['episodeinfoID'] > 0) + if ($data['episodeinfoid'] > 0) { $episode = new Episode(); - $episodeArray = $episode->getEpisodeInfoByID($data['episodeinfoID']); + $episodeArray = $episode->getEpisodeInfoByID($data['episodeinfoid']); } $mov = ''; - if ($data['imdbID'] != '' && $data['imdbID'] != 0000000) { + if ($data['imdbid'] != '' && $data['imdbid'] != 0000000) { $movie = new Film(); - $mov = $movie->getMovieInfo($data['imdbID']); + $mov = $movie->getMovieInfo($data['imdbid']); $trakt = new TraktTv(); - $traktSummary = $trakt->traktMoviesummary('tt' . $data['imdbID'], true); + $traktSummary = $trakt->traktMoviesummary('tt' . $data['imdbid'], true); if ($traktSummary !== false && isset($traktSummary['trailer']) && $traktSummary['trailer'] !== '' && @@ -99,7 +99,7 @@ if (isset($_GET["id"])) 'https://www.youtube.com/v/' . $youtubeM[1] . '" type="application/x-shockwave-flash">'; } else { - $mov['trailer'] = imdb_trailers($data['imdbID']); + $mov['trailer'] = imdb_trailers($data['imdbid']); } if ($mov && isset($mov['title'])) { @@ -140,45 +140,45 @@ if (isset($_GET["id"])) } $mus = ''; - if ($data['musicinfoID'] != '') { + if ($data['musicinfoid'] != '') { require_once(WWW_DIR."/lib/music.php"); $music = new Musik(['Settings' => $page->settings]); - $mus = $music->getMusicInfo($data['musicinfoID']); + $mus = $music->getMusicInfo($data['musicinfoid']); } $book = ''; - if ($data['bookinfoID'] != '') { + if ($data['bookinfoid'] != '') { require_once(WWW_DIR."/lib/book.php"); $b = new Book(); - $book = $b->getBookInfo($data['bookinfoID']); + $book = $b->getBookInfo($data['bookinfoid']); } $con = ''; - if ($data['consoleinfoID'] != '') { + if ($data['consoleinfoid'] != '') { require_once(WWW_DIR."/lib/console.php"); $c = new Console(); - $con = $c->getConsoleInfo($data['consoleinfoID']); + $con = $c->getConsoleInfo($data['consoleinfoid']); } $AniDBAPIArray = ''; - if ($data["anidbID"] > 0) + if ($data["anidbid"] > 0) { $AniDB = new AniDB(['Settings' => $releases->pdo]); - $AniDBAPIArray = $AniDB->getAnimeInfo($data["anidbID"]); + $AniDBAPIArray = $AniDB->getAnimeInfo($data["anidbid"]); } $predbQuery = ''; - if ($data["preID"] > 0) + if ($data["preid"] > 0) { $PreDB = new PreDB(); - $predbQuery = $PreDB->getByID($data["preID"]); + $predbQuery = $PreDB->getByID($data["preid"]); } $prehash = new PreHash(); - $pre = $prehash->getForRelease($data["prehashID"]); + $pre = $prehash->getForRelease($data["prehashid"]); $rf = new ReleaseFiles; - $releasefiles = $rf->get($data["ID"]); + $releasefiles = $rf->get($data["id"]); $page->smarty->assign('releasefiles',$releasefiles); $page->smarty->assign('release',$data); diff --git a/lib/copy_this/www/pages/forgottenpassword.php b/lib/copy_this/www/pages/forgottenpassword.php index 1601a6bdd..0df73a111 100644 --- a/lib/copy_this/www/pages/forgottenpassword.php +++ b/lib/copy_this/www/pages/forgottenpassword.php @@ -26,9 +26,9 @@ switch($action) // // reset the password, inform the user, send out the email // - $users->updatePassResetGuid($ret["ID"], ""); + $users->updatePassResetGuid($ret["id"], ""); $newpass = $users->generatePassword(); - $users->updatePassword($ret["ID"], $newpass); + $users->updatePassword($ret["id"], $newpass); $to = $ret["email"]; $subject = $page->site->title." Password Reset"; @@ -66,7 +66,7 @@ switch($action) // Generate a forgottenpassword guid, store it in the user table // $guid = md5(uniqid()); - $users->updatePassResetGuid($ret["ID"], $guid); + $users->updatePassResetGuid($ret["id"], $guid); // // Send the email diff --git a/lib/copy_this/www/pages/games.php b/lib/copy_this/www/pages/games.php index 83b5e4aaa..8a416ade2 100644 --- a/lib/copy_this/www/pages/games.php +++ b/lib/copy_this/www/pages/games.php @@ -13,7 +13,7 @@ $gen = new Genres(); $concats = $cat->getChildren(Category::CAT_PARENT_PC); $ctmp = array(); foreach ($concats as $ccat) { - $ctmp[$ccat['ID']] = $ccat; + $ctmp[$ccat['id']] = $ccat; } $category = Category::CAT_PC_GAMES; if (isset($_REQUEST["t"]) && array_key_exists($_REQUEST['t'], $ctmp)) { @@ -55,7 +55,7 @@ $page->smarty->assign('title', $title); $genres = $gen->getGenres(Genres::GAME_TYPE, true); $tmpgnr = array(); foreach ($genres as $gn) { - $tmpgnr[$gn['ID']] = $gn['title']; + $tmpgnr[$gn['id']] = $gn['title']; } $genre = (isset($_REQUEST['genre']) && array_key_exists($_REQUEST['genre'], $tmpgnr)) ? $_REQUEST['genre'] : ''; $page->smarty->assign('genres', $genres); diff --git a/lib/copy_this/www/pages/getnzb.php b/lib/copy_this/www/pages/getnzb.php index f466181c6..91afd77f8 100644 --- a/lib/copy_this/www/pages/getnzb.php +++ b/lib/copy_this/www/pages/getnzb.php @@ -23,11 +23,11 @@ if ($users->isLoggedIn()) { $res = $users->getByIdAndRssToken($_GET["i"], $_GET["r"]); if (!$res) { header("X-DNZB-RCode: 401"); - header("X-DNZB-RText: Unauthorised, wrong user ID or rss key!"); + header("X-DNZB-RText: Unauthorised, wrong user id or rss key!"); $page->show403(); } } - $uid = $res["ID"]; + $uid = $res["id"]; $maxdls = $res["downloadrequests"]; } diff --git a/lib/copy_this/www/pages/login.php b/lib/copy_this/www/pages/login.php index 9a2c02902..b8bd69547 100644 --- a/lib/copy_this/www/pages/login.php +++ b/lib/copy_this/www/pages/login.php @@ -24,7 +24,7 @@ if ($page->isPostBack()) else if ($users->checkPassword($_POST["password"], $res["password"])) { $rememberMe = (isset($_POST['rememberme']) && $_POST['rememberme'] == 'on') ? 1 : 0; - $users->login($res["ID"], $_SERVER['REMOTE_ADDR'], $rememberMe); + $users->login($res["id"], $_SERVER['REMOTE_ADDR'], $rememberMe); if (isset($_POST["redirect"]) && $_POST["redirect"] != "") header("Location: ".$_POST["redirect"]); diff --git a/lib/copy_this/www/pages/movies.php b/lib/copy_this/www/pages/movies.php index 9e82214f1..7cf9f510a 100644 --- a/lib/copy_this/www/pages/movies.php +++ b/lib/copy_this/www/pages/movies.php @@ -12,7 +12,7 @@ if (!$users->isLoggedIn()) $moviecats = $cat->getChildren(Category::CAT_PARENT_MOVIE); $mtmp = array(); foreach($moviecats as $mcat) { - $mtmp[$mcat['ID']] = $mcat; + $mtmp[$mcat['id']] = $mcat; } $category = (isset($_GET["imdb"]) ? -1 : Category::CAT_PARENT_MOVIE); diff --git a/lib/copy_this/www/pages/music.php b/lib/copy_this/www/pages/music.php index e26f19ae6..6b18f5a24 100644 --- a/lib/copy_this/www/pages/music.php +++ b/lib/copy_this/www/pages/music.php @@ -14,7 +14,7 @@ $gen = new Genres(['Settings' => $page->settings]); $musiccats = $cat->getChildren(Category::CAT_PARENT_MUSIC); $mtmp = array(); foreach ($musiccats as $mcat) { - $mtmp[$mcat['ID']] = $mcat; + $mtmp[$mcat['id']] = $mcat; } $category = Category::CAT_PARENT_MUSIC; if (isset($_REQUEST['t']) && array_key_exists($_REQUEST['t'], $mtmp)) { diff --git a/lib/copy_this/www/pages/nfo.php b/lib/copy_this/www/pages/nfo.php index c236d8106..9c72b1eab 100644 --- a/lib/copy_this/www/pages/nfo.php +++ b/lib/copy_this/www/pages/nfo.php @@ -13,7 +13,7 @@ if (isset($_GET["id"])) { if (!$rel) $page->show404(); - $nfo = $releases->getReleaseNfo($rel['ID']); + $nfo = $releases->getReleaseNfo($rel['id']); $nfo['nfoUTF'] = cp437toUTF($nfo['nfo']); $page->smarty->assign('rel', $rel); diff --git a/lib/copy_this/www/pages/prehashinfo.php b/lib/copy_this/www/pages/prehashinfo.php index 9e6ec8a36..13522262b 100644 --- a/lib/copy_this/www/pages/prehashinfo.php +++ b/lib/copy_this/www/pages/prehashinfo.php @@ -20,7 +20,7 @@ require_once(WWW_DIR . '/../misc/update_scripts/nix_scripts/tmux/lib/functions.p * * Parameters: * ---------- - * reqid : The request ID + * reqid : The request id * group : The group name. * * Example URL: @@ -150,15 +150,15 @@ if (isset($_GET['type'])) { switch ($_GET['type']) { case 'r': - case 'requestID': + case 'requestid': if (isset($_GET['reqid']) && is_numeric($_GET['reqid']) && isset($_GET['group']) && is_string($_GET['group'])) { $db = new DB(); $preData = $db->query( sprintf(' SELECT p.* FROM prehash p - INNER JOIN groups g ON g.ID = p.groupID - WHERE requestID = %d + INNER JOIN groups g ON g.id = p.groupid + WHERE requestid = %d AND g.name = %s %s %s %s LIMIT %d @@ -198,7 +198,7 @@ if (isset($_GET['type'])) { if (isset($_GET['md5']) && strlen($_GET['title']) === 32) { $db = new DB(); $preData = $db->query( - sprintf('SELECT * FROM prehash p INNER JOIN predbhash ph ON ph.pre_id = p.ID WHERE MATCH(hashes) AGAINST (%s) %s %s %s LIMIT %d OFFSET %d', + sprintf('SELECT * FROM prehash p INNER JOIN predbhash ph ON ph.pre_id = p.id WHERE MATCH(hashes) AGAINST (%s) %s %s %s LIMIT %d OFFSET %d', $db->escapeString($_GET['md5']), $newer, $older, @@ -215,7 +215,7 @@ if (isset($_GET['type'])) { if (isset($_GET['sha1']) && strlen($_GET['sha1']) === 40) { $db = new DB(); $preData = $db->query( - sprintf('SELECT * FROM prehash p INNER JOIN predbhash ph ON ph.pre_id = p.ID WHERE MATCH(hashes) AGAINST (%s) %s %s %s LIMIT %d OFFSET %d', + sprintf('SELECT * FROM prehash p INNER JOIN predbhash ph ON ph.pre_id = p.id WHERE MATCH(hashes) AGAINST (%s) %s %s %s LIMIT %d OFFSET %d', $db->escapeString($_GET['sha1']), $newer, $older, @@ -253,7 +253,7 @@ if ($json === false) { foreach ($preData as $data) { echo 'getByEmail($_POST['email']); - if ($res && $res["ID"] != $userid) { + if ($res && $res["id"] != $userid) { $errorStr = "Sorry, the email is already in use."; } elseif ((empty($_POST['saburl']) && !empty($_POST['sabapikey'])) || (!empty($_POST['saburl']) && empty($_POST['sabapikey']))) { $errorStr = "Insert a SABnzdb URL and API key."; diff --git a/lib/copy_this/www/pages/register.php b/lib/copy_this/www/pages/register.php index f712eb7f6..be1b696ec 100644 --- a/lib/copy_this/www/pages/register.php +++ b/lib/copy_this/www/pages/register.php @@ -57,7 +57,7 @@ else { //get the default user role $userdefault = $users->getDefaultRole(); - $ret = $users->signup($username, $password, $email, $_SERVER['REMOTE_ADDR'], $userdefault['ID'], "", $userdefault['defaultinvites'], $invitecode, false, isset($_POST['recaptcha_challenge_field']) ? $_POST['recaptcha_challenge_field'] : null, isset($_POST['recaptcha_response_field']) ? $_POST['recaptcha_response_field'] : null); + $ret = $users->signup($username, $password, $email, $_SERVER['REMOTE_ADDR'], $userdefault['id'], "", $userdefault['defaultinvites'], $invitecode, false, isset($_POST['recaptcha_challenge_field']) ? $_POST['recaptcha_challenge_field'] : null, isset($_POST['recaptcha_response_field']) ? $_POST['recaptcha_response_field'] : null); if ($ret > 0) { $users->login($ret, $_SERVER['REMOTE_ADDR']); header("Location: " . WWW_TOP . "/"); diff --git a/lib/copy_this/www/pages/series.php b/lib/copy_this/www/pages/series.php index 500c68a83..34bd8603b 100644 --- a/lib/copy_this/www/pages/series.php +++ b/lib/copy_this/www/pages/series.php @@ -30,7 +30,7 @@ if (isset($_GET["id"]) && ctype_digit($_GET['id'])) { } elseif (!$rel) { $page->smarty->assign("nodata", "No releases for this series."); } else { - $myshows = $us->getShow($users->currentUserId(), $rage[0]['rageID']); + $myshows = $us->getShow($users->currentUserId(), $rage[0]['rageid']); // Sort releases by season, episode, date posted. $season = $episode = $posted = array(); diff --git a/lib/copy_this/www/pages/xxx.php b/lib/copy_this/www/pages/xxx.php index 9d7b5cd37..65cf90fe3 100644 --- a/lib/copy_this/www/pages/xxx.php +++ b/lib/copy_this/www/pages/xxx.php @@ -12,7 +12,7 @@ $cat = new Category(); $moviecats = $cat->getChildren(Category::CAT_PARENT_XXX); $mtmp = array(); foreach ($moviecats as $mcat) { - $mtmp[$mcat['ID']] = $mcat; + $mtmp[$mcat['id']] = $mcat; } $category = Category::CAT_PARENT_XXX; if (isset($_REQUEST['t']) && array_key_exists($_REQUEST['t'], $mtmp)) { diff --git a/lib/copy_this/www/populate/AniDB.php b/lib/copy_this/www/populate/AniDB.php index 66f0177ca..d41671e14 100644 --- a/lib/copy_this/www/populate/AniDB.php +++ b/lib/copy_this/www/populate/AniDB.php @@ -26,7 +26,7 @@ class PopulateAniDB public $pdo; /** - * The AniDB ID we are looking up + * The AniDB id we are looking up * @var bool */ private $anidbId; @@ -104,7 +104,7 @@ class PopulateAniDB /** * Checks for an existing anime title in anidb table * - * @param int $id The AniDB ID to be inserted + * @param int $id The AniDB id to be inserted * @param string $type The title type * @param string $lang The title language * @param string $title The title of the Anime @@ -132,7 +132,7 @@ class PopulateAniDB /** * Retrieves supplemental anime info from the AniDB API * - * @param int $id The AniDB ID to be inserted + * @param int $id The AniDB id to be inserted * @param string $type The title type * @param string $lang The title language * @param string $title The title of the Anime @@ -273,7 +273,7 @@ class PopulateAniDB /** * Inserts new anime info from AniDB to anidb table * - * @param int $id The AniDB ID to be inserted + * @param int $id The AniDB id to be inserted * @param string $type The title type * @param string $lang The title language * @param string $title The title of the Anime @@ -431,12 +431,12 @@ class PopulateAniDB true); exit; } elseif ($AniDBAPIArray === false && $this->echooutput) { - $this->pdo->log->doEcho($this->pdo->log->info("Anime ID: {$this->anidbId} not available for update yet."), + $this->pdo->log->doEcho($this->pdo->log->info("Anime id: {$this->anidbId} not available for update yet."), true); } else { $this->updateAniChildTables($AniDBAPIArray); if (NN_DEBUG) { - $this->pdo->log->doEcho($this->pdo->log->headerOver("Added/Updated AniDB ID: {$this->anidbId}"), + $this->pdo->log->doEcho($this->pdo->log->headerOver("Added/Updated AniDB id: {$this->anidbId}"), true); } } diff --git a/lib/copy_this/www/processing/ProcessReleases.php b/lib/copy_this/www/processing/ProcessReleases.php index 6f809765a..a59642ae0 100644 --- a/lib/copy_this/www/processing/ProcessReleases.php +++ b/lib/copy_this/www/processing/ProcessReleases.php @@ -157,7 +157,7 @@ class ProcessReleases if (!empty($groupName)) { $groupInfo = $this->groups->getByName($groupName); - $groupID = $groupInfo['ID']; + $groupID = $groupInfo['id']; } $processReleases = microtime(true); @@ -195,7 +195,7 @@ class ProcessReleases } else if ($this->processRequestIDs === 2) { $requestIDTime = time(); if ($this->echoCLI) { - $this->pdo->log->doEcho($this->pdo->log->header("Process Releases -> Request ID Threaded lookup.")); + $this->pdo->log->doEcho($this->pdo->log->header("Process Releases -> Request id Threaded lookup.")); } passthru("$PYTHON ${DIR}update_scripts/nix_scripts/tmux/python/requestid_threaded.py"); if ($this->echoCLI) { @@ -250,7 +250,7 @@ class ProcessReleases public function resetCategorize($where = '') { $this->pdo->queryExec( - sprintf('UPDATE releases SET categoryID = %d, iscategorized = 0 %s', \Category::CAT_MISC_OTHER, $where) + sprintf('UPDATE releases SET categoryid = %d, iscategorized = 0 %s', \Category::CAT_MISC_OTHER, $where) ); } @@ -267,13 +267,13 @@ class ProcessReleases { $cat = new \Categorize(['Settings' => $this->pdo]); $categorized = $total = 0; - $releases = $this->pdo->queryDirect(sprintf('SELECT ID, %s, groupID FROM releases %s', $type, $where)); + $releases = $this->pdo->queryDirect(sprintf('SELECT id, %s, groupid FROM releases %s', $type, $where)); if ($releases && $releases->rowCount()) { $total = $releases->rowCount(); foreach ($releases as $release) { - $catId = $cat->determineCategory($release['groupID'], $release[$type]); + $catId = $cat->determineCategory($release['groupid'], $release[$type]); $this->pdo->queryExec( - sprintf('UPDATE releases SET categoryID = %d, iscategorized = 1 WHERE ID = %d', $catId, $release['ID']) + sprintf('UPDATE releases SET categoryid = %d, iscategorized = 1 WHERE id = %d', $catId, $release['id']) ); $categorized++; if ($this->echoCLI) { @@ -448,7 +448,7 @@ class ProcessReleases AND filesize > %d', $group['cname'], self::COLLFC_SIZED, - $groupID['ID'], + $groupID['id'], $maxSizeSetting ) ); @@ -552,7 +552,7 @@ class ProcessReleases // A 1% variance in size is considered the same size when the subject and poster are the same $dupeCheck = $this->pdo->queryOneRow( sprintf(" - SELECT ID + SELECT id FROM releases WHERE name = %s AND fromname = %s @@ -586,7 +586,7 @@ class ProcessReleases $preMatch = $preDB->matchPre($cleanedName); if ($preMatch !== false) { $cleanedName = $preMatch['title']; - $preID = $preMatch['prehashID']; + $preID = $preMatch['prehashid']; $properName = true; } } @@ -596,15 +596,15 @@ class ProcessReleases 'name' => $cleanRelName, 'searchname' => $this->pdo->escapeString(utf8_encode($cleanedName)), 'totalpart' => $collection['totalfiles'], - 'groupID' => $collection['group_id'], + 'groupid' => $collection['group_id'], 'guid' => $this->pdo->escapeString($this->releases->createGUID($cleanRelName)), 'postdate' => $this->pdo->escapeString($collection['date']), 'fromname' => $fromName, 'size' => $collection['filesize'], - 'categoryID' => $categorize->determineCategory($collection['group_id'], $cleanedName), + 'categoryid' => $categorize->determineCategory($collection['group_id'], $cleanedName), 'isrenamed' => ($properName === true ? 1 : 0), 'reqidstatus' => ($isReqID === true ? 1 : 0), - 'prehashID' => ($preID === false ? 0 : $preID), + 'prehashid' => ($preID === false ? 0 : $preID), 'nzbstatus' => \NZB::NZB_NONE ] ); @@ -680,12 +680,12 @@ class ProcessReleases $releases = $this->pdo->queryDirect( sprintf(" SELECT CONCAT(COALESCE(cp.title,'') , CASE WHEN cp.title IS NULL THEN '' ELSE ' > ' END , c.title) AS title, - r.name, r.ID, r.guid + r.name, r.id, r.guid FROM releases r - INNER JOIN category c ON r.categoryID = c.ID - INNER JOIN category cp ON cp.ID = c.parentID + INNER JOIN category c ON r.categoryid = c.id + INNER JOIN category cp ON cp.id = c.parentID WHERE %s nzbstatus = 0", - (!empty($groupID) ? ' r.groupID = ' . $groupID . ' AND ' : ' ') + (!empty($groupID) ? ' r.groupid = ' . $groupID . ' AND ' : ' ') ) ); @@ -697,7 +697,7 @@ class ProcessReleases $this->nzb->initiateForWrite($groupID); foreach ($releases as $release) { - if ($this->nzb->writeNZBforReleaseId($release['ID'], $release['guid'], $release['name'], $release['title']) === true) { + if ($this->nzb->writeNZBforReleaseId($release['id'], $release['guid'], $release['name'], $release['title']) === true) { $nzbCount++; if ($this->echoCLI) { echo $this->pdo->log->primaryOver("Creating NZBs:\t" . $nzbCount . '/' . $total . "\r"); @@ -720,7 +720,7 @@ class ProcessReleases $deleteQuery = $this->pdo->queryExec( sprintf(' DELETE c FROM %s c - INNER JOIN releases r ON r.ID = c.releaseid + INNER JOIN releases r ON r.id = c.releaseid WHERE r.nzbstatus = %d AND c.filecheck = %d', $group['cname'], @@ -769,7 +769,7 @@ class ProcessReleases $this->pdo->log->doEcho( $this->pdo->log->header( sprintf( - "Process Releases -> Request ID %s lookup -- limit %s", + "Process Releases -> Request id %s lookup -- limit %s", ($local === true ? 'local' : 'web'), $limit ) @@ -830,7 +830,7 @@ class ProcessReleases } $this->categorizeRelease( $type, - (!empty($groupID) ? 'WHERE iscategorized = 0 AND groupID = ' . $groupID : 'WHERE iscategorized = 0') + (!empty($groupID) ? 'WHERE iscategorized = 0 AND groupid = ' . $groupID : 'WHERE iscategorized = 0') ); if ($this->echoCLI) { @@ -933,7 +933,7 @@ class ProcessReleases } $deleted = 0; - // Parts that somehow have no binaries. Don't delete parts currently inserting, by checking the max ID. + // Parts that somehow have no binaries. Don't delete parts currently inserting, by checking the max id. if (mt_rand(0, 100) <= 5) { $deleteQuery = $this->pdo->queryExec( sprintf( @@ -1074,20 +1074,20 @@ class ProcessReleases foreach ($groupIDs as $groupID) { $releases = $this->pdo->queryDirect( sprintf(" - SELECT r.guid, r.ID + SELECT r.guid, r.id FROM releases r - INNER JOIN groups g ON g.ID = r.groupID - WHERE r.groupID = %d + INNER JOIN groups g ON g.id = r.groupid + WHERE r.groupid = %d AND greatest(IFNULL(g.minsizetoformrelease, 0), %d) > 0 AND r.size < greatest(IFNULL(g.minsizetoformrelease, 0), %d)", - $groupID['ID'], + $groupID['id'], $minSizeSetting, $minSizeSetting ) ); if ($releases instanceof \Traversable) { foreach ($releases as $release) { - $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['ID']], $this->nzb, $this->releaseImage); + $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['id']], $this->nzb, $this->releaseImage); $minSizeDeleted++; } } @@ -1095,17 +1095,17 @@ class ProcessReleases if ($maxSizeSetting > 0) { $releases = $this->pdo->queryDirect( sprintf(' - SELECT ID, guid + SELECT id, guid FROM releases - WHERE groupID = %d + WHERE groupid = %d AND size > %d', - $groupID['ID'], + $groupID['id'], $maxSizeSetting ) ); if ($releases instanceof \Traversable) { foreach ($releases as $release) { - $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['ID']], $this->nzb, $this->releaseImage); + $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['id']], $this->nzb, $this->releaseImage); $maxSizeDeleted++; } } @@ -1113,20 +1113,20 @@ class ProcessReleases $releases = $this->pdo->queryDirect( sprintf(" - SELECT r.ID, r.guid + SELECT r.id, r.guid FROM releases r - INNER JOIN groups g ON g.ID = r.groupID - WHERE r.groupID = %d + INNER JOIN groups g ON g.id = r.groupid + WHERE r.groupid = %d AND greatest(IFNULL(g.minfilestoformrelease, 0), %d) > 0 AND r.totalpart < greatest(IFNULL(g.minfilestoformrelease, 0), %d)", - $groupID['ID'], + $groupID['id'], $minFilesSetting, $minFilesSetting ) ); if ($releases instanceof \Traversable) { foreach ($releases as $release) { - $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['ID']], $this->nzb, $this->releaseImage); + $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['id']], $this->nzb, $this->releaseImage); $minFilesDeleted++; } } @@ -1169,13 +1169,13 @@ class ProcessReleases if ($this->site->releaseretentiondays != 0) { $releases = $this->pdo->queryDirect( sprintf( - 'SELECT ID, guid FROM releases WHERE postdate < (NOW() - INTERVAL %d DAY)', + 'SELECT id, guid FROM releases WHERE postdate < (NOW() - INTERVAL %d DAY)', $this->site->releaseretentiondays ) ); if ($releases instanceof \Traversable) { foreach ($releases as $release) { - $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['ID']], $this->nzb, $this->releaseImage); + $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['id']], $this->nzb, $this->releaseImage); $retentionDeleted++; } } @@ -1185,13 +1185,13 @@ class ProcessReleases if ($this->site->deletepasswordedrelease == 1) { $releases = $this->pdo->queryDirect( sprintf( - 'SELECT ID, guid FROM releases WHERE passwordstatus = %d', + 'SELECT id, guid FROM releases WHERE passwordstatus = %d', \Releases::PASSWD_RAR ) ); if ($releases instanceof \Traversable) { foreach ($releases as $release) { - $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['ID']], $this->nzb, $this->releaseImage); + $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['id']], $this->nzb, $this->releaseImage); $passwordDeleted++; } } @@ -1201,13 +1201,13 @@ class ProcessReleases if ($this->site->deletepossiblerelease == 1) { $releases = $this->pdo->queryDirect( sprintf( - 'SELECT ID, guid FROM releases WHERE passwordstatus = %d', + 'SELECT id, guid FROM releases WHERE passwordstatus = %d', \Releases::PASSWD_POTENTIAL ) ); if ($releases instanceof \Traversable) { foreach ($releases as $release) { - $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['ID']], $this->nzb, $this->releaseImage); + $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['id']], $this->nzb, $this->releaseImage); $passwordDeleted++; } } @@ -1218,7 +1218,7 @@ class ProcessReleases do { $releases = $this->pdo->queryDirect( sprintf( - 'SELECT ID, guid FROM releases WHERE adddate > (NOW() - INTERVAL %d HOUR) GROUP BY name HAVING COUNT(name) > 1', + 'SELECT id, guid FROM releases WHERE adddate > (NOW() - INTERVAL %d HOUR) GROUP BY name HAVING COUNT(name) > 1', $this->crossPostTime ) ); @@ -1226,7 +1226,7 @@ class ProcessReleases if ($releases && $releases->rowCount()) { $total = $releases->rowCount(); foreach ($releases as $release) { - $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['ID']], $this->nzb, $this->releaseImage); + $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['id']], $this->nzb, $this->releaseImage); $duplicateDeleted++; } } @@ -1235,11 +1235,11 @@ class ProcessReleases if ($this->completion > 0) { $releases = $this->pdo->queryDirect( - sprintf('SELECT ID, guid FROM releases WHERE completion < %d AND completion > 0', $this->completion) + sprintf('SELECT id, guid FROM releases WHERE completion < %d AND completion > 0', $this->completion) ); if ($releases instanceof \Traversable) { foreach ($releases as $release) { - $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['ID']], $this->nzb, $this->releaseImage); + $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['id']], $this->nzb, $this->releaseImage); $completionDeleted++; } } @@ -1250,12 +1250,12 @@ class ProcessReleases if (count($disabledCategories) > 0) { foreach ($disabledCategories as $disabledCategory) { $releases = $this->pdo->queryDirect( - sprintf('SELECT ID, guid FROM releases WHERE categoryID = %d', $disabledCategory['ID']) + sprintf('SELECT id, guid FROM releases WHERE categoryid = %d', $disabledCategory['id']) ); if ($releases instanceof \Traversable) { foreach ($releases as $release) { $disabledCategoryDeleted++; - $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['ID']], $this->nzb, $this->releaseImage); + $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['id']], $this->nzb, $this->releaseImage); } } } @@ -1263,10 +1263,10 @@ class ProcessReleases // Delete smaller than category minimum sizes. $categories = $this->pdo->queryDirect(' - SELECT c.ID AS id, + SELECT c.id AS id, CASE WHEN c.minsizetoformrelease = 0 THEN cp.minsizetoformrelease ELSE c.minsizetoformrelease END AS minsize FROM category c - INNER JOIN category cp ON cp.ID = c.parentID + INNER JOIN category cp ON cp.id = c.parentID WHERE c.parentID IS NOT NULL' ); @@ -1275,17 +1275,17 @@ class ProcessReleases if ($category['minsize'] > 0) { $releases = $this->pdo->queryDirect( sprintf(' - SELECT r.ID, r.guid + SELECT r.id, r.guid FROM releases r - WHERE r.categoryID = %d + WHERE r.categoryid = %d AND r.size < %d', - $category['ID'], + $category['id'], $category['minsize'] ) ); if ($releases instanceof \Traversable) { foreach ($releases as $release) { - $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['ID']], $this->nzb, $this->releaseImage); + $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['id']], $this->nzb, $this->releaseImage); $categoryMinSizeDeleted++; } } @@ -1299,17 +1299,17 @@ class ProcessReleases foreach ($genrelist as $genre) { $releases = $this->pdo->queryDirect( sprintf(' - SELECT ID, guid + SELECT id, guid FROM releases - INNER JOIN (SELECT ID AS mid FROM musicinfo WHERE musicinfo.genreID = %d) mi - ON musicinfoID = mid', - $genre['ID'] + INNER JOIN (SELECT id AS mid FROM musicinfo WHERE musicinfo.genreID = %d) mi + ON musicinfoid = mid', + $genre['id'] ) ); if ($releases instanceof \Traversable) { foreach ($releases as $release) { $disabledGenreDeleted++; - $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['ID']], $this->nzb, $this->releaseImage); + $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['id']], $this->nzb, $this->releaseImage); } } } @@ -1319,9 +1319,9 @@ class ProcessReleases if ($this->site->miscotherretentionhours > 0) { $releases = $this->pdo->queryDirect( sprintf(' - SELECT ID, guid + SELECT id, guid FROM releases - WHERE categoryID = %d + WHERE categoryid = %d AND adddate <= NOW() - INTERVAL %d HOUR', \Category::CAT_MISC_OTHER, $this->site->miscotherretentionhours @@ -1329,7 +1329,7 @@ class ProcessReleases ); if ($releases instanceof \Traversable) { foreach ($releases as $release) { - $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['ID']], $this->nzb, $this->releaseImage); + $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['id']], $this->nzb, $this->releaseImage); $miscRetentionDeleted++; } } @@ -1339,9 +1339,9 @@ class ProcessReleases if ($this->site->mischashedretentionhours > 0) { $releases = $this->pdo->queryDirect( sprintf(' - SELECT ID, guid + SELECT id, guid FROM releases - WHERE categoryID = %d + WHERE categoryid = %d AND adddate <= NOW() - INTERVAL %d HOUR', \Category::CAT_MISC_HASHED, $this->site->mischashedretentionhours @@ -1349,7 +1349,7 @@ class ProcessReleases ); if ($releases instanceof \Traversable) { foreach ($releases as $release) { - $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['ID']], $this->nzb, $this->releaseImage); + $this->releases->deleteSingle(['g' => $release['guid'], 'i' => $release['id']], $this->nzb, $this->releaseImage); $miscHashedDeleted++; } } @@ -1409,11 +1409,11 @@ class ProcessReleases */ private function minMaxQueryFormulator($groupName, $difference) { - $minMaxId = $this->pdo->queryOneRow(sprintf('SELECT MIN(ID) AS min, MAX(ID) AS max FROM %s', $groupName)); + $minMaxId = $this->pdo->queryOneRow(sprintf('SELECT MIN(id) AS min, MAX(id) AS max FROM %s', $groupName)); if ($minMaxId === false) { $minMaxId = ''; } else { - $minMaxId = ' AND ID < ' . ((($minMaxId['max'] - $minMaxId['min']) >= $difference) ? ($minMaxId['max'] - $difference) : 1); + $minMaxId = ' AND id < ' . ((($minMaxId['max'] - $minMaxId['min']) >= $difference) ? ($minMaxId['max'] - $difference) : 1); } return $minMaxId; } @@ -1441,7 +1441,7 @@ class ProcessReleases GROUP BY b.collection_id, c.totalfiles, c.id HAVING COUNT(b.id) IN (c.totalfiles, c.totalfiles + 1) ) - r ON c.id = r.ID SET filecheck = %d', + r ON c.id = r.id SET filecheck = %d', $group['cname'], $group['cname'], $group['bname'], @@ -1478,7 +1478,7 @@ class ProcessReleases AND c.filecheck = %d %s GROUP BY c.id ) - r ON c.id = r.ID SET c.filecheck = %d', + r ON c.id = r.id SET c.filecheck = %d', $group['cname'], $group['cname'], $group['bname'], @@ -1520,7 +1520,7 @@ class ProcessReleases WHERE c.filecheck = %d AND b.partcheck = %d %s AND b.currentparts = b.totalparts GROUP BY b.id, b.totalparts) - r ON b.id = r.ID SET b.partcheck = %d', + r ON b.id = r.id SET b.partcheck = %d', $group['bname'], $group['bname'], $group['cname'], @@ -1538,7 +1538,7 @@ class ProcessReleases WHERE c.filecheck = %d AND b.partcheck = %d %s AND b.currentparts >= (b.totalparts + 1) GROUP BY b.id, b.totalparts) - r ON b.id = r.ID SET b.partcheck = %d', + r ON b.id = r.id SET b.partcheck = %d', $group['bname'], $group['bname'], $group['cname'], @@ -1570,7 +1570,7 @@ class ProcessReleases INNER JOIN %s b ON c.id = b.collection_id WHERE b.partcheck = 1 AND c.filecheck IN (%d, %d) %s GROUP BY b.collection_id, c.totalfiles, c.id HAVING COUNT(b.id) >= c.totalfiles) - r ON c.id = r.ID SET filecheck = %d', + r ON c.id = r.id SET filecheck = %d', $group['cname'], $group['cname'], $group['bname'], diff --git a/lib/copy_this/www/processing/post/AniDB.php b/lib/copy_this/www/processing/post/AniDB.php index d049b2605..8f196f7bf 100644 --- a/lib/copy_this/www/processing/post/AniDB.php +++ b/lib/copy_this/www/processing/post/AniDB.php @@ -10,7 +10,7 @@ require_once(WWW_DIR . "/lib/nzb.php"); class PostAniDB { const PROC_EXTFAIL = -1; // Release Anime title/episode # could not be extracted from searchname - const PROC_NOMATCH = -2; // AniDB ID was not found in anidb table using extracted title/episode # + const PROC_NOMATCH = -2; // AniDB id was not found in anidb table using extracted title/episode # const REGEX_NOFORN = 'English|Japanese|German|Danish|Flemish|Dutch|French|Swe(dish|sub)|Deutsch|Norwegian'; @@ -68,11 +68,11 @@ class PostAniDB { $results = $this->pdo->queryDirect( sprintf(' - SELECT searchname, ID + SELECT searchname, id FROM releases WHERE nzbstatus = %d AND anidbid IS NULL - AND categoryID = %d + AND categoryid = %d ORDER BY postdate DESC LIMIT %d', \NZB::NZB_ADDED, @@ -97,9 +97,9 @@ class PostAniDB sprintf(' UPDATE releases SET anidbid = %d - WHERE ID = %d', + WHERE id = %d', $this->status, - $release['ID'] + $release['id'] ) ); } @@ -237,7 +237,7 @@ class PostAniDB $type = 'Remote'; } else { echo PHP_EOL . - $this->pdo->log->info("This AniDB ID was not found to be accurate locally, but has been updated too recently to check AniDB.") . + $this->pdo->log->info("This AniDB id was not found to be accurate locally, but has been updated too recently to check AniDB.") . PHP_EOL; } } @@ -246,10 +246,10 @@ class PostAniDB $cleanArr['epno'], $updatedAni['episode_title'], $updatedAni['airdate'], - $release['ID']); + $release['id']); $this->pdo->log->doEcho( - $this->pdo->log->headerOver("Matched {$type} AniDB ID: ") . + $this->pdo->log->headerOver("Matched {$type} AniDB id: ") . $this->pdo->log->primary($anidbId['anidbid']) . $this->pdo->log->alternateOver(" Title: ") . $this->pdo->log->primary($anidbId['title']) . @@ -293,7 +293,7 @@ class PostAniDB UPDATE releases SET anidbid = %d, seriesfull = %s, season = 'S01', episode = %s, tvtitle = %s, tvairdate = %s - WHERE ID = %d", + WHERE id = %d", $anidbId, $this->pdo->escapeString('S01' . $epno), $this->pdo->escapeString($epno), diff --git a/lib/copy_this/www/templates/nntmux/scripts/jquery-1.9.1.js b/lib/copy_this/www/templates/nntmux/scripts/jquery-1.9.1.js index e2c203fe9..e0375b304 100644 --- a/lib/copy_this/www/templates/nntmux/scripts/jquery-1.9.1.js +++ b/lib/copy_this/www/templates/nntmux/scripts/jquery-1.9.1.js @@ -176,7 +176,7 @@ jQuery.fn = jQuery.prototype = { // nodes that are no longer in the document #6963 if ( elem && elem.parentNode ) { // Handle the case where IE and Opera return items - // by name instead of ID + // by name instead of id if ( elem.id !== match[2] ) { return rootjQuery.find( selector ); } @@ -1565,7 +1565,7 @@ function internalData( elem, name, data, pvt /* Internal Use Only */ ){ // attached directly to the object so GC can occur automatically cache = isNode ? jQuery.cache : elem, - // Only defining an ID for JS objects if its cache already exists allows + // Only defining an id for JS objects if its cache already exists allows // the code to shortcut on the same path as a DOM node with no cache id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; @@ -1576,7 +1576,7 @@ function internalData( elem, name, data, pvt /* Internal Use Only */ ){ } if ( !id ) { - // Only DOM nodes need a new unique ID for each element since their data + // Only DOM nodes need a new unique id for each element since their data // ends up in the global cache if ( isNode ) { elem[ internalKey ] = id = core_deletedIds.pop() || jQuery.guid++; @@ -2733,7 +2733,7 @@ jQuery.event = { selector = handleObjIn.selector; } - // Make sure that the handler has a unique ID, used to find/remove it later + // Make sure that the handler has a unique id, used to find/remove it later if ( !handler.guid ) { handler.guid = jQuery.guid++; } @@ -3778,7 +3778,7 @@ var i, ridentifier = new RegExp( "^" + identifier + "$" ), matchExpr = { - "ID": new RegExp( "^#(" + characterEncoding + ")" ), + "id": new RegExp( "^#(" + characterEncoding + ")" ), "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ), "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), @@ -3797,7 +3797,7 @@ var i, rnative = /^[^{]+\{\s*\[native code/, - // Easily-parseable/retrievable ID or TAG or CLASS selectors + // Easily-parseable/retrievable id or TAG or CLASS selectors rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, rinputs = /^(?:input|select|textarea|button)$/i, @@ -3912,7 +3912,7 @@ function Sizzle( selector, context, results, seed ) { // Shortcuts if ( (match = rquickExpr.exec( selector )) ) { - // Speed-up: Sizzle("#ID") + // Speed-up: Sizzle("#id") if ( (m = match[1]) ) { if ( nodeType === 9 ) { elem = context.getElementById( m ); @@ -3920,7 +3920,7 @@ function Sizzle( selector, context, results, seed ) { // nodes that are no longer in the document #6963 if ( elem && elem.parentNode ) { // Handle the case where IE, Opera, and Webkit return items - // by name instead of ID + // by name instead of id if ( elem.id === m ) { results.push( elem ); return results; @@ -3957,7 +3957,7 @@ function Sizzle( selector, context, results, seed ) { newSelector = nodeType === 9 && selector; // qSA works strangely on Element-rooted queries - // We can work around this by specifying an extra ID on the root + // We can work around this by specifying an extra id on the root // and working up from there (Thanks to Andrew Dupont for the technique) // IE 8 doesn't work on object elements if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { @@ -4057,7 +4057,7 @@ setDocument = Sizzle.setDocument = function( node ) { }); // Check if getElementById returns elements by name - // Check if getElementsByName privileges form controls or returns elements by ID + // Check if getElementsByName privileges form controls or returns elements by id support.getByName = assert(function( div ) { // Inject content div.id = expando + 0; @@ -4094,9 +4094,9 @@ setDocument = Sizzle.setDocument = function( node ) { } }; - // ID find and filter + // id find and filter if ( support.getIdNotName ) { - Expr.find["ID"] = function( id, context ) { + Expr.find["id"] = function( id, context ) { if ( typeof context.getElementById !== strundefined && !documentIsXML ) { var m = context.getElementById( id ); // Check parentNode to catch when Blackberry 4.6 returns @@ -4104,14 +4104,14 @@ setDocument = Sizzle.setDocument = function( node ) { return m && m.parentNode ? [m] : []; } }; - Expr.filter["ID"] = function( id ) { + Expr.filter["id"] = function( id ) { var attrId = id.replace( runescape, funescape ); return function( elem ) { return elem.getAttribute("id") === attrId; }; }; } else { - Expr.find["ID"] = function( id, context ) { + Expr.find["id"] = function( id, context ) { if ( typeof context.getElementById !== strundefined && !documentIsXML ) { var m = context.getElementById( id ); @@ -4122,7 +4122,7 @@ setDocument = Sizzle.setDocument = function( node ) { []; } }; - Expr.filter["ID"] = function( id ) { + Expr.filter["id"] = function( id ) { var attrId = id.replace( runescape, funescape ); return function( elem ) { var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); @@ -5463,13 +5463,13 @@ function select( selector, context, results, seed ) { // Try to minimize operations if there is only one group if ( match.length === 1 ) { - // Take a shortcut and set the context if the root selector is an ID + // Take a shortcut and set the context if the root selector is an id tokens = match[0] = match[0].slice( 0 ); - if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && + if ( tokens.length > 2 && (token = tokens[0]).type === "id" && context.nodeType === 9 && !documentIsXML && Expr.relative[ tokens[1].type ] ) { - context = Expr.find["ID"]( token.matches[0].replace( runescape, funescape ), context )[0]; + context = Expr.find["id"]( token.matches[0].replace( runescape, funescape ), context )[0]; if ( !context ) { return results; } diff --git a/lib/copy_this/www/templates/nntmux/views/admin/ajax_release-edit.tpl b/lib/copy_this/www/templates/nntmux/views/admin/ajax_release-edit.tpl index 828ed72b5..8711069a6 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/ajax_release-edit.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/ajax_release-edit.tpl @@ -37,7 +37,7 @@ : - {html_options id="category" name=category options=$catlist selected=$release.categoryID} + {html_options id="category" name=category options=$catlist selected=$release.categoryid} @@ -49,16 +49,16 @@ - : + : - + - : + : - + @@ -86,7 +86,7 @@ : - + diff --git a/lib/copy_this/www/templates/nntmux/views/admin/book-edit.tpl b/lib/copy_this/www/templates/nntmux/views/admin/book-edit.tpl index e019ee145..417958379 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/book-edit.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/book-edit.tpl @@ -1,9 +1,9 @@ - +

{$page->title}

- + @@ -54,7 +54,7 @@ diff --git a/lib/copy_this/www/templates/nntmux/views/admin/book-list.tpl b/lib/copy_this/www/templates/nntmux/views/admin/book-list.tpl index b40c454da..a83c0d369 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/book-list.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/book-list.tpl @@ -1,4 +1,4 @@ -

{$page->title}

+

{$page->title}

{if $booklist} {$pager} @@ -6,16 +6,16 @@
{if $book.cover == 1} - + {/if}
- + - + {foreach from=$booklist item=book} - - + + diff --git a/lib/copy_this/www/templates/nntmux/views/admin/category-edit.tpl b/lib/copy_this/www/templates/nntmux/views/admin/category-edit.tpl index 370ba6301..e7e2e89b3 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/category-edit.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/category-edit.tpl @@ -1,4 +1,4 @@ - +

{$page->title}

{if $error != ''} @@ -12,7 +12,7 @@ diff --git a/lib/copy_this/www/templates/nntmux/views/admin/category-list.tpl b/lib/copy_this/www/templates/nntmux/views/admin/category-list.tpl index 2c9eee7e3..55018ba72 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/category-list.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/category-list.tpl @@ -1,4 +1,4 @@ - +

{$page->title}

@@ -16,11 +16,11 @@

- + {foreach from=$categorylist item=category} - - + + {/foreach} diff --git a/lib/copy_this/www/templates/nntmux/views/admin/console-edit.tpl b/lib/copy_this/www/templates/nntmux/views/admin/console-edit.tpl index 5ae2c63bb..ba6827608 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/console-edit.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/console-edit.tpl @@ -1,9 +1,9 @@ - +

{$page->title}

- +
IDid Title Author Created
{$book.ID}{$book.title}{$book.id}{$book.title} {$book.author} {$book.createddate|date_format}
Title: - + {$category.title}
active disable preview
{$category.ID}{$category.title}{$category.id}{$category.title} {if $category.parentID != null} {$category.parentName} diff --git a/lib/copy_this/www/templates/nntmux/views/admin/comments-list.tpl b/lib/copy_this/www/templates/nntmux/views/admin/comments-list.tpl index 47af5e655..9e53f5e0d 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/comments-list.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/comments-list.tpl @@ -26,7 +26,7 @@ {$comment.host} {if $comment.guid != ""}view | {/if} - delete + delete
@@ -68,7 +68,7 @@ @@ -79,7 +79,7 @@ diff --git a/lib/copy_this/www/templates/nntmux/views/admin/console-list.tpl b/lib/copy_this/www/templates/nntmux/views/admin/console-list.tpl index 6853c7b40..255f79139 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/console-list.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/console-list.tpl @@ -1,4 +1,4 @@ -

{$page->title}

+

{$page->title}

{if $consolelist} {$pager} @@ -6,16 +6,16 @@
{if $console.cover == 1} - + {/if}
- + - + {foreach from=$consolelist item=console} - - + + diff --git a/lib/copy_this/www/templates/nntmux/views/admin/group-edit.tpl b/lib/copy_this/www/templates/nntmux/views/admin/group-edit.tpl index dbe2b9d30..ccaf0b643 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/group-edit.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/group-edit.tpl @@ -4,7 +4,7 @@ @@ -37,14 +37,14 @@ - + - + {foreach from=$grouplist item=group} - + - - + + - {/foreach} diff --git a/lib/copy_this/www/templates/nntmux/views/admin/menu-edit.tpl b/lib/copy_this/www/templates/nntmux/views/admin/menu-edit.tpl index 77fc59033..8c1a4faa4 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/menu-edit.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/menu-edit.tpl @@ -1,4 +1,4 @@ - +

{$page->title}

@@ -8,7 +8,7 @@ diff --git a/lib/copy_this/www/templates/nntmux/views/admin/menu-list.tpl b/lib/copy_this/www/templates/nntmux/views/admin/menu-list.tpl index 03f52cded..004bfc932 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/menu-list.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/menu-list.tpl @@ -1,4 +1,4 @@ -

{$page->title}

+

{$page->title}

{if $menulist} @@ -13,16 +13,16 @@ - + {foreach from=$menulist item=menu} - + - + {/foreach} diff --git a/lib/copy_this/www/templates/nntmux/views/admin/movie-add.tpl b/lib/copy_this/www/templates/nntmux/views/admin/movie-add.tpl index a2d8683c9..f7e0b9537 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/movie-add.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/movie-add.tpl @@ -1,4 +1,4 @@ - +

{$page->title}

@@ -12,7 +12,7 @@ - + diff --git a/lib/copy_this/www/templates/nntmux/views/admin/movie-edit.tpl b/lib/copy_this/www/templates/nntmux/views/admin/movie-edit.tpl index 390752360..526f9b5a5 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/movie-edit.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/movie-edit.tpl @@ -3,17 +3,17 @@ - +
IDid Title Platform Created
{$console.ID}{$console.title}{$console.id}{$console.title} {$console.platform} {$console.createddate|date_format}
Name: - +
Changing the name to an invalid group will break things.
The oldest record number for the group.
The newest record number for the group.
diff --git a/lib/copy_this/www/templates/nntmux/views/admin/group-list.tpl b/lib/copy_this/www/templates/nntmux/views/admin/group-list.tpl index 89fb291ba..fe9ea07a2 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/group-list.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/group-list.tpl @@ -38,24 +38,24 @@
options
- {$group.name|replace:"alt.binaries":"a.b"} + {$group.name|replace:"alt.binaries":"a.b"}
{$group.description}
{$group.first_record_postdate}
{$group.first_record_postdate|timeago}
{$group.last_record_postdate}
{$group.last_record_postdate|timeago}
{$group.last_updated|timeago} ago{if $group.active=="1"}Deactivate{else}Activate{/if}{if $group.backfill=="1"}Deactivate{else}Activate{/if}{if $group.active=="1"}Deactivate{else}Activate{/if}{if $group.backfill=="1"}Deactivate{else}Activate{/if} {$group.num_releases} {if $group.minfilestoformrelease==""}n/a{else}{$group.minfilestoformrelease}{/if} {if $group.minsizetoformrelease==""}n/a{else}{$group.minsizetoformrelease|fsize_format:"MB"}{/if} {$group.backfill_target} - Reset | - Delete | - Purge + + Reset | + Delete | + Purge
: - +
new window options
{$menu.title|escape:"htmlall"}{$menu.title|escape:"htmlall"} {$menu.href} {$menu.tooltip} {if $menu.role == 0}Guests{elseif $menu.role == 1}Users{elseif $menu.role == 2}Admin{else}Other{/if} {$menu.ordinal} {if $menu.newwindow == 1}Yes{else}No{/if}deletedelete
::
- - + + - + @@ -85,7 +85,7 @@ @@ -95,7 +95,7 @@ diff --git a/lib/copy_this/www/templates/nntmux/views/admin/movie-list.tpl b/lib/copy_this/www/templates/nntmux/views/admin/movie-list.tpl index d39eaa36c..dd02a1528 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/movie-list.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/movie-list.tpl @@ -1,4 +1,4 @@ -

{$page->title}

+

{$page->title}

{if $movielist} @@ -19,26 +19,26 @@
:{$movie.imdbID}:{$movie.imdbid}
:: {$movie.tmdbID}
{if $movie.cover == 1} - + {/if}
{if $movie.backdrop == 1} - + {/if}
- - + + - + {foreach from=$movielist item=movie} - + - + {/foreach} diff --git a/lib/copy_this/www/templates/nntmux/views/admin/music-edit.tpl b/lib/copy_this/www/templates/nntmux/views/admin/music-edit.tpl index b3d72b0d1..985c0fc8b 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/music-edit.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/music-edit.tpl @@ -1,9 +1,9 @@ - +

{$page->title}

- +
IMDB IDTMDb IDIMDB idTMDb id Title Cover Backdrop Created options
{$movie.imdbID}{$movie.imdbid} {$movie.tmdbID}{$movie.title} ({$movie.year}){$movie.title} ({$movie.year}) {if $movie.cover == "1"}Yes{else}No{/if} {if $movie.backdrop == "1"}Yes{else}No{/if} {$movie.createddate|date_format} - update | - delete + update | + delete
@@ -68,7 +68,7 @@ @@ -87,7 +87,7 @@ diff --git a/lib/copy_this/www/templates/nntmux/views/admin/music-list.tpl b/lib/copy_this/www/templates/nntmux/views/admin/music-list.tpl index d674d9bca..1d80c484a 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/music-list.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/music-list.tpl @@ -1,4 +1,4 @@ -

{$page->title}

+

{$page->title}

{if $musiclist} {$pager} @@ -6,16 +6,16 @@
{if $music.cover == 1} - + {/if}
- + - + {foreach from=$musiclist item=music} - - + + diff --git a/lib/copy_this/www/templates/nntmux/views/admin/nzb-export.tpl b/lib/copy_this/www/templates/nntmux/views/admin/nzb-export.tpl index ef359caa7..97e2a90aa 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/nzb-export.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/nzb-export.tpl @@ -1,4 +1,4 @@ - +

{$page->title}

@@ -43,9 +43,9 @@ If you are exporting a large number of nzb files, run this script from the comma

- + diff --git a/lib/copy_this/www/templates/nntmux/views/admin/preview-list.tpl b/lib/copy_this/www/templates/nntmux/views/admin/preview-list.tpl index 7bff6329c..bf1233800 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/preview-list.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/preview-list.tpl @@ -4,9 +4,9 @@ @@ -23,15 +23,15 @@ - + {foreach from=$releaselist item=release} - + {/foreach} diff --git a/lib/copy_this/www/templates/nntmux/views/admin/rage-edit.tpl b/lib/copy_this/www/templates/nntmux/views/admin/rage-edit.tpl index 271c3da53..bfc1a009e 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/rage-edit.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/rage-edit.tpl @@ -1,7 +1,7 @@ - +

{$page->title}

-Update from TV Rage +Update from TV Rage

@@ -12,10 +12,10 @@
IDid Title Artist Created
{$music.ID}{$music.title} ({$music.year}){$music.id}{$music.title} ({$music.year}) {$music.artist} {$music.createddate|date_format}
:: - {html_options id="categoryID" name='categoryID' options=$catlist selected=$cat} + {html_options id="categoryid" name='categoryid' options=$catlist selected=$cat}
Posted to this category
preview options

- {$release.searchname|escape:"htmlall"|wordwrap:75:"\n":true} + {$release.searchname|escape:"htmlall"|wordwrap:75:"\n":true}
- + @@ -55,7 +55,7 @@ - + {foreach from=$tvragelist item=tvrage} - - + + - + {/foreach} diff --git a/lib/copy_this/www/templates/nntmux/views/admin/regex-edit.tpl b/lib/copy_this/www/templates/nntmux/views/admin/regex-edit.tpl index f62f450d0..b7f16e775 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/regex-edit.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/regex-edit.tpl @@ -1,7 +1,7 @@ - +

{$page->title}

-{if $regex.ID > 0 && $regex.ID < 100000 && $site->reqidurl != ""} +{if $regex.id > 0 && $regex.id < 100000 && $site->reqidurl != ""}
Warning: Editing system regex, these changes will be overwritten next update releases.
{/if} @@ -17,7 +17,7 @@ @@ -30,7 +30,7 @@
The regex to be applied.
Regex requires at least 1 named capturing group in the form of (?P<name>) to work.
If the subjects contains the number of parts (ie [1/10]) then it is wise to also use (?P<parts>) to match the parts. -
+ @@ -38,15 +38,15 @@ @@ -54,7 +54,7 @@ @@ -62,7 +62,7 @@ diff --git a/lib/copy_this/www/templates/nntmux/views/admin/regex-list.tpl b/lib/copy_this/www/templates/nntmux/views/admin/regex-list.tpl index 4d651cdc8..63a2f3e6c 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/regex-list.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/regex-list.tpl @@ -1,4 +1,4 @@ - +

{$page->title}

@@ -29,21 +29,21 @@

- + {foreach from=$regexlist item=regex} - - + + - - + - + {/foreach} diff --git a/lib/copy_this/www/templates/nntmux/views/admin/regex-submit.tpl b/lib/copy_this/www/templates/nntmux/views/admin/regex-submit.tpl index 83a793d85..76e6b8c53 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/regex-submit.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/regex-submit.tpl @@ -1,7 +1,7 @@ - +

{$page->title}

-

Use this feature to submit any regex you have added locally to newznab. We'll have a look at integrating them into the master list. No data other than regex's with an ID greater than 10000 will be sent.

+

Use this feature to submit any regex you have added locally to newznab. We'll have a look at integrating them into the master list. No data other than regex's with an id greater than 10000 will be sent.

{if $upload_status eq 'OK'}
diff --git a/lib/copy_this/www/templates/nntmux/views/admin/regex-test.tpl b/lib/copy_this/www/templates/nntmux/views/admin/regex-test.tpl index e955b6e28..63e58ac77 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/regex-test.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/regex-test.tpl @@ -1,4 +1,4 @@ - +

{$page->title}

{if $error != ''} @@ -14,7 +14,7 @@
@@ -69,14 +69,14 @@ - - + + {/if} - + - + {/foreach} @@ -134,12 +134,12 @@ {foreach from=$topdownloads item=result} + {if $isadmin}[Edit]{/if} {/foreach} - +
:: - - + +
The numeric TVRage Id.
: {if $rage.imgdata != ""} - + {/if}
Shown in the TV series view page.
@@ -81,7 +81,7 @@ function doDelete() { if (confirm('Are you sure?')) { - window.location = "rage-delete.php?id={$rage.ID}&from={$smarty.get.from}"; + window.location = "rage-delete.php?id={$rage.id}&from={$smarty.get.from}"; } } \ No newline at end of file diff --git a/lib/copy_this/www/templates/nntmux/views/admin/rage-list.tpl b/lib/copy_this/www/templates/nntmux/views/admin/rage-list.tpl index 12948341e..1fd3031bc 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/rage-list.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/rage-list.tpl @@ -1,4 +1,4 @@ -

{$page->title}

+

{$page->title}

{if $tvragelist} @@ -24,13 +24,13 @@
date options
{$tvrage.rageID}{$tvrage.releasetitle|escape:"htmlall"}{$tvrage.rageid}{$tvrage.releasetitle|escape:"htmlall"} {$tvrage.createddate|date_format}delete | removedelete | remove
Group: - +
The full name of a valid newsgroup. This value can be a regular expression. Use .* to apply regex to all newsgroups.
Description: -
A description for this regex
+
A description for this regex
: - {html_options id="category" name=category options=$catlist selected=$regex.categoryID} -
If this regex indicates the release category then supply it here. If left blank the standard method of determining the category will apply.
+ {html_options id="category" name=category options=$catlist selected=$regex.categoryid} +
If this regex indicates the release category then supply it here. If left blank the standard method of determining the category will apply.
Ordinal: -
The zero-based order in which the regex should be applied.
+
The zero-based order in which the regex should be applied.
: {html_radios id="status" name='status' values=$status_ids output=$status_names selected=$regex.status separator='
'} -
Only active regexes are applied during the release process.
+
Only active regexes are applied during the release process.
Order Options
{$regex.ID}
{$regex.id} {if $regex.groupname==""}all{else}{$regex.groupname|replace:"alt.binaries":"a.b"}{/if}{$regex.regex|escape:html}
+
{$regex.regex|escape:html}
{$regex.description}
{$regex.poster}{if $regex.categoryID!=""}{$regex.categoryTitle}{/if}{if $regex.categoryid!=""}{$regex.categoryTitle}{/if} {if $regex.status==1}active{else}disabled{/if} {$regex.num_releases} {$regex.max_releasedate} {$regex.ordinal} up | downdelete{if $regex.groupname != ""} | test{/if}delete{if $regex.groupname != ""} | test{/if}
or - {html_options values=$gid output=$gnames selected=$groupID} poster Bin Count Bin SizeRegex IDReq IDRegex idReq id Group Age
@@ -87,8 +87,8 @@ - - + + @@ -114,7 +114,7 @@ diff --git a/lib/copy_this/www/templates/nntmux/views/admin/release-edit.tpl b/lib/copy_this/www/templates/nntmux/views/admin/release-edit.tpl index 053bacdf9..6f4f32260 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/release-edit.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/release-edit.tpl @@ -10,7 +10,7 @@ @@ -41,7 +41,7 @@ @@ -60,16 +60,16 @@ - + - + @@ -102,16 +102,16 @@ - + - + @@ -123,9 +123,9 @@ - + diff --git a/lib/copy_this/www/templates/nntmux/views/admin/release-list.tpl b/lib/copy_this/www/templates/nntmux/views/admin/release-list.tpl index 96b81d78e..326cf67c5 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/release-list.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/release-list.tpl @@ -1,4 +1,4 @@ -

{$page->title}

+

{$page->title}

{if $releaselist} {$pager} @@ -15,17 +15,17 @@ - + {foreach from=$releaselist item=release} - + - + {/foreach} 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 index e29f45d8d..6587ae2b5 100644 --- 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 @@ -18,7 +18,7 @@ {if $data}
{$match.bininfo[0].fromname|escape:"htmlall"} {$match.bincount}{if $match.reltotalparts != ''}/{$match.reltotalparts}{/if} {$match.totalsize|fsize_format:"MB"}{$match.bininfo[0].regexID}{$match.reqID}{$match.bininfo[0].regexid}{$match.reqid} {$match.bininfo[0].groupname|replace:"alt.binaries":"a.b"} {$match.bininfo[0].date|timeago}
or - {html_options values=$gid output=$gnames selected=$groupID}
: - +
: - {html_options id="category" name=category options=$catlist selected=$release.categoryID} + {html_options id="category" name=category options=$catlist selected=$release.categoryid}
:: - +
:: - +
:: - +
:: - +
Regex ID:Regex id: - {$release.regexID} + {$release.regexid}
grabs options
{$release.searchname|escape:"htmlall"|wordwrap:75:"\n":true}{$release.searchname|escape:"htmlall"|wordwrap:75:"\n":true} {$release.category_name} {$release.size|fsize_format:"MB"} {$release.totalpart} {$release.postdate|date_format} {$release.adddate|date_format} {$release.grabs}deletedelete
- + diff --git a/lib/copy_this/www/templates/nntmux/views/admin/role-edit.tpl b/lib/copy_this/www/templates/nntmux/views/admin/role-edit.tpl index 537d773d9..c0ed1e6cb 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/role-edit.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/role-edit.tpl @@ -1,4 +1,4 @@ - +

{$page->title}

@@ -8,8 +8,8 @@ @@ -61,7 +61,7 @@ -{if $role.ID != ''} +{if $role.id != ''} - + diff --git a/lib/copy_this/www/templates/nntmux/views/admin/site-stats.tpl b/lib/copy_this/www/templates/nntmux/views/admin/site-stats.tpl index 630b33577..a66ea97df 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/site-stats.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/site-stats.tpl @@ -1,4 +1,4 @@ - +

{$page->title}

{if $topgrabs|count > 0} @@ -12,11 +12,11 @@ {foreach from=$topgrabs item=result} - + {/foreach} - +
Release IDRelease id Usenet Subject Old Search Name New Search Name
Name: - - {if $role.ID != '' && $role.ID < 4}{$role.name}{else}
The name of the role
{/if} + + {if $role.id != '' && $role.id < 4}{$role.name}{else}
The name of the role
{/if}
Is Default Role: diff --git a/lib/copy_this/www/templates/nntmux/views/admin/role-list.tpl b/lib/copy_this/www/templates/nntmux/views/admin/role-list.tpl index ded17b254..bff3a392d 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/role-list.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/role-list.tpl @@ -1,4 +1,4 @@ - +

{$page->title}

@@ -15,10 +15,10 @@ - + {foreach from=$userroles item=role} - + @@ -26,7 +26,7 @@ - + {/foreach} diff --git a/lib/copy_this/www/templates/nntmux/views/admin/sharing.tpl b/lib/copy_this/www/templates/nntmux/views/admin/sharing.tpl index a4a98ee94..20b30931d 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/sharing.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/sharing.tpl @@ -162,7 +162,7 @@
options
{$role.name}{$role.name} {$role.apirequests} {$role.downloadrequests} {$role.defaultinvites}{if $role.canpre == 1}Yes{else}No{/if} {if $role.hideads == 1}Yes{else}No{/if} {if $role.isdefault=="1"}Yes{else}No{/if}edit {if $role.ID>"3"}delete{/if}edit {if $role.id>"3"}delete{/if}
- + @@ -171,21 +171,21 @@ {foreach from=$sites item=site} - - + + - {/foreach} diff --git a/lib/copy_this/www/templates/nntmux/views/admin/site-edit.tpl b/lib/copy_this/www/templates/nntmux/views/admin/site-edit.tpl index ddd8d81fd..fd66143cc 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/site-edit.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/site-edit.tpl @@ -1194,14 +1194,14 @@ - + @@ -1210,7 +1210,7 @@
IDid Name First seen Last seen
{$site.ID}
{$site.id} {$site.site_name} {$site.first_time|timeago} {$site.last_time|timeago} + {if $site.enabled=="1"} - + {else} - + {/if} {$site.comments} - +
{html_options style="width:180px;" id="lookup_reqids" name='lookup_reqids' values=$lookup_reqids_ids output=$lookup_reqids_names selected=$fsite->lookup_reqids} -
Whether to attempt to lookup Request IDs using the Request ID link below. This will rename your releases to proper PreDB names.
+
Whether to attempt to lookup Request IDs using the Request id link below. This will rename your releases to proper PreDB names.
-
Optional URL to lookup Request IDs. [REQUEST_ID] gets replaced with the request ID from the +
Optional URL to lookup Request IDs. [REQUEST_ID] gets replaced with the request id from the post. [GROUP_NM] Gets replaced with the group name.
-
The maximum hours after a release is added to recheck for a Request ID match.
+
The maximum hours after a release is added to recheck for a Request id match.
@@ -1506,10 +1506,10 @@
-
The number of threads for local Request ID processing. +
The number of threads for local Request id processing.
{$result.username}{$result.username} {$result.grabs}


@@ -73,19 +73,19 @@ {foreach from=$usersbyhosthash item=result}
{$result.hosthash} {assign var="usersplits" value=","|explode:$result.user_string} {foreach from=$usersplits item=usersplit} {$usersplit} - {/foreach} + {/foreach} {assign var="usernsplits" value=","|explode:$result.user_names} {foreach from=$usernsplits item=usernsplit} {$usernsplit} - {/foreach} + {/foreach}
{$result.searchname|escape:"htmlall"|replace:".":" "} - {if $isadmin}[Edit]{/if} {$result.grabs} {$result.adddate|timeago}


@@ -159,7 +159,7 @@ {$result.count} {/foreach} - +

@@ -181,6 +181,6 @@ {$result.adddate|timeago} {/foreach} - + {/if} \ No newline at end of file diff --git a/lib/copy_this/www/templates/nntmux/views/admin/spotnab-edit.tpl b/lib/copy_this/www/templates/nntmux/views/admin/spotnab-edit.tpl index 00a6221e9..7d74aa219 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/spotnab-edit.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/spotnab-edit.tpl @@ -1,4 +1,4 @@ - +

{$page->title}

@@ -8,9 +8,9 @@ Name: - + -
A name or description for the source.
+
A name or description for the source.
@@ -18,28 +18,28 @@ Poster Username: -
The username part of the poster. eg nntp
+
The username part of the poster. eg nntp
Poster E-mail: -
The email part of the poster. eg spot@nntp.com
+
The email part of the poster. eg spot@nntp.com
Usenet Group: -
Group to search when looking up posts for this source.
+
Group to search when looking up posts for this source.
Public Key: -
Public Key needed to decode the posts specific for this source.
+
Public Key needed to decode the posts specific for this source.
diff --git a/lib/copy_this/www/templates/nntmux/views/admin/spotnab-list.tpl b/lib/copy_this/www/templates/nntmux/views/admin/spotnab-list.tpl index 009ba4fc6..0bfd8824d 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/spotnab-list.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/spotnab-list.tpl @@ -1,4 +1,4 @@ - +

{$page->title}

{if $spotnab|@count == 0} @@ -15,11 +15,11 @@ No available sources. Add one? last update options - + {foreach from=$spotnab item=source} - {$source.description} - {if $source.active=="1"}active{else}inactive{/if} + {$source.description} + {if $source.active=="1"}active{else}inactive{/if} {$source.comments} {if $source.lastbroadcast != null} @@ -35,7 +35,7 @@ No available sources. Add one? n/a {/if} - edit delete + edit delete {/foreach} diff --git a/lib/copy_this/www/templates/nntmux/views/admin/thetvdb-edit.tpl b/lib/copy_this/www/templates/nntmux/views/admin/thetvdb-edit.tpl index 4c9b07870..c1b55a8a0 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/thetvdb-edit.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/thetvdb-edit.tpl @@ -8,9 +8,9 @@ - + @@ -57,9 +57,9 @@ - + diff --git a/lib/copy_this/www/templates/nntmux/views/admin/thetvdb-list.tpl b/lib/copy_this/www/templates/nntmux/views/admin/thetvdb-list.tpl index 373cd50aa..b457497b5 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/thetvdb-list.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/thetvdb-list.tpl @@ -19,16 +19,16 @@
:: - +
:: - +
- + {foreach from=$serieslist item=thetvdb} - - - + + + {/foreach} diff --git a/lib/copy_this/www/templates/nntmux/views/admin/thetvdb-remove.tpl b/lib/copy_this/www/templates/nntmux/views/admin/thetvdb-remove.tpl index bbf12af25..1c245f125 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/thetvdb-remove.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/thetvdb-remove.tpl @@ -1,4 +1,4 @@

{$page->title}

-Removed tvdbID from {$numtv} releases. \ No newline at end of file +Removed tvdbid from {$numtv} releases. \ No newline at end of file diff --git a/lib/copy_this/www/templates/nntmux/views/admin/tmux-edit.tpl b/lib/copy_this/www/templates/nntmux/views/admin/tmux-edit.tpl index 40b8538f7..8946ae2df 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/tmux-edit.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/tmux-edit.tpl @@ -121,10 +121,10 @@ release.

The 'In Process' NZBs are total nzbs, inside the parenthesis is distinct nzbs and 'In Database' are nzbs that have all parts available and will be processed on next run.

- The 'In Process' requestID is the number waiting to be processed and inside the parenthesis is the + The 'In Process' requestid is the number waiting to be processed and inside the parenthesis is the number changed since the script started. The 'In Database' is the total matches of releases to requestIDs and inside the parenthesis is percentage of total releases that you have matched to a - requestID.

+ requestid.

The 'In Process' rows PC and Pron are simply subsets of the 'In Process' row Misc. There is no postprocessing specifically for these categories. The 'In Database' is the actual count for the category. diff --git a/lib/copy_this/www/templates/nntmux/views/admin/user-edit.tpl b/lib/copy_this/www/templates/nntmux/views/admin/user-edit.tpl index fbde31cb4..5abbaf6bc 100644 --- a/lib/copy_this/www/templates/nntmux/views/admin/user-edit.tpl +++ b/lib/copy_this/www/templates/nntmux/views/admin/user-edit.tpl @@ -11,7 +11,7 @@ @@ -27,12 +27,12 @@ - {if $user.ID} + {if $user.id} {/foreach} - +
TheTVDB IDTheTVDB id Title Options
{$thetvdb.tvdbID}{$thetvdb.seriesname|escape:"htmlall"}delete | remove{$thetvdb.tvdbid}{$thetvdb.seriesname|escape:"htmlall"}delete | remove
Name: - +
Password: - {if $user.ID} + {if $user.id}
Only enter a password if you want to change it.
{/if}
Grabs: @@ -107,12 +107,12 @@ - {if $user.ID != ""} + {if $user.id != ""} @@ -181,7 +181,7 @@ {/if} {if $loggedin=="true"} - + {/if} diff --git a/lib/copy_this/www/templates/nntmux/views/frontend/books.tpl b/lib/copy_this/www/templates/nntmux/views/frontend/books.tpl index dbe27a5ee..47c0c77eb 100644 --- a/lib/copy_this/www/templates/nntmux/views/frontend/books.tpl +++ b/lib/copy_this/www/templates/nntmux/views/frontend/books.tpl @@ -76,7 +76,7 @@
{$result.author|escape: @@ -84,7 +84,7 @@
{if $result.url != ""} + name="amazon{$result.bookinfoid}" title="View amazon page"> Amazon{/if} Grp diff --git a/lib/copy_this/www/templates/nntmux/views/frontend/browse.tpl b/lib/copy_this/www/templates/nntmux/views/frontend/browse.tpl index cb21ba447..fd1f6115f 100644 --- a/lib/copy_this/www/templates/nntmux/views/frontend/browse.tpl +++ b/lib/copy_this/www/templates/nntmux/views/frontend/browse.tpl @@ -7,7 +7,7 @@
@@ -113,16 +113,16 @@ {if $result.nfoID > 0} Nfo{/if} - {if $result.imdbID > 0} - Cover + {if $result.imdbid > 0} + Cover {/if} - {if $result.preID > 0 && $userdata.canpre == 1} 0 && $userdata.canpre == 1} PreDB{/if} - {if $result.prehashID > 0}Prehash{/if} + {if $result.prehashid > 0}Prehash{/if} {if $result.movieinfoID > 0}Movie{/if} {if $result.haspreview == 1 && $userdata.canpreview == 1} {/if} - {if $result.musicinfoID > 0} 0}Cover{/if} - {if $result.consoleinfoID > 0} 0} Cover{/if} - {if $result.bookinfoID > 0} 0}Cover{/if} - {if $result.rageID > 0} 0}View Series{/if} {if $result.anidbid > 0}
{$result.category_name} + href="{$smarty.const.WWW_TOP}/browse?t={$result.categoryid}">{$result.category_name} {$result.postdate|timeago} {$result.size|fsize_format:"MB"}{if $result.completion > 0} diff --git a/lib/copy_this/www/templates/nntmux/views/frontend/cart.tpl b/lib/copy_this/www/templates/nntmux/views/frontend/cart.tpl index 0d65d27b8..2fbad4153 100644 --- a/lib/copy_this/www/templates/nntmux/views/frontend/cart.tpl +++ b/lib/copy_this/www/templates/nntmux/views/frontend/cart.tpl @@ -2,7 +2,7 @@

My Cart

-Your cart can be downloaded as an Rss Feed. +Your cart can be downloaded as an Rss Feed.

{if $results|@count > 0} @@ -36,7 +36,7 @@ Your cart can be downloaded as an delete
diff --git a/lib/copy_this/www/templates/nntmux/views/frontend/console.tpl b/lib/copy_this/www/templates/nntmux/views/frontend/console.tpl index 202fd1a2b..248f18773 100644 --- a/lib/copy_this/www/templates/nntmux/views/frontend/console.tpl +++ b/lib/copy_this/www/templates/nntmux/views/frontend/console.tpl @@ -16,7 +16,7 @@ @@ -24,7 +24,7 @@ @@ -120,7 +120,7 @@ {$result.title|escape: @@ -130,7 +130,7 @@ Nfo{/if} {if $result.url != ""} + name="amazon{$result.consoleinfoid}" title="View amazon page"> Amazon{/if} Grp @@ -154,10 +154,10 @@ title="View similar nzbs">Similar {if $isadmin} Edit Del {/if}
diff --git a/lib/copy_this/www/templates/nntmux/views/frontend/dlbrowse.tpl b/lib/copy_this/www/templates/nntmux/views/frontend/dlbrowse.tpl index a92b886cc..35e9c6504 100644 --- a/lib/copy_this/www/templates/nntmux/views/frontend/dlbrowse.tpl +++ b/lib/copy_this/www/templates/nntmux/views/frontend/dlbrowse.tpl @@ -4,7 +4,7 @@

/{$subpath|escape:"htmlall"}

-View: +View: {if $lm}Covers | List {else}Covers | List{/if}
@@ -24,19 +24,19 @@ View: .. {/if} - + {foreach from=$results item=result} - - {assign var="icon" value='templates/nntmux/images/fileicons/'|cat:$result.pathinfo.extension|cat:".png"} + + {assign var="icon" value='templates/nntmux/images/fileicons/'|cat:$result.pathinfo.extension|cat:".png"} {if $result.isdir == "1"} {assign var="icon" value='folder'} {elseif $result.pathinfo.extension == "" || !is_file("$icon")} {assign var="icon" value='file'} {else} {assign var="icon" value=$result.pathinfo.extension} - {/if} - + {/if} + {$result.pathinfo.extension} {if $result.isdir == 1} @@ -62,7 +62,7 @@ View: {if $result.release.ep_airdate != ''}Aired: {$result.release.ep_airdate|date_format}
{/if} {if $result.release.ep_fullep != ''}Episode: {$result.release.ep_fullep}
{/if} - {/if} + {/if} {if $result.release.music_id != ""}
@@ -70,12 +70,12 @@ View: {if $result.release.mu_artist != ''}{$result.release.mu_artist}

{/if} {if $result.release.mu_year != ''}Year: {$result.release.mu_year}
{/if}
- {/if} - + {/if} + {if $result.release.music_id == "" && $result.release.ep_id == "" && $result.release.movie_id == ""}
{/if} - {if $result.release.ID != ""} + {if $result.release.id != ""}
More Info

{/if} @@ -85,25 +85,25 @@ View: {/if} - {if $result.release.categoryID != ""} - {$result.release.category_name} + {if $result.release.categoryid != ""} + {$result.release.category_name} {/if} {if $result.release.movie_id != ""} - {$result.release.title|escape: + {$result.release.title|escape: {/if} {if $result.release.rage_imgdata != ""} {$result.release.showtitle} Logo - {/if} + {/if} {if $result.release.mu_cover == "1"} {$result.release.title|escape: - {/if} + {/if} {$result.mtime|timeago} {/foreach} - +


diff --git a/lib/copy_this/www/templates/nntmux/views/frontend/forum.tpl b/lib/copy_this/www/templates/nntmux/views/frontend/forum.tpl index 0bdcb41b4..57fbad568 100644 --- a/lib/copy_this/www/templates/nntmux/views/frontend/forum.tpl +++ b/lib/copy_this/www/templates/nntmux/views/frontend/forum.tpl @@ -1,6 +1,6 @@

Forum

- + {if $results|@count > 0} {$pager} @@ -18,9 +18,9 @@ {foreach from=$results item=result} - - - {$result.subject|escape:"htmlall"|truncate:100:'...':true:true} + + + {$result.subject|escape:"htmlall"|truncate:100:'...':true:true}
{$result.message|escape:"htmlall"|truncate:200:'...':false:false}
@@ -31,12 +31,12 @@ on {$result.createddate|date_format}
({$result.createddate|timeago})
- {$result.updateddate|date_format}
({$result.updateddate|timeago})
+ {$result.updateddate|date_format}
({$result.updateddate|timeago})
{$result.replies} {/foreach} - + diff --git a/lib/copy_this/www/templates/nntmux/views/frontend/forumpost.tpl b/lib/copy_this/www/templates/nntmux/views/frontend/forumpost.tpl index 1c10888c3..97012692c 100644 --- a/lib/copy_this/www/templates/nntmux/views/frontend/forumpost.tpl +++ b/lib/copy_this/www/templates/nntmux/views/frontend/forumpost.tpl @@ -24,15 +24,15 @@ on {$result.createddate|date_format}
({$result.createddate|timeago})
{if $userdata.role==2} {/if} - + {$result.message|escape:"htmlall"|nl2br|magicurl} {/foreach} - + diff --git a/lib/copy_this/www/templates/nntmux/views/frontend/games.tpl b/lib/copy_this/www/templates/nntmux/views/frontend/games.tpl index 63353b1f8..409757c80 100644 --- a/lib/copy_this/www/templates/nntmux/views/frontend/games.tpl +++ b/lib/copy_this/www/templates/nntmux/views/frontend/games.tpl @@ -17,7 +17,7 @@ diff --git a/lib/copy_this/www/templates/nntmux/views/frontend/headermenu.tpl b/lib/copy_this/www/templates/nntmux/views/frontend/headermenu.tpl index 2f81b41cf..48b5ccbf8 100644 --- a/lib/copy_this/www/templates/nntmux/views/frontend/headermenu.tpl +++ b/lib/copy_this/www/templates/nntmux/views/frontend/headermenu.tpl @@ -2,55 +2,55 @@ {/if} {/if} -{if $anidb && $release.anidbID > 0} +{if $anidb && $release.anidbid > 0} {if $release.tvtitle != ""}{$release.tvtitle|escape:"htmlall"}{/if}
{if $anidb.description != ""}{$anidb.description|escape:"htmlall"|nl2br|magicurl|truncate:"350":"more..."}{if $anidb.description|strlen > 350}{$anidb.description|escape:"htmlall"|nl2br|magicurl}{else}{/if}

{/if} {if $anidb.categories != ""}Categories: {$anidb.categories|escape:"htmlall"|replace:"|":", "}
{/if} {if $release.tvairdate != "0000-00-00 00:00:00"}Aired: {$release.tvairdate|date_format}
{/if} -{if $episode && $release.episodeinfoID > 0} +{if $episode && $release.episodeinfoid > 0} {if $episode.overview != ""}Overview: {$episode.overview}{/if} {if $episode.rating > 0}Rating: {$episode.rating}{/if} {if $episode.director != ""}Director: {$episode.director|escape:"htmlall"|replace:"|":", "}{/if} @@ -120,10 +120,10 @@ {if $episode.writer != ""}Writer: {$episode.writer|escape:"htmlall"|replace:"|":", "}{/if} {/if}

- All Episodes - AniDB - {if $release.tvdbID > 0}TheTVDB{/if} - Anime RSS Feed + All Episodes + AniDB + {if $release.tvdbid > 0}TheTVDB{/if} + Anime RSS Feed
{/if} {if $con} @@ -235,10 +235,10 @@