Browse Source

Prefer require_once in non-entry-points

spaghetti 7 years ago
parent
commit
83c5b4fae3

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

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

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

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

+ 4
- 4
feeds.php View File

11
   unset($_GET['clearcache']);
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
 $Cache = new Cache(MEMCACHED_SERVERS); // Load the caching class
19
 $Cache = new Cache(MEMCACHED_SERVERS); // Load the caching class
20
 $Feed = new FEED; // Load the time class
20
 $Feed = new FEED; // Load the time class
21
 
21
 

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

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

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

8
 // most members.                                                        //
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
 if (!is_number($_GET['id']) || !$_GET['id']) {
13
 if (!is_number($_GET['id']) || !$_GET['id']) {
14
   error(0);
14
   error(0);

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

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

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

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

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

76
   $Properties['Artists'] = $ArtistForm;
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
 $TorrentForm = new TorrentForm($Properties ?? false, $Err ?? false);
80
 $TorrentForm = new TorrentForm($Properties ?? false, $Err ?? false);
81
 
81
 
82
 $GenreTags = $Cache->get_value('genre_tags');
82
 $GenreTags = $Cache->get_value('genre_tags');

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

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
 $TwoFA = new TwoFactorAuth(SITE_NAME);
5
 $TwoFA = new TwoFactorAuth(SITE_NAME);
6
 $U2F = new u2f\U2F('https://'.SITE_DOMAIN);
6
 $U2F = new u2f\U2F('https://'.SITE_DOMAIN);

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

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

Loading…
Cancel
Save