pjc 5 years ago
parent
commit
47a1daa8e3

+ 121
- 103
classes/calendarview.class.php View File

1
-<?
1
+<?php
2
 
2
 
3
-class CalendarView {
4
-  private static $Days = array('S', 'M', 'T', 'W', 'T', 'F', 'S');
5
-  private static $Headings = array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
6
-  private static $Events;
3
+# todo: Check strict eqality all this page
4
+# The staff calendar may actually be broken
7
 
5
 
8
-  public static function render_title($Month, $Year) {
9
-    if (!is_numeric($Month) || !is_numeric($Year)) {
10
-      error(404);
11
-    }
12
-    $NextMonth = $Month % 12 == 0 ? 1 : $Month + 1;
13
-    $PreviousMonth = $Month == 1 ? 12 : $Month - 1;
14
-    $NextYear = $Year;
15
-    if ($NextMonth == 1) {
16
-      $NextYear++;
17
-    }
18
-    $PreviousYear = $Year;
19
-    if ($PreviousMonth == 12) {
20
-      $PreviousYear--;
6
+class CalendarView
7
+{
8
+    private static $Days = array('S', 'M', 'T', 'W', 'T', 'F', 'S');
9
+    private static $Headings = array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
10
+    private static $Events;
11
+
12
+    public static function render_title($Month, $Year)
13
+    {
14
+        if (!is_numeric($Month) || !is_numeric($Year)) {
15
+            error(404);
16
+        }
17
+
18
+        $NextMonth = $Month % 12 == 0 ? 1 : $Month + 1;
19
+        $PreviousMonth = $Month == 1 ? 12 : $Month - 1;
20
+        $NextYear = $Year;
21
+
22
+        if ($NextMonth == 1) {
23
+            $NextYear++;
24
+        }
25
+
26
+        $PreviousYear = $Year;
27
+        if ($PreviousMonth == 12) {
28
+            $PreviousYear--;
29
+        } ?>
30
+
31
+<h1 class="center">
32
+  <a
33
+    href="tools.php?action=calendar&amp;month=<?=$PreviousMonth?>&amp;year=<?=$PreviousYear?>">«</a>
34
+  <?=date("F", mktime(0, 0, 0, $Month, 10)) . " $Year"?>
35
+  <a
36
+    href="tools.php?action=calendar&amp;month=<?=$NextMonth?>&amp;year=<?=$NextYear?>">»</a>
37
+</h1>
38
+
39
+<input type="hidden" id="month" value="<?=$Month?>" />
40
+<input type="hidden" id="year" value="<?=$Year?>" />
41
+
42
+<?php
21
     }
43
     }
22
-?>
23
-    <h1 class="center">
24
-      <a href="tools.php?action=calendar&amp;month=<?=$PreviousMonth?>&amp;year=<?=$PreviousYear?>">&lt;</a>
25
-      <?=date("F", mktime(0, 0, 0, $Month, 10)) . " $Year"?>
26
-      <a href="tools.php?action=calendar&amp;month=<?=$NextMonth?>&amp;year=<?=$NextYear?>">&gt;</a>
27
-    </h1>
28
-    <input type="hidden" id="month" value="<?=$Month?>" />
29
-    <input type="hidden" id="year" value="<?=$Year?>" />
30
-<?
31
-  }
32
-
33
-  private static function get_events_on($Day, $Events) {
34
-    // Linear search, Lol.
35
-    $Results = [];
36
-    foreach ($Events as $Event) {
37
-      if ($Event['StartDay'] == $Day || ($Event['StartDay'] <= $Day && $Event['EndDay'] >= $Day)) {
38
-        $Results[] = $Event;
39
-      }
44
+
45
+    private static function get_events_on($Day, $Events)
46
+    {
47
+        // Linear search, lol
48
+        $Results = [];
49
+        foreach ($Events as $Event) {
50
+            if ($Event['StartDay'] == $Day || ($Event['StartDay'] <= $Day && $Event['EndDay'] >= $Day)) {
51
+                $Results[] = $Event;
52
+            }
53
+        }
54
+        return $Results;
40
     }
55
     }
41
-    return $Results;
42
-  }
43
-
44
-
45
-  private static function render_events_day($Day, $Events) {
46
-    $Events = self::get_events_on($Day, $Events);
47
-    foreach ($Events as $Event) {
48
-      $Color = Calendar::$Colors[Calendar::$Importances[$Event['Importance']]];
49
-      $Category = Calendar::$Categories[$Event['Category']];
50
-      $Tooltip = $Event['Title'] . " - " . Calendar::$Categories[$Event['Category']] . " - " . Calendar::$Importances[$Event['Importance']];
51
-?>
52
-      <p><a href="#" class="event_day tooltip" title="<?=$Tooltip?>" data-gazelle-id="<?=$Event['ID']?>" style="color: <?=$Color?>;"><?=Format::cut_string($Event['Title'], 8, true)?></a></p>
53
-<?
56
+
57
+    private static function render_events_day($Day, $Events)
58
+    {
59
+        $Events = self::get_events_on($Day, $Events);
60
+        foreach ($Events as $Event) {
61
+            $Color = Calendar::$Colors[Calendar::$Importances[$Event['Importance']]];
62
+            $Category = Calendar::$Categories[$Event['Category']];
63
+            $Tooltip = $Event['Title'] . " - " . Calendar::$Categories[$Event['Category']] . " - " . Calendar::$Importances[$Event['Importance']]; ?>
64
+
65
+<p>
66
+  <a href="#" class="event_day tooltip" title="<?=$Tooltip?>"
67
+    data-gazelle-id="<?=$Event['ID']?>"
68
+    style="color: <?=$Color?>;"><?=Format::cut_string($Event['Title'], 8, true)?></a>
69
+</p>
70
+
71
+<?php
72
+        }
54
     }
73
     }
55
-  }
56
-
57
-  public static function render_calendar($Month, $Year, $Events) {
58
-    $RunningDay = date('w', mktime(0, 0, 0, $Month, 1, $Year));
59
-    $DaysInMonth = date('t', mktime(0 ,0 ,0, $Month, 1, $Year));
60
-    $DaysThisWeek = 1;
61
-    $DayCounter = 0;
62
-    $DatesArray = [];
63
-?>
64
-
65
-    <table class="calendar">
66
-      <tr>
67
-<?    foreach (self::$Headings as $Heading) { ?>
68
-        <td class="calendar-row calendar-heading">
69
-          <strong><?=$Heading?></strong>
70
-        </td>
71
-<?    } ?>
72
-      </tr>
73
-      <tr class="calendar-row">
74
-
75
-<?    for ($x = 0; $x < $RunningDay; $x++) { ?>
76
-        <td class="calendar-day-np"></td>
77
-<?
74
+
75
+    public static function render_calendar($Month, $Year, $Events)
76
+    {
77
+        $RunningDay = date('w', mktime(0, 0, 0, $Month, 1, $Year));
78
+        $DaysInMonth = date('t', mktime(0, 0, 0, $Month, 1, $Year));
79
+        $DaysThisWeek = 1;
80
+        $DayCounter = 0;
81
+        $DatesArray = []; ?>
82
+
83
+<table class="calendar">
84
+  <tr>
85
+    <?php foreach (self::$Headings as $Heading) { ?>
86
+    <td class="calendar-row calendar-heading">
87
+      <strong><?=$Heading?></strong>
88
+    </td>
89
+    <?php } ?>
90
+  </tr>
91
+
92
+  <tr class="calendar-row">
93
+    <?php for ($x = 0; $x < $RunningDay; $x++) { ?>
94
+    <td class="calendar-day-np"></td>
95
+    <?php
78
       $DaysThisWeek++;
96
       $DaysThisWeek++;
79
     }
97
     }
80
 
98
 
81
-    for ($i = 1; $i <= $DaysInMonth; $i++) {
82
-?>
83
-        <td class="calendar-day">
84
-          <div class="day-events">
85
-<?            self::render_events_day($i, $Events); ?>
86
-          </div>
87
-          <div class="day-number">
88
-            <?=$i?>
89
-          </div>
90
-        </td>
91
-<?      if ($RunningDay == 6) { ?>
92
-      </tr>
93
-<?        if (($DayCounter + 1) != $DaysInMonth) { ?>
94
-      <tr class="calendar-row">
95
-<?
99
+        for ($i = 1; $i <= $DaysInMonth; $i++) {
100
+            ?>
101
+    <td class="calendar-day">
102
+      <div class="day-events">
103
+        <?php self::render_events_day($i, $Events); ?>
104
+      </div>
105
+      <div class="day-number">
106
+        <?=$i?>
107
+      </div>
108
+    </td>
109
+    <?php if ($RunningDay == 6) { ?>
110
+  </tr>
111
+
112
+  <?php if (($DayCounter + 1) != $DaysInMonth) { ?>
113
+  <tr class="calendar-row">
114
+    <?php
96
         }
115
         }
97
         $RunningDay = -1;
116
         $RunningDay = -1;
98
         $DaysThisWeek = 0;
117
         $DaysThisWeek = 0;
99
       }
118
       }
100
-      $DaysThisWeek++;
101
-      $RunningDay++;
102
-      $DayCounter++;
103
-    }
119
+            $DaysThisWeek++;
120
+            $RunningDay++;
121
+            $DayCounter++;
122
+        }
104
 
123
 
105
-    if ($DaysThisWeek < 8) {
106
-      for ($x = 1; $x <= (8 - $DaysThisWeek); $x++) {
107
-?>
108
-        <td class="calendar-day-np"></td>
109
-<?
110
-      }
111
-    }
112
-?>
113
-      </tr>
124
+        if ($DaysThisWeek < 8) {
125
+            for ($x = 1; $x <= (8 - $DaysThisWeek); $x++) {
126
+                ?>
127
+    <td class="calendar-day-np"></td>
128
+    <?php
129
+            }
130
+        } ?>
131
+  </tr>
114
 
132
 
115
-    </table>
116
-<?
133
+</table>
134
+<?php
117
     echo $Calendar;
135
     echo $Calendar;
118
-  }
136
+    }
119
 }
137
 }

+ 4
- 4
classes/format.class.php View File

295
             $Pages = '';
295
             $Pages = '';
296
 
296
 
297
             if ($StartPage > 1) {
297
             if ($StartPage > 1) {
298
-                $Pages .= "<a href=\"$Location?page=1$QueryString$Anchor\"><strong>&lt;&lt; First</strong></a> ";
299
-                $Pages .= "<a href=\"$Location?page=".($StartPage - 1).$QueryString.$Anchor.'" class="pager_prev"><strong>&lt; Prev</strong></a> | ';
298
+                $Pages .= "<a href=\"$Location?page=1$QueryString$Anchor\"><strong>« First</strong></a> ";
299
+                $Pages .= "<a href=\"$Location?page=".($StartPage - 1).$QueryString.$Anchor.'" class="pager_prev"><strong> Prev</strong></a> | ';
300
             }
300
             }
301
             // End change
301
             // End change
302
 
302
 
325
             }
325
             }
326
 
326
 
327
             if ($StartPage && $StartPage < $TotalPages) {
327
             if ($StartPage && $StartPage < $TotalPages) {
328
-                $Pages .= " | <a href=\"$Location?page=".($StartPage + 1).$QueryString.$Anchor.'" class="pager_next"><strong>Next &gt;</strong></a> ';
329
-                $Pages .= "<a href=\"$Location?page=$TotalPages$QueryString$Anchor\"><strong> Last &gt;&gt;</strong></a>";
328
+                $Pages .= " | <a href=\"$Location?page=".($StartPage + 1).$QueryString.$Anchor.'" class="pager_next"><strong>Next </strong></a> ';
329
+                $Pages .= "<a href=\"$Location?page=$TotalPages$QueryString$Anchor\"><strong> Last »</strong></a>";
330
             }
330
             }
331
         }
331
         }
