Browse Source

More tiny inconsistent forms

pjc 5 years ago
parent
commit
7c97921fd4
2 changed files with 229 additions and 205 deletions
  1. 2
    2
      sections/forums/search.php
  2. 227
    203
      sections/torrents/user.php

+ 2
- 2
sections/forums/search.php View File

127
           <input type="radio" name="type" id="type_title" value="title"<?php if ($Type == 'title') {
127
           <input type="radio" name="type" id="type_title" value="title"<?php if ($Type == 'title') {
128
         echo ' checked="checked"';
128
         echo ' checked="checked"';
129
     } ?> />
129
     } ?> />
130
-          <label for="type_title">Titles</label>
130
+          <label for="type_title">Titles</label>&nbsp;&nbsp;
131
           <input type="radio" name="type" id="type_body" value="body"<?php if ($Type == 'body') {
131
           <input type="radio" name="type" id="type_body" value="body"<?php if ($Type == 'body') {
132
         echo ' checked="checked"';
132
         echo ' checked="checked"';
133
-    } ?> />&nbsp;&nbsp;
133
+    } ?> />
134
           <label for="type_body">Body</label>
134
           <label for="type_body">Body</label>
135
         </td>
135
         </td>
136
       </tr>
136
       </tr>

+ 227
- 203
sections/torrents/user.php View File

1
 <?php
1
 <?php
2
 
2
 
3
-
4
 $Orders = ['Time', 'Name', 'Seeders', 'Leechers', 'Snatched', 'Size'];
3
 $Orders = ['Time', 'Name', 'Seeders', 'Leechers', 'Snatched', 'Size'];
5
 $Ways = ['DESC' => 'Descending', 'ASC' => 'Ascending'];
4
 $Ways = ['DESC' => 'Descending', 'ASC' => 'Ascending'];
6
 
5
 
7
 // The "order by x" links on columns headers
6
 // The "order by x" links on columns headers
8
-function header_link($SortKey, $DefaultWay = 'DESC') {
9
-  global $Order, $Way;
10
-  if ($SortKey == $Order) {
11
-    if ($Way == 'DESC') {
12
-      $NewWay = 'ASC';
7
+function header_link($SortKey, $DefaultWay = 'DESC')
8
+{
9
+    global $Order, $Way;
10
+    if ($SortKey === $Order) {
11
+        if ($Way === 'DESC') {
12
+            $NewWay = 'ASC';
13
+        } else {
14
+            $NewWay = 'DESC';
15
+        }
13
     } else {
16
     } else {
14
-      $NewWay = 'DESC';
17
+        $NewWay = $DefaultWay;
15
     }
18
     }
16
-  } else {
17
-    $NewWay = $DefaultWay;
18
-  }
19
-
20
-  return "torrents.php?way=$NewWay&amp;order=$SortKey&amp;" . Format::get_url(array('way','order'));
19
+    return "torrents.php?way=$NewWay&amp;order=$SortKey&amp;" . Format::get_url(array('way','order'));
21
 }
20
 }
22
 
21
 
23
 $UserID = $_GET['userid'];
22
 $UserID = $_GET['userid'];
24
 if (!is_number($UserID)) {
23
 if (!is_number($UserID)) {
25
-  error(0);
24
+    error(0);
26
 }
25
 }
27
 
26
 
28
 if (!empty($_GET['page']) && is_number($_GET['page']) && $_GET['page'] > 0) {
27
 if (!empty($_GET['page']) && is_number($_GET['page']) && $_GET['page'] > 0) {
29
-  $Page = $_GET['page'];
30
-  $Limit = ($Page - 1) * TORRENTS_PER_PAGE.', '.TORRENTS_PER_PAGE;
28
+    $Page = $_GET['page'];
29
+    $Limit = ($Page - 1) * TORRENTS_PER_PAGE.', '.TORRENTS_PER_PAGE;
31
 } else {
30
 } else {
32
-  $Page = 1;
33
-  $Limit = TORRENTS_PER_PAGE;
31
+    $Page = 1;
32
+    $Limit = TORRENTS_PER_PAGE;
34
 }
33
 }
35
 
34
 
36
 if (!empty($_GET['order']) && in_array($_GET['order'], $Orders)) {
35
 if (!empty($_GET['order']) && in_array($_GET['order'], $Orders)) {
37
-  $Order = $_GET['order'];
36
+    $Order = $_GET['order'];
38
 } else {
37
 } else {
39
-  $Order = 'Time';
38
+    $Order = 'Time';
40
 }
39
 }
41
 
40
 
42
 if (!empty($_GET['way']) && array_key_exists($_GET['way'], $Ways)) {
41
 if (!empty($_GET['way']) && array_key_exists($_GET['way'], $Ways)) {
43
-  $Way = $_GET['way'];
42
+    $Way = $_GET['way'];
44
 } else {
43
 } else {
45
-  $Way = 'DESC';
44
+    $Way = 'DESC';
46
 }
45
 }
47
 
46
 
48
 $SearchWhere = [];
47
 $SearchWhere = [];
49
 if (!empty($_GET['format'])) {
48
 if (!empty($_GET['format'])) {
50
-  if (in_array($_GET['format'], $Formats)) {
51
-    $SearchWhere[] = "t.Format = '".db_string($_GET['format'])."'";
52
-  } elseif ($_GET['format'] == 'perfectflac') {
53
-    $_GET['filter'] = 'perfectflac';
54
-  }
49
+    if (in_array($_GET['format'], $Formats)) {
50
+        $SearchWhere[] = "t.Format = '".db_string($_GET['format'])."'";
51
+    } elseif ($_GET['format'] === 'perfectflac') {
52
+        $_GET['filter'] = 'perfectflac';
53
+    }
55
 }
54
 }
