Empty commit

This commit is contained in:
Git 2013-10-22 08:01:07 +00:00
parent ff177b33a7
commit 2473fb6261
13 changed files with 92 additions and 83 deletions

View File

@ -168,7 +168,7 @@ public static function process($Url, $Thumb = false) {
if (empty($Url)) {
return '';
}
if (($Found = self::get_stored($Url . ($Thumb ? '_thumb' : '')))) {
if ($Found = self::get_stored($Url . ($Thumb ? '_thumb' : ''))) {
return $Found;
}

View File

@ -45,7 +45,6 @@ private static function get_selected_link($String, $Selected) {
public static function render_artist_tile($Artist, $Category) {
if (self::is_valid_artist($Artist)) {
switch ($Category) {
case 'weekly':
case 'hyped':
self::render_tile("artist.php?artistname=", $Artist['name'], $Artist['image'][3]['#text']);

View File

@ -29,7 +29,7 @@ function invisible($Image) {
$Color = imagecolorsforindex($Image, $i);
$TotalAlpha += $Color['alpha'];
}
return (($TotalAlpha/$Count) == 127) ? true : false;
return (($TotalAlpha / $Count) == 127) ? true : false;
}

View File

@ -1,6 +1,6 @@
<?
// Main image proxy page
// The image proxy does not use script_start.php, its code instead resides entirely in image.php in the document root
// The image proxy does not use script_start.php. Its code, instead, resides entirely in image.php in the document root
// Bear this in mind when you try to use script_start functions.
if (!check_perms('site_proxy_images')) {
@ -12,22 +12,22 @@
img_error('badprotocol');
}
if (!preg_match('/^'.IMAGE_REGEX.'/is',$URL,$Matches)) {
if (!preg_match('/^'.IMAGE_REGEX.'/is', $URL, $Matches)) {
img_error('invalid');
}
if (isset($_GET['c'])) {
list($Data,$Type) = $Cache->get_value('image_cache_'.md5($URL));
list($Data, $Type) = $Cache->get_value('image_cache_'.md5($URL));
$Cached = true;
}
if (!isset($Data) || !$Data) {
$Cached = false;
$Data = @file_get_contents($URL,0,stream_context_create(array('http'=>array('timeout'=>15))));
$Data = @file_get_contents($URL, 0, stream_context_create(array('http' => array('timeout' => 15))));
if (!$Data || empty($Data)) {
img_error('timeout');
}
$Type = image_type($Data);
if ($Type && function_exists('imagecreatefrom'.$Type)) {
if ($Type && function_exists("imagecreatefrom$Type")) {
$Image = imagecreatefromstring($Data);
if (invisible($Image)) {
img_error('invisible');
@ -38,7 +38,7 @@
}
if (isset($_GET['c']) && strlen($Data) < 262144) {
$Cache->cache_value('image_cache_'.md5($URL), array($Data,$Type), 3600 * 24 * 7);
$Cache->cache_value('image_cache_'.md5($URL), array($Data, $Type), 3600 * 24 * 7);
}
}
@ -53,7 +53,7 @@
if (strlen($Data) > 256 * 1024 || $Height > 400) {
// Sometimes the cached image we have isn't the actual image
if ($Cached) {
$Data2 = @file_get_contents($URL,0,stream_context_create(array('http'=>array('timeout'=>15))));
$Data2 = @file_get_contents($URL, 0, stream_context_create(array('http' => array('timeout' => 15))));
} else {
$Data2 = $Data;
}
@ -63,20 +63,22 @@
$DBURL = db_string($URL);
// Reset avatar, add mod note
$UserInfo = $Cache->get_value('user_info_'.$UserID);
$UserInfo = $Cache->get_value("user_info_$UserID");
$UserInfo['Avatar'] = '';
$Cache->cache_value('user_info_'.$UserID, $UserInfo, 2592000);
$Cache->cache_value("user_info_$UserID", $UserInfo, 2592000);
$DB->query("
UPDATE users_info
SET Avatar='', AdminComment=CONCAT('".sqltime()." - Avatar reset automatically (Size: ".number_format((strlen($Data)) / 1024)." kB, Height: ".$Height."px). Used to be $DBURL\n\n', AdminComment)
WHERE UserID='$UserID'");
SET
Avatar = '',
AdminComment = CONCAT('".sqltime()." - Avatar reset automatically (Size: ".number_format((strlen($Data)) / 1024)." kB, Height: ".$Height."px). Used to be $DBURL\n\n', AdminComment)
WHERE UserID = '$UserID'");
// Send PM
Misc::send_pm($UserID,0,"Your avatar has been automatically reset","The following avatar rules have been in effect for months now:
Misc::send_pm($UserID, 0, "Your avatar has been automatically reset", SITE_NAME." has the following requirements for avatars:
[b]Avatars must not exceed 256 kB or be vertically longer than 400px. [/b]
[b]Avatars must not exceed 256 kB or be vertically longer than 400 px.[/b]
Your avatar at $DBURL has been found to exceed these rules. As such, it has been automatically reset. You are welcome to reinstate your avatar once it has been resized down to an acceptable size.");
@ -92,7 +94,7 @@
}
*/
if (isset($Type)) {
header('Content-type: image/'.$Type);
header("Content-type: image/$Type");
}
echo $Data;
?>

View File

@ -10,10 +10,16 @@
$UserIDSQL = " AND UserID != '$UserID' ";
}
G::$DB->query("SELECT UserID, Answer, Date FROM staff_answers WHERE QuestionID = '$ID' $UserIDSQL ORDER BY DATE DESC");
G::$DB->query("
SELECT UserID, Answer, Date
FROM staff_answers
WHERE QuestionID = '$ID'
$UserIDSQL
ORDER BY DATE DESC");
$Answers = G::$DB->to_array(false, MYSQLI_ASSOC);
foreach($Answers as $Answer) { ?>
foreach($Answers as $Answer) {
?>
<div class="box box2">
<div class="head">
<span>
@ -21,7 +27,9 @@
</span>
</div>
<div class="pad">
<?=$Text->full_format($Answer['Answer'])?>
<?= $Text->full_format($Answer['Answer'])?>
</div>
</div>
<? } ?>
<?
}
?>

View File

@ -19,7 +19,6 @@
View::show_header("Ask the Staff");
?>
<div class="thin">
<h2>
Answer Question
@ -36,7 +35,7 @@
</span>
</div>
<div class="pad">
<?=$Text->full_format($Question['Question'])?>
<?= $Text->full_format($Question['Question'])?>
</div>
</div>
<div class="center box pad">
@ -51,6 +50,5 @@
</form>
</div>
</div>
<?
View::show_footer();

View File

@ -16,7 +16,6 @@
View::show_header("Ask the Staff");
?>
<div class="thin">
<div class="header">
<h2>Staff Answers</h2>
@ -36,6 +35,5 @@
</h2>
<? } ?>
</div>
<?
View::show_footer();

View File

@ -1,8 +1,6 @@
<?
View::show_header("Ask the Staff");
?>
<div class="thin">
<div class="header">
<h2>Ask Staff Anything</h2>
@ -21,6 +19,5 @@
</form>
</div>
</div>
<?
View::show_footer();
View::show_footer();

View File

@ -25,7 +25,6 @@
View::show_header("Ask the Staff");
?>
<div class="thin">
<h2>
Edit Answer
@ -35,7 +34,7 @@
<a class="brackets" href="questions.php?action=answers">View staff answers</a>
<a class="brackets" href="questions.php?action=popular_questions">Popular questions</a>
</div>
<form method="post" class="box box2 center">
<form method="post" class="box box2 center" action="">
<input type="hidden" name="action" value="take_edit_answer" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="id" value="<?=$ID?>" />
@ -44,6 +43,5 @@
<input type="submit" class="submit" value="Answer" />
</form>
</div>
<?
View::show_footer();

View File

@ -3,13 +3,20 @@
$Text = new TEXT(true);
G::$DB->query("
SELECT
q.ID, q.Question, q.UserID, q.Date AS QuestionDate,
(SELECT COUNT(1) FROM staff_answers WHERE QuestionID = q.ID) AS Responses
FROM user_questions AS q
JOIN staff_answers AS a ON q.ID = a.QuestionID
GROUP BY q.ID
ORDER BY Responses DESC");
SELECT
q.ID,
q.Question,
q.UserID,
q.Date AS QuestionDate,
(
SELECT COUNT(1)
FROM staff_answers
WHERE QuestionID = q.ID
) AS Responses
FROM user_questions AS q
JOIN staff_answers AS a ON q.ID = a.QuestionID
GROUP BY q.ID
ORDER BY Responses DESC");
$Questions = G::$DB->to_array();
@ -35,26 +42,24 @@
<a class="post_id" href="questions.php?action=popular_questions#question<?=$Question['ID']?>">#<?=$Question['ID']?></a>
Question by <?=Users::format_username($Question['UserID'])?> - <?=time_diff($Question['QuestionDate'])?>
</span>
<span style="float: right;">
<a href="#" id="<?=$Question['ID']?>" class="view_responses brackets"><?=$Question['Responses'] == 1 ? ("View " . $Question['Responses'] . " response") : ("View " . $Question['Responses'] . " responses")?></a>
<? if (check_perms("users_mod")) { ?>
<? if (check_perms("users_mod")) { ?>
-
<form class="hidden" id="delete_<?=$Question['ID']?>" method="POST">
<form class="hidden" id="delete_<?=$Question['ID']?>" method="post" action="">
<input type="hidden" name="action" value="take_remove_answer" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="question_id" value="<?=$Question['ID']?>" />
</form>
<a href="#" onclick="if (confirm('Are you sure?') == true) { $('#delete_<?=$Question['ID']?>').raw().submit(); } return false;" class="brackets">Delete</a>
<? } ?>
<? } ?>
</span>
</div>
<div class="pad">
<?=$Text->full_format($Question['Question'])?>
<?= $Text->full_format($Question['Question'])?>
</div>
</div>
<? } ?>
</div>
<?
View::show_footer();
View::show_footer();

View File

@ -40,13 +40,12 @@
View::show_header("Ask the Staff", "questions");
?>
<div class="thin">
<div class="header">
<h2>
User Questions
<span style="float: right;">
<?=$TotalQuestions?> questions asked, <?=count($Questions)?> left to answer
<?=$TotalQuestions?> questions asked, <?=count($Questions)?> left to answer
</span>
</h2>
</div>
@ -66,14 +65,14 @@
<a href="#" id="<?=$Question['ID']?>" class="view_responses brackets"><?=$Question['Responses'] == 1 ? ("View " . $Question['Responses'] . " response") : ("View " . $Question['Responses'] . " responses")?></a>
-
<? } ?>
<form class="hidden" id="delete_<?=$Question['ID']?>" method="post">
<form class="hidden" id="delete_<?=$Question['ID']?>" method="post" action="">
<input type="hidden" name="action" value="take_remove_question" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="question_id" value="<?=$Question['ID']?>" />
</form>
<a href="#" onclick="if (confirm('Are you sure?') == true) { $('#delete_<?=$Question['ID']?>').raw().submit(); } return false;" class="brackets">Delete</a>
-
<form class="hidden" id="ignore_<?=$Question['ID']?>" method="post">
<form class="hidden" id="ignore_<?=$Question['ID']?>" method="post" action="">
<input type="hidden" name="action" value="take_ignore_question" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="question_id" value="<?=$Question['ID']?>" />
@ -93,6 +92,5 @@
</div>
<? } ?>
</div>
<?
View::show_footer();

View File

@ -9,6 +9,10 @@
error(403);
}
$DB->query("UPDATE staff_answers SET Answer = '$Answer' WHERE QuestionID = '$ID' AND UserID = '$UserID'");
$DB->query("
UPDATE staff_answers
SET Answer = '$Answer'
WHERE QuestionID = '$ID'
AND UserID = '$UserID'");
header("Location: questions.php?action=view_answers&userid=$UserID");
header("Location: questions.php?action=view_answers&userid=$UserID");

View File

@ -55,37 +55,39 @@
<a class="brackets" href="questions.php?action=popular_questions">Popular questions</a>
</div>
<? foreach($Questions as $Question) { ?>
<div id="question<?=$Question['ID']?>" class="box box2">
<div class="head">
<span>
<a class="post_id" href="questions.php?action=view_answers&amp;userid=<?=$UserID?>#question<?=$Question['ID']?>">#<?=$Question['ID']?></a>
Question by <?=Users::format_username($Question['UserID'])?> - <?=time_diff($Question['QuestionDate'])?>
</span>
<span style="float: right;">
<? if ($Question['Responses'] > 0) { ?>
<a href="#" data-gazelle-userid="<?=$UserID?>" id="<?=$Question['ID']?>" class="view_responses brackets"><?=$Question['Responses'] == 1 ? ("View " . $Question['Responses'] . " other response") : ("View " . $Question['Responses'] . " other responses")?></a>
-
<? } ?>
<? if (check_perms("users_mod")) { ?>
<form class="hidden" id="delete_<?=$Question['ID']?>" method="post">
<input type="hidden" name="action" value="take_remove_answer" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="question_id" value="<?=$Question['ID']?>" />
</form>
<a href="#" onclick="if (confirm('Are you sure?') == true) { $('#delete_<?=$Question['ID']?>').raw().submit(); } return false;" class="brackets">Delete</a>
<? } ?>
<? if ($LoggedUser['ID'] == $UserID) { ?>
<a href="questions.php?action=edit&amp;id=<?=$Question['ID']?>&amp;userid=<?=$UserID?>" class="brackets">Edit</a>
<? } ?>
</span>
</div>
<div class="pad">
<?=$Text->full_format("[quote=" . $Question['Username'] . "]". $Question['Question'] . "[/quote]\n". $Question['Answer'])?>
</div>
<div id="question<?=$Question['ID']?>" class="box box2">
<div class="head">
<span>
<a class="post_id" href="questions.php?action=view_answers&amp;userid=<?=$UserID?>#question<?=$Question['ID']?>">#<?=$Question['ID']?></a>
Question by <?=Users::format_username($Question['UserID'])?> - <?=time_diff($Question['QuestionDate'])?>
</span>
<span style="float: right;">
<? if ($Question['Responses'] > 0) { ?>
<a href="#" data-gazelle-userid="<?=$UserID?>" id="<?=$Question['ID']?>" class="view_responses brackets"><?=$Question['Responses'] == 1 ? ("View " . $Question['Responses'] . " other response") : ("View " . $Question['Responses'] . " other responses")?></a>
-
<?
}
if (check_perms("users_mod")) {
?>
<form class="hidden" id="delete_<?=$Question['ID']?>" method="post">
<input type="hidden" name="action" value="take_remove_answer" />
<input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
<input type="hidden" name="question_id" value="<?=$Question['ID']?>" />
</form>
<a href="#" onclick="if (confirm('Are you sure?') == true) { $('#delete_<?=$Question['ID']?>').raw().submit(); } return false;" class="brackets">Delete</a>
<?
}
if ($LoggedUser['ID'] == $UserID) {
?>
<a href="questions.php?action=edit&amp;id=<?=$Question['ID']?>&amp;userid=<?=$UserID?>" class="brackets">Edit</a>
<? } ?>
</span>
</div>
<div class="pad">
<?= $Text->full_format("[quote=" . $Question['Username'] . "]". $Question['Question'] . "[/quote]\n". $Question['Answer'])?>
</div>
</div>
<? } ?>
</div>
<?
View::show_footer();