332
         if ($TotalPages > 1) {
332
         if ($TotalPages > 1) {

+ 251
- 121
classes/mediainfo.class.php View File

1
 <?php
1
 <?php
2
-class MediaInfo {
3
-    public static function parse($string, $raw=false) {
2
+
3
+class MediaInfo
4
+{
5
+    public static function parse($string, $raw=false)
6
+    {
4
         $t = new ParseManager($string);
7
         $t = new ParseManager($string);
5
         $t->parse();
8
         $t->parse();
6
         return $raw ? $t->output_raw() : $t->output();
9
         return $raw ? $t->output_raw() : $t->output();
7
     }
10
     }
8
 }
11
 }
9
 
12
 
10
-class ParseManager {
13
+class ParseManager
14
+{
11
     protected $lines;
15
     protected $lines;
12
     protected $parsed_lines;
16
     protected $parsed_lines;
13
     protected $index;
17
     protected $index;
22
 
26
 
23
     const GENERIC_PARSER = 'generic_parser';
27
     const GENERIC_PARSER = 'generic_parser';
24
     const MEDIAINFO_START = 'general';
28
     const MEDIAINFO_START = 'general';
25
-    public function __construct($string='') {
29
+    public function __construct($string='')
30
+    {
26
         $this->index = 0;
31
         $this->index = 0;
27
         $this->output = '';
32
         $this->output = '';
28
         $this->parsed_lines = [];
33
         $this->parsed_lines = [];
31
         $this->add_parser($p);
36
         $this->add_parser($p);
32
     }
37
     }
33
 
38
 
34
-    protected function set_string($string) {
39
+    protected function set_string($string)
40
+    {
35
         $string = trim($string);
41
         $string = trim($string);
36
         $string = static::strip_escaped_tags($string);
42
         $string = static::strip_escaped_tags($string);
37
         $lines = preg_split("/\r\n|\n|\r/", $string);
43
         $lines = preg_split("/\r\n|\n|\r/", $string);
38
-        array_walk($lines,function(&$l) {
44
+        array_walk($lines, function (&$l) {
39
             $l=trim($l);
45
             $l=trim($l);
40
         });
46
         });
41
         $this->lines = $lines;
47
         $this->lines = $lines;
42
     }
48
     }
43
 
49
 
44
-    protected function add_parser($p,$name='') {
45
-        $p->set_lines($this->lines,$this->index);
46
-        if (!$name) $name = static::GENERIC_PARSER;
50
+    protected function add_parser($p, $name='')
51
+    {
52
+        $p->set_lines($this->lines, $this->index);
53
+        if (!$name) {
54
+            $name = static::GENERIC_PARSER;
55
+        }
47
         $this->parsers[$name][] = $p;
56
         $this->parsers[$name][] = $p;
48
     }
57
     }
49
 
58
 
50
-    public function parse() {
51
-        // get the next section
59
+    public function parse()
60
+    {
61
+        // Get the next section
52
         while ($this->index < count($this->lines) &&
62
         while ($this->index < count($this->lines) &&
53
           !($line = $this->parsers[static::GENERIC_PARSER][0]->parse_line()));
63
           !($line = $this->parsers[static::GENERIC_PARSER][0]->parse_line()));
54
         $section = SectionParser::section_name($line);
64
         $section = SectionParser::section_name($line);
55
         $this->index--; // go back to line we just read
65
         $this->index--; // go back to line we just read
56
 
66
 
57
-        // we can have multiple mediainfo files inside the block, so handle that case here
67
+        // We can have multiple mediainfo files inside the block, so handle that case here
58
         if ($section == self::MEDIAINFO_START && isset($this->parsers[$section])) {
68
         if ($section == self::MEDIAINFO_START && isset($this->parsers[$section])) {
59
             $this->new_mediainfo();
69
             $this->new_mediainfo();
60
         }
70
         }
61
-        if (isset($this->available_parsers[$section])){
71
+
72
+        if (isset($this->available_parsers[$section])) {
62
             $parser = new $this->available_parsers[$section];
73
             $parser = new $this->available_parsers[$section];
63
-            $this->add_parser($parser,$section);
64
-            // parse section using the parser
65
-            while ($line = $parser->parse_line()) $this->parsed_lines[] = $line;
74
+            $this->add_parser($parser, $section);
75
+            // Parse section using the parser
76
+            while ($line = $parser->parse_line()) {
77
+                $this->parsed_lines[] = $line;
78
+            }
66
 
79
 
67
             $this->parsed_lines[] = '';
80
             $this->parsed_lines[] = '';
68
-        }
69
-        else {
70
-            // skip until the next blank line or until the next general section
71
-            while ($line = $this->parsers[static::GENERIC_PARSER][0]->parse_line()){
81
+        } else {
82
+            // Skip until the next blank line or until the next general section
83
+            while ($line = $this->parsers[static::GENERIC_PARSER][0]->parse_line()) {
72
                 $section = SectionParser::section_name($line);
84
                 $section = SectionParser::section_name($line);
73
                 if ($section == self::MEDIAINFO_START) {
85
                 if ($section == self::MEDIAINFO_START) {
74
                     $this->index--; // go back to line we just read
86
                     $this->index--; // go back to line we just read
77
             }
89
             }
78
         }
90
         }
79
 
91
 
80
-        // keep iterating until the last line
92
+        // Keep iterating until the last line
81
         if ($this->index < count($this->lines)) {
93
         if ($this->index < count($this->lines)) {
82
             $this->parse();
94
             $this->parse();
83
         }
95
         }
84
     }
96
     }
85
 
97
 
86
-    public function output($cummulative=true) {
87
-        $string = implode("<br />\n",$this->parsed_lines);
88
-        if (!isset($this->parsers['general'])) return $string;
98
+    public function output($cummulative=true)
99
+    {
100
+        $string = implode("<br />\n", $this->parsed_lines);
101
+        if (!isset($this->parsers['general'])) {
102
+            return $string;
103
+        }
89
 
104
 
90
         $midiv_start = '<div class="spoilerContainer hideContainer">
105
         $midiv_start = '<div class="spoilerContainer hideContainer">
91
             <input type="button" class="spoilerButton" value="Show '.
106
             <input type="button" class="spoilerButton" value="Show '.
95
 
110
 
96
         $output = '<table class="mediainfo"><tbody><tr><td>';
111
         $output = '<table class="mediainfo"><tbody><tr><td>';
97
         $output .= $this->parsers['general'][0]->output();
112
         $output .= $this->parsers['general'][0]->output();
98
-        if (isset($this->parsers['video'])){
113
+
114
+        if (isset($this->parsers['video'])) {
99
             $output .= '</td><td>';
115
             $output .= '</td><td>';
100
             $output .= $this->parsers['video'][0]->output();
116
             $output .= $this->parsers['video'][0]->output();
101
         }
117
         }
102
-        if (isset($this->parsers['audio'])){
118
+
119
+        if (isset($this->parsers['audio'])) {
103
             $output .= '</td><td>';
120
             $output .= '</td><td>';
104
             $output .= '<table><caption>Audio</caption><tbody>';
121
             $output .= '<table><caption>Audio</caption><tbody>';
105
-            foreach($this->parsers['audio'] as $index => $ap) {
106
-                $output .= sprintf('<tr><td>#%d: &nbsp;</td><td>%s</td></tr>',intval($index+1),$ap->output());
122
+            foreach ($this->parsers['audio'] as $index => $ap) {
123
+                $output .= sprintf('<tr><td>#%d: &nbsp;</td><td>%s</td></tr>', intval($index+1), $ap->output());
107
             }
124
             }
108
             $output .= '</tbody></table>';
125
             $output .= '</tbody></table>';
109
         }
126
         }
110
-        if (isset($this->parsers['text'])){
111
-            // subtitles table will be printed below the previous table
127
+
128
+        if (isset($this->parsers['text'])) {
129
+            // Subtitles table will be printed below the previous table
112
             $output .= '<br />';
130
             $output .= '<br />';
113
             $output .= '<table><caption>Subtitles</caption><tbody>';
131
             $output .= '<table><caption>Subtitles</caption><tbody>';
114
-            foreach($this->parsers['text'] as $index => $tp) {
115
-                $output .= sprintf('<tr><td>#%d: &nbsp;</td><td>%s</td></tr>',intval($index+1),$tp->output());
132
+            foreach ($this->parsers['text'] as $index => $tp) {
133
+                $output .= sprintf('<tr><td>#%d: &nbsp;</td><td>%s</td></tr>', intval($index+1), $tp->output());
116
             }
134
             }
117
             $output .= '</tbody></table>';
135
             $output .= '</tbody></table>';
118
         }
136
         }
137
+
119
         $output .= '</td></tr></tbody></table><br />';
138
         $output .= '</td></tr></tbody></table><br />';
120
         $output = $midiv_start . $string . $midiv_end . $output;
139
         $output = $midiv_start . $string . $midiv_end . $output;
140
+
121
         if ($cummulative) {
141
         if ($cummulative) {
122
             $output = $this->output . $output;
142
             $output = $this->output . $output;
123
         }
143
         }
124
         return  $output;
144
         return  $output;
125
     }
145
     }
126
 
146
 
127
-    public function output_raw() {
147
+    public function output_raw()
148
+    {
128
         $output = [];
149
         $output = [];
129
         $sections = ['general', 'video', 'audio', 'text'];
150
         $sections = ['general', 'video', 'audio', 'text'];
130
 
151
 
131
-        foreach($sections as $section) {
152
+        foreach ($sections as $section) {
132
             if (isset($this->parsers[$section])) {
153
             if (isset($this->parsers[$section])) {
133
                 $output[$section] = [];
154
                 $output[$section] = [];
134
-                foreach($this->parsers[$section] as $index => $parser) {
155
+                foreach ($this->parsers[$section] as $index => $parser) {
135
                     $output[$section][$index] = $parser->output_raw();
156
                     $output[$section][$index] = $parser->output_raw();
136
                 }
157
                 }
137
             }
158
             }
139
         return $output;
160
         return $output;
140
     }
161
     }
141
 
162
 
142
-    // strip escaped html tags
143
-    // this is not done for security, just to beautify things (html should already be escaped)
144
-    public static function strip_escaped_tags($string) {
163
+    // Strip escaped html tags
164
+    // This is not done for security, just to beautify things (html should already be escaped)
165
+    public static function strip_escaped_tags($string)
166
+    {
145
         // use the php function first
167
         // use the php function first
146
         $string = strip_tags($string);
168
         $string = strip_tags($string);
147
 
169
 
148
         $gt = '&gt;|&#62;|>';
170
         $gt = '&gt;|&#62;|>';
149
         $lt = '&lt;|&#60;|<';
171
         $lt = '&lt;|&#60;|<';
150
 
172
 
151
-        // there is no opening tag, so don't go through the rest of the regexes
152
-        if (!preg_match("($lt)",$string))
173
+        // There is no opening tag, so don't go through the rest of the regexes
174
+        if (!preg_match("($lt)", $string)) {
153
             return $string;
175
             return $string;
176
+        }
154
 
177
 
155
         $tag_match = "/(?:$lt)(?P<tag>(?:(?!$gt).)*)(?:$gt)/ims";
178
         $tag_match = "/(?:$lt)(?P<tag>(?:(?!$gt).)*)(?:$gt)/ims";
156
 
179
 
157
-        // this should match and remove tags
158
-        $string = preg_replace($tag_match,'',$string);
180
+        // This should match and remove tags
181
+        $string = preg_replace($tag_match, '', $string);
159
 
182
 
160
         return $string;
183
         return $string;
161
     }
184
     }
162
 
185
 
163
-    protected function new_mediainfo() {
186
+    protected function new_mediainfo()
187
+    {
164
         $this->output .= $this->output(false);
188
         $this->output .= $this->output(false);
165
         $this->parsed_lines = [];
189
         $this->parsed_lines = [];
166
-        foreach(array_keys($this->parsers) as $key) {
167
-            if ($key != static::GENERIC_PARSER)
190
+
191
+        foreach (array_keys($this->parsers) as $key) {
192
+            if ($key != static::GENERIC_PARSER) {
168
                 unset($this->parsers[$key]);
193
                 unset($this->parsers[$key]);
194
+            }
169
         }
195
         }
170
     }
196
     }
171
-
172
 }
197
 }
173
 
198
 
174
-class SectionParser {
199
+class SectionParser
200
+{
175
     protected $lines;
201
     protected $lines;
176
     protected $index;
202
     protected $index;
177
 
203
 
178
-
179
-    public function __construct(&$lines=[],&$i=0) {
180
-        $this->set_lines($lines,$i);
204
+    public function __construct(&$lines=[], &$i=0)
205
+    {
206
+        $this->set_lines($lines, $i);
181
     }
207
     }
182
-    public function set_lines(&$lines=[],&$i=0){
208
+
209
+    public function set_lines(&$lines=[], &$i=0)
210
+    {
183
         $this->lines = &$lines;
211
         $this->lines = &$lines;
184
         $this->index = &$i;
212
         $this->index = &$i;
185
     }
213
     }
186
-    // should always return the read line
187
-    public function parse_line(){
214
+
215
+    // Should always return the read line
216
+    public function parse_line()
217
+    {
188
         if (!isset($this->lines[$this->index])) {
218
         if (!isset($this->lines[$this->index])) {
189
             return null;
219
             return null;
190
         }
220
         }
221
+
191
         $line = $this->lines[$this->index++];
222
         $line = $this->lines[$this->index++];
192
         $pair = static::property_value_pair($line);
223
         $pair = static::property_value_pair($line);
193
-        $this->handle_cases($pair['property'],$pair['value']);
224
+        $this->handle_cases($pair['property'], $pair['value']);
194
         return $line;
225
         return $line;
195
     }
226
     }
196
-    public function output() {
197
 
227
 
228
+    public function output()
229
+    {
198
     }
230
     }
199
-    protected function handle_cases($property, $value) {
200
 
231
 
232
+    protected function handle_cases($property, $value)
233
+    {
201
     }
234
     }
202
-    public static function section_name($string) {
203
-        if (!$string) return false;
235
+
236
+    public static function section_name($string)
237
+    {
238
+        if (!$string) {
239
+            return false;
240
+        }
204
         $mistart="/^(?:general$|unique id|complete name)/i";
241
         $mistart="/^(?:general$|unique id|complete name)/i";
205
-        if (preg_match($mistart, $string)) return ParseManager::MEDIAINFO_START;
206
-        $words = explode(' ',$string);
242
+        if (preg_match($mistart, $string)) {
243
+            return ParseManager::MEDIAINFO_START;
244
+        }
245
+        $words = explode(' ', $string);
207
         return strtolower($words[0]);
246
         return strtolower($words[0]);
208
     }
247
     }
209
-    public static function property_value_pair($string) {
248
+
249
+    public static function property_value_pair($string)
250
+    {
210
         $pair = explode(":", $string, 2);
251
         $pair = explode(":", $string, 2);
211
         return array('property'=>strtolower(trim($pair[0])),'value'=>trim($pair[1]??''));
252
         return array('property'=>strtolower(trim($pair[0])),'value'=>trim($pair[1]??''));
212
     }
253
     }
213
-    public static function strip_path($string) { // remove filepath
254
+
255
+    public static function strip_path($string)
256
+    { // remove filepath
214
         $string = str_replace("\\", "/", $string);
257
         $string = str_replace("\\", "/", $string);
215
         $path_parts = pathinfo($string);
258
         $path_parts = pathinfo($string);
216
         return $path_parts['basename'];
259
         return $path_parts['basename'];
217
     }
260
     }
218
-    public static function parse_size($string) {
261
+
262
+    public static function parse_size($string)
263
+    {
219
         return str_replace(array('pixels', ' '), null, $string);
264
         return str_replace(array('pixels', ' '), null, $string);
220
     }
265
     }
221
-    protected static function table_head($caption) {
266
+
267
+    protected static function table_head($caption)
268
+    {
222
         return "<table class='nobr'><caption>$caption</caption><tbody>";
269
         return "<table class='nobr'><caption>$caption</caption><tbody>";
223
     }
270
     }
224
-    protected static function table_row($property,$value) {
225
-        if ($value)
271
+
272
+    protected static function table_row($property, $value)
273
+    {
274
+        if ($value) {
226
             return "<tr><td>$property:&nbsp;&nbsp;</td><td>$value</td></tr>";
275
             return "<tr><td>$property:&nbsp;&nbsp;</td><td>$value</td></tr>";
276
+        }
227
         return '';
277
         return '';
228
     }
278
     }
229
-    protected static function table_tail(){
279
+
280
+    protected static function table_tail()
281
+    {
230
         return '</tbody></table>';
282
         return '</tbody></table>';
231
     }
283
     }
232
-
233
 }
284
 }
234
 
285
 
235
-class AudioSectionParser extends SectionParser {
286
+class AudioSectionParser extends SectionParser
287
+{
236
     protected $audioformat;
288
     protected $audioformat;
237
     protected $audiobitrate;
289
     protected $audiobitrate;
238
     protected $audiochannels;
290
     protected $audiochannels;
243
     protected $form_audioformat;
295
     protected $form_audioformat;
244
     protected $form_audiochannels;
296
     protected $form_audiochannels;
245
 
297
 
246
-    protected function handle_cases($property,$value) {
298
+    protected function handle_cases($property, $value)
299
+    {
247
         switch ($property) {
300
         switch ($property) {
248
             case "format":
301
             case "format":
249
                 $this->audioformat = $value;
302
                 $this->audioformat = $value;
268
                 break;
321
                 break;
269
         }
322
         }
270
     }
323
     }
271
-    public function output() {
324
+
325
+    public function output()
326
+    {
272
         $this->process_vars();
327
         $this->process_vars();
273
         $output = $this->audiolang . ' ' . $this->channels() . ' ' . $this->format();
328
         $output = $this->audiolang . ' ' . $this->channels() . ' ' . $this->format();
274
         $output .= ($this->audiobitrate) ? " @ $this->audiobitrate" : '';
329
         $output .= ($this->audiobitrate) ? " @ $this->audiobitrate" : '';
275
         $output .= ($this->audiotitle) ? " ($this->audiotitle)" : '';
330
         $output .= ($this->audiotitle) ? " ($this->audiotitle)" : '';
276
         return $output;
331
         return $output;
277
     }
332
     }
278
-    public function output_raw() {
333
+
334
+    public function output_raw()
335
+    {
279
         $this->process_vars();
336
         $this->process_vars();
280
         $output = [];
337
         $output = [];
281
         $properties = [
338
         $properties = [
283
             'audiochannelpositions', 'audiotitle', 'audiolang', 'audioprofile',
340
             'audiochannelpositions', 'audiotitle', 'audiolang', 'audioprofile',
284
             'form_audioformat', 'form_audiochannels'
341
             'form_audioformat', 'form_audiochannels'
285
         ];
342
         ];
286
-        foreach($properties as $property) {
287
-            if ($this->$property) $output[$property] = $this->$property;
343
+
344
+        foreach ($properties as $property) {
345
+            if ($this->$property) {
346
+                $output[$property] = $this->$property;
347
+            }
288
         }
348
         }
289
         return $output;
349
         return $output;
290
     }
350
     }
291
-    protected function process_vars() {
351
+
352
+    protected function process_vars()
353
+    {
292
         $this->form_audioformat = $this->form_format();
354
         $this->form_audioformat = $this->form_format();
293
         $this->form_audiochannels = $this->form_channels();
355
         $this->form_audiochannels = $this->form_channels();
294
     }
356
     }
295
-    protected function format() {
357
+
358
+    protected function format()
359
+    {
296
         if (strtolower($this->audioformat) === 'mpeg audio') {
360
         if (strtolower($this->audioformat) === 'mpeg audio') {
297
             switch (strtolower($this->audioprofile)) {
361
             switch (strtolower($this->audioprofile)) {
298
                 case 'layer 3':
362
                 case 'layer 3':
305
         }
369
         }
306
         return $this->audioformat;
370
         return $this->audioformat;
307
     }
371
     }
308
-    protected function form_format() {
372
+
373
+    protected function form_format()
374
+    {
309
         // Not implemented: Real Audio, DTS-HD
375
         // Not implemented: Real Audio, DTS-HD
310
         switch (strtolower($this->format())) {
376
         switch (strtolower($this->format())) {
311
             case 'mp2':
377
             case 'mp2':
329
                     default:
395
                     default:
330
                         return 'DTS';
396
                         return 'DTS';
331
                 }
397
                 }
398
+                // no break
332
             case 'flac':
399
             case 'flac':
333
                 return 'FLAC';
400
                 return 'FLAC';
334
             case 'pcm':
401
             case 'pcm':
337
                 return 'WMA';
404
                 return 'WMA';
338
         }
405
         }
339
     }
406
     }
340
-    protected function channels() {
407
+
408
+    protected function channels()
409
+    {
341
         if (isset($this->audiochannels)) {
410
         if (isset($this->audiochannels)) {
342
             $chans = preg_replace('/^(\d).*$/', '$1', $this->audiochannels);
411
             $chans = preg_replace('/^(\d).*$/', '$1', $this->audiochannels);
343
 
412
 
344
-            if (isset($this->audiochannelpositions) && preg_match('/LFE/',
345
-                    $this->audiochannelpositions)) {
413
+            if (isset($this->audiochannelpositions) && preg_match(
414
+                '/LFE/',
415
+                $this->audiochannelpositions
416
+            )) {
346
                 $chans -= .9;
417
                 $chans -= .9;
347
             } else {
418
             } else {
348
                 $chans = $chans . '.0';
419
                 $chans = $chans . '.0';
351
             return $chans . 'ch';
422
             return $chans . 'ch';
352
         }
423
         }
353
     }
424
     }
354
-    protected function form_channels() {
425
+
426
+    protected function form_channels()
427
+    {
355
         return preg_replace('/ch/', '', $this->channels());
428
         return preg_replace('/ch/', '', $this->channels());
356
     }
429
     }
357
 }
430
 }
358
 
431
 
359
-class GeneralSectionParser extends SectionParser {
432
+class GeneralSectionParser extends SectionParser
433
+{
360
     public $filename;
434
     public $filename;
361
     protected $generalformat;
435
     protected $generalformat;
362
     protected $duration;
436
     protected $duration;
364
     protected $form_codec;
438
     protected $form_codec;
365
     protected $form_releasegroup;
439
     protected $form_releasegroup;
366
 
440
 
367
-    protected function handle_cases($property,$value) {
441
+    protected function handle_cases($property, $value)
442
+    {
368
         switch ($property) {
443
         switch ($property) {
369
             case "complete name":
444
             case "complete name":
370
                 // Remove autodetected urls
445
                 // Remove autodetected urls
384
                 break;
459
                 break;
385
         }
460
         }
386
     }
461
     }
387
-    public function output() {
462
+
463
+    public function output()
464
+    {
388
         $this->process_vars();
465
         $this->process_vars();
389
         $output = static::table_head('General');
466
         $output = static::table_head('General');
390
         $properties = [
467
         $properties = [
392
             'Runtime' => 'duration',
469
             'Runtime' => 'duration',
393
             'Size' => 'filesize'
470
             'Size' => 'filesize'
394
         ];
471
         ];
395
-        foreach($properties as $property => $value) {
396
-            $output .= static::table_row($property,$this->$value);
472
+
473
+        foreach ($properties as $property => $value) {
474
+            $output .= static::table_row($property, $this->$value);
397
         }
475
         }
476
+
398
         $output .= static::table_tail();
477
         $output .= static::table_tail();
399
         return  $output;
478
         return  $output;
400
     }
479
     }
401
-    public function output_raw() {
480
+
481
+    public function output_raw()
482
+    {
402
         $this->process_vars();
483
         $this->process_vars();
403
         $output = [];
484
         $output = [];
404
         $properties = [
485
         $properties = [
405
             'filename', 'generalformat', 'duration', 'filesize', 'form_codec',
486
             'filename', 'generalformat', 'duration', 'filesize', 'form_codec',
406
             'form_releasegroup'
487
             'form_releasegroup'
407
         ];
488
         ];
408
-        foreach($properties as $property) {
409
-            if ($this->$property) $output[$property] = $this->$property;
489
+
490
+        foreach ($properties as $property) {
491
+            if ($this->$property) {
492
+                $output[$property] = $this->$property;
493
+            }
410
         }
494
         }
495
+
411
         return $output;
496
         return $output;
412
     }
497
     }
413
-    protected function process_vars() {
498
+
499
+    protected function process_vars()
500
+    {
414
         switch (strtolower($this->generalformat)) {
501
         switch (strtolower($this->generalformat)) {
415
             case 'mpeg-ts':
502
             case 'mpeg-ts':
416
                 $this->form_codec = 'MPEG-TS';
503
                 $this->form_codec = 'MPEG-TS';
420
                 $this->form_codec = '---';
507
                 $this->form_codec = '---';
421
                 break;
508
                 break;
422
         }
509
         }
510
+
423
         $matches = [];
511
         $matches = [];
424
-        preg_match('/(?:^|.*\\|\/)\[(.*?)\].*$/',
425
-            $this->filename, $matches);
512
+        preg_match(
513
+            '/(?:^|.*\\|\/)\[(.*?)\].*$/',
514
+            $this->filename,
515
+            $matches
516
+        );
426
         $this->form_releasegroup = $matches ? $matches[1] : '';
517
         $this->form_releasegroup = $matches ? $matches[1] : '';
427
     }
518
     }
428
 }
519
 }
429
 
520
 
430
-class TextSectionParser extends SectionParser {
521
+class TextSectionParser extends SectionParser
522
+{
431
     protected $title;
523
     protected $title;
432
     protected $language;
524
     protected $language;
433
     protected $format;
525
     protected $format;
435
     protected $processed_language;
527
     protected $processed_language;
436
     protected $form_format;
528
     protected $form_format;
437
 
529
 
438
-    protected function handle_cases($property,$value) {
530
+    protected function handle_cases($property, $value)
531
+    {
439
         switch ($property) {
532
         switch ($property) {
440
             case 'title':
533
             case 'title':
441
                 $this->title = $value;
534
                 $this->title = $value;
451
                 break;
544
                 break;
452
         }
545
         }
453
     }
546
     }
454
-    public function output() {
547
+
548
+    public function output()
549
+    {
455
         $this->process_vars();
550
         $this->process_vars();
456
         $language = $this->processed_language;
551
         $language = $this->processed_language;
457
         $output = "$language ($this->format)";
552
         $output = "$language ($this->format)";
458
-        if ($this->title) $output .= " ($this->title)";
459
-        if ($this->default) $output .= ' (default)';
553
+        if ($this->title) {
554
+            $output .= " ($this->title)";
555
+        }
556
+        if ($this->default) {
557
+            $output .= ' (default)';
558
+        }
460
         return $output;
559
         return $output;
461
     }
560
     }
462
-    public function output_raw() {
561
+
562
+    public function output_raw()
563
+    {
463
         $this->process_vars();
564
         $this->process_vars();
464
         $output = [];
565
         $output = [];
465
         $properties = [
566
         $properties = [
466
             'title', 'language', 'format', 'default', 'processed_language',
567
             'title', 'language', 'format', 'default', 'processed_language',
467
             'form_format'
568
             'form_format'
468
         ];
569
         ];
469
-        foreach($properties as $property) {
470
-            if ($this->$property) $output[$property] = $this->$property;
570
+        foreach ($properties as $property) {
571
+            if ($this->$property) {
572
+                $output[$property] = $this->$property;
573
+            }
471
         }
574
         }
472
         return $output;
575
         return $output;
473
     }
576
     }
474
-    protected function process_vars() {
577
+
578
+    protected function process_vars()
579
+    {
475
         $this->processed_language = ($this->language) ?
580
         $this->processed_language = ($this->language) ?
476
             $this->language : 'Unknown';
581
             $this->language : 'Unknown';
477
         $this->form_format = 'Softsubbed';
582
         $this->form_format = 'Softsubbed';
478
     }
583
     }
479
 }
584
 }
480
 
585
 
481
-class VideoSectionParser extends SectionParser {
586
+class VideoSectionParser extends SectionParser
587
+{
482
     protected $videoformat;
588
     protected $videoformat;
483
     protected $videoformatversion;
589
     protected $videoformatversion;
484
     protected $codec;
590
     protected $codec;
499
     protected $form_codec;
605
     protected $form_codec;
500
     protected $form_resolution;
606
     protected $form_resolution;
501
 
607
 
502
-    protected function handle_cases($property,$value) {
608
+    protected function handle_cases($property, $value)
609
+    {
503
         switch ($property) {
610
         switch ($property) {
504
             case "format":
611
             case "format":
505
                 $this->videoformat = $value;
612
                 $this->videoformat = $value;
546
                 break;
653
                 break;
547
         }
654
         }
548
     }
655
     }
549
-    public function output() {
656
+
657
+    public function output()
658
+    {
550
         $this->process_vars();
659
         $this->process_vars();
551
         $output = static::table_head('Video');
660
         $output = static::table_head('Video');
552
         $properties = [
661
         $properties = [
558
             'Bit rate' => 'bitrate',
667
             'Bit rate' => 'bitrate',
559
             'BPP' => 'bpp'
668
             'BPP' => 'bpp'
560
         ];
669
         ];
561
-        foreach($properties as $property => $value) {
562
-            $output .= static::table_row($property,$this->$value);
670
+
671
+        foreach ($properties as $property => $value) {
672
+            $output .= static::table_row($property, $this->$value);
563
         }
673
         }
674
+
564
         $output .= static::table_tail();
675
         $output .= static::table_tail();
565
         return  $output;
676
         return  $output;
566
     }
677
     }
567
-    public function output_raw() {
678
+
679
+    public function output_raw()
680
+    {
568
         $this->process_vars();
681
         $this->process_vars();
569
         $output = [];
682
         $output = [];
570
         $properties = [
683
         $properties = [
574
             'processed_codec', 'processed_resolution', 'processed_framerate',
687
             'processed_codec', 'processed_resolution', 'processed_framerate',
575
             'form_codec', 'form_resolution'
688
             'form_codec', 'form_resolution'
576
         ];
689
         ];
577
-        foreach($properties as $property) {
578
-            if ($this->$property) $output[$property] = $this->$property;
690
+
691
+        foreach ($properties as $property) {
692
+            if ($this->$property) {
693
+                $output[$property] = $this->$property;
694
+            }
579
         }
695
         }
696
+
580
         return $output;
697
         return $output;
581
     }
698
     }
582
-    protected function process_vars() {
699
+
700
+    protected function process_vars()
701
+    {
583
         $this->processed_codec = $this->compute_codec();
702
         $this->processed_codec = $this->compute_codec();
584
         $this->processed_resolution = ($this->width) ?
703
         $this->processed_resolution = ($this->width) ?
585
             $this->width . 'x' . $this->height : '';
704
             $this->width . 'x' . $this->height : '';
589
         $this->form_codec = $this->compute_form_codec();
708
         $this->form_codec = $this->compute_form_codec();
590
         $this->form_resolution = $this->compute_form_resolution();
709
         $this->form_resolution = $this->compute_form_resolution();
591
     }
710
     }
592
-    protected function compute_codec() {
711
+
712
+    protected function compute_codec()
713
+    {
593
         switch (strtolower($this->videoformat)) {
714
         switch (strtolower($this->videoformat)) {
594
             case "mpeg video":
715
             case "mpeg video":
595
                 switch (strtolower($this->videoformatversion)) {
716
                 switch (strtolower($this->videoformatversion)) {
615
 
736
 
616
         $chk = strtolower($this->codec);
737
         $chk = strtolower($this->codec);
617
         $wl = strtolower($this->writinglibrary);
738
         $wl = strtolower($this->writinglibrary);
618
-        if (($chk === "v_mpeg4/iso/avc" || $chk === "avc1") && strpos($wl, "x264 core") === FALSE) {
739
+
740
+        if (($chk === "v_mpeg4/iso/avc" || $chk === "avc1") && strpos($wl, "x264 core") === false) {
619
             return "H264";
741
             return "H264";
620
-        } else if (($chk === "v_mpeg4/iso/avc" || $chk === "avc1") && strpos($wl, "x264 core") > -1)  {
742
+        } elseif (($chk === "v_mpeg4/iso/avc" || $chk === "avc1") && strpos($wl, "x264 core") > -1) {
621
             return "x264";
743
             return "x264";
622
-        } else if (strtolower($this->videoformat) === "avc" && strpos($wl, "x264 core") === FALSE) {
744
+        } elseif (strtolower($this->videoformat) === "avc" && strpos($wl, "x264 core") === false) {
623
             return "H264";
745
             return "H264";
624
         }
746
         }
625
 
747
 
626
-        if (($chk === 'v_mpegh/iso/hevc') || ($wl === 'hevc'))
748
+        if (($chk === 'v_mpegh/iso/hevc') || ($wl === 'hevc')) {
627
             return 'H265';
749
             return 'H265';
750
+        }
628
     }
751
     }
629
-    protected function compute_form_codec() {
752
+
753
+    protected function compute_form_codec()
754
+    {
630
         // Not implemented: DVD5, DVD9, WMV, Real Video
755
         // Not implemented: DVD5, DVD9, WMV, Real Video
631
         // MPEG-TS set as GeneralSectionParser::$form_codec if found
756
         // MPEG-TS set as GeneralSectionParser::$form_codec if found
632
         // MPEG-PS sets GeneralSectionParser::$form_codec to blank form value
757
         // MPEG-PS sets GeneralSectionParser::$form_codec to blank form value
633
         //   so DVD5 or DVD9 is selected manually.
758
         //   so DVD5 or DVD9 is selected manually.
634
         $codec = $this->compute_codec();
759
         $codec = $this->compute_codec();
635
-        switch(strtolower($codec)) {
760
+        switch (strtolower($codec)) {
636
             case 'x264':
761
             case 'x264':
637
             case 'h264':
762
             case 'h264':
638
                 return strtolower($this->bitdepth) == '10 bits' ?
763
                 return strtolower($this->bitdepth) == '10 bits' ?
649
             case 'mpeg-2':
774
             case 'mpeg-2':
650
                 return 'MPEG-2';
775
                 return 'MPEG-2';
651
         }
776
         }
652
-        switch(strtolower($this->codec)) {
777
+
778
+        switch (strtolower($this->codec)) {
653
             case 'wmv3':
779
             case 'wmv3':
654
                 return 'VC-1';
780
                 return 'VC-1';
655
             case 'mp43':
781
             case 'mp43':
656
                 return 'MPEG-4 v3';
782
                 return 'MPEG-4 v3';
657
         }
783
         }
658
-        switch(strtolower($this->videoformat)) {
784
+
785
+        switch (strtolower($this->videoformat)) {
659
             case 'vc-1':
786
             case 'vc-1':
660
                 return 'VC-1';
787
                 return 'VC-1';
661
             case 's-mpeg 4 v3':
788
             case 's-mpeg 4 v3':
662
                 return 'MPEG-4 v3';
789
                 return 'MPEG-4 v3';
663
         }
790
         }
664
     }
791
     }
665
-    protected function compute_form_resolution() {
792
+
793
+    protected function compute_form_resolution()
794
+    {
666
         global $Resolutions;
795
         global $Resolutions;
667
         $closest = null;
796
         $closest = null;
797
+        
668
         if (isset($this->height)) {
798
         if (isset($this->height)) {
669
             $resolutions = $Resolutions;
799
             $resolutions = $Resolutions;
670
-            foreach($resolutions as $resolution) {
800
+            foreach ($resolutions as $resolution) {
671
                 if (!isset($closest) || abs($this->height - $resolution) <
801
                 if (!isset($closest) || abs($this->height - $resolution) <
672
                         abs($this->height - $closest)) {
802
                         abs($this->height - $closest)) {
673
                     $closest = $resolution;
803
                     $closest = $resolution;

+ 27
- 24
classes/reports.class.php View File

1
 <?php
1
 <?php
2
-class Reports {
3
-  /**
4
-   * This function formats a string containing a torrent's remaster information
5
-   * to be used in Reports v2.
6
-   *
7
-   * @param boolean  $Remastered - whether the torrent contains remaster information
8
-   * @param string   $RemasterTitle - the title of the remaster information
9
-   * @param string   $RemasterYear - the year of the remaster information
10
-   */
11
-  public static function format_reports_remaster_info($Remastered, $RemasterTitle, $RemasterYear) {
12
-    if ($Remastered) {
13
-      $RemasterDisplayString = ' &lt;';
14
-      if ($RemasterTitle != '' && $RemasterYear != '') {
15
-        $RemasterDisplayString .= "$RemasterTitle - $RemasterYear";
16
-      } elseif ($RemasterTitle != '' && $RemasterYear == '') {
17
-        $RemasterDisplayString .= $RemasterTitle;
18
-      } elseif ($RemasterTitle == '' && $RemasterYear != '') {
19
-        $RemasterDisplayString .= $RemasterYear;
20
-      }
21
-      $RemasterDisplayString .= '&gt;';
22
-    } else {
23
-      $RemasterDisplayString = '';
2
+
3
+class Reports
4
+{
5
+    /**
6
+     * This function formats a string containing a torrent's remaster information
7
+     * to be used in Reports v2.
8
+     *
9
+     * @param boolean  $Remastered - whether the torrent contains remaster information
10
+     * @param string   $RemasterTitle - the title of the remaster information
11
+     * @param string   $RemasterYear - the year of the remaster information
12
+     */
13
+    public static function format_reports_remaster_info($Remastered, $RemasterTitle, $RemasterYear)
14
+    {
15
+        if ($Remastered) {
16
+            $RemasterDisplayString = ' &lt;';
17
+            if ($RemasterTitle !== '' && $RemasterYear !== '') {
18
+                $RemasterDisplayString .= "$RemasterTitle - $RemasterYear";
19
+            } elseif ($RemasterTitle !== '' && $RemasterYear === '') {
20
+                $RemasterDisplayString .= $RemasterTitle;
21
+            } elseif ($RemasterTitle === '' && $RemasterYear !== '') {
22
+                $RemasterDisplayString .= $RemasterYear;
23
+            }
24
+            $RemasterDisplayString .= '&gt;';
25
+        } else {
26
+            $RemasterDisplayString = '';
27
+        }
28
+        return $RemasterDisplayString;
24
     }
29
     }
25
-    return $RemasterDisplayString;
26
-  }
27
 }
30
 }

+ 77
- 68
classes/top10view.class.php View File

1
-<?
1
+<?php
2
 
2
 
3
-class Top10View {
3
+class Top10View
4
+{
5
+    public static function render_linkbox($Selected)
6
+    {
7
+        ?>
4
 
8
 
5
-  public static function render_linkbox($Selected) {
6
-?>
7
-    <div class="linkbox">
8
-      <a href="top10.php?type=torrents" class="brackets"><?=self::get_selected_link("Torrents", $Selected == "torrents")?></a>
9
-      <a href="top10.php?type=users" class="brackets"><?=self::get_selected_link("Users", $Selected == "users")?></a>
10
-      <a href="top10.php?type=tags" class="brackets"><?=self::get_selected_link("Tags", $Selected == "tags")?></a>
11
-<?  if (FEATURE_DONATE) { ?>
12
-      <a href="top10.php?type=donors" class="brackets"><?=self::get_selected_link("Donors", $Selected == "donors")?></a>
13
-<?  } ?>
14
-    </div>
15
-<?
16
-  }
9
+<div class="linkbox">
10
+  <a href="top10.php?type=torrents" class="brackets"><?=self::get_selected_link("Torrents", $Selected === "torrents")?></a>
11
+  <a href="top10.php?type=users" class="brackets"><?=self::get_selected_link("Users", $Selected === "users")?></a>
12
+  <a href="top10.php?type=tags" class="brackets"><?=self::get_selected_link("Tags", $Selected === "tags")?></a>
13
+  <?php if (FEATURE_DONATE) { ?>
14
+  <a href="top10.php?type=donors" class="brackets"><?=self::get_selected_link("Donors", $Selected === "donors")?></a>
15
+  <?php } ?>
16
+</div>
17
 
17
 
18
-  private static function get_selected_link($String, $Selected) {
19
-    if ($Selected) {
20
-      return "<strong>$String</strong>";
21
-    } else {
22
-      return $String;
18
+<?php
23
     }
19
     }
24
-  }
25
 
20
 
26
-  public static function render_artist_tile($Artist, $Category) {
27
-    if (self::is_valid_artist($Artist)) {
28
-      switch ($Category) {
29
-        case 'weekly':
30
-        case 'hyped':
31
-          self::render_tile("artist.php?artistname=", $Artist['name'], $Artist['image'][3]['#text']);
32
-          break;
33
-        default:
34
-          break;
35
-      }
21
+    private static function get_selected_link($String, $Selected)
22
+    {
23
+        if ($Selected) {
24
+            return "<strong>$String</strong>";
25
+        } else {
26
+            return $String;
27
+        }
36
     }
28
     }
37
-  }
38
 
29
 
39
-  private static function render_tile($Url, $Name, $Image) {
40
-    if (!empty($Image)) {
41
-      $Name = display_str($Name);
42
-?>
43
-      <li>
44
-        <a href="<?=$Url?><?=$Name?>">
45
-          <img class="tooltip large_tile" alt="<?=$Name?>" title="<?=$Name?>" src="<?=ImageTools::process($Image)?>" />
46
-        </a>
47
-      </li>
48
-<?
30
+    public static function render_artist_tile($Artist, $Category)
31
+    {
32
+        if (self::is_valid_artist($Artist)) {
33
+            switch ($Category) {
34
+              case 'weekly':
35
+              case 'hyped':
36
+                self::render_tile("artist.php?artistname=", $Artist['name'], $Artist['image'][3]['#text']);
37
+                break;
38
+              default:
39
+                break;
40
+            }
41
+        }
49
     }
42
     }
50
-  }
51
 
43
 
44
+    private static function render_tile($Url, $Name, $Image)
45
+    {
46
+        if (!empty($Image)) {
47
+            $Name = display_str($Name); ?>
52
 
48
 
53
-  public static function render_artist_list($Artist, $Category) {
54
-    if (self::is_valid_artist($Artist)) {
55
-      switch ($Category) {
56
-
57
-        case 'weekly':
58
-        case 'hyped':
59
-          self::render_list("artist.php?artistname=", $Artist['name'], $Artist['image'][3]['#text']);
60
-          break;
61
-        default:
62
-          break;
63
-      }
49
+<li>
50
+  <a
51
+    href="<?=$Url?><?=$Name?>">
52
+    <img class="tooltip large_tile" alt="<?=$Name?>"
53
+      title="<?=$Name?>"
54
+      src="<?=ImageTools::process($Image)?>" />
55
+  </a>
56
+</li>
57
+<?php
58
+        }
64
     }
59
     }
65
-  }
66
 
60
 
67
-  private static function render_list($Url, $Name, $Image) {
68
-    if (!empty($Image)) {
69
-      $Image = ImageTools::process($Image);
70
-      $Title = "title=\"&lt;img class=&quot;large_tile&quot; src=&quot;$Image&quot; alt=&quot;&quot; /&gt;\"";
71
-      $Name = display_str($Name);
72
-?>
73
-      <li>
74
-        <a class="tooltip_image" data-title-plain="<?=$Name?>" <?=$Title?> href="<?=$Url?><?=$Name?>"><?=$Name?></a>
75
-      </li>
76
-<?
61
+    public static function render_artist_list($Artist, $Category)
62
+    {
63
+        if (self::is_valid_artist($Artist)) {
64
+            switch ($Category) {
65
+              case 'weekly':
66
+              case 'hyped':
67
+                self::render_list("artist.php?artistname=", $Artist['name'], $Artist['image'][3]['#text']);
68
+                break;
69
+              default:
70
+                break;
71
+            }
72
+        }
77
     }
73
     }
78
-  }
79
 
74
 
80
-  private static function is_valid_artist($Artist) {
81
-    return $Artist['name'] != '[unknown]';
82
-  }
75
+    private static function render_list($Url, $Name, $Image)
76
+    {
77
+        if (!empty($Image)) {
78
+            $Image = ImageTools::process($Image);
79
+            $Title = "title=\"&lt;img class=&quot;large_tile&quot; src=&quot;$Image&quot; alt=&quot;&quot; /&gt;\"";
80
+            $Name = display_str($Name); ?>
81
+
82
+<li>
83
+  <a class="tooltip_image" data-title-plain="<?=$Name?>" <?=$Title?> href="<?=$Url?><?=$Name?>"><?=$Name?></a>
84
+</li>
85
+<?php
86
+        }
87
+    }
83
 
88
 
89
+    private static function is_valid_artist($Artist)
90
+    {
91
+        return $Artist['name'] !== '[unknown]';
92
+    }
84
 }
93
 }

+ 30
- 24
classes/util.php View File

52
     if (!is_array($Base) || !is_array($Keys)) {
52
     if (!is_array($Base) || !is_array($Keys)) {
53
         return;
53
         return;
54
     }
54
     }
55
+
55
     foreach ($Keys as $Key) {
56
     foreach ($Keys as $Key) {
56
         if (!isset($Base[$Key]) || !is_number($Base[$Key])) {
57
         if (!isset($Base[$Key]) || !is_number($Base[$Key])) {
57
             error($Error);
58
             error($Error);
71
     if (is_bool($Value)) {
72
     if (is_bool($Value)) {
72
         return $Value;
73
         return $Value;
73
     }
74
     }
75
+
74
     if (is_string($Value)) {
76
     if (is_string($Value)) {
75
         switch (strtolower($Value)) {
77
         switch (strtolower($Value)) {
76
-      case 'true':
77
-      case 'yes':
78
-      case 'on':
79
-      case '1':
80
-        return true;
81
-      case 'false':
82
-      case 'no':
83
-      case 'off':
84
-      case '0':
85
-        return false;
86
-    }
78
+            case 'true':
79
+            case 'yes':
80
+            case 'on':
81
+            case '1':
82
+                return true;
83
+            case 'false':
84
+            case 'no':
85
+            case 'off':
86
+            case '0':
87
+                return false;
88
+        }
87
     }
89
     }
90
+
88
     if (is_numeric($Value)) {
91
     if (is_numeric($Value)) {
89
         if ($Value === 1) {
92
         if ($Value === 1) {
90
             return true;
93
             return true;
92
             return false;
95
             return false;
93
         }
96
         }
94
     }
97
     }
98
+
95
     return null;
99
     return null;
96
 }
100
 }
97
 
101
 
107
     if ($Str === null || $Str === false || is_array($Str)) {
111
     if ($Str === null || $Str === false || is_array($Str)) {
108
         return '';
112
         return '';
109
     }
113
     }
114
+
110
     if ($Str !== '' && !is_number($Str)) {
115
     if ($Str !== '' && !is_number($Str)) {
111
         $Str = Format::make_utf8($Str);
116
         $Str = Format::make_utf8($Str);
112
         $Str = mb_convert_encoding($Str, 'HTML-ENTITIES', 'UTF-8');
117
         $Str = mb_convert_encoding($Str, 'HTML-ENTITIES', 'UTF-8');
113
         $Str = preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,6};)/m", '&amp;', $Str);
118
         $Str = preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,6};)/m", '&amp;', $Str);
114
 
119
 
115
         $Replace = array(
120
         $Replace = array(
116
-      "'",'"',"<",">",
117
-      '&#128;','&#130;','&#131;','&#132;','&#133;','&#134;','&#135;','&#136;',
118
-      '&#137;','&#138;','&#139;','&#140;','&#142;','&#145;','&#146;','&#147;',
119
-      '&#148;','&#149;','&#150;','&#151;','&#152;','&#153;','&#154;','&#155;',
120
-      '&#156;','&#158;','&#159;'
121
-    );
121
+            "'",'"',"<",">",
122
+            '&#128;','&#130;','&#131;','&#132;','&#133;','&#134;','&#135;','&#136;',
123
+            '&#137;','&#138;','&#139;','&#140;','&#142;','&#145;','&#146;','&#147;',
124
+            '&#148;','&#149;','&#150;','&#151;','&#152;','&#153;','&#154;','&#155;',
125
+            '&#156;','&#158;','&#159;'
126
+        );
122
 
127
 
123
         $With = array(
128
         $With = array(
124
-      '&#39;','&quot;','&lt;','&gt;',
125
-      '&#8364;','&#8218;','&#402;','&#8222;','&#8230;','&#8224;','&#8225;','&#710;',
126
-      '&#8240;','&#352;','&#8249;','&#338;','&#381;','&#8216;','&#8217;','&#8220;',
127
-      '&#8221;','&#8226;','&#8211;','&#8212;','&#732;','&#8482;','&#353;','&#8250;',
128
-      '&#339;','&#382;','&#376;'
129
-    );
129
+            '&#39;','&quot;','&lt;','&gt;',
130
+            '&#8364;','&#8218;','&#402;','&#8222;','&#8230;','&#8224;','&#8225;','&#710;',
131
+            '&#8240;','&#352;','&#8249;','&#338;','&#381;','&#8216;','&#8217;','&#8220;',
132
+            '&#8221;','&#8226;','&#8211;','&#8212;','&#732;','&#8482;','&#353;','&#8250;',
133
+            '&#339;','&#382;','&#376;'
134
+        );
130
 
135
 
131
         $Str = str_replace($Replace, $With, $Str);
136
         $Str = str_replace($Replace, $With, $Str);
132
     }
137
     }
147
 
152
 
148
     $IRCSocket = fsockopen(SOCKET_LISTEN_ADDRESS, SOCKET_LISTEN_PORT);
153
     $IRCSocket = fsockopen(SOCKET_LISTEN_ADDRESS, SOCKET_LISTEN_PORT);
149
     $Raw = str_replace(array("\n", "\r"), '', $Raw);
154
     $Raw = str_replace(array("\n", "\r"), '', $Raw);
155
+
150
     fwrite($IRCSocket, $Raw);
156
     fwrite($IRCSocket, $Raw);
151
     fclose($IRCSocket);
157
     fclose($IRCSocket);
152
 }
158
 }
163
 function error($Error, $NoHTML = false, $Log = false)
169
 function error($Error, $NoHTML = false, $Log = false)
164
 {
170
 {
165
     global $Debug;
171
     global $Debug;
166
-    require(SERVER_ROOT.'/sections/error/index.php');
172
+    require SERVER_ROOT.'/sections/error/index.php';
167
     $Debug->profile();
173
     $Debug->profile();
168
     die();
174
     die();
169
 }
175
 }

+ 40
- 38
sections/ajax/forum/thread.php View File

18
         $ThreadID = $_GET['topicid'];
18
         $ThreadID = $_GET['topicid'];
19
     } elseif (isset($_GET['postid']) && is_number($_GET['postid'])) {
19
     } elseif (isset($_GET['postid']) && is_number($_GET['postid'])) {
20
         $DB->query("
20
         $DB->query("
21
-      SELECT TopicID
22
-      FROM forums_posts
23
-      WHERE ID = $_GET[postid]");
21
+        SELECT TopicID
22
+        FROM forums_posts
23
+          WHERE ID = $_GET[postid]");
24
         list($ThreadID) = $DB->next_record();
24
         list($ThreadID) = $DB->next_record();
25
+
25
         if ($ThreadID) {
26
         if ($ThreadID) {
26
-            //Redirect postid to threadid when necessary.
27
+            // Redirect postid to threadid when necessary
27
             header("Location: ajax.php?action=forum&type=viewthread&threadid=$ThreadID&postid=$_GET[postid]");
28
             header("Location: ajax.php?action=forum&type=viewthread&threadid=$ThreadID&postid=$_GET[postid]");
28
             die();
29
             die();
29
         } else {
30
         } else {
67
         $PostNum = $_GET['post'];
68
         $PostNum = $_GET['post'];
68
     } elseif (isset($_GET['postid']) && is_number($_GET['postid'])) {
69
     } elseif (isset($_GET['postid']) && is_number($_GET['postid'])) {
69
         $DB->query("
70
         $DB->query("
70
-      SELECT COUNT(ID)
71
-      FROM forums_posts
72
-      WHERE TopicID = $ThreadID
73
-        AND ID <= $_GET[postid]");
71
+        SELECT COUNT(ID)
72
+        FROM forums_posts
73
+          WHERE TopicID = $ThreadID
74
+          AND ID <= $_GET[postid]");
74
         list($PostNum) = $DB->next_record();
75
         list($PostNum) = $DB->next_record();
75
     } else {
76
     } else {
76
         $PostNum = 1;
77
         $PostNum = 1;
115
     // Handle last read
116
     // Handle last read
116
     if (!$ThreadInfo['IsLocked'] || $ThreadInfo['IsSticky']) {
117
     if (!$ThreadInfo['IsLocked'] || $ThreadInfo['IsSticky']) {
117
         $DB->query("
118
         $DB->query("
118
-      SELECT PostID
119
-      FROM forums_last_read_topics
120
-      WHERE UserID = '$LoggedUser[ID]'
121
-        AND TopicID = '$ThreadID'");
119
+        SELECT PostID
120
+        FROM forums_last_read_topics
121
+          WHERE UserID = '$LoggedUser[ID]'
122
+          AND TopicID = '$ThreadID'");
122
         list($LastRead) = $DB->next_record();
123
         list($LastRead) = $DB->next_record();
124
+
123
         if ($LastRead < $LastPost) {
125
         if ($LastRead < $LastPost) {
124
             $DB->query("
126
             $DB->query("
125
-        INSERT INTO forums_last_read_topics
126
-          (UserID, TopicID, PostID)
127
-        VALUES
128
-          ('$LoggedUser[ID]', '$ThreadID', '".db_string($LastPost)."')
129
-        ON DUPLICATE KEY UPDATE
130
-          PostID = '$LastPost'");
127
+            INSERT INTO forums_last_read_topics
128
+              (UserID, TopicID, PostID)
129
+            VALUES
130
+              ('$LoggedUser[ID]', '$ThreadID', '".db_string($LastPost)."')
131
+            ON DUPLICATE KEY UPDATE
132
+              PostID = '$LastPost'");
131
         }
133
         }
132
     }
134
     }
133
 }
135
 }
144
 }
146
 }
145
 
147
 
146
 $JsonPoll = [];
148
 $JsonPoll = [];
147
-if ($ThreadInfo['NoPoll'] == 0) {
149
+if ($ThreadInfo['NoPoll'] === 0) {
148
     if (!list($Question, $Answers, $Votes, $Featured, $Closed) = $Cache->get_value("polls_$ThreadID")) {
150
     if (!list($Question, $Answers, $Votes, $Featured, $Closed) = $Cache->get_value("polls_$ThreadID")) {
149
         $DB->query("
151
         $DB->query("
150
-      SELECT Question, Answers, Featured, Closed
151
-      FROM forums_polls
152
-      WHERE TopicID = '$ThreadID'");
152
+        SELECT Question, Answers, Featured, Closed
153
+        FROM forums_polls
154
+          WHERE TopicID = '$ThreadID'");
153
         list($Question, $Answers, $Featured, $Closed) = $DB->next_record(MYSQLI_NUM, array(1));
155
         list($Question, $Answers, $Featured, $Closed) = $DB->next_record(MYSQLI_NUM, array(1));
154
         $Answers = unserialize($Answers);
156
         $Answers = unserialize($Answers);
155
         $DB->query("
157
         $DB->query("
156
-      SELECT Vote, COUNT(UserID)
157
-      FROM forums_polls_votes
158
-      WHERE TopicID = '$ThreadID'
159
-      GROUP BY Vote");
158
+        SELECT Vote, COUNT(UserID)
159
+        FROM forums_polls_votes
160
+          WHERE TopicID = '$ThreadID'
161
+        GROUP BY Vote");
160
         $VoteArray = $DB->to_array(false, MYSQLI_NUM);
162
         $VoteArray = $DB->to_array(false, MYSQLI_NUM);
161
 
163
 
162
         $Votes = [];
164
         $Votes = [];
186
     $DB->query("
188
     $DB->query("
187
     SELECT Vote
189
     SELECT Vote
188
     FROM forums_polls_votes
190
     FROM forums_polls_votes
189
-    WHERE UserID = '".$LoggedUser['ID']."'
191
+      WHERE UserID = '".$LoggedUser['ID']."'
190
       AND TopicID = '$ThreadID'");
192
       AND TopicID = '$ThreadID'");
191
     list($UserResponse) = $DB->next_record();
193
     list($UserResponse) = $DB->next_record();
192
-    if (!empty($UserResponse) && $UserResponse != 0) {
193
-        $Answers[$UserResponse] = '&raquo; '.$Answers[$UserResponse];
194
+    if (!empty($UserResponse) && $UserResponse !== 0) {
195
+        $Answers[$UserResponse] = ' '.$Answers[$UserResponse];
194
     } else {
196
     } else {
195
         if (!empty($UserResponse) && $RevealVoters) {
197
         if (!empty($UserResponse) && $RevealVoters) {
196
-            $Answers[$UserResponse] = '&raquo; '.$Answers[$UserResponse];
198
+            $Answers[$UserResponse] = ' '.$Answers[$UserResponse];
197
         }
199
         }
198
     }
200
     }
199
 
201
 
200
-    $JsonPoll['closed'] = ($Closed == 1);
202
+    $JsonPoll['closed'] = ($Closed === 1);
201
     $JsonPoll['featured'] = $Featured;
203
     $JsonPoll['featured'] = $Featured;
202
     $JsonPoll['question'] = $Question;
204
     $JsonPoll['question'] = $Question;
203
     $JsonPoll['maxVotes'] = (int)$MaxVotes;
205
     $JsonPoll['maxVotes'] = (int)$MaxVotes;
213
             $Percent = 0;
215
             $Percent = 0;
214
         }
216
         }
215
         $JsonPollAnswers[] = array(
217
         $JsonPollAnswers[] = array(
216
-      'answer' => $Answer,
217
-      'ratio' => $Ratio,
218
-      'percent' => $Percent
218
+            'answer' => $Answer,
219
+            'ratio' => $Ratio,
220
+            'percent' => $Percent
219
     );
221
     );
220
     }
222
     }
221
 
223
 
230
 
232
 
231
 // Sqeeze in stickypost
233
 // Sqeeze in stickypost
232
 if ($ThreadInfo['StickyPostID']) {
234
 if ($ThreadInfo['StickyPostID']) {
233
-    if ($ThreadInfo['StickyPostID'] != $Thread[0]['ID']) {
235
+    if ($ThreadInfo['StickyPostID'] !== $Thread[0]['ID']) {
234
         array_unshift($Thread, $ThreadInfo['StickyPost']);
236
         array_unshift($Thread, $ThreadInfo['StickyPost']);
235
     }
237
     }
236
-    if ($ThreadInfo['StickyPostID'] != $Thread[count($Thread) - 1]['ID']) {
238
+    if ($ThreadInfo['StickyPostID'] !== $Thread[count($Thread) - 1]['ID']) {
237
         $Thread[] = $ThreadInfo['StickyPost'];
239
         $Thread[] = $ThreadInfo['StickyPost'];
238
     }
240
     }
239
 }
241
 }
274
     'threadId' => (int)$ThreadID,
276
     'threadId' => (int)$ThreadID,
275
     'threadTitle' => display_str($ThreadInfo['Title']),
277
     'threadTitle' => display_str($ThreadInfo['Title']),
276
     'subscribed' => in_array($ThreadID, $UserSubscriptions),
278
     'subscribed' => in_array($ThreadID, $UserSubscriptions),
277
-    'locked' => $ThreadInfo['IsLocked'] == 1,
278
-    'sticky' => $ThreadInfo['IsSticky'] == 1,
279
+    'locked' => $ThreadInfo['IsLocked'] === 1,
280
+    'sticky' => $ThreadInfo['IsSticky'] === 1,
279
     'currentPage' => (int)$Page,
281
     'currentPage' => (int)$Page,
280
     'pages' => ceil($ThreadInfo['Posts'] / $PerPage),
282
     'pages' => ceil($ThreadInfo['Posts'] / $PerPage),
281
     'poll' => empty($JsonPoll) ? null : $JsonPoll,
283
     'poll' => empty($JsonPoll) ? null : $JsonPoll,

+ 5
- 5
sections/artist/artist.php View File

167
 }
167
 }
168
 
168
 
169
 $OpenTable = false;
169
 $OpenTable = false;
170
-$ShowGroups = !isset($LoggedUser['TorrentGrouping']) || $LoggedUser['TorrentGrouping'] == 0;
170
+$ShowGroups = !isset($LoggedUser['TorrentGrouping']) || $LoggedUser['TorrentGrouping'] === 0;
171
 $HideTorrents = ($ShowGroups ? '' : ' hidden');
171
 $HideTorrents = ($ShowGroups ? '' : ' hidden');
172
 $OldGroupID = 0;
172
 $OldGroupID = 0;
173
 ?>
173
 ?>
242
         $SnatchedGroupClass = ($GroupFlags['IsSnatched'] ? ' snatched_group' : ''); ?>
242
         $SnatchedGroupClass = ($GroupFlags['IsSnatched'] ? ' snatched_group' : ''); ?>
243
     <tr class="group<?=$SnatchedGroupClass?>">
243
     <tr class="group<?=$SnatchedGroupClass?>">
244
       <?php
244
       <?php
245
-    $ShowGroups = !(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] == 1); ?>
245
+    $ShowGroups = !(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] === 1); ?>
246
       <td class="center">
246
       <td class="center">
247
         <div id="showimg_<?=$GroupID?>"
247
         <div id="showimg_<?=$GroupID?>"
248
           class="<?=($ShowGroups ? 'hide' : 'show')?>_torrents">
248
           class="<?=($ShowGroups ? 'hide' : 'show')?>_torrents">
315
       <td class="number_column"><?=number_format($Torrent['Snatched'])?>
315
       <td class="number_column"><?=number_format($Torrent['Snatched'])?>
316
       </td>
316
       </td>
317
       <td
317
       <td
318
-        class="number_column<?=(($Torrent['Seeders'] == 0) ? ' r00' : '')?>">
318
+        class="number_column<?=(($Torrent['Seeders'] === 0) ? ' r00' : '')?>">
319
         <?=number_format($Torrent['Seeders'])?>
319
         <?=number_format($Torrent['Seeders'])?>
320
       </td>
320
       </td>
321
       <td class="number_column"><?=number_format($Torrent['Leechers'])?>
321
       <td class="number_column"><?=number_format($Torrent['Leechers'])?>
443
       <td class="number_column"><?=number_format($Torrent['Snatched'])?>
443
       <td class="number_column"><?=number_format($Torrent['Snatched'])?>
444
       </td>
444
       </td>
445
       <td
445
       <td
446
-        class="number_column<?=(($Torrent['Seeders'] == 0) ? ' r00' : '')?>">
446
+        class="number_column<?=(($Torrent['Seeders'] === 0) ? ' r00' : '')?>">
447
         <?=number_format($Torrent['Seeders'])?>
447
         <?=number_format($Torrent['Seeders'])?>
448
       </td>
448
       </td>
449
       <td class="number_column"><?=number_format($Torrent['Leechers'])?>
449
       <td class="number_column"><?=number_format($Torrent['Leechers'])?>
560
               value="<?=$Name?>" />
560
               value="<?=$Name?>" />
561
             <input type="hidden" name="action" value="advanced" />
561
             <input type="hidden" name="action" value="advanced" />
562
             <input type="text" autocomplete="off" id="filelist" name="filelist" size="20" />
562
             <input type="text" autocomplete="off" id="filelist" name="filelist" size="20" />
563
-            <input type="submit" value="&gt;" />
563
+            <input type="submit" value="»" />
564
           </form>
564
           </form>
565
         </li>
565
         </li>
566
       </ul>
566
       </ul>

+ 339
- 252
sections/bookmarks/torrents.php View File

1
 <?php
1
 <?php
2
+
3
+# todo: Go through line by line
2
 ini_set('max_execution_time', 600);
4
 ini_set('max_execution_time', 600);
3
 set_time_limit(0);
5
 set_time_limit(0);
4
 
6
 
5
 //~~~~~~~~~~~ Main bookmarks page ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
7
 //~~~~~~~~~~~ Main bookmarks page ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
6
 
8
 
7
-function compare($X, $Y) {
8
-  return($Y['count'] - $X['count']);
9
+function compare($X, $Y)
10
+{
11
+    return($Y['count'] - $X['count']);
9
 }
12
 }
10
 
13
 
11
 if (!empty($_GET['userid'])) {
14
 if (!empty($_GET['userid'])) {
12
-  if (!check_perms('users_override_paranoia')) {
13
-    error(403);
14
-  }
15
-  $UserID = $_GET['userid'];
16
-  if (!is_number($UserID)) {
17
-    error(404);
18
-  }
19
-  $DB->query("
15
+    if (!check_perms('users_override_paranoia')) {
16
+        error(403);
17
+    }
18
+    $UserID = $_GET['userid'];
19
+    if (!is_number($UserID)) {
20
+        error(404);
21
+    }
22
+    $DB->query("
20
     SELECT Username
23
     SELECT Username
21
     FROM users_main
24
     FROM users_main
22
     WHERE ID = '$UserID'");
25
     WHERE ID = '$UserID'");
23
-  list($Username) = $DB->next_record();
26
+    list($Username) = $DB->next_record();
24
 } else {
27
 } else {
25
-  $UserID = $LoggedUser['ID'];
28
+    $UserID = $LoggedUser['ID'];
26
 }
29
 }
27
 
30
 
28
 $Sneaky = $UserID !== $LoggedUser['ID'];
31
 $Sneaky = $UserID !== $LoggedUser['ID'];
38
 
41
 
39
 list($GroupIDs, $CollageDataList, $TorrentList) = Users::get_bookmarks($UserID);
42
 list($GroupIDs, $CollageDataList, $TorrentList) = Users::get_bookmarks($UserID);
40
 foreach ($GroupIDs as $GroupID) {
43
 foreach ($GroupIDs as $GroupID) {
41
-  if (!isset($TorrentList[$GroupID])) {
42
-    continue;
43
-  }
44
-  $Group = $TorrentList[$GroupID];
45
-  extract(Torrents::array_group($Group));
46
-  list(, $Sort, $AddedTime) = array_values($CollageDataList[$GroupID]);
47
-
48
-  // Handle stats and stuff
49
-  $NumGroups++;
50
-
51
-  if ($Artists) {
52
-    foreach ($Artists as $Artist) {
53
-      if (!isset($ArtistCount[$Artist['id']])) {
54
-        $ArtistCount[$Artist['id']] = array('name' => $Artist['name'], 'count' => 1);
55
-      } else {
56
-        $ArtistCount[$Artist['id']]['count']++;
57
-      }
44
+    if (!isset($TorrentList[$GroupID])) {
45
+        continue;
58
     }
46
     }
59
-  }
47
+    $Group = $TorrentList[$GroupID];
48
+    extract(Torrents::array_group($Group));
49
+    list(, $Sort, $AddedTime) = array_values($CollageDataList[$GroupID]);
60
 
50
 
61
-  $TorrentTags = new Tags($TagList);
51
+    // Handle stats and stuff
52
+    $NumGroups++;
62
 
53
 
63
-  $DisplayName = Artists::display_artists($Artists);
64
-
65
-  $GroupName = empty($GroupName) ? (empty($GroupNameRJ) ? $GroupNameJP : $GroupNameRJ) : $GroupName;
66
-
67
-  $DisplayName .= '<a href="torrents.php?id='.$GroupID.'" ';
68
-  if (!isset($LoggedUser['CoverArt']) || $LoggedUser['CoverArt']) {
69
-    $DisplayName .= 'data-cover="'.ImageTools::process($WikiImage, 'thumb').'" ';
70
-  }
71
-  $DisplayName .= ' class="tooltip" title="View torrent group" dir="ltr">'.$GroupName.'</a>';
72
-  if ($GroupYear > 0) {
73
-    $DisplayName = "$DisplayName [$GroupYear]";
74
-  }
75
-  $SnatchedGroupClass = $GroupFlags['IsSnatched'] ? ' snatched_group' : '';
76
-
77
-  // Start an output buffer, so we can store this output in $TorrentTable
78
-  ob_start();
79
-  if (count($Torrents) > 1) {
80
-      // Grouped torrents
81
-      $ShowGroups = !(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] === 1);
82
-?>
83
-      <tr class="group" id="group_<?=$GroupID?>">
84
-        <td class="center">
85
-          <div id="showimg_<?=$GroupID?>" class="<?=($ShowGroups ? 'hide' : 'show')?>_torrents">
86
-            <a class="tooltip show_torrents_link" onclick="toggle_group(<?=$GroupID?>, this, event);" title="Collapse this group. Hold &quot;Ctrl&quot; while clicking to collape all groups on this page."></a>
87
-          </div>
88
-        </td>
89
-        <td class="center">
90
-          <div title="<?=$TorrentTags->title()?>" class="tooltip <?=Format::css_category($GroupCategoryID)?>"></div>
91
-        </td>
92
-        <td colspan="5">
93
-          <?=$DisplayName?>
94
-          <span style="text-align: right;" class="float_right">
95
-            <?=time_diff($AddedTime);?>
96
-<?    if (!$Sneaky) { ?>
97
-            <br />
98
-            <a href="#group_<?=$GroupID?>" class="brackets remove_bookmark" onclick="Unbookmark('torrent', <?=$GroupID?>, ''); return false;">Remove bookmark</a>
99
-<?    } ?>
100
-          </span>
101
-          <div class="tags"><?=$TorrentTags->format()?></div>
102
-        </td>
103
-      </tr>
104
-<?
105
-    foreach ($Torrents as $TorrentID => $Torrent) {
106
-      $SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : '';
107
-?>
108
-  <tr class="group_torrent torrent_row groupid_<?=$GroupID?> <?=$SnatchedTorrentClass . $SnatchedGroupClass . (!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] === 1 ? ' hidden' : '')?>">
109
-    <td colspan="3">
110
-      <span>[ <a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" class="tooltip" title="Download">DL</a>
111
-<?      if (Torrents::can_use_token($Torrent)) { ?>
112
-      | <a href="torrents.php?action=download&amp;id=<?=$TorrentID ?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>&amp;usetoken=1" class="tooltip" title="Use a FL Token" onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
113
-<?      } ?>
114
-      | <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" class="tooltip" title="Report">RP</a> ]
115
-      </span>
116
-      &nbsp;&nbsp;&raquo;&nbsp; <a href="torrents.php?id=<?=$GroupID?>&amp;torrentid=<?=$TorrentID?>"><?=Torrents::torrent_info($Torrent)?></a>
117
-    </td>
118
-    <td class="number_column nobr"><?=Format::get_size($Torrent['Size'])?></td>
119
-    <td class="number_column"><?=number_format($Torrent['Snatched'])?></td>
120
-    <td class="number_column<?=(($Torrent['Seeders'] == 0) ? ' r00' : '')?>"><?=number_format($Torrent['Seeders'])?></td>
121
-    <td class="number_column"><?=number_format($Torrent['Leechers'])?></td>
122
-  </tr>
123
-<?
54
+    if ($Artists) {
55
+        foreach ($Artists as $Artist) {
56
+            if (!isset($ArtistCount[$Artist['id']])) {
57
+                $ArtistCount[$Artist['id']] = array('name' => $Artist['name'], 'count' => 1);
58
+            } else {
59
+                $ArtistCount[$Artist['id']]['count']++;
60
+            }
61
+        }
124
     }
62
     }
125
-  } else {
126
-    // Viewing a type that does not require grouping
127
 
63
 
128
-    $TorrentID = key($Torrents);
129
-    $Torrent = current($Torrents);
64
+    $TorrentTags = new Tags($TagList);
65
+
66
+    $DisplayName = Artists::display_artists($Artists);
130
 
67
 
131
-    $DisplayName = Artists::display_artists(Artists::get_artist($GroupID));
68
+    $GroupName = empty($GroupName) ? (empty($GroupNameRJ) ? $GroupNameJP : $GroupNameRJ) : $GroupName;
132
 
69
 
133
     $DisplayName .= '<a href="torrents.php?id='.$GroupID.'" ';
70
     $DisplayName .= '<a href="torrents.php?id='.$GroupID.'" ';
134
     if (!isset($LoggedUser['CoverArt']) || $LoggedUser['CoverArt']) {
71
     if (!isset($LoggedUser['CoverArt']) || $LoggedUser['CoverArt']) {
135
-      $DisplayName .= 'data-cover="'.ImageTools::process($WikiImage, 'thumb').'" ';
72
+        $DisplayName .= 'data-cover="'.ImageTools::process($WikiImage, 'thumb').'" ';
136
     }
73
     }
137
-    $DisplayName .=' class="tooltip" title="View torrent group" dir="ltr">'.$GroupName.'</a>';
74
+    $DisplayName .= ' class="tooltip" title="View torrent group" dir="ltr">'.$GroupName.'</a>';
75
+    if ($GroupYear > 0) {
76
+        $DisplayName = "$DisplayName [$GroupYear]";
77
+    }
78
+    $SnatchedGroupClass = $GroupFlags['IsSnatched'] ? ' snatched_group' : '';
79
+
80
+    // Start an output buffer, so we can store this output in $TorrentTable
81
+    ob_start();
82
+    if (count($Torrents) > 1) {
83
+        // Grouped torrents
84
+        $ShowGroups = !(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] === 1); ?>
138
 
85
 
139
-    if ($Torrent['IsSnatched']) {
140
-      $DisplayName .= ' ' . Format::torrent_label('Snatched!');
86
+<tr class="group" id="group_<?=$GroupID?>">
87
+  <td class="center">
88
+    <div id="showimg_<?=$GroupID?>"
89
+      class="<?=($ShowGroups ? 'hide' : 'show')?>_torrents">
90
+      <a class="tooltip show_torrents_link"
91
+        onclick="toggle_group(<?=$GroupID?>, this, event);"
92
+        title="Collapse this group. Hold &quot;Ctrl&quot; while clicking to collape all groups on this page."></a>
93
+    </div>
94
+  </td>
95
+  <td class="center">
96
+    <div title="<?=$TorrentTags->title()?>"
97
+      class="tooltip <?=Format::css_category($GroupCategoryID)?>">
98
+    </div>
99
+  </td>
100
+  <td colspan="5">
101
+    <?=$DisplayName?>
102
+    <span style="text-align: right;" class="float_right">
103
+      <?=time_diff($AddedTime); ?>
104
+      <?php if (!$Sneaky) { ?>
105
+      <br />
106
+      <a href="#group_<?=$GroupID?>" class="brackets remove_bookmark"
107
+        onclick="Unbookmark('torrent', <?=$GroupID?>, ''); return false;">Remove
108
+        bookmark</a>
109
+      <?php } ?>
110
+    </span>
111
+    <div class="tags"><?=$TorrentTags->format()?>
112
+    </div>
113
+  </td>
114
+</tr>
115
+<?php
116
+    foreach ($Torrents as $TorrentID => $Torrent) {
117
+        $SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : ''; ?>
118
+<tr
119
+  class="group_torrent torrent_row groupid_<?=$GroupID?> <?=$SnatchedTorrentClass . $SnatchedGroupClass . (!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] === 1 ? ' hidden' : '')?>">
120
+  <td colspan="3">
121
+    <span>[ <a
122
+        href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>"
123
+        class="tooltip" title="Download">DL</a>
124
+      <?php if (Torrents::can_use_token($Torrent)) { ?>
125
+      | <a
126
+        href="torrents.php?action=download&amp;id=<?=$TorrentID ?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>&amp;usetoken=1"
127
+        class="tooltip" title="Use a FL Token"
128
+        onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
129
+      <?php } ?>
130
+      | <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>"
131
+        class="tooltip" title="Report">RP</a> ]
132
+    </span>
133
+    &nbsp;&nbsp;&raquo;&nbsp; <a
134
+      href="torrents.php?id=<?=$GroupID?>&amp;torrentid=<?=$TorrentID?>"><?=Torrents::torrent_info($Torrent)?></a>
135
+  </td>
136
+  <td class="number_column nobr"><?=Format::get_size($Torrent['Size'])?>
137
+  </td>
138
+  <td class="number_column"><?=number_format($Torrent['Snatched'])?>
139
+  </td>
140
+  <td
141
+    class="number_column<?=(($Torrent['Seeders'] == 0) ? ' r00' : '')?>">
142
+    <?=number_format($Torrent['Seeders'])?>
143
+  </td>
144
+  <td class="number_column"><?=number_format($Torrent['Leechers'])?>
145
+  </td>
146
+</tr>
147
+<?php
141
     }
148
     }
142
-    if ($Torrent['FreeTorrent'] === '1') {
143
-      $DisplayName .= ' ' . Format::torrent_label('Freeleech!');
144
-    } elseif ($Torrent['FreeTorrent'] === '2') {
145
-      $DisplayName .= ' ' . Format::torrent_label('Neutral leech!');
146
-    } elseif ($Torrent['PersonalFL']) {
147
-      $DisplayName .= ' ' . Format::torrent_label('Personal Freeleech!');
149
+    } else {
150
+        // Viewing a type that does not require grouping
151
+
152
+        $TorrentID = key($Torrents);
153
+        $Torrent = current($Torrents);
154
+
155
+        $DisplayName = Artists::display_artists(Artists::get_artist($GroupID));
156
+
157
+        $DisplayName .= '<a href="torrents.php?id='.$GroupID.'" ';
158
+        if (!isset($LoggedUser['CoverArt']) || $LoggedUser['CoverArt']) {
159
+            $DisplayName .= 'data-cover="'.ImageTools::process($WikiImage, 'thumb').'" ';
160
+        }
161
+        $DisplayName .=' class="tooltip" title="View torrent group" dir="ltr">'.$GroupName.'</a>';
162
+
163
+        if ($Torrent['IsSnatched']) {
164
+            $DisplayName .= ' ' . Format::torrent_label('Snatched!');
165
+        }
166
+        if ($Torrent['FreeTorrent'] === '1') {
167
+            $DisplayName .= ' ' . Format::torrent_label('Freeleech!');
168
+        } elseif ($Torrent['FreeTorrent'] === '2') {
169
+            $DisplayName .= ' ' . Format::torrent_label('Neutral leech!');
170
+        } elseif ($Torrent['PersonalFL']) {
171
+            $DisplayName .= ' ' . Format::torrent_label('Personal Freeleech!');
172
+        }
173
+        $SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : ''; ?>
174
+<tr
175
+  class="torrent torrent_row<?=$SnatchedTorrentClass . $SnatchedGroupClass?>"
176
+  id="group_<?=$GroupID?>">
177
+  <td></td>
178
+  <td class="center">
179
+    <div title="<?=$TorrentTags->title()?>"
180
+      class="tooltip <?=Format::css_category($GroupCategoryID)?>">
181
+    </div>
182
+  </td>
183
+  <td>
184
+    <span>
185
+      [ <a
186
+        href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>"
187
+        class="tooltip" title="Download">DL</a>
188
+      <?php if (Torrents::can_use_token($Torrent)) { ?>
189
+      | <a
190
+        href="torrents.php?action=download&amp;id=<?=$TorrentID ?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>&amp;usetoken=1"
191
+        class="tooltip" title="Use a FL Token"
192
+        onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
193
+      <?php } ?>
194
+      | <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>"
195
+        class="tooltip" title="Report">RP</a> ]
196
+    </span>
197
+    <span class="float_right float_clear"><?=time_diff($AddedTime); ?></span>
198
+    <?php if (!$Sneaky) { ?>
199
+    <span class="float_right float_clear"><a
200
+        href="#group_<?=$GroupID?>" class="brackets remove_bookmark"
201
+        onclick="Unbookmark('torrent', <?=$GroupID?>, ''); return false;">Remove
202
+        bookmark</a></span>
203
+    <?php } ?>
204
+    <?=$DisplayName?>
205
+    <div class="tags"><?=$TorrentTags->format()?>
206
+    </div>
207
+
208
+  </td>
209
+  <td class="number_column nobr"><?=Format::get_size($Torrent['Size'])?>
210
+  </td>
211
+  <td class="number_column"><?=number_format($Torrent['Snatched'])?>
212
+  </td>
213
+  <td
214
+    class="number_column<?=(($Torrent['Seeders'] == 0) ? ' r00' : '')?>">
215
+    <?=number_format($Torrent['Seeders'])?>
216
+  </td>
217
+  <td class="number_column"><?=number_format($Torrent['Leechers'])?>
218
+  </td>
219
+</tr>
220
+<?php
148
     }
221
     }
149
-    $SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : '';
150
-?>
151
-  <tr class="torrent torrent_row<?=$SnatchedTorrentClass . $SnatchedGroupClass?>" id="group_<?=$GroupID?>">
152
-    <td></td>
153
-    <td class="center">
154
-      <div title="<?=$TorrentTags->title()?>" class="tooltip <?=Format::css_category($GroupCategoryID)?>">
155
-      </div>
156
-    </td>
157
-    <td>
158
-      <span>
159
-        [ <a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" class="tooltip" title="Download">DL</a>
160
-<?    if (Torrents::can_use_token($Torrent)) { ?>
161
-        | <a href="torrents.php?action=download&amp;id=<?=$TorrentID ?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>&amp;usetoken=1" class="tooltip" title="Use a FL Token" onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
162
-<?    } ?>
163
-        | <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" class="tooltip" title="Report">RP</a> ]
164
-      </span>
165
-      <span class="float_right float_clear"><?=time_diff($AddedTime);?></span>
166
-<?    if (!$Sneaky) { ?>
167
-      <span class="float_right float_clear"><a href="#group_<?=$GroupID?>" class="brackets remove_bookmark" onclick="Unbookmark('torrent', <?=$GroupID?>, ''); return false;">Remove bookmark</a></span>
168
-<?    } ?>
169
-      <?=$DisplayName?>
170
-      <div class="tags"><?=$TorrentTags->format()?></div>
171
-
172
-    </td>
173
-    <td class="number_column nobr"><?=Format::get_size($Torrent['Size'])?></td>
174
-    <td class="number_column"><?=number_format($Torrent['Snatched'])?></td>
175
-    <td class="number_column<?=(($Torrent['Seeders'] == 0) ? ' r00' : '')?>"><?=number_format($Torrent['Seeders'])?></td>
176
-    <td class="number_column"><?=number_format($Torrent['Leechers'])?></td>
177
-  </tr>
178
-<?
179
-  }
180
-  $TorrentTable .= ob_get_clean();
222
+    $TorrentTable .= ob_get_clean();
181
 
223
 
182
-  // Album art
224
+    // Album art
183
 
225
 
184
-  ob_start();
226
+    ob_start();
185
 
227
 
186
-  $DisplayName = '';
228
+    $DisplayName = '';
187
 
229
 
188
-  $DisplayName .= Artists::display_artists($Artists, false);
230
+    $DisplayName .= Artists::display_artists($Artists, false);
189
 
231
 
190
-  $DisplayName .= $GroupName;
191
-  if ($GroupYear > 0) {
192
-    $DisplayName = "$DisplayName [$GroupYear]";
193
-  }
194
-  $Tags = display_str($TorrentTags->format());
195
-  $PlainTags = implode(', ', $TorrentTags->get_tags());
196
-?>
232
+    $DisplayName .= $GroupName;
233
+    if ($GroupYear > 0) {
234
+        $DisplayName = "$DisplayName [$GroupYear]";
235
+    }
236
+    $Tags = display_str($TorrentTags->format());
237
+    $PlainTags = implode(', ', $TorrentTags->get_tags()); ?>
197
 <div class='collage_image image_group_<?=$GroupID?>'>
238
 <div class='collage_image image_group_<?=$GroupID?>'>
198
-      <a href="torrents.php?id=<?=$GroupID?>" class="bookmark_<?=$GroupID?>">
199
-<?  if (!$WikiImage) {
200
-      $WikiImage = STATIC_SERVER.'common/noartwork/music.png';
201
-} ?>
202
-        <img class="tooltip_interactive" src="<?=ImageTools::process($WikiImage, 'thumb')?>" alt="<?=$DisplayName?>" title="<?=$DisplayName?> <br /> <?=$Tags?>" data-title-plain="<?="$DisplayName ($PlainTags)"?>" width="100%" />
203
-      </a>
204
-    </div>
239
+  <a href="torrents.php?id=<?=$GroupID?>"
240
+    class="bookmark_<?=$GroupID?>">
241
+    <?php if (!$WikiImage) {
242
+        $WikiImage = STATIC_SERVER.'common/noartwork/music.png';
243
+    } ?>
244
+    <img class="tooltip_interactive"
245
+      src="<?=ImageTools::process($WikiImage, 'thumb')?>"
246
+      alt="<?=$DisplayName?>"
247
+      title="<?=$DisplayName?> <br /> <?=$Tags?>"
248
+      data-title-plain="<?="$DisplayName ($PlainTags)"?>"
249
+      width="100%" />
250
+  </a>
251
+</div>
205
 
252
 
206
-<?
253
+<?php
207
   $Collage[] = ob_get_clean();
254
   $Collage[] = ob_get_clean();
208
-
209
 }
255
 }
210
 
256
 
211
 $CollageCovers = isset($LoggedUser['CollageCovers']) ? (int)$LoggedUser['CollageCovers'] : 10;
257
 $CollageCovers = isset($LoggedUser['CollageCovers']) ? (int)$LoggedUser['CollageCovers'] : 10;
212
 $CollagePages = [];
258
 $CollagePages = [];
213
 if ($CollageCovers > 0) {
259
 if ($CollageCovers > 0) {
214
-  for ($i = 0; $i < $NumGroups / $CollageCovers; $i++) {
215
-    $Groups = array_slice($Collage, $i * $CollageCovers, $CollageCovers);
216
-    $CollagePage = '';
217
-    foreach ($Groups as $Group) {
218
-      $CollagePage .= $Group;
260
+    for ($i = 0; $i < $NumGroups / $CollageCovers; $i++) {
261
+        $Groups = array_slice($Collage, $i * $CollageCovers, $CollageCovers);
262
+        $CollagePage = '';
263
+        foreach ($Groups as $Group) {
264
+            $CollagePage .= $Group;
265
+        }
266
+        $CollagePages[] = $CollagePage;
219
     }
267
     }
220
-    $CollagePages[] = $CollagePage;
221
-  }
222
 }
268
 }
223
 
269
 
224
 View::show_header($Title, 'browse,collage,wall');
270
 View::show_header($Title, 'browse,collage,wall');
225
 ?>
271
 ?>
226
 <div class="thin">
272
 <div class="thin">
227
   <div class="header">
273
   <div class="header">
228
-    <h2><? if (!$Sneaky) { ?><a href="feeds.php?feed=torrents_bookmarks_t_<?=$LoggedUser['torrent_pass']?>&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;name=<?=urlencode(SITE_NAME.': Bookmarked Torrents')?>"><img src="<?=STATIC_SERVER?>/common/symbols/rss.png" alt="RSS feed" /></a>&nbsp;<? } ?><?=$Title?></h2>
274
+    <h2><?php if (!$Sneaky) { ?><a
275
+        href="feeds.php?feed=torrents_bookmarks_t_<?=$LoggedUser['torrent_pass']?>&amp;user=<?=$LoggedUser['ID']?>&amp;auth=<?=$LoggedUser['RSS_Auth']?>&amp;passkey=<?=$LoggedUser['torrent_pass']?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;name=<?=urlencode(SITE_NAME.': Bookmarked Torrents')?>"><img
276
+          src="<?=STATIC_SERVER?>/common/symbols/rss.png"
277
+          alt="RSS feed" /></a>&nbsp;<?php } ?><?=$Title?>
278
+    </h2>
229
     <div class="linkbox">
279
     <div class="linkbox">
230
       <a href="bookmarks.php?type=torrents" class="brackets">Torrents</a>
280
       <a href="bookmarks.php?type=torrents" class="brackets">Torrents</a>
231
       <a href="bookmarks.php?type=artists" class="brackets">Artists</a>
281
       <a href="bookmarks.php?type=artists" class="brackets">Artists</a>
232
       <a href="bookmarks.php?type=collages" class="brackets">Collections</a>
282
       <a href="bookmarks.php?type=collages" class="brackets">Collections</a>
233
       <a href="bookmarks.php?type=requests" class="brackets">Requests</a>
283
       <a href="bookmarks.php?type=requests" class="brackets">Requests</a>
234
-<? if (count($TorrentList) > 0) { ?>
284
+      <?php if (count($TorrentList) > 0) { ?>
235
       <br /><br />
285
       <br /><br />
236
-      <a href="bookmarks.php?action=remove_snatched&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets" onclick="return confirm('Are you sure you want to remove the bookmarks for all items you\'ve snatched?');">Remove snatched</a>
286
+      <a href="bookmarks.php?action=remove_snatched&amp;auth=<?=$LoggedUser['AuthKey']?>"
287
+        class="brackets"
288
+        onclick="return confirm('Are you sure you want to remove the bookmarks for all items you\'ve snatched?');">Remove
289
+        snatched</a>
237
       <a href="bookmarks.php?action=edit&amp;type=torrents" class="brackets">Manage torrents</a>
290
       <a href="bookmarks.php?action=edit&amp;type=torrents" class="brackets">Manage torrents</a>
238
-<? } ?>
291
+      <?php } ?>
239
     </div>
292
     </div>
240
   </div>
293
   </div>
241
-<? if (count($TorrentList) === 0) { ?>
294
+  <?php if (count($TorrentList) === 0) { ?>
242
   <div class="box pad" align="center">
295
   <div class="box pad" align="center">
243
     <h2>You have not bookmarked any torrents.</h2>
296
     <h2>You have not bookmarked any torrents.</h2>
244
   </div>
297
   </div>
245
-</div><!--content-->
246
-<?
298
+</div>
299
+<!--content-->
300
+<?php
247
   View::show_footer();
301
   View::show_footer();
248
   die();
302
   die();
249
 } ?>
303
 } ?>
250
-  <div class="sidebar">
251
-    <div class="box box_info box_statistics_bookmarked_torrents">
252
-      <div class="head"><strong>Stats</strong></div>
253
-      <ul class="stats nobullet">
254
-        <li>Torrent groups: <?=$NumGroups?></li>
255
-        <li>Artists: <?=count($ArtistCount)?></li>
256
-      </ul>
257
-    </div>
258
-    <div class="box box_tags">
259
-      <div class="head"><strong>Top Tags</strong></div>
260
-      <div class="pad">
261
-        <ol style="padding-left: 5px;">
262
-<? Tags::format_top(5) ?>
263
-        </ol>
264
-      </div>
304
+<div class="sidebar">
305
+  <div class="box box_info box_statistics_bookmarked_torrents">
306
+    <div class="head"><strong>Stats</strong></div>
307
+    <ul class="stats nobullet">
308
+      <li>Torrent groups: <?=$NumGroups?>
309
+      </li>
310
+      <li>Artists: <?=count($ArtistCount)?>
311
+      </li>
312
+    </ul>
313
+  </div>
314
+  <div class="box box_tags">
315
+    <div class="head"><strong>Top Tags</strong></div>
316
+    <div class="pad">
317
+      <ol style="padding-left: 5px;">
318
+        <?php Tags::format_top(5) ?>
319
+      </ol>
265
     </div>
320
     </div>
266
-    <div class="box box_artists">
267
-      <div class="head"><strong>Top Artists</strong></div>
268
-      <div class="pad">
269
-<?
321
+  </div>
322
+  <div class="box box_artists">
323
+    <div class="head"><strong>Top Artists</strong></div>
324
+    <div class="pad">
325
+      <?php
270
   $Indent = "\t\t\t\t";
326
   $Indent = "\t\t\t\t";
271
   if (count($ArtistCount) > 0) {
327
   if (count($ArtistCount) > 0) {
272
-    echo "$Indent<ol style=\"padding-left: 5px;\">\n";
273
-    uasort($ArtistCount, 'compare');
274
-    $i = 0;
275
-    foreach ($ArtistCount as $ID => $Artist) {
276
-      $i++;
277
-      if ($i > 10) {
278
-        break;
328
+      echo "$Indent<ol style=\"padding-left: 5px;\">\n";
329
+      uasort($ArtistCount, 'compare');
330
+      $i = 0;
331
+      foreach ($ArtistCount as $ID => $Artist) {
332
+          $i++;
333
+          if ($i > 10) {
334
+              break;
335
+          } ?>
336
+      <li><a href="artist.php?id=<?=$ID?>"><?=display_str($Artist['name'])?></a> (<?=$Artist['count']?>)</li>
337
+      <?php
279
       }
338
       }
280
-?>
281
-          <li><a href="artist.php?id=<?=$ID?>"><?=display_str($Artist['name'])?></a> (<?=$Artist['count']?>)</li>
282
-<?
283
-    }
284
-    echo "$Indent</ol>\n";
339
+      echo "$Indent</ol>\n";
285
   } else {
340
   } else {
286
-    echo "$Indent<ul class=\"nobullet\" style=\"padding-left: 5px;\">\n";
287
-    echo "$Indent\t<li>There are no artists to display.</li>\n";
288
-    echo "$Indent</ul>\n";
341
+      echo "$Indent<ul class=\"nobullet\" style=\"padding-left: 5px;\">\n";
342
+      echo "$Indent\t<li>There are no artists to display.</li>\n";
343
+      echo "$Indent</ul>\n";
289
   }
344
   }
290
 ?>
345
 ?>
291
-      </div>
292
     </div>
346
     </div>
293
   </div>
347
   </div>
294
-  <div class="main_column">
295
-<?
348
+</div>
349
+<div class="main_column">
350
+  <?php
296
 if ($CollageCovers !== 0) { ?>
351
 if ($CollageCovers !== 0) { ?>
297
-    <div id="coverart" class="box">
298
-      <div class="head" id="coverhead"><strong>Cover art</strong></div>
299
-      <div class="collage_images" id="collage_page0" data-wall-child=".collage_image" data-wall-size="4", data-wall-min="2">
300
-<?
352
+  <div id="coverart" class="box">
353
+    <div class="head" id="coverhead"><strong>Cover art</strong></div>
354
+    <div class="collage_images" id="collage_page0" data-wall-child=".collage_image" data-wall-size="4" ,
355
+      data-wall-min="2">
356
+      <?php
301
   $Page1 = array_slice($Collage, 0, $CollageCovers);
357
   $Page1 = array_slice($Collage, 0, $CollageCovers);
302
   foreach ($Page1 as $Group) {
358
   foreach ($Page1 as $Group) {
303
-    echo $Group;
359
+      echo $Group;
304
   }
360
   }
305
 ?>
361
 ?>
306
-      </div>
307
-    </div>
308
-<?  if ($NumGroups > $CollageCovers) { ?>
309
-    <div class="linkbox pager" style="clear: left;" id="pageslinksdiv">
310
-      <span id="firstpage" class="invisible"><a href="#" class="pageslink" onclick="collageShow.page(0, this); return false;">&lt;&lt; First</a> | </span>
311
-      <span id="prevpage" class="invisible"><a href="#" id="prevpage" class="pageslink" onclick="collageShow.prevPage(); return false;">&lt; Prev</a> | </span>
312
-<?    for ($i = 0; $i < $NumGroups / $CollageCovers; $i++) { ?>
313
-      <span id="pagelink<?=$i?>" class="<?=(($i > 4) ? 'hidden' : '')?><?=(($i === 0) ? ' selected' : '')?>"><a href="#" class="pageslink" onclick="collageShow.page(<?=$i?>, this); wall('.collage_images', '.collage_image', 4); return false;"><?=($CollageCovers * $i + 1)?>-<?=min($NumGroups, $CollageCovers * ($i + 1))?></a><?=(($i !== ceil($NumGroups / $CollageCovers) - 1) ? ' | ' : '')?></span>
314
-<?    } ?>
315
-      <span id="nextbar" class="<?=(($NumGroups / $CollageCovers > 5) ? 'hidden' : '')?>"> | </span>
316
-      <span id="nextpage"><a href="#" class="pageslink" onclick="collageShow.nextPage(); wall('.collage_images', '.collage_image', 4); return false;">Next &gt;</a></span>
317
-      <span id="lastpage" class="<?=(ceil($NumGroups / $CollageCovers) === 2 ? 'invisible' : '')?>"> | <a href="#" id="lastpage" class="pageslink" onclick="collageShow.page(<?=(ceil($NumGroups / $CollageCovers) - 1)?>, this); return false;">Last &gt;&gt;</a></span>
318
     </div>
362
     </div>
319
-    <script type="text/javascript">
320
-      $(()=>collageShow.init(<?=json_encode($CollagePages)?>));
321
-    </script>
322
-<?
363
+  </div>
364
+  <?php if ($NumGroups > $CollageCovers) { ?>
365
+  <div class="linkbox pager" style="clear: left;" id="pageslinksdiv">
366
+    <span id="firstpage" class="invisible">
367
+      <a href="#" class="pageslink" onclick="collageShow.page(0, this); return false;">‹ First</a> |
368
+    </span>
369
+    <span id="prevpage" class="invisible">
370
+      <a href="#" id="prevpage" class="pageslink" onclick="collageShow.prevPage(); return false;">&lsaquo; Prev</a> |
371
+    </span>
372
+    <?php for ($i = 0; $i < $NumGroups / $CollageCovers; $i++) { ?>
373
+    <span id="pagelink<?=$i?>"
374
+      class="<?=(($i > 4) ? 'hidden' : '')?><?=(($i === 0) ? ' selected' : '')?>">
375
+      <a href="#" class="pageslink"
376
+        onclick="collageShow.page(<?=$i?>, this); wall('.collage_images', '.collage_image', 4); return false;"><?=($CollageCovers * $i + 1)?>-<?=min($NumGroups, $CollageCovers * ($i + 1))?></a>
377
+      <?=(($i !== ceil($NumGroups / $CollageCovers) - 1) ? ' | ' : '')?>
378
+    </span>
379
+    <?php } ?>
380
+    <span id="nextbar"
381
+      class="<?=(($NumGroups / $CollageCovers > 5) ? 'hidden' : '')?>">
382
+      | </span>
383
+    <span id="nextpage">
384
+      <a href="#" class="pageslink"
385
+        onclick="collageShow.nextPage(); wall('.collage_images', '.collage_image', 4); return false;">Next ›</a>
386
+    </span>
387
+    <span id="lastpage"
388
+      class="<?=(ceil($NumGroups / $CollageCovers) === 2 ? 'invisible' : '')?>">
389
+      | <a href="#" id="lastpage" class="pageslink"
390
+        onclick="collageShow.page(<?=(ceil($NumGroups / $CollageCovers) - 1)?>, this); return false;">Last
391
+        »</a>
392
+    </span>
393
+  </div>
394
+
395
+  <script type="text/javascript">
396
+    $(() => collageShow.init( <?=json_encode($CollagePages)?> ));
397
+  </script>
398
+  <?php
323
   }
399
   }
324
 }
400
 }
325
 ?>
401
 ?>
326
-    <table class="torrent_table grouping cats" id="torrent_table">
327
-      <tr class="colhead_dark">
328
-        <td><!-- expand/collapse --></td>
329
-        <td><!-- Category --></td>
330
-        <td width="70%"><strong>Torrents</strong></td>
331
-        <td>Size</td>
332
-        <td class="sign snatches">
333
-          <a><svg width="15" height="15" fill="black" class="tooltip" alt="Snatches" title="Snatches" viewBox="3 0 88 98"><path d="M20 20 A43 43,0,1,0,77 23 L90 10 L55 10 L55 45 L68 32 A30.27 30.27,0,1,1,28 29"></path></svg></a>
334
-        </td>
335
-        <td class="sign seeders">
336
-          <a><svg width="11" height="15" fill="black" class="tooltip" alt="Seeders" title="Seeders"><polygon points="0,7 5.5,0 11,7 8,7 8,15 3,15 3,7"></polygon></svg></a>
337
-        </td>
338
-        <td class="sign leechers">
339
-          <a><svg width="11" height="15" fill="black" class="tooltip" alt="Leechers" title="Leechers"><polygon points="0,8 5.5,15 11,8 8,8 8,0 3,0 3,8"></polygon></svg></a>
340
-        </td>
341
-      </tr>
342
-<?=$TorrentTable?>
343
-    </table>
344
-  </div>
402
+
403
+  <table class="torrent_table grouping cats" id="torrent_table">
404
+    <tr class="colhead_dark">
405
+      <td>
406
+        <!-- Expand/Collapse -->
407
+      </td>
408
+      <td>
409
+        <!-- Category -->
410
+      </td>
411
+      <td width="70%"><strong>Torrents</strong></td>
412
+      <td>Size</td>
413
+      <td class="sign snatches">
414
+        <a><svg width="15" height="15" fill="black" class="tooltip" alt="Snatches" title="Snatches" viewBox="3 0 88 98">
415
+            <path d="M20 20 A43 43,0,1,0,77 23 L90 10 L55 10 L55 45 L68 32 A30.27 30.27,0,1,1,28 29"></path>
416
+          </svg></a>
417
+      </td>
418
+      <td class="sign seeders">
419
+        <a><svg width="11" height="15" fill="black" class="tooltip" alt="Seeders" title="Seeders">
420
+            <polygon points="0,7 5.5,0 11,7 8,7 8,15 3,15 3,7"></polygon>
421
+          </svg></a>
422
+      </td>
423
+      <td class="sign leechers">
424
+        <a><svg width="11" height="15" fill="black" class="tooltip" alt="Leechers" title="Leechers">
425
+            <polygon points="0,8 5.5,15 11,8 8,8 8,0 3,0 3,8"></polygon>
426
+          </svg></a>
427
+      </td>
428
+    </tr>
429
+    <?=$TorrentTable?>
430
+  </table>
431
+</div>
345
 </div>
432
 </div>
346
-<?
347
-View::show_footer();
433
+
434
+<?php View::show_footer();

+ 18
- 11
sections/collages/all_comments.php View File

1
-<?
1
+<?php
2
+
2
 /**********|| Page to show individual threads || ********************************\
3
 /**********|| Page to show individual threads || ********************************\
3
 
4
 
4
 Things to expect in $_GET:
5
 Things to expect in $_GET:
12
 
13
 
13
 // Check for lame SQL injection attempts
14
 // Check for lame SQL injection attempts
14
 if (!is_number($_GET['collageid'])) {
15
 if (!is_number($_GET['collageid'])) {
15
-  error(0);
16
+    error(0);
16
 }
17
 }
17
 $CollageID = (int)$_GET['collageid'];
18
 $CollageID = (int)$_GET['collageid'];
18
 
19
 
27
 // Start printing
28
 // Start printing
28
 View::show_header("Comments for collage $Name", 'comments,bbcode,subscriptions');
29
 View::show_header("Comments for collage $Name", 'comments,bbcode,subscriptions');
29
 ?>
30
 ?>
31
+
30
 <div class="thin">
32
 <div class="thin">
31
   <div class="header">
33
   <div class="header">
32
     <h2>
34
     <h2>
33
-      <a href="collages.php">Collages</a> &gt;
35
+      <a href="collages.php">Collages</a> 
34
       <a href="collages.php?id=<?=$CollageID?>"><?=$Name?></a>
36
       <a href="collages.php?id=<?=$CollageID?>"><?=$Name?></a>
35
     </h2>
37
     </h2>
38
+
36
     <div class="linkbox">
39
     <div class="linkbox">
37
-      <a href="#" id="subscribelink_collages<?=$CollageID?>" class="brackets" onclick="SubscribeComments('collages', <?=$CollageID?>); return false;"><?=Subscriptions::has_subscribed_comments('collages', $CollageID) !== false ? 'Unsubscribe' : 'Subscribe'?></a>
38
-<?
40
+      <a href="#" id="subscribelink_collages<?=$CollageID?>"
41
+        class="brackets"
42
+        onclick="SubscribeComments('collages', <?=$CollageID?>); return false;"><?=Subscriptions::has_subscribed_comments('collages', $CollageID) !== false ? 'Unsubscribe' : 'Subscribe'?></a>
43
+      <?php
39
 $Pages = Format::get_pages($Page, $NumComments, TORRENT_COMMENTS_PER_PAGE, 9);
44
 $Pages = Format::get_pages($Page, $NumComments, TORRENT_COMMENTS_PER_PAGE, 9);
40
 if ($Pages) {
45
 if ($Pages) {
41
-  echo '<br /><br />' . $Pages;
46
+    echo '<br /><br />' . $Pages;
42
 }
47
 }
43
 ?>
48
 ?>
44
     </div>
49
     </div>
45
   </div>
50
   </div>
46
-<?
47
 
51
 
52
+  <?php
48
 //---------- Begin printing
53
 //---------- Begin printing
49
 CommentsView::render_comments($Thread, $LastRead, "collages.php?action=comments&amp;collageid=$CollageID");
54
 CommentsView::render_comments($Thread, $LastRead, "collages.php?action=comments&amp;collageid=$CollageID");
50
 if (!$ThreadInfo['IsLocked'] || check_perms('site_moderate_forums')) {
55
 if (!$ThreadInfo['IsLocked'] || check_perms('site_moderate_forums')) {
51
-  if ($ThreadInfo['MinClassWrite'] <= $LoggedUser['Class'] && !$LoggedUser['DisablePosting']) {
52
-    View::parse('generic/reply/quickreply.php', array(
56
+    if ($ThreadInfo['MinClassWrite'] <= $LoggedUser['Class'] && !$LoggedUser['DisablePosting']) {
57
+        View::parse('generic/reply/quickreply.php', array(
53
       'InputName' => 'pageid',
58
       'InputName' => 'pageid',
54
       'InputID' => $CollageID,
59
       'InputID' => $CollageID,
55
       'Action' => 'comments.php?page=collages',
60
       'Action' => 'comments.php?page=collages',
57
       'TextareaCols' => 90,
62
       'TextareaCols' => 90,
58
       'SubscribeBox' => true
63
       'SubscribeBox' => true
59
     ));
64
     ));
60
-  }
65
+    }
61
 }
66
 }
62
 ?>
67
 ?>
68
+
63
   <div class="linkbox">
69
   <div class="linkbox">
64
     <?=$Pages?>
70
     <?=$Pages?>
65
   </div>
71
   </div>
66
 </div>
72
 </div>
67
-<? View::show_footer(); ?>
73
+
74
+<?php View::show_footer();

+ 206
- 122
sections/collages/artist_collage.php View File

1
-<?
1
+<?php
2
+
2
 // todo: Cache this
3
 // todo: Cache this
3
 $DB->query("
4
 $DB->query("
4
   SELECT
5
   SELECT
24
 $UserAdditions = [];
25
 $UserAdditions = [];
25
 
26
 
26
 foreach ($Artists as $Artist) {
27
 foreach ($Artists as $Artist) {
27
-  $UserID = $Artist['UserID'];
28
-  if ($UserID == $LoggedUser['ID']) {
29
-    $NumGroupsByUser++;
30
-  }
28
+    $UserID = $Artist['UserID'];
29
+    if ($UserID === $LoggedUser['ID']) {
30
+        $NumGroupsByUser++;
31
+    }
31
 
32
 
32
-  if (!isset($UserAdditions[$UserID])) {
33
-    $UserAdditions[$UserID] = 0;
34
-  }
35
-  $UserAdditions[$UserID]++;
33
+    if (!isset($UserAdditions[$UserID])) {
34
+        $UserAdditions[$UserID] = 0;
35
+    }
36
+    $UserAdditions[$UserID]++;
36
 
37
 
37
-  ob_start();
38
-?>
39
-      <tr>
40
-        <td><a href="artist.php?id=<?=$Artist['ArtistID']?>"><?=$Artist['Name']?></a></td>
41
-      </tr>
42
-<?
38
+    ob_start(); ?>
39
+<tr>
40
+  <td><a
41
+      href="artist.php?id=<?=$Artist['ArtistID']?>"><?=$Artist['Name']?></a></td>
42
+</tr>
43
+<?php
43
   $ArtistTable .= ob_get_clean();
44
   $ArtistTable .= ob_get_clean();
44
 
45
 
45
-  ob_start();
46
-  ?>
47
-        <li class="image_group_<?=$Artist['ArtistID']?>">
48
-          <a href="artist.php?id=<?=$Artist['ArtistID']?>">
49
-<?  if ($Artist['Image']) { ?>
50
-            <img class="tooltip" src="<?=ImageTools::process($Artist['Image'], 'thumb')?>" alt="<?=$Artist['Name']?>" title="<?=$Artist['Name']?>" width="118" />
51
-<?  } else { ?>
52
-            <span style="width: 107px; padding: 5px;"><?=$Artist['Name']?></span>
53
-<?  } ?>
54
-          </a>
55
-        </li>
56
-<?
46
+    ob_start(); ?>
47
+<li class="image_group_<?=$Artist['ArtistID']?>">
48
+  <a
49
+    href="artist.php?id=<?=$Artist['ArtistID']?>">
50
+    <?php if ($Artist['Image']) { ?>
51
+    <img class="tooltip"
52
+      src="<?=ImageTools::process($Artist['Image'], 'thumb')?>"
53
+      alt="<?=$Artist['Name']?>"
54
+      title="<?=$Artist['Name']?>" width="118" />
55
+    <?php } else { ?>
56
+    <span style="width: 107px; padding: 5px;"><?=$Artist['Name']?></span>
57
+    <?php } ?>
58
+  </a>
59
+</li>
60
+<?php
57
   $Collage[] = ob_get_clean();
61
   $Collage[] = ob_get_clean();
58
 }
62
 }
59
 
63
 
60
-
61
 if (!check_perms('site_collages_delete') && ($Locked || ($MaxGroups > 0 && $NumGroups >= $MaxGroups) || ($MaxGroupsPerUser > 0 && $NumGroupsByUser >= $MaxGroupsPerUser))) {
64
 if (!check_perms('site_collages_delete') && ($Locked || ($MaxGroups > 0 && $NumGroups >= $MaxGroups) || ($MaxGroupsPerUser > 0 && $NumGroupsByUser >= $MaxGroupsPerUser))) {
62
-  $PreventAdditions = true;
65
+    $PreventAdditions = true;
63
 }
66
 }
64
 
67
 
65
 // Silly hack for people who are on the old setting
68
 // Silly hack for people who are on the old setting
68
 
71
 
69
 // Pad it out
72
 // Pad it out
70
 if ($NumGroups > $CollageCovers) {
73
 if ($NumGroups > $CollageCovers) {
71
-  for ($i = $NumGroups + 1; $i <= ceil($NumGroups / $CollageCovers) * $CollageCovers; $i++) {
72
-    $Collage[] = '<li></li>';
73
-  }
74
+    for ($i = $NumGroups + 1; $i <= ceil($NumGroups / $CollageCovers) * $CollageCovers; $i++) {
75
+        $Collage[] = '<li></li>';
76
+    }
74
 }
77
 }
75
 
78
 
76
 for ($i = 0; $i < $NumGroups / $CollageCovers; $i++) {
79
 for ($i = 0; $i < $NumGroups / $CollageCovers; $i++) {
77
-  $Groups = array_slice($Collage, $i * $CollageCovers, $CollageCovers);
78
-  $CollagePage = '';
79
-  foreach ($Groups as $Group) {
80
-    $CollagePage .= $Group;
81
-  }
82
-  $CollagePages[] = $CollagePage;
80
+    $Groups = array_slice($Collage, $i * $CollageCovers, $CollageCovers);
81
+    $CollagePage = '';
82
+    foreach ($Groups as $Group) {
83
+        $CollagePage .= $Group;
84
+    }
85
+    $CollagePages[] = $CollagePage;
83
 }
86
 }
84
 
87
 
85
 View::show_header($Name, 'browse,collage,bbcode,recommend');
88
 View::show_header($Name, 'browse,collage,bbcode,recommend');
86
-
87
 ?>
89
 ?>
90
+
88
 <div class="thin">
91
 <div class="thin">
89
   <div class="header">
92
   <div class="header">
90
-    <h2><?=$Name?></h2>
93
+    <h2><?=$Name?>
94
+    </h2>
91
     <div class="linkbox">
95
     <div class="linkbox">
92
       <a href="collages.php" class="brackets">List of collections</a>
96
       <a href="collages.php" class="brackets">List of collections</a>
93
-<?  if (check_perms('site_collages_create')) { ?>
97
+      <?php if (check_perms('site_collages_create')) { ?>
94
       <a href="collages.php?action=new" class="brackets">New collage</a>
98
       <a href="collages.php?action=new" class="brackets">New collage</a>
95
-<?  } ?>
99
+      <?php } ?>
96
       <br /><br />
100
       <br /><br />
97
-<?  if (check_perms('site_collages_subscribe')) { ?>
98
-      <a href="#" id="subscribelink<?=$CollageID?>" class="brackets" onclick="CollageSubscribe(<?=$CollageID?>); return false;"><?=(in_array($CollageID, $CollageSubscriptions) ? 'Unsubscribe' : 'Subscribe')?></a>
99
-<?
101
+      <?php if (check_perms('site_collages_subscribe')) { ?>
102
+      <a href="#" id="subscribelink<?=$CollageID?>" class="brackets"
103
+        onclick="CollageSubscribe(<?=$CollageID?>); return false;"><?=(in_array($CollageID, $CollageSubscriptions) ? 'Unsubscribe' : 'Subscribe')?></a>
104
+      <?php
100
   }
105
   }
101
   if (check_perms('site_collages_delete') || (check_perms('site_edit_wiki') && !$Locked)) {
106
   if (check_perms('site_collages_delete') || (check_perms('site_edit_wiki') && !$Locked)) {
102
-?>
103
-      <a href="collages.php?action=edit&amp;collageid=<?=$CollageID?>" class="brackets">Edit description</a>
104
-<?  } else { ?>
107
+      ?>
108
+      <a href="collages.php?action=edit&amp;collageid=<?=$CollageID?>"
109
+        class="brackets">Edit description</a>
110
+      <?php
111
+  } else { ?>
105
       <span class="brackets">Locked</span>
112
       <span class="brackets">Locked</span>
106
-<?
113
+      <?php
107
   }
114
   }
108
   if (Bookmarks::has_bookmarked('collage', $CollageID)) {
115
   if (Bookmarks::has_bookmarked('collage', $CollageID)) {
109
-?>
110
-      <a href="#" id="bookmarklink_collage_<?=$CollageID?>" class="brackets" onclick="Unbookmark('collage', <?=$CollageID?>, 'Bookmark'); return false;">Remove bookmark</a>
111
-<?  } else { ?>
112
-      <a href="#" id="bookmarklink_collage_<?=$CollageID?>" class="brackets" onclick="Bookmark('collage', <?=$CollageID?>, 'Remove bookmark'); return false;">Bookmark</a>
113
-<?
116
+      ?>
117
+      <a href="#" id="bookmarklink_collage_<?=$CollageID?>"
118
+        class="brackets"
119
+        onclick="Unbookmark('collage', <?=$CollageID?>, 'Bookmark'); return false;">Remove
120
+        bookmark</a>
121
+      <?php
122
+  } else { ?>
123
+      <a href="#" id="bookmarklink_collage_<?=$CollageID?>"
124
+        class="brackets"
125
+        onclick="Bookmark('collage', <?=$CollageID?>, 'Remove bookmark'); return false;">Bookmark</a>
126
+      <?php
114
   }
127
   }
115
   if (check_perms('site_collages_manage') && !$Locked) {
128
   if (check_perms('site_collages_manage') && !$Locked) {
116
-?>
117
-      <a href="collages.php?action=manage_artists&amp;collageid=<?=$CollageID?>" class="brackets">Manage artists</a>
118
-<?  } ?>
119
-      <a href="reports.php?action=report&amp;type=collage&amp;id=<?=$CollageID?>" class="brackets">Report collage</a>
120
-<?  if (check_perms('site_collages_delete') || $CreatorID == $LoggedUser['ID']) { ?>
121
-      <a href="collages.php?action=delete&amp;collageid=<?=$CollageID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets" onclick="return confirm('Are you sure you want to delete this collage?');">Delete</a>
122
-<?  } ?>
129
+      ?>
130
+      <a href="collages.php?action=manage_artists&amp;collageid=<?=$CollageID?>"
131
+        class="brackets">Manage artists</a>
132
+      <?php
133
+  } ?>
134
+      <a href="reports.php?action=report&amp;type=collage&amp;id=<?=$CollageID?>"
135
+        class="brackets">Report collage</a>
136
+      <?php if (check_perms('site_collages_delete') || $CreatorID === $LoggedUser['ID']) { ?>
137
+      <a href="collages.php?action=delete&amp;collageid=<?=$CollageID?>&amp;auth=<?=$LoggedUser['AuthKey']?>"
138
+        class="brackets" onclick="return confirm('Are you sure you want to delete this collage?');">Delete</a>
139
+      <?php } ?>
123
     </div>
140
     </div>
124
   </div>
141
   </div>
142
+
125
   <div class="sidebar">
143
   <div class="sidebar">
126
     <div class="box box_category">
144
     <div class="box box_category">
127
       <div class="head"><strong>Category</strong></div>
145
       <div class="head"><strong>Category</strong></div>
128
-      <div class="pad"><a href="collages.php?action=search&amp;cats[<?=(int)$CollageCategoryID?>]=1"><?=$CollageCats[(int)$CollageCategoryID]?></a></div>
146
+      <div class="pad"><a
147
+          href="collages.php?action=search&amp;cats[<?=(int)$CollageCategoryID?>]=1"><?=$CollageCats[(int)$CollageCategoryID]?></a></div>
129
     </div>
148
     </div>
149
+
130
     <div class="box box_description">
150
     <div class="box box_description">
131
       <div class="head"><strong>Description</strong></div>
151
       <div class="head"><strong>Description</strong></div>
132
-      <div class="pad"><?=Text::full_format($Description)?></div>
152
+      <div class="pad"><?=Text::full_format($Description)?>
153
+      </div>
133
     </div>
154
     </div>
155
+
134
     <div class="box box_info box_statistics_collage_torrents">
156
     <div class="box box_info box_statistics_collage_torrents">
135
       <div class="head"><strong>Statistics</strong></div>
157
       <div class="head"><strong>Statistics</strong></div>
136
       <ul class="stats nobullet">
158
       <ul class="stats nobullet">
137
-        <li>Artists: <?=number_format($NumGroups)?></li>
138
-        <li>Subscribers: <?=number_format((int)$Subscribers)?></li>
139
-        <li>Built by <?=number_format(count($UserAdditions))?> user<?=(count($UserAdditions) > 1 ? 's' : '')?></li>
140
-        <li>Last updated: <?=time_diff($Updated)?></li>
159
+        <li>Artists: <?=number_format($NumGroups)?>
160
+        </li>
161
+        <li>Subscribers: <?=number_format((int)$Subscribers)?>
162
+        </li>
163
+        <li>Built by <?=number_format(count($UserAdditions))?>
164
+          user<?=(count($UserAdditions) > 1 ? 's' : '')?>
165
+        </li>
166
+        <li>Last updated: <?=time_diff($Updated)?>
167
+        </li>
141
       </ul>
168
       </ul>
142
     </div>
169
     </div>
170
+
143
     <div class="box box_contributors">
171
     <div class="box box_contributors">
144
       <div class="head"><strong>Top Contributors</strong></div>
172
       <div class="head"><strong>Top Contributors</strong></div>
145
       <div class="pad">
173
       <div class="pad">
146
         <ol style="padding-left: 5px;">
174
         <ol style="padding-left: 5px;">
147
-<?
175
+          <?php
148
 arsort($UserAdditions);
176
 arsort($UserAdditions);
149
 $i = 0;
177
 $i = 0;
150
 foreach ($UserAdditions as $UserID => $Additions) {
178
 foreach ($UserAdditions as $UserID => $Additions) {
151
-  $i++;
152
-  if ($i > 5) {
153
-    break;
154
-  }
155
-?>
156
-          <li><?=Users::format_username($UserID, false, false, false)?> (<?=number_format($Additions)?>)</li>
157
-<?
179
+    $i++;
180
+    if ($i > 5) {
181
+        break;
182
+    } ?>
183
+          <li><?=Users::format_username($UserID, false, false, false)?>
184
+            (<?=number_format($Additions)?>)</li>
185
+          <?php
158
 }
186
 }
159
 ?>
187
 ?>
160
         </ol>
188
         </ol>
161
       </div>
189
       </div>
162
     </div>
190
     </div>
163
-<? if (check_perms('site_collages_manage') && !isset($PreventAdditions)) { ?>
191
+
192
+    <?php if (check_perms('site_collages_manage') && !isset($PreventAdditions)) { ?>
164
     <div class="box box_addartist">
193
     <div class="box box_addartist">
165
-      <div class="head"><strong>Add Artists</strong><span class="float_right"><a href="#" onclick="$('.add_artist_container').toggle_class('hidden'); this.innerHTML = (this.innerHTML == 'Batch add' ? 'Individual add' : 'Batch add'); return false;" class="brackets">Batch add</a></span></div>
194
+      <div class="head"><strong>Add Artists</strong><span class="float_right"><a href="#"
195
+            onclick="$('.add_artist_container').toggle_class('hidden'); this.innerHTML = (this.innerHTML === 'Batch add' ? 'Individual add' : 'Batch add'); return false;"
196
+            class="brackets">Batch add</a></span></div>
166
       <div class="pad add_artist_container">
197
       <div class="pad add_artist_container">
167
         <form class="add_form" name="artist" action="collages.php" method="post">
198
         <form class="add_form" name="artist" action="collages.php" method="post">
168
           <input type="hidden" name="action" value="add_artist" />
199
           <input type="hidden" name="action" value="add_artist" />
169
-          <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
170
-          <input type="hidden" name="collageid" value="<?=$CollageID?>" />
200
+          <input type="hidden" name="auth"
201
+            value="<?=$LoggedUser['AuthKey']?>" />
202
+          <input type="hidden" name="collageid"
203
+            value="<?=$CollageID?>" />
171
           <div class="field_div">
204
           <div class="field_div">
172
-            <input type="text" id="artist" size="20" name="url"<? Users::has_autocomplete_enabled('other'); ?> />
205
+            <input type="text" id="artist" size="20" name="url" <?php Users::has_autocomplete_enabled('other'); ?>
206
+            />
173
           </div>
207
           </div>
174
           <div class="submit_div">
208
           <div class="submit_div">
175
             <input type="submit" value="Add" />
209
             <input type="submit" value="Add" />
177
           <span style="font-style: italic;">Enter the URL of an artist on the site.</span>
211
           <span style="font-style: italic;">Enter the URL of an artist on the site.</span>
178
         </form>
212
         </form>
179
       </div>
213
       </div>
214
+
180
       <div class="pad hidden add_artist_container">
215
       <div class="pad hidden add_artist_container">
181
         <form class="add_form" name="artists" action="collages.php" method="post">
216
         <form class="add_form" name="artists" action="collages.php" method="post">
182
           <input type="hidden" name="action" value="add_artist_batch" />
217
           <input type="hidden" name="action" value="add_artist_batch" />
183
-          <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
184
-          <input type="hidden" name="collageid" value="<?=$CollageID?>" />
218
+          <input type="hidden" name="auth"
219
+            value="<?=$LoggedUser['AuthKey']?>" />
220
+          <input type="hidden" name="collageid"
221
+            value="<?=$CollageID?>" />
185
           <div class="field_div">
222
           <div class="field_div">
186
             <textarea name="urls" rows="5" cols="25" style="white-space: nowrap;"></textarea>
223
             <textarea name="urls" rows="5" cols="25" style="white-space: nowrap;"></textarea>
187
           </div>
224
           </div>
192
         </form>
229
         </form>
193
       </div>
230
       </div>
194
     </div>
231
     </div>
195
-<? } ?>
232
+    <?php } ?>
233
+
196
     <h3>Comments</h3>
234
     <h3>Comments</h3>
197
-<?
235
+    <?php
198
 if ($CommentList === null) {
236
 if ($CommentList === null) {
199
-  $DB->query("
237
+    $DB->query("
200
     SELECT
238
     SELECT
201
       c.ID,
239
       c.ID,
202
       c.Body,
240
       c.Body,
209
       AND c.PageID = $CollageID
247
       AND c.PageID = $CollageID
210
     ORDER BY c.ID DESC
248
     ORDER BY c.ID DESC
211
     LIMIT 15");
249
     LIMIT 15");
212
-  $CommentList = $DB->to_array(false, MYSQLI_NUM);
250
+    $CommentList = $DB->to_array(false, MYSQLI_NUM);
213
 }
251
 }
252
+
214
 foreach ($CommentList as $Comment) {
253
 foreach ($CommentList as $Comment) {
215
-  list($CommentID, $Body, $UserID, $Username, $CommentTime) = $Comment;
216
-?>
254
+    list($CommentID, $Body, $UserID, $Username, $CommentTime) = $Comment; ?>
217
     <div class="box comment">
255
     <div class="box comment">
218
       <div class="head">
256
       <div class="head">
219
-        <?=Users::format_username($UserID, false, false, false) ?> <?=time_diff($CommentTime) ?>
257
+        <?=Users::format_username($UserID, false, false, false) ?>
258
+        <?=time_diff($CommentTime) ?>
220
         <br />
259
         <br />
221
-        <a href="reports.php?action=report&amp;type=comment&amp;id=<?=$CommentID?>" class="brackets">Report</a>
260
+        <a href="reports.php?action=report&amp;type=comment&amp;id=<?=$CommentID?>"
261
+          class="brackets">Report</a>
262
+      </div>
263
+      <div class="pad"><?=Text::full_format($Body)?>
222
       </div>
264
       </div>
223
-      <div class="pad"><?=Text::full_format($Body)?></div>
224
     </div>
265
     </div>
225
-<?
266
+    <?php
226
 }
267
 }
227
 ?>
268
 ?>
269
+
228
     <div class="box pad">
270
     <div class="box pad">
229
-      <a href="collages.php?action=comments&amp;collageid=<?=$CollageID?>" class="brackets">View all comments</a>
271
+      <a href="collages.php?action=comments&amp;collageid=<?=$CollageID?>"
272
+        class="brackets">View all comments</a>
230
     </div>
273
     </div>
231
-<?
274
+
275
+    <?php
232
 if (!$LoggedUser['DisablePosting']) {
276
 if (!$LoggedUser['DisablePosting']) {
233
-?>
277
+    ?>
234
     <div class="box box_addcomment">
278
     <div class="box box_addcomment">
235
       <div class="head"><strong>Comment</strong></div>
279
       <div class="head"><strong>Comment</strong></div>
236
-      <form class="send_form" name="comment" id="quickpostform" onsubmit="quickpostform.submit_button.disabled = true;" action="comments.php" method="post">
280
+      <form class="send_form" name="comment" id="quickpostform" onsubmit="quickpostform.submit_button.disabled = true;"
281
+        action="comments.php" method="post">
237
         <input type="hidden" name="action" value="take_post" />
282
         <input type="hidden" name="action" value="take_post" />
238
         <input type="hidden" name="page" value="collages" />
283
         <input type="hidden" name="page" value="collages" />
239
-        <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
284
+        <input type="hidden" name="auth"
285
+          value="<?=$LoggedUser['AuthKey']?>" />
240
         <input type="hidden" name="pageid" value="<?=$CollageID?>" />
286
         <input type="hidden" name="pageid" value="<?=$CollageID?>" />
241
         <div class="pad">
287
         <div class="pad">
242
           <div class="field_div">
288
           <div class="field_div">
248
         </div>
294
         </div>
249
       </form>
295
       </form>
250
     </div>
296
     </div>
251
-<?
297
+    <?php
252
 }
298
 }
253
 ?>
299
 ?>
254
   </div>
300
   </div>
301
+
255
   <div class="main_column">
302
   <div class="main_column">
256
-<?
257
-if ($CollageCovers != 0) {
258
-?>
303
+    <?php
304
+if ($CollageCovers !== 0) {
305
+    ?>
259
     <div id="coverart" class="box">
306
     <div id="coverart" class="box">
260
       <div class="head" id="coverhead"><strong>Pictures</strong></div>
307
       <div class="head" id="coverhead"><strong>Pictures</strong></div>
261
       <ul class="collage_images" id="collage_page0">
308
       <ul class="collage_images" id="collage_page0">
262
-<?
309
+        <?php
263
   $Page1 = array_slice($Collage, 0, $CollageCovers);
310
   $Page1 = array_slice($Collage, 0, $CollageCovers);
264
-  foreach ($Page1 as $Group) {
265
-    echo $Group;
266
-  }
267
-?>
311
+    foreach ($Page1 as $Group) {
312
+        echo $Group;
313
+    } ?>
268
       </ul>
314
       </ul>
269
     </div>
315
     </div>
270
-<?  if ($NumGroups > $CollageCovers) { ?>
316
+    <?php if ($NumGroups > $CollageCovers) { ?>
271
     <div class="linkbox pager" style="clear: left;" id="pageslinksdiv">
317
     <div class="linkbox pager" style="clear: left;" id="pageslinksdiv">
272
-      <span id="firstpage" class="invisible"><a href="#" class="pageslink" onclick="collageShow.page(0, this); return false;"><strong>&lt;&lt; First</strong></a> | </span>
273
-      <span id="prevpage" class="invisible"><a href="#" class="pageslink" onclick="collageShow.prevPage(); return false;"><strong>&lt; Prev</strong></a> | </span>
274
-<?    for ($i = 0; $i < $NumGroups / $CollageCovers; $i++) { ?>
275
-      <span id="pagelink<?=$i?>" class="<?=($i > 4 ? 'hidden' : '')?><?=($i == 0 ? 'selected' : '')?>"><a href="#" class="pageslink" onclick="collageShow.page(<?=$i?>, this); return false;"><strong><?=$CollageCovers * $i + 1?>-<?=min($NumGroups, $CollageCovers * ($i + 1))?></strong></a><?=(($i != ceil($NumGroups / $CollageCovers) - 1) ? ' | ' : '')?></span>
276
-<?    } ?>
277
-      <span id="nextbar" class="<?=($NumGroups / $CollageCovers > 5) ? 'hidden' : ''?>"> | </span>
278
-      <span id="nextpage"><a href="#" class="pageslink" onclick="collageShow.nextPage(); return false;"><strong>Next &gt;</strong></a></span>
279
-      <span id="lastpage" class="<?=(ceil($NumGroups / $CollageCovers) == 2 ? 'invisible' : '')?>"> | <a href="#" class="pageslink" onclick="collageShow.page(<?=ceil($NumGroups / $CollageCovers) - 1?>, this); return false;"><strong>Last &gt;&gt;</strong></a></span>
318
+
319
+      <span id="firstpage" class="invisible">
320
+        <a href="#" class="pageslink" onclick="collageShow.page(0, this); return false;">
321
+          <strong>&raquo; First</strong>
322
+        </a> |
323
+      </span>
324
+
325
+      <span id="prevpage" class="invisible">
326
+        <a href="#" class="pageslink" onclick="collageShow.prevPage(); return false;">
327
+          <strong>‹ Prev</strong>
328
+        </a> |
329
+      </span>
330
+
331
+      <?php for ($i = 0; $i < $NumGroups / $CollageCovers; $i++) { ?>
332
+      <span id="pagelink<?=$i?>"
333
+        class="<?=($i > 4 ? 'hidden' : '')?><?=($i === 0 ? 'selected' : '')?>">
334
+        <a href="#" class="pageslink"
335
+          onclick="collageShow.page(<?=$i?>, this); return false;">
336
+          <strong><?=$CollageCovers * $i + 1?>-<?=min($NumGroups, $CollageCovers * ($i + 1))?></strong>
337
+        </a>
338
+        <?=(($i !== ceil($NumGroups / $CollageCovers) - 1) ? ' | ' : '')?>
339
+      </span>
340
+      <?php } ?>
341
+
342
+      <span id="nextbar"
343
+        class="<?=($NumGroups / $CollageCovers > 5) ? 'hidden' : ''?>">
344
+        | </span>
345
+
346
+      <span id="nextpage">
347
+        <a href="#" class="pageslink" onclick="collageShow.nextPage(); return false;">
348
+          <strong>Next ›</strong>
349
+        </a>
350
+      </span>
351
+
352
+      <span id="lastpage"
353
+        class="<?=(ceil($NumGroups / $CollageCovers) === 2 ? 'invisible' : '')?>">
354
+        |
355
+        <a href="#" class="pageslink"
356
+          onclick="collageShow.page(<?=ceil($NumGroups / $CollageCovers) - 1?>, this); return false;">
357
+          <strong>Last »</strong>
358
+        </a>
359
+      </span>
280
     </div>
360
     </div>
281
-    <script type="text/javascript">//<![CDATA[
282
-      collageShow.init(<?=json_encode($CollagePages)?>);
283
-    //]]></script>
284
-<?
361
+
362
+    <script type="text/javascript">
363
+      //<![CDATA[
364
+      collageShow.init( <?=json_encode($CollagePages)?> );
365
+      //]]>
366
+    </script>
367
+    <?php
285
   }
368
   }
286
 }
369
 }
287
 ?>
370
 ?>
371
+
288
     <div class="box">
372
     <div class="box">
289
       <table class="artist_table grouping cats" id="discog_table">
373
       <table class="artist_table grouping cats" id="discog_table">
290
         <tr class="colhead_dark">
374
         <tr class="colhead_dark">
291
           <td><strong>Artists</strong></td>
375
           <td><strong>Artists</strong></td>
292
         </tr>
376
         </tr>
293
-<?=$ArtistTable?>
377
+        <?=$ArtistTable?>
294
       </table>
378
       </table>
295
     </div>
379
     </div>
296
   </div>
380
   </div>
297
 </div>
381
 </div>
298
-<?
382
+
383
+<?php
299
 View::show_footer();
384
 View::show_footer();
300
-?>

+ 464
- 289
sections/collages/torrent_collage.php View File

1
-<?
2
-function compare($X, $Y) {
3
-  return($Y['count'] - $X['count']);
1
+<?php
2
+
3
+function compare($X, $Y)
4
+{
5
+    return($Y['count'] - $X['count']);
4
 }
6
 }
5
 
7
 
6
 // Build the data for the collage and the torrent list
8
 // Build the data for the collage and the torrent list
16
 
18
 
17
 $GroupIDs = $DB->collect('GroupID');
19
 $GroupIDs = $DB->collect('GroupID');
18
 $Contributors = $DB->to_pair('GroupID', 'UserID', false);
20
 $Contributors = $DB->to_pair('GroupID', 'UserID', false);
21
+
19
 if (count($GroupIDs) > 0) {
22
 if (count($GroupIDs) > 0) {
20
-  $TorrentList = Torrents::get_groups($GroupIDs);
23
+    $TorrentList = Torrents::get_groups($GroupIDs);
21
 } else {
24
 } else {
22
-  $TorrentList = [];
25
+    $TorrentList = [];
23
 }
26
 }
24
 
27
 
25
 // Loop through the result set, building up $Collage and $TorrentTable
28
 // Loop through the result set, building up $Collage and $TorrentTable
34
 $Number = 0;
37
 $Number = 0;
35
 
38
 
36
 foreach ($GroupIDs as $GroupID) {
39
 foreach ($GroupIDs as $GroupID) {
37
-  if (!isset($TorrentList[$GroupID])) {
38
-    continue;
39
-  }
40
-  $Group = $TorrentList[$GroupID];
41
-  extract(Torrents::array_group($Group));
42
-  $UserID = $Contributors[$GroupID];
43
-  $TorrentTags = new Tags($TagList);
44
-
45
-  // Handle stats and stuff
46
-  $Number++;
47
-  if ($UserID == $LoggedUser['ID']) {
48
-    $NumGroupsByUser++;
49
-  }
40
+    if (!isset($TorrentList[$GroupID])) {
41
+        continue;
42
+    }
50
 
43
 
51
-  $CountArtists = $Artists;
44
+    $Group = $TorrentList[$GroupID];
45
+    extract(Torrents::array_group($Group));
46
+    $UserID = $Contributors[$GroupID];
47
+    $TorrentTags = new Tags($TagList);
52
 
48
 
53
-  if ($CountArtists) {
54
-    foreach ($CountArtists as $Artist) {
55
-      if (!isset($TopArtists[$Artist['id']])) {
56
-        $TopArtists[$Artist['id']] = array('name' => $Artist['name'], 'count' => 1);
57
-      } else {
58
-        $TopArtists[$Artist['id']]['count']++;
59
-      }
49
+    // Handle stats and stuff
50
+    $Number++;
51
+    if ($UserID == $LoggedUser['ID']) {
52
+        $NumGroupsByUser++;
60
     }
53
     }
61
-  }
62
 
54
 
63
-  if (!isset($UserAdditions[$UserID])) {
64
-    $UserAdditions[$UserID] = 0;
65
-  }
66
-  $UserAdditions[$UserID]++;
55
+    $CountArtists = $Artists;
56
+    if ($CountArtists) {
57
+        foreach ($CountArtists as $Artist) {
58
+            if (!isset($TopArtists[$Artist['id']])) {
59
+                $TopArtists[$Artist['id']] = array('name' => $Artist['name'], 'count' => 1);
60
+            } else {
61
+                $TopArtists[$Artist['id']]['count']++;
62
+            }
63
+        }
64
+    }
67
 
65
 
68
-  $DisplayName = "$Number - ";
66
+    if (!isset($UserAdditions[$UserID])) {
67
+        $UserAdditions[$UserID] = 0;
68
+    }
69
+    $UserAdditions[$UserID]++;
69
 
70
 
70
-  $DisplayName .= Artists::display_artists($Artists);
71
+    $DisplayName = "$Number - ";
72
+    $DisplayName .= Artists::display_artists($Artists);
73
+    $DisplayName .= "<a href=\"torrents.php?id=$GroupID\" ";
71
 
74
 
72
-  $DisplayName .= "<a href=\"torrents.php?id=$GroupID\" ";
73
-  if (!isset($LoggedUser['CoverArt']) || $LoggedUser['CoverArt']) {
74
-    $DisplayName .= 'data-cover="'.ImageTools::process($WikiImage, 'thumb').'" ';
75
-  }
76
-  $GroupName = empty($GroupName) ? (empty($GroupNameRJ) ? $GroupNameJP : $GroupNameRJ) : $GroupName;
77
-  $DisplayName .= "dir=\"ltr\">$GroupName</a>";
78
-  if ($GroupYear > 0) {
79
-    $DisplayName = "$DisplayName [$GroupYear]";
80
-  }
81
-  if ($GroupStudio) {
82
-    $DisplayName .= " [$GroupStudio]";
83
-  }
84
-  if ($GroupCatalogueNumber) {
85
-    $DisplayName .= " [$GroupCatalogueNumber]";
86
-  }
87
-  if ($GroupDLSiteID) {
88
-    $DisplayName .= " [$GroupDLSiteID]";
89
-  }
90
-  $SnatchedGroupClass = ($GroupFlags['IsSnatched'] ? ' snatched_group' : '');
91
-  // Start an output buffer, so we can store this output in $TorrentTable
92
-  ob_start();
75
+    if (!isset($LoggedUser['CoverArt']) || $LoggedUser['CoverArt']) {
76
+        $DisplayName .= 'data-cover="'.ImageTools::process($WikiImage, 'thumb').'" ';
77
+    }
93
 
78
 
94
-  if (count($Torrents) > 1) {
95
-    // Grouped torrents
96
-    $ShowGroups = !(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] == 1);
97
-?>
98
-      <tr class="group <?=$SnatchedGroupClass?>" id="group_<?=$GroupID?>">
99
-        <td class="center">
100
-          <div id="showimg_<?=$GroupID?>" class="<?=($ShowGroups ? 'hide' : 'show')?>_torrents">
101
-            <a class="tooltip show_torrents_link" onclick="toggle_group(<?=$GroupID?>, this, event);" title="Collapse this group. Hold &quot;Ctrl&quot; while clicking to collapse all groups on this page."></a>
102
-          </div>
103
-        </td>
104
-        <td class="center">
105
-          <div title="<?=$TorrentTags->title()?>" class="tooltip <?=Format::css_category($GroupCategoryID)?> <?=$TorrentTags->css_name()?>"></div>
106
-        </td>
107
-        <td colspan="5">
108
-          <?=$DisplayName?>
109
-<?    if (Bookmarks::has_bookmarked('torrent', $GroupID)) { ?>
110
-          <span class="remove_bookmark float_right">
111
-            <a class="float_right" href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="remove_bookmark brackets" onclick="Unbookmark('torrent', <?=$GroupID?>, 'Bookmark'); return false;">Remove bookmark</a>
112
-          </span>
113
-<?    } else { ?>
114
-          <span class="add_bookmark float_right">
115
-            <a class="float_right" href="#" id="bookmarklink_torrent_<?=$GroupID?>" class="add_bookmark brackets" onclick="Bookmark('torrent', <?=$GroupID?>, 'Remove bookmark'); return false;">Bookmark</a>
116
-          </span>
117
-<?
79
+    $GroupName = empty($GroupName) ? (empty($GroupNameRJ) ? $GroupNameJP : $GroupNameRJ) : $GroupName;
80
+    $DisplayName .= "dir=\"ltr\">$GroupName</a>";
81
+
82
+    if ($GroupYear > 0) {
83
+        $DisplayName = "$DisplayName<br />$GroupYear";
118
     }
84
     }
119
-?>
120
-          <div class="tags"><?=$TorrentTags->format()?></div>
121
-        </td>
122
-      </tr>
123
-<?
124
-    foreach ($Torrents as $TorrentID => $Torrent) {
125
-      $SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : '';
126
-?>
127
-      <tr class="group_torrent torrent_row groupid_<?=$GroupID?> <?=$SnatchedTorrentClass . $SnatchedGroupClass . (!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] == 1 ? ' hidden' : '')?>">
128
-        <td colspan="3">
129
-          <span class="brackets">
130
-            <a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" class="tooltip" title="Download">DL</a>
131
-<?      if (Torrents::can_use_token($Torrent)) { ?>
132
-            | <a href="torrents.php?action=download&amp;id=<?=$TorrentID ?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>&amp;usetoken=1" class="tooltip" title="Use a FL Token" onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
133
-<?      } ?>
134
-            | <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" class="tooltip" title="Report">RP</a>
135
-          </span>
136
-          &nbsp;&nbsp;&raquo;&nbsp; <a href="torrents.php?id=<?=$GroupID?>&amp;torrentid=<?=$TorrentID?>"><?=Torrents::torrent_info($Torrent)?></a>
137
-        </td>
138
-        <td class="number_column nobr"><?=Format::get_size($Torrent['Size'])?></td>
139
-        <td class="number_column"><?=number_format($Torrent['Snatched'])?></td>
140
-        <td class="number_column<?=(($Torrent['Seeders'] == 0) ? ' r00' : '')?>"><?=number_format($Torrent['Seeders'])?></td>
141
-        <td class="number_column"><?=number_format($Torrent['Leechers'])?></td>
142
-      </tr>
143
-<?
85
+
86
+    if ($GroupStudio) {
87
+        $DisplayName .= " / $GroupStudio";
144
     }
88
     }
145
-  } else {
146
-    // Viewing a type that does not require grouping
147
 
89
 
148
-    $TorrentID = key($Torrents);
149
-    $Torrent = current($Torrents);
90
+    if ($GroupCatalogueNumber) {
91
+        $DisplayName .= " / $GroupCatalogueNumber";
92
+    }
93
+
94
+    /*
95
+    if ($GroupDLSiteID) {
96
+        $DisplayName .= " [$GroupDLSiteID]";
97
+    }
98
+    */
99
+
100
+    $SnatchedGroupClass = ($GroupFlags['IsSnatched'] ? ' snatched_group' : '');
101
+    // Start an output buffer, so we can store this output in $TorrentTable
102
+    ob_start();
103
+
104
+    if (count($Torrents) > 1) {
105
+        // Grouped torrents
106
+        $ShowGroups = !(!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] == 1); ?>
107
+
108
+<tr class="group <?=$SnatchedGroupClass?>"
109
+  id="group_<?=$GroupID?>">
110
+  <td class="center">
111
+    <div id="showimg_<?=$GroupID?>"
112
+      class="<?=($ShowGroups ? 'hide' : 'show')?>_torrents">
113
+      <a class="tooltip show_torrents_link"
114
+        onclick="toggle_group(<?=$GroupID?>, this, event);"
115
+        title="Collapse this group. Hold &quot;Ctrl&quot; while clicking to collapse all groups on this page."></a>
116
+    </div>
117
+  </td>
118
+
119
+  <td class="center">
120
+    <div title="<?=$TorrentTags->title()?>"
121
+      class="tooltip <?=Format::css_category($GroupCategoryID)?> <?=$TorrentTags->css_name()?>">
122
+    </div>
123
+  </td>
124
+
125
+  <td colspan="5">
126
+    <?=$DisplayName?>
127
+    <?php if (Bookmarks::has_bookmarked('torrent', $GroupID)) { ?>
128
+    <span class="remove_bookmark float_right">
129
+      <a class="float_right" href="#"
130
+        id="bookmarklink_torrent_<?=$GroupID?>"
131
+        class="remove_bookmark brackets"
132
+        onclick="Unbookmark('torrent', <?=$GroupID?>, 'Bookmark'); return false;">Remove
133
+        bookmark</a>
134
+    </span>
135
+    <?php } else { ?>
136
+    <span class="add_bookmark float_right">
137
+      <a class="float_right" href="#"
138
+        id="bookmarklink_torrent_<?=$GroupID?>"
139
+        class="add_bookmark brackets"
140
+        onclick="Bookmark('torrent', <?=$GroupID?>, 'Remove bookmark'); return false;">Bookmark</a>
141
+    </span>
142
+    <?php
143
+    } ?>
144
+    <div class="tags"><?=$TorrentTags->format()?>
145
+    </div>
146
+  </td>
147
+</tr>
148
+
149
+<?php
150
+    foreach ($Torrents as $TorrentID => $Torrent) {
151
+        $SnatchedTorrentClass = $Torrent['IsSnatched'] ? ' snatched_torrent' : ''; ?>
152
+<tr
153
+  class="group_torrent torrent_row groupid_<?=$GroupID?> <?=$SnatchedTorrentClass . $SnatchedGroupClass . (!empty($LoggedUser['TorrentGrouping']) && $LoggedUser['TorrentGrouping'] == 1 ? ' hidden' : '')?>">
154
+
155
+  <td colspan="3">
156
+    <span class="brackets">
157
+      <a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>"
158
+        class="tooltip" title="Download">DL</a>
159
+      <?php if (Torrents::can_use_token($Torrent)) { ?>
160
+      | <a
161
+        href="torrents.php?action=download&amp;id=<?=$TorrentID ?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>&amp;usetoken=1"
162
+        class="tooltip" title="Use a FL Token"
163
+        onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
164
+      <?php } ?>
165
+      | <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>"
166
+        class="tooltip" title="Report">RP</a>
167
+    </span>
168
+    &nbsp;&nbsp;&raquo;&nbsp; <a
169
+      href="torrents.php?id=<?=$GroupID?>&amp;torrentid=<?=$TorrentID?>"><?=Torrents::torrent_info($Torrent)?></a>
170
+  </td>
171
+
172
+  <td class="number_column nobr"><?=Format::get_size($Torrent['Size'])?>
173
+  </td>
174
+
175
+  <td class="number_column"><?=number_format($Torrent['Snatched'])?>
176
+  </td>
177
+
178
+  <td
179
+    class="number_column<?=(($Torrent['Seeders'] == 0) ? ' r00' : '')?>">
180
+    <?=number_format($Torrent['Seeders'])?>
181
+  </td>
150
 
182
 
151
-    if ($Torrent['IsLeeching']) {
152
-      $DisplayName .= ' ' . Format::torrent_label('Leeching');
153
-    } else if ($Torrent['IsSeeding']) {
154
-      $DisplayName .= ' ' . Format::torrent_label('Seeding');
155
-    } else if ($Torrent['IsSnatched']) {
156
-      $DisplayName .= ' ' . Format::torrent_label('Snatched');
183
+  <td class="number_column"><?=number_format($Torrent['Leechers'])?>
184
+  </td>
185
+</tr>
186
+
187
+<?php
157
     }
188
     }
158
-    if ($Torrent['FreeTorrent'] == '1') {
159
-      $DisplayName .= ' ' . Format::torrent_label('Freeleech!');
160
-    } elseif ($Torrent['FreeTorrent'] == '2') {
161
-      $DisplayName .= ' ' . Format::torrent_label('Neutral Leech!');
162
-    } elseif ($Torrent['PersonalFL']) {
163
-      $DisplayName .= ' ' . Format::torrent_label('Personal Freeleech!');
189
+    } else {
190
+        // Viewing a type that does not require grouping
191
+
192
+        $TorrentID = key($Torrents);
193
+        $Torrent = current($Torrents);
194
+
195
+        if ($Torrent['IsLeeching']) {
196
+            $DisplayName .= ' ' . Format::torrent_label('Leeching');
197
+        } elseif ($Torrent['IsSeeding']) {
198
+            $DisplayName .= ' ' . Format::torrent_label('Seeding');
199
+        } elseif ($Torrent['IsSnatched']) {
200
+            $DisplayName .= ' ' . Format::torrent_label('Snatched');
201
+        }
202
+
203
+        if ($Torrent['FreeTorrent'] == '1') {
204
+            $DisplayName .= ' ' . Format::torrent_label('Freeleech!');
205
+        } elseif ($Torrent['FreeTorrent'] == '2') {
206
+            $DisplayName .= ' ' . Format::torrent_label('Neutral Leech!');
207
+        } elseif ($Torrent['PersonalFL']) {
208
+            $DisplayName .= ' ' . Format::torrent_label('Personal Freeleech!');
209
+        }
210
+
211
+        $SnatchedTorrentClass = ($Torrent['IsSnatched'] ? ' snatched_torrent' : ''); ?>
212
+
213
+<tr
214
+  class="torrent torrent_row<?=$SnatchedTorrentClass . $SnatchedGroupClass?>"
215
+  id="group_<?=$GroupID?>">
216
+  <td></td>
217
+
218
+  <td class="center">
219
+    <div title="<?=$TorrentTags->title()?>"
220
+      class="tooltip <?=Format::css_category($GroupCategoryID)?> <?=$TorrentTags->css_name()?>">
221
+    </div>
222
+  </td>
223
+
224
+  <td>
225
+    <span class="brackets">
226
+      <a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>"
227
+        class="tooltip" title="Download">DL</a>
228
+      <?php    if (Torrents::can_use_token($Torrent)) { ?>
229
+      | <a
230
+        href="torrents.php?action=download&amp;id=<?=$TorrentID ?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>&amp;usetoken=1"
231
+        class="tooltip" title="Use a FL Token"
232
+        onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
233
+      <?php    } ?>
234
+      | <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>"
235
+        class="tooltip" title="Report">RP</a>
236
+    </span>
237
+    <?=$DisplayName?>
238
+    <div class="tags"><?=$TorrentTags->format()?>
239
+    </div>
240
+  </td>
241
+
242
+  <td class="number_column nobr"><?=Format::get_size($Torrent['Size'])?>
243
+  </td>
244
+
245
+  <td class="number_column"><?=number_format($Torrent['Snatched'])?>
246
+  </td>
247
+
248
+  <td
249
+    class="number_column<?=(($Torrent['Seeders'] == 0) ? ' r00' : '')?>">
250
+    <?=number_format($Torrent['Seeders'])?>
251
+  </td>
252
+
253
+  <td class="number_column"><?=number_format($Torrent['Leechers'])?>
254
+  </td>
255
+</tr>
256
+
257
+<?php
164
     }
258
     }
165
-    $SnatchedTorrentClass = ($Torrent['IsSnatched'] ? ' snatched_torrent' : '');
166
-?>
167
-      <tr class="torrent torrent_row<?=$SnatchedTorrentClass . $SnatchedGroupClass?>" id="group_<?=$GroupID?>">
168
-        <td></td>
169
-        <td class="center">
170
-          <div title="<?=$TorrentTags->title()?>" class="tooltip <?=Format::css_category($GroupCategoryID)?> <?=$TorrentTags->css_name()?>">
171
-          </div>
172
-        </td>
173
-        <td>
174
-          <span class="brackets">
175
-            <a href="torrents.php?action=download&amp;id=<?=$TorrentID?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>" class="tooltip" title="Download">DL</a>
176
-<?    if (Torrents::can_use_token($Torrent)) { ?>
177
-            | <a href="torrents.php?action=download&amp;id=<?=$TorrentID ?>&amp;authkey=<?=$LoggedUser['AuthKey']?>&amp;torrent_pass=<?=$LoggedUser['torrent_pass']?>&amp;usetoken=1" class="tooltip" title="Use a FL Token" onclick="return confirm('Are you sure you want to use a freeleech token here?');">FL</a>
178
-<?    } ?>
179
-            | <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" class="tooltip" title="Report">RP</a>
180
-          </span>
181
-          <?=$DisplayName?>
182
-          <div class="tags"><?=$TorrentTags->format()?></div>
183
-        </td>
184
-        <td class="number_column nobr"><?=Format::get_size($Torrent['Size'])?></td>
185
-        <td class="number_column"><?=number_format($Torrent['Snatched'])?></td>
186
-        <td class="number_column<?=(($Torrent['Seeders'] == 0) ? ' r00' : '')?>"><?=number_format($Torrent['Seeders'])?></td>
187
-        <td class="number_column"><?=number_format($Torrent['Leechers'])?></td>
188
-      </tr>
189
-<?
190
-  }
191
-  $TorrentTable .= ob_get_clean();
259
+    $TorrentTable .= ob_get_clean();
192
 
260
 
193
-  // Album art
261
+    // Album art
194
 
262
 
195
-  ob_start();
263
+    ob_start();
196
 
264
 
197
-  $DisplayName = '';
265
+    $DisplayName = '';
198
 
266
 
199
-  $DisplayName .= Artists::display_artists($Artists, false);
200
-  $DisplayName .= $GroupName;
201
-  if ($GroupYear > 0) {
202
-    $DisplayName = "$DisplayName [$GroupYear]";
203
-  }
204
-  $Tags = display_str($TorrentTags->format());
205
-  $PlainTags = implode(', ', $TorrentTags->get_tags());
206
-?>
207
-        <div class="collage_image image_group_<?=$GroupID?>">
208
-          <a href="torrents.php?id=<?=$GroupID?>">
209
-<?  if (!$WikiImage) {
210
-      $WikiImage = STATIC_SERVER.'common/noartwork/music.png';
267
+    $DisplayName .= Artists::display_artists($Artists, false);
268
+    $DisplayName .= $GroupName;
269
+
270
+    if ($GroupYear > 0) {
271
+        $DisplayName = "$DisplayName [$GroupYear]";
272
+    }
273
+
274
+    $Tags = display_str($TorrentTags->format());
275
+    $PlainTags = implode(', ', $TorrentTags->get_tags()); ?>
276
+
277
+<div class="collage_image image_group_<?=$GroupID?>">
278
+  <a href="torrents.php?id=<?=$GroupID?>">
279
+    <?php if (!$WikiImage) {
280
+        $WikiImage = STATIC_SERVER.'common/noartwork/music.png';
211
     } ?>
281
     } ?>
212
-            <img class="tooltip_interactive" src="<?=ImageTools::process($WikiImage, 'thumb')?>" alt="<?=$DisplayName?>" title="<?=$DisplayName?> <br /> <div class='tags'><?=$Tags?></div>" data-title-plain="<?="$DisplayName ($PlainTags)"?>" width="100%" />
213
-          </a>
214
-        </div>
215
-<?
282
+    <img class="tooltip_interactive"
283
+      src="<?=ImageTools::process($WikiImage, 'thumb')?>"
284
+      alt="<?=$DisplayName?>"
285
+      title="<?=$DisplayName?> <br /> <div class='tags'><?=$Tags?></div>"
286
+      data-title-plain="<?="$DisplayName ($PlainTags)"?>"
287
+      width="100%" />
288
+  </a>
289
+</div>
290
+
291
+<?php
216
   $Collage[] = ob_get_clean();
292
   $Collage[] = ob_get_clean();
217
 }
293
 }
218
 
294
 
219
 if ($CollageCategoryID === '0' && !check_perms('site_collages_delete')) {
295
 if ($CollageCategoryID === '0' && !check_perms('site_collages_delete')) {
220
-  if (!check_perms('site_collages_personal') || $CreatorID !== $LoggedUser['ID']) {
221
-    $PreventAdditions = true;
222
-  }
296
+    if (!check_perms('site_collages_personal') || $CreatorID !== $LoggedUser['ID']) {
297
+        $PreventAdditions = true;
298
+    }
223
 }
299
 }
224
 
300
 
225
 if (!check_perms('site_collages_delete')
301
 if (!check_perms('site_collages_delete')
226
   && (
302
   && (
227
-    $Locked
303
+      $Locked
228
     || ($MaxGroups > 0 && $NumGroups >= $MaxGroups)
304
     || ($MaxGroups > 0 && $NumGroups >= $MaxGroups)
229
     || ($MaxGroupsPerUser > 0 && $NumGroupsByUser >= $MaxGroupsPerUser)
305
     || ($MaxGroupsPerUser > 0 && $NumGroupsByUser >= $MaxGroupsPerUser)
230
   )
306
   )
231
 ) {
307
 ) {
232
-  $PreventAdditions = true;
308
+    $PreventAdditions = true;
233
 }
309
 }
234
 
310
 
235
 // Silly hack for people who are on the old setting
311
 // Silly hack for people who are on the old setting
237
 $CollagePages = [];
313
 $CollagePages = [];
238
 
314
 
239
 if ($CollageCovers) {
315
 if ($CollageCovers) {
240
-  for ($i = 0; $i < $NumGroups / $CollageCovers; $i++) {
241
-    $Groups = array_slice($Collage, $i * $CollageCovers, $CollageCovers);
242
-    $CollagePage = '';
243
-    foreach ($Groups as $Group) {
244
-      $CollagePage .= $Group;
316
+    for ($i = 0; $i < $NumGroups / $CollageCovers; $i++) {
317
+        $Groups = array_slice($Collage, $i * $CollageCovers, $CollageCovers);
318
+        $CollagePage = '';
319
+        foreach ($Groups as $Group) {
320
+            $CollagePage .= $Group;
321
+        }
322
+        $CollagePages[] = $CollagePage;
245
     }
323
     }
246
-    $CollagePages[] = $CollagePage;
247
-  }
248
 }
324
 }
249
 
325
 
250
 View::show_header($Name, 'browse,collage,bbcode,recommend,wall');
326
 View::show_header($Name, 'browse,collage,bbcode,recommend,wall');
251
 ?>
327
 ?>
328
+
252
 <div class="thin">
329
 <div class="thin">
253
   <div class="header">
330
   <div class="header">
254
-    <h2><?=$Name?></h2>
331
+    <h2><?=$Name?>
332
+    </h2>
255
     <div class="linkbox">
333
     <div class="linkbox">
256
       <a href="collages.php" class="brackets">List of collections</a>
334
       <a href="collages.php" class="brackets">List of collections</a>
257
-<?  if (check_perms('site_collages_create')) { ?>
335
+      <?php  if (check_perms('site_collages_create')) { ?>
258
       <a href="collages.php?action=new" class="brackets">New collection</a>
336
       <a href="collages.php?action=new" class="brackets">New collection</a>
259
-<?  } ?>
337
+      <?php  } ?>
260
       <br /><br />
338
       <br /><br />
261
-<?  if (check_perms('site_collages_subscribe')) { ?>
262
-      <a href="#" id="subscribelink<?=$CollageID?>" class="brackets" onclick="CollageSubscribe(<?=$CollageID?>); return false;"><?=(in_array($CollageID, $CollageSubscriptions) ? 'Unsubscribe' : 'Subscribe')?></a>
263
-<?
339
+      <?php  if (check_perms('site_collages_subscribe')) { ?>
340
+      <a href="#" id="subscribelink<?=$CollageID?>" class="brackets"
341
+        onclick="CollageSubscribe(<?=$CollageID?>); return false;"><?=(in_array($CollageID, $CollageSubscriptions) ? 'Unsubscribe' : 'Subscribe')?></a>
342
+      <?php
264
   }
343
   }
265
   if (check_perms('site_collages_delete') || (check_perms('site_edit_wiki') && !$Locked)) {
344
   if (check_perms('site_collages_delete') || (check_perms('site_edit_wiki') && !$Locked)) {
266
-?>
267
-      <a href="collages.php?action=edit&amp;collageid=<?=$CollageID?>" class="brackets">Edit description</a>
268
-<?  } else { ?>
345
+      ?>
346
+      <a href="collages.php?action=edit&amp;collageid=<?=$CollageID?>"
347
+        class="brackets">Edit description</a>
348
+      <?php
349
+  } else { ?>
269
       <span class="brackets">Locked</span>
350
       <span class="brackets">Locked</span>
270
-<?
351
+      <?php
271
   }
352
   }
272
   if (Bookmarks::has_bookmarked('collage', $CollageID)) {
353
   if (Bookmarks::has_bookmarked('collage', $CollageID)) {
273
-?>
274
-      <a href="#" id="bookmarklink_collage_<?=$CollageID?>" class="brackets" onclick="Unbookmark('collage', <?=$CollageID?>, 'Bookmark'); return false;">Remove bookmark</a>
275
-<?  } else { ?>
276
-      <a href="#" id="bookmarklink_collage_<?=$CollageID?>" class="brackets" onclick="Bookmark('collage', <?=$CollageID?>, 'Remove bookmark'); return false;">Bookmark</a>
277
-<?  } ?>
278
-<!-- <a href="#" id="recommend" class="brackets">Recommend</a> -->
279
-<?
354
+      ?>
355
+      <a href="#" id="bookmarklink_collage_<?=$CollageID?>"
356
+        class="brackets"
357
+        onclick="Unbookmark('collage', <?=$CollageID?>, 'Bookmark'); return false;">Remove
358
+        bookmark</a>
359
+      <?php
360
+  } else { ?>
361
+      <a href="#" id="bookmarklink_collage_<?=$CollageID?>"
362
+        class="brackets"
363
+        onclick="Bookmark('collage', <?=$CollageID?>, 'Remove bookmark'); return false;">Bookmark</a>
364
+      <?php  } ?>
365
+      <!-- <a href="#" id="recommend" class="brackets">Recommend</a> -->
366
+      <?php
280
   if (check_perms('site_collages_manage') && !$Locked) {
367
   if (check_perms('site_collages_manage') && !$Locked) {
281
-?>
282
-      <a href="collages.php?action=manage&amp;collageid=<?=$CollageID?>" class="brackets">Manage torrents</a>
283
-<?  } ?>
284
-      <a href="reports.php?action=report&amp;type=collage&amp;id=<?=$CollageID?>" class="brackets">Report collection</a>
285
-<?  if (check_perms('site_collages_delete') || $CreatorID == $LoggedUser['ID']) { ?>
286
-      <a href="collages.php?action=delete&amp;collageid=<?=$CollageID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets" onclick="return confirm('Are you sure you want to delete this collage?');">Delete</a>
287
-<?  } ?>
368
+      ?>
369
+      <a href="collages.php?action=manage&amp;collageid=<?=$CollageID?>"
370
+        class="brackets">Manage torrents</a>
371
+      <?php
372
+  } ?>
373
+      <a href="reports.php?action=report&amp;type=collage&amp;id=<?=$CollageID?>"
374
+        class="brackets">Report collection</a>
375
+      <?php  if (check_perms('site_collages_delete') || $CreatorID == $LoggedUser['ID']) { ?>
376
+      <a href="collages.php?action=delete&amp;collageid=<?=$CollageID?>&amp;auth=<?=$LoggedUser['AuthKey']?>"
377
+        class="brackets" onclick="return confirm('Are you sure you want to delete this collage?');">Delete</a>
378
+      <?php  } ?>
288
     </div>
379
     </div>
289
   </div>
380
   </div>
290
-<? /* Misc::display_recommend($CollageID, "collage"); */ ?>
381
+  <?php /* Misc::display_recommend($CollageID, "collage"); */ ?>
291
   <div class="sidebar">
382
   <div class="sidebar">
292
     <div class="box box_category">
383
     <div class="box box_category">
293
       <div class="head"><strong>Category</strong></div>
384
       <div class="head"><strong>Category</strong></div>
294
-      <div class="pad"><a href="collages.php?action=search&amp;cats[<?=(int)$CollageCategoryID?>]=1"><?=$CollageCats[(int)$CollageCategoryID]?></a></div>
385
+      <div class="pad"><a
386
+          href="collages.php?action=search&amp;cats[<?=(int)$CollageCategoryID?>]=1"><?=$CollageCats[(int)$CollageCategoryID]?></a></div>
295
     </div>
387
     </div>
296
     <div class="box box_description">
388
     <div class="box box_description">
297
       <div class="head"><strong>Description</strong></div>
389
       <div class="head"><strong>Description</strong></div>
298
-      <div class="pad"><?=Text::full_format($Description)?></div>
390
+      <div class="pad"><?=Text::full_format($Description)?>
391
+      </div>
299
     </div>
392
     </div>
300
-<?
393
+    <?php
301
 // I'm actually commenting this out
394
 // I'm actually commenting this out
302
 /*
395
 /*
303
 if (check_perms('zip_downloader')) {
396
 if (check_perms('zip_downloader')) {
364
 <? }
457
 <? }
365
 */
458
 */
366
 ?>
459
 ?>
460
+
367
     <div class="box box_info box_statistics_collage_torrents">
461
     <div class="box box_info box_statistics_collage_torrents">
368
       <div class="head"><strong>Statistics</strong></div>
462
       <div class="head"><strong>Statistics</strong></div>
369
       <ul class="stats nobullet">
463
       <ul class="stats nobullet">
370
-        <li>Torrents: <?=number_format($NumGroups)?></li>
371
-<? if (!empty($TopArtists)) { ?>
372
-        <li>Artists: <?=number_format(count($TopArtists))?></li>
373
-<? } ?>
374
-        <li>Subscribers: <?=number_format((int)$Subscribers)?></li>
375
-        <li>Built by <?=number_format(count($UserAdditions))?> user<?=(count($UserAdditions) > 1 ? 's' : '')?></li>
376
-        <li>Last updated: <?=time_diff($Updated)?></li>
464
+        <li>Torrents: <?=number_format($NumGroups)?>
465
+        </li>
466
+        <?php if (!empty($TopArtists)) { ?>
467
+        <li>Artists: <?=number_format(count($TopArtists))?>
468
+        </li>
469
+        <?php } ?>
470
+        <li>Subscribers: <?=number_format((int)$Subscribers)?>
471
+        </li>
472
+        <li>Built by <?=number_format(count($UserAdditions))?>
473
+          user<?=(count($UserAdditions) > 1 ? 's' : '')?>
474
+        </li>
475
+        <li>Last updated: <?=time_diff($Updated)?>
476
+        </li>
377
       </ul>
477
       </ul>
378
     </div>
478
     </div>
379
     <div class="box box_tags">
479
     <div class="box box_tags">
380
       <div class="head"><strong>Top Tags</strong></div>
480
       <div class="head"><strong>Top Tags</strong></div>
381
       <div class="pad tags">
481
       <div class="pad tags">
382
         <ol style="padding-left: 5px">
482
         <ol style="padding-left: 5px">
383
-<?
483
+          <?php
384
         Tags::format_top(5, 'collages.php?action=search&amp;tags=');
484
         Tags::format_top(5, 'collages.php?action=search&amp;tags=');
385
 ?>
485
 ?>
386
         </ol>
486
         </ol>
387
       </div>
487
       </div>
388
     </div>
488
     </div>
389
-<?  if (!empty($TopArtists)) { ?>
489
+
490
+    <?php  if (!empty($TopArtists)) { ?>
390
     <div class="box box_artists">
491
     <div class="box box_artists">
391
       <div class="head"><strong>Top Artists</strong></div>
492
       <div class="head"><strong>Top Artists</strong></div>
392
       <div class="pad">
493
       <div class="pad">
393
         <ol style="padding-left: 5px;">
494
         <ol style="padding-left: 5px;">
394
-<?
495
+          <?php
395
     uasort($TopArtists, 'compare');
496
     uasort($TopArtists, 'compare');
396
     $i = 0;
497
     $i = 0;
397
     foreach ($TopArtists as $ID => $Artist) {
498
     foreach ($TopArtists as $ID => $Artist) {
398
-      $i++;
399
-      if ($i > 10) {
400
-        break;
401
-      }
402
-?>
499
+        $i++;
500
+        if ($i > 10) {
501
+            break;
502
+        } ?>
403
           <li><a href="artist.php?id=<?=$ID?>"><?=$Artist['name']?></a> (<?=number_format($Artist['count'])?>)</li>
503
           <li><a href="artist.php?id=<?=$ID?>"><?=$Artist['name']?></a> (<?=number_format($Artist['count'])?>)</li>
404
-<?
504
+          <?php
405
     }
505
     }
406
 ?>
506
 ?>
407
         </ol>
507
         </ol>
408
       </div>
508
       </div>
409
     </div>
509
     </div>
410
-<?  } ?>
510
+    <?php  } ?>
511
+
411
     <div class="box box_contributors">
512
     <div class="box box_contributors">
412
       <div class="head"><strong>Top Contributors</strong></div>
513
       <div class="head"><strong>Top Contributors</strong></div>
413
       <div class="pad">
514
       <div class="pad">
414
         <ol style="padding-left: 5px;">
515
         <ol style="padding-left: 5px;">
415
-<?
516
+          <?php
416
 arsort($UserAdditions);
517
 arsort($UserAdditions);
417
 $i = 0;
518
 $i = 0;
418
 foreach ($UserAdditions as $UserID => $Additions) {
519
 foreach ($UserAdditions as $UserID => $Additions) {
419
-  $i++;
420
-  if ($i > 5) {
421
-    break;
422
-  }
423
-?>
424
-          <li><?=Users::format_username($UserID, false, false, false)?> (<?=number_format($Additions)?>)</li>
425
-<?
520
+    $i++;
521
+    if ($i > 5) {
522
+        break;
523
+    } ?>
524
+          <li><?=Users::format_username($UserID, false, false, false)?>
525
+            (<?=number_format($Additions)?>)</li>
526
+          <?php
426
 }
527
 }
427
 ?>
528
 ?>
428
         </ol>
529
         </ol>
429
       </div>
530
       </div>
430
     </div>
531
     </div>
431
-<? if (check_perms('site_collages_manage') && !isset($PreventAdditions)) { ?>
532
+
533
+    <?php if (check_perms('site_collages_manage') && !isset($PreventAdditions)) { ?>
432
     <div class="box box_addtorrent">
534
     <div class="box box_addtorrent">
433
-      <div class="head"><strong>Add Torrent Group</strong><span class="float_right"><a href="#" onclick="$('.add_torrent_container').toggle_class('hidden'); this.innerHTML = (this.innerHTML == 'Batch add' ? 'Individual add' : 'Batch add'); return false;" class="brackets">Batch add</a></span></div>
535
+      <div class="head"><strong>Add Torrent Group</strong><span class="float_right"><a href="#"
536
+            onclick="$('.add_torrent_container').toggle_class('hidden'); this.innerHTML = (this.innerHTML == 'Batch add' ? 'Individual add' : 'Batch add'); return false;"
537
+            class="brackets">Batch add</a></span></div>
434
       <div class="pad add_torrent_container">
538
       <div class="pad add_torrent_container">
435
         <form class="add_form" name="torrent" action="collages.php" method="post">
539
         <form class="add_form" name="torrent" action="collages.php" method="post">
436
           <input type="hidden" name="action" value="add_torrent" />
540
           <input type="hidden" name="action" value="add_torrent" />
437
-          <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
438
-          <input type="hidden" name="collageid" value="<?=$CollageID?>" />
541
+          <input type="hidden" name="auth"
542
+            value="<?=$LoggedUser['AuthKey']?>" />
543
+          <input type="hidden" name="collageid"
544
+            value="<?=$CollageID?>" />
439
           <div class="field_div">
545
           <div class="field_div">
440
             <input type="text" size="20" name="url" />
546
             <input type="text" size="20" name="url" />
441
           </div>
547
           </div>
445
           <span style="font-style: italic;">Enter the URL of a torrent group on the site.</span>
551
           <span style="font-style: italic;">Enter the URL of a torrent group on the site.</span>
446
         </form>
552
         </form>
447
       </div>
553
       </div>
554
+
448
       <div class="pad hidden add_torrent_container">
555
       <div class="pad hidden add_torrent_container">
449
         <form class="add_form" name="torrents" action="collages.php" method="post">
556
         <form class="add_form" name="torrents" action="collages.php" method="post">
450
           <input type="hidden" name="action" value="add_torrent_batch" />
557
           <input type="hidden" name="action" value="add_torrent_batch" />
451
-          <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
452
-          <input type="hidden" name="collageid" value="<?=$CollageID?>" />
558
+          <input type="hidden" name="auth"
559
+            value="<?=$LoggedUser['AuthKey']?>" />
560
+          <input type="hidden" name="collageid"
561
+            value="<?=$CollageID?>" />
453
           <div class="field_div">
562
           <div class="field_div">
454
-            <textarea name="urls" rows="5" cols="25" style="white-space: pre; word-wrap: normal; overflow: auto;"></textarea>
563
+            <textarea name="urls" rows="5" cols="25"
564
+              style="white-space: pre; word-wrap: normal; overflow: auto;"></textarea>
455
           </div>
565
           </div>
566
+
456
           <div class="submit_div">
567
           <div class="submit_div">
457
             <input type="submit" value="Add" />
568
             <input type="submit" value="Add" />
458
           </div>
569
           </div>
460
         </form>
571
         </form>
461
       </div>
572
       </div>
462
     </div>
573
     </div>
463
-<? } ?>
574
+    <?php } ?>
575
+
464
     <h3>Comments</h3>
576
     <h3>Comments</h3>
465
-<?
577
+    <?php
466
 if ($CommentList === null) {
578
 if ($CommentList === null) {
467
-  $DB->query("
579
+    $DB->query("
468
     SELECT
580
     SELECT
469
       c.ID,
581
       c.ID,
470
       c.Body,
582
       c.Body,
477
       AND c.PageID = $CollageID
589
       AND c.PageID = $CollageID
478
     ORDER BY c.ID DESC
590
     ORDER BY c.ID DESC
479
     LIMIT 15");
591
     LIMIT 15");
480
-  $CommentList = $DB->to_array(false, MYSQLI_NUM);
592
+    $CommentList = $DB->to_array(false, MYSQLI_NUM);
481
 }
593
 }
482
 foreach ($CommentList as $Comment) {
594
 foreach ($CommentList as $Comment) {
483
-  list($CommentID, $Body, $UserID, $Username, $CommentTime) = $Comment;
484
-?>
595
+    list($CommentID, $Body, $UserID, $Username, $CommentTime) = $Comment; ?>
485
     <div class="box comment">
596
     <div class="box comment">
486
       <div class="head">
597
       <div class="head">
487
-        <?=Users::format_username($UserID, false, false, false) ?> <?=time_diff($CommentTime) ?>
598
+        <?=Users::format_username($UserID, false, false, false) ?>
599
+        <?=time_diff($CommentTime) ?>
488
         <br />
600
         <br />
489
-        <a href="reports.php?action=report&amp;type=comment&amp;id=<?=$CommentID?>" class="brackets">Report</a>
601
+        <a href="reports.php?action=report&amp;type=comment&amp;id=<?=$CommentID?>"
602
+          class="brackets">Report</a>
603
+      </div>
604
+      <div class="pad"><?=Text::full_format($Body)?>
490
       </div>
605
       </div>
491
-      <div class="pad"><?=Text::full_format($Body)?></div>
492
     </div>
606
     </div>
493
-<?
607
+    <?php
494
 }
608
 }
495
 ?>
609
 ?>
610
+
496
     <div class="box pad">
611
     <div class="box pad">
497
-      <a href="collages.php?action=comments&amp;collageid=<?=$CollageID?>" class="brackets">View all comments</a>
612
+      <a href="collages.php?action=comments&amp;collageid=<?=$CollageID?>"
613
+        class="brackets">View all comments</a>
498
     </div>
614
     </div>
499
-<?
615
+
616
+    <?php
500
 if (!$LoggedUser['DisablePosting']) {
617
 if (!$LoggedUser['DisablePosting']) {
501
-?>
618
+    ?>
502
     <div class="box box_addcomment">
619
     <div class="box box_addcomment">
503
       <div class="head"><strong>Comment</strong></div>
620
       <div class="head"><strong>Comment</strong></div>
504
-      <form class="send_form" name="comment" id="quickpostform" onsubmit="quickpostform.submit_button.disabled = true;" action="comments.php" method="post">
621
+      <form class="send_form" name="comment" id="quickpostform" onsubmit="quickpostform.submit_button.disabled = true;"
622
+        action="comments.php" method="post">
505
         <input type="hidden" name="action" value="take_post" />
623
         <input type="hidden" name="action" value="take_post" />
506
         <input type="hidden" name="page" value="collages" />
624
         <input type="hidden" name="page" value="collages" />
507
-        <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
625
+        <input type="hidden" name="auth"
626
+          value="<?=$LoggedUser['AuthKey']?>" />
508
         <input type="hidden" name="pageid" value="<?=$CollageID?>" />
627
         <input type="hidden" name="pageid" value="<?=$CollageID?>" />
509
         <div class="pad">
628
         <div class="pad">
510
           <div class="field_div">
629
           <div class="field_div">
516
         </div>
635
         </div>
517
       </form>
636
       </form>
518
     </div>
637
     </div>
519
-<?
638
+    <?php
520
 }
639
 }
521
 ?>
640
 ?>
522
   </div>
641
   </div>
642
+
523
   <div class="main_column">
643
   <div class="main_column">
524
-<?
644
+    <?php
525
 if ($CollageCovers != 0) { ?>
645
 if ($CollageCovers != 0) { ?>
526
     <div id="coverart" class="box">
646
     <div id="coverart" class="box">
527
       <div class="head" id="coverhead"><strong>Pictures</strong></div>
647
       <div class="head" id="coverhead"><strong>Pictures</strong></div>
528
-      <div class="collage_images" id="collage_page0" data-wall-child=".collage_image" data-wall-size="4" data-wall-min="2">
529
-<?
648
+      <div class="collage_images" id="collage_page0" data-wall-child=".collage_image" data-wall-size="4"
649
+        data-wall-min="2">
650
+        <?php
530
   $Page1 = array_slice($Collage, 0, $CollageCovers);
651
   $Page1 = array_slice($Collage, 0, $CollageCovers);
531
   foreach ($Page1 as $Group) {
652
   foreach ($Page1 as $Group) {
532
-    echo $Group;
653
+      echo $Group;
533
   }
654
   }
534
 ?>
655
 ?>
535
       </div>
656
       </div>
536
     </div>
657
     </div>
537
-<?  if ($NumGroups > $CollageCovers) { ?>
658
+
659
+    <?php if ($NumGroups > $CollageCovers) { ?>
538
     <div class="linkbox pager" style="clear: left;" id="pageslinksdiv">
660
     <div class="linkbox pager" style="clear: left;" id="pageslinksdiv">
539
-      <span id="firstpage" class="invisible"><a href="#" class="pageslink" onclick="collageShow.page(0, this); return false;"><strong>&lt;&lt; First</strong></a> | </span>
540
-      <span id="prevpage" class="invisible"><a href="#" class="pageslink" onclick="collageShow.prevPage(); return false;"><strong>&lt; Prev</strong></a> | </span>
541
-<?    for ($i = 0; $i < $NumGroups / $CollageCovers; $i++) { ?>
542
-      <span id="pagelink<?=$i?>" class="<?=(($i > 4) ? 'hidden' : '')?><?=(($i == 0) ? 'selected' : '')?>"><a href="#" class="pageslink" onclick="collageShow.page(<?=$i?>, this); return false;"><strong><?=$CollageCovers * $i + 1?>-<?=min($NumGroups, $CollageCovers * ($i + 1))?></strong></a><?=(($i != ceil($NumGroups / $CollageCovers) - 1) ? ' | ' : '')?></span>
543
-<?    } ?>
544
-      <span id="nextbar" class="<?=($NumGroups / $CollageCovers > 5) ? 'hidden' : ''?>"> | </span>
545
-      <span id="nextpage"><a href="#" class="pageslink" onclick="collageShow.nextPage(); return false;"><strong>Next &gt;</strong></a></span>
546
-      <span id="lastpage" class="<?=(ceil($NumGroups / $CollageCovers) == 2 ? 'invisible' : '')?>"> | <a href="#" class="pageslink" onclick="collageShow.page(<?=ceil($NumGroups / $CollageCovers) - 1?>, this); return false;"><strong>Last &gt;&gt;</strong></a></span>
661
+
662
+      <span id="firstpage" class="invisible">
663
+        <a href="#" class="pageslink" onclick="collageShow.page(0, this); return false;">
664
+          <strong>« First</strong>
665
+        </a> |
666
+      </span>
667
+
668
+      <span id="prevpage" class="invisible">
669
+        <a href="#" class="pageslink" onclick="collageShow.prevPage(); return false;">
670
+          <strong>‹ Prev</strong>
671
+        </a> |
672
+      </span>
673
+
674
+      <?php for ($i = 0; $i < $NumGroups / $CollageCovers; $i++) { ?>
675
+      <span id="pagelink<?=$i?>"
676
+        class="<?=(($i > 4) ? 'hidden' : '')?><?=(($i == 0) ? 'selected' : '')?>">
677
+        <a href="#" class="pageslink"
678
+          onclick="collageShow.page(<?=$i?>, this); return false;">
679
+          <strong><?=$CollageCovers * $i + 1?>-<?=min($NumGroups, $CollageCovers * ($i + 1))?></strong>
680
+        </a>
681
+        <?=(($i != ceil($NumGroups / $CollageCovers) - 1) ? ' | ' : '')?>
682
+      </span>
683
+      <?php } ?>
684
+
685
+      <span id="nextbar"
686
+        class="<?=($NumGroups / $CollageCovers > 5) ? 'hidden' : ''?>">
687
+        | </span>
688
+
689
+      <span id="nextpage">
690
+        <a href="#" class="pageslink" onclick="collageShow.nextPage(); return false;">
691
+          <strong>Next ›</strong>
692
+        </a>
693
+      </span>
694
+
695
+      <span id="lastpage"
696
+        class="<?=(ceil($NumGroups / $CollageCovers) == 2 ? 'invisible' : '')?>">
697
+        |
698
+        <a href="#" class="pageslink"
699
+          onclick="collageShow.page(<?=ceil($NumGroups / $CollageCovers) - 1?>, this); return false;">
700
+          <strong>Last »</strong>
701
+        </a>
702
+      </span>
547
     </div>
703
     </div>
704
+
548
     <script type="text/javascript">
705
     <script type="text/javascript">
549
-      $(()=>collageShow.init(<?=json_encode($CollagePages)?>));
706
+      $(() => collageShow.init( <?=json_encode($CollagePages)?> ));
550
     </script>
707
     </script>
551
-<?
708
+    <?php
552
   }
709
   }
553
 }
710
 }
554
 ?>
711
 ?>
712
+
555
     <div class="box">
713
     <div class="box">
556
-    <table class="torrent_table grouping cats" id="discog_table">
557
-      <tr class="colhead_dark">
558
-        <td><!-- expand/collapse --></td>
559
-        <td><!-- Category --></td>
560
-        <td width="70%"><strong>Torrents</strong></td>
561
-        <td>Size</td>
562
-        <td class="sign snatches">
563
-          <a><svg width="15" height="15" fill="black" class="tooltip" alt="Snatches" title="Snatches" viewBox="3 0 88 98"><path d="M20 20 A43 43,0,1,0,77 23 L90 10 L55 10 L55 45 L68 32 A30.27 30.27,0,1,1,28 29"></path></svg></a>
564
-        </td>
565
-        <td class="sign seeders">
566
-          <a><svg width="11" height="15" fill="black" class="tooltip" alt="Seeders" title="Seeders"><polygon points="0,7 5.5,0 11,7 8,7 8,15 3,15 3,7"></polygon></svg></a>
567
-        </td>
568
-        <td class="sign leechers">
569
-          <a><svg width="11" height="15" fill="black" class="tooltip" alt="Leechers" title="Leechers"><polygon points="0,8 5.5,15 11,8 8,8 8,0 3,0 3,8"></polygon></svg></a>
570
-        </td>
571
-      </tr>
572
-<?=$TorrentTable?>
573
-    </table>
714
+      <table class="torrent_table grouping cats" id="discog_table">
715
+        <tr class="colhead_dark">
716
+          <td>
717
+            <!-- Expand/Collapse -->
718
+          </td>
719
+
720
+          <td>
721
+            <!-- Category -->
722
+          </td>
723
+
724
+          <td width="70%"><strong>Torrents</strong></td>
725
+
726
+          <td>Size</td>
727
+
728
+          <td class="sign snatches">
729
+            <a><svg width="15" height="15" fill="black" class="tooltip" alt="Snatches" title="Snatches"
730
+                viewBox="3 0 88 98">
731
+                <path d="M20 20 A43 43,0,1,0,77 23 L90 10 L55 10 L55 45 L68 32 A30.27 30.27,0,1,1,28 29"></path>
732
+              </svg></a>
733
+          </td>
734
+
735
+          <td class="sign seeders">
736
+            <a><svg width="11" height="15" fill="black" class="tooltip" alt="Seeders" title="Seeders">
737
+                <polygon points="0,7 5.5,0 11,7 8,7 8,15 3,15 3,7"></polygon>
738
+              </svg></a>
739
+          </td>
740
+
741
+          <td class="sign leechers">
742
+            <a><svg width="11" height="15" fill="black" class="tooltip" alt="Leechers" title="Leechers">
743
+                <polygon points="0,8 5.5,15 11,8 8,8 8,0 3,0 3,8"></polygon>
744
+              </svg></a>
745
+          </td>
746
+        </tr>
747
+
748
+        <?=$TorrentTable?>
749
+
750
+      </table>
574
     </div>
751
     </div>
575
   </div>
752
   </div>
576
 </div>
753
 </div>
577
-<?
578
-View::show_footer();
579
-?>
754
+<?php View::show_footer();

+ 33
- 32
sections/forums/edit_rules.php View File

1
-<?
1
+<?php
2
 
2
 
3
 enforce_login();
3
 enforce_login();
4
 if (!check_perms('site_moderate_forums')) {
4
 if (!check_perms('site_moderate_forums')) {
5
-  error(403);
5
+    error(403);
6
 }
6
 }
7
 
7
 
8
-
9
 $ForumID = $_GET['forumid'];
8
 $ForumID = $_GET['forumid'];
10
 if (!is_number($ForumID)) {
9
 if (!is_number($ForumID)) {
11
-  error(404);
10
+    error(404);
12
 }
11
 }
13
 
12
 
14
-
15
 if (!empty($_POST['add']) || (!empty($_POST['del']))) {
13
 if (!empty($_POST['add']) || (!empty($_POST['del']))) {
16
-  if (!empty($_POST['add'])) {
17
-    if (is_number($_POST['new_thread'])) {
18
-      $DB->query("
19
-        INSERT INTO forums_specific_rules (ForumID, ThreadID)
20
-        VALUES ($ForumID, ".$_POST['new_thread'].')');
14
+    if (!empty($_POST['add'])) {
15
+        if (is_number($_POST['new_thread'])) {
16
+            $DB->query("
17
+            INSERT INTO forums_specific_rules (ForumID, ThreadID)
18
+            VALUES ($ForumID, ".$_POST['new_thread'].')');
19
+        }
21
     }
20
     }
22
-  }
23
-  if (!empty($_POST['del'])) {
24
-    if (is_number($_POST['threadid'])) {
25
-      $DB->query("
26
-        DELETE FROM forums_specific_rules
27
-        WHERE ForumID = $ForumID
28
-          AND ThreadID = ".$_POST['threadid']);
21
+
22
+    if (!empty($_POST['del'])) {
23
+        if (is_number($_POST['threadid'])) {
24
+            $DB->query("
25
+            DELETE FROM forums_specific_rules
26
+            WHERE ForumID = $ForumID
27
+              AND ThreadID = ".$_POST['threadid']);
28
+        }
29
     }
29
     }
30
-  }
31
-  $Cache->delete_value('forums_list');
30
+    $Cache->delete_value('forums_list');
32
 }
31
 }
33
 
32
 
34
-
35
 $DB->query("
33
 $DB->query("
36
-  SELECT ThreadID
37
-  FROM forums_specific_rules
34
+SELECT ThreadID
35
+FROM forums_specific_rules
38
   WHERE ForumID = $ForumID");
36
   WHERE ForumID = $ForumID");
39
 $ThreadIDs = $DB->collect('ThreadID');
37
 $ThreadIDs = $DB->collect('ThreadID');
40
 
38
 
41
 View::show_header();
39
 View::show_header();
42
 ?>
40
 ?>
41
+
43
 <div class="thin box pad">
42
 <div class="thin box pad">
44
   <div class="header">
43
   <div class="header">
45
     <h2>
44
     <h2>
46
       <a href="forums.php">Forums</a>
45
       <a href="forums.php">Forums</a>
47
-      &gt;
48
-      <a href="forums.php?action=viewforum&amp;forumid=<?=$ForumID?>"><?=$Forums[$ForumID]['Name']?></a>
49
-      &gt;
46
+      ›
47
+      <a
48
+        href="forums.php?action=viewforum&amp;forumid=<?=$ForumID?>"><?=$Forums[$ForumID]['Name']?></a>
49
+      ›
50
       Edit forum specific rules
50
       Edit forum specific rules
51
     </h2>
51
     </h2>
52
   </div>
52
   </div>
64
           <input type="submit" name="add" value="Add thread" />
64
           <input type="submit" name="add" value="Add thread" />
65
         </td>
65
         </td>
66
       </form>
66
       </form>
67
-<?  foreach ($ThreadIDs as $ThreadID) { ?>
67
+      <?php foreach ($ThreadIDs as $ThreadID) { ?>
68
     <tr>
68
     <tr>
69
-      <td><?=$ThreadID?></td>
69
+      <td><?=$ThreadID?>
70
+      </td>
70
       <td>
71
       <td>
71
         <form class="delete_form" name="forum_rules" action="" method="post">
72
         <form class="delete_form" name="forum_rules" action="" method="post">
72
-          <input type="hidden" name="threadid" value="<?=$ThreadID?>" />
73
+          <input type="hidden" name="threadid"
74
+            value="<?=$ThreadID?>" />
73
           <input type="submit" name="del" value="Delete link" />
75
           <input type="submit" name="del" value="Delete link" />
74
         </form>
76
         </form>
75
       </td>
77
       </td>
76
     </tr>
78
     </tr>
77
-<?  } ?>
79
+    <?php } ?>
78
   </table>
80
   </table>
79
 </div>
81
 </div>
80
-<?
81
-View::show_footer();
82
-?>
82
+
83
+<?php View::show_footer();

+ 138
- 120
sections/forums/forum.php View File

1
 <?php
1
 <?php
2
+
2
 /**********|| Page to show individual forums || ********************************\
3
 /**********|| Page to show individual forums || ********************************\
3
 
4
 
4
 Things to expect in $_GET:
5
 Things to expect in $_GET:
13
 // Check for lame SQL injection attempts
14
 // Check for lame SQL injection attempts
14
 $ForumID = $_GET['forumid'];
15
 $ForumID = $_GET['forumid'];
15
 if (!is_number($ForumID)) {
16
 if (!is_number($ForumID)) {
16
-  error(0);
17
+    error(0);
17
 }
18
 }
18
 
19
 
19
 $Tooltip = "tooltip";
20
 $Tooltip = "tooltip";
20
 
21
 
21
 if (isset($LoggedUser['PostsPerPage'])) {
22
 if (isset($LoggedUser['PostsPerPage'])) {
22
-  $PerPage = $LoggedUser['PostsPerPage'];
23
+    $PerPage = $LoggedUser['PostsPerPage'];
23
 } else {
24
 } else {
24
-  $PerPage = POSTS_PER_PAGE;
25
+    $PerPage = POSTS_PER_PAGE;
25
 }
26
 }
26
 
27
 
27
 list($Page, $Limit) = Format::page_limit(TOPICS_PER_PAGE);
28
 list($Page, $Limit) = Format::page_limit(TOPICS_PER_PAGE);
30
 
31
 
31
 // Caching anything beyond the first page of any given forum is just wasting RAM.
32
 // Caching anything beyond the first page of any given forum is just wasting RAM.
32
 // Users are more likely to search than to browse to page 2.
33
 // Users are more likely to search than to browse to page 2.
33
-if ($Page == 1) {
34
-  list($Forum,,,$Stickies) = $Cache->get_value("forums_$ForumID");
34
+if ($Page === 1) {
35
+    list($Forum, , , $Stickies) = $Cache->get_value("forums_$ForumID");
35
 }
36
 }
37
+
36
 if (!isset($Forum) || !is_array($Forum)) {
38
 if (!isset($Forum) || !is_array($Forum)) {
37
-  $DB->query("
39
+    $DB->query("
38
     SELECT
40
     SELECT
39
       ID,
41
       ID,
40
       Title,
42
       Title,
49
     WHERE ForumID = '$ForumID'
51
     WHERE ForumID = '$ForumID'
50
     ORDER BY IsSticky DESC, Ranking ASC, LastPostTime DESC
52
     ORDER BY IsSticky DESC, Ranking ASC, LastPostTime DESC
51
     LIMIT $Limit"); // Can be cached until someone makes a new post
53
     LIMIT $Limit"); // Can be cached until someone makes a new post
52
-  $Forum = $DB->to_array('ID', MYSQLI_ASSOC, false);
54
+    $Forum = $DB->to_array('ID', MYSQLI_ASSOC, false);
53
 
55
 
54
-  if ($Page == 1) {
55
-    $DB->query("
56
+    if ($Page === 1) {
57
+        $DB->query("
56
       SELECT COUNT(ID)
58
       SELECT COUNT(ID)
57
       FROM forums_topics
59
       FROM forums_topics
58
       WHERE ForumID = '$ForumID'
60
       WHERE ForumID = '$ForumID'
59
         AND IsSticky = '1'");
61
         AND IsSticky = '1'");
60
-    list($Stickies) = $DB->next_record();
61
-    $Cache->cache_value("forums_$ForumID", array($Forum, '', 0, $Stickies), 0);
62
-  }
62
+        list($Stickies) = $DB->next_record();
63
+        $Cache->cache_value("forums_$ForumID", array($Forum, '', 0, $Stickies), 0);
64
+    }
63
 }
65
 }
64
 
66
 
65
 if (!isset($Forums[$ForumID])) {
67
 if (!isset($Forums[$ForumID])) {
66
-  error(404);
68
+    error(404);
67
 }
69
 }
70
+
68
 // Make sure they're allowed to look at the page
71
 // Make sure they're allowed to look at the page
69
 if (!check_perms('site_moderate_forums')) {
72
 if (!check_perms('site_moderate_forums')) {
70
-  if (isset($LoggedUser['CustomForums'][$ForumID]) && $LoggedUser['CustomForums'][$ForumID] === 0) {
71
-    error(403);
72
-  }
73
+    if (isset($LoggedUser['CustomForums'][$ForumID]) && $LoggedUser['CustomForums'][$ForumID] === 0) {
74
+        error(403);
75
+    }
73
 }
76
 }
74
 
77
 
75
-
76
 $ForumName = display_str($Forums[$ForumID]['Name']);
78
 $ForumName = display_str($Forums[$ForumID]['Name']);
77
 if (!Forums::check_forumperm($ForumID)) {
79
 if (!Forums::check_forumperm($ForumID)) {
78
-  error(403);
80
+    error(403);
79
 }
81
 }
80
 
82
 
81
 // Start printing
83
 // Start printing
82
-View::show_header('Forums &gt; '. $Forums[$ForumID]['Name'], '', '');
84
+View::show_header('Forums  '. $Forums[$ForumID]['Name'], '', '');
83
 ?>
85
 ?>
86
+
84
 <div class="thin">
87
 <div class="thin">
85
-  <h2><a href="forums.php">Forums</a> &gt; <?=$ForumName?></h2>
88
+  <h2><a href="forums.php">Forums</a> › <?=$ForumName?>
89
+  </h2>
86
   <div class="linkbox">
90
   <div class="linkbox">
87
-<? if (Forums::check_forumperm($ForumID, 'Write') && Forums::check_forumperm($ForumID, 'Create')) { ?>
88
-    <a href="forums.php?action=new&amp;forumid=<?=$ForumID?>" class="brackets">New thread</a>
89
-<? } ?>
91
+    <?php if (Forums::check_forumperm($ForumID, 'Write') && Forums::check_forumperm($ForumID, 'Create')) { ?>
92
+    <a href="forums.php?action=new&amp;forumid=<?=$ForumID?>"
93
+      class="brackets">New thread</a>
94
+    <?php } ?>
90
     <a data-toggle-target="#searchforum" data-toggle-replace="Hide search" class="brackets">Search this forum</a>
95
     <a data-toggle-target="#searchforum" data-toggle-replace="Hide search" class="brackets">Search this forum</a>
91
     <div id="searchforum" class="hidden center">
96
     <div id="searchforum" class="hidden center">
92
       <div style="display: inline-block;">
97
       <div style="display: inline-block;">
96
             <tr>
101
             <tr>
97
               <td>
102
               <td>
98
                 <input type="hidden" name="action" value="search" />
103
                 <input type="hidden" name="action" value="search" />
99
-                <input type="hidden" name="forums[]" value="<?=$ForumID?>" />
104
+                <input type="hidden" name="forums[]"
105
+                  value="<?=$ForumID?>" />
100
                 <strong>Search Terms</strong>
106
                 <strong>Search Terms</strong>
101
               </td>
107
               </td>
102
               <td>
108
               <td>
127
       </div>
133
       </div>
128
     </div>
134
     </div>
129
   </div>
135
   </div>
130
-<?  if (check_perms('site_moderate_forums')) { ?>
136
+  <?php if (check_perms('site_moderate_forums')) { ?>
131
   <div class="linkbox">
137
   <div class="linkbox">
132
-    <a href="forums.php?action=edit_rules&amp;forumid=<?=$ForumID?>" class="brackets">Change specific rules</a>
138
+    <a href="forums.php?action=edit_rules&amp;forumid=<?=$ForumID?>"
139
+      class="brackets">Change specific rules</a>
133
   </div>
140
   </div>
134
-<?  } ?>
135
-<?  if (!empty($Forums[$ForumID]['SpecificRules'])) { ?>
141
+  <?php } ?>
142
+  <?php if (!empty($Forums[$ForumID]['SpecificRules'])) { ?>
136
   <div class="linkbox">
143
   <div class="linkbox">
137
-      <strong>Forum Specific Rules</strong>
138
-<?    foreach ($Forums[$ForumID]['SpecificRules'] as $ThreadIDs) {
139
-      $Thread = Forums::get_thread_info($ThreadIDs);
140
-      if ($Thread === null) {
144
+    <strong>Forum Specific Rules</strong>
145
+    <?php foreach ($Forums[$ForumID]['SpecificRules'] as $ThreadIDs) {
146
+    $Thread = Forums::get_thread_info($ThreadIDs);
147
+    if ($Thread === null) {
141
         error(404);
148
         error(404);
142
-      }
143
-?>
149
+    } ?>
144
     <br />
150
     <br />
145
-    <a href="forums.php?action=viewthread&amp;threadid=<?=$ThreadIDs?>" class="brackets"><?=display_str($Thread['Title'])?></a>
146
-<?    } ?>
151
+    <a href="forums.php?action=viewthread&amp;threadid=<?=$ThreadIDs?>"
152
+      class="brackets"><?=display_str($Thread['Title'])?></a>
153
+    <?php
154
+} ?>
147
   </div>
155
   </div>
148
-<?  } ?>
156
+  <?php } ?>
149
   <div class="linkbox pager">
157
   <div class="linkbox pager">
150
-<?
158
+    <?php
151
 $Pages = Format::get_pages($Page, $Forums[$ForumID]['NumTopics'], TOPICS_PER_PAGE, 9);
159
 $Pages = Format::get_pages($Page, $Forums[$ForumID]['NumTopics'], TOPICS_PER_PAGE, 9);
152
 echo $Pages;
160
 echo $Pages;
153
 ?>
161
 ?>
159
       <td style="width: 7%;">Replies</td>
167
       <td style="width: 7%;">Replies</td>
160
       <td style="width: 14%;">Author</td>
168
       <td style="width: 14%;">Author</td>
161
     </tr>
169
     </tr>
162
-<?
170
+    <?php
163
 // Check that we have content to process
171
 // Check that we have content to process
164
 if (count($Forum) === 0) {
172
 if (count($Forum) === 0) {
165
-?>
173
+    ?>
166
     <tr>
174
     <tr>
167
       <td colspan="4">
175
       <td colspan="4">
168
         No threads to display in this forum!
176
         No threads to display in this forum!
169
       </td>
177
       </td>
170
     </tr>
178
     </tr>
171
-<?
179
+    <?php
172
 } else {
180
 } else {
173
-  // forums_last_read_topics is a record of the last post a user read in a topic, and what page that was on
174
-  $DB->query("
181
+        // forums_last_read_topics is a record of the last post a user read in a topic, and what page that was on
182
+        $DB->query("
175
     SELECT
183
     SELECT
176
       l.TopicID,
184
       l.TopicID,
177
       l.PostID,
185
       l.PostID,
186
     WHERE l.TopicID IN (".implode(', ', array_keys($Forum)).')
194
     WHERE l.TopicID IN (".implode(', ', array_keys($Forum)).')
187
       AND l.UserID = \''.$LoggedUser['ID'].'\'');
195
       AND l.UserID = \''.$LoggedUser['ID'].'\'');
188
 
196
 
189
-  // Turns the result set into a multi-dimensional array, with
190
-  // forums_last_read_topics.TopicID as the key.
191
-  // This is done here so we get the benefit of the caching, and we
192
-  // don't have to make a database query for each topic on the page
193
-  $LastRead = $DB->to_array('TopicID');
197
+        // Turns the result set into a multi-dimensional array, with
198
+        // forums_last_read_topics.TopicID as the key.
199
+        // This is done here so we get the benefit of the caching, and we
200
+        // don't have to make a database query for each topic on the page
201
+        $LastRead = $DB->to_array('TopicID');
194
 
202
 
195
-  //---------- Begin printing
203
+        //---------- Begin printing
196
 
204
 
197
-  foreach ($Forum as $Topic) {
198
-    list($TopicID, $Title, $AuthorID, $Locked, $Sticky, $PostCount, $LastID, $LastTime, $LastAuthorID) = array_values($Topic);
199
-    // Build list of page links
200
-    // Only do this if there is more than one page
201
-    $PageLinks = [];
202
-    $ShownEllipses = false;
203
-    $PagesText = '';
204
-    $TopicPages = ceil($PostCount / $PerPage);
205
+        foreach ($Forum as $Topic) {
206
+            list($TopicID, $Title, $AuthorID, $Locked, $Sticky, $PostCount, $LastID, $LastTime, $LastAuthorID) = array_values($Topic);
207
+            // Build list of page links
208
+            // Only do this if there is more than one page
209
+            $PageLinks = [];
210
+            $ShownEllipses = false;
211
+            $PagesText = '';
212
+            $TopicPages = ceil($PostCount / $PerPage);
205
 
213
 
206
-    if ($TopicPages > 1) {
207
-      $PagesText = ' (';
208
-      for ($i = 1; $i <= $TopicPages; $i++) {
209
-        if ($TopicPages > 4 && ($i > 2 && $i <= $TopicPages - 2)) {
210
-          if (!$ShownEllipses) {
211
-            $PageLinks[] = '-';
212
-            $ShownEllipses = true;
213
-          }
214
-          continue;
215
-        }
216
-        $PageLinks[] = "<a href=\"forums.php?action=viewthread&amp;threadid=$TopicID&amp;page=$i\">$i</a>";
217
-      }
218
-      $PagesText .= implode(' ', $PageLinks);
219
-      $PagesText .= ')';
220
-    }
214
+            if ($TopicPages > 1) {
215
+                $PagesText = ' (';
216
+                for ($i = 1; $i <= $TopicPages; $i++) {
217
+                    if ($TopicPages > 4 && ($i > 2 && $i <= $TopicPages - 2)) {
218
+                        if (!$ShownEllipses) {
219
+                            $PageLinks[] = '-';
220
+                            $ShownEllipses = true;
221
+                        }
222
+                        continue;
223
+                    }
224
+                    $PageLinks[] = "<a href=\"forums.php?action=viewthread&amp;threadid=$TopicID&amp;page=$i\">$i</a>";
225
+                }
226
+                $PagesText .= implode(' ', $PageLinks);
227
+                $PagesText .= ')';
228
+            }
221
 
229
 
222
-    // handle read/unread posts - the reason we can't cache the whole page
223
-    if ((!$Locked || $Sticky) && ((empty($LastRead[$TopicID]) || $LastRead[$TopicID]['PostID'] < $LastID) && strtotime($LastTime) > $LoggedUser['CatchupTime'])) {
224
-      $Read = 'unread';
225
-    } else {
226
-      $Read = 'read';
227
-    }
228
-    if ($Locked) {
229
-      $Read .= '_locked';
230
-    }
231
-    if ($Sticky) {
232
-      $Read .= '_sticky';
233
-    }
234
-?>
235
-  <tr class="row">
236
-    <td class="<?=$Read?> <?=$Tooltip?>" title="<?=ucwords(str_replace('_', ' ', $Read))?>"></td>
237
-    <td>
238
-      <span class="float_left last_topic">
239
-<?
230
+            // handle read/unread posts - the reason we can't cache the whole page
231
+            if ((!$Locked || $Sticky) && ((empty($LastRead[$TopicID]) || $LastRead[$TopicID]['PostID'] < $LastID) && strtotime($LastTime) > $LoggedUser['CatchupTime'])) {
232
+                $Read = 'unread';
233
+            } else {
234
+                $Read = 'read';
235
+            }
236
+            if ($Locked) {
237
+                $Read .= '_locked';
238
+            }
239
+            if ($Sticky) {
240
+                $Read .= '_sticky';
241
+            } ?>
242
+    <tr class="row">
243
+      <td
244
+        class="<?=$Read?> <?=$Tooltip?>"
245
+        title="<?=ucwords(str_replace('_', ' ', $Read))?>">
246
+      </td>
247
+      <td>
248
+        <span class="float_left last_topic">
249
+          <?php
240
     $TopicLength = 75 - (2 * count($PageLinks));
250
     $TopicLength = 75 - (2 * count($PageLinks));
241
-    unset($PageLinks);
242
-    $Title = display_str($Title);
243
-    $DisplayTitle = $Title;
244
-
245
-?>
246
-        <strong>
247
-          <a href="forums.php?action=viewthread&amp;threadid=<?=$TopicID?>" class="tooltip" data-title-plain="<?=$Title?>"><?=Format::cut_string($DisplayTitle, $TopicLength) ?></a>
248
-        </strong>
249
-        <?=$PagesText?>
250
-      </span>
251
-<?    if (!empty($LastRead[$TopicID])) { ?>
252
-      <a class="<?=$Tooltip?> last_read" title="Jump to last read" href="forums.php?action=viewthread&amp;threadid=<?=$TopicID?>&amp;page=<?=$LastRead[$TopicID]['Page']?>#post<?=$LastRead[$TopicID]['PostID']?>">
253
-        <svg width="15" height="11"><polygon points="0,3 0,8 8,8 8,11 15,5.5 8,0 8,3"/></svg>
254
-      </a>
255
-<?    } ?>
256
-      <span class="float_right last_poster">
257
-        by <?=Users::format_username($LastAuthorID, false, false, false, false, false)?> <?=time_diff($LastTime,1)?>
258
-      </span>
259
-    </td>
260
-    <td class="number_column"><?=number_format($PostCount - 1)?></td>
261
-    <td><?=Users::format_username($AuthorID, false, false, false, false, false)?></td>
262
-  </tr>
263
-<?  }
264
-} ?>
265
-</table>
266
-<!--<div class="breadcrumbs">
267
-  <a href="forums.php">Forums</a> &gt; <?=$ForumName?>
268
-</div>-->
251
+            unset($PageLinks);
252
+            $Title = display_str($Title);
253
+            $DisplayTitle = $Title; ?>
254
+          <strong>
255
+            <a href="forums.php?action=viewthread&amp;threadid=<?=$TopicID?>"
256
+              class="tooltip" data-title-plain="<?=$Title?>"><?=Format::cut_string($DisplayTitle, $TopicLength) ?></a>
257
+          </strong>
258
+          <?=$PagesText?>
259
+        </span>
260
+        <?php if (!empty($LastRead[$TopicID])) { ?>
261
+        <a class="<?=$Tooltip?> last_read" title="Jump to last read"
262
+          href="forums.php?action=viewthread&amp;threadid=<?=$TopicID?>&amp;page=<?=$LastRead[$TopicID]['Page']?>#post<?=$LastRead[$TopicID]['PostID']?>">
263
+          <svg width="15" height="11">
264
+            <polygon points="0,3 0,8 8,8 8,11 15,5.5 8,0 8,3" /></svg>
265
+        </a>
266
+        <?php } ?>
267
+        <span class="float_right last_poster">
268
+          by <?=Users::format_username($LastAuthorID, false, false, false, false, false)?>
269
+          <?=time_diff($LastTime, 1)?>
270
+        </span>
271
+      </td>
272
+      <td class="number_column"><?=number_format($PostCount - 1)?>
273
+      </td>
274
+      <td><?=Users::format_username($AuthorID, false, false, false, false, false)?>
275
+      </td>
276
+    </tr>
277
+    <?php
278
+        }
279
+    } ?>
280
+  </table>
281
+  <div class="breadcrumbs">
282
+    <a href="forums.php">Forums</a> › <?=$ForumName?>
283
+  </div>
269
   <div class="linkbox pager">
284
   <div class="linkbox pager">
270
     <?=$Pages?>
285
     <?=$Pages?>
271
   </div>
286
   </div>
272
-  <div class="linkbox"><a href="forums.php?action=catchup&amp;forumid=<?=$ForumID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Catch up</a></div>
287
+  <div class="linkbox"><a
288
+      href="forums.php?action=catchup&amp;forumid=<?=$ForumID?>&amp;auth=<?=$LoggedUser['AuthKey']?>"
289
+      class="brackets">Catch up</a></div>
273
 </div>
290
 </div>
274
-<? View::show_footer(); ?>
291
+
292
+<?php View::show_footer();

+ 54
- 32
sections/forums/newthread.php View File

1
-<?
1
+<?php
2
+
2
 /*
3
 /*
3
 New post page
4
 New post page
4
 
5
 
11
 
12
 
12
 $ForumID = $_GET['forumid'];
13
 $ForumID = $_GET['forumid'];
13
 if (!is_number($ForumID)) {
14
 if (!is_number($ForumID)) {
14
-  error(404);
15
+    error(404);
15
 }
16
 }
17
+
16
 $Forum = Forums::get_forum_info($ForumID);
18
 $Forum = Forums::get_forum_info($ForumID);
17
 if ($Forum === false) {
19
 if ($Forum === false) {
18
-  error(404);
20
+    error(404);
19
 }
21
 }
20
 
22
 
21
-
22
 if (!Forums::check_forumperm($ForumID, 'Write') || !Forums::check_forumperm($ForumID, 'Create')) {
23
 if (!Forums::check_forumperm($ForumID, 'Write') || !Forums::check_forumperm($ForumID, 'Create')) {
23
-  error(403);
24
+    error(403);
24
 }
25
 }
25
-View::show_header('Forums &gt; '.$Forum['Name'].' &gt; New Topic', 'comments,bbcode,jquery.validate,form_validate');
26
+
27
+View::show_header('Forums › '.$Forum['Name'].' › New Topic', 'comments,bbcode,jquery.validate,form_validate');
26
 ?>
28
 ?>
29
+
27
 <div class="thin">
30
 <div class="thin">
28
-  <h2><a href="forums.php">Forums</a> &gt; <a href="forums.php?action=viewforum&amp;forumid=<?=$ForumID?>"><?=$Forum['Name']?></a> &gt; <span id="newthreadtitle">New Topic</span></h2>
31
+  <h2>
32
+    <a href="forums.php">Forums</a>
33
+    ›
34
+    <a href="forums.php?action=viewforum&amp;forumid=<?=$ForumID?>">
35
+      <?=$Forum['Name']?></a>
36
+    ›
37
+    <span id="newthreadtitle">
38
+      New Topic
39
+    </span>
40
+  </h2>
41
+
29
   <div class="hidden" id="newthreadpreview">
42
   <div class="hidden" id="newthreadpreview">
30
     <div class="linkbox">
43
     <div class="linkbox">
31
       <div class="center">
44
       <div class="center">
33
         <a href="#" onclick="return false;" class="brackets"><?=!empty($HeavyInfo['AutoSubscribe']) ? 'Unsubscribe' : 'Subscribe'?></a>
46
         <a href="#" onclick="return false;" class="brackets"><?=!empty($HeavyInfo['AutoSubscribe']) ? 'Unsubscribe' : 'Subscribe'?></a>
34
       </div>
47
       </div>
35
     </div>
48
     </div>
36
-<?  if (check_perms('forums_polls_create')) { ?>
49
+    <?php if (check_perms('forums_polls_create')) { ?>
37
     <div class="box thin clear hidden" id="pollpreview">
50
     <div class="box thin clear hidden" id="pollpreview">
38
-      <div class="head colhead_dark"><strong>Poll</strong> <a data-toggle-target="#threadpoll" class="brackets">View</a></div>
51
+      <div class="head colhead_dark"><strong>Poll</strong> <a data-toggle-target="#threadpoll" class="brackets">View</a>
52
+      </div>
39
       <div class="pad" id="threadpoll">
53
       <div class="pad" id="threadpoll">
40
         <p><strong id="pollquestion"></strong></p>
54
         <p><strong id="pollquestion"></strong></p>
41
         <div id="pollanswers"></div>
55
         <div id="pollanswers"></div>
42
-        <br /><input type="radio" name="vote" id="answer_0" value="0" /> <label for="answer_0">Blank&#8202;&mdash;&#8202;Show the results!</label><br /><br />
56
+        <br /><input type="radio" name="vote" id="answer_0" value="0" /> <label
57
+          for="answer_0">Blank&#8202;&mdash;&#8202;Show the results!</label><br /><br />
43
         <input type="button" class="float_left" value="Vote" />
58
         <input type="button" class="float_left" value="Vote" />
44
       </div>
59
       </div>
45
     </div>
60
     </div>
46
-<?  } ?>
61
+    <?php } ?>
47
     <table class="forum_post box vertical_margin" style="text-align: left;">
62
     <table class="forum_post box vertical_margin" style="text-align: left;">
48
       <colgroup>
63
       <colgroup>
49
-<?  if (Users::has_avatars_enabled()) { ?>
64
+        <?php if (Users::has_avatars_enabled()) { ?>
50
         <col class="col_avatar" />
65
         <col class="col_avatar" />
51
-<?  } ?>
66
+        <?php } ?>
52
         <col class="col_post_body" />
67
         <col class="col_post_body" />
53
       </colgroup>
68
       </colgroup>
54
       <tr class="colhead_dark">
69
       <tr class="colhead_dark">
55
         <td colspan="<?=Users::has_avatars_enabled() ? 2 : 1 ?>">
70
         <td colspan="<?=Users::has_avatars_enabled() ? 2 : 1 ?>">
56
           <span class="float_left"><a href="#newthreadpreview">#XXXXXX</a>
71
           <span class="float_left"><a href="#newthreadpreview">#XXXXXX</a>
57
             by <strong><?=Users::format_username($LoggedUser['ID'], true, true, true, true, true)?></strong>
72
             by <strong><?=Users::format_username($LoggedUser['ID'], true, true, true, true, true)?></strong>
58
-          Just now
73
+            Just now
59
           </span>
74
           </span>
60
           <span id="barpreview" class="float_right">
75
           <span id="barpreview" class="float_right">
61
             <a href="#newthreadpreview" class="brackets">Report</a>
76
             <a href="#newthreadpreview" class="brackets">Report</a>
65
         </td>
80
         </td>
66
       </tr>
81
       </tr>
67
       <tr>
82
       <tr>
68
-<?  if (Users::has_avatars_enabled()) { ?>
83
+        <?php if (Users::has_avatars_enabled()) { ?>
69
         <td class="avatar" valign="top">
84
         <td class="avatar" valign="top">
70
           <?=Users::show_avatar($LoggedUser['Avatar'], $LoggedUser['ID'], $LoggedUser['Username'], $HeavyInfo['DisableAvatars'])?>
85
           <?=Users::show_avatar($LoggedUser['Avatar'], $LoggedUser['ID'], $LoggedUser['Username'], $HeavyInfo['DisableAvatars'])?>
71
         </td>
86
         </td>
72
-<?  } ?>
87
+        <?php } ?>
73
         <td class="body" valign="top">
88
         <td class="body" valign="top">
74
           <div id="contentpreview" style="text-align: left;"></div>
89
           <div id="contentpreview" style="text-align: left;"></div>
75
         </td>
90
         </td>
79
   <div class="box pad">
94
   <div class="box pad">
80
     <form class="create_form" name="forum_thread" action="" id="newthreadform" method="post">
95
     <form class="create_form" name="forum_thread" action="" id="newthreadform" method="post">
81
       <input type="hidden" name="action" value="new" />
96
       <input type="hidden" name="action" value="new" />
82
-      <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
97
+      <input type="hidden" name="auth"
98
+        value="<?=$LoggedUser['AuthKey']?>" />
83
       <input type="hidden" name="forum" value="<?=$ForumID?>" />
99
       <input type="hidden" name="forum" value="<?=$ForumID?>" />
84
       <table id="newthreadtext" class="layout">
100
       <table id="newthreadtext" class="layout">
85
         <tr>
101
         <tr>
88
         </tr>
104
         </tr>
89
         <tr>
105
         <tr>
90
           <td class="label">Body</td>
106
           <td class="label">Body</td>
91
-          <td><textarea id="posttext" class="required bbcode_editor" style="width: 98%;" onkeyup="resize('posttext');" name="body" cols="90" rows="8"></textarea></td>
107
+          <td><textarea id="posttext" class="required bbcode_editor" style="width: 98%;" onkeyup="resize('posttext');"
108
+              name="body" cols="90" rows="8"></textarea></td>
92
         </tr>
109
         </tr>
93
         <tr>
110
         <tr>
94
           <td></td>
111
           <td></td>
95
           <td>
112
           <td>
96
-            <input id="subscribebox" type="checkbox" name="subscribe"<?=!empty($HeavyInfo['AutoSubscribe']) ? ' checked="checked"' : ''?> onchange="$('#subscribeboxpreview').raw().checked=this.checked;" />
113
+            <input id="subscribebox" type="checkbox" name="subscribe" <?=!empty($HeavyInfo['AutoSubscribe']) ? ' checked="checked"' : ''?>
114
+            onchange="$('#subscribeboxpreview').raw().checked=this.checked;" />
97
             <label for="subscribebox">Subscribe to topic</label>
115
             <label for="subscribebox">Subscribe to topic</label>
98
           </td>
116
           </td>
99
         </tr>
117
         </tr>
100
-<?
118
+        <?php
101
 if (check_perms('forums_polls_create')) {
119
 if (check_perms('forums_polls_create')) {
102
-?>
103
-        <script type="text/javascript">//<![CDATA[
104
-        var AnswerCount = 1;
120
+    ?>
121
+        <script type="text/javascript">
122
+          //<![CDATA[
123
+          var AnswerCount = 1;
105
 
124
 
106
-        function AddAnswerField() {
125
+          function AddAnswerField() {
107
             if (AnswerCount >= 25) {
126
             if (AnswerCount >= 25) {
108
               return;
127
               return;
109
             }
128
             }
110
             var AnswerField = document.createElement("input");
129
             var AnswerField = document.createElement("input");
111
             AnswerField.type = "text";
130
             AnswerField.type = "text";
112
-            AnswerField.id = "answer_"+AnswerCount;
131
+            AnswerField.id = "answer_" + AnswerCount;
113
             AnswerField.className = "required";
132
             AnswerField.className = "required";
114
             AnswerField.name = "answers[]";
133
             AnswerField.name = "answers[]";
115
             AnswerField.style.width = "90%";
134
             AnswerField.style.width = "90%";
118
             x.appendChild(document.createElement("br"));
137
             x.appendChild(document.createElement("br"));
119
             x.appendChild(AnswerField);
138
             x.appendChild(AnswerField);
120
             AnswerCount++;
139
             AnswerCount++;
121
-        }
140
+          }
122
 
141
 
123
-        function RemoveAnswerField() {
142
+          function RemoveAnswerField() {
124
             if (AnswerCount == 1) {
143
             if (AnswerCount == 1) {
125
               return;
144
               return;
126
             }
145
             }
129
               x.removeChild(x.lastChild);
148
               x.removeChild(x.lastChild);
130
             }
149
             }
131
             AnswerCount--;
150
             AnswerCount--;
132
-        }
133
-        //]]>
151
+          }
152
+          //]]>
134
         </script>
153
         </script>
135
         <tr>
154
         <tr>
136
           <td colspan="2" class="center">
155
           <td colspan="2" class="center">
150
             <a href="#" onclick="RemoveAnswerField();return false;" class="brackets">&minus;</a>
169
             <a href="#" onclick="RemoveAnswerField();return false;" class="brackets">&minus;</a>
151
           </td>
170
           </td>
152
         </tr>
171
         </tr>
153
-<? } ?>
172
+        <?php
173
+} ?>
154
       </table>
174
       </table>
155
       <div id="subscribediv" class="hidden">
175
       <div id="subscribediv" class="hidden">
156
-        <input id="subscribeboxpreview" type="checkbox" name="subscribe"<?=!empty($HeavyInfo['AutoSubscribe']) ? ' checked="checked"' : '' ?> />
176
+        <input id="subscribeboxpreview" type="checkbox" name="subscribe" <?=!empty($HeavyInfo['AutoSubscribe']) ? ' checked="checked"' : '' ?>
177
+        />
157
         <label for="subscribebox">Subscribe to topic</label>
178
         <label for="subscribebox">Subscribe to topic</label>
158
       </div>
179
       </div>
159
       <div id="buttons" class="center">
180
       <div id="buttons" class="center">
164
     </form>
185
     </form>
165
   </div>
186
   </div>
166
 </div>
187
 </div>
167
-<? View::show_footer(); ?>
188
+
189
+<?php View::show_footer();

+ 834
- 628
sections/user/edit.php
File diff suppressed because it is too large
View File


+ 100
- 73
sections/userhistory/subscriptions.php View File

1
-<?
1
+<?php
2
+
2
 /*
3
 /*
3
-User subscription page
4
-*/
4
+ * User subscription page
5
+ */
5
 
6
 
6
 if (isset($LoggedUser['PostsPerPage'])) {
7
 if (isset($LoggedUser['PostsPerPage'])) {
7
-  $PerPage = $LoggedUser['PostsPerPage'];
8
+    $PerPage = $LoggedUser['PostsPerPage'];
8
 } else {
9
 } else {
9
-  $PerPage = POSTS_PER_PAGE;
10
+    $PerPage = POSTS_PER_PAGE;
10
 }
11
 }
11
 list($Page, $Limit) = Format::page_limit($PerPage);
12
 list($Page, $Limit) = Format::page_limit($PerPage);
12
 
13
 
13
-View::show_header('Subscriptions','subscriptions,bbcode');
14
+View::show_header('Subscriptions', 'subscriptions,bbcode');
14
 
15
 
15
 $ShowUnread = (!isset($_GET['showunread']) && !isset($HeavyInfo['SubscriptionsUnread']) || isset($HeavyInfo['SubscriptionsUnread']) && !!$HeavyInfo['SubscriptionsUnread'] || isset($_GET['showunread']) && !!$_GET['showunread']);
16
 $ShowUnread = (!isset($_GET['showunread']) && !isset($HeavyInfo['SubscriptionsUnread']) || isset($HeavyInfo['SubscriptionsUnread']) && !!$HeavyInfo['SubscriptionsUnread'] || isset($_GET['showunread']) && !!$_GET['showunread']);
16
 $ShowCollapsed = (!isset($_GET['collapse']) && !isset($HeavyInfo['SubscriptionsCollapse']) || isset($HeavyInfo['SubscriptionsCollapse']) && !!$HeavyInfo['SubscriptionsCollapse'] || isset($_GET['collapse']) && !!$_GET['collapse']);
17
 $ShowCollapsed = (!isset($_GET['collapse']) && !isset($HeavyInfo['SubscriptionsCollapse']) || isset($HeavyInfo['SubscriptionsCollapse']) && !!$HeavyInfo['SubscriptionsCollapse'] || isset($_GET['collapse']) && !!$_GET['collapse']);
85
   GROUP BY t.ID)
86
   GROUP BY t.ID)
86
   ORDER BY LastPostTime DESC
87
   ORDER BY LastPostTime DESC
87
   LIMIT $Limit");
88
   LIMIT $Limit");
89
+
88
 $Results = $DB->to_array(false, MYSQLI_ASSOC, false);
90
 $Results = $DB->to_array(false, MYSQLI_ASSOC, false);
89
 $DB->query('SELECT FOUND_ROWS()');
91
 $DB->query('SELECT FOUND_ROWS()');
90
 list($NumResults) = $DB->next_record();
92
 list($NumResults) = $DB->next_record();
93
 
95
 
94
 $TorrentGroups = $Requests = [];
96
 $TorrentGroups = $Requests = [];
95
 foreach ($Results as $Result) {
97
 foreach ($Results as $Result) {
96
-  if ($Result['Page'] == 'torrents') {
97
-    $TorrentGroups[] = $Result['PageID'];
98
-  } elseif ($Result['Page'] == 'requests') {
99
-    $Requests[] = $Result['PageID'];
100
-  }
98
+    if ($Result['Page'] === 'torrents') {
99
+        $TorrentGroups[] = $Result['PageID'];
100
+    } elseif ($Result['Page'] === 'requests') {
101
+        $Requests[] = $Result['PageID'];
102
+    }
101
 }
103
 }
102
 
104
 
103
 $TorrentGroups = Torrents::get_groups($TorrentGroups, true, true, false);
105
 $TorrentGroups = Torrents::get_groups($TorrentGroups, true, true, false);
104
 $Requests = Requests::get_requests($Requests);
106
 $Requests = Requests::get_requests($Requests);
105
-
106
 ?>
107
 ?>
108
+
107
 <div class="thin">
109
 <div class="thin">
108
   <div class="header">
110
   <div class="header">
109
-    <h2>Subscriptions<?=$ShowUnread ? ' with unread posts' . ($NumResults ? ' (' . $NumResults . ' new)' : '') : ''?></h2>
111
+    <h2>Subscriptions<?=$ShowUnread ? ' with unread posts' . ($NumResults ? ' (' . $NumResults . ' new)' : '') : ''?>
112
+    </h2>
110
 
113
 
111
     <div class="linkbox">
114
     <div class="linkbox">
112
-<?
115
+      <?php
113
 if (!$ShowUnread) {
116
 if (!$ShowUnread) {
114
-?>
117
+    ?>
115
       <br /><br />
118
       <br /><br />
116
-      <a href="userhistory.php?action=subscriptions&amp;showunread=1" class="brackets">Only display subscriptions with unread replies</a>&nbsp;&nbsp;&nbsp;
117
-<?
119
+      <a href="userhistory.php?action=subscriptions&amp;showunread=1" class="brackets">Only display subscriptions with
120
+        unread replies</a>&nbsp;&nbsp;&nbsp;
121
+      <?php
118
 } else {
122
 } else {
119
-?>
123
+        ?>
120
       <br /><br />
124
       <br /><br />
121
-      <a href="userhistory.php?action=subscriptions&amp;showunread=0" class="brackets">Show all subscriptions</a>&nbsp;&nbsp;&nbsp;
122
-<?
123
-}
125
+      <a href="userhistory.php?action=subscriptions&amp;showunread=0" class="brackets">Show all
126
+        subscriptions</a>&nbsp;&nbsp;&nbsp;
127
+      <?php
128
+    }
124
 if ($NumResults) {
129
 if ($NumResults) {
125
-?>
126
-      <a href="#" onclick="Collapse(); return false;" id="collapselink" class="brackets"><?=$ShowCollapsed ? 'Show' : 'Hide' ?> post bodies</a>&nbsp;&nbsp;&nbsp;
127
-<?
130
+    ?>
131
+      <a href="#" onclick="Collapse(); return false;" id="collapselink" class="brackets"><?=$ShowCollapsed ? 'Show' : 'Hide' ?>
132
+        post bodies</a>&nbsp;&nbsp;&nbsp;
133
+      <?php
128
 }
134
 }
129
 ?>
135
 ?>
130
-      <a href="userhistory.php?action=catchup&amp;auth=<?=$LoggedUser['AuthKey']?>" class="brackets">Catch up</a>&nbsp;&nbsp;&nbsp;
131
-      <a href="userhistory.php?action=posts&amp;userid=<?=$LoggedUser['ID']?>" class="brackets">Go to post history</a>&nbsp;&nbsp;&nbsp;
136
+      <a href="userhistory.php?action=catchup&amp;auth=<?=$LoggedUser['AuthKey']?>"
137
+        class="brackets">Catch up</a>&nbsp;&nbsp;&nbsp;
138
+      <a href="userhistory.php?action=posts&amp;userid=<?=$LoggedUser['ID']?>"
139
+        class="brackets">Go to post history</a>&nbsp;&nbsp;&nbsp;
132
       <a href="userhistory.php?action=quote_notifications" class="brackets">Quote notifications</a>&nbsp;&nbsp;&nbsp;
140
       <a href="userhistory.php?action=quote_notifications" class="brackets">Quote notifications</a>&nbsp;&nbsp;&nbsp;
133
     </div>
141
     </div>
134
   </div>
142
   </div>
135
-<?
143
+  <?php
136
 if (!$NumResults) {
144
 if (!$NumResults) {
137
-?>
145
+    ?>
138
   <div class="center">
146
   <div class="center">
139
     No subscriptions<?=$ShowUnread ? ' with unread posts' : ''?>
147
     No subscriptions<?=$ShowUnread ? ' with unread posts' : ''?>
140
   </div>
148
   </div>
141
-<?
149
+  <?php
142
 } else {
150
 } else {
143
-?>
151
+        ?>
144
   <div class="linkbox">
152
   <div class="linkbox">
145
-<?
153
+    <?php
146
   $Pages = Format::get_pages($Page, $NumResults, $PerPage, 11);
154
   $Pages = Format::get_pages($Page, $NumResults, $PerPage, 11);
147
-  echo $Pages;
148
-?>
155
+        echo $Pages; ?>
149
   </div>
156
   </div>
150
-<?
157
+  <?php
151
   foreach ($Results as $Result) {
158
   foreach ($Results as $Result) {
152
-    switch ($Result['Page']) {
159
+      switch ($Result['Page']) {
153
       case 'artist':
160
       case 'artist':
154
         $Links = 'Artist: <a href="artist.php?id=' . $Result['PageID'] . '">' . display_str($Result['Name']) . '</a>';
161
         $Links = 'Artist: <a href="artist.php?id=' . $Result['PageID'] . '">' . display_str($Result['Name']) . '</a>';
155
         $JumpLink = 'artist.php?id=' . $Result['PageID'] . '&amp;postid=' . $Result['PostID'] . '#post' . $Result['PostID'];
162
         $JumpLink = 'artist.php?id=' . $Result['PageID'] . '&amp;postid=' . $Result['PostID'] . '#post' . $Result['PostID'];
160
         break;
167
         break;
161
       case 'requests':
168
       case 'requests':
162
         if (!isset($Requests[$Result['PageID']])) {
169
         if (!isset($Requests[$Result['PageID']])) {
163
-          continue;
170
+            continue;
164
         }
171
         }
165
         $Request = $Requests[$Result['PageID']];
172
         $Request = $Requests[$Result['PageID']];
166
         $CategoryName = $Categories[$CategoryID - 1];
173
         $CategoryName = $Categories[$CategoryID - 1];
167
 
174
 
168
         $Links = 'Request: ';
175
         $Links = 'Request: ';
176
+        /*
169
         if ($CategoryName == 'Music' || $CategoryName == 'Audiobooks' || $CategoryName == 'Comedy') {
177
         if ($CategoryName == 'Music' || $CategoryName == 'Audiobooks' || $CategoryName == 'Comedy') {
170
-          $Links .= ($CategoryName == 'Music' ? 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>";
178
+            $Links .= ($CategoryName == 'Music' ? 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>";
171
         } else {
179
         } else {
172
-          $Links .= '<a href="requests.php?action=view&amp;id=' . $Result['PageID'] . '">' . $Request['Title'] . "</a>";
173
-        }
180
+          */
181
+            $Links .= '<a href="requests.php?action=view&amp;id=' . $Result['PageID'] . '">' . $Request['Title'] . "</a>";
182
+        #} # else
174
         $JumpLink = 'requests.php?action=view&amp;id=' . $Result['PageID'] . '&amp;postid=' . $Result['PostID'] . '#post' . $Result['PostID'];
183
         $JumpLink = 'requests.php?action=view&amp;id=' . $Result['PageID'] . '&amp;postid=' . $Result['PostID'] . '#post' . $Result['PostID'];
175
         break;
184
         break;
176
       case 'torrents':
185
       case 'torrents':
177
         if (!isset($TorrentGroups[$Result['PageID']])) {
186
         if (!isset($TorrentGroups[$Result['PageID']])) {
178
-          continue;
187
+            continue;
179
         }
188
         }
180
         $GroupInfo = $TorrentGroups[$Result['PageID']];
189
         $GroupInfo = $TorrentGroups[$Result['PageID']];
181
         $Links = 'Torrent: ' . Artists::display_artists($GroupInfo['ExtendedArtists']) . '<a href="torrents.php?id=' . $GroupInfo['ID'] . '" dir="ltr">' . $GroupInfo['Name'] . '</a>';
190
         $Links = 'Torrent: ' . Artists::display_artists($GroupInfo['ExtendedArtists']) . '<a href="torrents.php?id=' . $GroupInfo['ID'] . '" dir="ltr">' . $GroupInfo['Name'] . '</a>';
182
         if ($GroupInfo['Year'] > 0) {
191
         if ($GroupInfo['Year'] > 0) {
183
-          $Links .= " [" . $GroupInfo['Year'] . "]";
192
+            $Links .= " [" . $GroupInfo['Year'] . "]";
184
         }
193
         }
185
         if ($GroupInfo['ReleaseType'] > 0) {
194
         if ($GroupInfo['ReleaseType'] > 0) {
186
-          $Links .= " [" . $ReleaseTypes[$GroupInfo['ReleaseType']] . "]";
195
+            $Links .= " [" . $ReleaseTypes[$GroupInfo['ReleaseType']] . "]";
187
         }
196
         }
188
         $JumpLink = 'torrents.php?id=' . $GroupInfo['ID'] . '&amp;postid=' . $Result['PostID'] . '#post' . $Result['PostID'];
197
         $JumpLink = 'torrents.php?id=' . $GroupInfo['ID'] . '&amp;postid=' . $Result['PostID'] . '#post' . $Result['PostID'];
189
         break;
198
         break;
197
         break;
206
         break;
198
       default:
207
       default:
199
         error(0);
208
         error(0);
200
-    }
201
-?>
202
-  <table class="forum_post box vertical_margin<?=(!Users::has_avatars_enabled() ? ' noavatar' : '')?>">
209
+    } ?>
210
+
211
+  <table
212
+    class="forum_post box vertical_margin<?=(!Users::has_avatars_enabled() ? ' noavatar' : '')?>">
203
     <colgroup>
213
     <colgroup>
204
-<?    if (Users::has_avatars_enabled()) { ?>
214
+      <?php if (Users::has_avatars_enabled()) { ?>
205
       <col class="col_avatar" />
215
       <col class="col_avatar" />
206
-<?    } ?>
216
+      <?php } ?>
207
       <col class="col_post_body" />
217
       <col class="col_post_body" />
208
     </colgroup>
218
     </colgroup>
209
-    <tr class="colhead_dark notify_<?=$Result['Page']?>">
219
+    <tr
220
+      class="colhead_dark notify_<?=$Result['Page']?>">
210
       <td colspan="<?=Users::has_avatars_enabled() ? 2 : 1 ?>">
221
       <td colspan="<?=Users::has_avatars_enabled() ? 2 : 1 ?>">
211
         <span class="float_left">
222
         <span class="float_left">
212
           <?=$Links . ($Result['PostID'] < $Result['LastPost'] ? ' <span class="new">(New!)</span>' : '')?>
223
           <?=$Links . ($Result['PostID'] < $Result['LastPost'] ? ' <span class="new">(New!)</span>' : '')?>
213
         </span>
224
         </span>
214
-        <a class="tooltip last_read" title="Jump to last read" href="<?=$JumpLink?>">
215
-          <svg width="15" height="11"><polygon points="0,3 0,8 8,8 8,11 15,5.5 8,0 8,3"/></svg>
225
+        <a class="tooltip last_read" title="Jump to last read"
226
+          href="<?=$JumpLink?>">
227
+          <svg width="15" height="11">
228
+            <polygon points="0,3 0,8 8,8 8,11 15,5.5 8,0 8,3" /></svg>
216
         </a>
229
         </a>
217
-<?    if ($Result['Page'] == 'forums') { ?>
218
-        <span id="bar<?=$Result['PostID'] ?>" class="float_right">
219
-          <a href="#" onclick="Subscribe(<?=$Result['PageID']?>); return false;" id="subscribelink<?=$Result['PageID']?>" class="brackets">Unsubscribe</a>
220
-<?    } else { ?>
221
-        <span id="bar_<?=$Result['Page'] . $Result['PostID'] ?>" class="float_right">
222
-          <a href="#" onclick="SubscribeComments('<?=$Result['Page']?>', <?=$Result['PageID']?>); return false;" id="subscribelink_<?=$Result['Page'] . $Result['PageID']?>" class="brackets">Unsubscribe</a>
223
-<?    } ?>
224
-          &nbsp;
225
-          <a href="#">&uarr;</a>
226
-        </span>
230
+        <?php if ($Result['Page'] === 'forums') { ?>
231
+        <span id="bar<?=$Result['PostID'] ?>"
232
+          class="float_right">
233
+          <a href="#"
234
+            onclick="Subscribe(<?=$Result['PageID']?>); return false;"
235
+            id="subscribelink<?=$Result['PageID']?>"
236
+            class="brackets">Unsubscribe</a>
237
+          <?php } else { ?>
238
+          <span
239
+            id="bar_<?=$Result['Page'] . $Result['PostID'] ?>"
240
+            class="float_right">
241
+            <a href="#"
242
+              onclick="SubscribeComments('<?=$Result['Page']?>', <?=$Result['PageID']?>); return false;"
243
+              id="subscribelink_<?=$Result['Page'] . $Result['PageID']?>"
244
+              class="brackets">Unsubscribe</a>
245
+            <?php } ?>
246
+            &nbsp;
247
+            <a href="#">&uarr;</a>
248
+          </span>
227
       </td>
249
       </td>
228
     </tr>
250
     </tr>
229
-<?    if (!empty($Result['LastReadBody'])) { // if a user is subscribed to a topic/comments but hasn't accessed the site ever, LastReadBody will be null - in this case we don't display a post. ?>
230
-    <tr class="row<?=$ShowCollapsed ? ' hidden' : '' ?>">
231
-<?      if (Users::has_avatars_enabled()) { ?>
251
+    <?php if (!empty($Result['LastReadBody'])) { // if a user is subscribed to a topic/comments but hasn't accessed the site ever, LastReadBody will be null - in this case we don't display a post.?>
252
+    <tr
253
+      class="row<?=$ShowCollapsed ? ' hidden' : '' ?>">
254
+      <?php if (Users::has_avatars_enabled()) { ?>
232
       <td class="avatar" valign="top">
255
       <td class="avatar" valign="top">
233
         <?=Users::show_avatar($Result['LastReadAvatar'], $Result['LastReadUserID'], $Result['LastReadUsername'], $HeavyInfo['DisableAvatars'])?>
256
         <?=Users::show_avatar($Result['LastReadAvatar'], $Result['LastReadUserID'], $Result['LastReadUsername'], $HeavyInfo['DisableAvatars'])?>
234
       </td>
257
       </td>
235
-<?      } ?>
258
+      <?php } ?>
236
       <td class="body" valign="top">
259
       <td class="body" valign="top">
237
         <div class="content3">
260
         <div class="content3">
238
           <?=Text::full_format($Result['LastReadBody']) ?>
261
           <?=Text::full_format($Result['LastReadBody']) ?>
239
-<?      if ($Result['LastReadEditedUserID']) { ?>
262
+          <?php if ($Result['LastReadEditedUserID']) { ?>
240
           <br /><br />
263
           <br /><br />
241
-          Last edited by <?=Users::format_username($Result['LastReadEditedUserID'], false, false, false) ?> <?=time_diff($Result['LastReadEditedTime'])?>
242
-<?      } ?>
264
+          Last edited by <?=Users::format_username($Result['LastReadEditedUserID'], false, false, false) ?>
265
+          <?=time_diff($Result['LastReadEditedTime'])?>
266
+          <?php } ?>
243
         </div>
267
         </div>
244
       </td>
268
       </td>
245
     </tr>
269
     </tr>
246
-<?    } ?>
270
+    <?php } ?>
247
   </table>
271
   </table>
248
-<?  } ?>
272
+  <?php
273
+  } ?>
274
+
249
   <div class="linkbox">
275
   <div class="linkbox">
250
-<?=$Pages?>
276
+    <?=$Pages?>
251
   </div>
277
   </div>
252
-<? }?>
278
+  <?php
279
+    }?>
253
 </div>
280
 </div>
254
-<?
255
-View::show_footer();
281
+
282
+<?php View::show_footer();

Loading…
Cancel
Save