From 78bfb562a020da658a4e626fd117b50b38b9f56f Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Sun, 25 Jul 2010 13:35:05 +0000 Subject: [PATCH] MDL-21249 improved php docs and adding direct access prevention in core libs --- blocks/edit_form.php | 7 ++++--- blocks/moodleblock.class.php | 5 +++-- lib/accesslib.php | 9 ++++++--- lib/adminlib.php | 9 ++++++--- lib/authlib.php | 9 ++++++--- lib/blocklib.php | 11 +++++++---- lib/clilib.php | 4 +++- lib/completionlib.php | 23 +++++++++++++---------- lib/componentlib.class.php | 4 +++- lib/conditionlib.php | 9 ++++++--- lib/configonlylib.php | 10 +++++----- lib/csvlib.class.php | 9 ++++++--- lib/customcheckslib.php | 9 ++++++--- lib/datalib.php | 9 ++++++--- lib/ddllib.php | 6 ++++-- lib/deprecatedlib.php | 8 +++++--- lib/dmllib.php | 6 ++++-- lib/dtllib.php | 6 ++++-- lib/eaccelerator.class.php | 9 ++++++--- lib/editorlib.php | 2 ++ lib/enrollib.php | 8 +++++--- lib/environmentlib.php | 13 ++++++++----- lib/eventslib.php | 9 ++++++--- lib/excellib.class.php | 11 +++++++---- lib/externallib.php | 5 +++-- lib/filelib.php | 2 +- lib/filterlib.php | 9 ++++++--- lib/formslib.php | 13 ++++++++----- lib/gdlib.php | 4 +++- lib/googleapi.php | 4 +++- lib/gradelib.php | 11 +++++++---- lib/graphlib.php | 9 ++++++--- lib/grouplib.php | 9 ++++++--- lib/javascript.php | 7 ++++--- lib/ldaplib.php | 13 ++++++++----- lib/licenselib.php | 12 +++++++----- lib/listlib.php | 9 ++++++--- lib/mathslib.php | 9 ++++++--- lib/memcached.class.php | 9 ++++++--- lib/messagelib.php | 9 ++++++--- lib/moodlelib.php | 9 ++++++--- lib/navigationlib.php | 10 ++++++---- lib/odslib.class.php | 9 ++++++--- lib/outputactions.php | 11 +++++++---- lib/outputcomponents.php | 8 +++++--- lib/outputfactories.php | 9 ++++++--- lib/outputlib.php | 9 ++++++--- lib/outputrenderers.php | 11 +++++++---- lib/outputrequirementslib.php | 9 ++++++--- lib/pagelib.php | 16 +++++++++------- lib/portfoliolib.php | 4 +++- lib/questionlib.php | 12 +++++++----- lib/resourcelib.php | 9 ++++++--- lib/rsslib.php | 9 ++++++--- lib/searchlib.php | 9 ++++++--- lib/sessionlib.php | 9 ++++++--- lib/setup.php | 7 ++++--- lib/setuplib.php | 9 ++++++--- lib/simpletestcoveragelib.php | 8 +++++--- lib/simpletestlib.php | 8 +++++--- lib/soaplib.php | 13 ++++++++----- lib/statslib.php | 9 ++++++--- lib/tablelib.php | 13 ++++++++----- lib/textlib.class.php | 9 ++++++--- lib/upgradelib.php | 4 +++- lib/uploadlib.php | 9 ++++++--- lib/weblib.php | 9 ++++++--- lib/wiki_to_markdown.php | 9 ++++++--- theme/yui_combo.php | 2 ++ theme/yui_image.php | 2 ++ 70 files changed, 388 insertions(+), 215 deletions(-) diff --git a/blocks/edit_form.php b/blocks/edit_form.php index 7ed14d7ea65..b0ad9755d95 100644 --- a/blocks/edit_form.php +++ b/blocks/edit_form.php @@ -21,9 +21,10 @@ * It works with the {@link block_edit_form} class, or rather the particular * subclass defined by this block, to do the editing. * - * @package moodlecore - * @copyright 2009 Tim Hunt - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage block + * @copyright 2009 Tim Hunt + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ if (!defined('MOODLE_INTERNAL')) { diff --git a/blocks/moodleblock.class.php b/blocks/moodleblock.class.php index a285ac2e6d9..36cf3edb14b 100644 --- a/blocks/moodleblock.class.php +++ b/blocks/moodleblock.class.php @@ -18,8 +18,9 @@ /** * This file contains the parent class for moodle blocks, block_base. * - * @license http://www.gnu.org/copyleft/gpl.html GNU Public License - * @package blocks + * @package core + * @subpackage block + * @license http://www.gnu.org/copyleft/gpl.html GNU Public License */ /// Constants diff --git a/lib/accesslib.php b/lib/accesslib.php index 3ebbf2e5fc0..325ebccdf43 100755 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -118,11 +118,14 @@ * DB need to ensure that the default role caps * are dealt with appropriately. * - * @package moodlecore - * @copyright 1999 onwards Martin Dougiamas http://dougiamas.com - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage role + * @copyright 1999 onwards Martin Dougiamas http://dougiamas.com + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** permission definitions */ define('CAP_INHERIT', 0); /** permission definitions */ diff --git a/lib/adminlib.php b/lib/adminlib.php index 50c84d3416c..d8f2cefebb4 100644 --- a/lib/adminlib.php +++ b/lib/adminlib.php @@ -97,11 +97,14 @@ * Original author: Vincenzo K. Marcovecchio * Maintainer: Petr Skoda * - * @package moodlecore - * @copyright 1999 onwards Martin Dougiamas http://dougiamas.com - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage admin + * @copyright 1999 onwards Martin Dougiamas http://dougiamas.com + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /// Add libraries require_once($CFG->libdir.'/ddllib.php'); require_once($CFG->libdir.'/xmlize.php'); diff --git a/lib/authlib.php b/lib/authlib.php index 7f2e9ef502f..48d1c37a288 100644 --- a/lib/authlib.php +++ b/lib/authlib.php @@ -20,11 +20,14 @@ * * 2006-08-28 File created, AUTH return values defined. * - * @package moodlecore - * @copyright 1999 onwards Martin Dougiamas http://dougiamas.com - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage auth + * @copyright 1999 onwards Martin Dougiamas http://dougiamas.com + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * Returned when the login was successful. */ diff --git a/lib/blocklib.php b/lib/blocklib.php index cc2d417b474..44666ebfa55 100644 --- a/lib/blocklib.php +++ b/lib/blocklib.php @@ -20,11 +20,14 @@ * * This file defines the {@link block_manager} class, * - * @package moodlecore - * @copyright 1999 onwards Martin Dougiamas http://dougiamas.com - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage block + * @copyright 1999 onwards Martin Dougiamas http://dougiamas.com + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /**#@+ * @deprecated since Moodle 2.0. No longer used. */ @@ -1353,7 +1356,7 @@ class block_manager { /** * Turns the display of normal blocks either on or off. - * + * * @param bool $setting */ public function show_only_fake_blocks($setting = true) { diff --git a/lib/clilib.php b/lib/clilib.php index d174051ad5c..d33145c50d0 100644 --- a/lib/clilib.php +++ b/lib/clilib.php @@ -18,12 +18,14 @@ /** * Command line utility functions and classes * - * @package moodlecore + * @package core * @subpackage cli * @copyright 2009 Petr Skoda (http://skodak.org) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * Get input from user * @param string $prompt text prompt, should include possible options diff --git a/lib/completionlib.php b/lib/completionlib.php index 6806eb2b7f7..b7972c634d8 100644 --- a/lib/completionlib.php +++ b/lib/completionlib.php @@ -15,23 +15,26 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -require_once $CFG->libdir.'/completion/completion_aggregation.php'; -require_once $CFG->libdir.'/completion/completion_criteria.php'; -require_once $CFG->libdir.'/completion/completion_completion.php'; -require_once $CFG->libdir.'/completion/completion_criteria_completion.php'; - - /** * Contains a class used for tracking whether activities have been completed * by students ('completion') * * Completion top-level options (admin setting enablecompletion) * - * @package moodlecore - * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage completion + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + +require_once $CFG->libdir.'/completion/completion_aggregation.php'; +require_once $CFG->libdir.'/completion/completion_criteria.php'; +require_once $CFG->libdir.'/completion/completion_completion.php'; +require_once $CFG->libdir.'/completion/completion_criteria_completion.php'; + + /** The completion system is enabled in this site/course */ define('COMPLETION_ENABLED', 1); /** The completion system is not enabled in this site/course */ @@ -110,7 +113,7 @@ define('COMPLETION_AGGREGATION_ANY', 2); * @package moodlecore */ class completion_info { - /** + /** * Course object passed during construction * @access private * @var object diff --git a/lib/componentlib.class.php b/lib/componentlib.class.php index 19ce9d1e2a9..b064161c51f 100644 --- a/lib/componentlib.class.php +++ b/lib/componentlib.class.php @@ -120,11 +120,13 @@ * * That's all! * - * @package moodlecore + * @package core * @copyright (C) 2001-3001 Eloy Lafuente (stronk7) {@link http://contiento.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * @global object $CFG * @name $CFG diff --git a/lib/conditionlib.php b/lib/conditionlib.php index 3d7fb585776..b4fa3195440 100644 --- a/lib/conditionlib.php +++ b/lib/conditionlib.php @@ -18,11 +18,14 @@ * Used for tracking conditions that apply before activities are displayed * to students ('conditional availability'). * - * @package moodlecore - * @copyright 1999 onwards Martin Dougiamas http://dougiamas.com - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage completion + * @copyright 1999 onwards Martin Dougiamas http://dougiamas.com + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** The activity is not displayed to students at all when conditions aren't met. */ define('CONDITION_STUDENTVIEW_HIDE',0); /** The activity is displayed to students as a greyed-out name, with informational diff --git a/lib/configonlylib.php b/lib/configonlylib.php index 25fda348ede..8d7dbf45d16 100644 --- a/lib/configonlylib.php +++ b/lib/configonlylib.php @@ -22,8 +22,8 @@ * before including main config.php. You can resume normal script operation * if you define ABORT_AFTER_CONFIG_CANCEL and require the setup.php * - * @package moodlecore - * @copyright 2009 petr Skoda (skodak) + * @package core + * @copyright 2009 Petr Skoda (skodak) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -82,7 +82,7 @@ function min_clean_param($value, $type) { * @return boolean, true if compression enabled */ function min_enable_zlib_compression() { - + if (headers_sent()) { return false; } @@ -102,7 +102,7 @@ function min_enable_zlib_compression() { } } } - + @ini_set('output_handler', ''); /* @@ -112,6 +112,6 @@ function min_enable_zlib_compression() { * so let's try some bigger sizes. */ @ini_set('zlib.output_compression', 65536); - + return true; } \ No newline at end of file diff --git a/lib/csvlib.class.php b/lib/csvlib.class.php index 5bf1d4f2d59..a5725203585 100644 --- a/lib/csvlib.class.php +++ b/lib/csvlib.class.php @@ -20,11 +20,14 @@ * You can have a rather longer description of the file as well, * if you like, and it can span multiple lines. * - * @copyright Petr Skoda - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - * @package moodlecore + * @package core + * @subpackage lib + * @copyright Petr Skoda + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * Utitily class for importing of CSV files. * @copyright Petr Skoda diff --git a/lib/customcheckslib.php b/lib/customcheckslib.php index 38eee30baaf..35f4698f2d4 100644 --- a/lib/customcheckslib.php +++ b/lib/customcheckslib.php @@ -27,11 +27,14 @@ * - true: if passed * - false: if failed * - * @package moodlecore - * @copyright (C) 2001-3001 Eloy Lafuente (stronk7) {@link http://contiento.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage admin + * @copyright (C) 2001-3001 Eloy Lafuente (stronk7) {@link http://contiento.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * This function will look for the risky PHP setting register_globals * in order to inform about. MDL-12914 diff --git a/lib/datalib.php b/lib/datalib.php index 0ac527d4d83..1de813b99e4 100644 --- a/lib/datalib.php +++ b/lib/datalib.php @@ -22,11 +22,14 @@ * - weblib.php - functions that produce web output * - moodlelib.php - general-purpose Moodle functions * - * @package moodlecore - * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage lib + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * The maximum courses in a category * MAX_COURSES_IN_CATEGORY * MAX_COURSE_CATEGORIES must not be more than max integer! diff --git a/lib/ddllib.php b/lib/ddllib.php index e603d66b750..6448d8dce3a 100644 --- a/lib/ddllib.php +++ b/lib/ddllib.php @@ -34,13 +34,15 @@ * * For further documentation, visit {@link http://docs.moodle.org/en/DDL_functions} * - * @package moodlecore - * @subpackage DDL + * @package core + * @subpackage ddl * @copyright 2001-3001 Eloy Lafuente (stronk7) http://contiento.com * 2008 Petr Skoda http://skodak.org * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + // Add required library require_once($CFG->libdir.'/xmlize.php'); diff --git a/lib/deprecatedlib.php b/lib/deprecatedlib.php index fc8347ddc4d..4f052c31f69 100644 --- a/lib/deprecatedlib.php +++ b/lib/deprecatedlib.php @@ -21,13 +21,15 @@ * Old functions retained only for backward compatibility. New code should not * use any of these functions. * - * @package moodlecore + * @package core * @subpackage deprecated - * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @deprecated */ +defined('MOODLE_INTERNAL') || die(); + /** * Given a physical path to a file, returns the URL through which it can be reached in Moodle. * diff --git a/lib/dmllib.php b/lib/dmllib.php index 7fdd3dfb0b6..8dd0fdeca6a 100644 --- a/lib/dmllib.php +++ b/lib/dmllib.php @@ -32,12 +32,14 @@ * http://docs.moodle.org/en/DML_functions * (feel free to modify, improve and document such page, thanks!) * - * @package moodlecore - * @subpackage DML + * @package core + * @subpackage dml * @copyright 2008 Petr Skoda (http://skodak.org) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + // Require the essential require_once($CFG->libdir.'/dml/moodle_database.php'); diff --git a/lib/dtllib.php b/lib/dtllib.php index 486508516cd..b3b4402f6c6 100644 --- a/lib/dtllib.php +++ b/lib/dtllib.php @@ -22,12 +22,14 @@ * This library includes all the required functions used to handle * transfer of data from one database to another. * - * @package moodlecore - * @subpackage DTL + * @package core + * @subpackage dtl * @copyright 2008 Andrei Bautu * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + // Require {@link ddllib.php} require_once($CFG->libdir.'/ddllib.php'); // Require {@link database_exporter.php} diff --git a/lib/eaccelerator.class.php b/lib/eaccelerator.class.php index 9636308e3d9..bde70b9b506 100644 --- a/lib/eaccelerator.class.php +++ b/lib/eaccelerator.class.php @@ -29,11 +29,14 @@ * memcached, a false value is indistinguisable from a * "not found in cache" response. * - * @copyright Martin Langhoff - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - * @package moodlecore + * @package core + * @subpackage lib + * @copyright Martin Langhoff + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * * @copyright Martin Langhoff diff --git a/lib/editorlib.php b/lib/editorlib.php index cbcc06e7048..4c73e1d3418 100644 --- a/lib/editorlib.php +++ b/lib/editorlib.php @@ -24,6 +24,8 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * Returns users preferred editor for given format * diff --git a/lib/enrollib.php b/lib/enrollib.php index 41438c46648..88cbac6d3a3 100644 --- a/lib/enrollib.php +++ b/lib/enrollib.php @@ -19,11 +19,13 @@ * This library includes the basic parts of enrol api. * It is available on each page. * - * @package moodlecore - * @copyright 2010 Petr Skoda {@link http://skodak.org} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage enrol + * @copyright 2010 Petr Skoda {@link http://skodak.org} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); /** Course enrol instance enabled. (used in enrol->status) */ define('ENROL_INSTANCE_ENABLED', 0); diff --git a/lib/environmentlib.php b/lib/environmentlib.php index 98c914d702d..40cd46efbaa 100644 --- a/lib/environmentlib.php +++ b/lib/environmentlib.php @@ -23,18 +23,21 @@ * All the info is stored in the admin/environment.xml file, * supporting to have an updated version in dataroot/environment * - * @copyright (C) 2001-3001 Eloy Lafuente (stronk7) {@link http://contiento.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - * @package moodlecore + * @copyright (C) 2001-3001 Eloy Lafuente (stronk7) {@link http://contiento.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage admin */ +defined('MOODLE_INTERNAL') || die(); + /// Add required files /** - * Inlucde the nessecary + * Include the necessary */ require_once($CFG->libdir.'/xmlize.php'); -/// Define a buch of XML processing errors +/// Define a bunch of XML processing errors /** XML Processing Error */ define('NO_ERROR', 0); /** XML Processing Error */ diff --git a/lib/eventslib.php b/lib/eventslib.php index 49fb7d6cace..b1ec978ebcf 100755 --- a/lib/eventslib.php +++ b/lib/eventslib.php @@ -20,11 +20,14 @@ * * The public API is all at the end of this file. * - * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - * @package moodlecore + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage event */ +defined('MOODLE_INTERNAL') || die(); + /** * Loads the events definitions for the component (from file). If no * events are defined for the component, we simply return an empty array. diff --git a/lib/excellib.class.php b/lib/excellib.class.php index 35ccb954ea7..4fa874278e7 100644 --- a/lib/excellib.class.php +++ b/lib/excellib.class.php @@ -18,12 +18,15 @@ /** * excellib.class.php * - * @copyright (C) 2001-3001 Eloy Lafuente (stronk7) {@link http://contiento.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - * @package moodlecore + * @copyright (C) 2001-3001 Eloy Lafuente (stronk7) {@link http://contiento.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage lib */ -/** setup.php icludes our hacked pear libs first */ +defined('MOODLE_INTERNAL') || die(); + +/** setup.php includes our hacked pear libs first */ require_once 'Spreadsheet/Excel/Writer.php'; /** diff --git a/lib/externallib.php b/lib/externallib.php index 551ad114f8c..34f0dd00bdc 100644 --- a/lib/externallib.php +++ b/lib/externallib.php @@ -18,12 +18,13 @@ /** * Support for external API * - * @package moodlecore + * @package core * @subpackage webservice * @copyright 2009 Moodle Pty Ltd (http://moodle.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); /** * Returns detailed function information @@ -354,7 +355,7 @@ class external_value extends external_description { public function __construct($type, $desc='', $required=VALUE_REQUIRED, $default=null, $allownull=NULL_ALLOWED) { parent::__construct($desc, $required, $default); - $this->type = $type; + $this->type = $type; $this->allownull = $allownull; } } diff --git a/lib/filelib.php b/lib/filelib.php index c3b850892a8..861ba8ca852 100644 --- a/lib/filelib.php +++ b/lib/filelib.php @@ -18,7 +18,7 @@ /** * Functions for file handling. * - * @package moodlecore + * @package core * @subpackage file * @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later diff --git a/lib/filterlib.php b/lib/filterlib.php index 4f8117be5ba..d6cc68b5faa 100644 --- a/lib/filterlib.php +++ b/lib/filterlib.php @@ -18,11 +18,14 @@ /** * Library functions for managing text filter plugins. * - * @package moodlecore - * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage filter + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** The states a filter can be in, stored in the filter_active table. */ define('TEXTFILTER_ON', 1); /** The states a filter can be in, stored in the filter_active table. */ diff --git a/lib/formslib.php b/lib/formslib.php index 7bec97ff3e7..5613487d119 100644 --- a/lib/formslib.php +++ b/lib/formslib.php @@ -25,18 +25,21 @@ * See examples of use of this library in course/edit.php and course/edit_form.php * * A few notes : - * form defintion is used for both printing of form and processing and should be the same + * form definition is used for both printing of form and processing and should be the same * for both or you may lose some submitted data which won't be let through. * you should be using setType for every form element except select, radio or checkbox * elements, these elements clean themselves. * * - * @copyright Jamie Pratt - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - * @package moodlecore + * @copyright Jamie Pratt + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage form */ -/** setup.php icludes our hacked pear libs first */ +defined('MOODLE_INTERNAL') || die(); + +/** setup.php includes our hacked pear libs first */ require_once 'HTML/QuickForm.php'; require_once 'HTML/QuickForm/DHTMLRulesTableless.php'; require_once 'HTML/QuickForm/Renderer/Tableless.php'; diff --git a/lib/gdlib.php b/lib/gdlib.php index d2874f6b032..fc801d9aaf9 100644 --- a/lib/gdlib.php +++ b/lib/gdlib.php @@ -19,11 +19,13 @@ * gdlib.php - Collection of routines in Moodle related to * processing images using GD * - * @package moodlecore + * @package core * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * * long description diff --git a/lib/googleapi.php b/lib/googleapi.php index 4151cdbfa9b..18d3dd62113 100644 --- a/lib/googleapi.php +++ b/lib/googleapi.php @@ -17,7 +17,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . * - * @package moodlecore + * @package core * @subpackage lib * @copyright Dan Poltawski * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later @@ -25,6 +25,8 @@ * Simple implementation of some Google API functions for Moodle. */ +defined('MOODLE_INTERNAL') || die(); + /** Include essential file */ require_once($CFG->libdir.'/filelib.php'); diff --git a/lib/gradelib.php b/lib/gradelib.php index f44c7698382..02ea8e62317 100644 --- a/lib/gradelib.php +++ b/lib/gradelib.php @@ -18,12 +18,15 @@ /** * Library of functions for gradebook - both public and internal * - * @package moodlecore - * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage grade + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ - /** Include essential files */ +defined('MOODLE_INTERNAL') || die(); + +/** Include essential files */ require_once($CFG->libdir . '/grade/constants.php'); require_once($CFG->libdir . '/grade/grade_category.php'); diff --git a/lib/graphlib.php b/lib/graphlib.php index 2c93e712cb1..d801378a317 100644 --- a/lib/graphlib.php +++ b/lib/graphlib.php @@ -21,10 +21,13 @@ * * Copy of GNU Lesser General Public License at: http://www.gnu.org/copyleft/lesser.txt * Contact author at: hermanV@mindless.com - * - * @package moodlecore + * + * @package core + * @subpackage lib */ +defined('MOODLE_INTERNAL') || die(); + /* This file contains modifications by Martin Dougiamas * as part of Moodle (http://moodle.com). Modified lines * are marked with "Moodle". @@ -983,7 +986,7 @@ class graph { $axis_colour = $this->parameter['axis_colour']; $axis_angle = $this->parameter['y_axis_angle']; $y_tick_labels = $this->y_tick_labels; - + $this->calculated['y_axis_left']['has_data'] = FALSE; $this->calculated['y_axis_right']['has_data'] = FALSE; diff --git a/lib/grouplib.php b/lib/grouplib.php index dcb1ef7c144..5eaf10831d3 100644 --- a/lib/grouplib.php +++ b/lib/grouplib.php @@ -16,11 +16,14 @@ // along with Moodle. If not, see . /** - * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - * @package moodlecore + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage group */ +defined('MOODLE_INTERNAL') || die(); + /** * Groups not used in course or activity */ diff --git a/lib/javascript.php b/lib/javascript.php index 535a60963b4..e0fc0bd30fa 100644 --- a/lib/javascript.php +++ b/lib/javascript.php @@ -18,9 +18,10 @@ /** * This file is serving optimised JS * - * @package moodlecore - * @copyright 2010 Petr Skoda (skodak) - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage lib + * @copyright 2010 Petr Skoda (skodak) + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ // we need just the values from config.php and minlib.php diff --git a/lib/ldaplib.php b/lib/ldaplib.php index 59e2c28e69e..c2333f54776 100644 --- a/lib/ldaplib.php +++ b/lib/ldaplib.php @@ -7,13 +7,16 @@ * data structures, useful for both ldap authentication (or ldap based * authentication like CAS) and enrolment plugins. * - * @author Iñaki Arenaza - * @package moodlecore - * @copyright 1999 onwards Martin Dougiamas http://dougiamas.com - * @copyright 2010 onwards Iñaki Arenaza - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @author I�aki Arenaza + * @package core + * @subpackage lib + * @copyright 1999 onwards Martin Dougiamas http://dougiamas.com + * @copyright 2010 onwards I�aki Arenaza + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + // rootDSE is defined as the root of the directory data tree on a directory server. if (!defined('ROOTDSE')) { define ('ROOTDSE', ''); diff --git a/lib/licenselib.php b/lib/licenselib.php index 52dd42e3cb0..b3c3789a5d3 100644 --- a/lib/licenselib.php +++ b/lib/licenselib.php @@ -19,13 +19,15 @@ /** * A namespace contains license specific functions * - * @since 2.0 - * @package moodlecore - * @subpackage moodlecore - * @copyright 2010 Dongsheng Cai - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @since 2.0 + * @package core + * @subpackage lib + * @copyright 2010 Dongsheng Cai + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + class license_manager { /** * Adding a new license type diff --git a/lib/listlib.php b/lib/listlib.php index 306da848e16..4f16582a4df 100644 --- a/lib/listlib.php +++ b/lib/listlib.php @@ -25,11 +25,14 @@ * Reordering of items works across pages. * Processing of editing actions on list. * - * @package moodlecore - * @copyright Jamie Pratt - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage lib + * @copyright Jamie Pratt + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * Clues to reading this code: * diff --git a/lib/mathslib.php b/lib/mathslib.php index 7f61f8d5608..bc0b38d6665 100644 --- a/lib/mathslib.php +++ b/lib/mathslib.php @@ -16,11 +16,14 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @copyright Petr Skoda (skodak) - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage lib + * @copyright Petr Skoda (skodak) + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** @see evalmath/evalmath.class.php */ require_once $CFG->dirroot.'/lib/evalmath/evalmath.class.php'; diff --git a/lib/memcached.class.php b/lib/memcached.class.php index 12770d2b33b..35ac0f4f892 100644 --- a/lib/memcached.class.php +++ b/lib/memcached.class.php @@ -16,11 +16,14 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @copyright Martin Langhoff - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage lib + * @copyright Martin Langhoff + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * This class abstracts PHP's PECL memcached * API to provide diff --git a/lib/messagelib.php b/lib/messagelib.php index d16a1f3333f..4c5ebd547bf 100644 --- a/lib/messagelib.php +++ b/lib/messagelib.php @@ -18,11 +18,14 @@ /** * messagelib.php - Contains generic messaging functions for the message system * - * @package moodlecore - * @copyright Luis Rodrigues and Martin Dougiamas - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage message + * @copyright Luis Rodrigues and Martin Dougiamas + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * Called when a message provider wants to send a message. * This functions checks the user's processor configuration to send the given type of message, diff --git a/lib/moodlelib.php b/lib/moodlelib.php index f176933754d..7d15bf61fdf 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -23,11 +23,14 @@ * - weblib.php - functions that produce web output * - datalib.php - functions that access the database * - * @package moodlecore - * @copyright 1999 onwards Martin Dougiamas http://dougiamas.com - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage lib + * @copyright 1999 onwards Martin Dougiamas http://dougiamas.com + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /// CONSTANTS (Encased in phpdoc proper comments)///////////////////////// /// Date and time constants /// diff --git a/lib/navigationlib.php b/lib/navigationlib.php index 9d3e99ffe98..11df9845b16 100644 --- a/lib/navigationlib.php +++ b/lib/navigationlib.php @@ -19,13 +19,15 @@ * This file contains classes used to manage the navigation structures in Moodle * and was introduced as part of the changes occuring in Moodle 2.0 * - * @since 2.0 - * @package moodlecore + * @since 2.0 + * @package core * @subpackage navigation - * @copyright 2009 Sam Hemelryk - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright 2009 Sam Hemelryk + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * The name that will be used to separate the navigation cache within SESSION */ diff --git a/lib/odslib.class.php b/lib/odslib.class.php index 36ace07ff24..a62151e8d68 100644 --- a/lib/odslib.class.php +++ b/lib/odslib.class.php @@ -20,11 +20,14 @@ * - Eloy Lafuente (stronk7) {@link http://contiento.com} * - Petr Skoda (skodak) * - * @package moodlecore - * @copyright (C) 2001-3001 Eloy Lafuente (stronk7) {@link http://contiento.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage lib + * @copyright (C) 2001-3001 Eloy Lafuente (stronk7) {@link http://contiento.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * The xml used here is derived from output of KSpread 1.6.1 * diff --git a/lib/outputactions.php b/lib/outputactions.php index 908ec17972c..2f43ef6bf9d 100644 --- a/lib/outputactions.php +++ b/lib/outputactions.php @@ -21,11 +21,14 @@ * Please see http://docs.moodle.org/en/Developement:How_Moodle_outputs_HTML * for an overview. * - * @package moodlecore - * @copyright 2009 Nicolas Connault - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage lib + * @copyright 2009 Nicolas Connault + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * Helper class used by other components that involve an action on the page (URL or JS). * @@ -146,7 +149,7 @@ class popup_action extends component_action { $this->params[$var] = $params[$var]; } } - + $attributes = array('url' => $url->out(false), 'name' => $name, 'options' => $this->get_js_options($params)); parent::__construct($event, $this->jsfunction, $attributes); } diff --git a/lib/outputcomponents.php b/lib/outputcomponents.php index 20754891f56..a96bc092785 100644 --- a/lib/outputcomponents.php +++ b/lib/outputcomponents.php @@ -21,11 +21,13 @@ * Please see http://docs.moodle.org/en/Developement:How_Moodle_outputs_HTML * for an overview. * - * @package moodlecore - * @copyright 2009 Tim Hunt - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage lib + * @copyright 2009 Tim Hunt + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); /** * Interface marking other classes as suitable for renderer_base::render() diff --git a/lib/outputfactories.php b/lib/outputfactories.php index 5a75a9fbc54..8e5a35b3434 100644 --- a/lib/outputfactories.php +++ b/lib/outputfactories.php @@ -22,11 +22,14 @@ * Please see http://docs.moodle.org/en/Developement:How_Moodle_outputs_HTML * for an overview. * - * @package moodlecore - * @copyright 2009 Tim Hunt - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage lib + * @copyright 2009 Tim Hunt + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** General rendering target, usually normal browser page */ define('RENDERER_TARGET_GENERAL', 'general'); diff --git a/lib/outputlib.php b/lib/outputlib.php index 3be88b56d2b..f5403dad703 100644 --- a/lib/outputlib.php +++ b/lib/outputlib.php @@ -21,11 +21,14 @@ * Please see http://docs.moodle.org/en/Developement:How_Moodle_outputs_HTML * for an overview. * - * @package moodlecore - * @copyright 2009 Tim Hunt - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage lib + * @copyright 2009 Tim Hunt + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + require_once($CFG->libdir.'/outputcomponents.php'); require_once($CFG->libdir.'/outputactions.php'); require_once($CFG->libdir.'/outputfactories.php'); diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php index 9d5f3ba12ce..2e4618cd09a 100644 --- a/lib/outputrenderers.php +++ b/lib/outputrenderers.php @@ -21,11 +21,14 @@ * Please see http://docs.moodle.org/en/Developement:How_Moodle_outputs_HTML * for an overview. * - * @package moodlecore - * @copyright 2009 Tim Hunt - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage lib + * @copyright 2009 Tim Hunt + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * Simple base class for Moodle renderers. * @@ -2457,7 +2460,7 @@ EOD; * @return string */ protected function render_image_gallery(image_gallery $imagegallery) { - $this->page->requires->yui_module(array('gallery-lightbox','gallery-lightbox-skin'), + $this->page->requires->yui_module(array('gallery-lightbox','gallery-lightbox-skin'), 'Y.Lightbox.init', null, '2010.04.08-12-35'); if (count($imagegallery->images) == 0) { return ''; diff --git a/lib/outputrequirementslib.php b/lib/outputrequirementslib.php index 8bddd433cb1..22fe5fde687 100644 --- a/lib/outputrequirementslib.php +++ b/lib/outputrequirementslib.php @@ -19,11 +19,14 @@ /** * Library functions to facilitate the use of JavaScript in Moodle. * - * @package moodlecore - * @copyright 2009 Tim Hunt, 2010 Petr Skoda - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage lib + * @copyright 2009 Tim Hunt, 2010 Petr Skoda + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + // note: you can find history of this file in lib/ajax/ajaxlib.php /** diff --git a/lib/pagelib.php b/lib/pagelib.php index b49b6f10912..363c5e8c575 100644 --- a/lib/pagelib.php +++ b/lib/pagelib.php @@ -17,14 +17,16 @@ /** * This file contains the moodle_page class. There is normally a single instance - * of this class in the $PAGE global variable. This class is a central reporitory + * of this class in the $PAGE global variable. This class is a central repository * of information about the page we are building up to send back to the user. * - * @package moodlecore - * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage lib + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); /** * $PAGE is a central store of information about the current page we are @@ -218,7 +220,7 @@ class moodle_page { * @var bool */ protected $_legacythemeinuse = false; - + /// Magic getter methods ============================================================= /// Due to the __get magic below, you normally do not call these as $PAGE->magic_get_x /// methods, but instead use the $PAGE->x syntax. @@ -1205,7 +1207,7 @@ class moodle_page { * default to the admin-selected legacy theme * * @return true if legacy theme should be used, otherwise false - * + * */ protected function browser_is_outdated() { foreach($this->_legacybrowsers as $browser => $version) { @@ -1217,7 +1219,7 @@ class moodle_page { } return false; } - + /** * Sets ->pagetype from the script name. For example, if the script that was * run is mod/quiz/view.php, ->pagetype will be set to 'mod-quiz-view'. diff --git a/lib/portfoliolib.php b/lib/portfoliolib.php index 8cd9e9bc7b5..4e05fd82fbe 100644 --- a/lib/portfoliolib.php +++ b/lib/portfoliolib.php @@ -23,12 +23,14 @@ * Major Contributors * - Penny Leach * - * @package moodlecore + * @package core * @subpackage portfolio * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + // require some of the sublibraries first. // this is not an exhaustive list, the others are pulled in as they're needed // so we don't have to always include everything unnecessarily for performance diff --git a/lib/questionlib.php b/lib/questionlib.php index 21730f1a87f..bdedaaa0870 100644 --- a/lib/questionlib.php +++ b/lib/questionlib.php @@ -29,12 +29,14 @@ * Major Contributors * - Alex Smith, Julian Sedding and Gustav Delius {@link http://maths.york.ac.uk/serving_maths} * - * @package moodlecore + * @package core * @subpackage question - * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /// CONSTANTS /////////////////////////////////// /**#@+ @@ -2500,8 +2502,8 @@ function question_category_options($contexts, $top = false, $currentcat = 0, $po foreach ($categoriesarray as $contextstring => $optgroup){ $group = array(); foreach ($optgroup as $key=>$value) { - $key = str_replace($CFG->wwwroot, '', $key); - $group[$key] = $value; + $key = str_replace($CFG->wwwroot, '', $key); + $group[$key] = $value; } $popupcats[] = array($contextstring=>$group); } diff --git a/lib/resourcelib.php b/lib/resourcelib.php index 264196f6e06..2b43fc34766 100644 --- a/lib/resourcelib.php +++ b/lib/resourcelib.php @@ -18,11 +18,14 @@ /** * Recourse module like helper functions * - * @package moodlecore - * @copyright 2009 Petr Skoda (http://skodak.org) - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage lib + * @copyright 2009 Petr Skoda (http://skodak.org) + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** Try the best way */ define('RESOURCELIB_DISPLAY_AUTO', 0); /** Display using object tag */ diff --git a/lib/rsslib.php b/lib/rsslib.php index d3181a7b858..ce18a88bc6a 100644 --- a/lib/rsslib.php +++ b/lib/rsslib.php @@ -18,11 +18,14 @@ /** * This file contains all the common stuff to be used in RSS System * - * @package moodlecore - * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage rss + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + function rss_add_http_header($context, $componentname, $componentinstance, $title) { global $PAGE, $USER; $rsspath = rss_get_url($context->id, $USER->id, $componentname, $componentinstance->id); diff --git a/lib/searchlib.php b/lib/searchlib.php index c9fcd1023c8..b7f4b1f8082 100644 --- a/lib/searchlib.php +++ b/lib/searchlib.php @@ -16,11 +16,14 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage search + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** @see lexer.php */ require_once($CFG->libdir.'/lexer.php'); diff --git a/lib/sessionlib.php b/lib/sessionlib.php index baa10e4da8f..4c43a32e785 100644 --- a/lib/sessionlib.php +++ b/lib/sessionlib.php @@ -16,11 +16,14 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage session + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * Factory method returning moodle_session object. * @return moodle_session diff --git a/lib/setup.php b/lib/setup.php index ebe2162917d..81118021b6d 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -21,9 +21,10 @@ * Normally this is only called by the main config.php file * Normally this file does not need to be edited. * - * @package moodlecore - * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage lib + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** diff --git a/lib/setuplib.php b/lib/setuplib.php index 18678eb6e18..0ae277cab66 100644 --- a/lib/setuplib.php +++ b/lib/setuplib.php @@ -21,11 +21,14 @@ * setup process, before any of the main libraries are * loaded. * - * @package moodlecore - * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage lib + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /// Debug levels /// /** no warnings at all */ define ('DEBUG_NONE', 0); diff --git a/lib/simpletestcoveragelib.php b/lib/simpletestcoveragelib.php index ee19a0c5791..6758e957127 100644 --- a/lib/simpletestcoveragelib.php +++ b/lib/simpletestcoveragelib.php @@ -22,12 +22,14 @@ * ones, provide code coverage analysis to already existing tests. Also there are some * utility functions designed to make the coverage control easier. * - * @package moodlecore + * @package core * @subpackage simpletestcoverage - * @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright 2003 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * Includes */ diff --git a/lib/simpletestlib.php b/lib/simpletestlib.php index b9e4a02e45f..76c89396807 100644 --- a/lib/simpletestlib.php +++ b/lib/simpletestlib.php @@ -25,12 +25,14 @@ * Major Contirbutors * - T.J.Hunt@open.ac.uk * - * @package moodlecore + * @package core * @subpackage simpletestex - * @copyright © 2006 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright © 2006 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * Includes */ diff --git a/lib/soaplib.php b/lib/soaplib.php index eeb0295ca0b..dc9f3384c5e 100644 --- a/lib/soaplib.php +++ b/lib/soaplib.php @@ -21,13 +21,16 @@ * Since Moodle 2.0 we rely only on native PHP Soap extension, * the original name of this file was lib/soap/phpsoap.php * - * @package moodlecore - * @author Alex Smith and others members of the Serving Mathematics project - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - * {@link http://maths.york.ac.uk/serving_maths} - * and others + * @package core + * @subpackage lib + * @author Alex Smith and others members of the Serving Mathematics project + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * {@link http://maths.york.ac.uk/serving_maths} + * and others */ +defined('MOODLE_INTERNAL') || die(); + /** * Create a new SoapClient object * diff --git a/lib/statslib.php b/lib/statslib.php index 515e5f24bf4..6dc3a7e6265 100644 --- a/lib/statslib.php +++ b/lib/statslib.php @@ -16,11 +16,14 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage stats + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** THESE CONSTANTS ARE USED FOR THE REPORTING PAGE. */ define('STATS_REPORT_LOGINS',1); // double impose logins and unique logins on a line graph. site course only. diff --git a/lib/tablelib.php b/lib/tablelib.php index 49c04726df8..cbe04f2fd6a 100644 --- a/lib/tablelib.php +++ b/lib/tablelib.php @@ -16,11 +16,14 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage lib + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** TABLE_VAR_SORT = 1 */ define('TABLE_VAR_SORT', 1); /** TABLE_VAR_HIDE = 2 */ @@ -1097,7 +1100,7 @@ class flexible_table { $fsortorder = get_string('asc'); $lsortorder = get_string('asc'); } - + $override = new object(); $override->firstname = 'firstname'; $override->lastname = 'lastname'; @@ -1111,7 +1114,7 @@ class flexible_table { } else { $this->headers[$index] = ''.get_string('lastname').get_accesshide(get_string('sortby').' '.get_string('lastname').' '.$lsortorder).' '.$icon_sort_last.' / '. ''.get_string('firstname').get_accesshide(get_string('sortby').' '.get_string('firstname').' '.$fsortorder).' '.$icon_sort_first; - } + } } break; diff --git a/lib/textlib.class.php b/lib/textlib.class.php index 846760e0fc3..62b70718088 100644 --- a/lib/textlib.class.php +++ b/lib/textlib.class.php @@ -16,11 +16,14 @@ // along with Moodle. If not, see . /** - * @package moodlecore - * @copyright (C) 2001-3001 Eloy Lafuente (stronk7) {@link http://contiento.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage lib + * @copyright (C) 2001-3001 Eloy Lafuente (stronk7) {@link http://contiento.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * As we implement the singleton pattern to use this class (only one instance * is shared globally), we need this helper function diff --git a/lib/upgradelib.php b/lib/upgradelib.php index 655ba87e8f4..987db09540d 100644 --- a/lib/upgradelib.php +++ b/lib/upgradelib.php @@ -18,12 +18,14 @@ /** * Various upgrade/install related functions and classes. * - * @package moodlecore + * @package core * @subpackage upgrade * @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** UPGRADE_LOG_NORMAL = 0 */ define('UPGRADE_LOG_NORMAL', 0); /** UPGRADE_LOG_NOTICE = 1 */ diff --git a/lib/uploadlib.php b/lib/uploadlib.php index 26335435394..721d7013d9b 100644 --- a/lib/uploadlib.php +++ b/lib/uploadlib.php @@ -18,11 +18,14 @@ /** * uploadlib.php - This class handles all aspects of fileuploading * - * @package moodlecore - * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage file + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /** * This class handles all aspects of fileuploading * diff --git a/lib/weblib.php b/lib/weblib.php index 1b13dee4bea..62689d17098 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -25,11 +25,14 @@ * - datalib.php - functions that access the database. * - moodlelib.php - general-purpose Moodle functions. * - * @package moodlecore - * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage lib + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /// Constants /// Define text formatting types ... eventually we can add Wiki, BBcode etc diff --git a/lib/wiki_to_markdown.php b/lib/wiki_to_markdown.php index 90978d20835..2950d1f42b3 100644 --- a/lib/wiki_to_markdown.php +++ b/lib/wiki_to_markdown.php @@ -18,11 +18,14 @@ /** * Utility function to convert wiki-like to Markdown format * - * @package moodlecore - * @copyright Howard Miller, 2005 - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package core + * @subpackage lib + * @copyright Howard Miller, 2005 + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +defined('MOODLE_INTERNAL') || die(); + /**#@+ * state defines */ diff --git a/theme/yui_combo.php b/theme/yui_combo.php index 53be0d71ab0..9ce4540dc6f 100644 --- a/theme/yui_combo.php +++ b/theme/yui_combo.php @@ -60,6 +60,8 @@ foreach ($parts as $part) { //debug($bits); $version = array_shift($bits); if ($version == 'moodle') { + //TODO: this is a ugly hack because we should not load any libs here! + define('MOODLE_INTERNAL', true); require_once($CFG->libdir.'/moodlelib.php'); $frankenstyle = array_shift($bits); $filename = array_pop($bits); diff --git a/theme/yui_image.php b/theme/yui_image.php index 0f62f5d5220..23ac987ff29 100644 --- a/theme/yui_image.php +++ b/theme/yui_image.php @@ -34,6 +34,8 @@ $parts = explode('/', $path); $version = array_shift($parts); if ($version == 'moodle' && count($parts) >= 3) { + //TODO: this is a ugly hack because we should not load any libs here! + define('MOODLE_INTERNAL', true); require_once($CFG->libdir.'/moodlelib.php'); $frankenstyle = array_shift($parts); $module = array_shift($parts);