Browse Source

Remove site history stuff

biotorrents 4 years ago
parent
commit
dd0c25cf67

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

@@ -128,6 +128,7 @@ function db_string($String, $DisableWildcards = false)
128 128
     # Connect and mysqli_real_escape_string()
129 129
     # Previously called $DB->escape_str, now below
130 130
     # todo: Fix the bad escapes everywhere; see below
131
+
131 132
     #if (!is_string($String)) { # This is the correct way,
132 133
     if (is_array($String)) { # but this prevents errors
133 134
         error('Attempted to escape non-string.', $NoHTML = true);
@@ -163,7 +164,6 @@ function db_array($Array, $DontEscape = [], $Quote = false)
163 164
 }
164 165
 
165 166
 
166
-// todo: Revisit access levels once Drone is replaced by ZeRobot
167 167
 class DB_MYSQL
168 168
 {
169 169
     public $LinkID = false;
@@ -256,7 +256,7 @@ class DB_MYSQL
256 256
                 $this->LinkID,
257 257
                 $this->Key,
258 258
                 $this->Cert,
259
-                $this->Ca,
259
+                $this->CA,
260 260
                 null,
261 261
                 null
262 262
             );
@@ -453,7 +453,7 @@ class DB_MYSQL
453 453
     }
454 454
 
455 455
 
456
-    /*
456
+    /**
457 457
      * Returns an integer with the number of rows found
458 458
      * Returns a string if the number of rows found exceeds MAXINT
459 459
      */
@@ -465,7 +465,7 @@ class DB_MYSQL
465 465
     }
466 466
 
467 467
 
468
-    /*
468
+    /**
469 469
      * Returns true if the query exists and there were records found
470 470
      * Returns false if the query does not exist or if there were 0 records returned
471 471
      */

+ 3
- 0
classes/security.class.php View File

@@ -18,6 +18,9 @@ class Security
18 18
      */
19 19
     public function CheckID($ID)
