Skip to content

Commit 78bfb56

Browse files
committed
MDL-21249 improved php docs and adding direct access prevention in core libs
1 parent 2ac619c commit 78bfb56

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+388
-215
lines changed

blocks/edit_form.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@
2121
* It works with the {@link block_edit_form} class, or rather the particular
2222
* subclass defined by this block, to do the editing.
2323
*
24-
* @package moodlecore
25-
* @copyright 2009 Tim Hunt
26-
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24+
* @package core
25+
* @subpackage block
26+
* @copyright 2009 Tim Hunt
27+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2728
*/
2829

2930
if (!defined('MOODLE_INTERNAL')) {

blocks/moodleblock.class.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@
1818
/**
1919
* This file contains the parent class for moodle blocks, block_base.
2020
*
21-
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
22-
* @package blocks
21+
* @package core
22+
* @subpackage block
23+
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
2324
*/
2425

2526
/// Constants

lib/accesslib.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,14 @@
118118
* DB need to ensure that the default role caps
119119
* are dealt with appropriately.
120120
*
121-
* @package moodlecore
122-
* @copyright 1999 onwards Martin Dougiamas http://dougiamas.com
123-
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
121+
* @package core
122+
* @subpackage role
123+
* @copyright 1999 onwards Martin Dougiamas http://dougiamas.com
124+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
124125
*/
125126

127+
defined('MOODLE_INTERNAL') || die();
128+
126129
/** permission definitions */
127130
define('CAP_INHERIT', 0);
128131
/** permission definitions */

lib/adminlib.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,14 @@
9797
* Original author: Vincenzo K. Marcovecchio
9898
* Maintainer: Petr Skoda
9999
*
100-
* @package moodlecore
101-
* @copyright 1999 onwards Martin Dougiamas http://dougiamas.com
102-
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
100+
* @package core
101+
* @subpackage admin
102+
* @copyright 1999 onwards Martin Dougiamas http://dougiamas.com
103+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
103104
*/
104105

106+
defined('MOODLE_INTERNAL') || die();
107+
105108
/// Add libraries
106109
require_once($CFG->libdir.'/ddllib.php');
107110
require_once($CFG->libdir.'/xmlize.php');

lib/authlib.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,14 @@
2020
*
2121
* 2006-08-28 File created, AUTH return values defined.
2222
*
23-
* @package moodlecore
24-
* @copyright 1999 onwards Martin Dougiamas http://dougiamas.com
25-
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23+
* @package core
24+
* @subpackage auth
25+
* @copyright 1999 onwards Martin Dougiamas http://dougiamas.com
26+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2627
*/
2728

29+
defined('MOODLE_INTERNAL') || die();
30+
2831
/**
2932
* Returned when the login was successful.
3033
*/

lib/blocklib.php

+7-4
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,14 @@
2020
*
2121
* This file defines the {@link block_manager} class,
2222
*
23-
* @package moodlecore
24-
* @copyright 1999 onwards Martin Dougiamas http://dougiamas.com
25-
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23+
* @package core
24+
* @subpackage block
25+
* @copyright 1999 onwards Martin Dougiamas http://dougiamas.com
26+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2627
*/
2728

29+
defined('MOODLE_INTERNAL') || die();
30+
2831
/**#@+
2932
* @deprecated since Moodle 2.0. No longer used.
3033
*/
@@ -1353,7 +1356,7 @@ public function process_url_move() {
13531356

13541357
/**
13551358
* Turns the display of normal blocks either on or off.
1356-
*
1359+
*
13571360
* @param bool $setting
13581361
*/
13591362
public function show_only_fake_blocks($setting = true) {

lib/clilib.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@
1818
/**
1919
* Command line utility functions and classes
2020
*
21-
* @package moodlecore
21+
* @package core
2222
* @subpackage cli
2323
* @copyright 2009 Petr Skoda (http://skodak.org)
2424
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2525
*/
2626

27+
defined('MOODLE_INTERNAL') || die();
28+
2729
/**
2830
* Get input from user
2931
* @param string $prompt text prompt, should include possible options

lib/completionlib.php

+13-10
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,26 @@
1515
// You should have received a copy of the GNU General Public License
1616
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
1717

18-
require_once $CFG->libdir.'/completion/completion_aggregation.php';
19-
require_once $CFG->libdir.'/completion/completion_criteria.php';
20-
require_once $CFG->libdir.'/completion/completion_completion.php';
21-
require_once $CFG->libdir.'/completion/completion_criteria_completion.php';
22-
23-
2418
/**
2519
* Contains a class used for tracking whether activities have been completed
2620
* by students ('completion')
2721
*
2822
* Completion top-level options (admin setting enablecompletion)
2923
*
30-
* @package moodlecore
31-
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
32-
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24+
* @package core
25+
* @subpackage completion
26+
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
27+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
3328
*/
3429

30+
defined('MOODLE_INTERNAL') || die();
31+
32+
require_once $CFG->libdir.'/completion/completion_aggregation.php';
33+
require_once $CFG->libdir.'/completion/completion_criteria.php';
34+
require_once $CFG->libdir.'/completion/completion_completion.php';
35+
require_once $CFG->libdir.'/completion/completion_criteria_completion.php';
36+
37+
3538
/** The completion system is enabled in this site/course */
3639
define('COMPLETION_ENABLED', 1);
3740
/** The completion system is not enabled in this site/course */
@@ -110,7 +113,7 @@
110113
* @package moodlecore
111114
*/
112115
class completion_info {
113-
/**
116+
/**
114117
* Course object passed during construction
115118
* @access private
116119
* @var object

lib/componentlib.class.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,13 @@
120120
*
121121
* That's all!
122122
*
123-
* @package moodlecore
123+
* @package core
124124
* @copyright (C) 2001-3001 Eloy Lafuente (stronk7) {@link http://contiento.com}
125125
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
126126
*/
127127

128+
defined('MOODLE_INTERNAL') || die();
129+
128130
/**
129131
* @global object $CFG
130132
* @name $CFG

lib/conditionlib.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,14 @@
1818
* Used for tracking conditions that apply before activities are displayed
1919
* to students ('conditional availability').
2020
*
21-
* @package moodlecore
22-
* @copyright 1999 onwards Martin Dougiamas http://dougiamas.com
23-
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
21+
* @package core
22+
* @subpackage completion
23+
* @copyright 1999 onwards Martin Dougiamas http://dougiamas.com
24+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2425
*/
2526

27+
defined('MOODLE_INTERNAL') || die();
28+
2629
/** The activity is not displayed to students at all when conditions aren't met. */
2730
define('CONDITION_STUDENTVIEW_HIDE',0);
2831
/** The activity is displayed to students as a greyed-out name, with informational

lib/configonlylib.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
* before including main config.php. You can resume normal script operation
2323
* if you define ABORT_AFTER_CONFIG_CANCEL and require the setup.php
2424
*
25-
* @package moodlecore
26-
* @copyright 2009 petr Skoda (skodak)
25+
* @package core
26+
* @copyright 2009 Petr Skoda (skodak)
2727
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2828
*/
2929

@@ -82,7 +82,7 @@ function min_clean_param($value, $type) {
8282
* @return boolean, true if compression enabled
8383
*/
8484
function min_enable_zlib_compression() {
85-
85+
8686
if (headers_sent()) {
8787
return false;
8888
}
@@ -102,7 +102,7 @@ function min_enable_zlib_compression() {
102102
}
103103
}
104104
}
105-
105+
106106
@ini_set('output_handler', '');
107107

108108
/*
@@ -112,6 +112,6 @@ function min_enable_zlib_compression() {
112112
* so let's try some bigger sizes.
113113
*/
114114
@ini_set('zlib.output_compression', 65536);
115-
115+
116116
return true;
117117
}

lib/csvlib.class.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,14 @@
2020
* You can have a rather longer description of the file as well,
2121
* if you like, and it can span multiple lines.
2222
*
23-
* @copyright Petr Skoda
24-
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
25-
* @package moodlecore
23+
* @package core
24+
* @subpackage lib
25+
* @copyright Petr Skoda
26+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2627
*/
2728

29+
defined('MOODLE_INTERNAL') || die();
30+
2831
/**
2932
* Utitily class for importing of CSV files.
3033
* @copyright Petr Skoda

lib/customcheckslib.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,14 @@
2727
* - true: if passed
2828
* - false: if failed
2929
*
30-
* @package moodlecore
31-
* @copyright (C) 2001-3001 Eloy Lafuente (stronk7) {@link http://contiento.com}
32-
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
30+
* @package core
31+
* @subpackage admin
32+
* @copyright (C) 2001-3001 Eloy Lafuente (stronk7) {@link http://contiento.com}
33+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
3334
*/
3435

36+
defined('MOODLE_INTERNAL') || die();
37+
3538
/**
3639
* This function will look for the risky PHP setting register_globals
3740
* in order to inform about. MDL-12914

lib/datalib.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,14 @@
2222
* - weblib.php - functions that produce web output
2323
* - moodlelib.php - general-purpose Moodle functions
2424
*
25-
* @package moodlecore
26-
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
27-
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
25+
* @package core
26+
* @subpackage lib
27+
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
28+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2829
*/
2930

31+
defined('MOODLE_INTERNAL') || die();
32+
3033
/**
3134
* The maximum courses in a category
3235
* MAX_COURSES_IN_CATEGORY * MAX_COURSE_CATEGORIES must not be more than max integer!

lib/ddllib.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,15 @@
3434
*
3535
* For further documentation, visit {@link http://docs.moodle.org/en/DDL_functions}
3636
*
37-
* @package moodlecore
38-
* @subpackage DDL
37+
* @package core
38+
* @subpackage ddl
3939
* @copyright 2001-3001 Eloy Lafuente (stronk7) http://contiento.com
4040
* 2008 Petr Skoda http://skodak.org
4141
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
4242
*/
4343

44+
defined('MOODLE_INTERNAL') || die();
45+
4446
// Add required library
4547
require_once($CFG->libdir.'/xmlize.php');
4648

lib/deprecatedlib.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@
2121
* Old functions retained only for backward compatibility. New code should not
2222
* use any of these functions.
2323
*
24-
* @package moodlecore
24+
* @package core
2525
* @subpackage deprecated
26-
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
27-
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
26+
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
27+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2828
* @deprecated
2929
*/
3030

31+
defined('MOODLE_INTERNAL') || die();
32+
3133
/**
3234
* Given a physical path to a file, returns the URL through which it can be reached in Moodle.
3335
*

lib/dmllib.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,14 @@
3232
* http://docs.moodle.org/en/DML_functions
3333
* (feel free to modify, improve and document such page, thanks!)
3434
*
35-
* @package moodlecore
36-
* @subpackage DML
35+
* @package core
36+
* @subpackage dml
3737
* @copyright 2008 Petr Skoda (http://skodak.org)
3838
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
3939
*/
4040

41+
defined('MOODLE_INTERNAL') || die();
42+
4143
// Require the essential
4244
require_once($CFG->libdir.'/dml/moodle_database.php');
4345

lib/dtllib.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,14 @@
2222
* This library includes all the required functions used to handle
2323
* transfer of data from one database to another.
2424
*
25-
* @package moodlecore
26-
* @subpackage DTL
25+
* @package core
26+
* @subpackage dtl
2727
* @copyright 2008 Andrei Bautu
2828
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2929
*/
3030

31+
defined('MOODLE_INTERNAL') || die();
32+
3133
// Require {@link ddllib.php}
3234
require_once($CFG->libdir.'/ddllib.php');
3335
// Require {@link database_exporter.php}

lib/eaccelerator.class.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,14 @@
2929
* memcached, a false value is indistinguisable from a
3030
* "not found in cache" response.
3131
*
32-
* @copyright Martin Langhoff <[email protected]>
33-
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
34-
* @package moodlecore
32+
* @package core
33+
* @subpackage lib
34+
* @copyright Martin Langhoff <[email protected]>
35+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
3536
*/
3637

38+
defined('MOODLE_INTERNAL') || die();
39+
3740
/**
3841
*
3942
* @copyright Martin Langhoff <[email protected]>

lib/editorlib.php

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2525
*/
2626

27+
defined('MOODLE_INTERNAL') || die();
28+
2729
/**
2830
* Returns users preferred editor for given format
2931
*

0 commit comments

Comments
 (0)