Browse Source

Prefer require_once in non-entry-points

spaghetti 1 year ago
parent
commit
83c5b4fae3

+ 1
- 1
classes/autoenable.class.php View File

@@ -119,7 +119,7 @@ class AutoEnable {
119 119
 
120 120
         if ($Status != self::DISCARDED) {
121 121
             // Prepare email
122
-            require(SERVER_ROOT . '/classes/templates.class.php');
122
+            require_once(SERVER_ROOT . '/classes/templates.class.php');
123 123
             $TPL = NEW TEMPLATE;
124 124
             if ($Status == self::APPROVED) {
125 125
                 $TPL->open(SERVER_ROOT . '/templates/enable_request_accepted.tpl');

+ 2
- 2
classes/users.class.php View File

@@ -656,7 +656,7 @@ class Users {
656 656
         ResetKey = '" . db_string($ResetKey) . "',
657 657
         ResetExpires = '" . time_plus(60 * 60) . "'
658 658
       WHERE UserID = '$UserID'");
659
-    require(SERVER_ROOT . '/classes/templates.class.php');
659
+    require_once(SERVER_ROOT . '/classes/templates.class.php');
660 660
     $TPL = NEW TEMPLATE;
661 661
     $TPL->open(SERVER_ROOT . '/templates/password_reset.tpl'); // Password reset template
662 662
     $TPL->set('Username', $Username);
@@ -680,7 +680,7 @@ class Users {
680 680
   public static function auth_location($UserID, $Username, $ASN, $Email) {
681 681
     $AuthKey = Users::make_secret();
682 682
     G::$Cache->cache_value('new_location_'.$AuthKey, ['UserID'=>$UserID, 'ASN'=>$ASN], 3600*2);
683
-    require(SERVER_ROOT . '/classes/templates.class.php');
683
+    require_once(SERVER_ROOT . '/classes/templates.class.php');
684 684
     $TPL = NEW TEMPLATE;
685 685
     $TPL->open(SERVER_ROOT . '/templates/new_location.tpl');
686 686
     $TPL->set('Username', $Username);

+ 4
- 4
feeds.php View File

@@ -11,11 +11,11 @@ if (isset($_GET['clearcache'])) {
11 11
   unset($_GET['clearcache']);
12 12
 }
13 13
 
14
-require 'classes/config.php'; // The config contains all site-wide configuration information as well as memcached rules
14
+require_once('classes/config.php'); // The config contains all site-wide configuration information as well as memcached rules
15 15
 
16
-require(SERVER_ROOT.'/classes/misc.class.php'); // Require the misc class
17
-require(SERVER_ROOT.'/classes/cache.class.php'); // Require the caching class
18
-require(SERVER_ROOT.'/classes/feed.class.php'); // Require the feeds class
16
+require_once(SERVER_ROOT.'/classes/misc.class.php'); // Require the misc class
17
+require_once(SERVER_ROOT.'/classes/cache.class.php'); // Require the caching class
18
+require_once(SERVER_ROOT.'/classes/feed.class.php'); // Require the feeds class
19 19
 $Cache = new Cache(MEMCACHED_SERVERS); // Load the caching class
20 20
 $Feed = new FEED; // Load the time class
21 21
 

+ 6
- 6
sections/feeds/index.php View File

@@ -23,7 +23,7 @@ if (
23 23
 $User = (int)$_GET['user'];
24 24
 
25 25
 if (!$Enabled = $Cache->get_value("enabled_$User")) {
26
-  require(SERVER_ROOT.'/classes/mysql.class.php');
26
+  require_once(SERVER_ROOT.'/classes/mysql.class.php');
27 27
   $DB = NEW DB_MYSQL; //Load the database wrapper
28 28
   $DB->query("
29 29
     SELECT Enabled
@@ -40,13 +40,13 @@ if (md5($User.RSS_HASH.$_GET['passkey']) !== $_GET['auth'] || $Enabled != 1) {
40 40
   die();
41 41
 }
42 42
 
43
-require(SERVER_ROOT.'/classes/text.class.php');
43
+require_once(SERVER_ROOT.'/classes/text.class.php');
44 44
 $Feed->open_feed();
45 45
 switch ($_GET['feed']) {
46 46
   case 'feed_news':
47 47
     $Feed->channel('News', 'RSS feed for site news.');
48 48
     if (!$News = $Cache->get_value('news')) {
49
-      require(SERVER_ROOT.'/classes/mysql.class.php'); //Require the database wrapper
49
+      require_once(SERVER_ROOT.'/classes/mysql.class.php'); //Require the database wrapper
50 50
       $DB = NEW DB_MYSQL; //Load the database wrapper
51 51
       $DB->query("
52 52
         SELECT
@@ -75,7 +75,7 @@ switch ($_GET['feed']) {
75 75
   case 'feed_blog':
76 76
     $Feed->channel('Blog', 'RSS feed for site blog.');
77 77
     if (!$Blog = $Cache->get_value('blog')) {
78
-      require(SERVER_ROOT.'/classes/mysql.class.php'); //Require the database wrapper
78
+      require_once(SERVER_ROOT.'/classes/mysql.class.php'); //Require the database wrapper
79 79
       $DB = NEW DB_MYSQL; //Load the database wrapper
80 80
       $DB->query("
81 81
         SELECT
@@ -105,8 +105,8 @@ switch ($_GET['feed']) {
105 105
   case 'feed_changelog':
106 106
     $Feed->channel('Gazelle Change Log', 'RSS feed for Gazelle\'s changelog.');
107 107
     if (!$Changelog = $Cache->get_value('changelog')) {
108
-      require(SERVER_ROOT.'/classes/mysql.class.php');
109
-      require(SERVER_ROOT.'/classes/misc.class.php');
108
+      require_once(SERVER_ROOT.'/classes/mysql.class.php');
109
+      require_once(SERVER_ROOT.'/classes/misc.class.php');
110 110
 
111 111
       $DB = NEW DB_MYSQL;
112 112
       $DB->query("

+ 1
- 1
sections/torrents/edit.php View File

@@ -8,7 +8,7 @@
8 8
 // most members.                                                        //
9 9
 //**********************************************************************//
10 10
 
11
-require(SERVER_ROOT.'/classes/torrent_form.class.php');
11
+require_once(SERVER_ROOT.'/classes/torrent_form.class.php');
12 12
 
13 13
 if (!is_number($_GET['id']) || !$_GET['id']) {
14 14
   error(0);

+ 1
- 1
sections/torrents/takeedit.php View File

@@ -9,7 +9,7 @@
9 9
 enforce_login();
10 10
 authorize();
11 11
 
12
-require(SERVER_ROOT.'/classes/validate.class.php');
12
+require_once(SERVER_ROOT.'/classes/validate.class.php');
13 13
 
14 14
 $Validate = new VALIDATE;
15 15
 

+ 1
- 1
sections/torrents/takemasspm.php View File

@@ -10,7 +10,7 @@ authorize();
10 10
 
11 11
 enforce_login();
12 12
 
13
-require(SERVER_ROOT.'/classes/validate.class.php');
13
+require_once(SERVER_ROOT.'/classes/validate.class.php');
14 14
 $Validate = new VALIDATE;
15 15
 
16 16
 $TorrentID = (int)$_POST['torrentid'];

+ 1
- 1
sections/upload/upload.php View File

@@ -76,7 +76,7 @@ if (!empty($ArtistForm)) {
76 76
   $Properties['Artists'] = $ArtistForm;
77 77
 }
78 78
 
79
-require(SERVER_ROOT.'/classes/torrent_form.class.php');
79
+require_once(SERVER_ROOT.'/classes/torrent_form.class.php');
80 80
 $TorrentForm = new TorrentForm($Properties ?? false, $Err ?? false);
81 81
 
82 82
 $GenreTags = $Cache->get_value('genre_tags');

+ 2
- 2
sections/user/2fa.php View File

@@ -1,6 +1,6 @@
1 1
 <?
2
-require(SERVER_ROOT.'/classes/twofa.class.php');
3
-require(SERVER_ROOT.'/classes/u2f.class.php');
2
+require_once(SERVER_ROOT.'/classes/twofa.class.php');
3
+require_once(SERVER_ROOT.'/classes/u2f.class.php');
4 4
 
5 5
 $TwoFA = new TwoFactorAuth(SITE_NAME);
6 6
 $U2F = new u2f\U2F('https://'.SITE_DOMAIN);

+ 1
- 1
sections/user/edit.php View File

@@ -1,5 +1,5 @@
1 1
 <?
2
-require(SERVER_ROOT.'/classes/twofa.class.php');
2
+require_once(SERVER_ROOT.'/classes/twofa.class.php');
3 3
 $UserID = $_REQUEST['userid'];
4 4
 if (!is_number($UserID)) {
5 5
   error(404);

Loading…
Cancel
Save