20 20
     {
21
+        # Temporary failsafe
22
+        # (int) 'dingus' = 0
23
+        # (int) 3.14 = 3
21 24
         $ID = (int) $ID;
22 25
 
23 26
         if (!is_int($ID) || $ID < 1) {

+ 0
- 305
classes/sitehistory.class.php View File

@@ -1,305 +0,0 @@
1
-<?php
2
-#declare(strict_types=1);
3
-
4
-class SiteHistory
5
-{
6
-    private static $Categories = array(1 => "Code", "Event", "Milestone", "Policy", "Release", "Staff Change");
7
-    private static $SubCategories = array(1 => "Announcement", "Blog Post", "Forum Post", "Wiki", "Other", "External Source");
8
-    private static $Tags = array(
9
-        "api",
10
-        "celebration",
11
-        "class.primary",
12
-        "class.secondary",
13
-        "collage",
14
-        "community",
15
-        "conclusion",
16
-        "contest",
17
-        "design",
18
-        "donate",
19
-        "editing",
20
-        "editorial",
21
-        "feature",
22
-        "featured.article",
23
-        "featured.album",
24
-        "featured.product",
25
-        "finances",
26
-        "format",
27
-        "forum",
28
-        "freeleech",
29
-        "freeleech.tokens",
30
-        "gazelle",
31
-        "hierarchy",
32
-        "inbox",
33
-        "infrastructure",
34
-        "interview",
35
-        "irc",
36
-        "log",
37
-        "neutral.leech",
38
-        "notifications",
39
-        "ocelot",
40
-        "paranoia",
41
-        "picks.guest",
42
-        "picks.staff",
43
-        "promotion",
44
-        "ratio",
45
-        "record",
46
-        "report",
47
-        "request",
48
-        "requirement",
49
-        "retirement",
50
-        "rippy",
51
-        "search",
52
-        "settings",
53
-        "start",
54
-        "stats",
55
-        "store",
56
-        "stylesheet",
57
-        "tagging",
58
-        "transcode",
59
-        "toolbox",
60
-        "top.10",
61
-        "torrent",
62
-        "torrent.group",
63
-        "upload",
64
-        "vanity.house",
65
-        "voting",
66
-        "whitelist",
67
-        "wiki"
68
-    );
69
-
70
-    public static function get_months()
71
-    {
72
-        $Results = G::$Cache->get_value("site_history_months");
73
-        if (!$Results) {
74
-            $QueryID = G::$DB->get_query_id();
75
-            G::$DB->query("
76
-            SELECT DISTINCT
77
-              YEAR(DATE) AS Year, MONTH(Date) AS Month, MONTHNAME(Date) AS MonthName
78
-            FROM site_history
79
-              ORDER BY Date DESC");
80
-
81
-            $Results = G::$DB->to_array();
82
-            G::$DB->set_query_id($QueryID);
83
-            G::$Cache->cache_value("site_history_months", $Results, 0);
84
-        }
85
-        return $Results;
86
-    }
87
-
88
-    public static function get_event($ID)
89
-    {
90
-        if (!empty($ID)) {
91
-            $QueryID = G::$DB->get_query_id();
92
-            G::$DB->query("
93
-            SELECT
94
-              ID, Title, Url, Category, SubCategory, Tags, Body, AddedBy, Date
95
-            FROM site_history
96
-              WHERE ID = '$ID'
97
-              ORDER BY Date DESC");
98
-
99
-            $Event = G::$DB->next_record();
100
-            G::$DB->set_query_id($QueryID);
101
-            return $Event;
102
-        }
103
-    }
104
-
105
-    public static function get_latest_events($Limit)
106
-    {
107
-        self::get_events(null, null, null, null, null, null, $Limit);
108
-    }
109
-
110
-    public static function get_events($Month, $Year, $Title, $Category, $SubCategory, $Tags, $Limit)
111
-    {
112
-        $Month = (int)$Month;
113
-        $Year = (int)$Year;
114
-        $Title = db_string($Title);
115
-        $Category = (int)$Category;
116
-        $SubCategory = (int)$SubCategory;
117
-        $Tags = db_string($Tags);
118
-        $Limit = (int)$Limit;
119
-        $Where = [];
120
-
121
-        if (!empty($Month)) {
122
-            $Where[] = " MONTH(Date) = '$Month' ";
123
-        }
124
-
125
-        if (!empty($Year)) {
126
-            $Where[] = " YEAR(Date) = '$Year' ";
127
-        }
128
-
129
-        if (!empty($Title)) {
130
-            $Where[] = " Title LIKE '%$Title%' ";
131
-        }
132
-
133
-        if (!empty($Category)) {
134
-            $Where[] = " Category = '$Category '";
135
-        }
136
-
137
-        if (!empty($SubCategory)) {
138
-            $Where[] = " SubCategory = '$SubCategory '";
139
-        }
140
-
141
-        if (!empty($Tags)) {
142
-            $Tags = explode(',', $Tags);
143
-            $Or = '(';
144
-
145
-            foreach ($Tags as $Tag) {
146
-                $Tag = trim($Tag);
147
-                $Or .= " Tags LIKE '%$Tag%' OR ";
148
-            }
149
-
150
-            if (strlen($Or) > 1) {
151
-                $Or = rtrim($Or, 'OR ');
152
-                $Or .= ')';
153
-                $Where[] = $Or;
154
-            }
155
-        }
156
-
157
-        if (!empty($Limit)) {
158
-            $Limit = " LIMIT $Limit";
159
-        } else {
160
-            $Limit = '';
161
-        }
162
-
163
-        if (count($Where) > 0) {
164
-            $Query = ' WHERE ' . implode('AND', $Where);
165
-        } else {
166
-            $Query = '';
167
-        }
168
-
169
-        $QueryID = G::$DB->get_query_id();
170
-        G::$DB->query("
171
-        SELECT
172
-          ID, Title, Url, Category, SubCategory, Tags, Body, AddedBy, Date
173
-        FROM site_history
174
-          $Query
175
-          ORDER BY Date DESC
176
-          $Limit");
177
-
178
-        $Events = G::$DB->to_array();
179
-        G::$DB->set_query_id($QueryID);
180
-        return $Events;
181
-    }
182
-
183
-    public static function add_event($Date, $Title, $Link, $Category, $SubCategory, $Tags, $Body, $UserID)
184
-    {
185
-        if (empty($Date)) {
186
-            $Date = sqltime();
187
-        } else {
188
-            list($Y, $M, $D) = explode('-', $Date);
189
-            if (!checkdate($M, $D, $Y)) {
190
-                error("Error");
191
-            }
192
-        }
193
-
194
-        $Title = db_string($Title);
195
-        $Link = db_string($Link);
196
-        $Category = (int)$Category;
197
-        $SubCategory = (int)$SubCategory;
198
-        $Tags = db_string(strtolower((preg_replace('/\s+/', '', $Tags))));
199
-        $ExplodedTags = explode(',', $Tags);
200
-
201
-        foreach ($ExplodedTags as $Tag) {
202
-            if (!in_array($Tag, self::get_tags())) {
203
-                error("Invalid tag");
204
-            }
205
-        }
206
-
207
-        $Body = db_string($Body);
208
-        $UserID = (int)$UserID;
209
-
210
-        if (empty($Title) || empty($Category) || empty($SubCategory)) {
211
-            error("Error");
212
-        }
213
-
214
-        $QueryID = G::$DB->get_query_id();
215
-        G::$DB->query("
216
-        INSERT INTO site_history
217
-          (Title, Url, Category, SubCategory, Tags, Body, AddedBy, Date)
218
-        VALUES
219
-          ('$Title', '$Link', '$Category', '$SubCategory', '$Tags', '$Body', '$UserID', '$Date')");
220
-
221
-        G::$DB->set_query_id($QueryID);
222
-        G::$Cache->delete_value("site_history_months");
223
-    }
224
-
225
-    public static function update_event($ID, $Date, $Title, $Link, $Category, $SubCategory, $Tags, $Body, $UserID)
226
-    {
227
-        if (empty($Date)) {
228
-            $Date = sqltime();
229
-        } else {
230
-            $Date = db_string($Date);
231
-            list($Y, $M, $D) = explode('-', $Date);
232
-            if (!checkdate($M, $D, $Y)) {
233
-                error("Error");
234
-            }
235
-        }
236
-
237
-        $ID = (int)$ID;
238
-        $Title = db_string($Title);
239
-        $Link = db_string($Link);
240
-        $Category = (int)$Category;
241
-        $SubCategory = (int)$SubCategory;
242
-        $Tags = db_string(strtolower((preg_replace('/\s+/', '', $Tags))));
243
-        $ExplodedTags = explode(",", $Tags);
244
-
245
-        foreach ($ExplodedTags as $Tag) {
246
-            if (!in_array($Tag, self::get_tags())) {
247
-                error("Invalid tag");
248
-            }
249
-        }
250
-
251
-        $Body = db_string($Body);
252
-        $UserID = (int)$UserID;
253
-
254
-        if (empty($ID) || empty($Title) || empty($Category) || empty($SubCategory)) {
255
-            error("Error");
256
-        }
257
-
258
-        $QueryID = G::$DB->get_query_id();
259
-        G::$DB->query("
260
-        UPDATE site_history
261
-        SET
262
-          Title = '$Title',
263
-          Url = '$Link',
264
-          Category = '$Category',
265
-          SubCategory = '$SubCategory',
266
-          Tags = '$Tags',
267
-          Body = '$Body',
268
-          AddedBy = '$UserID',
269
-          Date = '$Date'
270
-        WHERE ID = '$ID'");
271
-
272
-        G::$DB->set_query_id($QueryID);
273
-        G::$Cache->delete_value("site_history_months");
274
-    }
275
-
276
-    public static function delete_event($ID)
277
-    {
278
-        if (!is_numeric($ID)) {
279
-            error(404);
280
-        }
281
-
282
-        $QueryID = G::$DB->get_query_id();
283
-        G::$DB->query("
284
-        DELETE FROM site_history
285
-          WHERE ID = '$ID'");
286
-          
287
-        G::$DB->set_query_id($QueryID);
288
-        G::$Cache->delete_value("site_history_months");
289
-    }
290
-
291
-    public static function get_categories()
292
-    {
293
-        return self::$Categories;
294
-    }
295
-
296
-    public static function get_sub_categories()
297
-    {
298
-        return self::$SubCategories;
299
-    }
300
-
301
-    public static function get_tags()
302
-    {
303
-        return self::$Tags;
304
-    }
305
-}

+ 0
- 237
classes/sitehistoryview.class.php View File

@@ -1,237 +0,0 @@
1
-<?php
2
-#declare(strict_types=1);
3
-
4
-class SiteHistoryView
5
-{
6
-    public static function render_linkbox()
7
-    {
8
-        if (check_perms('users_mod')
9
-      ) {
10
-            ?>
11
-<div class="linkbox">
12
-  <a href="sitehistory.php?action=edit" class="brackets">Create new event</a>
13
-</div>
14
-<?php
15
-        }
16
-    }
17
-
18
-    public static function render_events($Events)
19
-    {
20
-        $Categories = SiteHistory::get_categories();
21
-        $SubCategories = SiteHistory::get_sub_categories();
22
-        $CanEdit = check_perms('users_mod') ;
23
-        foreach ($Events as $Event) {
24
-            ?>
25
-<div class="box">
26
-  <div class="head colhead_dark">
27
-    <div class="title">
28
-      <?php if ($CanEdit) { ?>
29
-      <a class="brackets"
30
-        href="sitehistory.php?action=edit&amp;id=<?=$Event['ID']?>">Edit</a>
31
-      <?php } ?>
32
-
33
-      <?=date('F d, Y', strtotime($Event['Date'])); ?>
34
-      -
35
-      <a href="sitehistory.php?action=search&amp;category=<?=$Event['Category']?>"
36
-        class="brackets"><?=$Categories[$Event['Category']]?></a>
37
-      <a href="sitehistory.php?action=search&amp;subcategory=<?=$Event['SubCategory']?>"
38
-        class="brackets"><?=$SubCategories[$Event['SubCategory']]?></a>
39
-
40
-      <?php if (!empty($Event['Url'])) { ?>
41
-      <a href="<?=$Event['Url']?>"><?=$Event['Title']?></a>
42
-      <?php } else { ?>
43
-      <?=$Event['Title']?>
44
-      <?php } ?>
45
-    </div>
46
-    <div class="tags">
47
-      <?php self::render_tags($Event['Tags'])?>
48
-    </div>
49
-  </div>
50
-  <?php if (!empty($Event['Body'])) { ?>
51
-  <div class="body">
52
-    <?=Text::full_format($Event['Body'])?>
53
-  </div>
54
-  <?php } ?>
55
-</div>
56
-<?php
57
-        }
58
-    }
59
-
60
-    private static function render_tags($Tags)
61
-    {
62
-        $Tags = explode(',', $Tags);
63
-        natcasesort($Tags);
64
-        $FormattedTags = '';
65
-        foreach ($Tags as $Tag) {
66
-            $FormattedTags .= "<a href=\"sitehistory.php?action=search&amp;tags=$Tag\">$Tag" . "</a>, ";
67
-        }
68
-        echo rtrim($FormattedTags, ', ');
69
-    }
70
-
71
-    public static function render_search() { ?>
72
-<div class="box">
73
-  <div class="head">Search</div>
74
-  <div class="pad">
75
-    <form class="search_form" action="sitehistory.php" method="get">
76
-      <input type="hidden" name="action" value="search" />
77
-      <input type="text" id="title" name="title" size="20" placeholder="Title" />
78
-      <br /><br />
79
-      <input type="text" id="tags" name="tags" size="20" placeholder="Comma-separated tags" />
80
-      <br /><br />
81
-      <select name="category" id="category">
82
-        <option value="0">Choose a category</option>
83
-        <?php
84
-      $Categories = SiteHistory::get_categories();
85
-      foreach ($Categories as $Key => $Value) {
86
-          ?>
87
-        <option<?=$Key == $Event['Category'] ? ' selected="selected"' : ''?>
88
-          value="<?=$Key?>"><?=$Value?>
89
-          </option>
90
-          <?php
91
-      } ?>
92
-      </select>
93
-      <br /><br />
94
-      <select name="subcategory">
95
-        <option value="0">Choose a subcategory</option>
96
-        <?php
97
-      $SubCategories = SiteHistory::get_sub_categories();
98
-      foreach ($SubCategories as $Key => $Value) {
99
-          ?>
100
-        <option<?=$Key == $Event['SubCategory'] ? ' selected="selected"' : ''?>
101
-          value="<?=$Key?>"><?=$Value?>
102
-          </option>
103
-          <?php
104
-      } ?>
105
-      </select>
106
-      <br /><br />
107
-      <input value="Search" type="submit" />
108
-    </form>
109
-  </div>
110
-</div>
111
-<?php }
112
-
113
-    public static function render_edit_form($Event) { ?>
114
-<form id="event_form" method="post" action="">
115
-  <?php if ($Event) { ?>
116
-  <input type="hidden" name="action" value="take_edit" />
117
-  <input type="hidden" name="id"
118
-    value="<?=$Event['ID']?>" />
119
-  <?php } else { ?>
120
-  <input type="hidden" name="action" value="take_create" />
121
-  <?php } ?>
122
-  <input type="hidden" name="auth"
123
-    value="<?=G::$LoggedUser['AuthKey']?>" />
124
-  <table cellpadding="6" cellspacing="1" border="0" class="layout border" width="100%">
125
-    <tr>
126
-      <td class="label">Title:</td>
127
-      <td>
128
-        <input type="text" id="title" name="title" size="50" class="required"
129
-          value="<?=$Event['Title']?>" />
130
-      </td>
131
-    </tr>
132
-    <tr>
133
-      <td class="label">Link:</td>
134
-      <td>
135
-        <input type="text" id="url" name="url" size="50"
136
-          value="<?=$Event['Url']?>" />
137
-      </td>
138
-    </tr>
139
-    <tr>
140
-      <td class="label">Date:</td>
141
-      <td>
142
-        <input type="date" id="date" name="date" class="required" <?=$Event ? ' value="' . date('Y-m-d', strtotime($Event['Date'])) . '"' : ''?>
143
-        />
144
-      </td>
145
-    </tr>
146
-    <tr>
147
-      <td class="label">Category:</td>
148
-      <td>
149
-        <select id="category" name="category" class="required">
150
-          <option value="0">Choose a category</option>
151
-          <?php
152
-    $Categories = SiteHistory::get_categories();
153
-    foreach ($Categories as $Key => $Value) {
154
-        ?>
155
-          <option<?=$Key == $Event['Category'] ? ' selected="selected"' : ''?>
156
-            value="<?=$Key?>"><?=$Value?>
157
-            </option>
158
-            <?php
159
-    } ?>
160
-        </select>
161
-      </td>
162
-    </tr>
163
-    <tr>
164
-      <td class="label">Subcategory:</td>
165
-      <td>
166
-        <select id="category" name="sub_category" class="required">
167
-          <option value="0">Choose a subcategory</option>
168
-          <?php $SubCategories = SiteHistory::get_sub_categories();
169
-    foreach ($SubCategories as $Key => $Value) { ?>
170
-          <option<?=$Key == $Event['SubCategory'] ? ' selected="selected"' : ''?>
171
-            value="<?=$Key?>"><?=$Value?>
172
-            </option>
173
-            <?php } ?>
174
-        </select>
175
-      </td>
176
-    </tr>
177
-    <tr>
178
-      <td class="label">Tags:</td>
179
-      <td>
180
-        <input type="text" id="tags" name="tags" placeholder="Comma-separated tags; use periods/dots for spaces"
181
-          size="50"
182
-          value="<?=$Event['Tags']?>" />
183
-        <select id="tag_list">
184
-          <option>Choose tags</option>
185
-          <?php
186
-    $Tags = SiteHistory::get_tags();
187
-    foreach ($Tags as $Tag) {
188
-        ?>
189
-          <option><?=$Tag?>
190
-          </option>
191
-          <?php
192
-    } ?>
193
-        </select>
194
-      </td>
195
-    </tr>
196
-    <tr>
197
-      <td class="label">Body:</td>
198
-      <td>
199
-        <textarea id="body" name="body" cols="90" rows="8" tabindex="1"
200
-          onkeyup="resize('body');"><?=$Event['Body']?></textarea>
201
-      </td>
202
-    </tr>
203
-  </table>
204
-  <input type="submit" name="submit" value="Submit" />
205
-  <?php if ($Event) { ?>
206
-  <input type="submit" name="delete" value="Delete" />
207
-  <?php } ?>
208
-</form>
209
-<?php
210
-  }
211
-
212
-    public static function render_recent_sidebar($Events) { ?>
213
-<div class="box">
214
-  <div class="head colhead_dark">
215
-    <strong><a href="sitehistory.php">Latest site history</a></strong>
216
-  </div>
217
-  <ul class="stats nobullet">
218
-    <?php
219
-    $Categories = SiteHistory::get_categories();
220
-    foreach ($Events as $Event) {
221
-        ?>
222
-    <li>
223
-      <a href="sitehistory.php?action=search&amp;category=<?=$Event['Category']?>"
224
-        class="brackets"><?=$Categories[$Event['Category']]?></a>
225
-      <?php if (!empty($Event['Url'])) { ?>
226
-      <a href="<?=$Event['Url']?>"><?=Format::cut_string($Event['Title'], 20)?></a>
227
-      <?php } else { ?>
228
-      <?=Format::cut_string($Event['Title'], 20)?>
229
-      <?php } ?>
230
-    </li>
231
-    <?php
232
-    } ?>
233
-  </ul>
234
-</div>
235
-<?php
236
-  }
237
-}

+ 0
- 34
sections/sitehistory/edit.php View File

@@ -1,34 +0,0 @@
1
-<?php
2
-#declare(strict_types = 1);
3
-
4
-if (!check_perms('users_mod')) {
5
-    error(403);
6
-}
7
-if (is_number($_GET['id'])) {
8
-    $ID = $_GET['id'];
9
-    $Event = SiteHistory::get_event($ID);
10
-}
11
-
12
-if ($ID) {
13
-    $Title = "Edit";
14
-} else {
15
-    $Title = "Create";
16
-}
17
-View::show_header(
18
-    $Title,
19
-    "vendor/jquery.validate.min,form_validate,site_history"
20
-);
21
-
22
-?>
23
-
24
-<div class="header">
25
-  <?php if ($ID) { ?>
26
-  <h2>Edit event</h2>
27
-  <?php } else { ?>
28
-  <h2>Create new event</h2>
29
-  <?php } ?>
30
-</div>
31
-
32
-<?php
33
-SiteHistoryView::render_edit_form($Event);
34
-View::show_footer();

+ 0
- 51
sections/sitehistory/history.php View File

@@ -1,51 +0,0 @@
1
-<?php
2
-define('DEFAULT_LIMIT', 10);
3
-
4
-$Limit = DEFAULT_LIMIT;
5
-if (is_number($_GET['month'])) {
6
-    $Month = $_GET['month'];
7
-    $Limit = null;
8
-}
9
-if (is_number($_GET['year'])) {
10
-    $Year = $_GET['year'];
11
-    $Limit = null;
12
-}
13
-if (!empty($_GET['title'])) {
14
-    $Title = $_GET['title'];
15
-    $Limit = null;
16
-}
17
-if (!empty($_GET['category'])) {
18
-    $Category = $_GET['category'];
19
-    $Limit = null;
20
-}
21
-if (!empty($_GET['subcategory'])) {
22
-    $SubCategory = $_GET['subcategory'];
23
-    $Limit = null;
24
-}
25
-if (!empty($_GET['tags'])) {
26
-    $Tags = $_GET['tags'];
27
-    $Limit = null;
28
-}
29
-$Events = SiteHistory::get_events($Month, $Year, $Title, $Category, $SubCategory, $Tags, $Limit);
30
-$Months = SiteHistory::get_months();
31
-View::show_header("Site History");
32
-?>
33
-<div class="header">
34
-  <h2><a href="sitehistory.php">Site History</a> <?=$Month && $Year ? date("- F, Y", mktime(0, 0, 0, $Month, 1, $Year)) : '' ?>
35
-  </h2>
36
-  <?php
37
-  SiteHistoryView::render_linkbox();
38
-?>
39
-</div>
40
-<div class="sidebar">
41
-  <?php
42
-  SiteHistoryView::render_search();
43
-?>
44
-</div>
45
-<div class="main_column">
46
-  <?php
47
-  SiteHistoryView::render_events($Events);
48
-?>
49
-</div>
50
-<?php
51
-View::show_footer();

+ 0
- 33
sections/sitehistory/index.php View File

@@ -1,33 +0,0 @@
1
-<?
2
-enforce_login();
3
-
4
-if (!check_perms('users_mod')) {
5
-  error(403);
6
-}
7
-if (!empty($_POST['action'])) {
8
-  switch ($_POST['action']) {
9
-    case 'take_create':
10
-      include(SERVER_ROOT . '/sections/sitehistory/take_create.php');
11
-      break;
12
-    case 'take_edit':
13
-      include(SERVER_ROOT . '/sections/sitehistory/take_edit.php');
14
-      break;
15
-    default:
16
-      error(404);
17
-      break;
18
-  }
19
-} elseif (!empty($_GET['action'])) {
20
-  switch ($_GET['action']) {
21
-    case 'search':
22
-      include(SERVER_ROOT . '/sections/sitehistory/history.php');
23
-      break;
24
-    case 'edit':
25
-      include(SERVER_ROOT . '/sections/sitehistory/edit.php');
26
-      break;
27
-    default:
28
-      error(404);
29
-      break;
30
-  }
31
-} else {
32
-  include(SERVER_ROOT . '/sections/sitehistory/history.php');
33
-}

+ 0
- 9
sections/sitehistory/take_create.php View File

@@ -1,9 +0,0 @@
1
-<?
2
-authorize();
3
-if (!check_perms('users_mod') ) {
4
-  error(403);
5
-}
6
-
7
-SiteHistory::add_event($_POST['date'], $_POST['title'], $_POST['url'], $_POST['category'], $_POST['sub_category'], $_POST['tags'], $_POST['body'], $LoggedUser['ID']);
8
-
9
-header("Location: sitehistory.php");

+ 0
- 12
sections/sitehistory/take_edit.php View File

@@ -1,12 +0,0 @@
1
-<?
2
-authorize();
3
-if (!check_perms('users_mod') ) {
4
-  error(403);
5
-}
6
-
7
-if ($_POST['submit']) {
8
-  SiteHistory::update_event($_POST['id'], $_POST['date'], $_POST['title'], $_POST['url'], $_POST['category'], $_POST['sub_category'], $_POST['tags'], $_POST['body'], $LoggedUser['ID']);
9
-} elseif ($_POST['delete']) {
10
-  SiteHistory::delete_event($_POST['id']);
11
-}
12
-header("Location: sitehistory.php");

+ 7
- 4
sections/torrents/editgroup.php View File

@@ -8,10 +8,11 @@ declare(strict_types = 1);
8 8
  * and clears the cache for the torrent group page.
9 9
  */
10 10
 
11
-Security::CheckID($_GET['groupid']);
11
+$GroupID = $_GET['groupid'];
12
+Security::CheckID($GroupID);
12 13
 
13 14
 // Get the torrent group name and the body of the last revision
14
-$DB->query("
15
+$DB->prepare_query("
15 16
 SELECT
16 17
   tg.`Name`,
17 18
   tg.`Title2`,
@@ -31,15 +32,16 @@ LEFT JOIN `wiki_torrents` AS wt
31 32
 ON
32 33
   wt.`RevisionID` = tg.`RevisionID`
33 34
 WHERE
34
-  tg.`ID` = '".db_string($GroupID)."'
35
+  tg.`ID` = '$GroupID'
35 36
 ");
37
+$DB->exec_prepared_query();
36 38
 
37 39
 if (!$DB->has_results()) {
38 40
     error(404);
39 41
 }
40 42
 list($Name, $Title2, $NameJP, $Image, $Body, $WikiImage, $WikiBody, $Year, $Studio, $Series, $CatalogueNumber, $CategoryID) = $DB->next_record();
41 43
 
42
-$DB->query("
44
+$DB->prepare_query("
43 45
 SELECT
44 46
   `ID`,
45 47
   `UserID`,
@@ -50,6 +52,7 @@ FROM
50 52
 WHERE
51 53
   `TorrentID` = '$GroupID'
52 54
 ");
55
+$DB->exec_prepared_query();
53 56
 
54 57
 if ($DB->has_results()) {
55 58
     $Screenshots = [];

+ 0
- 4
sitehistory.php View File

@@ -1,4 +0,0 @@
1
-<?php
2
-declare(strict_types=1);
3
-
4
-require_once 'classes/script_start.php';

+ 0
- 1
static/functions/form_validate.js View File

@@ -6,6 +6,5 @@ $(document).ready(function() {
6 6
   if (path == "inbox" && (action == "viewconv" || action == "compose")) $("#messageform").validate();
7 7
   if (path == "user" && action == "notify") $("#filter_form").validate();
8 8
   if (path == "requests" && action == "new") $("#request_form").preventDoubleSubmission();
9
-  if (path == "sitehistory" && action == "edit") $("#event_form").validate();
10 9
   if (path == "tools" && action == "mass_pm") $("#messageform").validate();
11 10
 });

+ 0
- 18
static/functions/site_history.js View File

@@ -1,18 +0,0 @@
1
-$(document).ready(function() {
2
-  var trimmed = false;
3
-  var tags = $("#tags");
4
-  $("#tag_list").change(function() {
5
-    if (tags.val().length == 0) {
6
-      trimmed = false;
7
-    } else {
8
-      trimmed = true;
9
-    }
10
-    if ($(this).prop("selectedIndex")) {
11
-      tags.val(tags.val() + "," + $(this).val());
12
-      if (!trimmed) {
13
-        tags.val(tags.val().substr(1, tags.val().length));
14
-        trimmed = true;
15
-      }
16
-    }
17
-  });
18
-});

Loading…
Cancel
Save