56
 
55
 
56
+# Get release specifics
57
 if (isset($_GET['container']) && in_array($_GET['container'], array_unique(array_merge($Containers, $ContainersGames)))) {
57
 if (isset($_GET['container']) && in_array($_GET['container'], array_unique(array_merge($Containers, $ContainersGames)))) {
58
-  $SearchWhere[] = "t.Container = '".db_string($_GET['container'])."'";
58
+    $SearchWhere[] = "t.Container = '".db_string($_GET['container'])."'";
59
 }
59
 }
60
 
60
 
61
 if (isset($_GET['bitrate']) && in_array($_GET['bitrate'], $Bitrates)) {
61
 if (isset($_GET['bitrate']) && in_array($_GET['bitrate'], $Bitrates)) {
62
-  $SearchWhere[] = "t.Encoding = '".db_string($_GET['bitrate'])."'";
62
+    $SearchWhere[] = "t.Encoding = '".db_string($_GET['bitrate'])."'";
63
 }
63
 }
64
 
64
 
65
 if (isset($_GET['media']) && in_array($_GET['media'], array_unique(array_merge($Media, $MediaManga)))) {
65
 if (isset($_GET['media']) && in_array($_GET['media'], array_unique(array_merge($Media, $MediaManga)))) {
66
-  $SearchWhere[] = "t.Media = '".db_string($_GET['media'])."'";
66
+    $SearchWhere[] = "t.Media = '".db_string($_GET['media'])."'";
67
 }
67
 }
68
 
68
 
69
 if (isset($_GET['codec']) && in_array($_GET['codec'], $Codecs)) {
69
 if (isset($_GET['codec']) && in_array($_GET['codec'], $Codecs)) {
70
-  $SearchWhere[] = "t.Codec = '".db_string($_GET['codec'])."'";
70
+    $SearchWhere[] = "t.Codec = '".db_string($_GET['codec'])."'";
71
 }
71
 }
72
 
72
 
73
 if (isset($_GET['audioformat']) && in_array($_GET['audioformat'], $AudioFormats)) {
73
 if (isset($_GET['audioformat']) && in_array($_GET['audioformat'], $AudioFormats)) {
74
-  $SearchWhere[] = "t.AudioFormat = '".db_string($_GET['audioformat'])."'";
74
+    $SearchWhere[] = "t.AudioFormat = '".db_string($_GET['audioformat'])."'";
75
 }
75
 }
76
 
76
 
77
 if (isset($_GET['resolution']) && in_array($_GET['resolution'], $Resolutions)) {
77
 if (isset($_GET['resolution']) && in_array($_GET['resolution'], $Resolutions)) {
78
-  $SearchWhere[] = "t.Resolution = '".db_string($_GET['resolution'])."'";
78
+    $SearchWhere[] = "t.Resolution = '".db_string($_GET['resolution'])."'";
79
 }
79
 }
80
 
80
 
81
 if (isset($_GET['language']) && in_array($_GET['language'], $Languages)) {
81
 if (isset($_GET['language']) && in_array($_GET['language'], $Languages)) {
82
-  $SearchWhere[] = "t.Language = '".db_string($_GET['language'])."'";
82
+    $SearchWhere[] = "t.Language = '".db_string($_GET['language'])."'";
83
 }
83
 }
84
 
84
 
85
 if (isset($_GET['subbing']) && in_array($_GET['subbing'], $Subbing)) {
85
 if (isset($_GET['subbing']) && in_array($_GET['subbing'], $Subbing)) {
86
-  $SearchWhere[] = "t.Subbing = '".db_string($_GET['subbing'])."'";
86
+    $SearchWhere[] = "t.Subbing = '".db_string($_GET['subbing'])."'";
87
 }
87
 }
88
 
88
 
89
 if (isset($_GET['censored']) && in_array($_GET['censored'], array(1, 0))) {
89
 if (isset($_GET['censored']) && in_array($_GET['censored'], array(1, 0))) {
90
-  $SearchWhere[] = "t.Censored = '".db_string($_GET['censored'])."'";
90
+    $SearchWhere[] = "t.Censored = '".db_string($_GET['censored'])."'";
91
 }
91
 }
92
 
92
 
93
 if (!empty($_GET['categories'])) {
93
 if (!empty($_GET['categories'])) {
94
-  $Cats = [];
95
-  foreach (array_keys($_GET['categories']) as $Cat) {
96
-    if (!is_number($Cat)) {
97
-      error(0);
94
+    $Cats = [];
95
+    foreach (array_keys($_GET['categories']) as $Cat) {
96
+        if (!is_number($Cat)) {
97
+            error(0);
98
+        }
99
+        $Cats[] = "tg.CategoryID = '".db_string($Cat)."'";
98
     }
100
     }
99
-    $Cats[] = "tg.CategoryID = '".db_string($Cat)."'";
100
-  }
101
-  $SearchWhere[] = '('.implode(' OR ', $Cats).')';
101
+    $SearchWhere[] = '('.implode(' OR ', $Cats).')';
102
 }
102
 }
103
 
103
 
104
 if (!isset($_GET['tags_type'])) {
104
 if (!isset($_GET['tags_type'])) {
105
-  $_GET['tags_type'] = '1';
105
+    $_GET['tags_type'] = '1';
106
 }
106
 }
107
 
107
 
