From 4f006bc149618062620a16a3757bdd6953a39fcd Mon Sep 17 00:00:00 2001 From: stronk7 Date: Sun, 16 May 2004 10:26:04 +0000 Subject: [PATCH] Added support for CFG->forcelogin in some files. Bug 1396 (http://moodle.org/bugs/bug.php?op=show&bugid=1396) --- course/category.php | 9 ++++++--- course/info.php | 4 ++++ course/search.php | 4 ++++ doc/contents.php | 4 ++++ doc/index.php | 4 ++++ doc/top.php | 4 ++++ doc/view.php | 4 ++++ user/pix.php | 4 ++++ user/pixgroup.php | 4 ++++ 9 files changed, 38 insertions(+), 3 deletions(-) diff --git a/course/category.php b/course/category.php index 096cf0de4d..0b91c17f50 100644 --- a/course/category.php +++ b/course/category.php @@ -3,18 +3,21 @@ // In editing mode, allows the admin to edit a category, // and rearrange courses - require_once("../config.php"); - require_once("lib.php"); + require_once("../config.php"); + require_once("lib.php"); require_variable($id); // Category id optional_variable($page, "0"); // which page to show optional_variable($perpage, "20"); // how many per page - if (!$site = get_site()) { error("Site isn't defined!"); } + if ($CFG->forcelogin) { + require_login(); + } + if (!$category = get_record("course_categories", "id", $id)) { error("Category not known!"); } diff --git a/course/info.php b/course/info.php index eda6423218..7baae3b2cc 100644 --- a/course/info.php +++ b/course/info.php @@ -24,6 +24,10 @@ $site = get_site(); + if ($CFG->forcelogin) { + require_login(); + } + if (empty($THEME->custompix)) { $pixpath = "$CFG->wwwroot/pix"; } else { diff --git a/course/search.php b/course/search.php index 8eac25f971..9a5d4843d6 100644 --- a/course/search.php +++ b/course/search.php @@ -23,6 +23,10 @@ $site = get_site(); + if ($CFG->forcelogin) { + require_login(); + } + $displaylist = array(); $parentlist = array(); make_categories_list($displaylist, $parentlist, ""); diff --git a/doc/contents.php b/doc/contents.php index bbde6f7797..f101a467ab 100755 --- a/doc/contents.php +++ b/doc/contents.php @@ -6,6 +6,10 @@ error("404 - File Not Found"); } + if ($CFG->forcelogin) { + require_login(); + } + include($info->filepath); print_header(); diff --git a/doc/index.php b/doc/index.php index a73030b188..46be9c2742 100644 --- a/doc/index.php +++ b/doc/index.php @@ -7,6 +7,10 @@ optional_variable($sub, ""); // sub-section (named anchor) optional_variable($lang, ""); // override current language + if ($CFG->forcelogin) { + require_login(); + } + if (!empty($lang)) { $SESSION->lang = $lang; } diff --git a/doc/top.php b/doc/top.php index 1618cdef51..bef501e38a 100644 --- a/doc/top.php +++ b/doc/top.php @@ -2,6 +2,10 @@ require("../config.php"); + if ($CFG->forcelogin) { + require_login(); + } + if (empty($CFG->langmenu)) { $langmenu = ""; } else { diff --git a/doc/view.php b/doc/view.php index 088c59f306..f3efc204c6 100644 --- a/doc/view.php +++ b/doc/view.php @@ -7,6 +7,10 @@ $file = clean_filename($file); + if ($CFG->forcelogin) { + require_login(); + } + if ($id) { if (! $course = get_record("course", "id", $id)) { error("Course is misconfigured"); diff --git a/user/pix.php b/user/pix.php index 9792148938..0929d942f5 100644 --- a/user/pix.php +++ b/user/pix.php @@ -9,6 +9,10 @@ $lifetime = 86400; + if ($CFG->forcelogin) { + require_login(); + } + if (isset($file)) { // workaround for situations where / syntax doesn't work $pathinfo = $file; diff --git a/user/pixgroup.php b/user/pixgroup.php index c5505a204c..53654f782d 100644 --- a/user/pixgroup.php +++ b/user/pixgroup.php @@ -9,6 +9,10 @@ $lifetime = 86400; + if ($CFG->forcelogin) { + require_login(); + } + if (isset($file)) { // workaround for situations where / syntax doesn't work $pathinfo = $file; -- 2.39.5