diff --git a/admin/uploadpicture_form.php b/admin/uploadpicture_form.php
index 9ed7d1c6a6d..5c4a1e9e81f 100644
--- a/admin/uploadpicture_form.php
+++ b/admin/uploadpicture_form.php
@@ -1,28 +1,33 @@
libdir.'/formslib.php';
- class admin_uploadpicture_form extends moodleform {
- function definition (){
- global $CFG, $USER;
-
- $mform =& $this->_form;
-
- $this->set_upload_manager(new upload_manager('userpicturesfile', false, false, null, false, 0, true, true, false));
-
- $mform->addElement('header', 'settingsheader', get_string('upload'));
-
- $mform->addElement('file', 'userpicturesfile', get_string('file'), 'size="40"');
- $mform->addRule('userpicturesfile', null, 'required');
+if (!defined('MOODLE_INTERNAL')) {
+ die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
+}
- $choices =& $this->_customdata;
- $mform->addElement('select', 'userfield', get_string('uploadpicture_userfield', 'admin'), $choices);
- $mform->setType('userfield', PARAM_INT);
+require_once $CFG->libdir.'/formslib.php';
- $choices = array( 0 => get_string('no'), 1 => get_string('yes') );
- $mform->addElement('select', 'overwritepicture', get_string('uploadpicture_overwrite', 'admin'), $choices);
- $mform->setType('overwritepicture', PARAM_INT);
-
- $this->add_action_buttons(false, get_string('uploadpictures', 'admin'));
- }
+class admin_uploadpicture_form extends moodleform {
+ function definition (){
+ global $CFG, $USER;
+
+ $mform =& $this->_form;
+
+ $this->set_upload_manager(new upload_manager('userpicturesfile', false, false, null, false, 0, true, true, false));
+
+ $mform->addElement('header', 'settingsheader', get_string('upload'));
+
+ $mform->addElement('file', 'userpicturesfile', get_string('file'), 'size="40"');
+ $mform->addRule('userpicturesfile', null, 'required');
+
+ $choices =& $this->_customdata;
+ $mform->addElement('select', 'userfield', get_string('uploadpicture_userfield', 'admin'), $choices);
+ $mform->setType('userfield', PARAM_INT);
+
+ $choices = array( 0 => get_string('no'), 1 => get_string('yes') );
+ $mform->addElement('select', 'overwritepicture', get_string('uploadpicture_overwrite', 'admin'), $choices);
+ $mform->setType('overwritepicture', PARAM_INT);
+
+ $this->add_action_buttons(false, get_string('uploadpictures', 'admin'));
}
+}
?>
diff --git a/admin/uploaduser_form.php b/admin/uploaduser_form.php
index 79559a68cb6..e142b01ceb8 100644
--- a/admin/uploaduser_form.php
+++ b/admin/uploaduser_form.php
@@ -1,4 +1,9 @@
libdir.'/formslib.php';
class admin_uploaduser_form1 extends moodleform {
diff --git a/blog/edit_form.php b/blog/edit_form.php
index 9723a317364..64a73965282 100644
--- a/blog/edit_form.php
+++ b/blog/edit_form.php
@@ -1,5 +1,9 @@
libdir.'/formslib.php');
class blog_edit_form extends moodleform {
diff --git a/course/delete_category_form.php b/course/delete_category_form.php
index 8e63d9f18da..96df9604a35 100644
--- a/course/delete_category_form.php
+++ b/course/delete_category_form.php
@@ -1,5 +1,9 @@
libdir.'/formslib.php');
require_once($CFG->libdir . '/questionlib.php');
diff --git a/course/edit_form.php b/course/edit_form.php
index 2738e51695a..8f4018e7d84 100644
--- a/course/edit_form.php
+++ b/course/edit_form.php
@@ -1,5 +1,9 @@
libdir.'/formslib.php');
class course_edit_form extends moodleform {
diff --git a/course/moodleform_mod.php b/course/moodleform_mod.php
index 37e15c322b2..21c1d9fc73b 100644
--- a/course/moodleform_mod.php
+++ b/course/moodleform_mod.php
@@ -1,4 +1,9 @@
libdir.'/formslib.php');
/**
* This class adds extra methods to form wrapper specific to be used for module
diff --git a/course/recent_form.php b/course/recent_form.php
index 05ce8433a21..beb08bc53c6 100644
--- a/course/recent_form.php
+++ b/course/recent_form.php
@@ -1,5 +1,9 @@
libdir.'/formslib.php');
class recent_form extends moodleform {
diff --git a/course/request_form.php b/course/request_form.php
index 98a74ef27a8..142b24a0092 100644
--- a/course/request_form.php
+++ b/course/request_form.php
@@ -31,6 +31,10 @@
* @package course
*//** */
+if (!defined('MOODLE_INTERNAL')) {
+ die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
+}
+
require_once($CFG->libdir.'/formslib.php');
/**
diff --git a/course/reset_form.php b/course/reset_form.php
index ce0fe4c0822..ba0227ee710 100644
--- a/course/reset_form.php
+++ b/course/reset_form.php
@@ -1,4 +1,8 @@
libdir.'/formslib.php';
class course_reset_form extends moodleform {
diff --git a/grade/edit/letter/edit_form.php b/grade/edit/letter/edit_form.php
index 03c1f86c388..822814289d4 100644
--- a/grade/edit/letter/edit_form.php
+++ b/grade/edit/letter/edit_form.php
@@ -16,6 +16,10 @@
// along with Moodle. If not, see .
+if (!defined('MOODLE_INTERNAL')) {
+ die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
+}
+
require_once $CFG->libdir.'/formslib.php';
class edit_letter_form extends moodleform {
diff --git a/grade/edit/outcome/edit_form.php b/grade/edit/outcome/edit_form.php
index 06a0364ea81..5bccdb410ea 100644
--- a/grade/edit/outcome/edit_form.php
+++ b/grade/edit/outcome/edit_form.php
@@ -16,6 +16,10 @@
// along with Moodle. If not, see .
+if (!defined('MOODLE_INTERNAL')) {
+ die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
+}
+
require_once $CFG->libdir.'/formslib.php';
class edit_outcome_form extends moodleform {
diff --git a/grade/edit/scale/edit_form.php b/grade/edit/scale/edit_form.php
index 48230625400..6a01fd4e562 100644
--- a/grade/edit/scale/edit_form.php
+++ b/grade/edit/scale/edit_form.php
@@ -16,6 +16,10 @@
// along with Moodle. If not, see .
+if (!defined('MOODLE_INTERNAL')) {
+ die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
+}
+
require_once $CFG->libdir.'/formslib.php';
class edit_scale_form extends moodleform {
diff --git a/grade/edit/settings/form.php b/grade/edit/settings/form.php
index c3d8b40986a..54b35372285 100644
--- a/grade/edit/settings/form.php
+++ b/grade/edit/settings/form.php
@@ -15,6 +15,10 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+if (!defined('MOODLE_INTERNAL')) {
+ die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
+}
+
require_once($CFG->libdir.'/formslib.php');
/**
diff --git a/grade/edit/tree/calculation_form.php b/grade/edit/tree/calculation_form.php
index 6ed382fd13a..6b3754bf9cd 100644
--- a/grade/edit/tree/calculation_form.php
+++ b/grade/edit/tree/calculation_form.php
@@ -15,6 +15,10 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+if (!defined('MOODLE_INTERNAL')) {
+ die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
+}
+
require_once $CFG->libdir.'/formslib.php';
class edit_calculation_form extends moodleform {
diff --git a/grade/edit/tree/category_form.php b/grade/edit/tree/category_form.php
index 1a9b8dbca3c..69238e30717 100644
--- a/grade/edit/tree/category_form.php
+++ b/grade/edit/tree/category_form.php
@@ -15,6 +15,10 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+if (!defined('MOODLE_INTERNAL')) {
+ die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
+}
+
require_once $CFG->libdir.'/formslib.php';
class edit_category_form extends moodleform {
diff --git a/grade/edit/tree/grade_form.php b/grade/edit/tree/grade_form.php
index b794d40c1ad..9c387010447 100755
--- a/grade/edit/tree/grade_form.php
+++ b/grade/edit/tree/grade_form.php
@@ -15,6 +15,10 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+if (!defined('MOODLE_INTERNAL')) {
+ die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
+}
+
require_once $CFG->libdir.'/formslib.php';
class edit_grade_form extends moodleform {
diff --git a/grade/edit/tree/outcomeitem_form.php b/grade/edit/tree/outcomeitem_form.php
index f0561d11d7e..e36f0da9706 100644
--- a/grade/edit/tree/outcomeitem_form.php
+++ b/grade/edit/tree/outcomeitem_form.php
@@ -15,6 +15,10 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+if (!defined('MOODLE_INTERNAL')) {
+ die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
+}
+
require_once $CFG->libdir.'/formslib.php';
class edit_outcomeitem_form extends moodleform {
diff --git a/grade/export/grade_export_form.php b/grade/export/grade_export_form.php
index 84a65064398..2b83815f2cb 100755
--- a/grade/export/grade_export_form.php
+++ b/grade/export/grade_export_form.php
@@ -15,6 +15,10 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+if (!defined('MOODLE_INTERNAL')) {
+ die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
+}
+
require_once $CFG->libdir.'/formslib.php';
class grade_export_form extends moodleform {
diff --git a/grade/import/grade_import_form.php b/grade/import/grade_import_form.php
index 99a15ed0538..3d74664b2f3 100755
--- a/grade/import/grade_import_form.php
+++ b/grade/import/grade_import_form.php
@@ -15,6 +15,10 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see .
+if (!defined('MOODLE_INTERNAL')) {
+ die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
+}
+
require_once $CFG->libdir.'/formslib.php';
require_once($CFG->libdir.'/gradelib.php');
diff --git a/lib/formslib.php b/lib/formslib.php
index 2af556db195..2ae3891a86d 100644
--- a/lib/formslib.php
+++ b/lib/formslib.php
@@ -20,6 +20,11 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
+if (!defined('MOODLE_INTERNAL')) {
+ die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
+}
+
+
//setup.php icludes our hacked pear libs first
require_once 'HTML/QuickForm.php';
require_once 'HTML/QuickForm/DHTMLRulesTableless.php';
diff --git a/login/change_password_form.php b/login/change_password_form.php
index d1dbdabe222..aacbeaabdd2 100644
--- a/login/change_password_form.php
+++ b/login/change_password_form.php
@@ -1,5 +1,9 @@
libdir.'/formslib.php';
class login_change_password_form extends moodleform {
diff --git a/login/restored_password_form.php b/login/restored_password_form.php
index 3e004b276e1..d8839202e0b 100644
--- a/login/restored_password_form.php
+++ b/login/restored_password_form.php
@@ -11,6 +11,10 @@
// part of each plugin, but now now. See MDL-20846
// for the rationale for this implementation.
+if (!defined('MOODLE_INTERNAL')) {
+ die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
+}
+
require_once $CFG->libdir.'/formslib.php';
class login_forgot_password_form extends moodleform {
diff --git a/login/signup_form.php b/login/signup_form.php
index f38318916dd..b96e1ae6646 100644
--- a/login/signup_form.php
+++ b/login/signup_form.php
@@ -1,5 +1,9 @@
libdir.'/formslib.php');
require_once($CFG->dirroot.'/user/profile/lib.php');
diff --git a/mod/forum/post_form.php b/mod/forum/post_form.php
index 44cdb38fd01..81400290d94 100644
--- a/mod/forum/post_form.php
+++ b/mod/forum/post_form.php
@@ -1,5 +1,9 @@
libdir.'/formslib.php');
class mod_forum_post_form extends moodleform {
diff --git a/mod/glossary/comment_form.php b/mod/glossary/comment_form.php
index 67579010e85..10a7309f642 100644
--- a/mod/glossary/comment_form.php
+++ b/mod/glossary/comment_form.php
@@ -1,5 +1,9 @@
libdir.'/formslib.php';
class mod_glossary_comment_form extends moodleform {
@@ -30,4 +34,4 @@ class mod_glossary_comment_form extends moodleform {
$this->add_action_buttons(false);
}
}
-?>
\ No newline at end of file
+?>
diff --git a/notes/edit_form.php b/notes/edit_form.php
index 7a94d5bd488..511678921df 100644
--- a/notes/edit_form.php
+++ b/notes/edit_form.php
@@ -1,5 +1,9 @@
libdir.'/formslib.php');
class note_edit_form extends moodleform {
@@ -31,4 +35,4 @@ class note_edit_form extends moodleform {
$mform->setType('id', PARAM_INT);
}
}
-?>
\ No newline at end of file
+?>
diff --git a/question/category_form.php b/question/category_form.php
index e028d8319ca..57cade3fd1c 100644
--- a/question/category_form.php
+++ b/question/category_form.php
@@ -1,5 +1,9 @@
libdir.'/formslib.php');
class question_category_edit_form extends moodleform {
diff --git a/question/contextmove_form.php b/question/contextmove_form.php
index 0ae9b591fd2..5a6b2799d8b 100644
--- a/question/contextmove_form.php
+++ b/question/contextmove_form.php
@@ -1,5 +1,9 @@
libdir.'/formslib.php');
class question_context_move_form extends moodleform {
diff --git a/question/contextmoveq_form.php b/question/contextmoveq_form.php
index 732ad5cdfe6..bfc3fc003ea 100644
--- a/question/contextmoveq_form.php
+++ b/question/contextmoveq_form.php
@@ -1,5 +1,9 @@
libdir.'/formslib.php');
class question_context_move_question_form extends moodleform {
diff --git a/question/export_form.php b/question/export_form.php
index e7c6c56fa82..95a71908931 100644
--- a/question/export_form.php
+++ b/question/export_form.php
@@ -1,5 +1,9 @@
libdir.'/formslib.php');
class question_export_form extends moodleform {
diff --git a/question/import_form.php b/question/import_form.php
index 38d5429e92b..108846bffc1 100644
--- a/question/import_form.php
+++ b/question/import_form.php
@@ -1,5 +1,9 @@
libdir.'/formslib.php');
class question_import_form extends moodleform {
diff --git a/question/move_form.php b/question/move_form.php
index 01a0870a1a8..d2b6445d55c 100644
--- a/question/move_form.php
+++ b/question/move_form.php
@@ -1,5 +1,9 @@
libdir.'/formslib.php');
class question_move_form extends moodleform {