108
 if (!empty($_GET['tags'])) {
108
 if (!empty($_GET['tags'])) {
109
-  $Tags = explode(',', $_GET['tags']);
110
-  $TagList = [];
111
-  foreach ($Tags as $Tag) {
112
-    $Tag = trim(str_replace('.', '_', $Tag));
113
-    if (empty($Tag)) {
114
-      continue;
109
+    $Tags = explode(',', $_GET['tags']);
110
+    $TagList = [];
111
+    foreach ($Tags as $Tag) {
112
+        $Tag = trim(str_replace('.', '_', $Tag));
113
+        if (empty($Tag)) {
114
+            continue;
115
+        }
116
+        if ($Tag[0] === '!') {
117
+            $Tag = ltrim(substr($Tag, 1));
118
+            if (empty($Tag)) {
119
+                continue;
120
+            }
121
+            $TagList[] = "tg.TagList NOT RLIKE '[[:<:]]".db_string($Tag)."(:[^ ]+)?[[:>:]]'";
122
+        } else {
123
+            $TagList[] = "tg.TagList RLIKE '[[:<:]]".db_string($Tag)."(:[^ ]+)?[[:>:]]'";
124
+        }
115
     }
125
     }
116
-    if ($Tag[0] == '!') {
117
-      $Tag = ltrim(substr($Tag, 1));
118
-      if (empty($Tag)) {
119
-        continue;
120
-      }
121
-      $TagList[] = "tg.TagList NOT RLIKE '[[:<:]]".db_string($Tag)."(:[^ ]+)?[[:>:]]'";
122
-    } else {
123
-      $TagList[] = "tg.TagList RLIKE '[[:<:]]".db_string($Tag)."(:[^ ]+)?[[:>:]]'";
124
-    }
125
-  }
126
-  if (!empty($TagList)) {
127
-    if (isset($_GET['tags_type']) && $_GET['tags_type'] !== '1') {
128
-      $_GET['tags_type'] = '0';
129
-      $SearchWhere[] = '('.implode(' OR ', $TagList).')';
130
-    } else {
131
-      $_GET['tags_type'] = '1';
132
-      $SearchWhere[] = '('.implode(' AND ', $TagList).')';
126
+    if (!empty($TagList)) {
127
+        if (isset($_GET['tags_type']) && $_GET['tags_type'] !== '1') {
128
+            $_GET['tags_type'] = '0';
129
+            $SearchWhere[] = '('.implode(' OR ', $TagList).')';
130
+        } else {
131
+            $_GET['tags_type'] = '1';
132
+            $SearchWhere[] = '('.implode(' AND ', $TagList).')';
133
+        }
133
     }
134
     }
134
-  }
135
 }
135
 }
136
 
136
 
137
 $SearchWhere = implode(' AND ', $SearchWhere);
137
 $SearchWhere = implode(' AND ', $SearchWhere);
138
 if (!empty($SearchWhere)) {
138
 if (!empty($SearchWhere)) {
139
-  $SearchWhere = " AND $SearchWhere";
139
+    $SearchWhere = " AND $SearchWhere";
140
 }
140
 }
141
 
141
 
142
 $User = Users::user_info($UserID);
142
 $User = Users::user_info($UserID);
146
 switch ($_GET['type']) {
146
 switch ($_GET['type']) {
147
   case 'snatched':
147
   case 'snatched':
148
     if (!check_paranoia('snatched', $User['Paranoia'], $UserClass, $UserID)) {
148
     if (!check_paranoia('snatched', $User['Paranoia'], $UserClass, $UserID)) {
149
-      error(403);
149
+        error(403);
150
     }
150
     }
151
     $Time = 'xs.tstamp';
151
     $Time = 'xs.tstamp';
152
     $UserField = 'xs.uid';
152
     $UserField = 'xs.uid';
157
     break;
157
     break;
158
   case 'seeding':
158
   case 'seeding':
159
     if (!check_paranoia('seeding', $User['Paranoia'], $UserClass, $UserID)) {
159
     if (!check_paranoia('seeding', $User['Paranoia'], $UserClass, $UserID)) {
160
-      error(403);
160
+        error(403);
161
     }
161
     }
162
     $Time = '(xfu.mtime - xfu.timespent)';
162
     $Time = '(xfu.mtime - xfu.timespent)';
163
     $UserField = 'xfu.uid';
163
     $UserField = 'xfu.uid';
181
     break;
181
     break;
182
   case 'leeching':
182
   case 'leeching':
183
     if (!check_paranoia('leeching', $User['Paranoia'], $UserClass, $UserID)) {
183
     if (!check_paranoia('leeching', $User['Paranoia'], $UserClass, $UserID)) {
184
-      error(403);
184
+        error(403);
185
     }
185
     }
186
     $Time = '(xfu.mtime - xfu.timespent)';
186
     $Time = '(xfu.mtime - xfu.timespent)';
187
     $UserField = 'xfu.uid';
187
     $UserField = 'xfu.uid';
194
     break;
194
     break;
195
   case 'uploaded':
195
   case 'uploaded':
196
     if ((empty($_GET['filter']) || $_GET['filter'] !== 'perfectflac') && !check_paranoia('uploads', $User['Paranoia'], $UserClass, $UserID)) {
196
     if ((empty($_GET['filter']) || $_GET['filter'] !== 'perfectflac') && !check_paranoia('uploads', $User['Paranoia'], $UserClass, $UserID)) {
197
-      error(403);
197
+        error(403);
198
     }
198
     }
199
     $Time = 'unix_timestamp(t.Time)';
199
     $Time = 'unix_timestamp(t.Time)';
200
     $UserField = 't.UserID';
200
     $UserField = 't.UserID';
203
     break;
203
     break;
204
   case 'downloaded':
204
   case 'downloaded':
205
     if (!check_perms('site_view_torrent_snatchlist')) {
205
     if (!check_perms('site_view_torrent_snatchlist')) {
206
-      error(403);
206
+        error(403);
207
     }
207
     }
208
     $Time = 'unix_timestamp(ud.Time)';
208
     $Time = 'unix_timestamp(ud.Time)';
209
     $UserField = 'ud.UserID';
209
     $UserField = 'ud.UserID';
217
 }
217
 }
