3 Commits

Author SHA1 Message Date
  biotorrents e2e4695d72 Staff blog redux 4 years ago
  biotorrents ff836e7897 Remove testing and staff blog stuff 4 years ago
  biotorrents 6d60b0baef Start using internal API calls to fetch database info 4 years ago

+ 0
- 42
classes/notificationsmanager.class.php View File

24
     // Types. These names must correspond to column names in users_notifications_settings
24
     // Types. These names must correspond to column names in users_notifications_settings
25
     const NEWS = 'News';
25
     const NEWS = 'News';
26
     const BLOG = 'Blog';
26
     const BLOG = 'Blog';
27
-    const STAFFBLOG = 'StaffBlog';
28
     const STAFFPM = 'StaffPM';
27
     const STAFFPM = 'StaffPM';
29
     const INBOX = 'Inbox';
28
     const INBOX = 'Inbox';
30
     const QUOTES = 'Quotes';
29
     const QUOTES = 'Quotes';
85
                 $this->load_blog();
84
                 $this->load_blog();
86
             }
85
             }
87
 
86
 
88
-            // if (!isset($this->Skipped[self::STAFFBLOG])) {
89
-            //   $this->load_staff_blog();
90
-            // }
91
-
92
             if (!isset($this->Skipped[self::STAFFPM])) {
87
             if (!isset($this->Skipped[self::STAFFPM])) {
93
                 $this->load_staff_pms();
88
                 $this->load_staff_pms();
94
             }
89
             }
313
         }
308
         }
314
     }
309
     }
315
 
310
 
