Permalink
Browse files

MDL-22388 Added some checks to kill these scripts dead with an unequi…

…vocal notice unless included properly from a Moodle script.
  • Loading branch information...
1 parent ae46b1f commit 03b8bc9bf3f3dee0676061637db3d1eb40ffb37e @moodler moodler committed May 13, 2010
@@ -1,28 +1,33 @@
<?php // $Id$
- require_once $CFG->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');
-
- $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'));
- }
+
+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 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'));
}
+}
?>
@@ -1,4 +1,9 @@
<?php // $Id$
+
+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 admin_uploaduser_form1 extends moodleform {
View
@@ -1,5 +1,9 @@
<?php // $Id$
+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 blog_edit_form extends moodleform {
@@ -1,5 +1,9 @@
<?php //$Id$
+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 . '/questionlib.php');
View
@@ -1,5 +1,9 @@
<?php //$Id$
+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 course_edit_form extends moodleform {
@@ -1,4 +1,9 @@
<?php
+
+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');
/**
* This class adds extra methods to form wrapper specific to be used for module
View
@@ -1,5 +1,9 @@
<?php //$$
+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 recent_form extends moodleform {
View
@@ -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');
/**
View
@@ -1,4 +1,8 @@
<?php // $Id$
+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 course_reset_form extends moodleform {
@@ -16,6 +16,10 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+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 {
@@ -16,6 +16,10 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+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 {
@@ -16,6 +16,10 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+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 {
@@ -15,6 +15,10 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+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');
/**
@@ -15,6 +15,10 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+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 {
@@ -15,6 +15,10 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+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 {
@@ -15,6 +15,10 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+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 {
@@ -15,6 +15,10 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+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 {
@@ -15,6 +15,10 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+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 {
@@ -15,6 +15,10 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+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');
View
@@ -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';
@@ -1,5 +1,9 @@
<?php //$Id$
+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_change_password_form extends moodleform {
@@ -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 {
View
@@ -1,5 +1,9 @@
<?php // $Id$
+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->dirroot.'/user/profile/lib.php');
View
@@ -1,5 +1,9 @@
<?php // $Id$
+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 mod_forum_post_form extends moodleform {
@@ -1,5 +1,9 @@
<?php //$Id$
+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 mod_glossary_comment_form extends moodleform {
@@ -30,4 +34,4 @@ function definition() {
$this->add_action_buttons(false);
}
}
-?>
+?>
View
@@ -1,5 +1,9 @@
<?php // $Id$
+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 note_edit_form extends moodleform {
@@ -31,4 +35,4 @@ function definition() {
$mform->setType('id', PARAM_INT);
}
}
-?>
+?>
@@ -1,5 +1,9 @@
<?php // $Id$
+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 question_category_edit_form extends moodleform {
@@ -1,5 +1,9 @@
<?php // $Id$
+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 question_context_move_form extends moodleform {
@@ -1,5 +1,9 @@
<?php // $Id$
+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 question_context_move_question_form extends moodleform {
View
@@ -1,5 +1,9 @@
<?php // $Id$
+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 question_export_form extends moodleform {
View
@@ -1,5 +1,9 @@
<?php // $Id$
+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 question_import_form extends moodleform {
View
@@ -1,5 +1,9 @@
<?php // $Id$
+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 question_move_form extends moodleform {

0 comments on commit 03b8bc9

Please sign in to comment.