218
 
218
 
219
 if (!empty($_GET['filter'])) {
219
 if (!empty($_GET['filter'])) {
220
-  if ($_GET['filter'] === 'perfectflac') {
221
-    if (!check_paranoia('perfectflacs', $User['Paranoia'], $UserClass, $UserID)) {
222
-      error(403);
223
-    }
224
-    $ExtraWhere .= " AND t.Format = 'FLAC'";
225
-    if (empty($_GET['media'])) {
226
-      $ExtraWhere .= "
220
+    if ($_GET['filter'] === 'perfectflac') {
221
+        if (!check_paranoia('perfectflacs', $User['Paranoia'], $UserClass, $UserID)) {
222
+            error(403);
223
+        }
224
+        $ExtraWhere .= " AND t.Format = 'FLAC'";
225
+        if (empty($_GET['media'])) {
226
+            $ExtraWhere .= "
227
         AND (
227
         AND (
228
           t.LogScore = 100 OR
228
           t.LogScore = 100 OR
229
           t.Media IN ('Vinyl', 'WEB', 'DVD', 'Soundboard', 'Cassette', 'SACD', 'Blu-ray', 'DAT')
229
           t.Media IN ('Vinyl', 'WEB', 'DVD', 'Soundboard', 'Cassette', 'SACD', 'Blu-ray', 'DAT')
230
           )";
230
           )";
231
-    } elseif (strtoupper($_GET['media']) === 'CD' && empty($_GET['log'])) {
232
-      $ExtraWhere .= "
231
+        } elseif (strtoupper($_GET['media']) === 'CD' && empty($_GET['log'])) {
232
+            $ExtraWhere .= "
233
         AND t.LogScore = 100";
233
         AND t.LogScore = 100";
234
+        }
235
+    } elseif ($_GET['filter'] === 'uniquegroup') {
236
+        if (!check_paranoia('uniquegroups', $User['Paranoia'], $UserClass, $UserID)) {
237
+            error(403);
238
+        }
239
+        $GroupBy = 'tg.ID';
234
     }
240
     }
235
-  } elseif ($_GET['filter'] === 'uniquegroup') {
236
-    if (!check_paranoia('uniquegroups', $User['Paranoia'], $UserClass, $UserID)) {
237
-      error(403);
238
-    }
239
-    $GroupBy = 'tg.ID';
240
-  }
241
 }
241
 }
242
 
242
 
243
 if (empty($GroupBy)) {
243
 if (empty($GroupBy)) {
244
-  $GroupBy = 't.ID';
244
+    $GroupBy = 't.ID';
245
 }
245
 }
246
 
246
 
