Empty commit

This commit is contained in:
Git 2013-07-19 08:00:28 +00:00
parent ddbdda3a43
commit 133b188d6b
6 changed files with 36 additions and 10 deletions

View File

@ -21,6 +21,23 @@ function is_number($Str) {
}
}
/**
* Check that some given variables (usually in _GET or _POST) are numbers
*
* @param array $Base Array that's supposed to contain all keys to check
* @param array $Keys list of keys to check
* @param mixed $Error error code or string to pass to the error() function if a key isn't numeric
*/
function assert_numbers(&$Base, $Keys, $Error = 0) {
if (!is_array($Base) || !is_array($Keys)) {
return;
}
foreach ($Keys as $Key) {
if (empty($Base[$Key]) || !is_number($Base[$Key])) {
error($Error);
}
}
}
/**
* HTML-escape a string for output.

View File

@ -51,6 +51,7 @@
'blogId' => (int) $BlogID,
'author' => $Author,
'title' => $Title,
'bbBody' => $Body,
'body' => $Text->full_format($Body),
'blogTime' => $BlogTime,
'threadId' => (int) $ThreadID
@ -68,6 +69,7 @@
$JsonAnnouncements[] = array(
'newsId' => (int) $NewsID,
'title' => $Title,
'bbBody' => $Body,
'body' => $Text->full_format($Body),
'newsTime' => $NewsTime
);

View File

@ -135,35 +135,42 @@ function compare($X, $Y) {
<?
}
//Get list of used release types
// Deal with torrents without release types, which can end up here
// if they're uploaded with a non-grouping category id
$UnknownRT = array_search('Unknown', $ReleaseTypes);
if ($UnknownRT === false) {
$UnknownRT = 1025;
$ReleaseTypes[$UnknownRT] = 'Unknown';
}
// Get list of used release types
$UsedReleases = array();
foreach ($Importances as $ID => $Group) {
switch ($Importances[$ID]['Importance']) {
case '2':
$Importances[$ID]['ReleaseType'] = 1024;
//$TorrentList[$GroupID]['ReleaseType'] = 1024;
$GuestAlbums = true;
break;
case '3':
$Importances[$ID]['ReleaseType'] = 1023;
//$TorrentList[$GroupID]['ReleaseType'] = 1023;
$RemixerAlbums = true;
break;
case '4':
$Importances[$ID]['ReleaseType'] = 1022;
//$TorrentList[$GroupID]['ReleaseType'] = 1022;
$ComposerAlbums = true;
break;
case '7':
$Importances[$ID]['ReleaseType'] = 1021;
//$TorrentList[$GroupID]['ReleaseType'] = 1021;
$ProducerAlbums = true;
break;
default:
if (!isset($ReleaseTypes[$TorrentList[$Group['GroupID']]['ReleaseType']])) {
$TorrentList[$Group['GroupID']]['ReleaseType'] = $UnknownRT;
}
$Importances[$ID]['ReleaseType'] = $TorrentList[$Group['GroupID']]['ReleaseType'];
}

View File

@ -51,7 +51,7 @@
$DB->query("
UPDATE collages
SET Featured = 0
WHERE CategoryID = 0 \
WHERE CategoryID = 0
AND UserID = $UserID");
$Updates[] = 'Featured = 1';
}

View File

@ -66,7 +66,7 @@
$_REQUEST['username'] = '';
}
if ($_POST['invite']) {
if ($_REQUEST['invite']) {
$DB->query("
SELECT InviterID, Email
FROM invites

View File

@ -2,12 +2,12 @@
if ($Message = db_string($_POST['message'])) {
if ($Subject = db_string($_POST['subject'])) {
// New staff PM conversation
$Level = db_string($_POST['level']);
assert_numbers($_POST, array('level'), 'Invalid recipient');
$DB->query("
INSERT INTO staff_pm_conversations
(Subject, Status, Level, UserID, Date)
VALUES
('$Subject', 'Unanswered', $Level, ".$LoggedUser['ID'].", '".sqltime()."')"
('$Subject', 'Unanswered', $_POST[level], $LoggedUser[ID], '".sqltime()."')"
);
// New message
@ -16,7 +16,7 @@
INSERT INTO staff_pm_messages
(UserID, SentDate, Message, ConvID)
VALUES
(".$LoggedUser['ID'].", '".sqltime()."', '$Message', $ConvID)"
($LoggedUser[ID], '".sqltime()."', '$Message', $ConvID)"
);
header('Location: staffpm.php');