diff --git a/classes/class_text.php b/classes/class_text.php
index 58629e4b..78c85111 100644
--- a/classes/class_text.php
+++ b/classes/class_text.php
@@ -454,7 +454,7 @@ function to_html($Array) {
$Str.=''.$Block['Val'].'';
break;
case 'torrent':
- $Pattern = '/('.NONSSL_SITE_URL.'\/torrents\.php?.*id=)?(\d+)($|&|#)/i';
+ $Pattern = '/('.NONSSL_SITE_URL.'\/torrents\.php.*[\?&]id=)?(\d+)($|&|\#).*/i';
$Matches = array();
if (preg_match($Pattern, $Block['Val'], $Matches)) {
if (isset($Matches[2])) {
@@ -467,7 +467,7 @@ function to_html($Array) {
}
}
} else {
- $Str .= '[torrent]'.$Block['Val'].'[/torrent]';
+ $Str .= '[torrent]'.str_replace('[inlineurl]','',$Block['Val']).'[/torrent]';
}
break;
case 'wiki':
diff --git a/classes/class_torrent_form.php b/classes/class_torrent_form.php
index ee58098f..960f9354 100644
--- a/classes/class_torrent_form.php
+++ b/classes/class_torrent_form.php
@@ -65,12 +65,15 @@ function head() {
- } else if($this->Torrent && $this->Torrent['GroupID']) { ?>
+ } else {
+ if($this->Torrent && $this->Torrent['GroupID']) { ?>
- } else if($this->Torrent && $this->Torrent['RequestID']) { ?>
+ }
+ if($this->Torrent && $this->Torrent['RequestID']) { ?>
- } ?>
+ }
+ } ?>
if($this->NewTorrent) { ?>
diff --git a/classes/script_start.php b/classes/script_start.php
index c821dc6c..48cd6bf7 100644
--- a/classes/script_start.php
+++ b/classes/script_start.php
@@ -1898,13 +1898,13 @@ function update_sphinx_requests($RequestID) {
$DB->query("REPLACE INTO sphinx_requests_delta (
ID, UserID, TimeAdded, LastVote, CategoryID, Title,
- Year, ReleaseType, RecordLabel, CatalogueNumber, BitrateList,
+ Year, ReleaseType, CatalogueNumber, BitrateList,
FormatList, MediaList, LogCue, FillerID, TorrentID,
TimeFilled, Visible, Votes, Bounty)
SELECT
ID, r.UserID, UNIX_TIMESTAMP(TimeAdded) AS TimeAdded,
UNIX_TIMESTAMP(LastVote) AS LastVote, CategoryID,
- Title, Year, ReleaseType, RecordLabel, CatalogueNumber, BitrateList,
+ Title, Year, ReleaseType, CatalogueNumber, BitrateList,
FormatList, MediaList, LogCue, FillerID, TorrentID,
UNIX_TIMESTAMP(TimeFilled) AS TimeFilled, Visible,
COUNT(rv.UserID) AS Votes, SUM(rv.Bounty) >> 10 AS Bounty
diff --git a/ocelot-0.3.1.tar.bz2 b/ocelot-0.3.1.tar.bz2
deleted file mode 100644
index 2c3df812..00000000
Binary files a/ocelot-0.3.1.tar.bz2 and /dev/null differ
diff --git a/ocelot-0.3.2.tar.bz2 b/ocelot-0.3.2.tar.bz2
new file mode 100644
index 00000000..40578a07
Binary files /dev/null and b/ocelot-0.3.2.tar.bz2 differ
diff --git a/sections/ajax/index.php b/sections/ajax/index.php
index a112c1cc..532f499b 100644
--- a/sections/ajax/index.php
+++ b/sections/ajax/index.php
@@ -49,6 +49,7 @@
break;
case 'browse':
require(SERVER_ROOT.'/sections/ajax/browse.php');
+ break;
case 'usersearch':
require(SERVER_ROOT.'/sections/ajax/usersearch.php');
break;
@@ -57,8 +58,7 @@
break;
case 'requests':
require(SERVER_ROOT.'/sections/ajax/requests.php');
- case 'bookmarks':
- require(SERVER_ROOT.'/sections/ajax/bookmarks/index.php');
+ break;
case 'artist':
require(SERVER_ROOT.'/sections/ajax/artist.php');
break;
diff --git a/sections/ajax/info.php b/sections/ajax/info.php
index 9acbc183..ab14c73d 100644
--- a/sections/ajax/info.php
+++ b/sections/ajax/info.php
@@ -3,51 +3,31 @@
//authorize(true);
-global $DB, $Cache;
-$HeavyInfo = $Cache->get_value('user_info_heavy_'.$UserID);
-
-$DB->query("SELECT
- m.Username,
- m.torrent_pass,
- i.AuthKey,
- Uploaded AS BytesUploaded,
- Downloaded AS BytesDownloaded,
- RequiredRatio,
- p.Level AS Class
- FROM users_main AS m
- INNER JOIN users_info AS i ON i.UserID=m.ID
- LEFT JOIN permissions AS p ON p.ID=m.PermissionID
- WHERE m.ID='$UserID'");
-
-list($Username,$torrent_pass,$AuthKey,$Uploaded,$Downloaded,$RequiredRatio,$Class) = $DB->next_record(MYSQLI_NUM, array(9,11));
-
//calculate ratio --Gwindow
//returns 0 for DNE and -1 for infiinity, because we dont want strings being returned for a numeric value in our java
-if($Uploaded == 0 && $Downloaded == 0) {
+if($LoggedUser['BytesUploaded'] == 0 && $LoggedUser['BytesDownloaded'] == 0) {
$Ratio = '0';
-} elseif($Downloaded == 0) {
+} elseif($LoggedUser['BytesDownloaded'] == 0) {
$Ratio = '-1';
} else {
- $Ratio = number_format(max($Uploaded/$Downloaded-0.005,0), 2); //Subtract .005 to floor to 2 decimals
+ $Ratio = number_format(max($LoggedUser['BytesUploaded']/$LoggedUser['BytesDownloaded']-0.005,0), 2); //Subtract .005 to floor to 2 decimals
}
-
-
print json_encode(
array(
'status' => 'success',
'response' => array(
- 'username' => $Username,
- 'id' => $UserID,
- 'authkey'=>$AuthKey,
- 'passkey'=>$torrent_pass,
+ 'username' => $LoggedUser['Username'],
+ 'id' => $LoggedUser['ID'],
+ 'authkey'=> $LoggedUser['AuthKey'],
+ 'passkey'=> $LoggedUser['torrent_pass'],
'userstats' => array(
- 'uploaded' => (int) $Uploaded,
- 'downloaded' => (int) $Downloaded,
- 'ratio' => (float) $Ratio,
- 'requiredratio' => (float) $RequiredRatio,
+ 'uploaded' => (int) $LoggedUser['BytesUploaded'],
+ 'downloaded' => (int) $LoggedUser['BytesDownloaded'],
+ 'ratio' => (float) $LoggedUser['Ratio'],
+ 'requiredratio' => (float) $LoggedUser['RequiredRatio'],
//'class' => $Class
- 'class' => $ClassLevels[$Class]['Name']
+ 'class' => $ClassLevels[$LoggedUser['Class']]['Name']
),
)
)
diff --git a/sections/requests/request.php b/sections/requests/request.php
index 4fcadb54..96f835ab 100644
--- a/sections/requests/request.php
+++ b/sections/requests/request.php
@@ -23,7 +23,7 @@
}
list($RequestID, $RequestorID, $RequestorName, $TimeAdded, $LastVote, $CategoryID, $Title, $Year, $Image, $Description, $CatalogueNumber, $RecordLabel, $ReleaseType,
- $BitrateList, $FormatList, $MediaList, $LogCue, $FillerID, $FillerName, $TorrentID, $TimeFilled) = $Request;
+ $BitrateList, $FormatList, $MediaList, $LogCue, $FillerID, $FillerName, $TorrentID, $TimeFilled, $GroupID) = $Request;
//Convenience variables
$IsFilled = !empty($TorrentID);
@@ -97,7 +97,7 @@
[Bookmark]
} ?>
[Report Request]
- [Upload Request]
+ ">[Upload Request]
if(!$IsFilled && (($CategoryID == 0) || ($CategoryName == "Music" && $Year == 0))) { ?>
[Request Update]
} ?>
diff --git a/sections/requests/requests.php b/sections/requests/requests.php
index b6a66aa5..09d77b42 100644
--- a/sections/requests/requests.php
+++ b/sections/requests/requests.php
@@ -481,7 +481,7 @@
// $Tags, $TimeAdded, $TimeFilled, $Title, $TorrentID, $RequestorID, $RequestorName, $Year, $RequestID, $Categoryid, $FillerID, $LastVote,
// $ReleaseType, $TagIDs, $TimeAdded, $TimeFilled, $TorrentID, $RequestorID, $Voters) = array_values($Request);
- list($RequestID, $RequestorID, $RequestorName, $TimeAdded, $LastVote, $CategoryID, $Title, $Year, $Image, $Description, $CatalogueNumber,
+ list($RequestID, $RequestorID, $RequestorName, $TimeAdded, $LastVote, $CategoryID, $Title, $Year, $Image, $Description, $CatalogueNumber, $RecordLabel,
$ReleaseType, $BitrateList, $FormatList, $MediaList, $LogCue, $FillerID, $FillerName, $TorrentID, $TimeFilled) = $Request;
$RequestVotes = get_votes_array($RequestID);
diff --git a/sections/staffpm/assign.php b/sections/staffpm/assign.php
index 60353a7a..c3322e42 100644
--- a/sections/staffpm/assign.php
+++ b/sections/staffpm/assign.php
@@ -48,8 +48,14 @@
// Assign to class
$DB->query("UPDATE staff_pm_conversations SET Status='Unanswered', Level=$NewLevel, AssignedToUser=NULL WHERE ID=$ConvID");
} else {
+ $UserInfo = user_info($NewLevel);
+ $Level = $Classes[$UserInfo['PermissionID']]['Level'];
+ if (!$Level) {
+ error("Assign to user not found.");
+ }
+
// Assign to user
- $DB->query("UPDATE staff_pm_conversations SET Status='Unanswered', AssignedToUser=$NewLevel WHERE ID=$ConvID");
+ $DB->query("UPDATE staff_pm_conversations SET Status='Unanswered', AssignedToUser=$NewLevel, Level=$Level WHERE ID=$ConvID");
}
echo '1';
diff --git a/sections/torrents/index.php b/sections/torrents/index.php
index 2e305b05..6015c3eb 100644
--- a/sections/torrents/index.php
+++ b/sections/torrents/index.php
@@ -260,7 +260,7 @@ function js_pages($Action, $TorrentID, $NumResults, $CurrentPage) {
WHERE tc.ID='".db_string($_POST['post'])."'");
list($OldBody, $AuthorID,$GroupID,$AddedTime)=$DB->next_record();
- $DB->query("SELECT ceil(COUNT(ID) / ".POSTS_PER_PAGE.") AS Page FROM torrents_comments WHERE GroupID = $GroupID AND ID <= $_POST[post]");
+ $DB->query("SELECT ceil(COUNT(ID) / ".TORRENT_COMMENTS_PER_PAGE.") AS Page FROM torrents_comments WHERE GroupID = $GroupID AND ID <= $_POST[post]");
list($Page) = $DB->next_record();
if ($LoggedUser['ID']!=$AuthorID && !check_perms('site_moderate_forums')) { error(404); }
@@ -321,14 +321,15 @@ function js_pages($Action, $TorrentID, $NumResults, $CurrentPage) {
$DB->query("DELETE FROM torrents_comments WHERE ID='".db_string($_GET['postid'])."'");
//We need to clear all subsequential catalogues as they've all been bumped with the absence of this post
- $ThisCatalogue = floor((POSTS_PER_PAGE*$Page-POSTS_PER_PAGE)/THREAD_CATALOGUE);
- $LastCatalogue = floor((POSTS_PER_PAGE*$Pages-POSTS_PER_PAGE)/THREAD_CATALOGUE);
+ $ThisCatalogue = floor((TORRENT_COMMENTS_PER_PAGE*$Page-TORRENT_COMMENTS_PER_PAGE)/THREAD_CATALOGUE);
+ $LastCatalogue = floor((TORRENT_COMMENTS_PER_PAGE*$Pages-TORRENT_COMMENTS_PER_PAGE)/THREAD_CATALOGUE);
for($i=$ThisCatalogue;$i<=$LastCatalogue;$i++) {
$Cache->delete('torrent_comments_'.$GroupID.'_catalogue_'.$i);
}
// Delete thread info cache (eg. number of pages)
$Cache->delete('torrent_comments_'.$GroupID);
+
break;
case 'regen_filelist' :
if(check_perms('users_mod') && !empty($_GET['torrentid']) && is_number($_GET['torrentid'])) {
diff --git a/sections/upload/upload.php b/sections/upload/upload.php
index 91618481..baac9ced 100644
--- a/sections/upload/upload.php
+++ b/sections/upload/upload.php
@@ -40,9 +40,10 @@
WHERE tt.GroupID='$_GET[groupid]'");
list($Properties['TagList']) = $DB->next_record();
-}
-
-if(empty($Properties) && !empty($_GET['requestid']) && is_number($_GET['requestid'])) {
+ if (!empty($_GET['requestid']) && is_number($_GET['requestid'])) {
+ $Properties['RequestID'] = $_GET['requestid'];
+ }
+} elseif (empty($Properties) && !empty($_GET['requestid']) && is_number($_GET['requestid'])) {
include(SERVER_ROOT.'/sections/requests/functions.php');
$DB->query("SELECT
r.ID AS RequestID,
diff --git a/sections/user/linkedfunctions.php b/sections/user/linkedfunctions.php
new file mode 100644
index 00000000..78e84b86
--- /dev/null
+++ b/sections/user/linkedfunctions.php
@@ -0,0 +1 @@
+
include_once(SERVER_ROOT.'/classes/class_text.php'); // Text formatting class
function link_users($UserID, $TargetID) {
global $DB;
authorize();
if (!check_perms('users_mod')) {
error(403);
}
if (!is_number($UserID) || !is_number($TargetID)) {
error(403);
}
if ($UserID == $TargetID) {
return;
}
$DB->query("SELECT 1 FROM users_main WHERE ID IN ($UserID, $TargetID)");
if ($DB->record_count() != 2) {
error(403);
}
$DB->query("SELECT GroupID FROM users_dupes WHERE UserID = $TargetID");
list($TargetGroupID) = $DB->next_record();
$DB->query("SELECT u.GroupID, d.Comments FROM users_dupes AS u JOIN dupe_groups AS d ON d.ID = u.GroupID WHERE UserID = $UserID");
list($UserGroupID, $Comments) = $DB->next_record();
if ($TargetGroupID) {
if ($TargetGroupID == $UserGroupID) {
return;
}
if ($UserGroupID) {
$DB->query("UPDATE users_dupes SET GroupID = $TargetGroupID WHERE GroupID = $UserGroupID");
$DB->query("UPDATE dupe_groups SET Comments = CONCAT('".db_string($Comments)."\n\n',Comments) WHERE ID = $TargetGroupID");
$DB->query("DELETE FROM dupe_groups WHERE ID = $UserGroupID");
} else {
$DB->query("INSERT INTO users_dupes (UserID, GroupID) VALUES ($UserID, $TargetGroupID)");
}
} elseif ($UserGroupID) {
$DB->query("INSERT INTO users_dupes (UserID, GroupID) VALUES ($TargetID, $UserGroupID)");
} else {
$DB->query("INSERT INTO dupe_groups () VALUES ()");
$GroupID = $DB->inserted_id();
$DB->query("INSERT INTO users_dupes (UserID, GroupID) VALUES ($TargetID, $GroupID)");
$DB->query("INSERT INTO users_dupes (UserID, GroupID) VALUES ($UserID, $GroupID)");
}
}
function unlink_user($UserID) {
global $DB;
authorize();
if (!check_perms('users_mod')) {
error(403);
}
if (!is_number($UserID)) {
error(403);
}
$DB->query("DELETE FROM users_dupes WHERE UserID='$UserID'");
$DB->query("DELETE g.* FROM dupe_groups AS g LEFT JOIN users_dupes AS u ON u.GroupID = g.ID WHERE u.GroupID IS NULL");
}
function delete_dupegroup($GroupID) {
global $DB;
authorize();
if (!check_perms('users_mod')) {
error(403);
}
if (!is_number($GroupID)) {
error(403);
}
$DB->query("DELETE FROM dupe_groups WHERE ID = '$GroupID'");
}
function dupe_comments($GroupID, $Comments) {
global $DB, $Text;
authorize();
if (!check_perms('users_mod')) {
error(403);
}
if (!is_number($GroupID)) {
error(403);
}
$DB->query("UPDATE dupe_groups SET Comments = '".db_string($Comments)."' WHERE ID = '$GroupID'");
}
function user_dupes_table($UserID) {
global $DB, $LoggedUser;
$Text = new TEXT;
if (!check_perms('users_mod')) {
error(403);
}
if (!is_number($UserID)) {
error(403);
}
$DB->query("SELECT d.ID, d.Comments
FROM dupe_groups AS d
JOIN users_dupes AS u ON u.GroupID = d.ID
WHERE u.UserID = $UserID");
if (list($GroupID, $Comments) = $DB->next_record()) {
$DB->query("SELECT m.ID
FROM users_main AS m
JOIN users_dupes AS d ON m.ID = d.UserID
WHERE d.GroupID = $GroupID
ORDER BY m.ID = $UserID DESC");
$DupeCount = $DB->record_count();
$Dupes = $DB->to_array();
} else {
$DupeCount = 0;
$Dupes = array();
}
?>
=max($DupeCount - 1, 0)?> Linked Account=(($DupeCount == 2)?'':'s')?>
(View)
if ($DupeCount > 0) {
?>
$i = 0;
foreach ($Dupes as $Dupe) {
$i++;
list($DupeID) = $Dupe;
$DupeInfo = user_info($DupeID);
?>
=format_username($DupeID, $DupeInfo['Username'], $DupeInfo['Donor'], $DupeInfo['Warned'], $DupeInfo['Enabled'])?>
(x) |
if ($i == 5) {
$i = 0;
echo "
";
}
}
for ($j = $i; $j < 5; $j++) {
echo ' | ';
}
?>
Comments: |
(Edit linked account comments)
|
}
?>
}
?>
\ No newline at end of file
diff --git a/sections/user/manage_linked.php b/sections/user/manage_linked.php
new file mode 100644
index 00000000..e1e26820
--- /dev/null
+++ b/sections/user/manage_linked.php
@@ -0,0 +1 @@
+
authorize();
include(SERVER_ROOT.'/sections/user/linkedfunctions.php');
if (!check_perms('users_mod')) {
error(403);
}
$UserID = $_REQUEST['userid'];
switch ($_REQUEST['dupeaction']) {
case 'remove':
unlink_user($_REQUEST['removeid']);
break;
case 'add':
$Target = $_REQUEST['target'];
$DB->query("SELECT ID FROM users_main WHERE Username LIKE '".db_string($Target)."'");
if (list($TargetID) = $DB->next_record()) {
link_users($UserID, $TargetID);
} else {
error("User '$Target' not found.");
}
break;
case 'comments':
dupe_comments($_REQUEST['groupid'], $_REQUEST['dupecomments']);
break;
default:
error(403);
}
echo '\o/';
header("Location: user.php?id=$UserID");
?>
\ No newline at end of file
diff --git a/sections/user/user.php b/sections/user/user.php
index 576b6e73..692fd089 100644
--- a/sections/user/user.php
+++ b/sections/user/user.php
@@ -715,6 +715,13 @@ function check_paranoia_here($Setting) {
}
+
+// Linked accounts
+if(check_perms('users_mod')) {
+ include(SERVER_ROOT.'/sections/user/linkedfunctions.php');
+ user_dupes_table($UserID);
+}
+
if ((check_perms('users_view_invites')) && $Invited > 0) {
include(SERVER_ROOT.'/classes/class_invite_tree.php');
$Tree = new INVITE_TREE($UserID, array('visible'=>false));