247
-if ((empty($_GET['search']) || trim($_GET['search']) === '')) {//&& $Order != 'Name') {
248
-  $SQL = "
247
+if ((empty($_GET['search']) || trim($_GET['search']) === '')) { // && $Order !== 'Name') {
248
+    $SQL = "
249
     SELECT
249
     SELECT
250
       SQL_CALC_FOUND_ROWS
250
       SQL_CALC_FOUND_ROWS
251
       t.GroupID,
251
       t.GroupID,
262
     ORDER BY $Order $Way
262
     ORDER BY $Order $Way
263
     LIMIT $Limit";
263
     LIMIT $Limit";
264
 } else {
264
 } else {
265
-  $DB->query("
265
+    $DB->query("
266
     CREATE TEMPORARY TABLE temp_sections_torrents_user (
266
     CREATE TEMPORARY TABLE temp_sections_torrents_user (
267
       GroupID int(10) unsigned not null,
267
       GroupID int(10) unsigned not null,
268
       TorrentID int(10) unsigned not null,
268
       TorrentID int(10) unsigned not null,
274
       Name mediumtext,
274
       Name mediumtext,
275
       Size bigint(12) unsigned,
275
       Size bigint(12) unsigned,
276
     PRIMARY KEY (TorrentID)) CHARSET=utf8");
276
     PRIMARY KEY (TorrentID)) CHARSET=utf8");
277
-  $DB->query("
277
+    $DB->query("
278
     INSERT IGNORE INTO temp_sections_torrents_user
278
     INSERT IGNORE INTO temp_sections_torrents_user
279
       SELECT
279
       SELECT
280
         t.GroupID,
280
         t.GroupID,
295
         $SearchWhere
295
         $SearchWhere
296
       GROUP BY TorrentID, Time");
296
       GROUP BY TorrentID, Time");
297
 
297
 
298
-  if (!empty($_GET['search']) && trim($_GET['search']) !== '') {
299
-    $Words = array_unique(explode(' ', db_string($_GET['search'])));
300
-  }
298
+    if (!empty($_GET['search']) && trim($_GET['search']) !== '') {
299
+        $Words = array_unique(explode(' ', db_string($_GET['search'])));
300
+    }
301
 
301
 
302
-  $SQL = "
302
+    $SQL = "
303
     SELECT
303
     SELECT
304
       SQL_CALC_FOUND_ROWS
304
       SQL_CALC_FOUND_ROWS
305
       GroupID,
305
       GroupID,
307
       Time,
307
       Time,
308
       CategoryID
308
       CategoryID
309
     FROM temp_sections_torrents_user";
309
     FROM temp_sections_torrents_user";
310
-  if (!empty($Words)) {
311
-    $SQL .= "
310
+    if (!empty($Words)) {
311
+        $SQL .= "
312
     WHERE Name LIKE '%".implode("%' AND Name LIKE '%", $Words)."%'";
312
     WHERE Name LIKE '%".implode("%' AND Name LIKE '%", $Words)."%'";
313
-  }
314
-  $SQL .= "
313
+    }
314
+    $SQL .= "
315
     ORDER BY $Order $Way
315
     ORDER BY $Order $Way
316
     LIMIT $Limit";
316
     LIMIT $Limit";
317
 }
317
 }
329
 $User = Users::user_info($UserID);
329
 $User = Users::user_info($UserID);
330
 
330
 
331
 View::show_header($User['Username']."'s $Action torrents", 'browse');
331
 View::show_header($User['Username']."'s $Action torrents", 'browse');
332
-
333
 $Pages = Format::get_pages($Page, $TorrentCount, TORRENTS_PER_PAGE);
332
 $Pages = Format::get_pages($Page, $TorrentCount, TORRENTS_PER_PAGE);
334
-
335
-
336
 ?>
333
 ?>
334
+
337
 <div class="thin">
335
 <div class="thin">
338
   <div class="header">
336
   <div class="header">
339
-    <h2><a href="user.php?id=<?=$UserID?>"><?=$User['Username']?></a><?="'s $Action torrents"?></h2>
337
+    <h2><a href="user.php?id=<?= $UserID ?>"><?= $User['Username'] ?></a><?= "'s $Action torrents" ?></h2>
340
   </div>
338
   </div>
341
   <div class="box pad">
339
   <div class="box pad">
342
     <form class="search_form" name="torrents" action="" method="get">
340
     <form class="search_form" name="torrents" action="" method="get">
343
       <table class="layout">
341
       <table class="layout">
342
+
343
+        <!-- Terms -->
344
         <tr>
344
         <tr>
345
-          <td class="label"><strong>Search for:</strong></td>
345
+          <td class="label"><strong>Search Terms</strong></td>
346
           <td>
346
           <td>
347
-            <input type="hidden" name="type" value="<?=$_GET['type']?>" />
348
-            <input type="hidden" name="userid" value="<?=$UserID?>" />
349
-            <input type="search" name="search" size="60" value="<?Format::form('search')?>" />
347
+            <input type="hidden" name="type" value="<?= $_GET['type'] ?>" />
348
+            <input type="hidden" name="userid" value="<?= $UserID ?>" />
349
+            <input type="search" name="search" size="60" value="<?php Format::form('search') ?>" />
350
           </td>
350
           </td>
351
         </tr>
351
         </tr>
352
+
353
+        <!-- Specifics -->
352
         <tr>
354
         <tr>
353
-          <td class="label"><strong>Release specifics:</strong></td>
355
+          <td class="label"><strong>Specifics</strong></td>
354
           <td class="nobr" colspan="3">
356
           <td class="nobr" colspan="3">
355
             <select id="container" name="container" class="ft_container">
357
             <select id="container" name="container" class="ft_container">
356
               <option value="">Format</option>
358
               <option value="">Format</option>
357
-<?  foreach ($Containers as $ContainerName) { ?>
358
-              <option value="<?=display_str($ContainerName); ?>"<?Format::selected('container', $ContainerName)?>><?=display_str($ContainerName); ?></option>
359
-<?  } ?>
359
+              <?php foreach ($Containers as $ContainerName) { ?>
360
+              <option value="<?= display_str($ContainerName); ?>"<?php Format::selected('container', $ContainerName) ?>><?= display_str($ContainerName); ?>
361
+              </option>
362
+              <?php } ?>
360
             </select>
363
             </select>
364
+
361
             <select id="codec" name="codec" class="ft_codec">
365
             <select id="codec" name="codec" class="ft_codec">
362
               <option value="">License</option>
366
               <option value="">License</option>
363
-<?  foreach ($Codecs as $CodecName) { ?>
364
-              <option value="<?=display_str($CodecName); ?>"<?Format::selected('codec', $CodecName)?>><?=display_str($CodecName); ?></option>
365
-<?  } ?>
367
+              <?php foreach ($Codecs as $CodecName) { ?>
368
+              <option value="<?= display_str($CodecName); ?>"<?php Format::selected('codec', $CodecName) ?>><?= display_str($CodecName); ?>
369
+              </option>
370
+              <?php } ?>
366
             </select>
371
             </select>
372
+
367
             <select id="resolution" name="resolution" class="ft_resolution">
373
             <select id="resolution" name="resolution" class="ft_resolution">
368
               <option value="">Assembly Level</option>
374
               <option value="">Assembly Level</option>
369
-<?  foreach ($Resolutions as $ResolutionName) { ?>
370
-              <option value="<?=display_str($ResolutionName); ?>"<?Format::selected('resolution', $ResolutionName)?>><?=display_str($ResolutionName); ?></option>
371
-<?  } ?>
375
+              <?php foreach ($Resolutions as $ResolutionName) { ?>
376
+              <option value="<?= display_str($ResolutionName); ?>"<?php Format::selected('resolution', $ResolutionName) ?>><?= display_str($ResolutionName); ?>
377
+              </option>
378
+              <?php } ?>
372
             </select>
379
             </select>
380
+
373
             <select name="media" class="ft_media">
381
             <select name="media" class="ft_media">
374
               <option value="">Platform</option>
382
               <option value="">Platform</option>
375
-<?  foreach ($Media as $MediaName) { ?>
376
-              <option value="<?=display_str($MediaName); ?>"<?Format::selected('media',$MediaName)?>><?=display_str($MediaName); ?></option>
377
-<?  } ?>
378
-              <option value="Scan"<?Format::selected('media', 'Scan')?>>Scan</option>
383
+              <?php foreach ($Media as $MediaName) { ?>
384
+              <option value="<?= display_str($MediaName); ?>"<?php Format::selected('media', $MediaName) ?>><?= display_str($MediaName); ?>
385
+              </option>
386
+              <?php } ?>
379
             </select>
387
             </select>
380
           </td>
388
           </td>
381
         </tr>
389
         </tr>
390
+
391
+        <!-- Misc -->
382
         <tr>
392
         <tr>
383
-          <td class="label"><strong>Misc:</strong></td>
393
+          <td class="label"><strong>Misc</strong></td>
384
           <td class="nobr" colspan="3">
394
           <td class="nobr" colspan="3">
385
             <select name="censored" class="ft_censored">
395
             <select name="censored" class="ft_censored">
386
-              <option value="3">Aligned Sequence?</option>
396
+              <option value="3">Alignment</option>
387
               <option value="1"<?Format::selected('censored', 1)?>>Aligned</option>
397
               <option value="1"<?Format::selected('censored', 1)?>>Aligned</option>
388
               <option value="0"<?Format::selected('censored', 0)?>>Unaligned</option>
398
               <option value="0"<?Format::selected('censored', 0)?>>Unaligned</option>
389
             </select>
399
             </select>
390
           </td>
400
           </td>
391
         </tr>
401
         </tr>
402
+
403
+        <!-- Tags -->
392
         <tr>
404
         <tr>
393
-          <td class="label"><strong>Tags:</strong></td>
405
+          <td class="label"><strong>Tags</strong></td>
394
           <td>
406
           <td>
395
-            <input type="search" name="tags" size="60" class="tooltip" title="Use !tag to exclude tag" value="<?Format::form('tags')?>" />&nbsp;
396
-            <input type="radio" name="tags_type" id="tags_type0" value="0"<?Format::selected('tags_type', 0, 'checked')?> /><label for="tags_type0"> Any</label>&nbsp;&nbsp;
397
-            <input type="radio" name="tags_type" id="tags_type1" value="1"<?Format::selected('tags_type', 1, 'checked')?> /><label for="tags_type1"> All</label>
407
+            <input type="search" name="tags" size="60" value="<?php Format::form('tags') ?>" />&nbsp;
408
+            <input type="radio" name="tags_type" id="tags_type0" value="0"<?php Format::selected('tags_type', 0, 'checked') ?> /><label for="tags_type0"> Any</label>&nbsp;&nbsp;
409
+            <input type="radio" name="tags_type" id="tags_type1" value="1"<?php Format::selected('tags_type', 1, 'checked') ?> /><label for="tags_type1"> All</label><br />
410
+            Use !tag to exclude tags
398
           </td>
411
           </td>
399
         </tr>
412
         </tr>
400
 
413
 
414
+        <!-- Order By -->
401
         <tr>
415
         <tr>
402
-          <td class="label"><strong>Order by</strong></td>
416
+          <td class="label"><strong>Order By</strong></td>
403
           <td>
417
           <td>
404
             <select name="order" class="ft_order_by">
418
             <select name="order" class="ft_order_by">
405
-<?  foreach ($Orders as $OrderText) { ?>
406
-              <option value="<?=$OrderText?>"<?Format::selected('order', $OrderText)?>><?=$OrderText?></option>
407
-<?  } ?>
408
-            </select>&nbsp;
419
+              <?php foreach ($Orders as $OrderText) { ?>
420
+              <option value="<?= $OrderText ?>"<?php Format::selected('order', $OrderText) ?>><?= $OrderText ?>
421
+              </option>
422
+              <?php } ?>
423
+            </select>
424
+
409
             <select name="way" class="ft_order_way">
425
             <select name="way" class="ft_order_way">
410
-<?  foreach ($Ways as $WayKey=>$WayText) { ?>
411
-              <option value="<?=$WayKey?>"<?Format::selected('way', $WayKey)?>><?=$WayText?></option>
412
-<?  } ?>
426
+              <?php foreach ($Ways as $WayKey=>$WayText) { ?>
427
+              <option value="<?= $WayKey ?>"<?php Format::selected('way', $WayKey) ?>><?= $WayText ?>
428
+              </option>
429
+              <?php } ?>
413
             </select>
430
             </select>
414
           </td>
431
           </td>
415
         </tr>
432
         </tr>
416
       </table>
433
       </table>
417
 
434
 
435
+      <!-- Categories -->
418
       <table class="layout cat_list">
436
       <table class="layout cat_list">
419
-<?
437
+<?php
420
 $x = 0;
438
 $x = 0;
421
 reset($Categories);
439
 reset($Categories);
422
 foreach ($Categories as $CatKey => $CatName) {
440
 foreach ($Categories as $CatKey => $CatName) {
423
-  if ($x % 7 === 0) {
424
-    if ($x > 0) {
425
-?>
441
+    if ($x % 7 === 0) {
442
+        if ($x > 0) {
443
+            ?>
426
         </tr>
444
         </tr>
427
-<?    } ?>
445
+<?php
446
+        } ?>
428
         <tr>
447
         <tr>
429
-<?
430
-  }
431
-  $x++;
432
-?>
448
+<?php
449
+    }
450
+    $x++; ?>
433
           <td>
451
           <td>
434
-            <input type="checkbox" name="categories[<?=($CatKey+1)?>]" id="cat_<?=($CatKey+1)?>" value="1"<? if (isset($_GET['categories'][$CatKey + 1])) { ?> checked="checked"<? } ?> />
435
-            <label for="cat_<?=($CatKey + 1)?>"><?=$CatName?></label>
452
+            <input type="checkbox" name="categories[<?= ($CatKey+1) ?>]" id="cat_<?= ($CatKey+1) ?>" value="1"<?php if (isset($_GET['categories'][$CatKey + 1])) { ?> checked="checked"<?php } ?> />
453
+            <label for="cat_<?= ($CatKey + 1) ?>"><?= $CatName ?></label>
436
           </td>
454
           </td>
437
-<?
455
+<?php
438
 }
456
 }
439
 ?>
457
 ?>
440
         </tr>
458
         </tr>
441
       </table>
459
       </table>
460
+
461
+      <!-- Submit -->
442
       <div class="submit">
462
       <div class="submit">
443
-        <span class="float_left"><?=number_format($TorrentCount)?> Results</span>
444
-        <input type="submit" value="Search torrents" />
463
+        <span class="float_left"><?= number_format($TorrentCount) ?> Results</span>
464
+        <input type="submit" value="Search" />
445
       </div>
465
       </div>
446
     </form>
466
     </form>
447
   </div>
467
   </div>
448
-<?  if (count($GroupIDs) === 0) { ?>
468
+
469
+  <!-- Results table -->
470
+<?php if (count($GroupIDs) === 0) { ?>
449
   <div class="center">
471
   <div class="center">
450
     Nothing found!
472
     Nothing found!
451
   </div>
473
   </div>
452
-<?  } else { ?>
474
+<?php } else { ?>
453
   <div class="linkbox"><?=$Pages?></div>
475
   <div class="linkbox"><?=$Pages?></div>
454
   <div class="box">
476
   <div class="box">
455
   <table class="torrent_table cats" width="100%">
477
   <table class="torrent_table cats" width="100%">
456
     <tr class="colhead">
478
     <tr class="colhead">
457
       <td class="cats_col"></td>
479
       <td class="cats_col"></td>
458
-      <td><a href="<?=header_link('Name', 'ASC')?>">Torrent</a></td>
459
-      <td><a href="<?=header_link('Time')?>">Time</a></td>
460
-      <td><a href="<?=header_link('Size')?>">Size</a></td>
480
+      <td><a href="<?= header_link('Name', 'ASC') ?>">Torrent</a></td>
481
+      <td><a href="<?= header_link('Time') ?>">Time</a></td>
482
+      <td><a href="<?= header_link('Size') ?>">Size</a></td>
461
       <td class="sign snatches">
483
       <td class="sign snatches">
462
-        <a href="<?=header_link('Snatched')?>">
484
+        <a href="<?= header_link('Snatched') ?>">
463
           <svg width="15" height="15" fill="white" 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>
485
           <svg width="15" height="15" fill="white" 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>
464
         </a>
486
         </a>
465
       </td>
487
       </td>
466
       <td class="sign seeders">
488
       <td class="sign seeders">
467
-        <a href="<?=header_link('Seeders')?>">
489
+        <a href="<?= header_link('Seeders') ?>">
468
           <svg width="11" height="15" fill="white" 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>
490
           <svg width="11" height="15" fill="white" 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>
469
         </a>
491
         </a>
470
       </td>
492
       </td>
471
       <td class="sign leechers">
493
       <td class="sign leechers">
472
-        <a href="<?=header_link('Leechers')?>">
494
+        <a href="<?= header_link('Leechers') ?>">
473
           <svg width="11" height="15" fill="white" 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>
495
           <svg width="11" height="15" fill="white" 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>
474
         </a>
496
         </a>
475
       </td>
497
       </td>
476
     </tr>
498
     </tr>
477
-<?
499
+
500
+    <!-- Results list -->
501
+<?php
478
   $PageSize = 0;
502
   $PageSize = 0;
479
   foreach ($TorrentsInfo as $TorrentID => $Info) {
503
   foreach ($TorrentsInfo as $TorrentID => $Info) {
480
-    list($GroupID, , $Time) = array_values($Info);
504
+      list($GroupID, , $Time) = array_values($Info);
481
 
505
 
482
-    extract(Torrents::array_group($Results[$GroupID]));
483
-    $Torrent = $Torrents[$TorrentID];
506
+      extract(Torrents::array_group($Results[$GroupID]));
507
+      $Torrent = $Torrents[$TorrentID];
484
 
508
 
509
+      $TorrentTags = new Tags($TagList);
485
 
510
 
486
-    $TorrentTags = new Tags($TagList);
511
+      $DisplayName = Artists::display_artists($Artists);
512
+      $DisplayName .= '<a href="torrents.php?id='.$GroupID.'&amp;torrentid='.$TorrentID.'" ';
513
+      if (!isset($LoggedUser['CoverArt']) || $LoggedUser['CoverArt']) {
514
+          $DisplayName .= 'data-cover="'.ImageTools::process($WikiImage, 'thumb').'" ';
515
+      }
516
+      $GroupName = empty($GroupName) ? (empty($GroupNameRJ) ? $GroupNameJP : $GroupNameRJ) : $GroupName;
517
+      $DisplayName .= 'dir="ltr">'.$GroupName.'</a>';
518
+      if ($GroupYear) {
519
+          $DisplayName .= " [$GroupYear]";
520
+      }
521
+      if ($GroupStudio) {
522
+          $DisplayName .= " [$GroupStudio]";
523
+      }
524
+      if ($GroupCatalogueNumber) {
525
+          $DisplayName .= " [$GroupCatalogueNumber]";
526
+      }
527
+      if ($GroupDLSiteID) {
528
+          $DisplayName .= " [$GroupDLSiteID]";
529
+      }
530
+      $ExtraInfo = Torrents::torrent_info($Torrent);
531
+      if ($ExtraInfo) {
532
+          $DisplayName .= " - $ExtraInfo";
533
+      } ?>
487
 
534
 
488
-    $DisplayName = Artists::display_artists($Artists);
489
-    $DisplayName .= '<a href="torrents.php?id='.$GroupID.'&amp;torrentid='.$TorrentID.'" ';
490
-    if (!isset($LoggedUser['CoverArt']) || $LoggedUser['CoverArt']) {
491
-      $DisplayName .= 'data-cover="'.ImageTools::process($WikiImage, 'thumb').'" ';
492
-    }
493
-    $GroupName = empty($GroupName) ? (empty($GroupNameRJ) ? $GroupNameJP : $GroupNameRJ) : $GroupName;
494
-    $DisplayName .= 'dir="ltr">'.$GroupName.'</a>';
495
-    if ($GroupYear) {
496
-      $DisplayName .= " [$GroupYear]";
497
-    }
498
-    if ($GroupStudio) {
499
-      $DisplayName .= " [$GroupStudio]";
500
-    }
501
-    if ($GroupCatalogueNumber) {
502
-      $DisplayName .= " [$GroupCatalogueNumber]";
503
-    }
504
-    if ($GroupDLSiteID) {
505
-      $DisplayName .= " [$GroupDLSiteID]";
506
-    }
507
-    $ExtraInfo = Torrents::torrent_info($Torrent);
508
-    if ($ExtraInfo) {
509
-      $DisplayName .= " - $ExtraInfo";
510
-    }
511
-?>
512
-    <tr class="torrent torrent_row<?=($Torrent['IsSnatched'] ? ' snatched_torrent' : '') . ($GroupFlags['IsSnatched'] ? ' snatched_group' : '')?>">
535
+    <tr class="torrent torrent_row<?= ($Torrent['IsSnatched'] ? ' snatched_torrent' : '') . ($GroupFlags['IsSnatched'] ? ' snatched_group' : '') ?>">
513
       <td class="center cats_col">
536
       <td class="center cats_col">
514
-        <div title="<?=Format::pretty_category($GroupCategoryID)?>" class="tooltip <?=Format::css_category($GroupCategoryID)?>"></div>
537
+        <div title="<?= Format::pretty_category($GroupCategoryID) ?>" class="tooltip <?= Format::css_category($GroupCategoryID) ?>"></div>
515
       </td>
538
       </td>
516
       <td class="big_info">
539
       <td class="big_info">
517
         <div class="group_info clear">
540
         <div class="group_info clear">
518
           <span class="torrent_links_block">
541
           <span class="torrent_links_block">
519
-            [ <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>
520
-            | <a href="reportsv2.php?action=report&amp;id=<?=$TorrentID?>" class="tooltip" title="Report">RP</a> ]
542
+            [ <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>
543
+            | <a href="reportsv2.php?action=report&amp;id=<?= $TorrentID ?>" class="tooltip" title="Report">RP</a> ]
521
           </span>
544
           </span>
522
-          <? echo "$DisplayName\n"; ?>
523
-          <div class="tags"><?=$TorrentTags->format('torrents.php?type='.$Action.'&amp;userid='.$UserID.'&amp;tags=')?></div>
545
+          <?php echo "$DisplayName\n"; ?>
546
+          <div class="tags"><?= $TorrentTags->format('torrents.php?type='.$Action.'&amp;userid='.$UserID.'&amp;tags=') ?></div>
524
         </div>
547
         </div>
525
       </td>
548
       </td>
526
-      <td class="nobr"><?=time_diff($Time, 1)?></td>
527
-      <td class="number_column nobr"><?=Format::get_size($Torrent['Size'])?></td>
528
-      <td class="number_column"><?=number_format($Torrent['Snatched'])?></td>
529
-      <td class="number_column<?=(($Torrent['Seeders'] == 0) ? ' r00' : '')?>"><?=number_format($Torrent['Seeders'])?></td>
530
-      <td class="number_column"><?=number_format($Torrent['Leechers'])?></td>
549
+      <td class="nobr"><?= time_diff($Time, 1) ?></td>
550
+      <td class="number_column nobr"><?= Format::get_size($Torrent['Size']) ?></td>
551
+      <td class="number_column"><?= number_format($Torrent['Snatched']) ?></td>
552
+      <td class="number_column<?= (($Torrent['Seeders'] === 0) ? ' r00' : '') ?>"><?= number_format($Torrent['Seeders']) ?></td>
553
+      <td class="number_column"><?= number_format($Torrent['Leechers']) ?></td>
531
     </tr>
554
     </tr>
532
-<?    }?>
555
+<?php
556
+  } ?>
533
   </table>
557
   </table>
534
   </div>
558
   </div>
535
-<?  } ?>
536
-  <div class="linkbox"><?=$Pages?></div>
559
+<?php  } ?>
560
+  <div class="linkbox"><?= $Pages ?></div>
537
 </div>
561
 </div>
538
-<? View::show_footer(); ?>
562
+<?php View::show_footer(); ?>

Loading…
Cancel
Save