Browse Source

Improve quote notifications page

spaghetti 7 years ago
parent
commit
fbd8876aa8
1 changed files with 32 additions and 55 deletions
  1. 32
    55
      sections/userhistory/quote_notifications.php

+ 32
- 55
sections/userhistory/quote_notifications.php View File

4
 }
4
 }
5
 
5
 
6
 $UnreadSQL = 'AND q.UnRead';
6
 $UnreadSQL = 'AND q.UnRead';
7
-if ($_GET['showall']) {
7
+if ($_GET['showall'] ?? false) {
8
   $UnreadSQL = '';
8
   $UnreadSQL = '';
9
 }
9
 }
10
 
10
 
11
-if ($_GET['catchup']) {
11
+if ($_GET['catchup'] ?? false) {
12
   $DB->query("UPDATE users_notify_quoted SET UnRead = '0' WHERE UserID = '$LoggedUser[ID]'");
12
   $DB->query("UPDATE users_notify_quoted SET UnRead = '0' WHERE UserID = '$LoggedUser[ID]'");
13
   $Cache->delete_value('notify_quoted_' . $LoggedUser['ID']);
13
   $Cache->delete_value('notify_quoted_' . $LoggedUser['ID']);
14
   header('Location: userhistory.php?action=quote_notifications');
14
   header('Location: userhistory.php?action=quote_notifications');
97
   <br />
97
   <br />
98
 <?
98
 <?
99
 foreach ($Results as $Result) {
99
 foreach ($Results as $Result) {
100
-  switch ($Result['Page']) {
101
-    case 'forums':
102
-      $Links = 'Forums: <a href="forums.php?action=viewforum&amp;forumid=' . $Result['ForumID'] . '">' . display_str($Result['ForumName']) . '</a> &gt; ' .
103
-          '<a href="forums.php?action=viewthread&amp;threadid=' . $Result['PageID'] . '" class="tooltip" title="' . display_str($Result['ForumTitle']) . '">' . Format::cut_string($Result['ForumTitle'], 75) . '</a>';
104
-      $JumpLink = 'forums.php?action=viewthread&amp;threadid=' . $Result['PageID'] . '&amp;postid=' . $Result['PostID'] . '#post' . $Result['PostID'];
105
-      break;
106
-    case 'artist':
107
-      $Links = 'Artist: <a href="artist.php?id=' . $Result['PageID'] . '">' . display_str($Result['ArtistName']) . '</a>';
108
-      $JumpLink = 'artist.php?id=' . $Result['PageID'] . '&amp;postid=' . $Result['PostID'] . '#post' . $Result['PostID'];
109
-      break;
110
-    case 'collages':
111
-      $Links = 'Collage: <a href="collages.php?id=' . $Result['PageID'] . '">' . display_str($Result['CollageName']) . '</a>';
112
-      $JumpLink = 'collages.php?action=comments&amp;collageid=' . $Result['PageID'] . '&amp;postid=' . $Result['PostID'] . '#post' . $Result['PostID'];
113
-      break;
114
-    case 'requests':
115
-      if (!isset($Requests[$Result['PageID']])) {
116
-        // Deleted request
117
-        continue 2;
118
-      }
119
-      $Request = $Requests[$Result['PageID']];
120
-      $CategoryName = $Categories[$Request['CategoryID'] - 1];
121
-      $Links = 'Request: ';
122
-      if ($CategoryName == 'Music') {
123
-        $Links .= Artists::display_artists(Requests::get_artists($Result['PageID'])) . '<a href="requests.php?action=view&amp;id=' . $Result['PageID'] . '" dir="ltr">' . $Request['Title'] . " [" . $Request['Year'] . "]</a>";
124
-      } elseif ($CategoryName == "Audiobooks" || $CategoryName == "Comedy") {
125
-        $Links .= '<a href="requests.php?action=view&amp;id=' . $Result['PageID'] . '" dir="ltr">' . $Request['Title'] . " [" . $Request['Year'] . "]</a>";
126
-      } else {
127
-        $Links .= '<a href="requests.php?action=view&amp;id=' . $Result['PageID'] . '">' . $Request['Title'] . "</a>";
128
-      }
129
-      $JumpLink = 'requests.php?action=view&amp;id=' . $Result['PageID'] . '&amp;postid=' . $Result['PostID'] . '#post' . $Result['PostID'];
130
-      break;
131
-    case 'torrents':
132
-      if (!isset($TorrentGroups[$Result['PageID']])) {
133
-        // Deleted or moved torrent group
134
-        continue 2;
135
-      }
136
-      $GroupInfo = $TorrentGroups[$Result['PageID']];
137
-      $Links = 'Torrent: ' . Artists::display_artists($GroupInfo['ExtendedArtists']) . '<a href="torrents.php?id=' . $GroupInfo['ID'] . '" dir="ltr">' . $GroupInfo['Name'] . '</a>';
138
-      if ($GroupInfo['Year'] > 0) {
139
-        $Links .= " [" . $GroupInfo['Year'] . "]";
140
-      }
141
-      if ($GroupInfo['ReleaseType'] > 0) {
142
-        $Links .= " [" . $ReleaseTypes[$GroupInfo['ReleaseType']] . "]";
143
-      }
144
-      $JumpLink = 'torrents.php?id=' . $GroupInfo['ID'] . '&postid=' . $Result['PostID'] . '#post' . $Result['PostID'];
145
-      break;
146
-    default:
147
-      continue 2;
100
+  if ($Result['Page'] == 'forums') {
101
+    $Links = 'Forums: <a href="forums.php?action=viewforum&amp;forumid=' . $Result['ForumID'] . '">' . display_str($Result['ForumName']) . '</a> &gt; ';
102
+    $Links .= '<a href="forums.php?action=viewthread&amp;threadid=' . $Result['PageID'] . '" class="tooltip" title="' . display_str($Result['ForumTitle']) . '">' . Format::cut_string($Result['ForumTitle'], 75) . '</a> &gt; ';
103
+    $Links .= '<a href="forums.php?action=viewthread&amp;threadid=' . $Result['PageID'] . '&amp;postid=' . $Result['PostID'] . '#post' . $Result['PostID'] . '">' . 'Post #' . $Result['PostID'] . '</a>';
104
+  } elseif ($Result['Page'] == 'artist') {
105
+    $Links = 'Artist: <a href="artist.php?id=' . $Result['PageID'] . '">' . display_str($Result['ArtistName']) . '</a> &gt; ';
106
+    $Links .= '<a href="artist.php?id=' . $Result['PageID'] . '&amp;postid=' . $Result['PostID'] . '#post' . $Result['PostID'] . '">Post #' . $Result['PostID'] . '</a>';
107
+  } elseif ($Result['Page'] == 'collages') {
108
+    $Links = 'Collage: <a href="collages.php?id=' . $Result['PageID'] . '">' . display_str($Result['CollageName']) . '</a> &gt; ';
109
+    $Links .= '<a href="collages.php?action=comments&amp;collageid=' . $Result['PageID'] . '&amp;postid=' . $Result['PostID'] . '#post' . $Result['PostID'] . '">Post #' . $Result['PostID'] . '</a>';
110
+  } elseif ($Result['Page'] == 'requests') {
111
+    if (!isset($Requests[$Result['PageID']])) {
112
+      continue;
113
+    }
114
+    $Request = $Requests[$Result['PageID']];
115
+    $CategoryName = $Categories[$Request['CategoryID'] - 1];
116
+    $Links = 'Request: ';
117
+    $Links .= Artists::display_artists(Requests::get_artists($Result['PageID'])) . '<a href="requests.php?action=view&amp;id=' . $Result['PageID'] . '">' . $Request['Title'] . "</a> &gt; ";
118
+    $Links .= '<a href="requests.php?action=view&amp;id=' . $Result['PageID'] . '&amp;postid=' . $Result['PostID'] . '#post' . $Result['PostID'] . '"> Post #' . $Result['PostID'] . '</a>';
119
+  } elseif ($Result['Page'] == 'torrents') {
120
+    if (!isset($TorrentGroups[$Result['PageID']])) {
121
+      continue;
122
+    }
123
+    $GroupInfo = $TorrentGroups[$Result['PageID']];
124
+    $Links = 'Torrent: ' . Artists::display_artists($GroupInfo['ExtendedArtists']) . '<a href="torrents.php?id=' . $GroupInfo['ID'] . '">' . ($GroupInfo['Name'] ? $GroupInfo['Name'] : ($GroupInfo['NameRJ'] ? $GroupInfo['NameRJ'] : $GroupInfo['NameJP'])) . '</a> &gt; ';
125
+    $Links .= '<a href="torrents.php?id=' . $GroupInfo['ID'] . '&postid=' . $Result['PostID'] . '#post' . $Result['PostID'] . '"> Post #' . $Result['PostID'] . '</a>';
126
+  } else {
127
+    continue;
148
   }
128
   }
149
 ?>
129
 ?>
150
   <table class="forum_post box vertical_margin noavatar">
130
   <table class="forum_post box vertical_margin noavatar">
152
       <td colspan="2">
132
       <td colspan="2">
153
         <span class="float_left">
133
         <span class="float_left">
154
           <?=$Links?>
134
           <?=$Links?>
155
-          &gt; Quoted by <?=Users::format_username($Result['QuoterID'], false, false, false, false) . ' ' . time_diff($Result['Date']) ?>
156
           <?=($Result['UnRead'] ? ' <span class="new">(New!)</span>' : '')?>
135
           <?=($Result['UnRead'] ? ' <span class="new">(New!)</span>' : '')?>
157
         </span>
136
         </span>
158
-        <span class="float_left tooltip last_read" title="Jump to quote">
159
-          <a href="<?=$JumpLink?>"></a>
160
-        </span>
137
+      <td colspan="1">
161
         <span class="float_right">
138
         <span class="float_right">
162
-          <a href="#">&uarr;</a>
139
+          Quoted by <?=Users::format_username($Result['QuoterID'], false, false, false, false) . ' ' . time_diff($Result['Date']) ?>
163
         </span>
140
         </span>
164
       </td>
141
       </td>
165
     </tr>
142
     </tr>

Loading…
Cancel
Save