mirror of
https://github.com/WhatCD/Gazelle.git
synced 2024-12-12 18:36:29 +00:00
Empty commit
This commit is contained in:
parent
2fba8339e7
commit
3eb2d57e23
@ -20,7 +20,9 @@ function time_ago($TimeStamp) {
|
||||
* Returns a <span> by default but can optionally return the raw time
|
||||
* difference in text (e.g. "16 hours and 28 minutes", "1 day, 18 hours").
|
||||
*/
|
||||
function time_diff($TimeStamp, $Levels = 2, $Span = true, $Lowercase = false) {
|
||||
function time_diff($TimeStamp, $Levels = 2, $Span = true, $Lowercase = false, $StartTime = false) {
|
||||
$StartTime = ($StartTime === false) ? time() : strtotime($StartTime);
|
||||
|
||||
if (!is_number($TimeStamp)) { // Assume that $TimeStamp is SQL timestamp
|
||||
if ($TimeStamp == '0000-00-00 00:00:00') {
|
||||
return 'Never';
|
||||
@ -30,7 +32,7 @@ function time_diff($TimeStamp, $Levels = 2, $Span = true, $Lowercase = false) {
|
||||
if ($TimeStamp == 0) {
|
||||
return 'Never';
|
||||
}
|
||||
$Time = time() - $TimeStamp;
|
||||
$Time = $StartTime - $TimeStamp;
|
||||
|
||||
// If the time is negative, then it expires in the future.
|
||||
if ($Time < 0) {
|
||||
|
@ -289,6 +289,9 @@
|
||||
<li id="nav_friends"<?=
|
||||
Format::add_class($PageID, array('friends'), 'active', true)?>>
|
||||
<a href="friends.php">Friends</a></li>
|
||||
<li id="nav_better"<?=
|
||||
Format::add_class($PageID, array('better'), 'active', true)?>>
|
||||
<a href="better.php">Better</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="menu">
|
||||
|
@ -1,5 +1,8 @@
|
||||
CHANGE LOG
|
||||
|
||||
2016-01-23 by newman
|
||||
Add confirmation for deleting poll options. Don't load all news and blogs when editing one. Don't load all news when writing a new post, instead load 5 and add the "click to view more" link, similar to the homepage. Add "Replies" column to staffpm.php and Staff PMs on user profiles. Add better.php header link
|
||||
|
||||
2016-01-19 by newman
|
||||
Fix PRs 93 and 91
|
||||
|
||||
|
@ -139,6 +139,8 @@
|
||||
<br />
|
||||
<?
|
||||
}
|
||||
|
||||
if ($_GET['action'] != 'editblog') {
|
||||
?>
|
||||
<div class="thin">
|
||||
<?
|
||||
@ -198,6 +200,7 @@
|
||||
<br />
|
||||
<?
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?
|
||||
|
@ -338,7 +338,7 @@
|
||||
<li>
|
||||
<a href="forums.php?action=change_vote&threadid=<?=$ThreadID?>&auth=<?=$LoggedUser['AuthKey']?>&vote=<?=(int)$i?>"><?=display_str($Answer == '' ? 'Blank' : $Answer)?></a>
|
||||
- <?=$StaffVotes[$i]?> (<?=number_format(((float)$Votes[$i] / $TotalVotes) * 100, 2)?>%)
|
||||
<a href="forums.php?action=delete_poll_option&threadid=<?=$ThreadID?>&auth=<?=$LoggedUser['AuthKey']?>&vote=<?=(int)$i?>" class="brackets tooltip" title="Delete poll option">X</a>
|
||||
<a href="forums.php?action=delete_poll_option&threadid=<?=$ThreadID?>&auth=<?=$LoggedUser['AuthKey']?>&vote=<?=(int)$i?>" onclick="return confirm('Are you sure you want to delete this poll option?');" class="brackets tooltip" title="Delete poll option">X</a>
|
||||
</li>
|
||||
<? } ?>
|
||||
<li>
|
||||
|
@ -488,7 +488,7 @@
|
||||
?>
|
||||
<div id="more_news" class="box">
|
||||
<div class="head">
|
||||
<em><span><a href="#" onclick="news_ajax(event, 3, <?=$NewsCount?>, <?=check_perms('admin_manage_news') ? 1 : 0; ?>); return false;">Click to load more news</a>.</span> To browse old news posts, <a href="forums.php?action=viewforum&forumid=19">click here</a>.</em>
|
||||
<em><span><a href="#" onclick="news_ajax(event, 3, <?=$NewsCount?>, <?=check_perms('admin_manage_news') ? 1 : 0; ?>, false); return false;">Click to load more news</a>.</span> To browse old news posts, <a href="forums.php?action=viewforum&forumid=19">click here</a>.</em>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -64,18 +64,21 @@
|
||||
$StaffPMs = $DB->query("
|
||||
SELECT
|
||||
SQL_CALC_FOUND_ROWS
|
||||
ID,
|
||||
Subject,
|
||||
UserID,
|
||||
Status,
|
||||
Level,
|
||||
AssignedToUser,
|
||||
Date,
|
||||
Unread,
|
||||
ResolverID
|
||||
FROM staff_pm_conversations
|
||||
spc.ID,
|
||||
spc.Subject,
|
||||
spc.UserID,
|
||||
spc.Status,
|
||||
spc.Level,
|
||||
spc.AssignedToUser,
|
||||
spc.Date,
|
||||
spc.Unread,
|
||||
COUNT(spm.ID) AS NumReplies,
|
||||
spc.ResolverID
|
||||
FROM staff_pm_conversations AS spc
|
||||
JOIN staff_pm_messages spm ON spm.ConvID = spc.ID
|
||||
$WhereCondition
|
||||
ORDER BY $SortStr Level DESC, Date DESC
|
||||
GROUP BY spc.ID
|
||||
ORDER BY $SortStr spc.Level DESC, spc.Date DESC
|
||||
LIMIT $Limit
|
||||
");
|
||||
|
||||
@ -146,6 +149,7 @@
|
||||
<td>Sender</td>
|
||||
<td>Date</td>
|
||||
<td>Assigned to</td>
|
||||
<td>Replies</td>
|
||||
<? if ($ViewString == 'Resolved') { ?>
|
||||
<td>Resolved by</td>
|
||||
<? } ?>
|
||||
@ -153,7 +157,7 @@
|
||||
<?
|
||||
|
||||
// List messages
|
||||
while (list($ID, $Subject, $UserID, $Status, $Level, $AssignedToUser, $Date, $Unread, $ResolverID) = $DB->next_record()) {
|
||||
while (list($ID, $Subject, $UserID, $Status, $Level, $AssignedToUser, $Date, $Unread, $NumReplies, $ResolverID) = $DB->next_record()) {
|
||||
$Row = $Row === 'a' ? 'b' : 'a';
|
||||
$RowClass = "row$Row";
|
||||
|
||||
@ -192,6 +196,7 @@
|
||||
<td><?=$UserStr?></td>
|
||||
<td><?=time_diff($Date, 2, true)?></td>
|
||||
<td><?=$Assigned?></td>
|
||||
<td><?=$NumReplies - 1?></td>
|
||||
<? if ($ViewString == 'Resolved') { ?>
|
||||
<td><?=$ResolverStr?></td>
|
||||
<? } ?>
|
||||
|
@ -47,6 +47,7 @@ <h1 class="hidden">Gazelle</h1>
|
||||
<li id="nav_subscriptions"><a href="#">Subscriptions</a></li>
|
||||
<li id="nav_comments"><a href="#">Comments</a></li>
|
||||
<li id="nav_friends"><a href="#">Friends</a></li>
|
||||
<li id="nav_better"><a href="#">Better</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="menu">
|
||||
|
@ -3,8 +3,8 @@
|
||||
if (!check_perms('admin_manage_news')) {
|
||||
error(403);
|
||||
}
|
||||
|
||||
View::show_header('Manage news', 'bbcode');
|
||||
$NewsCount = 5;
|
||||
View::show_header('Manage news', 'bbcode,news_ajax');
|
||||
|
||||
switch ($_GET['action']) {
|
||||
case 'takeeditnews':
|
||||
@ -58,7 +58,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<? if ($_GET['action'] != 'editnews') { ?>
|
||||
<h2>News archive</h2>
|
||||
<?
|
||||
$DB->query('
|
||||
@ -68,7 +68,9 @@
|
||||
Body,
|
||||
Time
|
||||
FROM news
|
||||
ORDER BY Time DESC');// LIMIT 20
|
||||
ORDER BY Time DESC
|
||||
LIMIT ' . $NewsCount);// LIMIT 20
|
||||
$Count = 0;
|
||||
while (list($NewsID, $Title, $Body, $NewsTime) = $DB->next_record()) {
|
||||
?>
|
||||
<div class="box vertical_space news_post">
|
||||
@ -79,6 +81,16 @@
|
||||
</div>
|
||||
<div class="pad"><?=Text::full_format($Body) ?></div>
|
||||
</div>
|
||||
<?
|
||||
if (++$Count > ($NewsCount - 1)) {
|
||||
break;
|
||||
}
|
||||
} ?>
|
||||
<div id="more_news" class="box">
|
||||
<div class="head">
|
||||
<em><span><a href="#" onclick="news_ajax(event, 3, <?=$NewsCount?>, 1, '<?=$LoggedUser['AuthKey']?>'); return false;">Click to load more news</a>.</span></em>
|
||||
</div>
|
||||
</div>
|
||||
<? } ?>
|
||||
</div>
|
||||
<? View::show_footer();?>
|
||||
|
@ -883,17 +883,20 @@ function check_paranoia_here($Setting) {
|
||||
$DB->query("
|
||||
SELECT
|
||||
SQL_CALC_FOUND_ROWS
|
||||
ID,
|
||||
Subject,
|
||||
Status,
|
||||
Level,
|
||||
AssignedToUser,
|
||||
Date,
|
||||
ResolverID
|
||||
FROM staff_pm_conversations
|
||||
WHERE UserID = $UserID
|
||||
AND (Level <= $UserLevel OR AssignedToUser = '".$LoggedUser['ID']."')
|
||||
ORDER BY Date DESC");
|
||||
spc.ID,
|
||||
spc.Subject,
|
||||
spc.Status,
|
||||
spc.Level,
|
||||
spc.AssignedToUser,
|
||||
spc.Date,
|
||||
COUNT(spm.ID) AS Resplies,
|
||||
spc.ResolverID
|
||||
FROM staff_pm_conversations AS spc
|
||||
JOIN staff_pm_messages spm ON spm.ConvID = spc.ID
|
||||
WHERE spc.UserID = $UserID
|
||||
AND (spc.Level <= $UserLevel OR spc.AssignedToUser = '".$LoggedUser['ID']."')
|
||||
GROUP BY spc.ID
|
||||
ORDER BY spc.Date DESC");
|
||||
if ($DB->has_results()) {
|
||||
$StaffPMs = $DB->to_array();
|
||||
?>
|
||||
@ -906,11 +909,12 @@ function check_paranoia_here($Setting) {
|
||||
<td>Subject</td>
|
||||
<td>Date</td>
|
||||
<td>Assigned to</td>
|
||||
<td>Replies</td>
|
||||
<td>Resolved by</td>
|
||||
</tr>
|
||||
<?
|
||||
foreach ($StaffPMs as $StaffPM) {
|
||||
list($ID, $Subject, $Status, $Level, $AssignedToUser, $Date, $ResolverID) = $StaffPM;
|
||||
list($ID, $Subject, $Status, $Level, $AssignedToUser, $Date, $Replies, $ResolverID) = $StaffPM;
|
||||
// Get assigned
|
||||
if ($AssignedToUser == '') {
|
||||
// Assigned to class
|
||||
@ -936,6 +940,7 @@ function check_paranoia_here($Setting) {
|
||||
<td><a href="staffpm.php?action=viewconv&id=<?=$ID?>"><?=display_str($Subject)?></a></td>
|
||||
<td><?=time_diff($Date, 2, true)?></td>
|
||||
<td><?=$Assigned?></td>
|
||||
<td><?=$Replies - 1?></td>
|
||||
<td><?=$Resolver?></td>
|
||||
</tr>
|
||||
<? } ?>
|
||||
|
@ -1,9 +1,10 @@
|
||||
function news_ajax(event, count, offset, privileged) {
|
||||
function news_ajax(event, count, offset, privileged, authkey) {
|
||||
/*
|
||||
* event - The click event, passed to hide the element when necessary.
|
||||
* count - Number of news items to fetch.
|
||||
* offset - Database offset for fetching news.
|
||||
* privilege - Gotta check your privilege (used to show/hide [Edit] on news).
|
||||
* authkey - Either the user's authkey or false. Used for rendering the [Delete] button on the news tool.
|
||||
*/
|
||||
// Unbind onclick to avoid spamclicks.
|
||||
$(event.target).attr('onclick', 'return false;');
|
||||
@ -18,7 +19,7 @@ function news_ajax(event, count, offset, privileged) {
|
||||
if (typeof data == 'undefined' || data == null || data.status != "success" || typeof response == 'undefined' || response == null) {
|
||||
console.log("ERR ajax_news(" + (new Error).lineNumber + "): Unknown data or failure returned.");
|
||||
// Return to original paremeters, no news were added.
|
||||
$(event.target).attr('onclick', 'news_ajax(event, ' + count + ', ' + offset + ', ' + privileged + '); return false;');
|
||||
$(event.target).attr('onclick', 'news_ajax(event, ' + count + ', ' + offset + ', ' + privileged + ', ' + authkey + '); return false;');
|
||||
} else {
|
||||
if (response.length == 0) {
|
||||
$(event.target).parent().remove();
|
||||
@ -31,7 +32,10 @@ function news_ajax(event, count, offset, privileged) {
|
||||
Class: targetClass
|
||||
}));
|
||||
// I'm so happy with this condition statement.
|
||||
if (privileged) {
|
||||
if (privileged && authkey !== false) {
|
||||
// Append [Delete] button and hide [Hide] button if on the news toolbox page
|
||||
$('#news' + this[0]).append('<div class="head"><strong>' + this[1] + '</strong> ' + this[2] + ' - <a href="tools.php?action=editnews&id=' + this[0] + '" class="brackets">Edit</a> <a class="brackets" href="tools.php?action=deletenews&id=' + this[0] + '&auth=' + authkey + '">Delete</a></div>');
|
||||
} else if (privileged) {
|
||||
$('#news' + this[0]).append('<div class="head"><strong>' + this[1] + '</strong> ' + this[2] + ' - <a href="tools.php?action=editnews&id=' + this[0] + '" class="brackets">Edit</a><span style="float: right;"><a class="brackets" onclick="$(\'#newsbody' + this[0] + '\').gtoggle(); this.innerHTML=(this.innerHTML == \'Hide\' ? \'Show\' : \'Hide\'); return false;" href="#">Hide</a></span></div>');
|
||||
} else {
|
||||
$('#news' + this[0]).append('<div class="head"><strong>' + this[1] + '</strong> ' + this[2] + '<span style="float: right;"><a class="brackets" onclick="$(\'#newsbody' + this[0] + '\').gtoggle(); this.innerHTML=(this.innerHTML == \'Hide\' ? \'Show\' : \'Hide\'); return false;" href="#">Hide</a></span></div>');
|
||||
@ -46,6 +50,6 @@ function news_ajax(event, count, offset, privileged) {
|
||||
.fail(function() {
|
||||
console.log("WARN ajax_news(" + (new Error).lineNumber + "): AJAX get failed.");
|
||||
// Return to original paremeters, no news were added.
|
||||
$(event.target).attr('onclick', 'news_ajax(event, ' + count + ', ' + offset + ', ' + privileged + '); return false;');
|
||||
$(event.target).attr('onclick', 'news_ajax(event, ' + count + ', ' + offset + ', ' + privileged + ', ' + authkey + '); return false;');
|
||||
});
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ ul.thin li { margin:0px 0px; padding:0px; }
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
#index #nav_index a, #torrents #nav_torrents a, #collage #nav_collages a, #requests #nav_requests a, #forums #nav_forums a, #chat #nav_irc a, #top10 #nav_top10 a, #rules #nav_rules a, #wiki #nav_wiki a, #staff #nav_staff #nav_inbox #nav_staffinbox #nav_uploaded #nav_bookmarks #nav_notifications #nav_subscriptions #nav_comments #nav_friends a {
|
||||
#index #nav_index a, #torrents #nav_torrents a, #collage #nav_collages a, #requests #nav_requests a, #forums #nav_forums a, #chat #nav_irc a, #top10 #nav_top10 a, #rules #nav_rules a, #wiki #nav_wiki a, #staff #nav_staff #nav_inbox #nav_staffinbox #nav_uploaded #nav_bookmarks #nav_notifications #nav_subscriptions #nav_comments #nav_friends #nav_better a {
|
||||
color: #000000;
|
||||
background: #A5A5A5;
|
||||
padding: 1px 4px;
|
||||
|
Loading…
Reference in New Issue
Block a user