Example #1
0
 public function delete($id)
 {
     $db = new DB();
     $this->delCartForUser($id);
     $this->delUserCategoryExclusions($id);
     $rc = new ReleaseComments();
     $rc->deleteCommentsForUser($id);
     $um = new UserMovies();
     $um->delMovieForUser($id);
     $us = new UserSeries();
     $us->delShowForUser($id);
     $forum = new Forum();
     $forum->deleteUser($id);
     $db->query(sprintf("delete from users where ID = %d", $id));
 }
Example #2
0
<?php

require_once "config.php";
$page = new AdminPage();
if (isset($_GET['id'])) {
    $rc = new ReleaseComments();
    $rc->deleteComment($_GET['id']);
}
$referrer = $_SERVER['HTTP_REFERER'];
header("Location: " . $referrer);
Example #3
0
<?php

if (!$page->users->isLoggedIn()) {
    $page->show403();
}
if (isset($_GET["id"])) {
    $releases = new Releases(['Settings' => $page->settings]);
    $rc = new ReleaseComments();
    $re = new ReleaseExtra();
    $data = $releases->getByGuid($_GET["id"]);
    if (!$data) {
        $page->show404();
    }
    if ($page->isPostBack()) {
        $rc->addComment($data["id"], $data["gid"], $_POST["txtAddComment"], $page->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"]);
    $comments = $rc->getCommentsByGid($data["gid"]);
    $rage = '';
    if ($data["rageid"] != '') {
        $tvrage = new TvAnger();
        $rageinfo = $tvrage->getByRageID($data["rageid"]);
        if (count($rageinfo) > 0) {
            $seriesnames = $seriesdescription = $seriescountry = $seriesgenre = $seriesimg = $seriesid = array();
            foreach ($rageinfo as $r) {
                $seriesnames[] = $r['releasetitle'];
                if (!empty($r['description'])) {
                    $seriesdescription[] = $r['description'];
<?php

require_once WWW_DIR . "/lib/releases.php";
require_once WWW_DIR . "/lib/category.php";
require_once WWW_DIR . "/lib/groups.php";
require_once WWW_DIR . "/lib/genres.php";
require_once WWW_DIR . "/lib/nzb.php";
require_once WWW_DIR . "/lib/movie.php";
require_once WWW_DIR . "/lib/util.php";
$releases = new Releases();
$rc = new ReleaseComments();
$gen = new Genres();
$category = new Category();
$grp = new Groups();
$nzb = new NZB();
$movie = new Movie();
if ($page->site->apienabled != 1) {
    showApiError(910);
}
//
// api functions
//
$function = "s";
if (isset($_GET["t"])) {
    if ($_GET["t"] == "details" || $_GET["t"] == "d") {
        $function = "d";
    } elseif ($_GET["t"] == "comments" || $_GET["t"] == "comm") {
        $function = "co";
    } elseif ($_GET["t"] == "commentadd" || $_GET["t"] == "commadd") {
        $function = "ca";
    } elseif ($_GET["t"] == "get" || $_GET["t"] == "g") {
Example #5
0
 /**
  * @param      $id
  * @param bool $isGuid
  */
 public function delete($id, $isGuid = false)
 {
     $users = new Users();
     $s = new Settings();
     $nfo = new Nfo();
     $rf = new ReleaseFiles();
     $re = new ReleaseExtra();
     $rc = new ReleaseComments();
     $ri = new ReleaseImage();
     if (!is_array($id)) {
         $id = array($id);
     }
     foreach ($id as $identifier) {
         //
         // delete from disk.
         //
         $rel = $isGuid ? $this->getByGuid($identifier) : $this->getById($identifier);
         $nzbpath = "";
         if ($isGuid) {
             $nzbpath = $s->getSetting('nzbpath') . substr($identifier, 0, 1) . "/" . $identifier . ".nzb.gz";
         } elseif ($rel) {
             $nzbpath = $s->getSetting('nzbpath') . substr($rel["guid"], 0, 1) . "/" . $rel["guid"] . ".nzb.gz";
         }
         if ($nzbpath != "" && file_exists($nzbpath)) {
             unlink($nzbpath);
         }
         $audiopreviewpath = "";
         if ($isGuid) {
             $audiopreviewpath = WWW_DIR . 'covers/audio/' . $identifier . ".mp3";
         } elseif ($rel) {
             $audiopreviewpath = WWW_DIR . 'covers/audio/' . $rel["guid"] . ".mp3";
         }
         if ($audiopreviewpath && file_exists($audiopreviewpath)) {
             unlink($audiopreviewpath);
         }
         if ($rel) {
             $nfo->deleteReleaseNfo($rel['id']);
             $rc->deleteCommentsForRelease($rel['id']);
             $users->delCartForRelease($rel['id']);
             $users->delDownloadRequestsForRelease($rel['id']);
             $rf->delete($rel['id']);
             $re->delete($rel['id']);
             $re->deleteFull($rel['id']);
             $ri->delete($rel['guid']);
             $this->pdo->queryExec(sprintf("DELETE FROM releases WHERE id = %d", $rel['id']));
         }
     }
 }
Example #6
0
 public function process_comment_headers($headers, $group_hash, $save = true)
 {
     /*
      *	We iterate over the provided headers (generated by
      *	$this->_get_headers() to a structure that is at the very
      *	minimum looking like this:
      *
      *	array (
      *		[0] => array (
      *				'Number': <int>
      *				'Subject': <string>
      *				'From': <string>
      *				'Date': <string>
      *				'Message-ID': <string>
      *				'Bytes': <int>
      *				'Lines': <int>
      *				'Epoch': <int>
      *			),
      *			...
      *		)
      *	From the structure above, we process our group hash and retrieve
      *	all the binary data we need on valid content.
      *
      *	A group_hash() record looks like this:
      *		array(
      *			array(
      *				'id': <int>,
      *				'key': <string>,
      *				'user': <string>,
      *				'email': <string>,
      *				'ref': <int>,
      *			),
      *			array(
      *				'id': <int>,
      *				'key': <string>,
      *				'user': <string>,
      *				'email': <string>,
      *				'ref': <int>,
      *			),
      *		)
      */
     if (!count($group_hash)) {
         // Nothing to process
         return [];
     }
     //
     // Prepare some general SQL Commands for saving later if all goes well
     //
     $db = new Settings();
     $rc = new ReleaseComments();
     // Comments
     $sql_new_cmt = "INSERT INTO release_comments (" . "id, sourceid, username, userid, gid, cid, isvisible, " . "releaseid, `text`, createddate, issynced, nzb_guid) VALUES (" . "NULL, %d, %s, 0, %s, %s, %d, 0, %s, %s, 1, %s)";
     $sql_upd_cmt = "UPDATE release_comments SET " . "isvisible = %d, `text` = %s" . "WHERE sourceid = %d AND gid = %s AND cid = %s AND nzb_guid = %s";
     $sql_fnd_cmt = "SELECT count(id) as cnt FROM release_comments " . "WHERE sourceid = %d AND gid = %s AND cid = %s";
     // Sync Times
     $sql_sync = "UPDATE spotnabsources SET lastupdate = %s " . "WHERE id = %d";
     $matches = Null;
     $processed = 0;
     $updates = 0;
     $inserts = 0;
     foreach ($headers as $header) {
         // 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)) {
             continue;
         }
         if ($matches['domain'] != SpotNab::SEGID_DOMAIN) {
             continue;
         }
         if ($matches['type'] != SpotNab::FETCH_COMMENT_TYPE) {
             continue;
         }
         // 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_COMMENT_SUBJECT_REGEX, $header['Subject'], $matches)) {
             continue;
         }
         // We have a match; So populate potential variables
         $checksum = $matches['checksum'];
         $refdate = $matches['utcref'];
         $refdate_epoch = @strtotime($matches['utcref'] . " UTC");
         if ($refdate_epoch === false || $refdate_epoch < 0) {
             // Bad time specified
             continue;
         }
         // PreKey is used to attempt to run the decode algorithm
         // a head of time.. if we can decrypt this we can probably
         // assume the body will decode too (and won't be a waste of
         // time to download it)
         foreach ($group_hash as $hash) {
             // Track how many records we handled
             $processed++;
             // First check the ref date... if it's newer then what we've
             // already processed, then we'll just keep on chugging along.
             if ($refdate_epoch <= $hash['ref']) {
                 continue;
             }
             // Scan header information for supported matches
             if (!preg_match('/^(?P<user>[^<]+)<(?P<email>[^>]+)>$/', $header['From'], $matches)) {
                 continue;
             }
             // Match against our sources posts
             if (trim($matches['user']) != $hash['user']) {
                 continue;
             }
             if (trim($matches['email']) != $hash['email']) {
                 continue;
             }
             // If we reach here, we've found a header we can process
             // The next step is to download the header's body
             // We'll do some final verifications on it such as detect
             // if the checksum is okay, and verify that the timestamp
             // within the body matches that of the header... then we
             // can start processing the guts of the body.
             if ($save) {
                 // Download Body
                 $body = $this->_get_body($header['Group'], $header['Message-ID']);
                 if ($body === false) {
                     continue;
                 }
                 //echo "DEBUG Close Match:\n";
                 //print_r($header);
                 // Decode Body
                 $body = $this->decodePost($body, $hash['key']);
                 if ($body === false) {
                     continue;
                 }
                 // Decode failed
                 // Verify Body
                 if (!is_array($body)) {
                     continue;
                 }
                 // not any array
                 if (!(bool) count(array_filter(array_keys($body), 'is_string'))) {
                     continue;
                 }
                 // not an associative array
                 if (!array_key_exists('server', $body) || !array_key_exists('postdate_utc', $body)) {
                     continue;
                 }
                 // base structure missing
                 // Compare postdate_utc and ensure it matches header
                 // timestamp
                 if (preg_replace('/[^0-9]/', '', $body['postdate_utc']) != $refdate) {
                     continue;
                 }
                 // Comment Handling
                 if (array_key_exists('comments', $body) && is_array($body['comments'])) {
                     $rc = new ReleaseComments();
                     foreach ($body['comments'] as $comment) {
                         // Verify Comment is parseable
                         if (!is_array($comment)) {
                             continue;
                         }
                         // not an array
                         if (!count(array_filter(array_keys($comment)))) {
                             continue;
                         }
                         // not an associative array
                         // Store isvisible flag
                         $is_visible = 1;
                         if (array_key_exists('is_visible', $comment)) {
                             $is_visible = intval($comment['is_visible']) > 0 ? 1 : 0;
                         }
                         // Check that comment doesn't already exist
                         $res = $db->queryOneRow(sprintf($sql_fnd_cmt, $hash['id'], $db->escapeString($comment['gid']), $db->escapeString($comment['cid'])));
                         // Store Results in DB
                         if ($res && intval($res['cnt']) > 0) {
                             // Make some noise
                             echo '.';
                             $updates += $db->queryExec(sprintf($sql_upd_cmt, $is_visible, $db->escapeString($comment['comment']), $hash['id'], $db->escapeString($comment['gid']), $db->escapeString($comment['cid']), $db->escapeString($comment['gid']))) > 0 ? 1 : 0;
                         } else {
                             // Make some noise
                             echo '+';
                             // Perform Insert
                             $res = $db->queryInsert(sprintf($sql_new_cmt, $hash['id'], $db->escapeString($comment['username']), $db->escapeString($comment['gid']), $db->escapeString($comment['cid']), $is_visible, $db->escapeString($comment['comment']), $db->escapeString($this->utc2local($comment['postdate_utc'])), $db->escapeString($comment['gid'])));
                             $inserts += 1;
                         }
                         $rc->updateReleaseCommentCount($comment['gid']);
                     }
                 }
                 // Update spotnabsources table, set lastupdate to the
                 // timestamp parsed from the header.
                 $db->queryExec(sprintf($sql_sync, $db->escapeString($this->utc2local($body['postdate_utc'])), $hash['id']));
             } else {
                 // Debug non/save mode; mark update
                 $updates += 1;
             }
             // always break if we made it this far... no mater how many
             // other groups are being processed, we've already matched
             // for this article, so we don't need to process it for
             // other sources.
             break;
         }
     }
     return [$inserts, $updates];
 }
Example #7
0
<?php

if (!$page->users->isLoggedIn()) {
    $page->show403();
}
if (isset($_GET['id'])) {
    $releases = new Releases(['Settings' => $page->settings]);
    $data = $releases->getByGuid($_GET['id']);
    if (!$data) {
        $page->show404();
    }
    $rc = new ReleaseComments($page->settings);
    if ($page->isPostBack()) {
        $rc->addComment($data['id'], $_POST['txtAddComment'], $page->users->currentUserId(), $_SERVER['REMOTE_ADDR']);
    }
    $nfo = $releases->getReleaseNfo($data['id'], false);
    $re = new ReleaseExtra($page->settings);
    $reVideo = $re->getVideo($data['id']);
    $reAudio = $re->getAudio($data['id']);
    $reSubs = $re->getSubs($data['id']);
    $comments = $rc->getComments($data['id']);
    $similars = $releases->searchSimilar($data['id'], $data['searchname'], 6, $page->userdata['categoryexclusions']);
    $rage = $ani = $mov = $mus = $con = $game = $xxx = $boo = '';
    if ($data['rageid'] != '') {
        $tvrage = new TvRage(['Settings' => $page->settings]);
        $rageinfo = $tvrage->getByRageID($data['rageid']);
        if (count($rageinfo) > 0) {
            $seriesnames = $seriesdescription = $seriescountry = $seriesgenre = $seriesimg = $seriesid = array();
            foreach ($rageinfo as $r) {
                $seriesnames[] = $r['releasetitle'];
                if (!empty($r['description'])) {
Example #8
0
<?php

$rc = new ReleaseComments();
$sab = new SABnzbd($page);
$nzbget = new NZBGet($page);
if (!$page->users->isLoggedIn()) {
    $page->show403();
}
$userID = 0;
if (isset($_GET["id"])) {
    $userID = $_GET["id"] + 0;
} elseif (isset($_GET["name"])) {
    $res = $page->users->getByUsername($_GET["name"]);
    if ($res) {
        $userID = $res["id"];
    }
} else {
    $userID = $page->users->currentUserId();
}
$privileged = $page->users->isAdmin($userID) || $page->users->isModerator($userID) ? true : false;
$privateProfiles = $page->settings->getSetting('privateprofiles') == 1 ? true : false;
$publicView = false;
if (!$privateProfiles || $privileged) {
    $altID = isset($_GET['id']) && $_GET['id'] >= 0 ? (int) $_GET['id'] : false;
    $altUsername = isset($_GET['name']) && strlen($_GET['name']) > 0 ? $_GET['name'] : false;
    // If both 'id' and 'name' are specified, 'id' should take precedence.
    if ($altID === false && $altUsername !== false) {
        $user = $page->users->getByUsername($altUsername);
        if ($user) {
            $altID = $user['id'];
        }
Example #9
0
                     } else {
                         if (isset($_GET['reset_settings'])) {
                             $guid = $admin->settings->queryOneRow('SELECT site_guid FROM sharing');
                             $guid = $guid === false ? '' : $guid['site_guid'];
                             (new Sharing(['Settings' => $admin->settings]))->initSettings($guid);
                             print 'Re-initiated sharing settings!';
                         } else {
                             if (isset($_GET['purge_site'])) {
                                 $guid = $admin->settings->queryOneRow(sprintf('SELECT site_guid FROM sharing_sites WHERE id = %d', $_GET['purge_site']));
                                 if ($guid === false) {
                                     print 'Error purging site ' . $_GET['purge_site'] . '!';
                                 } else {
                                     $ids = $admin->settings->query(sprintf('SELECT id FROM releasecomment WHERE siteid = %s', $admin->settings->escapeString($guid['site_guid'])));
                                     $total = count($ids);
                                     if ($total > 0) {
                                         $rc = new ReleaseComments($admin->settings);
                                         foreach ($ids as $id) {
                                             $rc->deleteComment($id['id']);
                                         }
                                     }
                                     $admin->settings->queryExec(sprintf('UPDATE sharing_sites SET comments = 0 WHERE id = %d', $_GET['purge_site']));
                                     print 'Deleted ' . $total . ' comments for site ' . $_GET['purge_site'];
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Example #10
0
<?php

require_once WWW_DIR . "/lib/releasecomments.php";
require_once WWW_DIR . "/lib/category.php";
require_once WWW_DIR . "/lib/sabnzbd.php";
$rc = new ReleaseComments();
$sab = new SABnzbd($page);
if (!$users->isLoggedIn()) {
    $page->show403();
}
$userid = 0;
if (isset($_GET["id"])) {
    $userid = $_GET["id"] + 0;
} elseif (isset($_GET["name"])) {
    $res = $users->getByUsername($_GET["name"]);
    if ($res) {
        $userid = $res["ID"];
    }
} else {
    $userid = $users->currentUserId();
}
$data = $users->getById($userid);
if (!$data) {
    $page->show404();
}
$invitedby = '';
if ($data["invitedby"] != "") {
    $invitedby = $users->getById($data["invitedby"]);
}
$page->smarty->assign('userinvitedby', $invitedby);
$page->smarty->assign('user', $data);
Example #11
0
 public function delete($id)
 {
     $this->delCartForUser($id);
     $this->delUserCategoryExclusions($id);
     $this->delDownloadRequests($id);
     $this->delApiRequests($id);
     $rc = new ReleaseComments();
     $rc->deleteCommentsForUser($id);
     $um = new UserMovies();
     $um->delMovieForUser($id);
     $us = new UserSeries();
     $us->delShowForUser($id);
     $forum = new Forum();
     $forum->deleteUser($id);
     $this->pdo->queryExec(sprintf("DELETE from users where id = %d", $id));
 }
Example #12
0
<?php

require_once WWW_DIR . "/lib/releases.php";
require_once WWW_DIR . "/lib/releasefiles.php";
require_once WWW_DIR . "/lib/releasecomments.php";
require_once WWW_DIR . "/lib/releaseextra.php";
require_once WWW_DIR . "/lib/tvrage.php";
require_once WWW_DIR . "/lib/anidb.php";
if (!$users->isLoggedIn()) {
    $page->show403();
}
if (isset($_GET["id"])) {
    $releases = new Releases();
    $rc = new ReleaseComments();
    $re = new ReleaseExtra();
    $tvrage = new TvRage();
    $AniDB = new AniDB();
    $data = $releases->getByGuid($_GET["id"]);
    if (!$data) {
        $page->show404();
    }
    if ($page->isPostBack()) {
        $rc->addComment($data["ID"], $_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"]);
    $comments = $rc->getComments($data["ID"]);
    $similars = $releases->searchSimilar($data["ID"], $data["searchname"], 6, $page->userdata["categoryexclusions"]);
    $rage = '';
<?php

require_once "config.php";
require_once WWW_DIR . "/lib/adminpage.php";
require_once WWW_DIR . "/lib/releasecomments.php";
$page = new AdminPage();
$releases = new ReleaseComments();
$page->title = "Comments List";
$commentcount = $releases->getCommentCount();
$offset = isset($_REQUEST["offset"]) ? $_REQUEST["offset"] : 0;
$page->smarty->assign('pagertotalitems', $commentcount);
$page->smarty->assign('pageroffset', $offset);
$page->smarty->assign('pageritemsperpage', ITEMS_PER_PAGE);
$page->smarty->assign('pagerquerybase', WWW_TOP . "/comments-list.php?offset=");
$pager = $page->smarty->fetch("pager.tpl");
$page->smarty->assign('pager', $pager);
$commentslist = $releases->getCommentsRange($offset, ITEMS_PER_PAGE);
$page->smarty->assign('commentslist', $commentslist);
$page->content = $page->smarty->fetch('comments-list.tpl');
$page->render();
Example #14
0
 public function delete($id, $isGuid = false)
 {
     $db = new DB();
     $users = new Users();
     $s = new Sites();
     $nfo = new Nfo();
     $site = $s->get();
     $rf = new ReleaseFiles();
     $re = new ReleaseExtra();
     $rc = new ReleaseComments();
     $ri = new ReleaseImage();
     if (!is_array($id)) {
         $id = array($id);
     }
     foreach ($id as $identifier) {
         //
         // delete from disk.
         //
         $rel = $isGuid ? $this->getByGuid($identifier) : $this->getById($identifier);
         if ($rel && file_exists($site->nzbpath . $rel["guid"] . ".nzb.gz")) {
             unlink($site->nzbpath . $rel["guid"] . ".nzb.gz");
         }
         $nfo->deleteReleaseNfo($rel['ID']);
         $rc->deleteCommentsForRelease($rel['ID']);
         $users->delCartForRelease($rel['ID']);
         $rf->delete($rel['ID']);
         $re->delete($rel['ID']);
         $re->deleteFull($rel['ID']);
         $ri->delete($rel['guid']);
         $db->query(sprintf("delete from releases where id = %d", $rel['ID']));
     }
 }