316
-    public function load_staff_blog()
317
-    {
318
-        if (check_perms('users_mod')) {
319
-            global $SBlogReadTime, $LatestSBlogTime;
320
-            if (!$SBlogReadTime && ($SBlogReadTime = G::$Cache->get_value('staff_blog_read_' . G::$LoggedUser['ID'])) === false) {
321
-                $QueryID = G::$DB->get_query_id();
322
-                G::$DB->query("
323
-                SELECT Time
324
-                FROM staff_blog_visits
325
-                  WHERE UserID = " . G::$LoggedUser['ID']);
326
-                if (list($SBlogReadTime) = G::$DB->next_record()) {
327
-                    $SBlogReadTime = strtotime($SBlogReadTime);
328
-                } else {
329
-                    $SBlogReadTime = 0;
330
-                }
331
-                G::$DB->set_query_id($QueryID);
332
-                G::$Cache->cache_value('staff_blog_read_' . G::$LoggedUser['ID'], $SBlogReadTime, 1209600);
333
-            }
334
-            if (!$LatestSBlogTime && ($LatestSBlogTime = G::$Cache->get_value('staff_blog_latest_time')) === false) {
335
-                $QueryID = G::$DB->get_query_id();
336
-                G::$DB->query('
337
-                SELECT MAX(Time)
338
-                FROM staff_blog');
339
-                if (list($LatestSBlogTime) = G::$DB->next_record()) {
340
-                    $LatestSBlogTime = strtotime($LatestSBlogTime);
341
-                } else {
342
-                    $LatestSBlogTime = 0;
343
-                }
344
-                G::$DB->set_query_id($QueryID);
345
-                G::$Cache->cache_value('staff_blog_latest_time', $LatestSBlogTime, 1209600);
346
-            }
347
-            if ($SBlogReadTime < $LatestSBlogTime) {
348
-                $this->create_notification(self::STAFFBLOG, 0, 'New Staff Blog Post!', 'staffblog.php', self::IMPORTANT);
349
-            }
350
-        }
351
-    }
352
-
353
     public function load_staff_pms()
311
     public function load_staff_pms()
354
     {
312
     {
355
         $NewStaffPMs = G::$Cache->get_value('staff_pm_new_' . G::$LoggedUser['ID']);
313
         $NewStaffPMs = G::$Cache->get_value('staff_pm_new_' . G::$LoggedUser['ID']);

+ 0
- 170
classes/testing.class.php View File

1
-<?php
2
-#declare(strict_types=1);
3
-
4
-class Testing
5
-{
6
-    private static $ClassDirectories = array("classes");
7
-    private static $Classes = [];
8
-
9
-    /**
10
-     * Initialize the testasble classes into a map keyed by class name
11
-     */
12
-    public static function init()
13
-    {
14
-        self::load_classes();
15
-    }
16
-
17
-    /**
18
-     * Gets the class
19
-     */
20
-    public static function get_classes()
21
-    {
22
-        return self::$Classes;
23
-    }
24
-
25
-    /**
26
-     * Loads all the classes within given directories
27
-     */
28
-    private static function load_classes()
29
-    {
30
-        foreach (self::$ClassDirectories as $Directory) {
31
-            $Directory = SERVER_ROOT . "/" . $Directory . "/";
32
-            foreach (glob($Directory . "*.php") as $FileName) {
33
-                self::get_class_name($FileName);
34
-            }
35
-        }
36
-    }
37
-
38
-    /**
39
-     * Gets the class and adds into the map
40
-     */
41
-    private static function get_class_name($FileName)
42
-    {
43
-        $Tokens = token_get_all(file_get_contents($FileName));
44
-        $IsTestable = false;
45
-        $IsClass = false;
46
-
47
-        foreach ($Tokens as $Token) {
48
-            if (is_array($Token)) {
49
-                if (!$IsTestable && $Token[0] == T_DOC_COMMENT && strpos($Token[1], "@TestClass")) {
50
-                    $IsTestable = true;
51
-                }
52
-
53
-                if ($IsTestable && $Token[0] == T_CLASS) {
54
-                    $IsClass = true;
55
-                } elseif ($IsClass && $Token[0] == T_STRING) {
56
-                    $ReflectionClass = new ReflectionClass($Token[1]);
57
-
58
-                    if (count(self::get_testable_methods($ReflectionClass))) {
59
-                        self::$Classes[$Token[1]] = new ReflectionClass($Token[1]);
60
-                    }
61
-
62
-                    $IsTestable = false;
63
-                    $IsClass = false;
64
-                }
65
-            }
66
-        }
67
-    }
68
-
69
-    /**
70
-     * Checks if class exists in the map
71
-     */
72
-    public static function has_class($Class)
73
-    {
74
-        return array_key_exists($Class, self::$Classes);
75
-    }
76
-
77
-    /**
78
-     * Checks if class has a given testable methood
79
-     */
80
-    public static function has_testable_method($Class, $Method)
81
-    {
82
-        $TestableMethods = self::get_testable_methods($Class);
83
-        foreach ($TestableMethods as $TestMethod) {
84
-            if ($TestMethod->getName() === $Method) {
85
-                return true;
86
-            }
87
-        }
88
-        return false;
89
-    }
90
-
91
-    /**
92
-     * Get testable methods in a class, a testable method has a @Test
93
-     */
94
-    public static function get_testable_methods($Class)
95
-    {
96
-        if (is_string($Class)) {
97
-            $ReflectionClass = self::$Classes[$Class];
98
-        } else {
99
-            $ReflectionClass = $Class;
100
-        }
101
-
102
-        $ReflectionMethods = $ReflectionClass->getMethods();
103
-        $TestableMethods = [];
104
-
105
-        foreach ($ReflectionMethods as $Method) {
106
-            if ($Method->isPublic() && $Method->isStatic() && strpos($Method->getDocComment(), "@Test")) {
107
-                $TestableMethods[] = $Method;
108
-            }
109
-        }
110
-        return $TestableMethods;
111
-    }
112
-
113
-
114
-    /**
115
-     * Get the class comment
116
-     */
117
-    public static function get_class_comment($Class)
118
-    {
119
-        $ReflectionClass = self::$Classes[$Class];
120
-        return trim(str_replace(array("@TestClass", "*", "/"), "", $ReflectionClass->getDocComment()));
121
-    }
122
-
123
-    /**
124
-     * Get the undocumented methods in a class
125
-     */
126
-    public static function get_undocumented_methods($Class)
127
-    {
128
-        $ReflectionClass = self::$Classes[$Class];
129
-        $Methods = [];
130
-
131
-        foreach ($ReflectionClass->getMethods() as $Method) {
132
-            if (!$Method->getDocComment()) {
133
-                $Methods[] = $Method;
134
-            }
135
-        }
136
-        return $Methods;
137
-    }
138
-
139
-    /**
140
-     * Get the documented methods
141
-     */
142
-    public static function get_documented_methods($Class)
143
-    {
144
-        $ReflectionClass = self::$Classes[$Class];
145
-        $Methods = [];
146
-
147
-        foreach ($ReflectionClass->getMethods() as $Method) {
148
-            if ($Method->getDocComment()) {
149
-                $Methods[] = $Method;
150
-            }
151
-        }
152
-        return $Methods;
153
-    }
154
-
155
-    /**
156
-     * Get all methods in a class
157
-     */
158
-    public static function get_methods($Class)
159
-    {
160
-        return self::$Classes[$Class]->getMethods();
161
-    }
162
-
163
-    /**
164
-     * Get a method  comment
165
-     */
166
-    public static function get_method_comment($Method)
167
-    {
168
-        return trim(str_replace(array("*", "/"), "", $Method->getDocComment()));
169
-    }
170
-}

+ 0
- 183
classes/testingview.class.php View File

1
-<?php
2
-#declare(strict_types=1);
3
-
4
-class TestingView
5
-{
6
-    /**
7
-     * Render the linkbox
8
-     */
9
-    public static function render_linkbox($Page) { ?>
10
-<div class="linkbox">
11
-  <?php if ($Page != "classes") { ?>
12
-  <a href="testing.php" class="brackets">Classes</a>
13
-  <?php }
14
-      if ($Page != "comments") { ?>
15
-  <a href="testing.php?action=comments" class="brackets">Comments</a>
16
-  <?php } ?>
17
-</div>
18
-<?php }
19
-
20
-    /**
21
-     * Render a list of classes
22
-     */
23
-    public static function render_classes($Classes) { ?>
24
-<table>
25
-  <tr class="colhead">
26
-    <td>
27
-      Class
28
-    </td>
29
-    <td>
30
-      Testable functions
31
-    </td>
32
-  </tr>
33
-  <?php foreach ($Classes as $Key => $Value) {
34
-        $Doc = Testing::get_class_comment($Key);
35
-        $Methods = count(Testing::get_testable_methods($Key)); ?>
36
-  <tr>
37
-    <td>
38
-      <a href="testing.php?action=class&amp;name=<?=$Key?>"
39
-        class="tooltip" title="<?=$Doc?>"><?=$Key?></a>
40
-    </td>
41
-    <td>
42
-      <?=$Methods?>
43
-    </td>
44
-  </tr>
45
-  <?php
46
-    } ?>
47
-</table>
48
-<?php }
49
-
50
-    /**
51
-     * Render functions in a class
52
-     */
53
-    public static function render_functions($Methods)
54
-    {
55
-        foreach ($Methods as $Index => $Method) {
56
-            $ClassName = $Method->getDeclaringClass()->getName();
57
-            $MethodName = $Method->getName(); ?>
58
-<div class="box">
59
-  <div class="head">
60
-    <span><?=self::render_method_definition($Method)?></span>
61
-    <span class="float_right">
62
-      <a data-toggle-target="#method_params_<?=$Index?>"
63
-        class="brackets">Params</a>
64
-      <a href="#" class="brackets run" data-gazelle-id="<?=$Index?>"
65
-        data-gazelle-class="<?=$ClassName?>"
66
-        data-gazelle-method="<?=$MethodName?>">Run</a>
67
-    </span>
68
-  </div>
69
-  <div class="pad hidden" id="method_params_<?=$Index?>">
70
-    <?self::render_method_params($Method); ?>
71
-  </div>
72
-  <div class="pad hidden" id="method_results_<?=$Index?>">
73
-  </div>
74
-</div>
75
-<?php
76
-        }
77
-    }
78
-
79
-    /**
80
-     * Render method parameters
81
-     */
82
-    private static function render_method_params($Method) { ?>
83
-<table>
84
-  <?php foreach ($Method->getParameters() as $Parameter) {
85
-        $DefaultValue = $Parameter->isDefaultValueAvailable() ? $Parameter->getDefaultValue() : ""; ?>
86
-  <tr>
87
-    <td class="label">
88
-      <?=$Parameter->getName()?>
89
-    </td>
90
-    <td>
91
-      <input type="text" name="<?=$Parameter->getName()?>"
92
-        value="<?=$DefaultValue?>" />
93
-    </td>
94
-  </tr>
95
-  <?php
96
-    } ?>
97
-</table>
98
-<?php }
99
-
100
-    /**
101
-     * Render the method definition
102
-     */
103
-    private static function render_method_definition($Method)
104
-    {
105
-        $Title = "<span class='tooltip' title='" . Testing::get_method_comment($Method) . "'>" . $Method->getName() . "</span> (";
106
-        foreach ($Method->getParameters() as $Parameter) {
107
-            $Color = "red";
108
-            if ($Parameter->isDefaultValueAvailable()) {
109
-                $Color = "green";
110
-            }
111
-            $Title .= "<span style='color: $Color'>";
112
-            $Title .= "$" . $Parameter->getName();
113
-            if ($Parameter->isDefaultValueAvailable()) {
114
-                $Title .= " = " . $Parameter->getDefaultValue();
115
-            }
116
-            $Title .= "</span>";
117
-            $Title .= ", ";
118
-        }
119
-        $Title = rtrim($Title, ", ");
120
-        $Title .= ")";
121
-        return $Title;
122
-    }
123
-
124
-    /**
125
-     * Renders class documentation stats
126
-     */
127
-    public static function render_missing_documentation($Classes) { ?>
128
-<table>
129
-  <tr class="colhead">
130
-    <td>
131
-      Class
132
-    </td>
133
-    <td>
134
-      Class documented
135
-    </td>
136
-    <td>
137
-      Undocumented functions
138
-    </td>
139
-    <td>
140
-      Documented functions
141
-    </td>
142
-  </tr>
143
-  <?php foreach ($Classes as $Key => $Value) {
144
-        $ClassComment = Testing::get_class_comment($Key); ?>
145
-  <tr>
146
-    <td>
147
-      <?=$Key?>
148
-    </td>
149
-    <td>
150
-      <?=!empty($ClassComment) ? "Yes" : "No"?>
151
-    <td>
152
-      <?=count(Testing::get_undocumented_methods($Key))?>
153
-    </td>
154
-    <td>
155
-      <?=count(Testing::get_documented_methods($Key))?>
156
-    </td>
157
-  </tr>
158
-  <?php
159
-    } ?>
160
-</table>
161
-<?php }
162
-
163
-    /**
164
-     * Pretty print any data
165
-     */
166
-    public static function render_results($Data)
167
-    {
168
-        $Results = '<pre><ul style="list-style-type: none">';
169
-        if (is_array($Data)) {
170
-            foreach ($Data as $Key => $Value) {
171
-                if (is_array($Value)) {
172
-                    $Results .= '<li>' . $Key . ' => ' . self::render_results($Value) . '</li>';
173
-                } else {
174
-                    $Results .= '<li>' . $Key . ' => ' . $Value . '</li>';
175
-                }
176
-            }
177
-        } else {
178
-            $Results .= '<li>' . $Data . '</li>';
179
-        }
180
-        $Results .= '</ul></pre>';
181
-        echo $Results;
182
-    }
183
-}

+ 0
- 36
design/privateheader.php View File

471
 $Alerts = [];
471
 $Alerts = [];
472
 $ModBar = [];
472
 $ModBar = [];
473
 
473
 
474
-// Staff blog
475
-if (check_perms('users_mod')) {
476
-    global $SBlogReadTime, $LatestSBlogTime;
477
-    if (!$SBlogReadTime && ($SBlogReadTime = G::$Cache->get_value('staff_blog_read_'.G::$LoggedUser['ID'])) === false) {
478
-        G::$DB->query("
479
-          SELECT Time
480
-          FROM staff_blog_visits
481
-          WHERE UserID = ".G::$LoggedUser['ID']);
482
-
483
-        if (list($SBlogReadTime) = G::$DB->next_record()) {
484
-            $SBlogReadTime = strtotime($SBlogReadTime);
485
-        } else {
486
-            $SBlogReadTime = 0;
487
-        }
488
-        G::$Cache->cache_value('staff_blog_read_'.G::$LoggedUser['ID'], $SBlogReadTime, 1209600);
489
-    }
490
-
491
-    if (!$LatestSBlogTime && ($LatestSBlogTime = G::$Cache->get_value('staff_blog_latest_time')) === false) {
492
-        G::$DB->query("
493
-          SELECT MAX(Time)
494
-          FROM staff_blog");
495
-        list($LatestSBlogTime) = G::$DB->next_record();
496
-
497
-        if ($LatestSBlogTime) {
498
-            $LatestSBlogTime = strtotime($LatestSBlogTime);
499
-        } else {
500
-            $LatestSBlogTime = 0;
501
-        }
502
-        G::$Cache->cache_value('staff_blog_latest_time', $LatestSBlogTime, 1209600);
503
-    }
504
-
505
-    if ($SBlogReadTime < $LatestSBlogTime) {
506
-        $Alerts[] = '<a href="staffblog.php">New staff blog post!</a>';
507
-    }
508
-}
509
-
510
 // Inbox
474
 // Inbox
511
 if ($NotificationsManager->is_traditional(NotificationsManager::INBOX)) {
475
 if ($NotificationsManager->is_traditional(NotificationsManager::INBOX)) {
512
     $NotificationsManager->load_inbox();
476
     $NotificationsManager->load_inbox();

+ 0
- 31
gazelle.sql View File

793
   KEY `ExpiryTime` (`ExpiryTime`)
793
   KEY `ExpiryTime` (`ExpiryTime`)
794
 ) ENGINE=InnoDB CHARSET=utf8mb4;
794
 ) ENGINE=InnoDB CHARSET=utf8mb4;
795
 
795
 
796
-CREATE TABLE `site_history` (
797
-  `ID` int NOT NULL AUTO_INCREMENT,
798
-  `Title` varchar(255) DEFAULT NULL,
799
-  `Url` varchar(255) NOT NULL DEFAULT '',
800
-  `Category` tinyint DEFAULT NULL,
801
-  `SubCategory` tinyint DEFAULT NULL,
802
-  `Tags` mediumtext,
803
-  `AddedBy` int DEFAULT NULL,
804
-  `Date` datetime DEFAULT NULL,
805
-  `Body` mediumtext,
806
-  PRIMARY KEY (`ID`)
807
-) ENGINE=InnoDB CHARSET=utf8mb4;
808
-
809
 -- 2020-03-09
796
 -- 2020-03-09
810
 CREATE TABLE `slaves` (
797
 CREATE TABLE `slaves` (
811
   `UserID` int NOT NULL DEFAULT '0',
798
   `UserID` int NOT NULL DEFAULT '0',
961
   PRIMARY KEY (`id`)
947
   PRIMARY KEY (`id`)
962
 ) ENGINE=InnoDB CHARSET=utf8mb4;
948
 ) ENGINE=InnoDB CHARSET=utf8mb4;
963
 
949
 
964
-CREATE TABLE `staff_blog` (
965
-  `ID` int unsigned NOT NULL AUTO_INCREMENT,
966
-  `UserID` int unsigned NOT NULL,
967
-  `Title` varchar(255) NOT NULL,
968
-  `Body` text,
969
-  `Time` datetime,
970
-  PRIMARY KEY (`ID`),
971
-  KEY `UserID` (`UserID`),
972
-  KEY `Time` (`Time`)
973
-) ENGINE=InnoDB CHARSET=utf8mb4;
974
-
975
-CREATE TABLE `staff_blog_visits` (
976
-  `UserID` int unsigned NOT NULL,
977
-  `Time` datetime,
978
-  UNIQUE KEY `UserID` (`UserID`),
979
-  CONSTRAINT `staff_blog_visits_ibfk_1` FOREIGN KEY (`UserID`) REFERENCES `users_main` (`ID`) ON DELETE CASCADE
980
-) ENGINE=InnoDB CHARSET=utf8mb4;
981
-
982
 -- 2020-03-09
950
 -- 2020-03-09
983
 CREATE TABLE `staff_pm_conversations` (
951
 CREATE TABLE `staff_pm_conversations` (
984
   `ID` int NOT NULL AUTO_INCREMENT,
952
   `ID` int NOT NULL AUTO_INCREMENT,

+ 182
- 224
sections/index/private.php View File

35
 }
35
 }
36
 
36
 
37
 View::show_header('News', 'news_ajax');
37
 View::show_header('News', 'news_ajax');
38
-#View::show_header('News', 'bbcode,news_ajax');
39
 ?>
38
 ?>
40
-<div>
41
-  <div class="sidebar">
42
-    <?php #include 'connect.php';?>
43
 
39
 
40
+<div class="sidebar">
41
+  <?php #include 'connect.php';?>
42
+
43
+  <ul class="stats nobullet">
44
     <?php
44
     <?php
45
-    # Staff blog
46
-if (check_perms('users_mod')) { ?>
47
-    <div class="box">
48
-      <div class="head colhead_dark">
49
-        <strong><a href="staffblog.php">Latest staff blog posts</a></strong>
50
-      </div>
51
-      <?php
52
-if (($Blog = $Cache->get_value('staff_blog')) === false) {
53
-    $DB->query("
54
-    SELECT
55
-      b.ID,
56
-      um.Username,
57
-      b.Title,
58
-      b.Body,
59
-      b.Time
60
-    FROM staff_blog AS b
61
-      LEFT JOIN users_main AS um ON b.UserID = um.ID
62
-    ORDER BY Time DESC");
63
-    $Blog = $DB->to_array(false, MYSQLI_NUM);
64
-    $Cache->cache_value('staff_blog', $Blog, 1209600);
65
-}
66
-    if (($SBlogReadTime = $Cache->get_value('staff_blog_read_'.$LoggedUser['ID'])) === false) {
67
-        $DB->query("
68
-    SELECT Time
69
-    FROM staff_blog_visits
70
-    WHERE UserID = ".$LoggedUser['ID']);
71
-        if (list($SBlogReadTime) = $DB->next_record()) {
72
-            $SBlogReadTime = strtotime($SBlogReadTime);
73
-        } else {
74
-            $SBlogReadTime = 0;
75
-        }
76
-        $Cache->cache_value('staff_blog_read_'.$LoggedUser['ID'], $SBlogReadTime, 1209600);
77
-    } ?>
78
-      <ul class="stats nobullet">
79
-        <?php
80
 $End = min(count($Blog), 5);
45
 $End = min(count($Blog), 5);
81
     for ($i = 0; $i < $End; $i++) {
46
     for ($i = 0; $i < $End; $i++) {
82
         list($BlogID, $Author, $Title, $Body, $BlogTime) = $Blog[$i];
47
         list($BlogID, $Author, $Title, $Body, $BlogTime) = $Blog[$i];
83
         $BlogTime = strtotime($BlogTime); ?>
48
         $BlogTime = strtotime($BlogTime); ?>
84
-        <li>
85
-          <?=$SBlogReadTime < $BlogTime ? '<strong>' : ''?><?=($i + 1)?>.
86
-          <a href="staffblog.php#blog<?=$BlogID?>"><?=$Title?></a>
87
-          <?=$SBlogReadTime < $BlogTime ? '</strong>' : ''?>
88
-        </li>
89
-        <?php
49
+    <?php
90
     } ?>
50
     } ?>
91
-      </ul>
92
-    </div>
51
+  </ul>
52
+
53
+  <div class="box">
54
+    <div class="head colhead_dark"><strong><a href="blog.php">Latest blog posts</a></strong></div>
93
     <?php
55
     <?php
94
-} ?>
95
-    <div class="box">
96
-      <div class="head colhead_dark"><strong><a href="blog.php">Latest blog posts</a></strong></div>
97
-      <?php
98
 if (($Blog = $Cache->get_value('blog')) === false) {
56
 if (($Blog = $Cache->get_value('blog')) === false) {
99
         $DB->query("
57
         $DB->query("
100
     SELECT
58
     SELECT
113
         $Cache->cache_value('blog', $Blog, 1209600);
71
         $Cache->cache_value('blog', $Blog, 1209600);
114
     }
72
     }
115
 ?>
73
 ?>
116
-      <ul class="stats nobullet">
117
-        <?php
74
+    <ul class="stats nobullet">
75
+      <?php
118
 if (count($Blog) < 5) {
76
 if (count($Blog) < 5) {
119
     $Limit = count($Blog);
77
     $Limit = count($Blog);
120
 } else {
78
 } else {
122
 }
80
 }
123
 for ($i = 0; $i < $Limit; $i++) {
81
 for ($i = 0; $i < $Limit; $i++) {
124
     list($BlogID, $Author, $AuthorID, $Title, $Body, $BlogTime, $ThreadID) = $Blog[$i]; ?>
82
     list($BlogID, $Author, $AuthorID, $Title, $Body, $BlogTime, $ThreadID) = $Blog[$i]; ?>
125
-        <li>
126
-          <?=($i + 1)?>. <a
127
-            href="blog.php#blog<?=$BlogID?>"><?=$Title?></a>
128
-        </li>
129
-        <?php
83
+      <li>
84
+        <?=($i + 1)?>. <a
85
+          href="blog.php#blog<?=$BlogID?>"><?=$Title?></a>
86
+      </li>
87
+      <?php
130
 }
88
 }
131
 ?>
89
 ?>
132
-      </ul>
133
-    </div>
134
-    <?php
90
+    </ul>
91
+  </div>
92
+  <?php
135
 if (($Freeleeches = $Cache->get_value('shop_freeleech_list')) === false) {
93
 if (($Freeleeches = $Cache->get_value('shop_freeleech_list')) === false) {
136
     $DB->query("
94
     $DB->query("
137
     SELECT
95
     SELECT
149
 }
107
 }
150
 if (count($Freeleeches)) {
108
 if (count($Freeleeches)) {
151
     ?>
109
     ?>
152
-    <div class="box">
153
-      <div class="head colhead_dark"><strong><a
154
-            href="torrents.php?freetorrent=1&order_by=seeders&order_way=asc">Freeleeches</a></strong></div>
155
-      <ul class="stats nobullet">
156
-        <?php
110
+  <div class="box">
111
+    <div class="head colhead_dark"><strong><a
112
+          href="torrents.php?freetorrent=1&order_by=seeders&order_way=asc">Freeleeches</a></strong></div>
113
+    <ul class="stats nobullet">
114
+      <?php
157
   for ($i = 0; $i < count($Freeleeches); $i++) {
115
   for ($i = 0; $i < count($Freeleeches); $i++) {
158
       list($ID, $ExpiryTime, $Name, $Image) = $Freeleeches[$i];
116
       list($ID, $ExpiryTime, $Name, $Image) = $Freeleeches[$i];
159
       if ($ExpiryTime < time()) {
117
       if ($ExpiryTime < time()) {
165
           $DisplayName .= ' data-cover="'.ImageTools::process($Image, 'thumb').'"';
123
           $DisplayName .= ' data-cover="'.ImageTools::process($Image, 'thumb').'"';
166
       }
124
       }
167
       $DisplayName .= '>'.$Name.'</a>'; ?>
125
       $DisplayName .= '>'.$Name.'</a>'; ?>
168
-        <li>
169
-          <strong class="fl_time"><?=$DisplayTime?></strong>
170
-          <?=$DisplayName?>
171
-        </li>
172
-        <?php
126
+      <li>
127
+        <strong class="fl_time"><?=$DisplayTime?></strong>
128
+        <?=$DisplayName?>
129
+      </li>
130
+      <?php
173
   } ?>
131
   } ?>
174
-      </ul>
175
-    </div>
176
-    <?php
132
+    </ul>
133
+  </div>
134
+  <?php
177
 }
135
 }
178
 ?>
136
 ?>
179
 
137
 
180
-    <!-- Stats -->
181
-    <div class="box">
182
-      <div class="head colhead_dark"><strong>Stats</strong></div>
183
-      <ul class="stats nobullet">
184
-        <?php if (USER_LIMIT > 0) { ?>
185
-        <li>Maximum users: <?=number_format(USER_LIMIT) ?>
186
-        </li>
187
-        <?php
138
+  <!-- Stats -->
139
+  <div class="box">
140
+    <div class="head colhead_dark"><strong>Stats</strong></div>
141
+    <ul class="stats nobullet">
142
+      <?php if (USER_LIMIT > 0) { ?>
143
+      <li>Maximum users: <?=number_format(USER_LIMIT) ?>
144
+      </li>
145
+      <?php
188
 }
146
 }
189
 
147
 
190
 if (($UserCount = $Cache->get_value('stats_user_count')) === false) {
148
 if (($UserCount = $Cache->get_value('stats_user_count')) === false) {
197
 }
155
 }
198
 $UserCount = (int)$UserCount;
156
 $UserCount = (int)$UserCount;
199
 ?>
157
 ?>
200
-        <li>
201
-          Enabled users: <?=number_format($UserCount)?>
202
-          <a href="stats.php?action=users" class="brackets">Details</a>
203
-        </li>
204
-        <?php
158
+      <li>
159
+        Enabled users: <?=number_format($UserCount)?>
160
+        <a href="stats.php?action=users" class="brackets">Details</a>
161
+      </li>
162
+      <?php
205
 
163
 
206
 if (($UserStats = $Cache->get_value('stats_users')) === false) {
164
 if (($UserStats = $Cache->get_value('stats_users')) === false) {
207
     $DB->query("
165
     $DB->query("
228
     $Cache->cache_value('stats_users', $UserStats, 0);
186
     $Cache->cache_value('stats_users', $UserStats, 0);
229
 }
187
 }
230
 ?>
188
 ?>
231
-        <li>Users active today: <?=number_format($UserStats['Day'])?> (<?=number_format($UserStats['Day'] / $UserCount * 100, 2)?>%)
232
-        </li>
233
-        <li>Users active this week: <?=number_format($UserStats['Week'])?>
234
-          (<?=number_format($UserStats['Week'] / $UserCount * 100, 2)?>%)
235
-        </li>
236
-        <li>Users active this month: <?=number_format($UserStats['Month'])?>
237
-          (<?=number_format($UserStats['Month'] / $UserCount * 100, 2)?>%)
238
-        </li>
239
-        <?php
189
+      <li>Users active today: <?=number_format($UserStats['Day'])?> (<?=number_format($UserStats['Day'] / $UserCount * 100, 2)?>%)
190
+      </li>
191
+      <li>Users active this week: <?=number_format($UserStats['Week'])?>
192
+        (<?=number_format($UserStats['Week'] / $UserCount * 100, 2)?>%)
193
+      </li>
194
+      <li>Users active this month: <?=number_format($UserStats['Month'])?>
195
+        (<?=number_format($UserStats['Month'] / $UserCount * 100, 2)?>%)
196
+      </li>
197
+      <?php
240
 
198
 
241
 if (($TorrentCount = $Cache->get_value('stats_torrent_count')) === false) {
199
 if (($TorrentCount = $Cache->get_value('stats_torrent_count')) === false) {
242
     $DB->query("
200
     $DB->query("
262
     $Cache->cache_value('stats_torrent_size_total', $TorrentSizeTotal, 86400); // 1 day cache
220
     $Cache->cache_value('stats_torrent_size_total', $TorrentSizeTotal, 86400); // 1 day cache
263
 }
221
 }
264
 ?>
222
 ?>
265
-        <li>
266
-          Total size of torrents:
267
-          <?=Format::get_size($TorrentSizeTotal)?>
268
-        </li>
223
+      <li>
224
+        Total size of torrents:
225
+        <?=Format::get_size($TorrentSizeTotal)?>
226
+      </li>
269
 
227
 
270
-        <?php
228
+      <?php
271
 if (($ArtistCount = $Cache->get_value('stats_artist_count')) === false) {
229
 if (($ArtistCount = $Cache->get_value('stats_artist_count')) === false) {
272
     $DB->query("
230
     $DB->query("
273
     SELECT COUNT(ArtistID)
231
     SELECT COUNT(ArtistID)
277
 }
235
 }
278
 
236
 
279
 ?>
237
 ?>
280
-        <li>
281
-          Torrents:
282
-          <?=number_format($TorrentCount)?>
283
-          <a href="stats.php?action=torrents" class="brackets">Details</a>
284
-        </li>
285
-
286
-        <li>Torrent Groups: <?=number_format($GroupCount)?>
287
-        </li>
288
-        <li>Artists: <?=number_format($ArtistCount)?>
289
-        </li>
290
-        <?php
238
+      <li>
239
+        Torrents:
240
+        <?=number_format($TorrentCount)?>
241
+        <a href="stats.php?action=torrents" class="brackets">Details</a>
242
+      </li>
243
+
244
+      <li>Torrent Groups: <?=number_format($GroupCount)?>
245
+      </li>
246
+      <li>Artists: <?=number_format($ArtistCount)?>
247
+      </li>
248
+      <?php
291
 // End Torrent Stats
249
 // End Torrent Stats
292
 
250
 
293
 if (($RequestStats = $Cache->get_value('stats_requests')) === false) {
251
 if (($RequestStats = $Cache->get_value('stats_requests')) === false) {
313
 }
271
 }
314
 
272
 
315
 ?>
273
 ?>
316
-        <li>Requests: <?=number_format($RequestCount)?> (<?=number_format($RequestsFilledPercent, 2)?>% filled)</li>
317
-        <?php
274
+      <li>Requests: <?=number_format($RequestCount)?> (<?=number_format($RequestsFilledPercent, 2)?>% filled)</li>
275
+      <?php
318
 
276
 
319
 if ($SnatchStats = $Cache->get_value('stats_snatches')) {
277
 if ($SnatchStats = $Cache->get_value('stats_snatches')) {
320
     ?>
278
     ?>
321
-        <li>Snatches: <?=number_format($SnatchStats)?>
322
-        </li>
323
-        <?php
279
+      <li>Snatches: <?=number_format($SnatchStats)?>
280
+      </li>
281
+      <?php
324
 }
282
 }
325
 
283
 
326
 if (($PeerStats = $Cache->get_value('stats_peers')) === false) {
284
 if (($PeerStats = $Cache->get_value('stats_peers')) === false) {
353
     $PeerCount = $SeederCount = $LeecherCount = $Ratio = 'Server busy';
311
     $PeerCount = $SeederCount = $LeecherCount = $Ratio = 'Server busy';
354
 }
312
 }
355
 ?>
313
 ?>
356
-        <li>Peers: <?=$PeerCount?>
357
-        </li>
358
-        <li>Seeders: <?=$SeederCount?>
359
-        </li>
360
-        <li>Leechers: <?=$LeecherCount?>
361
-        </li>
362
-        <li>Seeder/leecher ratio: <?=$Ratio?>
363
-        </li>
364
-      </ul>
365
-    </div>
314
+      <li>Peers: <?=$PeerCount?>
315
+      </li>
316
+      <li>Seeders: <?=$SeederCount?>
317
+      </li>
318
+      <li>Leechers: <?=$LeecherCount?>
319
+      </li>
320
+      <li>Seeder/leecher ratio: <?=$Ratio?>
321
+      </li>
322
+    </ul>
323
+  </div>
366
 
324
 
367
-    <!-- Polls -->
368
-    <?php
325
+  <!-- Polls -->
326
+  <?php
369
 if (($TopicID = $Cache->get_value('polls_featured')) === false) {
327
 if (($TopicID = $Cache->get_value('polls_featured')) === false) {
370
     $DB->query("
328
     $DB->query("
371
     SELECT TopicID
329
     SELECT TopicID
422
       AND TopicID = '$TopicID'");
380
       AND TopicID = '$TopicID'");
423
     list($UserResponse) = $DB->next_record(); ?>
381
     list($UserResponse) = $DB->next_record(); ?>
424
 
382
 
425
-    <div class="box">
426
-      <div class="head colhead_dark"><strong>Poll<?php if ($Closed) {
383
+  <div class="box">
384
+    <div class="head colhead_dark"><strong>Poll<?php if ($Closed) {
427
         echo ' [Closed]';
385
         echo ' [Closed]';
428
     } ?>
386
     } ?>
429
-        </strong>
430
-      </div>
431
-      <div class="pad">
432
-        <p><strong><?=display_str($Question)?></strong></p>
433
-        <?php if ($UserResponse !== null || $Closed) { ?>
434
-        <ul class="poll nobullet">
435
-          <?php foreach ($Answers as $i => $Answer) {
387
+      </strong>
388
+    </div>
389
+    <div class="pad">
390
+      <p><strong><?=display_str($Question)?></strong></p>
391
+      <?php if ($UserResponse !== null || $Closed) { ?>
392
+      <ul class="poll nobullet">
393
+        <?php foreach ($Answers as $i => $Answer) {
436
         if ($TotalVotes > 0) {
394
         if ($TotalVotes > 0) {
437
             $Ratio = $Votes[$i] / $MaxVotes;
395
             $Ratio = $Votes[$i] / $MaxVotes;
438
             $Percent = $Votes[$i] / $TotalVotes;
396
             $Percent = $Votes[$i] / $TotalVotes;
440
             $Ratio = 0;
398
             $Ratio = 0;
441
             $Percent = 0;
399
             $Percent = 0;
442
         } ?>
400
         } ?>
443
-          <li<?=((!empty($UserResponse) && ($UserResponse == $i))?' class="poll_your_answer"':'')?>><?=display_str($Answers[$i])?> (<?=number_format($Percent * 100, 2)?>%)</li>
444
-            <li class="graph">
445
-              <span class="center_poll"
446
-                style="width: <?=round($Ratio * 140)?>px;"></span>
447
-              <br />
448
-            </li>
449
-            <?php
401
+        <li<?=((!empty($UserResponse) && ($UserResponse == $i))?' class="poll_your_answer"':'')?>><?=display_str($Answers[$i])?> (<?=number_format($Percent * 100, 2)?>%)</li>
402
+          <li class="graph">
403
+            <span class="center_poll"
404
+              style="width: <?=round($Ratio * 140)?>px;"></span>
405
+            <br />
406
+          </li>
407
+          <?php
450
     } ?>
408
     } ?>
451
-        </ul>
452
-        <strong>Votes:</strong> <?=number_format($TotalVotes)?><br />
453
-        <?php } else { ?>
454
-        <div id="poll_container">
455
-          <form class="vote_form" name="poll" id="poll" action="">
456
-            <input type="hidden" name="action" value="poll" />
457
-            <input type="hidden" name="auth"
458
-              value="<?=$LoggedUser['AuthKey']?>" />
459
-            <input type="hidden" name="topicid"
460
-              value="<?=$TopicID?>" />
461
-            <?php foreach ($Answers as $i => $Answer) { ?>
462
-            <input type="radio" name="vote" id="answer_<?=$i?>"
463
-              value="<?=$i?>" />
464
-            <label for="answer_<?=$i?>"><?=display_str($Answers[$i])?></label><br />
465
-            <?php } ?>
466
-            <br /><input type="radio" name="vote" id="answer_0" value="0" /> <label
467
-              for="answer_0">Blank&#8202;&mdash;&#8202;Show the results!</label><br /><br />
468
-            <input type="button"
469
-              onclick="ajax.post('index.php', 'poll', function(response) { $('#poll_container').raw().innerHTML = response } );"
470
-              value="Vote" />
471
-          </form>
472
-        </div>
473
-        <?php } ?>
474
-        <br /><strong>Topic:</strong> <a
475
-          href="forums.php?action=viewthread&amp;threadid=<?=$TopicID?>">Visit</a>
409
+      </ul>
410
+      <strong>Votes:</strong> <?=number_format($TotalVotes)?><br />
411
+      <?php } else { ?>
412
+      <div id="poll_container">
413
+        <form class="vote_form" name="poll" id="poll" action="">
414
+          <input type="hidden" name="action" value="poll" />
415
+          <input type="hidden" name="auth"
416
+            value="<?=$LoggedUser['AuthKey']?>" />
417
+          <input type="hidden" name="topicid"
418
+            value="<?=$TopicID?>" />
419
+          <?php foreach ($Answers as $i => $Answer) { ?>
420
+          <input type="radio" name="vote" id="answer_<?=$i?>"
421
+            value="<?=$i?>" />
422
+          <label for="answer_<?=$i?>"><?=display_str($Answers[$i])?></label><br />
423
+          <?php } ?>
424
+          <br /><input type="radio" name="vote" id="answer_0" value="0" /> <label
425
+            for="answer_0">Blank&#8202;&mdash;&#8202;Show the results!</label><br /><br />
426
+          <input type="button"
427
+            onclick="ajax.post('index.php', 'poll', function(response) { $('#poll_container').raw().innerHTML = response } );"
428
+            value="Vote" />
429
+        </form>
476
       </div>
430
       </div>
431
+      <?php } ?>
432
+      <br /><strong>Topic:</strong> <a
433
+        href="forums.php?action=viewthread&amp;threadid=<?=$TopicID?>">Visit</a>
477
     </div>
434
     </div>
478
-    <?php
435
+  </div>
436
+  <?php
479
 }
437
 }
480
 // polls();
438
 // polls();
481
 ?>
439
 ?>
482
-  </div>
483
-  <div class="main_column">
484
-    <?php
440
+</div>
441
+<div class="main_column">
442
+  <?php
485
 
443
 
486
 $Recommend = $Cache->get_value('recommend');
444
 $Recommend = $Cache->get_value('recommend');
487
 $Recommend_artists = $Cache->get_value('recommend_artists');
445
 $Recommend_artists = $Cache->get_value('recommend_artists');
508
 
466
 
509
 if (count($Recommend) >= 4) {
467
 if (count($Recommend) >= 4) {
510
     $Cache->increment('usage_index'); ?>
468
     $Cache->increment('usage_index'); ?>
511
-    <div class="box" id="recommended">
512
-      <div class="head colhead_dark">
513
-        <strong>Latest Vanity House additions</strong>
514
-        <a data-toggle-target="#vanityhouse" , data-toggle-replace="Hide" class="brackets">Show</a>
515
-      </div>
469
+  <div class="box" id="recommended">
470
+    <div class="head colhead_dark">
471
+      <strong>Latest Vanity House additions</strong>
472
+      <a data-toggle-target="#vanityhouse" , data-toggle-replace="Hide" class="brackets">Show</a>
473
+    </div>
516
 
474
 
517
-      <table class="torrent_table hidden" id="vanityhouse">
518
-        <?php
475
+    <table class="torrent_table hidden" id="vanityhouse">
476
+      <?php
519
   foreach ($Recommend as $Recommendations) {
477
   foreach ($Recommend as $Recommendations) {
520
       list($GroupID, $UserID, $Username, $GroupName, $TagList) = $Recommendations;
478
       list($GroupID, $UserID, $Username, $GroupName, $TagList) = $Recommendations;
521
       $TagsStr = '';
479
       $TagsStr = '';
531
           }
489
           }
532
           $TagStr = "<br />\n<div class=\"tags\">".implode(', ', $TagLinks).'</div>';
490
           $TagStr = "<br />\n<div class=\"tags\">".implode(', ', $TagLinks).'</div>';
533
       } ?>
491
       } ?>
534
-        <tr>
535
-          <td>
536
-            <?=Artists::display_artists($Recommend_artists[$GroupID]) ?>
537
-            <a href="torrents.php?id=<?=$GroupID?>"><?=$GroupName?></a> (by <?=Users::format_username($UserID, false, false, false)?>)
538
-            <?=$TagStr?>
539
-          </td>
540
-        </tr>
541
-        <?php
492
+      <tr>
493
+        <td>
494
+          <?=Artists::display_artists($Recommend_artists[$GroupID]) ?>
495
+          <a href="torrents.php?id=<?=$GroupID?>"><?=$GroupName?></a> (by <?=Users::format_username($UserID, false, false, false)?>)
496
+          <?=$TagStr?>
497
+        </td>
498
+      </tr>
499
+      <?php
542
   } ?>
500
   } ?>
543
-      </table>
544
-    </div>
545
-    <!-- END recommendations section -->
546
-    <?php
501
+    </table>
502
+  </div>
503
+  <!-- END recommendations section -->
504
+  <?php
547
 }
505
 }
548
 
506
 
549
 $Count = 0;
507
 $Count = 0;
552
     if (strtotime($NewsTime) > time()) {
510
     if (strtotime($NewsTime) > time()) {
553
         continue;
511
         continue;
554
     } ?>
512
     } ?>
555
-    <div id="news<?=$NewsID?>" class="box news_post">
556
-      <div class="head">
557
-        <strong>
558
-          <?=$Title?>
559
-        </strong>
560
-
561
-        <?=time_diff($NewsTime)?>
562
-
563
-        <?php if (check_perms('admin_manage_news')) { ?>
564
-        &ndash;
565
-        <a href="tools.php?action=editnews&amp;id=<?=$NewsID?>"
566
-          class="brackets">Edit</a>
567
-        <?php } ?>
568
-
569
-        <span class="float_right">
570
-          <a data-toggle-target="#newsbody<?=$NewsID?>"
571
-            data-toggle-replace="Show" class="brackets">Hide</a>
572
-        </span>
573
-      </div>
513
+  <div id="news<?=$NewsID?>" class="box news_post">
514
+    <div class="head">
515
+      <strong>
516
+        <?=$Title?>
517
+      </strong>
518
+
519
+      <?=time_diff($NewsTime)?>
520
+
521
+      <?php if (check_perms('admin_manage_news')) { ?>
522
+      &ndash;
523
+      <a href="tools.php?action=editnews&amp;id=<?=$NewsID?>"
524
+        class="brackets">Edit</a>
525
+      <?php } ?>
526
+
527
+      <span class="float_right">
528
+        <a data-toggle-target="#newsbody<?=$NewsID?>"
529
+          data-toggle-replace="Show" class="brackets">Hide</a>
530
+      </span>
531
+    </div>
574
 
532
 
575
-      <div id="newsbody<?=$NewsID?>" class="pad">
576
-        <?=Text::full_format($Body)?>
577
-      </div>
533
+    <div id="newsbody<?=$NewsID?>" class="pad">
534
+      <?=Text::full_format($Body)?>
578
     </div>
535
     </div>
536
+  </div>
579
 
537
 
580
-    <?php
538
+  <?php
581
   if (++$Count > ($NewsCount - 1)) {
539
   if (++$Count > ($NewsCount - 1)) {
582
       break;
540
       break;
583
   }
541
   }
584
 }
542
 }
585
 ?>
543
 ?>
586
-    <div id="more_news" class="box">
587
-      <div class="head">
588
-        <em><span><a href="#"
589
-              onclick="news_ajax(event, 3, <?=$NewsCount?>, <?=check_perms('admin_manage_news') ? 1 : 0; ?>); return false;">Click
590
-              to load more news</a>.</span> To browse old news posts, <a
591
-            href="forums.php?action=viewforum&amp;forumid=<?=$ENV->ANNOUNCEMENT_FORUM?>">click
592
-            here</a>.</em>
593
-      </div>
544
+  <div id="more_news" class="box">
545
+    <div class="head">
546
+      <em><span><a href="#"
547
+            onclick="news_ajax(event, 3, <?=$NewsCount?>, <?=check_perms('admin_manage_news') ? 1 : 0; ?>); return false;">Click
548
+            to load more news</a>.</span> To browse old news posts, <a
549
+          href="forums.php?action=viewforum&amp;forumid=<?=$ENV->ANNOUNCEMENT_FORUM?>">click
550
+          here</a>.</em>
594
     </div>
551
     </div>
595
   </div>
552
   </div>
596
 </div>
553
 </div>
554
+</div>
597
 <?php
555
 <?php
598
 View::show_footer(array('disclaimer'=>true));
556
 View::show_footer(array('disclaimer'=>true));
599
 
557
 

+ 1
- 1
sections/pwgen/diceware.php View File

1
 <?php
1
 <?php
2
-#declare(strict_types=1);
2
+declare(strict_types=1);
3
 
3
 
4
 # Load the dictionary
4
 # Load the dictionary
5
 require_once 'wordlist.php';
5
 require_once 'wordlist.php';

+ 1
- 1
sections/pwgen/wordlist.php View File

1
 <?php
1
 <?php
2
-#declare(strict_types=1);
2
+declare(strict_types=1);
3
 
3
 
4
 # https://www.eff.org/files/2016/07/18/eff_large_wordlist.txt
4
 # https://www.eff.org/files/2016/07/18/eff_large_wordlist.txt
5
 $eff_large_wordlist = [
5
 $eff_large_wordlist = [

+ 1
- 1
sections/rules/chat.php View File

1
 <?php
1
 <?php
2
-#declare(strict_types=1);
2
+declare(strict_types=1);
3
 
3
 
4
 # Formerly Rules::display_forum_rules()
4
 # Formerly Rules::display_forum_rules()
5
 # and Rules::display_irc_chat_rules()
5
 # and Rules::display_irc_chat_rules()

+ 1
- 1
sections/rules/clients.php View File

1
 <?php
1
 <?php
2
-#declare(strict_types=1);
2
+declare(strict_types=1);
3
 
3
 
4
 View::show_header('Client rules');
4
 View::show_header('Client rules');
5
 
5
 

+ 1
- 1
sections/rules/collages.php View File

1
 <?php
1
 <?php
2
-#declare(strict_types=1);
2
+declare(strict_types=1);
3
 
3
 
4
 View::show_header('Collection rules');
4
 View::show_header('Collection rules');
5
 ?>
5
 ?>

+ 1
- 1
sections/rules/index.php View File

1
 <?php
1
 <?php
2
-#declare(strict_types=1);
2
+declare(strict_types=1);
3
 
3
 
4
 enforce_login();
4
 enforce_login();
5
 
5
 

+ 5
- 0
sections/rules/jump.php View File

1
+<?php
2
+declare(strict_types=1);
3
+
4
+?>
5
+
1
 <h3 id="jump">Other sections</h3>
6
 <h3 id="jump">Other sections</h3>
2
 <div class="box pad rule_table">
7
 <div class="box pad rule_table">
3
   <table>
8
   <table>

+ 1
- 1
sections/rules/ratio.php View File

1
 <?php
1
 <?php
2
-#declare(strict_types=1);
2
+declare(strict_types=1);
3
 
3
 
4
 View::show_header('Ratio requirements');
4
 View::show_header('Ratio requirements');
5
 ?>
5
 ?>

+ 1
- 1
sections/rules/requests.php View File

1
 <?php
1
 <?php
2
-#declare(strict_types=1);
2
+declare(strict_types=1);
3
 
3
 
4
 View::show_header('Request rules');
4
 View::show_header('Request rules');
5
 ?>
5
 ?>

+ 1
- 1
sections/rules/tag.php View File

1
 <?php
1
 <?php
2
-#declare(strict_types=1);
2
+declare(strict_types=1);
3
 
3
 
4
 # Formerly Rules::display_site_tag_rules()
4
 # Formerly Rules::display_site_tag_rules()
5
 View::show_header('Tagging rules');
5
 View::show_header('Tagging rules');

+ 0
- 156
sections/staffblog/index.php View File

1
-<?
2
-enforce_login();
3
-
4
-if (!check_perms('users_mod')) {
5
-  error(403);
6
-}
7
-
8
-$DB->query("
9
-  INSERT INTO staff_blog_visits
10
-    (UserID, Time)
11
-  VALUES
12
-    (".$LoggedUser['ID'].", NOW())
13
-  ON DUPLICATE KEY UPDATE
14
-    Time = NOW()");
15
-$Cache->delete_value('staff_blog_read_'.$LoggedUser['ID']);
16
-
17
-// WHY
18
-//define('ANNOUNCEMENT_FORUM_ID', 19);
19
-
20
-if (check_perms('admin_manage_blog')) {
21
-  if (!empty($_REQUEST['action'])) {
22
-    switch ($_REQUEST['action']) {
23
-      case 'takeeditblog':
24
-        authorize();
25
-        if (empty($_POST['title'])) {
26
-          error("Please enter a title.");
27
-        }
28
-        if (is_number($_POST['blogid'])) {
29
-          $DB->query("
30
-            UPDATE staff_blog
31
-            SET Title = '".db_string($_POST['title'])."', Body = '".db_string($_POST['body'])."'
32
-            WHERE ID = '".db_string($_POST['blogid'])."'");
33
-          $Cache->delete_value('staff_blog');
34
-          $Cache->delete_value('staff_feed_blog');
35
-        }
36
-        header('Location: staffblog.php');
37
-        break;
38
-      case 'editblog':
39
-        if (is_number($_GET['id'])) {
40
-          $BlogID = $_GET['id'];
41
-          $DB->query("
42
-            SELECT Title, Body
43
-            FROM staff_blog
44
-            WHERE ID = $BlogID");
45
-          list($Title, $Body, $ThreadID) = $DB->next_record();
46
-        }
47
-        break;
48
-      case 'deleteblog':
49
-        if (is_number($_GET['id'])) {
50
-          authorize();
51
-          $DB->query("
52
-            DELETE FROM staff_blog
53
-            WHERE ID = '".db_string($_GET['id'])."'");
54
-          $Cache->delete_value('staff_blog');
55
-          $Cache->delete_value('staff_feed_blog');
56
-        }
57
-        header('Location: staffblog.php');
58
-        break;
59
-
60
-      case 'takenewblog':
61
-        authorize();
62
-        if (empty($_POST['title'])) {
63
-          error("Please enter a title.");
64
-        }
65
-        $Title = db_string($_POST['title']);
66
-        $Body = db_string($_POST['body']);
67
-
68
-        $DB->query("
69
-          INSERT INTO staff_blog
70
-            (UserID, Title, Body, Time)
71
-          VALUES
72
-            ('$LoggedUser[ID]', '".db_string($_POST['title'])."', '".db_string($_POST['body'])."', NOW())");
73
-        $Cache->delete_value('staff_blog');
74
-        $Cache->delete_value('staff_blog_latest_time');
75
-
76
-        send_irc(STAFF_CHAN, "New staff blog: ".$_POST['title']." - https://".SITE_DOMAIN."/staffblog.php#blog".$DB->inserted_id());
77
-
78
-        header('Location: staffblog.php');
79
-        break;
80
-    }
81
-  }
82
-  View::show_header('Staff Blog','bbcode');
83
-  ?>
84
-    <div class="box">
85
-      <div class="head">
86
-        <?=((empty($_GET['action'])) ? 'Create a staff blog post' : 'Edit staff blog post')?>
87
-        <span class="float_right">
88
-          <a data-toggle-target="#postform" data-toggle-replace="<?=(($_REQUEST['action'] != 'editblog') ? 'Hide' : 'Show')?>" class="brackets"><?=(($_REQUEST['action'] != 'editblog') ? 'Show' : 'Hide')?></a>
89
-        </span>
90
-      </div>
91
-      <form class="<?=((empty($_GET['action'])) ? 'create_form' : 'edit_form')?>" name="blog_post" action="staffblog.php" method="post">
92
-        <div id="postform" class="pad<?=($_REQUEST['action'] != 'editblog') ? ' hidden' : '' ?>">
93
-          <input type="hidden" name="action" value="<?=((empty($_GET['action'])) ? 'takenewblog' : 'takeeditblog')?>" />
94
-          <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
95
-<?php if (!empty($_GET['action']) && $_GET['action'] == 'editblog') { ?>
96
-          <input type="hidden" name="blogid" value="<?=$BlogID; ?>" />
97
-<?php } ?>
98
-          <div>
99
-            <h3>Title</h3>
100
-            <input type="text" name="title" size="95"<? if (!empty($Title)) { echo ' value="'.display_str($Title).'"'; } ?> />
101
-          </div>
102
-          <div>
103
-            <h3>Body</h3>
104
-            <textarea name="body" cols="95" rows="15"><? if (!empty($Body)) { echo display_str($Body); } ?></textarea> <br />
105
-          </div>
106
-          <div class="submit_div center">
107
-            <input type="submit" value="<?=((!isset($_GET['action'])) ? 'Create blog post' : 'Edit blog post') ?>" />
108
-          </div>
109
-        </div>
110
-      </form>
111
-    </div>
112
-<?
113
-} else {
114
-  View::show_header('Staff Blog','bbcode');
115
-}
116
-?>
117
-<div>
118
-<?
119
-if (($Blog = $Cache->get_value('staff_blog')) === false) {
120
-  $DB->query("
121
-    SELECT
122
-      b.ID,
123
-      um.Username,
124
-      b.Title,
125
-      b.Body,
126
-      b.Time
127
-    FROM staff_blog AS b
128
-      LEFT JOIN users_main AS um ON b.UserID = um.ID
129
-    ORDER BY Time DESC");
130
-  $Blog = $DB->to_array(false, MYSQLI_NUM);
131
-  $Cache->cache_value('staff_blog', $Blog, 1209600);
132
-}
133
-
134
-foreach ($Blog as $BlogItem) {
135
-  list($BlogID, $Author, $Title, $Body, $BlogTime) = $BlogItem;
136
-  $BlogTime = strtotime($BlogTime);
137
-?>
138
-      <div id="blog<?=$BlogID?>" class="box blog_post">
139
-        <div class="head">
140
-          <strong><?=$Title?></strong> - posted <?=time_diff($BlogTime);?> by <?=$Author?>
141
-<?php if (check_perms('admin_manage_blog')) { ?>
142
-          - <a href="staffblog.php?action=editblog&amp;id=<?=$BlogID?>" class="brackets">Edit</a>
143
-          <a href="staffblog.php?action=deleteblog&amp;id=<?=$BlogID?>&amp;auth=<?=$LoggedUser['AuthKey']?>" onclick="return confirm('Do you want to delete this?');" class="brackets">Delete</a>
144
-<?php } ?>
145
-        </div>
146
-        <div class="pad">
147
-          <?=Text::full_format($Body)?>
148
-        </div>
149
-      </div>
150
-<?
151
-}
152
-?>
153
-</div>
154
-<?
155
-View::show_footer();
156
-?>

+ 0
- 43
sections/store/become_admin.php View File

1
-<?php
2
-#declare(strict_types=1);
3
-
4
-$Purchase = "Admin status";
5
-$UserID = $LoggedUser['ID'];
6
-
7
-$DB->query("
8
-  SELECT BonusPoints
9
-  FROM users_main
10
-  WHERE ID = $UserID");
11
-  
12
-if ($DB->has_results()) {
13
-    list($Points) = $DB->next_record();
14
-
15
-    if ($Points >= 4294967296) {
16
-        $DB->query("
17
-          UPDATE users_main
18
-          SET BonusPoints  = BonusPoints - 4294967296,
19
-            PermissionID = 15
20
-          WHERE ID = $UserID");
21
-        $Worked = true;
22
-    } else {
23
-        $Worked = false;
24
-        $ErrMessage = "Not enough points";
25
-    }
26
-}
27
-
28
-View::show_header('Store'); ?>
29
-<div>
30
-  <h2>Purchase
31
-    <?= $Worked?"Successful":"Failed"?>
32
-  </h2>
33
-  <div class="box">
34
-    <p>
35
-      <?= $Worked?("You purchased ".$Purchase):("Error: ".$ErrMessage)?>
36
-    </p>
37
-    <p>
38
-      <a href="/store.php">Back to Store</a>
39
-    </p>
40
-  </div>
41
-</div>
42
-<?php
43
-View::show_footer();

+ 0
- 18
sections/testing/ajax_run_method.php View File

1
-<?
2
-authorize();
3
-if (!check_perms('users_mod')) {
4
-  error(404);
5
-}
6
-
7
-$Class = $_POST['class'];
8
-$Method = $_POST['method'];
9
-$Params = json_decode($_POST['params'], true);
10
-
11
-if (!empty($Class) && !empty($Method) && Testing::has_testable_method($Class, $Method)) {
12
-  if (count($Params)) {
13
-    $Results = call_user_func_array(array($Class, $Method), array_values($Params));
14
-  } else {
15
-    $Results = call_user_func(array($Class, $Method));
16
-  }
17
-  TestingView::render_results($Results);
18
-}

+ 0
- 26
sections/testing/class.php View File

1
-<?
2
-if (!check_perms('users_mod')) {
3
-  error(404);
4
-}
5
-
6
-$Class = $_GET['name'];
7
-if (!empty($Class) && !Testing::has_class($Class)) {
8
-  error("Missing class");
9
-}
10
-
11
-View::show_header("Tests", "testing");
12
-
13
-?>
14
-<div class="header">
15
-  <h2><?=$Class?></h2>
16
-  <?=TestingView::render_linkbox("class"); ?>
17
-</div>
18
-
19
-<div>
20
-  <?=TestingView::render_functions(Testing::get_testable_methods($Class));?>
21
-</div>
22
-
23
-<?
24
-View::show_footer();
25
-
26
-

+ 0
- 21
sections/testing/classes.php View File

1
-<?
2
-if (!check_perms('users_mod')) {
3
-  error(404);
4
-}
5
-
6
-View::show_header("Tests");
7
-
8
-?>
9
-<div class="header">
10
-  <h2>Tests</h2>
11
-  <? TestingView::render_linkbox("classes"); ?>
12
-</div>
13
-
14
-<div>
15
-  <? TestingView::render_classes(Testing::get_classes());?>
16
-</div>
17
-
18
-<?
19
-View::show_footer();
20
-
21
-

+ 0
- 23
sections/testing/comments.php View File

1
-<?php
2
-#declare(strict_types=1);
3
-
4
-if (!check_perms('users_mod')) {
5
-  error(404);
6
-}
7
-
8
-View::show_header("Tests");
9
-
10
-?>
11
-
12
-<div class="header">
13
-  <h2>Documentation</h2>
14
-  <? TestingView::render_linkbox("comments"); ?>
15
-</div>
16
-
17
-<div>
18
-  <? TestingView::render_missing_documentation(Testing::get_classes());?>
19
-</div>
20
-
21
-<?
22
-View::show_footer();
23
-

+ 0
- 26
sections/testing/index.php View File

1
-<?
2
-enforce_login();
3
-if (!check_perms('users_mod')) {
4
-  error(404);
5
-} else {
6
-  Testing::init();
7
-
8
-  if (!empty($_REQUEST['action'])) {
9
-    switch ($_REQUEST['action']) {
10
-      case 'class':
11
-        include(SERVER_ROOT.'/sections/testing/class.php');
12
-        break;
13
-      case 'ajax_run_method':
14
-        include(SERVER_ROOT.'/sections/testing/ajax_run_method.php');
15
-        break;
16
-      case 'comments':
17
-        include(SERVER_ROOT.'/sections/testing/comments.php');
18
-        break;
19
-      default:
20
-        include(SERVER_ROOT.'/sections/testing/classes.php');
21
-        break;
22
-    }
23
-  } else {
24
-    include(SERVER_ROOT.'/sections/testing/classes.php');
25
-  }
26
-}

+ 206
- 149
sections/user/community_stats.php View File

1
-<?
1
+<?php
2
+declare(strict_types=1);
3
+
2
 $DB->query("
4
 $DB->query("
3
   SELECT Page, COUNT(1)
5
   SELECT Page, COUNT(1)
4
   FROM comments
6
   FROM comments
32
 list($UniqueGroups) = $DB->next_record();
34
 list($UniqueGroups) = $DB->next_record();
33
 
35
 
34
 ?>
36
 ?>
35
-    <div class="box box_info box_userinfo_community">
36
-      <div class="head colhead_dark">Community</div>
37
-      <ul class="stats nobullet">
38
-        <li id="comm_posts">Forum posts: <?=number_format($ForumPosts)?> <a href="userhistory.php?action=posts&amp;userid=<?=$UserID?>" class="brackets">View</a></li>
39
-        <li id="comm_irc">IRC lines: <?=number_format($IRCLines)?></li>
40
-<?php if ($Override = check_paranoia_here('torrentcomments+')) { ?>
41
-        <li id="comm_torrcomm"<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Torrent comments: <?=number_format($NumComments)?>
42
-<?php if ($Override = check_paranoia_here('torrentcomments')) { ?>
43
-          <a href="comments.php?id=<?=$UserID?>" class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>">View</a>
44
-<?php } ?>
45
-        </li>
46
-        <li id="comm_artcomm"<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Artist comments: <?=number_format($NumArtistComments)?>
47
-<?php if ($Override = check_paranoia_here('torrentcomments')) { ?>
48
-          <a href="comments.php?id=<?=$UserID?>&amp;action=artist" class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>">View</a>
49
-<?php } ?>
50
-        </li>
51
-        <li id="comm_collcomm"<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Collage comments: <?=number_format($NumCollageComments)?>
52
-<?php if ($Override = check_paranoia_here('torrentcomments')) { ?>
53
-          <a href="comments.php?id=<?=$UserID?>&amp;action=collages" class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>">View</a>
54
-<?php } ?>
55
-        </li>
56
-        <li id="comm_reqcomm"<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Request comments: <?=number_format($NumRequestComments)?>
57
-<?php if ($Override = check_paranoia_here('torrentcomments')) { ?>
58
-          <a href="comments.php?id=<?=$UserID?>&amp;action=requests" class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>">View</a>
59
-<?php } ?>
60
-        </li>
61
-<?
37
+<div class="box box_info box_userinfo_community">
38
+        <div class="head colhead_dark">Community</div>
39
+        <ul class="stats nobullet">
40
+                <li id="comm_posts">Forum posts: <?=number_format($ForumPosts)?> <a
41
+                                href="userhistory.php?action=posts&amp;userid=<?=$UserID?>"
42
+                                class="brackets">View</a></li>
43
+                <li id="comm_irc">IRC lines: <?=number_format($IRCLines)?>
44
+                </li>
45
+                <?php if ($Override = check_paranoia_here('torrentcomments+')) { ?>
46
+                <li id="comm_torrcomm" <?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Torrent
47
+                        comments: <?=number_format($NumComments)?>
48
+                        <?php if ($Override = check_paranoia_here('torrentcomments')) { ?>
49
+                        <a href="comments.php?id=<?=$UserID?>"
50
+                                class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>">View</a>
51
+                        <?php } ?>
52
+                </li>
53
+                <li id="comm_artcomm" <?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Artist
54
+                        comments: <?=number_format($NumArtistComments)?>
55
+                        <?php if ($Override = check_paranoia_here('torrentcomments')) { ?>
56
+                        <a href="comments.php?id=<?=$UserID?>&amp;action=artist"
57
+                                class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>">View</a>
58
+                        <?php } ?>
59
+                </li>
60
+                <li id="comm_collcomm" <?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Collage
61
+                        comments: <?=number_format($NumCollageComments)?>
62
+                        <?php if ($Override = check_paranoia_here('torrentcomments')) { ?>
63
+                        <a href="comments.php?id=<?=$UserID?>&amp;action=collages"
64
+                                class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>">View</a>
65
+                        <?php } ?>
66
+                </li>
67
+                <li id="comm_reqcomm" <?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Request
68
+                        comments: <?=number_format($NumRequestComments)?>
69
+                        <?php if ($Override = check_paranoia_here('torrentcomments')) { ?>
70
+                        <a href="comments.php?id=<?=$UserID?>&amp;action=requests"
71
+                                class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>">View</a>
72
+                        <?php } ?>
73
+                </li>
74
+                <?php
62
   }
75
   }
63
   if (($Override = check_paranoia_here('collages+'))) { ?>
76
   if (($Override = check_paranoia_here('collages+'))) { ?>
64
-        <li id="comm_collstart"<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Collages started: <?=number_format($NumCollages)?>
65
-<?php if ($Override = check_paranoia_here('collages')) { ?>
66
-          <a href="collages.php?userid=<?=$UserID?>" class="brackets<?=(($Override === 2) ? ' paranoia_override' : '')?>">View</a>
67
-<?php } ?>
68
-        </li>
69
-<?
77
+                <li id="comm_collstart" <?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Collages
78
+                        started: <?=number_format($NumCollages)?>
79
+                        <?php if ($Override = check_paranoia_here('collages')) { ?>
80
+                        <a href="collages.php?userid=<?=$UserID?>"
81
+                                class="brackets<?=(($Override === 2) ? ' paranoia_override' : '')?>">View</a>
82
+                        <?php } ?>
83
+                </li>
84
+                <?php
70
   }
85
   }
71
   if (($Override = check_paranoia_here('collagecontribs+'))) { ?>
86
   if (($Override = check_paranoia_here('collagecontribs+'))) { ?>
72
-        <li id="comm_collcontrib"<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Collages contributed to: <? echo number_format($NumCollageContribs); ?>
73
-<?php if ($Override = check_paranoia_here('collagecontribs')) { ?>
74
-          <a href="collages.php?userid=<?=$UserID?>&amp;contrib=1" class="brackets<?=(($Override === 2) ? ' paranoia_override' : '')?>">View</a>
75
-<?php } ?>
76
-        </li>
77
-<?
87
+                <li id="comm_collcontrib" <?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Collages
88
+                        contributed to:
89
+                        <?php echo number_format($NumCollageContribs); ?>
90
+                        <?php if ($Override = check_paranoia_here('collagecontribs')) { ?>
91
+                        <a href="collages.php?userid=<?=$UserID?>&amp;contrib=1"
92
+                                class="brackets<?=(($Override === 2) ? ' paranoia_override' : '')?>">View</a>
93
+                        <?php } ?>
94
+                </li>
95
+                <?php
78
   }
96
   }
79
 
97
 
80
   //Let's see if we can view requests because of reasons
98
   //Let's see if we can view requests because of reasons
83
   $ViewBounty = check_paranoia_here('requestsfilled_bounty');
101
   $ViewBounty = check_paranoia_here('requestsfilled_bounty');
84
 
102
 
85
   if ($ViewCount && !$ViewBounty && !$ViewAll) { ?>
103
   if ($ViewCount && !$ViewBounty && !$ViewAll) { ?>
86
-        <li>Requests filled: <?=number_format($RequestsFilled)?></li>
87
-<?php } elseif (!$ViewCount && $ViewBounty && !$ViewAll) { ?>
88
-        <li>Requests filled: <?=Format::get_size($TotalBounty)?> collected</li>
89
-<?php } elseif ($ViewCount && $ViewBounty && !$ViewAll) { ?>
90
-        <li>Requests filled: <?=number_format($RequestsFilled)?> for <?=Format::get_size($TotalBounty)?></li>
91
-<?php } elseif ($ViewAll) { ?>
92
-        <li>
93
-          <span<?=($ViewCount === 2 ? ' class="paranoia_override"' : '')?>>Requests filled: <?=number_format($RequestsFilled)?></span>
94
-          <span<?=($ViewBounty === 2 ? ' class="paranoia_override"' : '')?>> for <?=Format::get_size($TotalBounty) ?></span>
95
-          <a href="requests.php?type=filled&amp;userid=<?=$UserID?>" class="brackets<?=(($ViewAll === 2) ? ' paranoia_override' : '')?>">View</a>
96
-        </li>
97
-<?
104
+                <li>Requests filled: <?=number_format($RequestsFilled)?>
105
+                </li>
106
+                <?php } elseif (!$ViewCount && $ViewBounty && !$ViewAll) { ?>
107
+                <li>Requests filled: <?=Format::get_size($TotalBounty)?> collected</li>
108
+                <?php } elseif ($ViewCount && $ViewBounty && !$ViewAll) { ?>
109
+                <li>Requests filled: <?=number_format($RequestsFilled)?> for <?=Format::get_size($TotalBounty)?>
110
+                </li>
111
+                <?php } elseif ($ViewAll) { ?>
112
+                <li>
113
+                        <span<?=($ViewCount === 2 ? ' class="paranoia_override"' : '')?>>Requests
114
+                                filled: <?=number_format($RequestsFilled)?></span>
115
+                                <span<?=($ViewBounty === 2 ? ' class="paranoia_override"' : '')?>>
116
+                                        for <?=Format::get_size($TotalBounty) ?></span>
117
+                                        <a href="requests.php?type=filled&amp;userid=<?=$UserID?>"
118
+                                                class="brackets<?=(($ViewAll === 2) ? ' paranoia_override' : '')?>">View</a>
119
+                </li>
120
+                <?php
98
   }
121
   }
99
 
122
 
100
   //Let's see if we can view requests because of reasons
123
   //Let's see if we can view requests because of reasons
103
   $ViewBounty = check_paranoia_here('requestsvoted_bounty');
126
   $ViewBounty = check_paranoia_here('requestsvoted_bounty');
104
 
127
 
105
   if ($ViewCount && !$ViewBounty && !$ViewAll) { ?>
128
   if ($ViewCount && !$ViewBounty && !$ViewAll) { ?>
106
-        <li>Requests created: <?=number_format($RequestsCreated)?></li>
107
-        <li>Requests voted: <?=number_format($RequestsVoted)?></li>
108
-<?php } elseif (!$ViewCount && $ViewBounty && !$ViewAll) { ?>
109
-        <li>Requests created: <?=Format::get_size($RequestsCreatedSpent)?> spent</li>
110
-        <li>Requests voted: <?=Format::get_size($TotalSpent)?> spent</li>
111
-<?php } elseif ($ViewCount && $ViewBounty && !$ViewAll) { ?>
112
-        <li>Requests created: <?=number_format($RequestsCreated)?> for <?=Format::get_size($RequestsCreatedSpent)?></li>
113
-        <li>Requests voted: <?=number_format($RequestsVoted)?> for <?=Format::get_size($TotalSpent)?></li>
114
-<?php } elseif ($ViewAll) { ?>
115
-        <li>
116
-          <span<?=($ViewCount === 2 ? ' class="paranoia_override"' : '')?>>Requests created: <?=number_format($RequestsCreated)?></span>
117
-          <span<?=($ViewBounty === 2 ? ' class="paranoia_override"' : '')?>> for <?=Format::get_size($RequestsCreatedSpent)?></span>
118
-          <a href="requests.php?type=created&amp;userid=<?=$UserID?>" class="brackets<?=($ViewAll === 2 ? ' paranoia_override' : '')?>">View</a>
119
-        </li>
120
-        <li>
121
-          <span<?=($ViewCount === 2 ? ' class="paranoia_override"' : '')?>>Requests voted: <?=number_format($RequestsVoted)?></span>
122
-          <span<?=($ViewBounty === 2 ? ' class="paranoia_override"' : '')?>> for <?=Format::get_size($TotalSpent)?></span>
123
-          <a href="requests.php?type=voted&amp;userid=<?=$UserID?>" class="brackets<?=($ViewAll === 2 ? ' paranoia_override' : '')?>">View</a>
124
-        </li>
125
-<?
129
+                <li>Requests created: <?=number_format($RequestsCreated)?>
130
+                </li>
131
+                <li>Requests voted: <?=number_format($RequestsVoted)?>
132
+                </li>
133
+                <?php } elseif (!$ViewCount && $ViewBounty && !$ViewAll) { ?>
134
+                <li>Requests created: <?=Format::get_size($RequestsCreatedSpent)?> spent
135
+                </li>
136
+                <li>Requests voted: <?=Format::get_size($TotalSpent)?> spent</li>
137
+                <?php } elseif ($ViewCount && $ViewBounty && !$ViewAll) { ?>
138
+                <li>Requests created: <?=number_format($RequestsCreated)?> for <?=Format::get_size($RequestsCreatedSpent)?>
139
+                </li>
140
+                <li>Requests voted: <?=number_format($RequestsVoted)?> for <?=Format::get_size($TotalSpent)?>
141
+                </li>
142
+                <?php } elseif ($ViewAll) { ?>
143
+                <li>
144
+                        <span<?=($ViewCount === 2 ? ' class="paranoia_override"' : '')?>>Requests
145
+                                created: <?=number_format($RequestsCreated)?></span>
146
+                                <span<?=($ViewBounty === 2 ? ' class="paranoia_override"' : '')?>>
147
+                                        for <?=Format::get_size($RequestsCreatedSpent)?></span>
148
+                                        <a href="requests.php?type=created&amp;userid=<?=$UserID?>"
149
+                                                class="brackets<?=($ViewAll === 2 ? ' paranoia_override' : '')?>">View</a>
150
+                </li>
151
+                <li>
152
+                        <span<?=($ViewCount === 2 ? ' class="paranoia_override"' : '')?>>Requests
153
+                                voted: <?=number_format($RequestsVoted)?></span>
154
+                                <span<?=($ViewBounty === 2 ? ' class="paranoia_override"' : '')?>>
155
+                                        for <?=Format::get_size($TotalSpent)?></span>
156
+                                        <a href="requests.php?type=voted&amp;userid=<?=$UserID?>"
157
+                                                class="brackets<?=($ViewAll === 2 ? ' paranoia_override' : '')?>">View</a>
158
+                </li>
159
+                <?php
126
   }
160
   }
127
 
161
 
128
   if ($Override = check_paranoia_here('screenshotcount')) {
162
   if ($Override = check_paranoia_here('screenshotcount')) {
129
-  $DB->query("
163
+      $DB->query("
130
     SELECT COUNT(*)
164
     SELECT COUNT(*)
131
     FROM torrents_doi
165
     FROM torrents_doi
132
     WHERE UserID = '$UserID'");
166
     WHERE UserID = '$UserID'");
133
-  list($Screenshots) = $DB->next_record();
134
-?>
135
-        <li id="comm_screenshots">Screenshots added: <?=number_format($Screenshots)?></li>
136
-<?
167
+      list($Screenshots) = $DB->next_record(); ?>
168
+                <li id="comm_screenshots">Screenshots added: <?=number_format($Screenshots)?>
169
+                </li>
170
+                <?php
137
   }
171
   }
138
 
172
 
139
   if ($Override = check_paranoia_here('uploads+')) { ?>
173
   if ($Override = check_paranoia_here('uploads+')) { ?>
140
-        <li id="comm_upload"<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Uploaded: <?=number_format($Uploads)?>
141
-<?php if ($Override = check_paranoia_here('uploads')) { ?>
142
-          <a href="torrents.php?type=uploaded&amp;userid=<?=$UserID?>" class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>">View</a>
143
-<?php if (check_perms('zip_downloader')) { ?>
144
-          <a href="torrents.php?action=redownload&amp;type=uploads&amp;userid=<?=$UserID?>" onclick="return confirm('If you no longer have the content, your ratio WILL be affected; be sure to check the size of all torrents before redownloading.');" class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>">Download</a>
145
-<?
174
+                <li id="comm_upload" <?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Uploaded:
175
+                        <?=number_format($Uploads)?>
176
+                        <?php if ($Override = check_paranoia_here('uploads')) { ?>
177
+                        <a href="torrents.php?type=uploaded&amp;userid=<?=$UserID?>"
178
+                                class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>">View</a>
179
+                        <?php if (check_perms('zip_downloader')) { ?>
180
+                        <a href="torrents.php?action=redownload&amp;type=uploads&amp;userid=<?=$UserID?>"
181
+                                onclick="return confirm('If you no longer have the content, your ratio WILL be affected; be sure to check the size of all torrents before redownloading.');"
182
+                                class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>">Download</a>
183
+                        <?php
146
             }
184
             }
147
           }
185
           }
148
 ?>
186
 ?>
149
-        </li>
150
-<?
187
+                </li>
188
+                <?php
151
   }
189
   }
152
   if ($Override = check_paranoia_here('uniquegroups+')) { ?>
190
   if ($Override = check_paranoia_here('uniquegroups+')) { ?>
153
-        <li id="comm_uniquegroup"<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Unique groups: <?=number_format($UniqueGroups)?>
154
-<?php if ($Override = check_paranoia_here('uniquegroups')) { ?>
155
-          <a href="torrents.php?type=uploaded&amp;userid=<?=$UserID?>&amp;filter=uniquegroup" class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>">View</a>
156
-<?php } ?>
157
-        </li>
158
-<?
191
+                <li id="comm_uniquegroup" <?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Unique
192
+                        groups: <?=number_format($UniqueGroups)?>
193
+                        <?php if ($Override = check_paranoia_here('uniquegroups')) { ?>
194
+                        <a href="torrents.php?type=uploaded&amp;userid=<?=$UserID?>&amp;filter=uniquegroup"
195
+                                class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>">View</a>
196
+                        <?php } ?>
197
+                </li>
198
+                <?php
159
   }
199
   }
160
   if ($Override = check_paranoia_here('seeding+')) {
200
   if ($Override = check_paranoia_here('seeding+')) {
161
-?>
162
-        <li id="comm_seeding"<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Seeding:
163
-          <span class="user_commstats" id="user_commstats_seeding"><a href="#" class="brackets" onclick="commStats(<?=$UserID?>); return false;">Show stats</a></span>
164
-<?php if ($Override = check_paranoia_here('snatched+')) { ?>
165
-          <span<?=($Override === 2 ? ' class="paranoia_override"' : '')?> id="user_commstats_seedingperc"></span>
166
-<?
201
+      ?>
202
+                <li id="comm_seeding" <?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Seeding:
203
+                        <span class="user_commstats" id="user_commstats_seeding"><a href="#" class="brackets"
204
+                                        onclick="commStats(<?=$UserID?>); return false;">Show
205
+                                        stats</a></span>
206
+                        <?php if ($Override = check_paranoia_here('snatched+')) { ?>
207
+                        <span<?=($Override === 2 ? ' class="paranoia_override"' : '')?>
208
+                                id="user_commstats_seedingperc"></span>
209
+                                <?php
167
     }
210
     }
168
-    if ($Override = check_paranoia_here('seeding')) {
169
-?>
170
-          <a href="torrents.php?type=seeding&amp;userid=<?=$UserID?>" class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>">View</a>
171
-<?php if (check_perms('zip_downloader')) { ?>
172
-          <a href="torrents.php?action=redownload&amp;type=seeding&amp;userid=<?=$UserID?>" onclick="return confirm('If you no longer have the content, your ratio WILL be affected; be sure to check the size of all torrents before redownloading.');" class="brackets">Download</a>
173
-<?
211
+      if ($Override = check_paranoia_here('seeding')) {
212
+          ?>
213
+                                <a href="torrents.php?type=seeding&amp;userid=<?=$UserID?>"
214
+                                        class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>">View</a>
215
+                                <?php if (check_perms('zip_downloader')) { ?>
216
+                                <a href="torrents.php?action=redownload&amp;type=seeding&amp;userid=<?=$UserID?>"
217
+                                        onclick="return confirm('If you no longer have the content, your ratio WILL be affected; be sure to check the size of all torrents before redownloading.');"
218
+                                        class="brackets">Download</a>
219
+                                <?php
174
       }
220
       }
175
-    }
176
-?>
177
-        </li>
178
-<?
221
+      } ?>
222
+                </li>
223
+                <?php
179
   }
224
   }
180
   if ($Override = check_paranoia_here('leeching+')) {
225
   if ($Override = check_paranoia_here('leeching+')) {
181
-?>
182
-        <li id="comm_leeching"<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Leeching:
183
-          <span class="user_commstats" id="user_commstats_leeching"><a href="#" class="brackets" onclick="commStats(<?=$UserID?>); return false;">Show stats</a></span>
184
-<?php if ($Override = check_paranoia_here('leeching')) { ?>
185
-          <a href="torrents.php?type=leeching&amp;userid=<?=$UserID?>" class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>">View</a>
186
-<?
226
+      ?>
227
+                <li id="comm_leeching" <?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Leeching:
228
+                        <span class="user_commstats" id="user_commstats_leeching"><a href="#" class="brackets"
229
+                                        onclick="commStats(<?=$UserID?>); return false;">Show
230
+                                        stats</a></span>
231
+                        <?php if ($Override = check_paranoia_here('leeching')) { ?>
232
+                        <a href="torrents.php?type=leeching&amp;userid=<?=$UserID?>"
233
+                                class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>">View</a>
234
+                        <?php
187
     }
235
     }
188
-    if ($DisableLeech == 0 && check_perms('users_view_ips')) {
189
-?>
190
-          <strong>(Disabled)</strong>
191
-<?php } ?>
192
-        </li>
193
-<?
236
+      if ($DisableLeech == 0 && check_perms('users_view_ips')) {
237
+          ?>
238
+                        <strong>(Disabled)</strong>
239
+                        <?php
240
+      } ?>
241
+                </li>
242
+                <?php
194
   }
243
   }
195
   if ($Override = check_paranoia_here('snatched+')) { ?>
244
   if ($Override = check_paranoia_here('snatched+')) { ?>
196
-        <li id="comm_snatched"<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Snatched:
197
-          <span class="user_commstats" id="user_commstats_snatched"><a href="#" class="brackets" onclick="commStats(<?=$UserID?>); return false;">Show stats</a></span>
198
-<?php if ($Override = check_perms('site_view_torrent_snatchlist', $Class)) { ?>
199
-          <span id="user_commstats_usnatched"<?=($Override === 2 ? ' class="paranoia_override"' : '')?>></span>
200
-<?
245
+                <li id="comm_snatched" <?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Snatched:
246
+                        <span class="user_commstats" id="user_commstats_snatched"><a href="#" class="brackets"
247
+                                        onclick="commStats(<?=$UserID?>); return false;">Show
248
+                                        stats</a></span>
249
+                        <?php if ($Override = check_perms('site_view_torrent_snatchlist', $Class)) { ?>
250
+                        <span id="user_commstats_usnatched" <?=($Override === 2 ? ' class="paranoia_override"' : '')?>></span>
251
+                        <?php
201
     }
252
     }
202
   }
253
   }
203
   if ($Override = check_paranoia_here('snatched')) { ?>
254
   if ($Override = check_paranoia_here('snatched')) { ?>
204
-          <a href="torrents.php?type=snatched&amp;userid=<?=$UserID?>" class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>">View</a>
205
-<?php if (check_perms('zip_downloader')) { ?>
206
-          <a href="torrents.php?action=redownload&amp;type=snatches&amp;userid=<?=$UserID?>" onclick="return confirm('If you no longer have the content, your ratio WILL be affected, be sure to check the size of all torrents before redownloading.');" class="brackets">Download</a>
207
-<?php } ?>
208
-        </li>
209
-<?
255
+                        <a href="torrents.php?type=snatched&amp;userid=<?=$UserID?>"
256
+                                class="brackets<?=($Override === 2 ? ' paranoia_override' : '')?>">View</a>
257
+                        <?php if (check_perms('zip_downloader')) { ?>
258
+                        <a href="torrents.php?action=redownload&amp;type=snatches&amp;userid=<?=$UserID?>"
259
+                                onclick="return confirm('If you no longer have the content, your ratio WILL be affected, be sure to check the size of all torrents before redownloading.');"
260
+                                class="brackets">Download</a>
261
+                        <?php } ?>
262
+                </li>
263
+                <?php
210
   }
264
   }
211
   if (check_perms('site_view_torrent_snatchlist', $Class)) {
265
   if (check_perms('site_view_torrent_snatchlist', $Class)) {
212
-?>
213
-        <li id="comm_downloaded">Downloaded:
214
-          <span class="user_commstats" id="user_commstats_downloaded"><a href="#" class="brackets" onclick="commStats(<?=$UserID?>); return false;">Show stats</a></span>
215
-          <span id="user_commstats_udownloaded"></span>
216
-          <a href="torrents.php?type=downloaded&amp;userid=<?=$UserID?>" class="brackets">View</a>
217
-        </li>
218
-<?
266
+      ?>
267
+                <li id="comm_downloaded">Downloaded:
268
+                        <span class="user_commstats" id="user_commstats_downloaded"><a href="#" class="brackets"
269
+                                        onclick="commStats(<?=$UserID?>); return false;">Show
270
+                                        stats</a></span>
271
+                        <span id="user_commstats_udownloaded"></span>
272
+                        <a href="torrents.php?type=downloaded&amp;userid=<?=$UserID?>"
273
+                                class="brackets">View</a>
274
+                </li>
275
+                <?php
219
   }
276
   }
220
   if ($Override = check_paranoia_here('invitedcount')) {
277
   if ($Override = check_paranoia_here('invitedcount')) {
221
-  $DB->query("
278
+      $DB->query("
222
     SELECT COUNT(UserID)
279
     SELECT COUNT(UserID)
223
     FROM users_info
280
     FROM users_info
224
     WHERE Inviter = '$UserID'");
281
     WHERE Inviter = '$UserID'");
225
-  list($Invited) = $DB->next_record();
226
-?>
227
-        <li id="comm_invited">Invited: <?=number_format($Invited)?></li>
228
-<?
282
+      list($Invited) = $DB->next_record(); ?>
283
+                <li id="comm_invited">Invited: <?=number_format($Invited)?>
284
+                </li>
285
+                <?php
229
   }
286
   }
230
 ?>
287
 ?>
231
-      </ul>
232
-<?php if ($LoggedUser['AutoloadCommStats']) { ?>
233
-      <script type="text/javascript">
234
-        commStats(<?=$UserID?>);
235
-      </script>
236
-<?php } ?>
237
-    </div>
288
+        </ul>
289
+        <?php if ($LoggedUser['AutoloadCommStats']) { ?>
290
+        <script type="text/javascript">
291
+                commStats( <?=$UserID?> );
292
+        </script>
293
+        <?php } ?>
294
+</div>

+ 13
- 12
sections/user/delete_invite.php View File

1
-<?
1
+<?php
2
+declare(strict_types=1);
3
+
2
 authorize();
4
 authorize();
3
 
5
 
4
 $InviteKey = db_string($_GET['invite']);
6
 $InviteKey = db_string($_GET['invite']);
8
   WHERE InviteKey = ?", $InviteKey);
10
   WHERE InviteKey = ?", $InviteKey);
9
 list($UserID) = $DB->next_record();
11
 list($UserID) = $DB->next_record();
10
 if (!$DB->has_results()) {
12
 if (!$DB->has_results()) {
11
-  error(404);
13
+    error(404);
12
 }
14
 }
13
 if ($UserID != $LoggedUser['ID'] && $LoggedUser['PermissionID'] != SYSOP) {
15
 if ($UserID != $LoggedUser['ID'] && $LoggedUser['PermissionID'] != SYSOP) {
14
-  error(403);
16
+    error(403);
15
 }
17
 }
16
 
18
 
17
 $DB->query("
19
 $DB->query("
19
   WHERE InviteKey = ?", $InviteKey);
21
   WHERE InviteKey = ?", $InviteKey);
20
 
22
 
21
 if (!check_perms('site_send_unlimited_invites')) {
23
 if (!check_perms('site_send_unlimited_invites')) {
22
-  $DB->query("
24
+    $DB->query("
23
     SELECT Invites
25
     SELECT Invites
24
     FROM users_main
26
     FROM users_main
25
     WHERE ID = ?
27
     WHERE ID = ?
26
     LIMIT 1", $UserID);
28
     LIMIT 1", $UserID);
27
-  list($Invites) = $DB->next_record();
28
-  if ($Invites < 10) {
29
-    $DB->query("
29
+    list($Invites) = $DB->next_record();
30
+    if ($Invites < 10) {
31
+        $DB->query("
30
       UPDATE users_main
32
       UPDATE users_main
31
       SET Invites = Invites + 1
33
       SET Invites = Invites + 1
32
       WHERE ID = ?", $UserID);
34
       WHERE ID = ?", $UserID);
33
-    $Cache->begin_transaction("user_info_heavy_$UserID");
34
-    $Cache->update_row(false, ['Invites' => '+1']);
35
-    $Cache->commit_transaction(0);
36
-  }
35
+        $Cache->begin_transaction("user_info_heavy_$UserID");
36
+        $Cache->update_row(false, ['Invites' => '+1']);
37
+        $Cache->commit_transaction(0);
38
+    }
37
 }
39
 }
38
 header('Location: user.php?action=invite');
40
 header('Location: user.php?action=invite');
39
-?>

+ 18
- 16
sections/user/donor_stats.php View File

1
-<?
1
+<?php
2
+declare(strict_types=1);
3
+
2
 if (check_perms('users_mod') || $OwnProfile || Donations::is_visible($UserID)) { ?>
4
 if (check_perms('users_mod') || $OwnProfile || Donations::is_visible($UserID)) { ?>
3
-  <div class="box box_info box_userinfo_donor_stats">
4
-    <div class="head colhead_dark">Donor Statistics</div>
5
-    <ul class="stats nobullet">
6
-      <li>
7
-        Total donor points: <?=Donations::get_total_rank($UserID)?>
8
-      </li>
9
-      <li>
10
-        Current donor rank: <?=Donations::render_rank(Donations::get_rank($UserID), true)?>
11
-      </li>
12
-      <li>
13
-        Last donated: <?=time_diff(Donations::get_donation_time($UserID))?>
14
-      </li>
15
-    </ul>
16
-  </div>
17
-<?
5
+<div class="box box_info box_userinfo_donor_stats">
6
+  <div class="head colhead_dark">Donor Statistics</div>
7
+  <ul class="stats nobullet">
8
+    <li>
9
+      Total donor points: <?=Donations::get_total_rank($UserID)?>
10
+    </li>
11
+    <li>
12
+      Current donor rank: <?=Donations::render_rank(Donations::get_rank($UserID), true)?>
13
+    </li>
14
+    <li>
15
+      Last donated: <?=time_diff(Donations::get_donation_time($UserID))?>
16
+    </li>
17
+  </ul>
18
+</div>
19
+<?php
18
 }
20
 }

+ 0
- 3
sections/user/lastfm.php View File

1
-<?php
2
-#declare(strict_types=1);
3
-

+ 12
- 11
sections/user/manage_linked.php View File

1
-<?
1
+<?php
2
+declare(strict_types=1);
3
+
2
 authorize();
4
 authorize();
3
 include(SERVER_ROOT.'/sections/user/linkedfunctions.php');
5
 include(SERVER_ROOT.'/sections/user/linkedfunctions.php');
4
 
6
 
5
 if (!check_perms('users_mod')) {
7
 if (!check_perms('users_mod')) {
6
-  error(403);
8
+    error(403);
7
 }
9
 }
8
 
10
 
9
 $UserID = (int) $_REQUEST['userid'];
11
 $UserID = (int) $_REQUEST['userid'];
15
 
17
 
16
   case 'update':
18
   case 'update':
17
     if ($_REQUEST['target']) {
19
     if ($_REQUEST['target']) {
18
-      $Target = $_REQUEST['target'];
19
-      $DB->query("
20
+        $Target = $_REQUEST['target'];
21
+        $DB->query("
20
         SELECT ID
22
         SELECT ID
21
         FROM users_main
23
         FROM users_main
22
         WHERE Username LIKE '".db_string($Target)."'");
24
         WHERE Username LIKE '".db_string($Target)."'");
23
-      if (list($TargetID) = $DB->next_record()) {
24
-        link_users($UserID, $TargetID);
25
-      } else {
26
-        error("User '$Target' not found.");
27
-      }
25
+        if (list($TargetID) = $DB->next_record()) {
26
+            link_users($UserID, $TargetID);
27
+        } else {
28
+            error("User '$Target' not found.");
29
+        }
28
     }
30
     }
29
 
31
 
30
     $DB->query("
32
     $DB->query("
34
     list($GroupID) = $DB->next_record();
36
     list($GroupID) = $DB->next_record();
35
 
37
 
36
     if ($_REQUEST['dupecomments'] && $GroupID) {
38
     if ($_REQUEST['dupecomments'] && $GroupID) {
37
-      dupe_comments($GroupID, $_REQUEST['dupecomments']);
39
+        dupe_comments($GroupID, $_REQUEST['dupecomments']);
38
     }
40
     }
39
     break;
41
     break;
40
 
42
 
43
 }
45
 }
44
 echo '\o/';
46
 echo '\o/';
45
 header("Location: user.php?id=$UserID");
47
 header("Location: user.php?id=$UserID");
46
-?>

+ 61
- 46
sections/user/permissions.php View File

1
-<?
1
+<?php
2
+declare(strict_types=1);
3
+
2
 // todo: Redo HTML
4
 // todo: Redo HTML
3
 if (!check_perms('admin_manage_permissions')) {
5
 if (!check_perms('admin_manage_permissions')) {
4
-  error(403);
6
+    error(403);
5
 }
7
 }
6
 if (!isset($_REQUEST['userid']) || !is_number($_REQUEST['userid'])) {
8
 if (!isset($_REQUEST['userid']) || !is_number($_REQUEST['userid'])) {
7
-  error(404);
9
+    error(404);
8
 }
10
 }
9
 
11
 
10
 include(SERVER_ROOT."/classes/permissions_form.php");
12
 include(SERVER_ROOT."/classes/permissions_form.php");
23
 
25
 
24
 $Delta = [];
26
 $Delta = [];
25
 if (isset($_POST['action'])) {
27
 if (isset($_POST['action'])) {
26
-  authorize();
28
+    authorize();
27
 
29
 
28
-  foreach ($PermissionsArray as $Perm => $Explaination) {
29
-    $Setting = isset($_POST["perm_$Perm"]) ? 1 : 0;
30
-    $Default = isset($Defaults[$Perm]) ? 1 : 0;
31
-    if ($Setting != $Default) {
32
-      $Delta[$Perm] = $Setting;
30
+    foreach ($PermissionsArray as $Perm => $Explaination) {
31
+        $Setting = isset($_POST["perm_$Perm"]) ? 1 : 0;
32
+        $Default = isset($Defaults[$Perm]) ? 1 : 0;
33
+        if ($Setting != $Default) {
34
+            $Delta[$Perm] = $Setting;
35
+        }
33
     }
36
     }
34
-  }
35
-  if (!is_number($_POST['maxcollages']) && !empty($_POST['maxcollages'])) {
36
-    error("Please enter a valid number of extra personal collages");
37
-  }
38
-  $Delta['MaxCollages'] = $_POST['maxcollages'];
37
+    if (!is_number($_POST['maxcollages']) && !empty($_POST['maxcollages'])) {
38
+        error("Please enter a valid number of extra personal collages");
39
+    }
40
+    $Delta['MaxCollages'] = $_POST['maxcollages'];
39
 
41
 
40
-  $Cache->begin_transaction("user_info_heavy_$UserID");
41
-  $Cache->update_row(false, array('CustomPermissions' => $Delta));
42
-  $Cache->commit_transaction(0);
43
-  $DB->query("
42
+    $Cache->begin_transaction("user_info_heavy_$UserID");
43
+    $Cache->update_row(false, array('CustomPermissions' => $Delta));
44
+    $Cache->commit_transaction(0);
45
+    $DB->query("
44
     UPDATE users_main
46
     UPDATE users_main
45
     SET CustomPermissions = '".db_string(serialize($Delta))."'
47
     SET CustomPermissions = '".db_string(serialize($Delta))."'
46
     WHERE ID = '$UserID'");
48
     WHERE ID = '$UserID'");
47
 } elseif (!empty($Customs)) {
49
 } elseif (!empty($Customs)) {
48
-  $Delta = unserialize($Customs);
50
+    $Delta = unserialize($Customs);
49
 }
51
 }
50
 
52
 
51
 $Permissions = array_merge($Defaults, $Delta);
53
 $Permissions = array_merge($Defaults, $Delta);
52
 $MaxCollages = $Customs['MaxCollages'] + $Delta['MaxCollages'];
54
 $MaxCollages = $Customs['MaxCollages'] + $Delta['MaxCollages'];
53
 
55
 
54
-function display_perm($Key, $Title) {
55
-  global $Defaults, $Permissions;
56
-  $Perm = "<input id=\"default_$Key\" type=\"checkbox\" disabled=\"disabled\"";
57
-  if (isset($Defaults[$Key]) && $Defaults[$Key]) {
58
-    $Perm .= ' checked="checked"';
59
-  }
60
-  $Perm .= " /><input type=\"checkbox\" name=\"perm_$Key\" id=\"$Key\" value=\"1\"";
61
-  if (isset($Permissions[$Key]) && $Permissions[$Key]) {
62
-    $Perm .= ' checked="checked"';
63
-  }
64
-  $Perm .= " /> <label for=\"$Key\">$Title</label><br />";
65
-  echo "$Perm\n";
56
+function display_perm($Key, $Title)
57
+{
58
+    global $Defaults, $Permissions;
59
+    $Perm = "<input id=\"default_$Key\" type=\"checkbox\" disabled=\"disabled\"";
60
+    if (isset($Defaults[$Key]) && $Defaults[$Key]) {
61
+        $Perm .= ' checked="checked"';
62
+    }
63
+    $Perm .= " /><input type=\"checkbox\" name=\"perm_$Key\" id=\"$Key\" value=\"1\"";
64
+    if (isset($Permissions[$Key]) && $Permissions[$Key]) {
65
+        $Perm .= ' checked="checked"';
66
+    }
67
+    $Perm .= " /> <label for=\"$Key\">$Title</label><br />";
68
+    echo "$Perm\n";
66
 }
69
 }
67
 
70
 
68
 View::show_header("$Username &gt; Permissions");
71
 View::show_header("$Username &gt; Permissions");
69
 ?>
72
 ?>
70
-<script type="text/javascript">//<![CDATA[
71
-function reset() {
72
-  for (i = 0; i < $('#permissionsform').raw().elements.length; i++) {
73
-    element = $('#permissionsform').raw().elements[i];
74
-    if (element.id.substr(0, 8) == 'default_') {
75
-      $('#' + element.id.substr(8)).raw().checked = element.checked;
73
+<script type="text/javascript">
74
+  //<![CDATA[
75
+  function reset() {
76
+    for (i = 0; i < $('#permissionsform').raw().elements.length; i++) {
77
+      element = $('#permissionsform').raw().elements[i];
78
+      if (element.id.substr(0, 8) == 'default_') {
79
+        $('#' + element.id.substr(8)).raw().checked = element.checked;
80
+      }
76
     }
81
     }
77
   }
82
   }
78
-}
79
-//]]>
83
+  //]]>
80
 </script>
84
 </script>
81
 <div class="header">
85
 <div class="header">
82
-  <h2><?=Users::format_username($UserID, false, false, false)?> &gt; Permissions</h2>
86
+  <h2><?=Users::format_username($UserID, false, false, false)?> &gt;
87
+    Permissions</h2>
83
   <div class="linkbox">
88
   <div class="linkbox">
84
     <a href="#" onclick="reset(); return false;" class="brackets">Defaults</a>
89
     <a href="#" onclick="reset(); return false;" class="brackets">Defaults</a>
85
   </div>
90
   </div>
86
 </div>
91
 </div>
87
 <div class="box pad">
92
 <div class="box pad">
88
-  <p>Before using permissions, please understand that it allows you to both add and remove access to specific features. If you think that to add access to a feature, you need to uncheck everything else, <strong>YOU ARE WRONG</strong>. The check boxes on the left, which are grayed out, are the standard permissions granted by their class (and donor/artist status). Any changes you make to the right side will overwrite this. It's not complicated, and if you screw up, click the "Defaults" link at the top. It will reset the user to their respective features granted by class, then you can select or deselect the one or two things you want to change. <strong>DO NOT DESELECT EVERYTHING.</strong> If you need further clarification, ask a developer before using this tool.</p>
93
+  <p>Before using permissions, please understand that it allows you to both add and remove access to specific features.
94
+    If you think that to add access to a feature, you need to uncheck everything else, <strong>YOU ARE WRONG</strong>.
95
+    The check boxes on the left, which are grayed out, are the standard permissions granted by their class (and
96
+    donor/artist status). Any changes you make to the right side will overwrite this. It's not complicated, and if you
97
+    screw up, click the "Defaults" link at the top. It will reset the user to their respective features granted by
98
+    class, then you can select or deselect the one or two things you want to change. <strong>DO NOT DESELECT
99
+      EVERYTHING.</strong> If you need further clarification, ask a developer before using this tool.</p>
89
 </div>
100
 </div>
90
 <br />
101
 <br />
91
 <form class="manage_form" name="permissions" id="permissionsform" method="post" action="">
102
 <form class="manage_form" name="permissions" id="permissionsform" method="post" action="">
92
   <table class="layout permission_head">
103
   <table class="layout permission_head">
93
     <tr>
104
     <tr>
94
       <td class="label">Extra personal collages</td>
105
       <td class="label">Extra personal collages</td>
95
-      <td><input type="text" name="maxcollages" size="5" value="<?=($MaxCollages ? $MaxCollages : '0') ?>" /></td>
106
+      <td><input type="text" name="maxcollages" size="5"
107
+          value="<?=($MaxCollages ? $MaxCollages : '0') ?>" />
108
+      </td>
96
     </tr>
109
     </tr>
97
   </table>
110
   </table>
98
   <input type="hidden" name="action" value="permissions" />
111
   <input type="hidden" name="action" value="permissions" />
99
-  <input type="hidden" name="auth" value="<?=$LoggedUser['AuthKey']?>" />
100
-  <input type="hidden" name="id" value="<?=$_REQUEST['userid']?>" />
101
-<?
112
+  <input type="hidden" name="auth"
113
+    value="<?=$LoggedUser['AuthKey']?>" />
114
+  <input type="hidden" name="id"
115
+    value="<?=$_REQUEST['userid']?>" />
116
+  <?php
102
 permissions_form();
117
 permissions_form();
103
 ?>
118
 ?>
104
 </form>
119
 </form>
105
-<? View::show_footer(); ?>
120
+<?php View::show_footer();

+ 54
- 51
sections/user/points.php View File

1
-<?
2
-$Amount = (int) db_string($_POST['amount']);
1
+<?php
2
+declare(strict_types=1);$Amount = (int) db_string($_POST['amount']);
3
 $To = (int) db_string($_POST['to']);
3
 $To = (int) db_string($_POST['to']);
4
 $UserID = (int) $LoggedUser['ID'];
4
 $UserID = (int) $LoggedUser['ID'];
5
 $Adjust = isset($_POST['adjust'])?true:false;
5
 $Adjust = isset($_POST['adjust'])?true:false;
9
 $Tax = 0.1;
9
 $Tax = 0.1;
10
 
10
 
11
 if ($LoggedUser['DisablePoints']) {
11
 if ($LoggedUser['DisablePoints']) {
12
-  $Err = 'You are not allowed to send '.BONUS_POINTS.'.';
12
+    $Err = 'You are not allowed to send '.BONUS_POINTS.'.';
13
 } else {
13
 } else {
14
-  if ($Adjust)
15
-    $Amount = $Amount/(1-$Tax);
14
+    if ($Adjust) {
15
+        $Amount = $Amount/(1-$Tax);
16
+    }
16
 
17
 
17
-  $SentAmount = (int) ($Amount*(1-$Tax));
18
+    $SentAmount = (int) ($Amount*(1-$Tax));
18
 
19
 
19
-  $Amount = (int) $Amount;
20
+    $Amount = (int) $Amount;
20
 
21
 
21
-  if ($UserID == $To) {
22
-    $Err = 'If you sent '.BONUS_POINTS.' to yourself it wouldn\'t even do anything. Stop that.';
23
-  } elseif ($Amount < 0) {
24
-    $Err = 'You can\'t send a negative amount of '.BONUS_POINTS.'.';
25
-  } elseif ($Amount < 100) {
26
-    $Err = 'You must send at least 100 '.BONUS_POINTS.'.';
27
-  } else {
28
-    $DB->query("
22
+    if ($UserID == $To) {
23
+        $Err = 'If you sent '.BONUS_POINTS.' to yourself it wouldn\'t even do anything. Stop that.';
24
+    } elseif ($Amount < 0) {
25
+        $Err = 'You can\'t send a negative amount of '.BONUS_POINTS.'.';
26
+    } elseif ($Amount < 100) {
27
+        $Err = 'You must send at least 100 '.BONUS_POINTS.'.';
28
+    } else {
29
+        $DB->query("
29
       SELECT ui.DisablePoints
30
       SELECT ui.DisablePoints
30
       FROM users_main AS um
31
       FROM users_main AS um
31
         JOIN users_info AS ui ON um.ID = ui.UserID
32
         JOIN users_info AS ui ON um.ID = ui.UserID
32
       WHERE ID = $To");
33
       WHERE ID = $To");
33
-    if (!$DB->has_results()) {
34
-      $Err = 'That user doesn\'t exist.';
35
-    } else {
36
-      list($Disabled) = $DB->next_record();
37
-      if ($Disabled) {
38
-        $Err = "This user is not allowed to receive ".BONUS_POINTS.".";
39
-      } else {
40
-        $DB->query("
34
+        if (!$DB->has_results()) {
35
+            $Err = 'That user doesn\'t exist.';
36
+        } else {
37
+            list($Disabled) = $DB->next_record();
38
+            if ($Disabled) {
39
+                $Err = "This user is not allowed to receive ".BONUS_POINTS.".";
40
+            } else {
41
+                $DB->query("
41
           SELECT BonusPoints
42
           SELECT BonusPoints
42
           FROM users_main
43
           FROM users_main
43
           WHERE ID = $UserID");
44
           WHERE ID = $UserID");
44
-        if ($DB->has_results()) {
45
-          list($BP) = $DB->next_record();
45
+                if ($DB->has_results()) {
46
+                    list($BP) = $DB->next_record();
46
 
47
 
47
-          if ($BP < $Amount) {
48
-            $Err = 'You don\'t have enough '.BONUS_POINTS.'.';
49
-          } else {
50
-            $DB->query("
48
+                    if ($BP < $Amount) {
49
+                        $Err = 'You don\'t have enough '.BONUS_POINTS.'.';
50
+                    } else {
51
+                        $DB->query("
51
               UPDATE users_main
52
               UPDATE users_main
52
               SET BonusPoints = BonusPoints - $Amount
53
               SET BonusPoints = BonusPoints - $Amount
53
               WHERE ID = $UserID");
54
               WHERE ID = $UserID");
54
-            $DB->query("
55
+                        $DB->query("
55
               UPDATE users_main
56
               UPDATE users_main
56
               SET BonusPoints = BonusPoints + ".$SentAmount."
57
               SET BonusPoints = BonusPoints + ".$SentAmount."
57
               WHERE ID = $To");
58
               WHERE ID = $To");
58
 
59
 
59
-            $UserInfo = Users::user_info($UserID);
60
-            $ToInfo = Users::user_info($To);
60
+                        $UserInfo = Users::user_info($UserID);
61
+                        $ToInfo = Users::user_info($To);
61
 
62
 
62
-            $DB->query("
63
+                        $DB->query("
63
               UPDATE users_info
64
               UPDATE users_info
64
               SET AdminComment = CONCAT('".sqltime()." - Sent $Amount ".BONUS_POINTS." (".$SentAmount." after tax) to [user]".$ToInfo['Username']."[/user]\n\n', AdminComment)
65
               SET AdminComment = CONCAT('".sqltime()." - Sent $Amount ".BONUS_POINTS." (".$SentAmount." after tax) to [user]".$ToInfo['Username']."[/user]\n\n', AdminComment)
65
               WHERE UserID = $UserID");
66
               WHERE UserID = $UserID");
66
-            $DB->query("
67
+                        $DB->query("
67
               UPDATE users_info
68
               UPDATE users_info
68
               SET AdminComment = CONCAT('".sqltime()." - Received ".$SentAmount." ".BONUS_POINTS." from [user]".$UserInfo['Username']."[/user]\n\n', AdminComment)
69
               SET AdminComment = CONCAT('".sqltime()." - Received ".$SentAmount." ".BONUS_POINTS." from [user]".$UserInfo['Username']."[/user]\n\n', AdminComment)
69
               WHERE UserID = $To");
70
               WHERE UserID = $To");
70
 
71
 
71
-            $PM = '[user]'.$UserInfo['Username'].'[/user] has sent you a gift of '.$SentAmount.' '.BONUS_POINTS.'!';
72
+                        $PM = '[user]'.$UserInfo['Username'].'[/user] has sent you a gift of '.$SentAmount.' '.BONUS_POINTS.'!';
72
 
73
 
73
-            if (!empty($Message)) {
74
-              $PM .= "\n\n".'[quote='.$UserInfo['Username'].']'.$Message.'[/quote]';
75
-            }
74
+                        if (!empty($Message)) {
75
+                            $PM .= "\n\n".'[quote='.$UserInfo['Username'].']'.$Message.'[/quote]';
76
+                        }
76
 
77
 
77
-            Misc::send_pm($To, 0, 'You\'ve received a gift!', $PM);
78
+                        Misc::send_pm($To, 0, 'You\'ve received a gift!', $PM);
78
 
79
 
79
-            $Cache->delete_value('user_info_heavy_'.$UserID);
80
-            $Cache->delete_value('user_stats_'.$UserID);
81
-            $Cache->delete_value('user_info_heavy_'.$To);
82
-            $Cache->delete_value('user_stats_'.$To);
83
-          }
84
-        } else {
85
-          $Err = 'An unknown error occurred.';
80
+                        $Cache->delete_value('user_info_heavy_'.$UserID);
81
+                        $Cache->delete_value('user_stats_'.$UserID);
82
+                        $Cache->delete_value('user_info_heavy_'.$To);
83
+                        $Cache->delete_value('user_stats_'.$To);
84
+                    }
85
+                } else {
86
+                    $Err = 'An unknown error occurred.';
87
+                }
88
+            }
86
         }
89
         }
87
-      }
88
     }
90
     }
89
-  }
90
 }
91
 }
91
 
92
 
92
 View::show_header('Send '.BONUS_POINTS); ?>
93
 View::show_header('Send '.BONUS_POINTS); ?>
93
 <div>
94
 <div>
94
-  <h2 id='general'>Send <?=BONUS_POINTS?></h2>
95
+  <h2 id='general'>Send <?=BONUS_POINTS?>
96
+  </h2>
95
   <div class='box pad' style='padding: 10px 10px 10px 20p;'>
97
   <div class='box pad' style='padding: 10px 10px 10px 20p;'>
96
-    <p><?=$Err?'Error: '.$Err:'Sent '.$Amount.' '.BONUS_POINTS.' ('.$SentAmount.' after tax) to '.$ToInfo['Username'].'.'?></p>
98
+    <p><?=$Err?'Error: '.$Err:'Sent '.$Amount.' '.BONUS_POINTS.' ('.$SentAmount.' after tax) to '.$ToInfo['Username'].'.'?>
99
+    </p>
97
     <p><a href='/user.php?id=<?=$To?>'>Return</a></p>
100
     <p><a href='/user.php?id=<?=$To?>'>Return</a></p>
98
   </div>
101
   </div>
99
 </div>
102
 </div>
100
-<? View::show_footer(); ?>
103
+<?php View::show_footer();

+ 0
- 5
staffblog.php View File

1
-<?php
2
-declare(strict_types=1);
3
-
4
-define('ERROR_EXCEPTION', true);
5
-require_once 'classes/script_start.php';

+ 0
- 4
testing.php View File

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

Loading…
Cancel
Save