From 1fcf0ca8a5b792a59d59f1eb64bbb56e2dfeb06b Mon Sep 17 00:00:00 2001 From: Russell Smith Date: Fri, 26 Feb 2016 17:47:58 +1100 Subject: [PATCH] MDL-35628 performance: Remove dirname() where possible. dirname() is a slow function compared with __DIR__ and using '/../'. Moodle has a large number of legacy files that are included each time a page loads and is not able to use an autoloader as it is functional code. This allows those required includes to perform as best as possible in this situation. --- admin/cli/automated_backups.php | 2 +- admin/cli/backup.php | 2 +- admin/cli/cron.php | 2 +- admin/cli/install.php | 10 +++---- admin/cli/install_database.php | 2 +- admin/cli/mysql_collation.php | 2 +- admin/cli/mysql_compressed_rows.php | 2 +- admin/cli/mysql_engine.php | 2 +- admin/cli/purge_caches.php | 2 +- admin/cli/reset_password.php | 2 +- admin/cli/upgrade.php | 2 +- admin/filters.php | 2 +- admin/localplugins.php | 2 +- admin/mailout-debugger.php | 2 +- admin/message.php | 2 +- admin/mnet/access_control.php | 2 +- admin/mnet/delete.php | 2 +- admin/mnet/index.php | 2 +- admin/mnet/peers.php | 2 +- admin/mnet/profilefields.php | 2 +- admin/mnet/services.php | 2 +- admin/mnet/testclient.php | 2 +- admin/mnet/trustedhosts.php | 2 +- admin/oauth2callback.php | 2 +- admin/plagiarism.php | 2 +- admin/plugins.php | 2 +- admin/portfolio.php | 2 +- admin/process_email.php | 2 +- admin/qbehaviours.php | 2 +- admin/qtypes.php | 2 +- admin/reports.php | 2 +- admin/repository.php | 2 +- admin/repositoryinstance.php | 2 +- admin/resetemoticons.php | 2 +- admin/roles/allow.php | 2 +- admin/roles/check.php | 2 +- admin/roles/define.php | 2 +- admin/roles/manage.php | 2 +- admin/tool/assignmentupgrade/batchupgrade.php | 2 +- admin/tool/assignmentupgrade/index.php | 2 +- .../assignmentupgrade/listnotupgraded.php | 2 +- .../tool/assignmentupgrade/upgradesingle.php | 2 +- .../upgradesingleconfirm.php | 2 +- admin/tool/capability/index.php | 2 +- admin/tool/cohortroles/index.php | 2 +- admin/tool/customlang/edit.php | 2 +- admin/tool/customlang/index.php | 2 +- admin/tool/generator/cli/maketestcourse.php | 2 +- admin/tool/generator/cli/maketestplan.php | 2 +- admin/tool/generator/index.php | 2 +- admin/tool/installaddon/index.php | 2 +- admin/tool/installaddon/permcheck.php | 2 +- admin/tool/messageinbound/index.php | 2 +- admin/tool/phpunit/index.php | 2 +- admin/tool/phpunit/webrunner.php | 2 +- admin/tool/profiling/export.php | 2 +- admin/tool/profiling/import.php | 4 +-- admin/tool/profiling/index.php | 2 +- admin/tool/recyclebin/index.php | 2 +- admin/tool/task/scheduledtasks.php | 2 +- admin/tool/unsuproles/index.php | 2 +- .../generate_all_documentation.class.php | 2 +- .../generate_documentation.class.php | 2 +- admin/tools.php | 2 +- auth/cas/cli/sync_users.php | 2 +- auth/ldap/cli/sync_users.php | 2 +- auth/ldap/ntlmsso_attempt.php | 2 +- auth/ldap/ntlmsso_finish.php | 2 +- auth/ldap/ntlmsso_magic.php | 2 +- auth/mnet/jump.php | 2 +- auth/mnet/land.php | 2 +- backup/backupfilesedit.php | 2 +- .../cc/cc_lib/gral_lib/ccdependencyparser.php | 2 +- backup/cc/cc_lib/gral_lib/functions.php | 2 +- backup/converter/moodle1/lib.php | 2 +- backup/restorefile.php | 2 +- badges/action.php | 2 +- badges/ajax.php | 2 +- badges/assertion.php | 2 +- badges/award.php | 2 +- badges/backpackconnect.php | 2 +- badges/badge.php | 2 +- badges/criteria.php | 2 +- badges/criteria_action.php | 2 +- badges/criteria_settings.php | 2 +- badges/edit.php | 2 +- badges/external.php | 2 +- badges/index.php | 2 +- badges/mybackpack.php | 2 +- badges/mybadges.php | 2 +- badges/newbadge.php | 2 +- badges/overview.php | 2 +- badges/preferences.php | 2 +- badges/recipients.php | 2 +- badges/view.php | 2 +- blocks/completionstatus/details.php | 2 +- blocks/course_overview/move.php | 4 +-- blocks/course_overview/save.php | 4 +-- blocks/rss_client/editfeed.php | 2 +- blocks/rss_client/managefeeds.php | 2 +- blocks/rss_client/tests/cron_test.php | 4 +-- blocks/rss_client/viewfeed.php | 2 +- blog/edit.php | 2 +- blog/index.php | 2 +- config-dist.php | 2 +- course/category.ajax.php | 2 +- course/changenumsections.php | 2 +- course/delete.php | 2 +- course/dndupload.php | 2 +- course/modduplicate.php | 2 +- course/pending.php | 2 +- course/request.php | 2 +- course/rest.php | 2 +- enrol/imsenterprise/importnow.php | 2 +- enrol/lti/index.php | 2 +- enrol/lti/tool.php | 2 +- enrol/meta/cli/sync.php | 2 +- enrol/mnet/enrol.php | 2 +- files/coursefilesedit.php | 2 +- filter/manage.php | 2 +- filter/mediaplugin/dev/perftest.php | 2 +- grade/edit/outcome/import.php | 2 +- grade/edit/outcome/index.php | 2 +- grade/grading/form/guide/edit.php | 6 ++--- grade/grading/form/guide/edit_form.php | 2 +- grade/grading/form/guide/preview.php | 6 ++--- grade/grading/form/rubric/edit.php | 6 ++--- grade/grading/form/rubric/edit_form.php | 2 +- grade/grading/form/rubric/preview.php | 6 ++--- grade/grading/manage.php | 2 +- grade/grading/pick.php | 2 +- grade/import/keymanager.php | 2 +- group/members.php | 4 +-- help.php | 2 +- install.php | 4 +-- install/css.php | 4 +-- lib/adminlib.php | 2 +- lib/ajax/blocks.php | 2 +- lib/ajax/getnavbranch.php | 2 +- lib/ajax/getsiteadminbranch.php | 2 +- lib/ajax/service.php | 2 +- lib/ajax/setuserpref.php | 2 +- lib/badgeslib.php | 4 +-- lib/editor/atto/autosave-ajax.php | 2 +- lib/editor/atto/plugins/equation/ajax.php | 2 +- .../tinymce/plugins/moodleemoticon/dialog.php | 2 +- .../tinymce/plugins/moodlemedia/preview.php | 2 +- .../plugins/spellchecker/includes/general.php | 14 +++++----- lib/installlib.php | 2 +- lib/messagelib.php | 2 +- lib/pdflib.php | 2 +- lib/sessionkeepalive_ajax.php | 2 +- lib/setup.php | 2 +- lib/setuplib.php | 4 +-- lib/tests/other/jquerypage.php | 2 +- lib/tests/other/pdflibtestpage.php | 2 +- lib/tests/other/todochecker.php | 2 +- .../filtersettingsperformancetester.php | 2 +- lib/tests/string_manager_standard_test.php | 4 +-- login/token.php | 2 +- message/defaultoutputs.php | 2 +- message/discussion.php | 2 +- message/edit.php | 2 +- message/output/airnotifier/rest.php | 2 +- message/output/popup/message_output_popup.php | 2 +- mnet/publickey.php | 2 +- mnet/service/enrol/course.php | 2 +- mnet/service/enrol/host.php | 2 +- mnet/service/enrol/index.php | 2 +- mnet/xmlrpc/server.php | 2 +- mod/assign/adminmanageplugins.php | 2 +- mod/assign/feedback/editpdf/testunoconv.php | 2 +- mod/book/delete.php | 4 +-- mod/book/edit.php | 6 ++--- mod/book/index.php | 4 +-- mod/book/lib.php | 8 +++--- mod/book/locallib.php | 2 +- mod/book/mod_form.php | 2 +- mod/book/move.php | 4 +-- mod/book/settings.php | 2 +- mod/book/show.php | 4 +-- mod/book/tool/exportimscp/index.php | 4 +-- mod/book/tool/exportimscp/locallib.php | 4 +-- mod/book/tool/importhtml/index.php | 6 ++--- mod/book/tool/importhtml/locallib.php | 2 +- mod/book/tool/print/index.php | 4 +-- mod/book/tool/print/locallib.php | 2 +- mod/book/view.php | 6 ++--- mod/chat/chat_ajax.php | 4 +-- mod/chat/chatd.php | 2 +- mod/chat/gui_ajax/index.php | 2 +- mod/chat/view.php | 2 +- mod/data/view.php | 2 +- mod/feedback/ajax.php | 2 +- mod/forum/index.php | 2 +- mod/forum/maildigest.php | 2 +- mod/forum/subscribe.php | 2 +- mod/forum/subscribe_ajax.php | 2 +- mod/forum/user.php | 2 +- mod/lesson/overridedelete.php | 2 +- mod/lesson/overrideedit.php | 2 +- mod/lesson/overrides.php | 2 +- mod/lesson/view.php | 2 +- mod/lti/ajax.php | 2 +- mod/lti/service.php | 2 +- mod/lti/services.php | 2 +- mod/quiz/attempt.php | 2 +- mod/quiz/autosave.ajax.php | 2 +- mod/quiz/grade.php | 2 +- mod/quiz/overridedelete.php | 2 +- mod/quiz/overrideedit.php | 2 +- mod/quiz/overrides.php | 2 +- mod/quiz/processattempt.php | 2 +- mod/quiz/report.php | 2 +- mod/quiz/report/overview/overviewgraph.php | 2 +- .../report/statistics/statistics_graph.php | 2 +- mod/quiz/review.php | 2 +- mod/quiz/reviewquestion.php | 2 +- mod/quiz/startattempt.php | 2 +- mod/quiz/summary.php | 2 +- mod/quiz/view.php | 2 +- mod/scorm/report/graphs/graph.php | 2 +- mod/wiki/create.php | 2 +- mod/wiki/filesedit.php | 2 +- mod/wiki/pagelib.php | 2 +- mod/workshop/aggregate.php | 4 +-- mod/workshop/allocation.php | 6 ++--- mod/workshop/allocation/manual/lib.php | 4 +-- mod/workshop/allocation/random/lib.php | 6 ++--- mod/workshop/allocation/random/settings.php | 2 +- mod/workshop/allocation/scheduled/lib.php | 8 +++--- .../allocation/scheduled/settings_form.php | 2 +- mod/workshop/assessment.php | 4 +-- mod/workshop/backup/moodle1/lib.php | 2 +- mod/workshop/editform.php | 4 +-- mod/workshop/editformpreview.php | 4 +-- mod/workshop/eval/best/lib.php | 2 +- mod/workshop/exassessment.php | 4 +-- mod/workshop/excompare.php | 4 +-- mod/workshop/exsubmission.php | 6 ++--- .../form/accumulative/assessment_form.php | 2 +- mod/workshop/form/accumulative/edit_form.php | 4 +-- mod/workshop/form/accumulative/lib.php | 6 ++--- .../form/comments/assessment_form.php | 2 +- mod/workshop/form/comments/edit_form.php | 4 +-- mod/workshop/form/comments/lib.php | 6 ++--- .../form/numerrors/assessment_form.php | 2 +- mod/workshop/form/numerrors/edit_form.php | 4 +-- mod/workshop/form/numerrors/lib.php | 8 +++--- mod/workshop/form/rubric/assessment_form.php | 2 +- mod/workshop/form/rubric/edit_form.php | 2 +- mod/workshop/form/rubric/lib.php | 8 +++--- mod/workshop/index.php | 4 +-- mod/workshop/lib.php | 6 ++--- mod/workshop/locallib.php | 16 ++++++------ mod/workshop/mod_form.php | 2 +- mod/workshop/submission.php | 6 ++--- mod/workshop/switchphase.php | 4 +-- mod/workshop/toolbox.php | 4 +-- mod/workshop/view.php | 4 +-- my/index.php | 2 +- my/indexsys.php | 2 +- portfolio/add.php | 2 +- portfolio/download/file.php | 2 +- portfolio/file.php | 2 +- portfolio/mahara/preconfig.php | 2 +- question/addquestion.php | 4 +-- .../adaptive/tests/behaviourtype_test.php | 4 +-- .../adaptive/tests/mark_display_test.php | 4 +-- .../adaptive/tests/walkthrough_test.php | 4 +-- .../behaviour/adaptivenopenalty/behaviour.php | 2 +- .../adaptivenopenalty/behaviourtype.php | 2 +- .../behaviour/adaptivenopenalty/renderer.php | 2 +- .../tests/walkthrough_test.php | 4 +-- question/behaviour/deferredcbm/behaviour.php | 2 +- .../behaviour/deferredcbm/behaviourtype.php | 2 +- .../deferredcbm/tests/behaviourtype_test.php | 4 +-- .../deferredcbm/tests/question_cbm_test.php | 2 +- .../deferredcbm/tests/walkthrough_test.php | 4 +-- .../tests/behaviourtype_test.php | 4 +-- .../tests/walkthrough_test.php | 4 +-- question/behaviour/immediatecbm/behaviour.php | 2 +- .../behaviour/immediatecbm/behaviourtype.php | 2 +- question/behaviour/immediatecbm/renderer.php | 2 +- .../immediatecbm/tests/behaviourtype_test.php | 4 +-- .../immediatecbm/tests/walkthrough_test.php | 4 +-- .../tests/behaviourtype_test.php | 4 +-- .../tests/walkthrough_test.php | 4 +-- .../tests/behaviourtype_test.php | 4 +-- .../tests/walkthrough_test.php | 4 +-- .../interactive/tests/behaviourtype_test.php | 4 +-- .../interactive/tests/walkthrough_test.php | 4 +-- .../interactivecountback/behaviour.php | 2 +- .../interactivecountback/behaviourtype.php | 2 +- .../interactivecountback/renderer.php | 2 +- .../tests/behaviourtype_test.php | 4 +-- .../tests/walkthrough_test.php | 4 +-- .../manualgraded/tests/behaviourtype_test.php | 4 +-- .../manualgraded/tests/walkthrough_test.php | 4 +-- .../missing/tests/behaviourtype_test.php | 4 +-- .../missing/tests/missingbehaviour_test.php | 6 ++--- question/edit.php | 2 +- question/engine/bank.php | 2 +- question/engine/lib.php | 26 +++++++++---------- .../tests/datalib_reporting_queries_test.php | 4 +-- question/engine/tests/datalib_test.php | 4 +-- .../engine/tests/qubaid_condition_test.php | 2 +- .../engine/tests/questionattempt_db_test.php | 4 +-- .../engine/tests/questionattempt_test.php | 4 +-- .../tests/questionattempt_with_steps_test.php | 4 +-- .../tests/questionattemptiterator_test.php | 4 +-- .../tests/questionattemptstep_db_test.php | 4 +-- .../engine/tests/questionattemptstep_test.php | 4 +-- .../questionattemptstepiterator_test.php | 4 +-- question/engine/tests/questionbank_test.php | 2 +- question/engine/tests/questionengine_test.php | 2 +- question/engine/tests/questionstate_test.php | 2 +- .../tests/questionusage_autosave_test.php | 4 +-- .../questionusagebyactivity_data_test.php | 4 +-- .../tests/questionusagebyactivity_test.php | 4 +-- question/engine/tests/questionutils_test.php | 2 +- question/engine/tests/unitofwork_test.php | 4 +-- question/engine/upgrade/tests/helper.php | 2 +- question/export.php | 2 +- question/import.php | 2 +- question/preview.php | 4 +-- question/question.php | 4 +-- .../missingtype/tests/missingtype_test.php | 6 ++--- report/completion/index.php | 2 +- report/configlog/index.php | 2 +- report/log/locallib.php | 2 +- report/outline/locallib.php | 2 +- report/questioninstances/index.php | 2 +- report/stats/locallib.php | 2 +- repository/dropbox/lib.php | 2 +- repository/dropbox/thumbnail.php | 4 +-- repository/equella/callback.php | 2 +- repository/flickr_public/lib.php | 2 +- repository/manage_instances.php | 2 +- repository/repository_ajax.php | 6 ++--- repository/repository_callback.php | 6 ++--- repository/url/lib.php | 2 +- repository/wikimedia/lib.php | 2 +- theme/index.php | 2 +- user/portfolio.php | 2 +- user/portfoliologs.php | 2 +- user/profile.php | 2 +- user/profilesys.php | 2 +- user/repository.php | 2 +- user/selector/search.php | 2 +- webservice/pluginfile.php | 2 +- webservice/upload.php | 2 +- 352 files changed, 499 insertions(+), 499 deletions(-) diff --git a/admin/cli/automated_backups.php b/admin/cli/automated_backups.php index 3c3841e718d18..0b03282fbcf65 100644 --- a/admin/cli/automated_backups.php +++ b/admin/cli/automated_backups.php @@ -28,7 +28,7 @@ define('CLI_SCRIPT', true); -require(dirname(dirname(dirname(__FILE__))).'/config.php'); +require(__DIR__.'/../../config.php'); require_once($CFG->libdir.'/clilib.php'); // cli only functions require_once($CFG->libdir.'/cronlib.php'); diff --git a/admin/cli/backup.php b/admin/cli/backup.php index 2770c03f19bf9..b8be31827c93f 100644 --- a/admin/cli/backup.php +++ b/admin/cli/backup.php @@ -25,7 +25,7 @@ define('CLI_SCRIPT', 1); -require(dirname(dirname(dirname(__FILE__))).'/config.php'); +require(__DIR__.'/../../config.php'); require_once($CFG->libdir.'/clilib.php'); require_once($CFG->dirroot . '/backup/util/includes/backup_includes.php'); diff --git a/admin/cli/cron.php b/admin/cli/cron.php index 527aa7216432d..3ece44a9e3a42 100644 --- a/admin/cli/cron.php +++ b/admin/cli/cron.php @@ -30,7 +30,7 @@ define('CLI_SCRIPT', true); -require(dirname(dirname(dirname(__FILE__))).'/config.php'); +require(__DIR__.'/../../config.php'); require_once($CFG->libdir.'/clilib.php'); // cli only functions require_once($CFG->libdir.'/cronlib.php'); diff --git a/admin/cli/install.php b/admin/cli/install.php index 523f9e8daaa81..9f3c0df4359ff 100644 --- a/admin/cli/install.php +++ b/admin/cli/install.php @@ -90,7 +90,7 @@ // distro specific customisation -$distrolibfile = dirname(dirname(dirname(__FILE__))).'/install/distrolib.php'; +$distrolibfile = __DIR__.'/../../install/distrolib.php'; $distro = null; if (file_exists($distrolibfile)) { require_once($distrolibfile); @@ -100,7 +100,7 @@ } // Nothing to do if config.php exists -$configfile = dirname(dirname(dirname(__FILE__))).'/config.php'; +$configfile = __DIR__.'/../../config.php'; if (file_exists($configfile)) { require($configfile); require_once($CFG->libdir.'/clilib.php'); @@ -159,7 +159,7 @@ global $CFG; $CFG = new stdClass(); $CFG->lang = 'en'; -$CFG->dirroot = dirname(dirname(dirname(__FILE__))); +$CFG->dirroot = dirname(dirname(__DIR__)); $CFG->libdir = "$CFG->dirroot/lib"; $CFG->wwwroot = "http://localhost"; $CFG->httpswwwroot = $CFG->wwwroot; @@ -172,7 +172,7 @@ $CFG->debugdisplay = true; $CFG->debugdeveloper = true; -$parts = explode('/', str_replace('\\', '/', dirname(dirname(__FILE__)))); +$parts = explode('/', str_replace('\\', '/', dirname(__DIR__))); $CFG->admin = array_pop($parts); //point pear include path to moodles lib/pear so that includes and requires will search there for files before anywhere else @@ -244,7 +244,7 @@ 'chmod' => isset($distro->directorypermissions) ? sprintf('%04o',$distro->directorypermissions) : '2777', // let distros set dir permissions 'lang' => $CFG->lang, 'wwwroot' => '', - 'dataroot' => empty($distro->dataroot) ? str_replace('\\', '/', dirname(dirname(dirname(dirname(__FILE__)))).'/moodledata'): $distro->dataroot, // initialised later after including libs or by distro + 'dataroot' => empty($distro->dataroot) ? str_replace('\\', '/', dirname(dirname(dirname(__DIR__))).'/moodledata'): $distro->dataroot, // initialised later after including libs or by distro 'dbtype' => empty($distro->dbtype) ? $defaultdb : $distro->dbtype, // let distro skip dbtype selection 'dbhost' => empty($distro->dbhost) ? 'localhost' : $distro->dbhost, // let distros set dbhost 'dbname' => 'moodle', diff --git a/admin/cli/install_database.php b/admin/cli/install_database.php index cb768c36d92ae..b66805e464621 100644 --- a/admin/cli/install_database.php +++ b/admin/cli/install_database.php @@ -72,7 +72,7 @@ } // Nothing to do if config.php does not exist -$configfile = dirname(dirname(dirname(__FILE__))).'/config.php'; +$configfile = __DIR__.'/../../config.php'; if (!file_exists($configfile)) { fwrite(STDERR, 'config.php does not exist, can not continue'); // do not localize fwrite(STDERR, "\n"); diff --git a/admin/cli/mysql_collation.php b/admin/cli/mysql_collation.php index 9938a3af9f846..131b8f42788c9 100644 --- a/admin/cli/mysql_collation.php +++ b/admin/cli/mysql_collation.php @@ -24,7 +24,7 @@ define('CLI_SCRIPT', true); -require(dirname(dirname(dirname(__FILE__))).'/config.php'); +require(__DIR__.'/../../config.php'); require_once($CFG->libdir.'/clilib.php'); // cli only functions if ($DB->get_dbfamily() !== 'mysql') { diff --git a/admin/cli/mysql_compressed_rows.php b/admin/cli/mysql_compressed_rows.php index df69376802155..e90060cdd8d7c 100644 --- a/admin/cli/mysql_compressed_rows.php +++ b/admin/cli/mysql_compressed_rows.php @@ -25,7 +25,7 @@ define('CLI_SCRIPT', true); -require(dirname(__FILE__).'/../../config.php'); +require(__DIR__.'/../../config.php'); require_once($CFG->libdir . '/clilib.php'); if ($DB->get_dbfamily() !== 'mysql') { diff --git a/admin/cli/mysql_engine.php b/admin/cli/mysql_engine.php index 6bc3642a1d4a4..d392b0b6f71af 100644 --- a/admin/cli/mysql_engine.php +++ b/admin/cli/mysql_engine.php @@ -26,7 +26,7 @@ define('CLI_SCRIPT', true); -require(dirname(dirname(dirname(__FILE__))).'/config.php'); +require(__DIR__.'/../../config.php'); require_once($CFG->libdir.'/clilib.php'); // cli only functions if ($DB->get_dbfamily() !== 'mysql') { diff --git a/admin/cli/purge_caches.php b/admin/cli/purge_caches.php index f008da2568cc7..7c9d3447c043a 100644 --- a/admin/cli/purge_caches.php +++ b/admin/cli/purge_caches.php @@ -23,7 +23,7 @@ define('CLI_SCRIPT', true); -require(dirname(dirname(dirname(__FILE__))).'/config.php'); +require(__DIR__.'/../../config.php'); require_once($CFG->libdir.'/clilib.php'); list($options, $unrecognized) = cli_get_params(array('help' => false), array('h' => 'help')); diff --git a/admin/cli/reset_password.php b/admin/cli/reset_password.php index d7b4f74ed080b..27f4ca9af4113 100644 --- a/admin/cli/reset_password.php +++ b/admin/cli/reset_password.php @@ -26,7 +26,7 @@ define('CLI_SCRIPT', true); -require(dirname(dirname(dirname(__FILE__))).'/config.php'); +require(__DIR__.'/../../config.php'); require_once($CFG->libdir.'/clilib.php'); // cli only functions diff --git a/admin/cli/upgrade.php b/admin/cli/upgrade.php index cefb990128d1a..6de2e13ca98ab 100644 --- a/admin/cli/upgrade.php +++ b/admin/cli/upgrade.php @@ -38,7 +38,7 @@ define('CLI_SCRIPT', true); define('CACHE_DISABLE_ALL', true); -require(dirname(dirname(dirname(__FILE__))).'/config.php'); +require(__DIR__.'/../../config.php'); require_once($CFG->libdir.'/adminlib.php'); // various admin-only functions require_once($CFG->libdir.'/upgradelib.php'); // general upgrade/install related functions require_once($CFG->libdir.'/clilib.php'); // cli only functions diff --git a/admin/filters.php b/admin/filters.php index 6313d08e42a30..b1127678d18de 100644 --- a/admin/filters.php +++ b/admin/filters.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->libdir . '/adminlib.php'); $action = optional_param('action', '', PARAM_ALPHA); diff --git a/admin/localplugins.php b/admin/localplugins.php index fb5c4cf74c601..eb6862d0d799d 100644 --- a/admin/localplugins.php +++ b/admin/localplugins.php @@ -27,7 +27,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(__FILE__)) . '/config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->libdir.'/adminlib.php'); require_once($CFG->libdir.'/tablelib.php'); diff --git a/admin/mailout-debugger.php b/admin/mailout-debugger.php index d183fa4a7b82b..ae9fc85e816be 100644 --- a/admin/mailout-debugger.php +++ b/admin/mailout-debugger.php @@ -29,7 +29,7 @@ */ // Security check. -if (!file_exists(dirname(__FILE__).'/mailout-debugger.enable')) { +if (!file_exists(__DIR__.'/mailout-debugger.enable')) { mdie("Disabled."); } $tmpdir=sys_get_temp_dir(); // default diff --git a/admin/message.php b/admin/message.php index 270a230210ef2..52cb5608bbc48 100644 --- a/admin/message.php +++ b/admin/message.php @@ -21,7 +21,7 @@ * @copyright 2011 Lancaster University Network Services Limited * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->dirroot . '/message/lib.php'); require_once($CFG->libdir.'/adminlib.php'); diff --git a/admin/mnet/access_control.php b/admin/mnet/access_control.php index 375b3facf25a2..6b1cebcdea5a9 100644 --- a/admin/mnet/access_control.php +++ b/admin/mnet/access_control.php @@ -2,7 +2,7 @@ // Allows the admin to control user logins from remote moodles. -require_once dirname(dirname(dirname(__FILE__))) . '/config.php'; +require_once(__DIR__ . '/../../config.php'); require_once($CFG->libdir.'/adminlib.php'); include_once($CFG->dirroot.'/mnet/lib.php'); diff --git a/admin/mnet/delete.php b/admin/mnet/delete.php index c078b274c3097..03eac9bcf138e 100644 --- a/admin/mnet/delete.php +++ b/admin/mnet/delete.php @@ -27,7 +27,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(dirname(__FILE__))) . '/config.php'); +require(__DIR__.'/../../config.php'); require_once($CFG->libdir . '/adminlib.php'); $step = optional_param('step', 'verify', PARAM_ALPHA); diff --git a/admin/mnet/index.php b/admin/mnet/index.php index d6e544eac508a..879caa83b2444 100644 --- a/admin/mnet/index.php +++ b/admin/mnet/index.php @@ -2,7 +2,7 @@ // Allows the admin to configure mnet stuff - require_once(dirname(dirname(dirname(__FILE__))) . '/config.php'); + require(__DIR__.'/../../config.php'); require_once($CFG->libdir.'/adminlib.php'); include_once($CFG->dirroot.'/mnet/lib.php'); diff --git a/admin/mnet/peers.php b/admin/mnet/peers.php index 24ef9b6af9a07..df1f6e2700ef1 100644 --- a/admin/mnet/peers.php +++ b/admin/mnet/peers.php @@ -27,7 +27,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(dirname(__FILE__))) . '/config.php'); +require(__DIR__.'/../../config.php'); require_once($CFG->libdir.'/adminlib.php'); require_once($CFG->dirroot.'/mnet/lib.php'); require_once($CFG->dirroot.'/'.$CFG->admin.'/mnet/peer_forms.php'); diff --git a/admin/mnet/profilefields.php b/admin/mnet/profilefields.php index 5f5fd6b1ec0d9..24ba79c1ec2cf 100644 --- a/admin/mnet/profilefields.php +++ b/admin/mnet/profilefields.php @@ -24,7 +24,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require(dirname(dirname(dirname(__FILE__))).'/config.php'); +require(__DIR__.'/../../config.php'); require_once($CFG->libdir.'/adminlib.php'); require_once($CFG->dirroot . '/admin/mnet/profilefields_form.php'); $mnet = get_mnet_environment(); diff --git a/admin/mnet/services.php b/admin/mnet/services.php index cdc4fe3a5c205..ea588cd66d320 100644 --- a/admin/mnet/services.php +++ b/admin/mnet/services.php @@ -25,7 +25,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(dirname(__FILE__))) . '/config.php'); +require(__DIR__.'/../../config.php'); require_once($CFG->libdir.'/adminlib.php'); require_once($CFG->dirroot . '/admin/mnet/services_form.php'); $mnet = get_mnet_environment(); diff --git a/admin/mnet/testclient.php b/admin/mnet/testclient.php index f43225c631e74..2560e847f6bb8 100644 --- a/admin/mnet/testclient.php +++ b/admin/mnet/testclient.php @@ -12,7 +12,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU Public License * @package mnet */ -require_once(dirname(dirname(dirname(__FILE__))) . '/config.php'); +require(__DIR__.'/../../config.php'); require_once $CFG->dirroot.'/mnet/xmlrpc/client.php'; require_once($CFG->libdir.'/adminlib.php'); include_once($CFG->dirroot.'/mnet/lib.php'); diff --git a/admin/mnet/trustedhosts.php b/admin/mnet/trustedhosts.php index 290c0ae921204..cbbbfa353cc1e 100644 --- a/admin/mnet/trustedhosts.php +++ b/admin/mnet/trustedhosts.php @@ -1,7 +1,7 @@ libdir.'/adminlib.php'); include_once($CFG->dirroot.'/mnet/lib.php'); diff --git a/admin/oauth2callback.php b/admin/oauth2callback.php index c032a9c2f1670..08bb01d78e3b6 100644 --- a/admin/oauth2callback.php +++ b/admin/oauth2callback.php @@ -28,7 +28,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(__FILE__)).'/config.php'); +require_once(__DIR__ . '/../config.php'); // The authorization code generated by the authorization server. $code = required_param('code', PARAM_RAW); diff --git a/admin/plagiarism.php b/admin/plagiarism.php index d0048693c4911..d0a3f5f8372f8 100644 --- a/admin/plagiarism.php +++ b/admin/plagiarism.php @@ -26,7 +26,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(__FILE__)) . '/config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->libdir.'/adminlib.php'); require_once($CFG->libdir.'/tablelib.php'); diff --git a/admin/plugins.php b/admin/plugins.php index 39510cc86fc48..1176f3b292847 100644 --- a/admin/plugins.php +++ b/admin/plugins.php @@ -24,7 +24,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(__FILE__)) . '/config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->libdir . '/adminlib.php'); require_once($CFG->libdir . '/filelib.php'); diff --git a/admin/portfolio.php b/admin/portfolio.php index 48237bbb33a26..6a33fc0eea03f 100644 --- a/admin/portfolio.php +++ b/admin/portfolio.php @@ -1,6 +1,6 @@ libdir . '/portfoliolib.php'); require_once($CFG->libdir . '/portfolio/forms.php'); require_once($CFG->libdir . '/adminlib.php'); diff --git a/admin/process_email.php b/admin/process_email.php index 20ad4c1ec4daf..6d7ed7181ae3b 100644 --- a/admin/process_email.php +++ b/admin/process_email.php @@ -3,7 +3,7 @@ //error_reporting(0); //ini_set('display_errors',0); -require_once(dirname(dirname(__FILE__)).'/config.php'); +require_once(__DIR__ . '/../config.php'); $tmp = explode('@',$_ENV['RECIPIENT']); $address = $tmp[0]; diff --git a/admin/qbehaviours.php b/admin/qbehaviours.php index 7cd027e2ef68f..057429cf5c075 100644 --- a/admin/qbehaviours.php +++ b/admin/qbehaviours.php @@ -25,7 +25,7 @@ */ -require_once(dirname(__FILE__) . '/../config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->libdir . '/questionlib.php'); require_once($CFG->libdir . '/adminlib.php'); require_once($CFG->libdir . '/tablelib.php'); diff --git a/admin/qtypes.php b/admin/qtypes.php index 80c6c6d76d255..b13baf074ccd9 100644 --- a/admin/qtypes.php +++ b/admin/qtypes.php @@ -25,7 +25,7 @@ */ -require_once(dirname(__FILE__) . '/../config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->libdir . '/questionlib.php'); require_once($CFG->libdir . '/adminlib.php'); require_once($CFG->libdir . '/tablelib.php'); diff --git a/admin/reports.php b/admin/reports.php index e4db14993dfdd..c3d648c9caf45 100644 --- a/admin/reports.php +++ b/admin/reports.php @@ -27,7 +27,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->libdir.'/adminlib.php'); require_once($CFG->libdir.'/tablelib.php'); diff --git a/admin/repository.php b/admin/repository.php index e01490e4659df..bf10f510c4ec8 100644 --- a/admin/repository.php +++ b/admin/repository.php @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -require_once(dirname(dirname(__FILE__)) . '/config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->dirroot . '/repository/lib.php'); require_once($CFG->libdir . '/adminlib.php'); diff --git a/admin/repositoryinstance.php b/admin/repositoryinstance.php index 0373857601052..960d0ff28c0ce 100644 --- a/admin/repositoryinstance.php +++ b/admin/repositoryinstance.php @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -require_once(dirname(dirname(__FILE__)) . '/config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->dirroot . '/repository/lib.php'); require_once($CFG->libdir . '/adminlib.php'); diff --git a/admin/resetemoticons.php b/admin/resetemoticons.php index 09a44bbb23b57..5c65c559bb142 100644 --- a/admin/resetemoticons.php +++ b/admin/resetemoticons.php @@ -23,7 +23,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require(dirname(dirname(__FILE__)) . '/config.php'); +require(__DIR__ . '/../config.php'); require_once($CFG->libdir.'/adminlib.php'); admin_externalpage_setup('resetemoticons'); diff --git a/admin/roles/allow.php b/admin/roles/allow.php index 8ffd54d71cd69..383455e0d2716 100644 --- a/admin/roles/allow.php +++ b/admin/roles/allow.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../../config.php'); +require_once(__DIR__ . '/../../config.php'); require_once($CFG->libdir . '/adminlib.php'); $mode = required_param('mode', PARAM_ALPHANUMEXT); diff --git a/admin/roles/check.php b/admin/roles/check.php index 79c697be99e1a..6649aaf59921a 100644 --- a/admin/roles/check.php +++ b/admin/roles/check.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../../config.php'); +require_once(__DIR__ . '/../../config.php'); $contextid = required_param('contextid', PARAM_INT); diff --git a/admin/roles/define.php b/admin/roles/define.php index 8e9839967929a..5a5e6a3a00577 100644 --- a/admin/roles/define.php +++ b/admin/roles/define.php @@ -28,7 +28,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../../config.php'); +require_once(__DIR__ . '/../../config.php'); require_once($CFG->libdir.'/adminlib.php'); $action = required_param('action', PARAM_ALPHA); diff --git a/admin/roles/manage.php b/admin/roles/manage.php index 6cd63abee8315..d5a95320c3c65 100644 --- a/admin/roles/manage.php +++ b/admin/roles/manage.php @@ -31,7 +31,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../../config.php'); +require_once(__DIR__ . '/../../config.php'); require_once($CFG->libdir.'/adminlib.php'); require_once($CFG->dirroot . '/' . $CFG->admin . '/roles/lib.php'); diff --git a/admin/tool/assignmentupgrade/batchupgrade.php b/admin/tool/assignmentupgrade/batchupgrade.php index 0d92dc0cb56fd..7744063fe396b 100644 --- a/admin/tool/assignmentupgrade/batchupgrade.php +++ b/admin/tool/assignmentupgrade/batchupgrade.php @@ -24,7 +24,7 @@ define('NO_OUTPUT_BUFFERING', true); -require_once(dirname(__FILE__) . '/../../../config.php'); +require_once(__DIR__ . '/../../../config.php'); require_once($CFG->libdir . '/adminlib.php'); require_once($CFG->dirroot . '/'.$CFG->admin.'/tool/assignmentupgrade/locallib.php'); require_once($CFG->dirroot . '/'.$CFG->admin.'/tool/assignmentupgrade/upgradableassignmentstable.php'); diff --git a/admin/tool/assignmentupgrade/index.php b/admin/tool/assignmentupgrade/index.php index d9e554df5fa82..7720ac7718b47 100644 --- a/admin/tool/assignmentupgrade/index.php +++ b/admin/tool/assignmentupgrade/index.php @@ -33,7 +33,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../../../config.php'); +require_once(__DIR__ . '/../../../config.php'); require_once($CFG->libdir . '/adminlib.php'); require_once($CFG->dirroot . '/'.$CFG->admin.'/tool/assignmentupgrade/locallib.php'); diff --git a/admin/tool/assignmentupgrade/listnotupgraded.php b/admin/tool/assignmentupgrade/listnotupgraded.php index 048ded5b49284..08360765623a9 100644 --- a/admin/tool/assignmentupgrade/listnotupgraded.php +++ b/admin/tool/assignmentupgrade/listnotupgraded.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../../../config.php'); +require_once(__DIR__ . '/../../../config.php'); require_once($CFG->libdir . '/adminlib.php'); require_once($CFG->dirroot . '/'.$CFG->admin.'/tool/assignmentupgrade/locallib.php'); require_once($CFG->dirroot . '/'.$CFG->admin.'/tool/assignmentupgrade/upgradableassignmentstable.php'); diff --git a/admin/tool/assignmentupgrade/upgradesingle.php b/admin/tool/assignmentupgrade/upgradesingle.php index 5a5679a0ce122..8a1f78d05f92e 100644 --- a/admin/tool/assignmentupgrade/upgradesingle.php +++ b/admin/tool/assignmentupgrade/upgradesingle.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../../../config.php'); +require_once(__DIR__ . '/../../../config.php'); require_once($CFG->libdir . '/adminlib.php'); require_once($CFG->dirroot . '/'.$CFG->admin.'/tool/assignmentupgrade/locallib.php'); diff --git a/admin/tool/assignmentupgrade/upgradesingleconfirm.php b/admin/tool/assignmentupgrade/upgradesingleconfirm.php index 88be9a57188ff..3c41fd9416582 100644 --- a/admin/tool/assignmentupgrade/upgradesingleconfirm.php +++ b/admin/tool/assignmentupgrade/upgradesingleconfirm.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../../../config.php'); +require_once(__DIR__ . '/../../../config.php'); require_once($CFG->libdir . '/adminlib.php'); require_once($CFG->dirroot . '/'.$CFG->admin.'/tool/assignmentupgrade/locallib.php'); diff --git a/admin/tool/capability/index.php b/admin/tool/capability/index.php index 45f90020d024c..57f071678c87c 100644 --- a/admin/tool/capability/index.php +++ b/admin/tool/capability/index.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../../../config.php'); +require_once(__DIR__ . '/../../../config.php'); require_once($CFG->dirroot.'/'.$CFG->admin.'/tool/capability/locallib.php'); require_once($CFG->libdir.'/adminlib.php'); diff --git a/admin/tool/cohortroles/index.php b/admin/tool/cohortroles/index.php index d53af3e9f5c45..cc9947cc70d5c 100644 --- a/admin/tool/cohortroles/index.php +++ b/admin/tool/cohortroles/index.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../../../config.php'); +require_once(__DIR__ . '/../../../config.php'); require_once($CFG->libdir.'/adminlib.php'); require_once($CFG->libdir.'/tablelib.php'); diff --git a/admin/tool/customlang/edit.php b/admin/tool/customlang/edit.php index 8ad4536715b9b..aabc31eb133cd 100644 --- a/admin/tool/customlang/edit.php +++ b/admin/tool/customlang/edit.php @@ -21,7 +21,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require(dirname(dirname(dirname(dirname(__FILE__)))) . '/config.php'); +require(__DIR__ . '/../../../config.php'); require_once($CFG->dirroot.'/'.$CFG->admin.'/tool/customlang/locallib.php'); require_once($CFG->dirroot.'/'.$CFG->admin.'/tool/customlang/filter_form.php'); require_once($CFG->libdir.'/adminlib.php'); diff --git a/admin/tool/customlang/index.php b/admin/tool/customlang/index.php index 4d120ffdba34e..90313296560ff 100644 --- a/admin/tool/customlang/index.php +++ b/admin/tool/customlang/index.php @@ -25,7 +25,7 @@ define('NO_OUTPUT_BUFFERING', true); // progress bar is used here -require(dirname(dirname(dirname(dirname(__FILE__)))) . '/config.php'); +require(__DIR__ . '/../../../config.php'); require_once($CFG->dirroot.'/'.$CFG->admin.'/tool/customlang/locallib.php'); require_once($CFG->libdir.'/adminlib.php'); diff --git a/admin/tool/generator/cli/maketestcourse.php b/admin/tool/generator/cli/maketestcourse.php index cbd43e109096a..124e286704c54 100644 --- a/admin/tool/generator/cli/maketestcourse.php +++ b/admin/tool/generator/cli/maketestcourse.php @@ -25,7 +25,7 @@ define('CLI_SCRIPT', true); define('NO_OUTPUT_BUFFERING', true); -require(dirname(__FILE__) . '/../../../../config.php'); +require(__DIR__ . '/../../../../config.php'); require_once($CFG->libdir. '/clilib.php'); // CLI options. diff --git a/admin/tool/generator/cli/maketestplan.php b/admin/tool/generator/cli/maketestplan.php index 78ab7e4974d68..1dbb2ae149824 100644 --- a/admin/tool/generator/cli/maketestplan.php +++ b/admin/tool/generator/cli/maketestplan.php @@ -25,7 +25,7 @@ define('CLI_SCRIPT', true); define('NO_OUTPUT_BUFFERING', true); -require(dirname(__FILE__) . '/../../../../config.php'); +require(__DIR__ . '/../../../../config.php'); require_once($CFG->libdir. '/clilib.php'); // CLI options. diff --git a/admin/tool/generator/index.php b/admin/tool/generator/index.php index 3c26f503740e2..84341b3f3f290 100644 --- a/admin/tool/generator/index.php +++ b/admin/tool/generator/index.php @@ -21,7 +21,7 @@ * @copyright 2009 Nicolas Connault * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require(dirname(__FILE__) . '/../../../config.php'); +require(__DIR__ . '/../../../config.php'); // This index page was previously in use, for now we redirect to the make test // course page - but we might reinstate this page in the future. diff --git a/admin/tool/installaddon/index.php b/admin/tool/installaddon/index.php index cd6e7f43e9237..453eed4044d44 100644 --- a/admin/tool/installaddon/index.php +++ b/admin/tool/installaddon/index.php @@ -23,7 +23,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require(dirname(__FILE__) . '/../../../config.php'); +require(__DIR__ . '/../../../config.php'); require_once($CFG->libdir.'/adminlib.php'); admin_externalpage_setup('tool_installaddon_index'); diff --git a/admin/tool/installaddon/permcheck.php b/admin/tool/installaddon/permcheck.php index 8df27d08e5807..db4888485977d 100644 --- a/admin/tool/installaddon/permcheck.php +++ b/admin/tool/installaddon/permcheck.php @@ -26,7 +26,7 @@ define('AJAX_SCRIPT', true); -require(dirname(__FILE__) . '/../../../config.php'); +require(__DIR__ . '/../../../config.php'); require_once($CFG->libdir.'/adminlib.php'); require_login(); diff --git a/admin/tool/messageinbound/index.php b/admin/tool/messageinbound/index.php index 4d1c10c514320..8d04d450aedd6 100644 --- a/admin/tool/messageinbound/index.php +++ b/admin/tool/messageinbound/index.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../../../config.php'); +require_once(__DIR__ . '/../../../config.php'); require_once($CFG->libdir.'/adminlib.php'); require_once($CFG->libdir.'/tablelib.php'); diff --git a/admin/tool/phpunit/index.php b/admin/tool/phpunit/index.php index 774d4eec0c904..d49d1dceff28f 100644 --- a/admin/tool/phpunit/index.php +++ b/admin/tool/phpunit/index.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require(dirname(__FILE__) . '/../../../config.php'); +require(__DIR__ . '/../../../config.php'); require_once($CFG->libdir.'/adminlib.php'); admin_externalpage_setup('toolphpunit'); diff --git a/admin/tool/phpunit/webrunner.php b/admin/tool/phpunit/webrunner.php index 482d39ee5e47c..47a2b42ecb66d 100644 --- a/admin/tool/phpunit/webrunner.php +++ b/admin/tool/phpunit/webrunner.php @@ -24,7 +24,7 @@ define('NO_OUTPUT_BUFFERING', true); -require(dirname(__FILE__) . '/../../../config.php'); +require(__DIR__ . '/../../../config.php'); require_once($CFG->libdir.'/adminlib.php'); $testpath = optional_param('testpath', '', PARAM_PATH); diff --git a/admin/tool/profiling/export.php b/admin/tool/profiling/export.php index 32adc0d0c497c..63d4986f693d6 100644 --- a/admin/tool/profiling/export.php +++ b/admin/tool/profiling/export.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../../../config.php'); +require_once(__DIR__ . '/../../../config.php'); require_once($CFG->libdir.'/adminlib.php'); require_once($CFG->libdir . '/xhprof/xhprof_moodle.php'); diff --git a/admin/tool/profiling/import.php b/admin/tool/profiling/import.php index 04c216e8f46d5..9e81f9707ddd1 100644 --- a/admin/tool/profiling/import.php +++ b/admin/tool/profiling/import.php @@ -22,10 +22,10 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../../../config.php'); +require_once(__DIR__ . '/../../../config.php'); require_once($CFG->libdir.'/adminlib.php'); require_once($CFG->libdir . '/xhprof/xhprof_moodle.php'); -require_once(dirname(__FILE__) . '/import_form.php'); +require_once(__DIR__ . '/import_form.php'); admin_externalpage_setup('toolprofiling'); diff --git a/admin/tool/profiling/index.php b/admin/tool/profiling/index.php index e602e44196b01..7a6c455ee61f0 100644 --- a/admin/tool/profiling/index.php +++ b/admin/tool/profiling/index.php @@ -26,7 +26,7 @@ // TODO: it is wrong when core lib references ANY plugin lang strings, maybe more login could be moved here (skodak) -require_once(dirname(__FILE__) . '/../../../config.php'); +require_once(__DIR__ . '/../../../config.php'); require_once($CFG->libdir.'/adminlib.php'); require_once($CFG->libdir . '/xhprof/xhprof_moodle.php'); diff --git a/admin/tool/recyclebin/index.php b/admin/tool/recyclebin/index.php index c509b27e08b89..42a3f5a18c806 100644 --- a/admin/tool/recyclebin/index.php +++ b/admin/tool/recyclebin/index.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../../../config.php'); +require_once(__DIR__ . '/../../../config.php'); require_once($CFG->libdir . '/tablelib.php'); $contextid = required_param('contextid', PARAM_INT); diff --git a/admin/tool/task/scheduledtasks.php b/admin/tool/task/scheduledtasks.php index ed6e53c0a66f4..9af5359ce2c2a 100644 --- a/admin/tool/task/scheduledtasks.php +++ b/admin/tool/task/scheduledtasks.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../../../config.php'); +require_once(__DIR__ . '/../../../config.php'); require_once($CFG->libdir.'/adminlib.php'); require_once($CFG->libdir.'/tablelib.php'); diff --git a/admin/tool/unsuproles/index.php b/admin/tool/unsuproles/index.php index f010f72d0e181..8248e27a8af84 100644 --- a/admin/tool/unsuproles/index.php +++ b/admin/tool/unsuproles/index.php @@ -24,7 +24,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../../../config.php'); +require_once(__DIR__ . '/../../../config.php'); require_once($CFG->libdir.'/adminlib.php'); $action = optional_param('action', '', PARAM_ALPHANUMEXT); diff --git a/admin/tool/xmldb/actions/generate_all_documentation/generate_all_documentation.class.php b/admin/tool/xmldb/actions/generate_all_documentation/generate_all_documentation.class.php index 8fffd02eaeb31..20f3ab7f975df 100644 --- a/admin/tool/xmldb/actions/generate_all_documentation/generate_all_documentation.class.php +++ b/admin/tool/xmldb/actions/generate_all_documentation/generate_all_documentation.class.php @@ -83,7 +83,7 @@ function invoke() { $doc = new DOMDocument(); $xsl = new XSLTProcessor(); - $doc->load(dirname(__FILE__).'/../generate_documentation/xmldb.xsl'); + $doc->load(__DIR__.'/../generate_documentation/xmldb.xsl'); $xsl->importStyleSheet($doc); $dbdirs = get_db_directories(); diff --git a/admin/tool/xmldb/actions/generate_documentation/generate_documentation.class.php b/admin/tool/xmldb/actions/generate_documentation/generate_documentation.class.php index 30667991f82d1..9c724416ed2a4 100644 --- a/admin/tool/xmldb/actions/generate_documentation/generate_documentation.class.php +++ b/admin/tool/xmldb/actions/generate_documentation/generate_documentation.class.php @@ -87,7 +87,7 @@ function invoke() { $doc = new DOMDocument(); $xsl = new XSLTProcessor(); - $doc->load(dirname(__FILE__).'/xmldb.xsl'); + $doc->load(__DIR__.'/xmldb.xsl'); $xsl->importStyleSheet($doc); $doc->load($path); diff --git a/admin/tools.php b/admin/tools.php index d4223b6bd88bc..e0559eec7786f 100644 --- a/admin/tools.php +++ b/admin/tools.php @@ -27,7 +27,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->libdir.'/adminlib.php'); require_once($CFG->libdir.'/tablelib.php'); diff --git a/auth/cas/cli/sync_users.php b/auth/cas/cli/sync_users.php index a78f91dd18287..1dec37b457d4d 100644 --- a/auth/cas/cli/sync_users.php +++ b/auth/cas/cli/sync_users.php @@ -42,7 +42,7 @@ define('CLI_SCRIPT', true); -require(dirname(dirname(dirname(dirname(__FILE__)))).'/config.php'); +require(__DIR__.'/../../../config.php'); require_once($CFG->dirroot.'/course/lib.php'); require_once($CFG->libdir.'/clilib.php'); diff --git a/auth/ldap/cli/sync_users.php b/auth/ldap/cli/sync_users.php index ee44dcf660616..d3d588b9e2cfa 100644 --- a/auth/ldap/cli/sync_users.php +++ b/auth/ldap/cli/sync_users.php @@ -46,7 +46,7 @@ define('CLI_SCRIPT', true); -require(dirname(dirname(dirname(dirname(__FILE__)))).'/config.php'); // global moodle config file. +require(__DIR__.'/../../../config.php'); // global moodle config file. require_once($CFG->dirroot.'/course/lib.php'); require_once($CFG->libdir.'/clilib.php'); diff --git a/auth/ldap/ntlmsso_attempt.php b/auth/ldap/ntlmsso_attempt.php index de1e4eb28ef30..561d7bf9d47ec 100644 --- a/auth/ldap/ntlmsso_attempt.php +++ b/auth/ldap/ntlmsso_attempt.php @@ -1,6 +1,6 @@ loginhttps enabled $PAGE->https_required(); diff --git a/auth/ldap/ntlmsso_finish.php b/auth/ldap/ntlmsso_finish.php index 04bcb0fd63a12..26a5129fa2f8d 100644 --- a/auth/ldap/ntlmsso_finish.php +++ b/auth/ldap/ntlmsso_finish.php @@ -1,6 +1,6 @@ loginhttps enabled $PAGE->https_required(); diff --git a/auth/ldap/ntlmsso_magic.php b/auth/ldap/ntlmsso_magic.php index 37228c18f6bfa..5d02ebe61c5de 100644 --- a/auth/ldap/ntlmsso_magic.php +++ b/auth/ldap/ntlmsso_magic.php @@ -6,7 +6,7 @@ // of the webserver. define('NO_MOODLE_COOKIES', true); -require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); +require(__DIR__.'/../../config.php'); //HTTPS is required in this page when $CFG->loginhttps enabled $PAGE->https_required(); diff --git a/auth/mnet/jump.php b/auth/mnet/jump.php index d72e206628f2c..6ee75590033e0 100644 --- a/auth/mnet/jump.php +++ b/auth/mnet/jump.php @@ -23,7 +23,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU Public License */ -require_once dirname(dirname(dirname(__FILE__))) . '/config.php'; +require_once __DIR__ . '/../../config.php'; // grab the GET params - wantsurl could be anything - take it // with PARAM_RAW diff --git a/auth/mnet/land.php b/auth/mnet/land.php index 8be9cf395d68a..07317d1cd5b1a 100644 --- a/auth/mnet/land.php +++ b/auth/mnet/land.php @@ -23,7 +23,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU Public License */ -require_once dirname(dirname(dirname(__FILE__))) . '/config.php'; +require_once __DIR__ . '/../../config.php'; require_once $CFG->dirroot . '/mnet/xmlrpc/client.php'; // grab the GET params diff --git a/backup/backupfilesedit.php b/backup/backupfilesedit.php index ac5584cd38043..86ce136b865cf 100644 --- a/backup/backupfilesedit.php +++ b/backup/backupfilesedit.php @@ -23,7 +23,7 @@ */ require_once('../config.php'); -require_once(dirname(__FILE__) . '/backupfilesedit_form.php'); +require_once(__DIR__ . '/backupfilesedit_form.php'); require_once($CFG->dirroot . '/backup/util/includes/restore_includes.php'); require_once($CFG->dirroot . '/repository/lib.php'); diff --git a/backup/cc/cc_lib/gral_lib/ccdependencyparser.php b/backup/cc/cc_lib/gral_lib/ccdependencyparser.php index 66fc55caac8d3..6fddb4d53bbaa 100644 --- a/backup/cc/cc_lib/gral_lib/ccdependencyparser.php +++ b/backup/cc/cc_lib/gral_lib/ccdependencyparser.php @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -require_once(dirname(__FILE__) .'/../xmlbase.php'); +require_once(__DIR__ .'/../xmlbase.php'); require_once('cssparser.php'); require_once('pathutils.php'); diff --git a/backup/cc/cc_lib/gral_lib/functions.php b/backup/cc/cc_lib/gral_lib/functions.php index 2d62dc8c603cb..f0b65b99ad670 100644 --- a/backup/cc/cc_lib/gral_lib/functions.php +++ b/backup/cc/cc_lib/gral_lib/functions.php @@ -53,7 +53,7 @@ function errorHandler($errno, $errstr, $errfile, $errline) { */ function file_mime_type ($file, $default_type = 'application/octet-stream'){ $ftype = $default_type; - $magic_path = dirname(__FILE__) + $magic_path = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR diff --git a/backup/converter/moodle1/lib.php b/backup/converter/moodle1/lib.php index 2f8232a93363d..6710afd77e5bf 100644 --- a/backup/converter/moodle1/lib.php +++ b/backup/converter/moodle1/lib.php @@ -33,7 +33,7 @@ require_once($CFG->dirroot . '/backup/util/dbops/backup_controller_dbops.class.php'); require_once($CFG->dirroot . '/backup/util/dbops/restore_dbops.class.php'); require_once($CFG->dirroot . '/backup/util/xml/contenttransformer/xml_contenttransformer.class.php'); -require_once(dirname(__FILE__) . '/handlerlib.php'); +require_once(__DIR__ . '/handlerlib.php'); /** * Converter of Moodle 1.9 backup into Moodle 2.x format diff --git a/backup/restorefile.php b/backup/restorefile.php index 411aeb607d7e7..ee2114041d7be 100644 --- a/backup/restorefile.php +++ b/backup/restorefile.php @@ -23,7 +23,7 @@ */ require_once('../config.php'); -require_once(dirname(__FILE__) . '/restorefile_form.php'); +require_once(__DIR__ . '/restorefile_form.php'); require_once($CFG->dirroot . '/backup/util/includes/restore_includes.php'); // current context diff --git a/badges/action.php b/badges/action.php index db431720bb616..05dafddb7442e 100644 --- a/badges/action.php +++ b/badges/action.php @@ -24,7 +24,7 @@ * @author Yuliya Bozhko */ -require_once(dirname(dirname(__FILE__)) . '/config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->libdir . '/badgeslib.php'); $badgeid = required_param('id', PARAM_INT); diff --git a/badges/ajax.php b/badges/ajax.php index 1615daccc04c6..b3528c56bbf5d 100644 --- a/badges/ajax.php +++ b/badges/ajax.php @@ -26,7 +26,7 @@ define('AJAX_SCRIPT', true); -require_once(dirname(dirname(__FILE__)) . '/config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->libdir . '/badgeslib.php'); require_login(); diff --git a/badges/assertion.php b/badges/assertion.php index 2e35176c7a47d..be307147927eb 100644 --- a/badges/assertion.php +++ b/badges/assertion.php @@ -27,7 +27,7 @@ define('AJAX_SCRIPT', true); define('NO_MOODLE_COOKIES', true); // No need for a session here. -require_once(dirname(dirname(__FILE__)) . '/config.php'); +require_once(__DIR__ . '/../config.php'); if (empty($CFG->enablebadges)) { print_error('badgesdisabled', 'badges'); diff --git a/badges/award.php b/badges/award.php index e80fa9228ce47..938c795cb73dc 100644 --- a/badges/award.php +++ b/badges/award.php @@ -24,7 +24,7 @@ * @author Yuliya Bozhko */ -require_once(dirname(dirname(__FILE__)) . '/config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->libdir . '/badgeslib.php'); require_once($CFG->dirroot . '/badges/lib/awardlib.php'); diff --git a/badges/backpackconnect.php b/badges/backpackconnect.php index 9365afea7967e..2854cb5549133 100644 --- a/badges/backpackconnect.php +++ b/badges/backpackconnect.php @@ -26,7 +26,7 @@ define('AJAX_SCRIPT', true); -require_once(dirname(dirname(__FILE__)) . '/config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->dirroot . '/badges/lib/backpacklib.php'); require_once($CFG->libdir . '/filelib.php'); require_once($CFG->libdir . '/badgeslib.php'); diff --git a/badges/badge.php b/badges/badge.php index 68cf109cb4f56..4d38580526a7e 100644 --- a/badges/badge.php +++ b/badges/badge.php @@ -24,7 +24,7 @@ * @author Yuliya Bozhko */ -require_once(dirname(dirname(__FILE__)) . '/config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->libdir . '/badgeslib.php'); require_once($CFG->libdir . '/filelib.php'); diff --git a/badges/criteria.php b/badges/criteria.php index ad4b5a614da55..0a9f290967b4c 100644 --- a/badges/criteria.php +++ b/badges/criteria.php @@ -24,7 +24,7 @@ * @author Yuliya Bozhko */ -require_once(dirname(dirname(__FILE__)) . '/config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->libdir . '/badgeslib.php'); $badgeid = required_param('id', PARAM_INT); diff --git a/badges/criteria_action.php b/badges/criteria_action.php index aef6ca002dcda..0766f885c9fc6 100644 --- a/badges/criteria_action.php +++ b/badges/criteria_action.php @@ -24,7 +24,7 @@ * @author Yuliya Bozhko */ -require_once(dirname(dirname(__FILE__)) . '/config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->libdir . '/badgeslib.php'); $badgeid = optional_param('badgeid', 0, PARAM_INT); // Badge ID. diff --git a/badges/criteria_settings.php b/badges/criteria_settings.php index d31f3abe47973..cd2cb213b975f 100644 --- a/badges/criteria_settings.php +++ b/badges/criteria_settings.php @@ -24,7 +24,7 @@ * @author Yuliya Bozhko */ -require_once(dirname(dirname(__FILE__)) . '/config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->libdir . '/badgeslib.php'); require_once($CFG->dirroot . '/badges/criteria_form.php'); diff --git a/badges/edit.php b/badges/edit.php index 0deb27288a0f3..c89aba43f0d7b 100644 --- a/badges/edit.php +++ b/badges/edit.php @@ -24,7 +24,7 @@ * @author Yuliya Bozhko */ -require_once(dirname(dirname(__FILE__)) . '/config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->libdir . '/badgeslib.php'); require_once($CFG->dirroot . '/badges/edit_form.php'); diff --git a/badges/external.php b/badges/external.php index 1a9cee8f0dd97..d05dbacd13dff 100644 --- a/badges/external.php +++ b/badges/external.php @@ -24,7 +24,7 @@ * @author Yuliya Bozhko */ -require_once(dirname(dirname(__FILE__)) . '/config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->libdir . '/badgeslib.php'); $json = optional_param('badge', null, PARAM_RAW); diff --git a/badges/index.php b/badges/index.php index a1102232aa8a3..732d9d507f18e 100644 --- a/badges/index.php +++ b/badges/index.php @@ -24,7 +24,7 @@ * @author Yuliya Bozhko */ -require_once(dirname(dirname(__FILE__)) . '/config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->libdir . '/badgeslib.php'); $type = required_param('type', PARAM_INT); diff --git a/badges/mybackpack.php b/badges/mybackpack.php index c2222f00bd98a..d9baedd7caf65 100644 --- a/badges/mybackpack.php +++ b/badges/mybackpack.php @@ -24,7 +24,7 @@ * @author Yuliya Bozhko */ -require_once(dirname(dirname(__FILE__)) . '/config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->libdir . '/badgeslib.php'); require_once($CFG->dirroot . '/badges/backpack_form.php'); require_once($CFG->dirroot . '/badges/lib/backpacklib.php'); diff --git a/badges/mybadges.php b/badges/mybadges.php index e523b3ea1c1ab..0ef4f68046dce 100644 --- a/badges/mybadges.php +++ b/badges/mybadges.php @@ -24,7 +24,7 @@ * @author Yuliya Bozhko */ -require_once(dirname(dirname(__FILE__)) . '/config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->libdir . '/badgeslib.php'); require_once($CFG->libdir . '/filelib.php'); diff --git a/badges/newbadge.php b/badges/newbadge.php index de5c447ec2d22..6c3b74c523a8d 100644 --- a/badges/newbadge.php +++ b/badges/newbadge.php @@ -24,7 +24,7 @@ * @author Yuliya Bozhko */ -require_once(dirname(dirname(__FILE__)) . '/config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->libdir . '/badgeslib.php'); require_once($CFG->dirroot . '/badges/edit_form.php'); diff --git a/badges/overview.php b/badges/overview.php index fa5e64012ca70..fab163f56c86d 100644 --- a/badges/overview.php +++ b/badges/overview.php @@ -24,7 +24,7 @@ * @author Yuliya Bozhko */ -require_once(dirname(dirname(__FILE__)) . '/config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->libdir . '/badgeslib.php'); $badgeid = required_param('id', PARAM_INT); diff --git a/badges/preferences.php b/badges/preferences.php index aa650342817d5..5152089925d3e 100644 --- a/badges/preferences.php +++ b/badges/preferences.php @@ -24,7 +24,7 @@ * @author Yuliya Bozhko */ -require_once(dirname(dirname(__FILE__)) . '/config.php'); +require_once(__DIR__ . '/../config.php'); require_once('preferences_form.php'); $url = new moodle_url('/badges/preferences.php'); diff --git a/badges/recipients.php b/badges/recipients.php index 1e31410d17566..244fef3a3b1f1 100644 --- a/badges/recipients.php +++ b/badges/recipients.php @@ -24,7 +24,7 @@ * @author Yuliya Bozhko */ -require_once(dirname(dirname(__FILE__)) . '/config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->libdir . '/badgeslib.php'); $badgeid = required_param('id', PARAM_INT); diff --git a/badges/view.php b/badges/view.php index ed1aa7df98a01..efa53c8155464 100644 --- a/badges/view.php +++ b/badges/view.php @@ -24,7 +24,7 @@ * @author Yuliya Bozhko */ -require_once(dirname(dirname(__FILE__)) . '/config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->libdir . '/badgeslib.php'); $type = required_param('type', PARAM_INT); diff --git a/blocks/completionstatus/details.php b/blocks/completionstatus/details.php index 38d89b34a5757..abb479b7558fc 100644 --- a/blocks/completionstatus/details.php +++ b/blocks/completionstatus/details.php @@ -23,7 +23,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__).'/../../config.php'); +require_once(__DIR__.'/../../config.php'); require_once("{$CFG->libdir}/completionlib.php"); // Load data. diff --git a/blocks/course_overview/move.php b/blocks/course_overview/move.php index 2b5e74d60e1c0..b6f042dd7a196 100644 --- a/blocks/course_overview/move.php +++ b/blocks/course_overview/move.php @@ -21,8 +21,8 @@ * @copyright 2012 Adam Olley * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../../config.php'); -require_once(dirname(__FILE__) . '/locallib.php'); +require_once(__DIR__ . '/../../config.php'); +require_once(__DIR__ . '/locallib.php'); require_sesskey(); require_login(); diff --git a/blocks/course_overview/save.php b/blocks/course_overview/save.php index 51a4eb1435b5a..b4bb175bfa504 100644 --- a/blocks/course_overview/save.php +++ b/blocks/course_overview/save.php @@ -23,8 +23,8 @@ */ define('AJAX_SCRIPT', true); -require_once(dirname(__FILE__) . '/../../config.php'); -require_once(dirname(__FILE__) . '/locallib.php'); +require_once(__DIR__ . '/../../config.php'); +require_once(__DIR__ . '/locallib.php'); require_sesskey(); require_login(); diff --git a/blocks/rss_client/editfeed.php b/blocks/rss_client/editfeed.php index 2b6d92a8a1277..97e1706fa63fb 100644 --- a/blocks/rss_client/editfeed.php +++ b/blocks/rss_client/editfeed.php @@ -23,7 +23,7 @@ */ -require_once(dirname(__FILE__) . '/../../config.php'); +require_once(__DIR__ . '/../../config.php'); require_once($CFG->libdir . '/formslib.php'); require_once($CFG->libdir .'/simplepie/moodle_simplepie.php'); diff --git a/blocks/rss_client/managefeeds.php b/blocks/rss_client/managefeeds.php index 2300fa691f04d..475337ca3496e 100644 --- a/blocks/rss_client/managefeeds.php +++ b/blocks/rss_client/managefeeds.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../../config.php'); +require_once(__DIR__ . '/../../config.php'); require_once($CFG->libdir . '/tablelib.php'); require_login(); diff --git a/blocks/rss_client/tests/cron_test.php b/blocks/rss_client/tests/cron_test.php index e1299a56bd7bb..7f99275254cb6 100644 --- a/blocks/rss_client/tests/cron_test.php +++ b/blocks/rss_client/tests/cron_test.php @@ -23,8 +23,8 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); -require_once(dirname(dirname(__DIR__)) . '/moodleblock.class.php'); -require_once(dirname(__DIR__) . '/block_rss_client.php'); +require_once(__DIR__ . '/../../moodleblock.class.php'); +require_once(__DIR__ . '/../block_rss_client.php'); /** * Class for the PHPunit tests for rss client cron. diff --git a/blocks/rss_client/viewfeed.php b/blocks/rss_client/viewfeed.php index 252431fef4c3b..c56eb30a9202e 100644 --- a/blocks/rss_client/viewfeed.php +++ b/blocks/rss_client/viewfeed.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../../config.php'); +require_once(__DIR__ . '/../../config.php'); require_once($CFG->libdir .'/simplepie/moodle_simplepie.php'); require_login(); diff --git a/blog/edit.php b/blog/edit.php index 6b13994ba1878..36a544cade6c6 100644 --- a/blog/edit.php +++ b/blog/edit.php @@ -23,7 +23,7 @@ * @copyright 2009 Nicolas Connault * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(__FILE__)).'/config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->dirroot . '/blog/lib.php'); require_once($CFG->dirroot . '/blog/locallib.php'); require_once($CFG->dirroot . '/comment/lib.php'); diff --git a/blog/index.php b/blog/index.php index 5aa84bd0e2457..fb1ef89a9c9b0 100644 --- a/blog/index.php +++ b/blog/index.php @@ -20,7 +20,7 @@ * if a blog id is specified then the latest entries from that blog are shown */ -require_once(dirname(dirname(__FILE__)).'/config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->dirroot .'/blog/lib.php'); require_once($CFG->dirroot .'/blog/locallib.php'); require_once($CFG->dirroot .'/course/lib.php'); diff --git a/config-dist.php b/config-dist.php index 30d8c152ee21a..faa77deda2372 100644 --- a/config-dist.php +++ b/config-dist.php @@ -851,7 +851,7 @@ // ALL DONE! To continue installation, visit your main page with a browser //========================================================================= -require_once(dirname(__FILE__) . '/lib/setup.php'); // Do not edit +require_once(__DIR__ . '/lib/setup.php'); // Do not edit // There is no php closing tag in this file, // it is intentional because it prevents trailing whitespace problems! diff --git a/course/category.ajax.php b/course/category.ajax.php index b85f158ea386c..3c69971edd672 100644 --- a/course/category.ajax.php +++ b/course/category.ajax.php @@ -27,7 +27,7 @@ define('AJAX_SCRIPT', true); -require_once(dirname(__dir__) . '/config.php'); +require_once(__DIR__ . '/../config.php'); if ($CFG->forcelogin) { require_login(); diff --git a/course/changenumsections.php b/course/changenumsections.php index beeaea930bf17..584691f1b408f 100644 --- a/course/changenumsections.php +++ b/course/changenumsections.php @@ -25,7 +25,7 @@ * @since Moodle 2.3 */ -require_once(dirname(__FILE__).'/../config.php'); +require_once(__DIR__.'/../config.php'); require_once($CFG->dirroot.'/course/lib.php'); $courseid = required_param('courseid', PARAM_INT); diff --git a/course/delete.php b/course/delete.php index 95bb480827d57..def41a6b7cc27 100644 --- a/course/delete.php +++ b/course/delete.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->dirroot . '/course/lib.php'); $id = required_param('id', PARAM_INT); // Course ID. diff --git a/course/dndupload.php b/course/dndupload.php index 797e6883f8ec8..6653336773d89 100644 --- a/course/dndupload.php +++ b/course/dndupload.php @@ -25,7 +25,7 @@ define('AJAX_SCRIPT', true); -require_once(dirname(dirname(__FILE__)).'/config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->dirroot.'/course/dnduploadlib.php'); $courseid = required_param('course', PARAM_INT); diff --git a/course/modduplicate.php b/course/modduplicate.php index 81eefa6066552..d39a34a208f8d 100644 --- a/course/modduplicate.php +++ b/course/modduplicate.php @@ -28,7 +28,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(__FILE__)) . '/config.php'); +require_once(__DIR__ . '/../config.php'); $cmid = required_param('cmid', PARAM_INT); $courseid = required_param('course', PARAM_INT); diff --git a/course/pending.php b/course/pending.php index 37bd8d062ea69..cfea7380414d9 100644 --- a/course/pending.php +++ b/course/pending.php @@ -30,7 +30,7 @@ * @package course */ -require_once(dirname(__FILE__) . '/../config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->libdir . '/adminlib.php'); require_once($CFG->dirroot . '/course/lib.php'); require_once($CFG->dirroot . '/course/request_form.php'); diff --git a/course/request.php b/course/request.php index 170e3085dc67f..34d02d3385eaa 100644 --- a/course/request.php +++ b/course/request.php @@ -23,7 +23,7 @@ * @package course */ -require_once(dirname(__FILE__) . '/../config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->dirroot . '/course/lib.php'); require_once($CFG->dirroot . '/course/request_form.php'); diff --git a/course/rest.php b/course/rest.php index 42b45ce1303d4..31064e105d69c 100644 --- a/course/rest.php +++ b/course/rest.php @@ -26,7 +26,7 @@ if (!defined('AJAX_SCRIPT')) { define('AJAX_SCRIPT', true); } -require_once(dirname(__FILE__) . '/../config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->dirroot.'/course/lib.php'); // Initialise ALL the incoming parameters here, up front. diff --git a/enrol/imsenterprise/importnow.php b/enrol/imsenterprise/importnow.php index e192e11f5e86e..8b738d0fcb826 100644 --- a/enrol/imsenterprise/importnow.php +++ b/enrol/imsenterprise/importnow.php @@ -21,7 +21,7 @@ * @copyright 2006 Dan Stowell * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(dirname(__FILE__))) . '/config.php'); +require(__DIR__.'/../../config.php'); require_login(0, false); require_capability('moodle/site:config', context_system::instance()); require_sesskey(); diff --git a/enrol/lti/index.php b/enrol/lti/index.php index 3640f864d2ecd..8738f7334300c 100644 --- a/enrol/lti/index.php +++ b/enrol/lti/index.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../../config.php'); +require_once(__DIR__ . '/../../config.php'); require_once($CFG->dirroot.'/enrol/lti/lib.php'); $courseid = required_param('courseid', PARAM_INT); diff --git a/enrol/lti/tool.php b/enrol/lti/tool.php index f7eab435981f2..9dcc3bcca80c5 100644 --- a/enrol/lti/tool.php +++ b/enrol/lti/tool.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../../config.php'); +require_once(__DIR__ . '/../../config.php'); require_once($CFG->dirroot . '/user/lib.php'); require_once($CFG->dirroot . '/enrol/lti/ims-blti/blti.php'); diff --git a/enrol/meta/cli/sync.php b/enrol/meta/cli/sync.php index 0f677acbf12a6..ae400e7b40504 100644 --- a/enrol/meta/cli/sync.php +++ b/enrol/meta/cli/sync.php @@ -30,7 +30,7 @@ define('CLI_SCRIPT', true); -require(dirname(dirname(dirname(dirname(__FILE__)))).'/config.php'); +require(__DIR__.'/../../../config.php'); require_once($CFG->libdir.'/clilib.php'); require_once("$CFG->dirroot/enrol/meta/locallib.php"); diff --git a/enrol/mnet/enrol.php b/enrol/mnet/enrol.php index 78fd0b84762ac..61c5ec9b323cb 100644 --- a/enrol/mnet/enrol.php +++ b/enrol/mnet/enrol.php @@ -125,7 +125,7 @@ public function user_enrolments() { */ public function enrol_user(array $userdata, $courseid) { global $CFG, $DB; - require_once(dirname(__FILE__).'/lib.php'); + require_once(__DIR__.'/lib.php'); if (!$client = get_mnet_remote_client()) { die('Callable via XML-RPC only'); diff --git a/files/coursefilesedit.php b/files/coursefilesedit.php index 56086936420f6..7de259a47b8c4 100644 --- a/files/coursefilesedit.php +++ b/files/coursefilesedit.php @@ -16,7 +16,7 @@ // along with Moodle. If not, see . require_once('../config.php'); -require_once(dirname(__FILE__) . '/coursefilesedit_form.php'); +require_once(__DIR__ . '/coursefilesedit_form.php'); require_once($CFG->dirroot . '/repository/lib.php'); // current context diff --git a/filter/manage.php b/filter/manage.php index f453c976a4099..2f12478a4069e 100644 --- a/filter/manage.php +++ b/filter/manage.php @@ -23,7 +23,7 @@ * @subpackage filter */ -require_once(dirname(__FILE__) . '/../config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->libdir . '/adminlib.php'); $contextid = required_param('contextid',PARAM_INT); diff --git a/filter/mediaplugin/dev/perftest.php b/filter/mediaplugin/dev/perftest.php index e590b396d06e2..1c16a3037d197 100644 --- a/filter/mediaplugin/dev/perftest.php +++ b/filter/mediaplugin/dev/perftest.php @@ -25,7 +25,7 @@ * @package filter_mediaplugin */ -require(dirname(__FILE__) . '/../../../config.php'); +require(__DIR__ . '/../../../config.php'); require_once($CFG->dirroot . '/filter/mediaplugin/filter.php'); // Only available to site admins. diff --git a/grade/edit/outcome/import.php b/grade/edit/outcome/import.php index 506205667fc37..3377552e6bfb0 100644 --- a/grade/edit/outcome/import.php +++ b/grade/edit/outcome/import.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__).'/../../../config.php'); +require_once(__DIR__.'/../../../config.php'); require_once($CFG->dirroot.'/lib/formslib.php'); require_once($CFG->dirroot.'/grade/lib.php'); require_once($CFG->libdir.'/gradelib.php'); diff --git a/grade/edit/outcome/index.php b/grade/edit/outcome/index.php index 658d5cea936fe..236049c08572c 100644 --- a/grade/edit/outcome/index.php +++ b/grade/edit/outcome/index.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__).'/../../../config.php'); +require_once(__DIR__.'/../../../config.php'); require_once($CFG->dirroot.'/grade/lib.php'); require_once($CFG->libdir.'/gradelib.php'); diff --git a/grade/grading/form/guide/edit.php b/grade/grading/form/guide/edit.php index 4d3b8313703a7..a7ce753ff226b 100644 --- a/grade/grading/form/guide/edit.php +++ b/grade/grading/form/guide/edit.php @@ -22,9 +22,9 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(dirname(dirname(dirname(__FILE__))))).'/config.php'); -require_once(dirname(__FILE__).'/lib.php'); -require_once(dirname(__FILE__).'/edit_form.php'); +require_once(__DIR__.'/../../../../config.php'); +require_once(__DIR__.'/lib.php'); +require_once(__DIR__.'/edit_form.php'); require_once($CFG->dirroot.'/grade/grading/lib.php'); $areaid = required_param('areaid', PARAM_INT); diff --git a/grade/grading/form/guide/edit_form.php b/grade/grading/form/guide/edit_form.php index e632bd1b0ae5a..01d061e4d8169 100644 --- a/grade/grading/form/guide/edit_form.php +++ b/grade/grading/form/guide/edit_form.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die(); require_once($CFG->dirroot.'/lib/formslib.php'); -require_once(dirname(__FILE__).'/guideeditor.php'); +require_once(__DIR__.'/guideeditor.php'); MoodleQuickForm::registerElementType('guideeditor', $CFG->dirroot.'/grade/grading/form/guide/guideeditor.php', 'moodlequickform_guideeditor'); diff --git a/grade/grading/form/guide/preview.php b/grade/grading/form/guide/preview.php index a2c6501779858..09607b9cf6f39 100644 --- a/grade/grading/form/guide/preview.php +++ b/grade/grading/form/guide/preview.php @@ -22,9 +22,9 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(dirname(dirname(dirname(__FILE__))))).'/config.php'); -require_once(dirname(__FILE__).'/lib.php'); -require_once(dirname(__FILE__).'/edit_form.php'); +require_once(__DIR__.'/../../../../config.php'); +require_once(__DIR__.'/lib.php'); +require_once(__DIR__.'/edit_form.php'); require_once($CFG->dirroot.'/grade/grading/lib.php'); $areaid = required_param('areaid', PARAM_INT); diff --git a/grade/grading/form/rubric/edit.php b/grade/grading/form/rubric/edit.php index 3ef31571ab9ee..2a6a33c1cf372 100644 --- a/grade/grading/form/rubric/edit.php +++ b/grade/grading/form/rubric/edit.php @@ -22,9 +22,9 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(dirname(dirname(dirname(__FILE__))))).'/config.php'); -require_once(dirname(__FILE__).'/lib.php'); -require_once(dirname(__FILE__).'/edit_form.php'); +require_once(__DIR__.'/../../../../config.php'); +require_once(__DIR__.'/lib.php'); +require_once(__DIR__.'/edit_form.php'); require_once($CFG->dirroot.'/grade/grading/lib.php'); $areaid = required_param('areaid', PARAM_INT); diff --git a/grade/grading/form/rubric/edit_form.php b/grade/grading/form/rubric/edit_form.php index 67aaf11174c53..9b3d795fea526 100644 --- a/grade/grading/form/rubric/edit_form.php +++ b/grade/grading/form/rubric/edit_form.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die(); require_once($CFG->dirroot.'/lib/formslib.php'); -require_once(dirname(__FILE__).'/rubriceditor.php'); +require_once(__DIR__.'/rubriceditor.php'); MoodleQuickForm::registerElementType('rubriceditor', $CFG->dirroot.'/grade/grading/form/rubric/rubriceditor.php', 'MoodleQuickForm_rubriceditor'); /** diff --git a/grade/grading/form/rubric/preview.php b/grade/grading/form/rubric/preview.php index babdef4f48bea..9d35bc20a66b7 100644 --- a/grade/grading/form/rubric/preview.php +++ b/grade/grading/form/rubric/preview.php @@ -22,9 +22,9 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(dirname(dirname(dirname(__FILE__))))).'/config.php'); -require_once(dirname(__FILE__).'/lib.php'); -require_once(dirname(__FILE__).'/edit_form.php'); +require_once(__DIR__.'/../../../../config.php'); +require_once(__DIR__.'/lib.php'); +require_once(__DIR__.'/edit_form.php'); require_once($CFG->dirroot.'/grade/grading/lib.php'); $areaid = required_param('areaid', PARAM_INT); diff --git a/grade/grading/manage.php b/grade/grading/manage.php index fc8483ecd4d32..2871a76388acf 100644 --- a/grade/grading/manage.php +++ b/grade/grading/manage.php @@ -26,7 +26,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); +require(__DIR__.'/../../config.php'); require_once($CFG->dirroot.'/grade/grading/lib.php'); // identify gradable area by its id diff --git a/grade/grading/pick.php b/grade/grading/pick.php index 8de5bcac13bd9..607d68a346f0d 100644 --- a/grade/grading/pick.php +++ b/grade/grading/pick.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); +require(__DIR__.'/../../config.php'); require_once($CFG->dirroot.'/grade/grading/lib.php'); require_once($CFG->dirroot.'/grade/grading/pick_form.php'); diff --git a/grade/import/keymanager.php b/grade/import/keymanager.php index 8c93b7e4027ac..3ff82cbcc8d44 100644 --- a/grade/import/keymanager.php +++ b/grade/import/keymanager.php @@ -23,7 +23,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__).'/../../config.php'); +require_once(__DIR__.'/../../config.php'); require_once($CFG->dirroot.'/grade/lib.php'); $id = required_param('id', PARAM_INT); // course id diff --git a/group/members.php b/group/members.php index 910d170c884c3..f62f45b80db2a 100644 --- a/group/members.php +++ b/group/members.php @@ -22,8 +22,8 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @package core_group */ -require_once(dirname(__FILE__) . '/../config.php'); -require_once(dirname(__FILE__) . '/lib.php'); +require_once(__DIR__ . '/../config.php'); +require_once(__DIR__ . '/lib.php'); require_once($CFG->dirroot . '/user/selector/lib.php'); require_once($CFG->dirroot . '/course/lib.php'); require_once($CFG->libdir . '/filelib.php'); diff --git a/help.php b/help.php index f59b2b64c4f7b..39053dbfe3c10 100644 --- a/help.php +++ b/help.php @@ -28,7 +28,7 @@ define('NO_MOODLE_COOKIES', true); -require_once(dirname(__FILE__) . '/config.php'); +require_once(__DIR__ . '/config.php'); $identifier = required_param('identifier', PARAM_STRINGID); $component = required_param('component', PARAM_COMPONENT); diff --git a/install.php b/install.php index 5fc031ba5895e..6a7209dc7492c 100644 --- a/install.php +++ b/install.php @@ -162,7 +162,7 @@ global $CFG; $CFG = new stdClass(); $CFG->lang = $config->lang; -$CFG->dirroot = dirname(__FILE__); +$CFG->dirroot = __DIR__; $CFG->libdir = "$CFG->dirroot/lib"; $CFG->wwwroot = install_guess_wwwroot(); // can not be changed - ppl must use the real address when installing $CFG->httpswwwroot = $CFG->wwwroot; @@ -252,7 +252,7 @@ //first time here? find out suitable dataroot if (is_null($CFG->dataroot)) { - $CFG->dataroot = dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.'moodledata'; + $CFG->dataroot = __DIR__.'/../moodledata'; $i = 0; //safety check - dirname might return some unexpected results while(is_dataroot_insecure()) { diff --git a/install/css.php b/install/css.php index 88c69fc1647b1..6314c221f46dd 100644 --- a/install/css.php +++ b/install/css.php @@ -23,7 +23,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -if (file_exists(dirname(dirname(__FILE__)).'/config.php')) { +if (file_exists(__DIR__.'/../config.php')) { // already installed die; } @@ -38,7 +38,7 @@ $content = ''; foreach($files as $file) { - $content .= file_get_contents(dirname(dirname(__FILE__)).'/theme/'.$file) . "\n"; + $content .= file_get_contents(__DIR__.'/../theme/'.$file) . "\n"; } $content .= << - * require(dirname(dirname(dirname(__FILE__))).'/config.php'); + * require(__DIR__.'/../../config.php'); * require_once($CFG->libdir.'/adminlib.php'); * admin_externalpage_setup('foo'); * // functionality like processing form submissions goes here diff --git a/lib/ajax/blocks.php b/lib/ajax/blocks.php index 83625f7bc389b..d12eccea684be 100644 --- a/lib/ajax/blocks.php +++ b/lib/ajax/blocks.php @@ -23,7 +23,7 @@ */ define('AJAX_SCRIPT', true); -require_once(dirname(__FILE__) . '/../../config.php'); +require_once(__DIR__ . '/../../config.php'); // Initialise ALL common incoming parameters here, up front. $courseid = required_param('courseid', PARAM_INT); diff --git a/lib/ajax/getnavbranch.php b/lib/ajax/getnavbranch.php index d87f4ea6a73df..17b2668d5ca62 100644 --- a/lib/ajax/getnavbranch.php +++ b/lib/ajax/getnavbranch.php @@ -28,7 +28,7 @@ define('AJAX_SCRIPT', true); /** Include config */ -require_once(dirname(__FILE__) . '/../../config.php'); +require_once(__DIR__ . '/../../config.php'); /** Include course lib for its functions */ require_once($CFG->dirroot.'/course/lib.php'); diff --git a/lib/ajax/getsiteadminbranch.php b/lib/ajax/getsiteadminbranch.php index 6cc4e5c6f1e0e..bce7948504fc2 100644 --- a/lib/ajax/getsiteadminbranch.php +++ b/lib/ajax/getsiteadminbranch.php @@ -26,7 +26,7 @@ */ define('AJAX_SCRIPT', true); -require_once(dirname(__FILE__) . '/../../config.php'); +require_once(__DIR__ . '/../../config.php'); // This should be accessed by only valid logged in user. require_login(null, false); diff --git a/lib/ajax/service.php b/lib/ajax/service.php index 19a43b68762a2..4a0a1db7030d7 100644 --- a/lib/ajax/service.php +++ b/lib/ajax/service.php @@ -29,7 +29,7 @@ define('AJAX_SCRIPT', true); -require_once(dirname(__FILE__) . '/../../config.php'); +require_once(__DIR__ . '/../../config.php'); require_once($CFG->libdir . '/externallib.php'); $rawjson = file_get_contents('php://input'); diff --git a/lib/ajax/setuserpref.php b/lib/ajax/setuserpref.php index d4b819dae16df..77dc8191ab197 100644 --- a/lib/ajax/setuserpref.php +++ b/lib/ajax/setuserpref.php @@ -26,7 +26,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../../config.php'); +require_once(__DIR__ . '/../../config.php'); // Check access. if (!confirm_sesskey()) { diff --git a/lib/badgeslib.php b/lib/badgeslib.php index d88de86238613..4db12f86e4ef4 100644 --- a/lib/badgeslib.php +++ b/lib/badgeslib.php @@ -1005,7 +1005,7 @@ function print_badge_image(badge $badge, stdClass $context, $size = 'small') { */ function badges_bake($hash, $badgeid, $userid = 0, $pathhash = false) { global $CFG, $USER; - require_once(dirname(dirname(__FILE__)) . '/badges/lib/bakerlib.php'); + require_once(__DIR__ . '/../badges/lib/bakerlib.php'); $badge = new badge($badgeid); $badge_context = $badge->get_context(); @@ -1066,7 +1066,7 @@ function badges_bake($hash, $badgeid, $userid = 0, $pathhash = false) { */ function get_backpack_settings($userid, $refresh = false) { global $DB; - require_once(dirname(dirname(__FILE__)) . '/badges/lib/backpacklib.php'); + require_once(__DIR__ . '/../badges/lib/backpacklib.php'); // Try to get badges from cache first. $badgescache = cache::make('core', 'externalbadges'); diff --git a/lib/editor/atto/autosave-ajax.php b/lib/editor/atto/autosave-ajax.php index 6626075a9fb5d..084bd131e1e63 100644 --- a/lib/editor/atto/autosave-ajax.php +++ b/lib/editor/atto/autosave-ajax.php @@ -24,7 +24,7 @@ define('AJAX_SCRIPT', true); -require_once(dirname(__FILE__) . '/../../../config.php'); +require_once(__DIR__ . '/../../../config.php'); require_once($CFG->libdir . '/filestorage/file_storage.php'); $contextid = required_param('contextid', PARAM_INT); diff --git a/lib/editor/atto/plugins/equation/ajax.php b/lib/editor/atto/plugins/equation/ajax.php index 278ced6d76ec0..dc48f383f62a2 100644 --- a/lib/editor/atto/plugins/equation/ajax.php +++ b/lib/editor/atto/plugins/equation/ajax.php @@ -25,7 +25,7 @@ define('AJAX_SCRIPT', true); -require_once(dirname(__FILE__) . '/../../../../../config.php'); +require_once(__DIR__ . '/../../../../../config.php'); $contextid = required_param('contextid', PARAM_INT); diff --git a/lib/editor/tinymce/plugins/moodleemoticon/dialog.php b/lib/editor/tinymce/plugins/moodleemoticon/dialog.php index d26d8ebe24bb2..5987a0e225000 100644 --- a/lib/editor/tinymce/plugins/moodleemoticon/dialog.php +++ b/lib/editor/tinymce/plugins/moodleemoticon/dialog.php @@ -24,7 +24,7 @@ define('NO_MOODLE_COOKIES', true); // Session not used here. -require(dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))) . '/config.php'); +require(__DIR__ . '/../../../../../config.php'); $PAGE->set_context(context_system::instance()); $PAGE->set_url('/lib/editor/tinymce/plugins/moodleemoticon/dialog.php'); diff --git a/lib/editor/tinymce/plugins/moodlemedia/preview.php b/lib/editor/tinymce/plugins/moodlemedia/preview.php index a98464a357a1b..f4585350bceee 100644 --- a/lib/editor/tinymce/plugins/moodlemedia/preview.php +++ b/lib/editor/tinymce/plugins/moodlemedia/preview.php @@ -23,7 +23,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require(dirname(__FILE__) . '/../../../../../config.php'); +require(__DIR__ . '/../../../../../config.php'); require_once($CFG->libdir . '/filelib.php'); // Decode the url - it can not be passed around unencoded because security filters might block it. diff --git a/lib/editor/tinymce/plugins/spellchecker/includes/general.php b/lib/editor/tinymce/plugins/spellchecker/includes/general.php index 4414c291fbc01..b76ce4ef49795 100644 --- a/lib/editor/tinymce/plugins/spellchecker/includes/general.php +++ b/lib/editor/tinymce/plugins/spellchecker/includes/general.php @@ -4,19 +4,19 @@ * * @package MCManager.includes * @author Moxiecode - * @copyright Copyright © 2007, Moxiecode Systems AB, All rights reserved. + * @copyright Copyright � 2007, Moxiecode Systems AB, All rights reserved. */ @error_reporting(E_ALL ^ E_NOTICE); $config = array(); -require_once(dirname(__FILE__) . "/../classes/utils/Logger.php"); -require_once(dirname(__FILE__) . "/../classes/utils/JSON.php"); -require_once(dirname(__FILE__) . "/../config.php"); -require_once(dirname(__FILE__) . "/../classes/SpellChecker.php"); +require_once(__DIR__ . "/../classes/utils/Logger.php"); +require_once(__DIR__ . "/../classes/utils/JSON.php"); +require_once(__DIR__ . "/../config.php"); +require_once(__DIR__ . "/../classes/SpellChecker.php"); if (isset($config['general.engine'])) - require_once(dirname(__FILE__) . "/../classes/" . $config["general.engine"] . ".php"); + require_once(__DIR__ . "/../classes/" . $config["general.engine"] . ".php"); /** * Returns an request value by name without magic quoting. @@ -51,7 +51,7 @@ function &getLogger() { $mcLogger = new Moxiecode_Logger(); // Set logger options - $mcLogger->setPath(dirname(__FILE__) . "/../logs"); + $mcLogger->setPath(__DIR__ . "/../logs"); $mcLogger->setMaxSize("100kb"); $mcLogger->setMaxFiles("10"); $mcLogger->setFormat("{time} - {message}"); diff --git a/lib/installlib.php b/lib/installlib.php index 8f033c92c4577..63aff6f0c7486 100644 --- a/lib/installlib.php +++ b/lib/installlib.php @@ -260,7 +260,7 @@ function install_generate_configphp($database, $cfg) { $configphp .= '$CFG->upgradekey = ' . var_export($cfg->upgradekey, true) . ';' . PHP_EOL . PHP_EOL; } - $configphp .= 'require_once(dirname(__FILE__) . \'/lib/setup.php\');' . PHP_EOL . PHP_EOL; + $configphp .= 'require_once(__DIR__ . \'/lib/setup.php\');' . PHP_EOL . PHP_EOL; $configphp .= '// There is no php closing tag in this file,' . PHP_EOL; $configphp .= '// it is intentional because it prevents trailing whitespace problems!' . PHP_EOL; diff --git a/lib/messagelib.php b/lib/messagelib.php index d700bcabac760..94798cb6a4aca 100644 --- a/lib/messagelib.php +++ b/lib/messagelib.php @@ -24,7 +24,7 @@ defined('MOODLE_INTERNAL') || die(); -require_once(dirname(dirname(__FILE__)) . '/message/lib.php'); +require_once(__DIR__ . '/../message/lib.php'); /** * Called when a message provider wants to send a message. diff --git a/lib/pdflib.php b/lib/pdflib.php index 0945ff8d4eb33..03b011e2ba2ec 100644 --- a/lib/pdflib.php +++ b/lib/pdflib.php @@ -146,7 +146,7 @@ function tcpdf_init_k_font_path() { /** Throw exceptions from errors so they can be caught and recovered from. */ define('K_TCPDF_THROW_EXCEPTION_ERROR', true); -require_once(dirname(__FILE__).'/tcpdf/tcpdf.php'); +require_once(__DIR__.'/tcpdf/tcpdf.php'); /** * Wrapper class that extends TCPDF (lib/tcpdf/tcpdf.php). diff --git a/lib/sessionkeepalive_ajax.php b/lib/sessionkeepalive_ajax.php index 7a930ff0c1f35..65d1acfc1e90b 100644 --- a/lib/sessionkeepalive_ajax.php +++ b/lib/sessionkeepalive_ajax.php @@ -23,7 +23,7 @@ */ define('AJAX_SCRIPT', true); -require_once(dirname(__DIR__) . '/config.php'); +require_once(__DIR__ . '/../config.php'); // Require the session key - want to make sure that this isn't called // maliciously to keep a session alive longer than intended. diff --git a/lib/setup.php b/lib/setup.php index 71b37ad69f74d..b9f51c1e28701 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -57,7 +57,7 @@ // We can detect real dirroot path reliably since PHP 4.0.2, // it can not be anything else, there is no point in having this in config.php -$CFG->dirroot = dirname(dirname(__FILE__)); +$CFG->dirroot = dirname(__DIR__); // File permissions on created directories in the $CFG->dataroot if (!isset($CFG->directorypermissions)) { diff --git a/lib/setuplib.php b/lib/setuplib.php index fbaf5884e0256..d3b7d1286ee79 100644 --- a/lib/setuplib.php +++ b/lib/setuplib.php @@ -460,7 +460,7 @@ function is_early_init($backtrace) { $dangerouscode = array( array('function' => 'header', 'type' => '->'), array('class' => 'bootstrap_renderer'), - array('file' => dirname(__FILE__).'/setup.php'), + array('file' => __DIR__.'/setup.php'), ); foreach ($backtrace as $stackframe) { foreach ($dangerouscode as $pattern) { @@ -735,7 +735,7 @@ function get_docs_url($path = null) { */ function format_backtrace($callers, $plaintext = false) { // do not use $CFG->dirroot because it might not be available in destructors - $dirroot = dirname(dirname(__FILE__)); + $dirroot = dirname(__DIR__); if (empty($callers)) { return ''; diff --git a/lib/tests/other/jquerypage.php b/lib/tests/other/jquerypage.php index b73e9677f83bb..8379523cb854d 100644 --- a/lib/tests/other/jquerypage.php +++ b/lib/tests/other/jquerypage.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require(dirname(__FILE__) . '/../../../config.php'); +require(__DIR__ . '/../../../config.php'); require_login(); $context = context_system::instance(); diff --git a/lib/tests/other/pdflibtestpage.php b/lib/tests/other/pdflibtestpage.php index f96937d0ebbd4..039018547ebde 100644 --- a/lib/tests/other/pdflibtestpage.php +++ b/lib/tests/other/pdflibtestpage.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require(dirname(__FILE__) . '/../../../config.php'); +require(__DIR__ . '/../../../config.php'); require_once($CFG->libdir . '/pdflib.php'); require_login(); diff --git a/lib/tests/other/todochecker.php b/lib/tests/other/todochecker.php index 9b40a2b742b81..4db0e73aff93b 100644 --- a/lib/tests/other/todochecker.php +++ b/lib/tests/other/todochecker.php @@ -24,7 +24,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require(dirname(__FILE__) . '/../../../config.php'); +require(__DIR__ . '/../../../config.php'); require_login(); $context = context_system::instance(); diff --git a/lib/tests/performance/filtersettingsperformancetester.php b/lib/tests/performance/filtersettingsperformancetester.php index ae9fea6ddb7e9..3cea4e089af8f 100644 --- a/lib/tests/performance/filtersettingsperformancetester.php +++ b/lib/tests/performance/filtersettingsperformancetester.php @@ -27,7 +27,7 @@ die(); //TODO: this needs to be rewritten as standard advanced_testcase -require(dirname(__FILE__) . '/../../../config.php'); +require(__DIR__ . '/../../../config.php'); require_once($CFG->libdir . '/ddllib.php'); require_login(); diff --git a/lib/tests/string_manager_standard_test.php b/lib/tests/string_manager_standard_test.php index e2a67765e26ba..426d2f348b99c 100644 --- a/lib/tests/string_manager_standard_test.php +++ b/lib/tests/string_manager_standard_test.php @@ -39,7 +39,7 @@ class core_string_manager_standard_testcase extends advanced_testcase { public function test_string_manager_instance() { $this->resetAfterTest(); - $otherroot = dirname(__FILE__).'/fixtures/langtest'; + $otherroot = __DIR__.'/fixtures/langtest'; $stringman = testable_core_string_manager::instance($otherroot); $this->assertInstanceOf('core_string_manager', $stringman); } @@ -47,7 +47,7 @@ public function test_string_manager_instance() { public function test_get_language_dependencies() { $this->resetAfterTest(); - $otherroot = dirname(__FILE__).'/fixtures/langtest'; + $otherroot = __DIR__.'/fixtures/langtest'; $stringman = testable_core_string_manager::instance($otherroot); // There is no parent language for 'en'. diff --git a/login/token.php b/login/token.php index 1a9b48b465dee..c1e50ed549416 100644 --- a/login/token.php +++ b/login/token.php @@ -25,7 +25,7 @@ define('REQUIRE_CORRECT_ACCESS', true); define('NO_MOODLE_COOKIES', true); -require_once(dirname(dirname(__FILE__)) . '/config.php'); +require_once(__DIR__ . '/../config.php'); // Allow CORS requests. header('Access-Control-Allow-Origin: *'); diff --git a/message/defaultoutputs.php b/message/defaultoutputs.php index 3e95a30c458eb..398fe25fcef08 100644 --- a/message/defaultoutputs.php +++ b/message/defaultoutputs.php @@ -21,7 +21,7 @@ * @copyright 2011 Lancaster University Network Services Limited * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->dirroot . '/message/lib.php'); require_once($CFG->libdir.'/adminlib.php'); diff --git a/message/discussion.php b/message/discussion.php index 0717ea4c39e37..ce6e892638fc0 100644 --- a/message/discussion.php +++ b/message/discussion.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ - require(dirname(dirname(__FILE__)) . '/config.php'); + require(__DIR__ . '/../config.php'); require_once($CFG->dirroot . '/message/lib.php'); //the same URL params as in 1.9 diff --git a/message/edit.php b/message/edit.php index 54381dcd4d94d..51597e3381e39 100644 --- a/message/edit.php +++ b/message/edit.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->dirroot . '/message/lib.php'); require_once($CFG->dirroot . '/user/lib.php'); diff --git a/message/output/airnotifier/rest.php b/message/output/airnotifier/rest.php index bf3712e5fe9c8..018b3bfcb6c1c 100644 --- a/message/output/airnotifier/rest.php +++ b/message/output/airnotifier/rest.php @@ -25,7 +25,7 @@ define('AJAX_SCRIPT', true); -require_once(dirname(__FILE__) . '/../../../config.php'); +require_once(__DIR__ . '/../../../config.php'); // Initialise ALL the incoming parameters here, up front. $id = required_param('id', PARAM_INT); diff --git a/message/output/popup/message_output_popup.php b/message/output/popup/message_output_popup.php index 68886ec83fbcd..a3910cf525806 100644 --- a/message/output/popup/message_output_popup.php +++ b/message/output/popup/message_output_popup.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v2 or later */ -require_once(dirname(dirname(dirname(dirname(__FILE__)))) . '/config.php'); //included from messagelib (how to fix?) +require_once(__DIR__ . '/../../../config.php'); //included from messagelib (how to fix?) require_once($CFG->dirroot.'/message/output/lib.php'); /** diff --git a/mnet/publickey.php b/mnet/publickey.php index ac018aeec9417..abdfde5cfdd9f 100644 --- a/mnet/publickey.php +++ b/mnet/publickey.php @@ -8,7 +8,7 @@ * @package mnet */ -require_once(dirname(dirname(__FILE__)) . '/config.php'); +require_once(__DIR__ . '/../config.php'); require_once $CFG->dirroot.'/mnet/lib.php'; if ($CFG->mnet_dispatcher_mode === 'off') { diff --git a/mnet/service/enrol/course.php b/mnet/service/enrol/course.php index f4382961c3c64..7f065f8414acb 100644 --- a/mnet/service/enrol/course.php +++ b/mnet/service/enrol/course.php @@ -24,7 +24,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require(dirname(dirname(dirname(dirname(__FILE__)))).'/config.php'); +require(__DIR__.'/../../../config.php'); require_once($CFG->libdir.'/adminlib.php'); require_once($CFG->dirroot.'/mnet/service/enrol/locallib.php'); diff --git a/mnet/service/enrol/host.php b/mnet/service/enrol/host.php index 80b4be6d08088..7aac73a5cf24f 100644 --- a/mnet/service/enrol/host.php +++ b/mnet/service/enrol/host.php @@ -28,7 +28,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require(dirname(dirname(dirname(dirname(__FILE__)))).'/config.php'); +require(__DIR__.'/../../../config.php'); require_once($CFG->libdir.'/adminlib.php'); require_once($CFG->dirroot.'/mnet/service/enrol/locallib.php'); diff --git a/mnet/service/enrol/index.php b/mnet/service/enrol/index.php index d4b6bd9fbe667..daa30ecc5b585 100644 --- a/mnet/service/enrol/index.php +++ b/mnet/service/enrol/index.php @@ -24,7 +24,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require(dirname(dirname(dirname(dirname(__FILE__)))).'/config.php'); +require(__DIR__.'/../../../config.php'); require_once($CFG->libdir.'/adminlib.php'); require_once($CFG->dirroot.'/mnet/service/enrol/locallib.php'); diff --git a/mnet/xmlrpc/server.php b/mnet/xmlrpc/server.php index 2f1fcaf228b23..c292e3287b268 100644 --- a/mnet/xmlrpc/server.php +++ b/mnet/xmlrpc/server.php @@ -17,7 +17,7 @@ define('MNET_SERVER', true); -require_once(dirname(dirname(dirname(__FILE__))) . '/config.php'); +require(__DIR__.'/../../config.php'); $mnet = get_mnet_environment(); // Include MNET stuff: diff --git a/mod/assign/adminmanageplugins.php b/mod/assign/adminmanageplugins.php index 0aaceb678071b..1b82ba8d6da7d 100644 --- a/mod/assign/adminmanageplugins.php +++ b/mod/assign/adminmanageplugins.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../../config.php'); +require_once(__DIR__ . '/../../config.php'); require_once($CFG->dirroot.'/mod/assign/adminlib.php'); $subtype = required_param('subtype', PARAM_PLUGIN); diff --git a/mod/assign/feedback/editpdf/testunoconv.php b/mod/assign/feedback/editpdf/testunoconv.php index 78a3ffabee7fb..ba81b78c506eb 100644 --- a/mod/assign/feedback/editpdf/testunoconv.php +++ b/mod/assign/feedback/editpdf/testunoconv.php @@ -20,7 +20,7 @@ * @copyright 2016 Simey Lameze * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require(dirname(__FILE__) . '/../../../../config.php'); +require(__DIR__ . '/../../../../config.php'); require_once($CFG->libdir . '/filelib.php'); $sendpdf = optional_param('sendpdf', 0, PARAM_BOOL); diff --git a/mod/book/delete.php b/mod/book/delete.php index 71a0c630e3f91..afd1bc1f1bf2a 100644 --- a/mod/book/delete.php +++ b/mod/book/delete.php @@ -22,8 +22,8 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require(dirname(__FILE__).'/../../config.php'); -require_once(dirname(__FILE__).'/locallib.php'); +require(__DIR__.'/../../config.php'); +require_once(__DIR__.'/locallib.php'); $id = required_param('id', PARAM_INT); // Course Module ID $chapterid = required_param('chapterid', PARAM_INT); // Chapter ID diff --git a/mod/book/edit.php b/mod/book/edit.php index 0d0a9af080d56..ce89704eaae9c 100644 --- a/mod/book/edit.php +++ b/mod/book/edit.php @@ -22,9 +22,9 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require(dirname(__FILE__).'/../../config.php'); -require_once(dirname(__FILE__).'/locallib.php'); -require_once(dirname(__FILE__).'/edit_form.php'); +require(__DIR__.'/../../config.php'); +require_once(__DIR__.'/locallib.php'); +require_once(__DIR__.'/edit_form.php'); $cmid = required_param('cmid', PARAM_INT); // Book Course Module ID $chapterid = optional_param('id', 0, PARAM_INT); // Chapter ID diff --git a/mod/book/index.php b/mod/book/index.php index 359ecbd133d55..3c91e8ed89270 100644 --- a/mod/book/index.php +++ b/mod/book/index.php @@ -22,8 +22,8 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require(dirname(__FILE__).'/../../config.php'); -require_once(dirname(__FILE__).'/locallib.php'); +require(__DIR__.'/../../config.php'); +require_once(__DIR__.'/locallib.php'); $id = required_param('id', PARAM_INT); // Course ID. diff --git a/mod/book/lib.php b/mod/book/lib.php index 1a56b767f179a..cbb471cb80db2 100644 --- a/mod/book/lib.php +++ b/mod/book/lib.php @@ -31,7 +31,7 @@ function book_get_numbering_types() { global $CFG; // required for the include - require_once(dirname(__FILE__).'/locallib.php'); + require_once(__DIR__.'/locallib.php'); return array ( BOOK_NUM_NONE => get_string('numbering0', 'mod_book'), @@ -46,7 +46,7 @@ function book_get_numbering_types() { * @return array */ function book_get_nav_types() { - require_once(dirname(__FILE__).'/locallib.php'); + require_once(__DIR__.'/locallib.php'); return array ( BOOK_LINK_TOCONLY => get_string('navtoc', 'mod_book'), @@ -359,7 +359,7 @@ function book_get_file_info($browser, $areas, $course, $cm, $context, $filearea, return null; } - require_once(dirname(__FILE__).'/locallib.php'); + require_once(__DIR__.'/locallib.php'); if (is_null($itemid)) { return new book_file_info($browser, $course, $cm, $context, $areas, $filearea); @@ -448,7 +448,7 @@ function book_pluginfile($course, $cm, $context, $filearea, $args, $forcedownloa $titles = ""; // Format the chapter titles. if (!$book->customtitles) { - require_once(dirname(__FILE__).'/locallib.php'); + require_once(__DIR__.'/locallib.php'); $chapters = book_preload_chapters($book); if (!$chapter->subchapter) { diff --git a/mod/book/locallib.php b/mod/book/locallib.php index e6c8dd752c39b..44ad7b44b2147 100644 --- a/mod/book/locallib.php +++ b/mod/book/locallib.php @@ -24,7 +24,7 @@ defined('MOODLE_INTERNAL') || die; -require_once(dirname(__FILE__).'/lib.php'); +require_once(__DIR__.'/lib.php'); require_once($CFG->libdir.'/filelib.php'); /** diff --git a/mod/book/mod_form.php b/mod/book/mod_form.php index a04924b86c49e..d47d746e67cee 100644 --- a/mod/book/mod_form.php +++ b/mod/book/mod_form.php @@ -24,7 +24,7 @@ defined('MOODLE_INTERNAL') || die; -require_once(dirname(__FILE__).'/locallib.php'); +require_once(__DIR__.'/locallib.php'); require_once($CFG->dirroot.'/course/moodleform_mod.php'); class mod_book_mod_form extends moodleform_mod { diff --git a/mod/book/move.php b/mod/book/move.php index 1da5ef7ff2a54..ea6dd9fcd1c80 100644 --- a/mod/book/move.php +++ b/mod/book/move.php @@ -22,8 +22,8 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require(dirname(__FILE__).'/../../config.php'); -require_once(dirname(__FILE__).'/locallib.php'); +require(__DIR__.'/../../config.php'); +require_once(__DIR__.'/locallib.php'); $id = required_param('id', PARAM_INT); // Course Module ID $chapterid = required_param('chapterid', PARAM_INT); // Chapter ID diff --git a/mod/book/settings.php b/mod/book/settings.php index 31901d87ae2fc..c49c658c739ba 100644 --- a/mod/book/settings.php +++ b/mod/book/settings.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die; if ($ADMIN->fulltree) { - require_once(dirname(__FILE__).'/lib.php'); + require_once(__DIR__.'/lib.php'); // General settings diff --git a/mod/book/show.php b/mod/book/show.php index d842a4654d046..2055de92bbd0b 100644 --- a/mod/book/show.php +++ b/mod/book/show.php @@ -22,8 +22,8 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require(dirname(__FILE__).'/../../config.php'); -require_once(dirname(__FILE__).'/locallib.php'); +require(__DIR__.'/../../config.php'); +require_once(__DIR__.'/locallib.php'); $id = required_param('id', PARAM_INT); // Course Module ID $chapterid = required_param('chapterid', PARAM_INT); // Chapter ID diff --git a/mod/book/tool/exportimscp/index.php b/mod/book/tool/exportimscp/index.php index f3c4b0daf22ed..de244d03232ea 100644 --- a/mod/book/tool/exportimscp/index.php +++ b/mod/book/tool/exportimscp/index.php @@ -24,8 +24,8 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require(dirname(__FILE__).'/../../../../config.php'); -require_once(dirname(__FILE__).'/locallib.php'); +require(__DIR__.'/../../../../config.php'); +require_once(__DIR__.'/locallib.php'); require_once($CFG->dirroot.'/mod/book/locallib.php'); require_once($CFG->libdir.'/filelib.php'); diff --git a/mod/book/tool/exportimscp/locallib.php b/mod/book/tool/exportimscp/locallib.php index 2892e5799273e..0c1a39bc9ad92 100644 --- a/mod/book/tool/exportimscp/locallib.php +++ b/mod/book/tool/exportimscp/locallib.php @@ -26,7 +26,7 @@ defined('MOODLE_INTERNAL') || die; -require_once(dirname(__FILE__).'/lib.php'); +require_once(__DIR__.'/lib.php'); require_once($CFG->dirroot.'/mod/book/locallib.php'); /** @@ -115,7 +115,7 @@ function booktool_exportimscp_prepare_files($book, $context) { $css_file_record = array('contextid'=>$context->id, 'component'=>'booktool_exportimscp', 'filearea'=>'temp', 'itemid'=>$book->revision, 'filepath'=>"/css/", 'filename'=>'styles.css'); - $fs->create_file_from_pathname($css_file_record, dirname(__FILE__).'/imscp.css'); + $fs->create_file_from_pathname($css_file_record, __DIR__.'/imscp.css'); // Init imsmanifest and others $imsmanifest = ''; diff --git a/mod/book/tool/importhtml/index.php b/mod/book/tool/importhtml/index.php index 95cfa298bf7ae..df186dd9e1ad0 100644 --- a/mod/book/tool/importhtml/index.php +++ b/mod/book/tool/importhtml/index.php @@ -22,9 +22,9 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require(dirname(__FILE__).'/../../../../config.php'); -require_once(dirname(__FILE__).'/locallib.php'); -require_once(dirname(__FILE__).'/import_form.php'); +require(__DIR__.'/../../../../config.php'); +require_once(__DIR__.'/locallib.php'); +require_once(__DIR__.'/import_form.php'); $id = required_param('id', PARAM_INT); // Course Module ID $chapterid = optional_param('chapterid', 0, PARAM_INT); // Chapter ID diff --git a/mod/book/tool/importhtml/locallib.php b/mod/book/tool/importhtml/locallib.php index 5ca3e4743a3a6..5af6f4acadb18 100644 --- a/mod/book/tool/importhtml/locallib.php +++ b/mod/book/tool/importhtml/locallib.php @@ -24,7 +24,7 @@ defined('MOODLE_INTERNAL') || die; -require_once(dirname(__FILE__).'/lib.php'); +require_once(__DIR__.'/lib.php'); require_once($CFG->dirroot.'/mod/book/locallib.php'); /** diff --git a/mod/book/tool/print/index.php b/mod/book/tool/print/index.php index b9f93e1ebce85..ac86e912ece04 100644 --- a/mod/book/tool/print/index.php +++ b/mod/book/tool/print/index.php @@ -22,8 +22,8 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require(dirname(__FILE__).'/../../../../config.php'); -require_once(dirname(__FILE__).'/locallib.php'); +require(__DIR__.'/../../../../config.php'); +require_once(__DIR__.'/locallib.php'); $id = required_param('id', PARAM_INT); // Course Module ID $chapterid = optional_param('chapterid', 0, PARAM_INT); // Chapter ID diff --git a/mod/book/tool/print/locallib.php b/mod/book/tool/print/locallib.php index 4f1908197b2fc..b8d06705f4f8c 100644 --- a/mod/book/tool/print/locallib.php +++ b/mod/book/tool/print/locallib.php @@ -24,7 +24,7 @@ defined('MOODLE_INTERNAL') || die; -require_once(dirname(__FILE__).'/lib.php'); +require_once(__DIR__.'/lib.php'); require_once($CFG->dirroot.'/mod/book/locallib.php'); /** diff --git a/mod/book/view.php b/mod/book/view.php index 0c57b2ed04805..6261ad1412e29 100644 --- a/mod/book/view.php +++ b/mod/book/view.php @@ -22,9 +22,9 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require(dirname(__FILE__).'/../../config.php'); -require_once(dirname(__FILE__).'/lib.php'); -require_once(dirname(__FILE__).'/locallib.php'); +require(__DIR__.'/../../config.php'); +require_once(__DIR__.'/lib.php'); +require_once(__DIR__.'/locallib.php'); require_once($CFG->libdir.'/completionlib.php'); $id = optional_param('id', 0, PARAM_INT); // Course Module ID diff --git a/mod/chat/chat_ajax.php b/mod/chat/chat_ajax.php index 02bd5d493eafa..552f8e82d750e 100644 --- a/mod/chat/chat_ajax.php +++ b/mod/chat/chat_ajax.php @@ -16,8 +16,8 @@ define('AJAX_SCRIPT', true); -require_once(dirname(dirname(dirname(__FILE__))) . '/config.php'); -require_once(dirname(__FILE__) . '/lib.php'); +require(__DIR__.'/../../config.php'); +require_once(__DIR__ . '/lib.php'); $action = optional_param('action', '', PARAM_ALPHANUM); $beepid = optional_param('beep', '', PARAM_RAW); diff --git a/mod/chat/chatd.php b/mod/chat/chatd.php index 37462c0e4ecf7..45ba410562dd8 100644 --- a/mod/chat/chatd.php +++ b/mod/chat/chatd.php @@ -24,7 +24,7 @@ define('CLI_SCRIPT', true); -require(dirname(dirname(dirname(__FILE__))).'/config.php'); +require(__DIR__.'/../../config.php'); require_once($CFG->dirroot . '/mod/chat/lib.php'); // Browser quirks. diff --git a/mod/chat/gui_ajax/index.php b/mod/chat/gui_ajax/index.php index 36b9d67880636..529f125e23c32 100644 --- a/mod/chat/gui_ajax/index.php +++ b/mod/chat/gui_ajax/index.php @@ -57,7 +57,7 @@ } // If requested theme doesn't exist, use default 'bubble' theme. -if ($theme != 'course_theme' and !file_exists(dirname(__FILE__) . '/theme/'.$theme.'/chat.css')) { +if ($theme != 'course_theme' and !file_exists(__DIR__ . '/theme/'.$theme.'/chat.css')) { $theme = 'compact'; } diff --git a/mod/chat/view.php b/mod/chat/view.php index 55478d7505fc0..ba6f2c51201dc 100644 --- a/mod/chat/view.php +++ b/mod/chat/view.php @@ -16,7 +16,7 @@ // This page prints a particular instance of chat. -require_once(dirname(dirname(dirname(__FILE__))) . '/config.php'); +require(__DIR__.'/../../config.php'); require_once($CFG->dirroot . '/mod/chat/lib.php'); require_once($CFG->libdir . '/completionlib.php'); diff --git a/mod/data/view.php b/mod/data/view.php index b0c50775857f8..964945170853f 100644 --- a/mod/data/view.php +++ b/mod/data/view.php @@ -22,7 +22,7 @@ // // /////////////////////////////////////////////////////////////////////////// - require_once(dirname(__FILE__) . '/../../config.php'); + require_once(__DIR__ . '/../../config.php'); require_once($CFG->dirroot . '/mod/data/lib.php'); require_once($CFG->libdir . '/rsslib.php'); require_once($CFG->libdir . '/completionlib.php'); diff --git a/mod/feedback/ajax.php b/mod/feedback/ajax.php index 0d75ba9f9e172..cd05d8cdf6e8e 100644 --- a/mod/feedback/ajax.php +++ b/mod/feedback/ajax.php @@ -26,7 +26,7 @@ define('AJAX_SCRIPT', true); } -require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); +require(__DIR__.'/../../config.php'); require_once('lib.php'); $id = required_param('id', PARAM_INT); diff --git a/mod/forum/index.php b/mod/forum/index.php index a8a38273d5864..1534ae91d779c 100644 --- a/mod/forum/index.php +++ b/mod/forum/index.php @@ -21,7 +21,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../../config.php'); +require_once(__DIR__ . '/../../config.php'); require_once($CFG->dirroot . '/course/lib.php'); require_once($CFG->dirroot . '/mod/forum/lib.php'); require_once($CFG->libdir . '/rsslib.php'); diff --git a/mod/forum/maildigest.php b/mod/forum/maildigest.php index 966442d9f9851..c3ac0570eff02 100644 --- a/mod/forum/maildigest.php +++ b/mod/forum/maildigest.php @@ -23,7 +23,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(__DIR__)) . '/config.php'); +require(__DIR__.'/../../config.php'); require_once($CFG->dirroot.'/mod/forum/lib.php'); $id = required_param('id', PARAM_INT); diff --git a/mod/forum/subscribe.php b/mod/forum/subscribe.php index 74e9c305cee86..0c5fbdbedbc2c 100644 --- a/mod/forum/subscribe.php +++ b/mod/forum/subscribe.php @@ -31,7 +31,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); +require(__DIR__.'/../../config.php'); require_once($CFG->dirroot.'/mod/forum/lib.php'); $id = required_param('id', PARAM_INT); // The forum to set subscription on. diff --git a/mod/forum/subscribe_ajax.php b/mod/forum/subscribe_ajax.php index cf6bb70080b1b..00aad245d364f 100644 --- a/mod/forum/subscribe_ajax.php +++ b/mod/forum/subscribe_ajax.php @@ -23,7 +23,7 @@ */ define('AJAX_SCRIPT', true); -require_once(dirname(dirname(__DIR__)) . '/config.php'); +require(__DIR__.'/../../config.php'); require_once($CFG->dirroot . '/mod/forum/lib.php'); $forumid = required_param('forumid', PARAM_INT); // The forum to subscribe or unsubscribe. diff --git a/mod/forum/user.php b/mod/forum/user.php index fc4655a65b710..5696c4a5a7dd0 100644 --- a/mod/forum/user.php +++ b/mod/forum/user.php @@ -23,7 +23,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); +require(__DIR__.'/../../config.php'); require_once($CFG->dirroot.'/mod/forum/lib.php'); require_once($CFG->dirroot.'/rating/lib.php'); diff --git a/mod/lesson/overridedelete.php b/mod/lesson/overridedelete.php index ad8c4e151b97b..8f23eb8053e0b 100644 --- a/mod/lesson/overridedelete.php +++ b/mod/lesson/overridedelete.php @@ -23,7 +23,7 @@ */ -require_once(dirname(__FILE__) . '/../../config.php'); +require_once(__DIR__ . '/../../config.php'); require_once($CFG->dirroot.'/mod/lesson/lib.php'); require_once($CFG->dirroot.'/mod/lesson/locallib.php'); require_once($CFG->dirroot.'/mod/lesson/override_form.php'); diff --git a/mod/lesson/overrideedit.php b/mod/lesson/overrideedit.php index 26a517f9c615b..8db1b3805d97c 100644 --- a/mod/lesson/overrideedit.php +++ b/mod/lesson/overrideedit.php @@ -23,7 +23,7 @@ */ -require_once(dirname(__FILE__) . '/../../config.php'); +require_once(__DIR__ . '/../../config.php'); require_once($CFG->dirroot.'/mod/lesson/lib.php'); require_once($CFG->dirroot.'/mod/lesson/locallib.php'); require_once($CFG->dirroot.'/mod/lesson/override_form.php'); diff --git a/mod/lesson/overrides.php b/mod/lesson/overrides.php index 9382346b96471..f9a141ba2c7b0 100644 --- a/mod/lesson/overrides.php +++ b/mod/lesson/overrides.php @@ -23,7 +23,7 @@ */ -require_once(dirname(__FILE__) . '/../../config.php'); +require_once(__DIR__ . '/../../config.php'); require_once($CFG->dirroot.'/mod/lesson/lib.php'); require_once($CFG->dirroot.'/mod/lesson/locallib.php'); require_once($CFG->dirroot.'/mod/lesson/override_form.php'); diff --git a/mod/lesson/view.php b/mod/lesson/view.php index ef59fa0b17a6a..94a426e944aed 100644 --- a/mod/lesson/view.php +++ b/mod/lesson/view.php @@ -23,7 +23,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or late **/ -require_once(dirname(__FILE__) . '/../../config.php'); +require_once(__DIR__ . '/../../config.php'); require_once($CFG->dirroot.'/mod/lesson/locallib.php'); require_once($CFG->dirroot.'/mod/lesson/view_form.php'); require_once($CFG->libdir . '/completionlib.php'); diff --git a/mod/lti/ajax.php b/mod/lti/ajax.php index a8fe3371c2441..7bc93e32a36fb 100644 --- a/mod/lti/ajax.php +++ b/mod/lti/ajax.php @@ -28,7 +28,7 @@ */ define('AJAX_SCRIPT', true); -require_once(dirname(__FILE__) . "/../../config.php"); +require_once(__DIR__ . "/../../config.php"); require_once($CFG->dirroot . '/mod/lti/locallib.php'); $courseid = required_param('course', PARAM_INT); diff --git a/mod/lti/service.php b/mod/lti/service.php index a00ce8886ad4a..a5a5df4b01067 100644 --- a/mod/lti/service.php +++ b/mod/lti/service.php @@ -26,7 +26,7 @@ define('NO_DEBUG_DISPLAY', true); define('NO_MOODLE_COOKIES', true); -require_once(dirname(__FILE__) . "/../../config.php"); +require_once(__DIR__ . "/../../config.php"); require_once($CFG->dirroot.'/mod/lti/locallib.php'); require_once($CFG->dirroot.'/mod/lti/servicelib.php'); diff --git a/mod/lti/services.php b/mod/lti/services.php index 26cc637878514..1cf58c5f0971e 100644 --- a/mod/lti/services.php +++ b/mod/lti/services.php @@ -26,7 +26,7 @@ define('NO_DEBUG_DISPLAY', true); define('NO_MOODLE_COOKIES', true); -require_once(dirname(__FILE__) . '/../../config.php'); +require_once(__DIR__ . '/../../config.php'); require_once($CFG->dirroot . '/mod/lti/locallib.php'); diff --git a/mod/quiz/attempt.php b/mod/quiz/attempt.php index f9208e7ea0468..96b8e1c0950cb 100644 --- a/mod/quiz/attempt.php +++ b/mod/quiz/attempt.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../../config.php'); +require_once(__DIR__ . '/../../config.php'); require_once($CFG->dirroot . '/mod/quiz/locallib.php'); // Look for old-style URLs, such as may be in the logs, and redirect them to startattemtp.php. diff --git a/mod/quiz/autosave.ajax.php b/mod/quiz/autosave.ajax.php index dccfadc0736d8..412bb3dc713cd 100644 --- a/mod/quiz/autosave.ajax.php +++ b/mod/quiz/autosave.ajax.php @@ -24,7 +24,7 @@ define('AJAX_SCRIPT', true); -require_once(dirname(__FILE__) . '/../../config.php'); +require_once(__DIR__ . '/../../config.php'); require_once($CFG->dirroot . '/mod/quiz/locallib.php'); // Remember the current time as the time any responses were submitted diff --git a/mod/quiz/grade.php b/mod/quiz/grade.php index dd0c9f8d9499f..f7ca5cbacb48c 100644 --- a/mod/quiz/grade.php +++ b/mod/quiz/grade.php @@ -25,7 +25,7 @@ */ -require_once(dirname(__FILE__) . '/../../config.php'); +require_once(__DIR__ . '/../../config.php'); require_once($CFG->dirroot . '/mod/quiz/locallib.php'); require_once($CFG->dirroot . '/mod/quiz/report/reportlib.php'); diff --git a/mod/quiz/overridedelete.php b/mod/quiz/overridedelete.php index b33d9e3309ddd..5e88eeb50d697 100644 --- a/mod/quiz/overridedelete.php +++ b/mod/quiz/overridedelete.php @@ -23,7 +23,7 @@ */ -require_once(dirname(__FILE__) . '/../../config.php'); +require_once(__DIR__ . '/../../config.php'); require_once($CFG->dirroot.'/mod/quiz/lib.php'); require_once($CFG->dirroot.'/mod/quiz/locallib.php'); require_once($CFG->dirroot.'/mod/quiz/override_form.php'); diff --git a/mod/quiz/overrideedit.php b/mod/quiz/overrideedit.php index 072f4fb30021d..b72e02c76cd37 100644 --- a/mod/quiz/overrideedit.php +++ b/mod/quiz/overrideedit.php @@ -23,7 +23,7 @@ */ -require_once(dirname(__FILE__) . '/../../config.php'); +require_once(__DIR__ . '/../../config.php'); require_once($CFG->dirroot.'/mod/quiz/lib.php'); require_once($CFG->dirroot.'/mod/quiz/locallib.php'); require_once($CFG->dirroot.'/mod/quiz/override_form.php'); diff --git a/mod/quiz/overrides.php b/mod/quiz/overrides.php index 7814b108b0b7f..5e8201df882d1 100644 --- a/mod/quiz/overrides.php +++ b/mod/quiz/overrides.php @@ -23,7 +23,7 @@ */ -require_once(dirname(__FILE__) . '/../../config.php'); +require_once(__DIR__ . '/../../config.php'); require_once($CFG->dirroot.'/mod/quiz/lib.php'); require_once($CFG->dirroot.'/mod/quiz/locallib.php'); require_once($CFG->dirroot.'/mod/quiz/override_form.php'); diff --git a/mod/quiz/processattempt.php b/mod/quiz/processattempt.php index a9dc9e2fe90ff..ee5c3e51d262e 100644 --- a/mod/quiz/processattempt.php +++ b/mod/quiz/processattempt.php @@ -28,7 +28,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../../config.php'); +require_once(__DIR__ . '/../../config.php'); require_once($CFG->dirroot . '/mod/quiz/locallib.php'); // Remember the current time as the time any responses were submitted diff --git a/mod/quiz/report.php b/mod/quiz/report.php index 2be5173f5495d..d6f05f791b0f9 100644 --- a/mod/quiz/report.php +++ b/mod/quiz/report.php @@ -23,7 +23,7 @@ */ -require_once(dirname(__FILE__) . '/../../config.php'); +require_once(__DIR__ . '/../../config.php'); require_once($CFG->dirroot . '/mod/quiz/locallib.php'); require_once($CFG->dirroot . '/mod/quiz/report/reportlib.php'); require_once($CFG->dirroot . '/mod/quiz/report/default.php'); diff --git a/mod/quiz/report/overview/overviewgraph.php b/mod/quiz/report/overview/overviewgraph.php index 6583ef95708be..9202369c03ca9 100644 --- a/mod/quiz/report/overview/overviewgraph.php +++ b/mod/quiz/report/overview/overviewgraph.php @@ -23,7 +23,7 @@ */ -require_once(dirname(__FILE__) . '/../../../../config.php'); +require_once(__DIR__ . '/../../../../config.php'); require_once($CFG->libdir . '/graphlib.php'); require_once($CFG->dirroot . '/mod/quiz/locallib.php'); require_once($CFG->dirroot . '/mod/quiz/report/reportlib.php'); diff --git a/mod/quiz/report/statistics/statistics_graph.php b/mod/quiz/report/statistics/statistics_graph.php index 9830c0f67c19d..6d93e3f9f6366 100644 --- a/mod/quiz/report/statistics/statistics_graph.php +++ b/mod/quiz/report/statistics/statistics_graph.php @@ -28,7 +28,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../../../../config.php'); +require_once(__DIR__ . '/../../../../config.php'); require_once($CFG->libdir . '/graphlib.php'); require_once($CFG->dirroot . '/mod/quiz/locallib.php'); require_once($CFG->dirroot . '/mod/quiz/report/reportlib.php'); diff --git a/mod/quiz/review.php b/mod/quiz/review.php index 6e78ef3542ce7..1fa481c06def9 100644 --- a/mod/quiz/review.php +++ b/mod/quiz/review.php @@ -26,7 +26,7 @@ */ -require_once(dirname(__FILE__) . '/../../config.php'); +require_once(__DIR__ . '/../../config.php'); require_once($CFG->dirroot . '/mod/quiz/locallib.php'); require_once($CFG->dirroot . '/mod/quiz/report/reportlib.php'); diff --git a/mod/quiz/reviewquestion.php b/mod/quiz/reviewquestion.php index 7a6e2a189e4e2..0ee6970aa04e4 100644 --- a/mod/quiz/reviewquestion.php +++ b/mod/quiz/reviewquestion.php @@ -24,7 +24,7 @@ */ -require_once(dirname(__FILE__) . '/../../config.php'); +require_once(__DIR__ . '/../../config.php'); require_once('locallib.php'); $attemptid = required_param('attempt', PARAM_INT); diff --git a/mod/quiz/startattempt.php b/mod/quiz/startattempt.php index e94a71f2497d4..7d2398ebce6d2 100644 --- a/mod/quiz/startattempt.php +++ b/mod/quiz/startattempt.php @@ -26,7 +26,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../../config.php'); +require_once(__DIR__ . '/../../config.php'); require_once($CFG->dirroot . '/mod/quiz/locallib.php'); // Get submitted parameters. diff --git a/mod/quiz/summary.php b/mod/quiz/summary.php index 4ccec15d0b8ca..0860a3f00d715 100644 --- a/mod/quiz/summary.php +++ b/mod/quiz/summary.php @@ -23,7 +23,7 @@ */ -require_once(dirname(__FILE__) . '/../../config.php'); +require_once(__DIR__ . '/../../config.php'); require_once($CFG->dirroot . '/mod/quiz/locallib.php'); $attemptid = required_param('attempt', PARAM_INT); // The attempt to summarise. diff --git a/mod/quiz/view.php b/mod/quiz/view.php index d9199e894a8eb..02b1a906357ca 100644 --- a/mod/quiz/view.php +++ b/mod/quiz/view.php @@ -24,7 +24,7 @@ */ -require_once(dirname(__FILE__) . '/../../config.php'); +require_once(__DIR__ . '/../../config.php'); require_once($CFG->libdir.'/gradelib.php'); require_once($CFG->dirroot.'/mod/quiz/locallib.php'); require_once($CFG->libdir . '/completionlib.php'); diff --git a/mod/scorm/report/graphs/graph.php b/mod/scorm/report/graphs/graph.php index 5e8ac0caabbc4..dea5e0dca4e77 100644 --- a/mod/scorm/report/graphs/graph.php +++ b/mod/scorm/report/graphs/graph.php @@ -23,7 +23,7 @@ define('NO_DEBUG_DISPLAY', true); -require_once(dirname(__FILE__) . '/../../../../config.php'); +require_once(__DIR__ . '/../../../../config.php'); require_once($CFG->libdir . '/graphlib.php'); require_once($CFG->dirroot.'/mod/scorm/report/reportlib.php'); require_once($CFG->dirroot.'/mod/scorm/locallib.php'); diff --git a/mod/wiki/create.php b/mod/wiki/create.php index b53ca36c81f58..9f91fe95be11b 100644 --- a/mod/wiki/create.php +++ b/mod/wiki/create.php @@ -16,7 +16,7 @@ // along with Moodle. If not, see . require_once('../../config.php'); -require_once(dirname(__FILE__) . '/create_form.php'); +require_once(__DIR__ . '/create_form.php'); require_once($CFG->dirroot . '/mod/wiki/lib.php'); require_once($CFG->dirroot . '/mod/wiki/locallib.php'); require_once($CFG->dirroot . '/mod/wiki/pagelib.php'); diff --git a/mod/wiki/filesedit.php b/mod/wiki/filesedit.php index be2fd74ff7323..5edab9afae1a0 100644 --- a/mod/wiki/filesedit.php +++ b/mod/wiki/filesedit.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(dirname(__FILE__))) . '/config.php'); +require(__DIR__.'/../../config.php'); require_once('lib.php'); require_once('locallib.php'); require_once("$CFG->dirroot/mod/wiki/filesedit_form.php"); diff --git a/mod/wiki/pagelib.php b/mod/wiki/pagelib.php index 3c4ca767cb400..76c597315e65b 100644 --- a/mod/wiki/pagelib.php +++ b/mod/wiki/pagelib.php @@ -913,7 +913,7 @@ function set_action($action) { global $PAGE; $this->action = $action; - require_once(dirname(__FILE__) . '/create_form.php'); + require_once(__DIR__ . '/create_form.php'); $url = new moodle_url('/mod/wiki/create.php', array('action' => 'create', 'wid' => $PAGE->activityrecord->id, 'group' => $this->gid, 'uid' => $this->uid)); $formats = wiki_get_formats(); $options = array('formats' => $formats, 'defaultformat' => $PAGE->activityrecord->defaultformat, 'forceformat' => $PAGE->activityrecord->forceformat, 'groups' => $this->groups); diff --git a/mod/workshop/aggregate.php b/mod/workshop/aggregate.php index b5dea5d7eb9e1..bfbc523470855 100644 --- a/mod/workshop/aggregate.php +++ b/mod/workshop/aggregate.php @@ -23,8 +23,8 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); -require_once(dirname(__FILE__).'/locallib.php'); +require(__DIR__.'/../../config.php'); +require_once(__DIR__.'/locallib.php'); $cmid = required_param('cmid', PARAM_INT); // course module $confirm = optional_param('confirm', false, PARAM_BOOL); // confirmation diff --git a/mod/workshop/allocation.php b/mod/workshop/allocation.php index 134181982cbc1..5901bcff70302 100644 --- a/mod/workshop/allocation.php +++ b/mod/workshop/allocation.php @@ -26,9 +26,9 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); -require_once(dirname(__FILE__).'/locallib.php'); -require_once(dirname(__FILE__).'/allocation/lib.php'); +require(__DIR__.'/../../config.php'); +require_once(__DIR__.'/locallib.php'); +require_once(__DIR__.'/allocation/lib.php'); $cmid = required_param('cmid', PARAM_INT); // course module $method = optional_param('method', 'manual', PARAM_ALPHA); // method to use diff --git a/mod/workshop/allocation/manual/lib.php b/mod/workshop/allocation/manual/lib.php index 3b62b76c194fd..a1fd31cf736dd 100644 --- a/mod/workshop/allocation/manual/lib.php +++ b/mod/workshop/allocation/manual/lib.php @@ -26,8 +26,8 @@ defined('MOODLE_INTERNAL') || die(); -require_once(dirname(dirname(__FILE__)) . '/lib.php'); // interface definition -require_once(dirname(dirname(dirname(__FILE__))) . '/locallib.php'); // workshop internal API +require_once(__DIR__ . '/../lib.php'); // interface definition +require_once(__DIR__ . '/../../locallib.php'); // workshop internal API /** * Allows users to allocate submissions for review manually diff --git a/mod/workshop/allocation/random/lib.php b/mod/workshop/allocation/random/lib.php index eba000938ced4..f878fe72f1fa0 100644 --- a/mod/workshop/allocation/random/lib.php +++ b/mod/workshop/allocation/random/lib.php @@ -28,9 +28,9 @@ global $CFG; // access to global variables during unit test -require_once(dirname(dirname(__FILE__)) . '/lib.php'); // interface definition -require_once(dirname(dirname(dirname(__FILE__))) . '/locallib.php'); // workshop internal API -require_once(dirname(__FILE__) . '/settings_form.php'); // settings form +require_once(__DIR__ . '/../lib.php'); // interface definition +require_once(__DIR__ . '/../../locallib.php'); // workshop internal API +require_once(__DIR__ . '/settings_form.php'); // settings form /** * Allocates the submissions randomly diff --git a/mod/workshop/allocation/random/settings.php b/mod/workshop/allocation/random/settings.php index a02feaed75ed1..b86865c434d97 100644 --- a/mod/workshop/allocation/random/settings.php +++ b/mod/workshop/allocation/random/settings.php @@ -26,7 +26,7 @@ defined('MOODLE_INTERNAL') || die(); -require_once(dirname(__FILE__) . '/lib.php'); +require_once(__DIR__ . '/lib.php'); $settings->add(new admin_setting_configselect('workshopallocation_random/numofreviews', get_string('numofreviews', 'workshopallocation_random'), diff --git a/mod/workshop/allocation/scheduled/lib.php b/mod/workshop/allocation/scheduled/lib.php index 11095a97b584a..35f6fca2f0b0f 100644 --- a/mod/workshop/allocation/scheduled/lib.php +++ b/mod/workshop/allocation/scheduled/lib.php @@ -26,10 +26,10 @@ defined('MOODLE_INTERNAL') || die(); -require_once(dirname(dirname(__FILE__)) . '/lib.php'); // interface definition -require_once(dirname(dirname(dirname(__FILE__))) . '/locallib.php'); // workshop internal API -require_once(dirname(dirname(__FILE__)) . '/random/lib.php'); // random allocator -require_once(dirname(__FILE__) . '/settings_form.php'); // our settings form +require_once(__DIR__ . '/../lib.php'); // interface definition +require_once(__DIR__ . '/../../locallib.php'); // workshop internal API +require_once(__DIR__ . '/../random/lib.php'); // random allocator +require_once(__DIR__ . '/settings_form.php'); // our settings form /** * Allocates the submissions randomly in a cronjob task diff --git a/mod/workshop/allocation/scheduled/settings_form.php b/mod/workshop/allocation/scheduled/settings_form.php index 129be6597582f..1e327149cbeee 100644 --- a/mod/workshop/allocation/scheduled/settings_form.php +++ b/mod/workshop/allocation/scheduled/settings_form.php @@ -27,7 +27,7 @@ defined('MOODLE_INTERNAL') || die(); require_once($CFG->dirroot.'/lib/formslib.php'); -require_once(dirname(dirname(__FILE__)) . '/random/settings_form.php'); // parent form +require_once(__DIR__ . '/../random/settings_form.php'); // parent form /** * Allocator settings form diff --git a/mod/workshop/assessment.php b/mod/workshop/assessment.php index a75b44e8c0172..129c38c17cdd0 100644 --- a/mod/workshop/assessment.php +++ b/mod/workshop/assessment.php @@ -34,8 +34,8 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); -require_once(dirname(__FILE__).'/locallib.php'); +require(__DIR__.'/../../config.php'); +require_once(__DIR__.'/locallib.php'); $asid = required_param('asid', PARAM_INT); // assessment id $assessment = $DB->get_record('workshop_assessments', array('id' => $asid), '*', MUST_EXIST); diff --git a/mod/workshop/backup/moodle1/lib.php b/mod/workshop/backup/moodle1/lib.php index baff6f9d4dc84..ddc4a01494f00 100644 --- a/mod/workshop/backup/moodle1/lib.php +++ b/mod/workshop/backup/moodle1/lib.php @@ -362,7 +362,7 @@ public function on_elements_end() { */ function workshop_upgrade_transform_instance(stdClass $old) { global $CFG; - require_once(dirname(dirname(dirname(__FILE__))) . '/locallib.php'); + require_once(__DIR__ . '/../../locallib.php'); $new = new stdClass(); $new->course = $old->course; diff --git a/mod/workshop/editform.php b/mod/workshop/editform.php index 96417e3a68657..6e77865c237b5 100644 --- a/mod/workshop/editform.php +++ b/mod/workshop/editform.php @@ -23,8 +23,8 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); -require_once(dirname(__FILE__).'/locallib.php'); +require(__DIR__.'/../../config.php'); +require_once(__DIR__.'/locallib.php'); $cmid = required_param('cmid', PARAM_INT); diff --git a/mod/workshop/editformpreview.php b/mod/workshop/editformpreview.php index 5594d3ab5219d..4f2941d611101 100644 --- a/mod/workshop/editformpreview.php +++ b/mod/workshop/editformpreview.php @@ -23,8 +23,8 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); -require_once(dirname(__FILE__).'/locallib.php'); +require(__DIR__.'/../../config.php'); +require_once(__DIR__.'/locallib.php'); $cmid = required_param('cmid', PARAM_INT); $cm = get_coursemodule_from_id('workshop', $cmid, 0, false, MUST_EXIST); diff --git a/mod/workshop/eval/best/lib.php b/mod/workshop/eval/best/lib.php index 954cf271d274a..0681d98dc42f2 100644 --- a/mod/workshop/eval/best/lib.php +++ b/mod/workshop/eval/best/lib.php @@ -27,7 +27,7 @@ defined('MOODLE_INTERNAL') || die(); -require_once(dirname(dirname(__FILE__)) . '/lib.php'); // interface definition +require_once(__DIR__ . '/../lib.php'); // interface definition require_once($CFG->libdir . '/gradelib.php'); /** diff --git a/mod/workshop/exassessment.php b/mod/workshop/exassessment.php index 9ffbcbe69de14..2896dc30c4fc7 100644 --- a/mod/workshop/exassessment.php +++ b/mod/workshop/exassessment.php @@ -23,8 +23,8 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); -require_once(dirname(__FILE__).'/locallib.php'); +require(__DIR__.'/../../config.php'); +require_once(__DIR__.'/locallib.php'); $asid = required_param('asid', PARAM_INT); // assessment id $assessment = $DB->get_record('workshop_assessments', array('id' => $asid), '*', MUST_EXIST); diff --git a/mod/workshop/excompare.php b/mod/workshop/excompare.php index e3977590f587a..481f7cffe0988 100644 --- a/mod/workshop/excompare.php +++ b/mod/workshop/excompare.php @@ -22,8 +22,8 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); -require_once(dirname(__FILE__).'/locallib.php'); +require(__DIR__.'/../../config.php'); +require_once(__DIR__.'/locallib.php'); $cmid = required_param('cmid', PARAM_INT); // course module id $sid = required_param('sid', PARAM_INT); // example submission id diff --git a/mod/workshop/exsubmission.php b/mod/workshop/exsubmission.php index 4f794bfda6c38..f95843b36a941 100644 --- a/mod/workshop/exsubmission.php +++ b/mod/workshop/exsubmission.php @@ -23,8 +23,8 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); -require_once(dirname(__FILE__).'/locallib.php'); +require(__DIR__.'/../../config.php'); +require_once(__DIR__.'/locallib.php'); $cmid = required_param('cmid', PARAM_INT); // course module id $id = required_param('id', PARAM_INT); // example submission id, 0 for the new one @@ -113,7 +113,7 @@ } if ($edit and $canmanage) { - require_once(dirname(__FILE__).'/submission_form.php'); + require_once(__DIR__.'/submission_form.php'); $example = file_prepare_standard_editor($example, 'content', $workshop->submission_content_options(), $workshop->context, 'mod_workshop', 'submission_content', $example->id); diff --git a/mod/workshop/form/accumulative/assessment_form.php b/mod/workshop/form/accumulative/assessment_form.php index a6ca71ceb1451..fac724306dd43 100644 --- a/mod/workshop/form/accumulative/assessment_form.php +++ b/mod/workshop/form/accumulative/assessment_form.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die(); -require_once(dirname(dirname(__FILE__)).'/assessment_form.php'); // parent class definition +require_once(__DIR__.'/../assessment_form.php'); // parent class definition /** * Class representing a form for assessing submissions by accumulative grading strategy diff --git a/mod/workshop/form/accumulative/edit_form.php b/mod/workshop/form/accumulative/edit_form.php index 6e90cf83a40e8..39f58ab7471a5 100644 --- a/mod/workshop/form/accumulative/edit_form.php +++ b/mod/workshop/form/accumulative/edit_form.php @@ -25,8 +25,8 @@ defined('MOODLE_INTERNAL') || die(); -require_once(dirname(dirname(dirname(__FILE__))).'/lib.php'); // module library -require_once(dirname(dirname(__FILE__)).'/edit_form.php'); // parent class definition +require_once(__DIR__.'/../../lib.php'); // module library +require_once(__DIR__.'/../edit_form.php'); // parent class definition /** * Class for editing accumulative grading strategy forms. diff --git a/mod/workshop/form/accumulative/lib.php b/mod/workshop/form/accumulative/lib.php index 6a3a54db808be..77576a8ad927a 100644 --- a/mod/workshop/form/accumulative/lib.php +++ b/mod/workshop/form/accumulative/lib.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die(); -require_once(dirname(dirname(__FILE__)) . '/lib.php'); // interface definition +require_once(__DIR__ . '/../lib.php'); // interface definition require_once($CFG->libdir . '/gradelib.php'); // to handle float vs decimal issues /** @@ -117,7 +117,7 @@ public function get_edit_strategy_form($actionurl=null) { global $CFG; // needed because the included files use it global $PAGE; - require_once(dirname(__FILE__) . '/edit_form.php'); + require_once(__DIR__ . '/edit_form.php'); $fields = $this->prepare_form_fields($this->dimensions); $nodimensions = count($this->dimensions); @@ -208,7 +208,7 @@ public function get_assessment_form(moodle_url $actionurl=null, $mode='preview', global $CFG; // needed because the included files use it global $PAGE; global $DB; - require_once(dirname(__FILE__) . '/assessment_form.php'); + require_once(__DIR__ . '/assessment_form.php'); $fields = $this->prepare_form_fields($this->dimensions); $nodimensions = count($this->dimensions); diff --git a/mod/workshop/form/comments/assessment_form.php b/mod/workshop/form/comments/assessment_form.php index 1dc19e115d8d6..b7521463ced96 100644 --- a/mod/workshop/form/comments/assessment_form.php +++ b/mod/workshop/form/comments/assessment_form.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die(); -require_once(dirname(dirname(__FILE__)).'/assessment_form.php'); // parent class definition +require_once(__DIR__ . '/../assessment_form.php'); // Parent class definition. /** * Class representing a form for assessing submissions by comments grading strategy diff --git a/mod/workshop/form/comments/edit_form.php b/mod/workshop/form/comments/edit_form.php index 9b819f1c4143e..ff5875f28f960 100644 --- a/mod/workshop/form/comments/edit_form.php +++ b/mod/workshop/form/comments/edit_form.php @@ -25,8 +25,8 @@ defined('MOODLE_INTERNAL') || die(); -require_once(dirname(dirname(dirname(__FILE__))).'/lib.php'); // module library -require_once(dirname(dirname(__FILE__)).'/edit_form.php'); // parent class definition +require_once(__DIR__ . '/../../lib.php'); // Module library. +require_once(__DIR__ . '/../edit_form.php'); // Parent class definition. /** * Class for editing comments grading strategy forms. diff --git a/mod/workshop/form/comments/lib.php b/mod/workshop/form/comments/lib.php index 408ecf427457e..3d2e50af90c25 100644 --- a/mod/workshop/form/comments/lib.php +++ b/mod/workshop/form/comments/lib.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die(); -require_once(dirname(dirname(__FILE__)) . '/lib.php'); // interface definition +require_once(__DIR__ . '/../lib.php'); // interface definition require_once($CFG->libdir . '/gradelib.php'); // to handle float vs decimal issues /** @@ -117,7 +117,7 @@ public function get_edit_strategy_form($actionurl=null) { global $CFG; // needed because the included files use it global $PAGE; - require_once(dirname(__FILE__) . '/edit_form.php'); + require_once(__DIR__ . '/edit_form.php'); $fields = $this->prepare_form_fields($this->dimensions); $nodimensions = count($this->dimensions); @@ -208,7 +208,7 @@ public function get_assessment_form(moodle_url $actionurl=null, $mode='preview', global $CFG; // needed because the included files use it global $PAGE; global $DB; - require_once(dirname(__FILE__) . '/assessment_form.php'); + require_once(__DIR__ . '/assessment_form.php'); $fields = $this->prepare_form_fields($this->dimensions); $nodimensions = count($this->dimensions); diff --git a/mod/workshop/form/numerrors/assessment_form.php b/mod/workshop/form/numerrors/assessment_form.php index 84cc45023247d..2c04cb1f8615d 100644 --- a/mod/workshop/form/numerrors/assessment_form.php +++ b/mod/workshop/form/numerrors/assessment_form.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die(); -require_once(dirname(dirname(__FILE__)).'/assessment_form.php'); // parent class definition +require_once(__DIR__ . '/../assessment_form.php'); // Parent class definition. /** * Class representing a form for assessing submissions by numerrors grading strategy diff --git a/mod/workshop/form/numerrors/edit_form.php b/mod/workshop/form/numerrors/edit_form.php index 3ccce763435fd..3f3ac9ed2c0ee 100644 --- a/mod/workshop/form/numerrors/edit_form.php +++ b/mod/workshop/form/numerrors/edit_form.php @@ -25,8 +25,8 @@ defined('MOODLE_INTERNAL') || die(); -require_once(dirname(dirname(dirname(__FILE__))).'/lib.php'); // module library -require_once(dirname(dirname(__FILE__)).'/edit_form.php'); // parent class definition +require_once(__DIR__ . '/../../lib.php'); // module library +require_once(__DIR__ . '/../edit_form.php'); // parent class definition /** * Class for editing "Number of errors" grading strategy forms. diff --git a/mod/workshop/form/numerrors/lib.php b/mod/workshop/form/numerrors/lib.php index 3e461dd88a360..c0195a6267669 100644 --- a/mod/workshop/form/numerrors/lib.php +++ b/mod/workshop/form/numerrors/lib.php @@ -25,8 +25,8 @@ defined('MOODLE_INTERNAL') || die(); -require_once(dirname(dirname(__FILE__)) . '/lib.php'); // interface definition -require_once($CFG->libdir . '/gradelib.php'); // to handle float vs decimal issues +require_once(__DIR__ . '/../lib.php'); // Interface definition. +require_once($CFG->libdir . '/gradelib.php'); // To handle float vs decimal issues. /** * Server workshop files @@ -121,7 +121,7 @@ public function get_edit_strategy_form($actionurl=null) { global $CFG; // needed because the included files use it global $PAGE; - require_once(dirname(__FILE__) . '/edit_form.php'); + require_once(__DIR__ . '/edit_form.php'); $fields = $this->prepare_form_fields($this->dimensions, $this->mappings); $nodimensions = count($this->dimensions); @@ -245,7 +245,7 @@ public function get_assessment_form(moodle_url $actionurl=null, $mode='preview', global $CFG; // needed because the included files use it global $PAGE; global $DB; - require_once(dirname(__FILE__) . '/assessment_form.php'); + require_once(__DIR__ . '/assessment_form.php'); $fields = $this->prepare_form_fields($this->dimensions, $this->mappings); $nodimensions = count($this->dimensions); diff --git a/mod/workshop/form/rubric/assessment_form.php b/mod/workshop/form/rubric/assessment_form.php index c1597542918f4..8e31559c4f540 100644 --- a/mod/workshop/form/rubric/assessment_form.php +++ b/mod/workshop/form/rubric/assessment_form.php @@ -28,7 +28,7 @@ defined('MOODLE_INTERNAL') || die(); -require_once(dirname(dirname(__FILE__)).'/assessment_form.php'); // parent class definition +require_once(__DIR__ . '/../assessment_form.php'); // parent class definition /** * Base class representing a form for assessing submissions by rubric grading strategy diff --git a/mod/workshop/form/rubric/edit_form.php b/mod/workshop/form/rubric/edit_form.php index ccd4c29c25c46..85af10c6e5959 100644 --- a/mod/workshop/form/rubric/edit_form.php +++ b/mod/workshop/form/rubric/edit_form.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die(); -require_once(dirname(dirname(__FILE__)).'/edit_form.php'); // parent class definition +require_once(__DIR__ . '/../edit_form.php'); // parent class definition /** * Class for editing rubric grading strategy forms. diff --git a/mod/workshop/form/rubric/lib.php b/mod/workshop/form/rubric/lib.php index d0e26d44af5d5..72a04914918a3 100644 --- a/mod/workshop/form/rubric/lib.php +++ b/mod/workshop/form/rubric/lib.php @@ -25,8 +25,8 @@ defined('MOODLE_INTERNAL') || die(); -require_once(dirname(dirname(__FILE__)) . '/lib.php'); // interface definition -require_once($CFG->libdir . '/gradelib.php'); // to handle float vs decimal issues +require_once(__DIR__ . '/../lib.php'); // Interface definition. +require_once($CFG->libdir . '/gradelib.php'); // To handle float vs decimal issues. /** * Server workshop files @@ -125,7 +125,7 @@ public function __construct(workshop $workshop) { public function get_edit_strategy_form($actionurl=null) { global $CFG; // needed because the included files use it - require_once(dirname(__FILE__) . '/edit_form.php'); + require_once(__DIR__ . '/edit_form.php'); $fields = $this->prepare_form_fields($this->dimensions); $fields->config_layout = $this->config->layout; @@ -248,7 +248,7 @@ public function save_edit_strategy_form(stdclass $data) { public function get_assessment_form(moodle_url $actionurl=null, $mode='preview', stdclass $assessment=null, $editable=true, $options=array()) { global $CFG; // needed because the included files use it global $DB; - require_once(dirname(__FILE__) . '/assessment_form.php'); + require_once(__DIR__ . '/assessment_form.php'); $fields = $this->prepare_form_fields($this->dimensions); $nodimensions = count($this->dimensions); diff --git a/mod/workshop/index.php b/mod/workshop/index.php index 02c513bba25bc..eba17ae162716 100644 --- a/mod/workshop/index.php +++ b/mod/workshop/index.php @@ -23,8 +23,8 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); -require_once(dirname(__FILE__).'/lib.php'); +require(__DIR__.'/../../config.php'); +require_once(__DIR__.'/lib.php'); $id = required_param('id', PARAM_INT); // course diff --git a/mod/workshop/lib.php b/mod/workshop/lib.php index 01e5701101b27..c9f40482f1d02 100644 --- a/mod/workshop/lib.php +++ b/mod/workshop/lib.php @@ -69,7 +69,7 @@ function workshop_supports($feature) { */ function workshop_add_instance(stdclass $workshop) { global $CFG, $DB; - require_once(dirname(__FILE__) . '/locallib.php'); + require_once(__DIR__ . '/locallib.php'); $workshop->phase = workshop::PHASE_SETUP; $workshop->timecreated = time(); @@ -147,7 +147,7 @@ function workshop_add_instance(stdclass $workshop) { */ function workshop_update_instance(stdclass $workshop) { global $CFG, $DB; - require_once(dirname(__FILE__) . '/locallib.php'); + require_once(__DIR__ . '/locallib.php'); $workshop->timemodified = time(); $workshop->id = $workshop->instance; @@ -366,7 +366,7 @@ function workshop_user_outline($course, $user, $mod, $workshop) { */ function workshop_user_complete($course, $user, $mod, $workshop) { global $CFG, $DB, $OUTPUT; - require_once(dirname(__FILE__).'/locallib.php'); + require_once(__DIR__.'/locallib.php'); require_once($CFG->libdir.'/gradelib.php'); $workshop = new workshop($workshop, $mod, $course); diff --git a/mod/workshop/locallib.php b/mod/workshop/locallib.php index 8418b3d40c687..b26d56ac3f45d 100644 --- a/mod/workshop/locallib.php +++ b/mod/workshop/locallib.php @@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die(); -require_once(dirname(__FILE__).'/lib.php'); // we extend this library here +require_once(__DIR__.'/lib.php'); // we extend this library here require_once($CFG->libdir . '/gradelib.php'); // we use some rounding and comparing routines here require_once($CFG->libdir . '/filelib.php'); @@ -1430,7 +1430,7 @@ public function grading_strategy_instance() { global $CFG; // because we require other libs here if (is_null($this->strategyinstance)) { - $strategylib = dirname(__FILE__) . '/form/' . $this->strategy . '/lib.php'; + $strategylib = __DIR__ . '/form/' . $this->strategy . '/lib.php'; if (is_readable($strategylib)) { require_once($strategylib); } else { @@ -1455,7 +1455,7 @@ public function grading_strategy_instance() { public function set_grading_evaluation_method($method) { global $DB; - $evaluationlib = dirname(__FILE__) . '/eval/' . $method . '/lib.php'; + $evaluationlib = __DIR__ . '/eval/' . $method . '/lib.php'; if (is_readable($evaluationlib)) { $this->evaluationinstance = null; @@ -1479,13 +1479,13 @@ public function grading_evaluation_instance() { if (empty($this->evaluation)) { $this->evaluation = 'best'; } - $evaluationlib = dirname(__FILE__) . '/eval/' . $this->evaluation . '/lib.php'; + $evaluationlib = __DIR__ . '/eval/' . $this->evaluation . '/lib.php'; if (is_readable($evaluationlib)) { require_once($evaluationlib); } else { // Fall back in case the subplugin is not available. $this->evaluation = 'best'; - $evaluationlib = dirname(__FILE__) . '/eval/' . $this->evaluation . '/lib.php'; + $evaluationlib = __DIR__ . '/eval/' . $this->evaluation . '/lib.php'; if (is_readable($evaluationlib)) { require_once($evaluationlib); } else { @@ -1511,7 +1511,7 @@ public function grading_evaluation_instance() { public function allocator_instance($method) { global $CFG; // because we require other libs here - $allocationlib = dirname(__FILE__) . '/allocation/' . $method . '/lib.php'; + $allocationlib = __DIR__ . '/allocation/' . $method . '/lib.php'; if (is_readable($allocationlib)) { require_once($allocationlib); } else { @@ -2365,7 +2365,7 @@ public function aggregate_grading_grades($restrict=null) { */ public function get_feedbackreviewer_form(moodle_url $actionurl, stdclass $assessment, $options=array()) { global $CFG; - require_once(dirname(__FILE__) . '/feedbackreviewer_form.php'); + require_once(__DIR__ . '/feedbackreviewer_form.php'); $current = new stdclass(); $current->asid = $assessment->id; @@ -2401,7 +2401,7 @@ public function get_feedbackreviewer_form(moodle_url $actionurl, stdclass $asses */ public function get_feedbackauthor_form(moodle_url $actionurl, stdclass $submission, $options=array()) { global $CFG; - require_once(dirname(__FILE__) . '/feedbackauthor_form.php'); + require_once(__DIR__ . '/feedbackauthor_form.php'); $current = new stdclass(); $current->submissionid = $submission->id; diff --git a/mod/workshop/mod_form.php b/mod/workshop/mod_form.php index 9fcaf27798698..0a87b5b0df1e5 100644 --- a/mod/workshop/mod_form.php +++ b/mod/workshop/mod_form.php @@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die(); require_once($CFG->dirroot . '/course/moodleform_mod.php'); -require_once(dirname(__FILE__) . '/locallib.php'); +require_once(__DIR__ . '/locallib.php'); require_once($CFG->libdir . '/filelib.php'); /** diff --git a/mod/workshop/submission.php b/mod/workshop/submission.php index 000c63fbc3ebd..d4326649ab17e 100644 --- a/mod/workshop/submission.php +++ b/mod/workshop/submission.php @@ -23,8 +23,8 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); -require_once(dirname(__FILE__).'/locallib.php'); +require(__DIR__.'/../../config.php'); +require_once(__DIR__.'/locallib.php'); require_once($CFG->dirroot . '/repository/lib.php'); $cmid = required_param('cmid', PARAM_INT); // Course module id. @@ -181,7 +181,7 @@ } if ($edit) { - require_once(dirname(__FILE__).'/submission_form.php'); + require_once(__DIR__.'/submission_form.php'); $submission = file_prepare_standard_editor($submission, 'content', $workshop->submission_content_options(), $workshop->context, 'mod_workshop', 'submission_content', $submission->id); diff --git a/mod/workshop/switchphase.php b/mod/workshop/switchphase.php index 0c58cef8937d7..3e1b7062a660f 100644 --- a/mod/workshop/switchphase.php +++ b/mod/workshop/switchphase.php @@ -23,8 +23,8 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); -require_once(dirname(__FILE__).'/locallib.php'); +require(__DIR__.'/../../config.php'); +require_once(__DIR__.'/locallib.php'); $cmid = required_param('cmid', PARAM_INT); // course module $phase = required_param('phase', PARAM_INT); // the code of the new phase diff --git a/mod/workshop/toolbox.php b/mod/workshop/toolbox.php index addd663b68baf..38958bcafe566 100644 --- a/mod/workshop/toolbox.php +++ b/mod/workshop/toolbox.php @@ -23,8 +23,8 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); -require_once(dirname(__FILE__).'/locallib.php'); +require(__DIR__.'/../../config.php'); +require_once(__DIR__.'/locallib.php'); $id = required_param('id', PARAM_INT); // course_module ID $tool = required_param('tool', PARAM_ALPHA); diff --git a/mod/workshop/view.php b/mod/workshop/view.php index 66adc1743d907..094b5b221688f 100644 --- a/mod/workshop/view.php +++ b/mod/workshop/view.php @@ -26,8 +26,8 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); -require_once(dirname(__FILE__).'/locallib.php'); +require(__DIR__.'/../../config.php'); +require_once(__DIR__.'/locallib.php'); require_once($CFG->libdir.'/completionlib.php'); $id = optional_param('id', 0, PARAM_INT); // course_module ID, or diff --git a/my/index.php b/my/index.php index 8bad3d9a92706..07e503b353a47 100644 --- a/my/index.php +++ b/my/index.php @@ -34,7 +34,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->dirroot . '/my/lib.php'); redirect_if_major_upgrade_required(); diff --git a/my/indexsys.php b/my/indexsys.php index c3c2c124220c0..ad16f4441a103 100644 --- a/my/indexsys.php +++ b/my/indexsys.php @@ -35,7 +35,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->dirroot . '/my/lib.php'); require_once($CFG->libdir.'/adminlib.php'); diff --git a/portfolio/add.php b/portfolio/add.php index 871042b24b331..b18ff4224cef5 100644 --- a/portfolio/add.php +++ b/portfolio/add.php @@ -22,7 +22,7 @@ * Martin Dougiamas * @license http://www.gnu.org/copyleft/gpl.html GNU GPL */ -require_once(dirname(dirname(__FILE__)) . '/config.php'); +require_once(__DIR__ . '/../config.php'); if (empty($CFG->enableportfolios)) { print_error('disabled', 'portfolio'); diff --git a/portfolio/download/file.php b/portfolio/download/file.php index edd62bc5d124c..0e10dd900d634 100644 --- a/portfolio/download/file.php +++ b/portfolio/download/file.php @@ -4,7 +4,7 @@ // (using portfolio/file.php) but still give them the 'return to where you were' link // to go back to their assignment, or whatever -require_once(dirname(dirname(dirname(__FILE__))) . '/config.php'); +require(__DIR__.'/../../config.php'); if (empty($CFG->enableportfolios)) { print_error('disabled', 'portfolio'); diff --git a/portfolio/file.php b/portfolio/file.php index dc805854db9f2..bcb1e7dc6b9b1 100644 --- a/portfolio/file.php +++ b/portfolio/file.php @@ -24,7 +24,7 @@ * Martin Dougiamas * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(__FILE__)) . '/config.php'); +require_once(__DIR__ . '/../config.php'); if (empty($CFG->enableportfolios)) { print_error('disabled', 'portfolio'); diff --git a/portfolio/mahara/preconfig.php b/portfolio/mahara/preconfig.php index ea923dc12e117..127a1a7c1bdcf 100644 --- a/portfolio/mahara/preconfig.php +++ b/portfolio/mahara/preconfig.php @@ -24,7 +24,7 @@ * @copyright 2009 Penny Leach * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(dirname(__FILE__))). '/config.php'); +require_once(__DIR__ . '/../../config.php'); if (empty($CFG->enableportfolios)) { print_error('disabled', 'portfolio'); diff --git a/question/addquestion.php b/question/addquestion.php index 790cdb69e32ed..c7ca982387631 100644 --- a/question/addquestion.php +++ b/question/addquestion.php @@ -25,8 +25,8 @@ */ -require_once(dirname(__FILE__) . '/../config.php'); -require_once(dirname(__FILE__) . '/editlib.php'); +require_once(__DIR__ . '/../config.php'); +require_once(__DIR__ . '/editlib.php'); // Read URL parameters. $categoryid = required_param('category', PARAM_INT); diff --git a/question/behaviour/adaptive/tests/behaviourtype_test.php b/question/behaviour/adaptive/tests/behaviourtype_test.php index 9071ae5d804bd..58cd548ec3936 100644 --- a/question/behaviour/adaptive/tests/behaviourtype_test.php +++ b/question/behaviour/adaptive/tests/behaviourtype_test.php @@ -27,8 +27,8 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../../../engine/lib.php'); -require_once(dirname(__FILE__) . '/../../../engine/tests/helpers.php'); +require_once(__DIR__ . '/../../../engine/lib.php'); +require_once(__DIR__ . '/../../../engine/tests/helpers.php'); /** diff --git a/question/behaviour/adaptive/tests/mark_display_test.php b/question/behaviour/adaptive/tests/mark_display_test.php index f77fdc9ecae9e..738d5accbe287 100644 --- a/question/behaviour/adaptive/tests/mark_display_test.php +++ b/question/behaviour/adaptive/tests/mark_display_test.php @@ -27,8 +27,8 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../../../engine/lib.php'); -require_once(dirname(__FILE__) . '/../behaviour.php'); +require_once(__DIR__ . '/../../../engine/lib.php'); +require_once(__DIR__ . '/../behaviour.php'); /** diff --git a/question/behaviour/adaptive/tests/walkthrough_test.php b/question/behaviour/adaptive/tests/walkthrough_test.php index eeb3a2e6fb864..863b87c04d1ee 100644 --- a/question/behaviour/adaptive/tests/walkthrough_test.php +++ b/question/behaviour/adaptive/tests/walkthrough_test.php @@ -29,8 +29,8 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../../../engine/lib.php'); -require_once(dirname(__FILE__) . '/../../../engine/tests/helpers.php'); +require_once(__DIR__ . '/../../../engine/lib.php'); +require_once(__DIR__ . '/../../../engine/tests/helpers.php'); /** diff --git a/question/behaviour/adaptivenopenalty/behaviour.php b/question/behaviour/adaptivenopenalty/behaviour.php index 7d02d2b54f866..aa15bb56c5041 100644 --- a/question/behaviour/adaptivenopenalty/behaviour.php +++ b/question/behaviour/adaptivenopenalty/behaviour.php @@ -26,7 +26,7 @@ defined('MOODLE_INTERNAL') || die(); -require_once(dirname(__FILE__) . '/../adaptive/behaviour.php'); +require_once(__DIR__ . '/../adaptive/behaviour.php'); /** diff --git a/question/behaviour/adaptivenopenalty/behaviourtype.php b/question/behaviour/adaptivenopenalty/behaviourtype.php index 2fd6eff0b24c3..8af74feccff83 100644 --- a/question/behaviour/adaptivenopenalty/behaviourtype.php +++ b/question/behaviour/adaptivenopenalty/behaviourtype.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die(); -require_once(dirname(__FILE__) . '/../adaptive/behaviourtype.php'); +require_once(__DIR__ . '/../adaptive/behaviourtype.php'); /** diff --git a/question/behaviour/adaptivenopenalty/renderer.php b/question/behaviour/adaptivenopenalty/renderer.php index 62b95401c155c..915381de62067 100644 --- a/question/behaviour/adaptivenopenalty/renderer.php +++ b/question/behaviour/adaptivenopenalty/renderer.php @@ -27,7 +27,7 @@ defined('MOODLE_INTERNAL') || die(); -require_once(dirname(__FILE__) . '/../adaptive/renderer.php'); +require_once(__DIR__ . '/../adaptive/renderer.php'); /** diff --git a/question/behaviour/adaptivenopenalty/tests/walkthrough_test.php b/question/behaviour/adaptivenopenalty/tests/walkthrough_test.php index 42aef5134d542..49d5a6619fc1b 100644 --- a/question/behaviour/adaptivenopenalty/tests/walkthrough_test.php +++ b/question/behaviour/adaptivenopenalty/tests/walkthrough_test.php @@ -28,8 +28,8 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../../../engine/lib.php'); -require_once(dirname(__FILE__) . '/../../../engine/tests/helpers.php'); +require_once(__DIR__ . '/../../../engine/lib.php'); +require_once(__DIR__ . '/../../../engine/tests/helpers.php'); /** diff --git a/question/behaviour/deferredcbm/behaviour.php b/question/behaviour/deferredcbm/behaviour.php index 04abd7a44e76b..e825460aeeae7 100644 --- a/question/behaviour/deferredcbm/behaviour.php +++ b/question/behaviour/deferredcbm/behaviour.php @@ -28,7 +28,7 @@ defined('MOODLE_INTERNAL') || die(); -require_once(dirname(__FILE__) . '/../deferredfeedback/behaviour.php'); +require_once(__DIR__ . '/../deferredfeedback/behaviour.php'); /** diff --git a/question/behaviour/deferredcbm/behaviourtype.php b/question/behaviour/deferredcbm/behaviourtype.php index 2b41c5b9ad5b5..254e863f51dd5 100644 --- a/question/behaviour/deferredcbm/behaviourtype.php +++ b/question/behaviour/deferredcbm/behaviourtype.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die(); -require_once(dirname(__FILE__) . '/../deferredfeedback/behaviourtype.php'); +require_once(__DIR__ . '/../deferredfeedback/behaviourtype.php'); /** diff --git a/question/behaviour/deferredcbm/tests/behaviourtype_test.php b/question/behaviour/deferredcbm/tests/behaviourtype_test.php index addcf4b8d53a9..a4892e6247e11 100644 --- a/question/behaviour/deferredcbm/tests/behaviourtype_test.php +++ b/question/behaviour/deferredcbm/tests/behaviourtype_test.php @@ -28,8 +28,8 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../../../engine/lib.php'); -require_once(dirname(__FILE__) . '/../../../engine/tests/helpers.php'); +require_once(__DIR__ . '/../../../engine/lib.php'); +require_once(__DIR__ . '/../../../engine/tests/helpers.php'); /** diff --git a/question/behaviour/deferredcbm/tests/question_cbm_test.php b/question/behaviour/deferredcbm/tests/question_cbm_test.php index f67025d62fe04..16d0d39ced9ca 100644 --- a/question/behaviour/deferredcbm/tests/question_cbm_test.php +++ b/question/behaviour/deferredcbm/tests/question_cbm_test.php @@ -28,7 +28,7 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../../../engine/lib.php'); +require_once(__DIR__ . '/../../../engine/lib.php'); /** diff --git a/question/behaviour/deferredcbm/tests/walkthrough_test.php b/question/behaviour/deferredcbm/tests/walkthrough_test.php index 9417dfe885aa1..b139c96a6d210 100644 --- a/question/behaviour/deferredcbm/tests/walkthrough_test.php +++ b/question/behaviour/deferredcbm/tests/walkthrough_test.php @@ -28,8 +28,8 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../../../engine/lib.php'); -require_once(dirname(__FILE__) . '/../../../engine/tests/helpers.php'); +require_once(__DIR__ . '/../../../engine/lib.php'); +require_once(__DIR__ . '/../../../engine/tests/helpers.php'); /** diff --git a/question/behaviour/deferredfeedback/tests/behaviourtype_test.php b/question/behaviour/deferredfeedback/tests/behaviourtype_test.php index 6b63e2223ae4c..3bedc80fd53ff 100644 --- a/question/behaviour/deferredfeedback/tests/behaviourtype_test.php +++ b/question/behaviour/deferredfeedback/tests/behaviourtype_test.php @@ -27,8 +27,8 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../../../engine/lib.php'); -require_once(dirname(__FILE__) . '/../../../engine/tests/helpers.php'); +require_once(__DIR__ . '/../../../engine/lib.php'); +require_once(__DIR__ . '/../../../engine/tests/helpers.php'); /** diff --git a/question/behaviour/deferredfeedback/tests/walkthrough_test.php b/question/behaviour/deferredfeedback/tests/walkthrough_test.php index 22bae00fcc466..c170aa4f522ed 100644 --- a/question/behaviour/deferredfeedback/tests/walkthrough_test.php +++ b/question/behaviour/deferredfeedback/tests/walkthrough_test.php @@ -28,8 +28,8 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../../../engine/lib.php'); -require_once(dirname(__FILE__) . '/../../../engine/tests/helpers.php'); +require_once(__DIR__ . '/../../../engine/lib.php'); +require_once(__DIR__ . '/../../../engine/tests/helpers.php'); /** diff --git a/question/behaviour/immediatecbm/behaviour.php b/question/behaviour/immediatecbm/behaviour.php index 3e0a12256a476..be66cecf0bf5e 100644 --- a/question/behaviour/immediatecbm/behaviour.php +++ b/question/behaviour/immediatecbm/behaviour.php @@ -27,7 +27,7 @@ defined('MOODLE_INTERNAL') || die(); -require_once(dirname(__FILE__) . '/../immediatefeedback/behaviour.php'); +require_once(__DIR__ . '/../immediatefeedback/behaviour.php'); /** diff --git a/question/behaviour/immediatecbm/behaviourtype.php b/question/behaviour/immediatecbm/behaviourtype.php index 1e8a7efb5f389..b40f1df822937 100644 --- a/question/behaviour/immediatecbm/behaviourtype.php +++ b/question/behaviour/immediatecbm/behaviourtype.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die(); -require_once(dirname(__FILE__) . '/../deferredcbm/behaviourtype.php'); +require_once(__DIR__ . '/../deferredcbm/behaviourtype.php'); /** diff --git a/question/behaviour/immediatecbm/renderer.php b/question/behaviour/immediatecbm/renderer.php index cc0811f71c97f..a7b36ccc52789 100644 --- a/question/behaviour/immediatecbm/renderer.php +++ b/question/behaviour/immediatecbm/renderer.php @@ -26,7 +26,7 @@ defined('MOODLE_INTERNAL') || die(); -require_once(dirname(__FILE__) . '/../deferredcbm/renderer.php'); +require_once(__DIR__ . '/../deferredcbm/renderer.php'); /** diff --git a/question/behaviour/immediatecbm/tests/behaviourtype_test.php b/question/behaviour/immediatecbm/tests/behaviourtype_test.php index f292b06ec1d10..8c137599f9e8a 100644 --- a/question/behaviour/immediatecbm/tests/behaviourtype_test.php +++ b/question/behaviour/immediatecbm/tests/behaviourtype_test.php @@ -27,8 +27,8 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../../../engine/lib.php'); -require_once(dirname(__FILE__) . '/../../../engine/tests/helpers.php'); +require_once(__DIR__ . '/../../../engine/lib.php'); +require_once(__DIR__ . '/../../../engine/tests/helpers.php'); /** diff --git a/question/behaviour/immediatecbm/tests/walkthrough_test.php b/question/behaviour/immediatecbm/tests/walkthrough_test.php index 794cae01cc64b..71d8b717d5773 100644 --- a/question/behaviour/immediatecbm/tests/walkthrough_test.php +++ b/question/behaviour/immediatecbm/tests/walkthrough_test.php @@ -28,8 +28,8 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../../../engine/lib.php'); -require_once(dirname(__FILE__) . '/../../../engine/tests/helpers.php'); +require_once(__DIR__ . '/../../../engine/lib.php'); +require_once(__DIR__ . '/../../../engine/tests/helpers.php'); /** diff --git a/question/behaviour/immediatefeedback/tests/behaviourtype_test.php b/question/behaviour/immediatefeedback/tests/behaviourtype_test.php index f78ff93a6213f..2d9b5cafdeb5f 100644 --- a/question/behaviour/immediatefeedback/tests/behaviourtype_test.php +++ b/question/behaviour/immediatefeedback/tests/behaviourtype_test.php @@ -27,8 +27,8 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../../../engine/lib.php'); -require_once(dirname(__FILE__) . '/../../../engine/tests/helpers.php'); +require_once(__DIR__ . '/../../../engine/lib.php'); +require_once(__DIR__ . '/../../../engine/tests/helpers.php'); /** diff --git a/question/behaviour/immediatefeedback/tests/walkthrough_test.php b/question/behaviour/immediatefeedback/tests/walkthrough_test.php index 708052175d0fc..b95c20430b4fe 100644 --- a/question/behaviour/immediatefeedback/tests/walkthrough_test.php +++ b/question/behaviour/immediatefeedback/tests/walkthrough_test.php @@ -28,8 +28,8 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../../../engine/lib.php'); -require_once(dirname(__FILE__) . '/../../../engine/tests/helpers.php'); +require_once(__DIR__ . '/../../../engine/lib.php'); +require_once(__DIR__ . '/../../../engine/tests/helpers.php'); /** diff --git a/question/behaviour/informationitem/tests/behaviourtype_test.php b/question/behaviour/informationitem/tests/behaviourtype_test.php index 7bb644bcbc28f..e8f56cca71e44 100644 --- a/question/behaviour/informationitem/tests/behaviourtype_test.php +++ b/question/behaviour/informationitem/tests/behaviourtype_test.php @@ -27,8 +27,8 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../../../engine/lib.php'); -require_once(dirname(__FILE__) . '/../../../engine/tests/helpers.php'); +require_once(__DIR__ . '/../../../engine/lib.php'); +require_once(__DIR__ . '/../../../engine/tests/helpers.php'); /** diff --git a/question/behaviour/informationitem/tests/walkthrough_test.php b/question/behaviour/informationitem/tests/walkthrough_test.php index a98d62588324d..52382b17628a6 100644 --- a/question/behaviour/informationitem/tests/walkthrough_test.php +++ b/question/behaviour/informationitem/tests/walkthrough_test.php @@ -27,8 +27,8 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../../../engine/lib.php'); -require_once(dirname(__FILE__) . '/../../../engine/tests/helpers.php'); +require_once(__DIR__ . '/../../../engine/lib.php'); +require_once(__DIR__ . '/../../../engine/tests/helpers.php'); /** diff --git a/question/behaviour/interactive/tests/behaviourtype_test.php b/question/behaviour/interactive/tests/behaviourtype_test.php index ad1f672e698e4..36af6bb734c58 100644 --- a/question/behaviour/interactive/tests/behaviourtype_test.php +++ b/question/behaviour/interactive/tests/behaviourtype_test.php @@ -27,8 +27,8 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../../../engine/lib.php'); -require_once(dirname(__FILE__) . '/../../../engine/tests/helpers.php'); +require_once(__DIR__ . '/../../../engine/lib.php'); +require_once(__DIR__ . '/../../../engine/tests/helpers.php'); /** diff --git a/question/behaviour/interactive/tests/walkthrough_test.php b/question/behaviour/interactive/tests/walkthrough_test.php index 8485e6a0ac8bd..86e78d28997b5 100644 --- a/question/behaviour/interactive/tests/walkthrough_test.php +++ b/question/behaviour/interactive/tests/walkthrough_test.php @@ -28,8 +28,8 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../../../engine/lib.php'); -require_once(dirname(__FILE__) . '/../../../engine/tests/helpers.php'); +require_once(__DIR__ . '/../../../engine/lib.php'); +require_once(__DIR__ . '/../../../engine/tests/helpers.php'); /** diff --git a/question/behaviour/interactivecountback/behaviour.php b/question/behaviour/interactivecountback/behaviour.php index 20c650b618722..ccd91fd879b1b 100644 --- a/question/behaviour/interactivecountback/behaviour.php +++ b/question/behaviour/interactivecountback/behaviour.php @@ -27,7 +27,7 @@ defined('MOODLE_INTERNAL') || die(); -require_once(dirname(__FILE__) . '/../interactive/behaviour.php'); +require_once(__DIR__ . '/../interactive/behaviour.php'); /** diff --git a/question/behaviour/interactivecountback/behaviourtype.php b/question/behaviour/interactivecountback/behaviourtype.php index abbf0a1aba129..363fc2544d152 100644 --- a/question/behaviour/interactivecountback/behaviourtype.php +++ b/question/behaviour/interactivecountback/behaviourtype.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die(); -require_once(dirname(__FILE__) . '/../interactive/behaviourtype.php'); +require_once(__DIR__ . '/../interactive/behaviourtype.php'); /** diff --git a/question/behaviour/interactivecountback/renderer.php b/question/behaviour/interactivecountback/renderer.php index 55875384115df..c20b42592fdf1 100644 --- a/question/behaviour/interactivecountback/renderer.php +++ b/question/behaviour/interactivecountback/renderer.php @@ -26,7 +26,7 @@ defined('MOODLE_INTERNAL') || die(); -require_once(dirname(__FILE__) . '/../interactive/renderer.php'); +require_once(__DIR__ . '/../interactive/renderer.php'); /** diff --git a/question/behaviour/interactivecountback/tests/behaviourtype_test.php b/question/behaviour/interactivecountback/tests/behaviourtype_test.php index 992605b335e10..0ce525310a60d 100644 --- a/question/behaviour/interactivecountback/tests/behaviourtype_test.php +++ b/question/behaviour/interactivecountback/tests/behaviourtype_test.php @@ -27,8 +27,8 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../../../engine/lib.php'); -require_once(dirname(__FILE__) . '/../../../engine/tests/helpers.php'); +require_once(__DIR__ . '/../../../engine/lib.php'); +require_once(__DIR__ . '/../../../engine/tests/helpers.php'); /** diff --git a/question/behaviour/interactivecountback/tests/walkthrough_test.php b/question/behaviour/interactivecountback/tests/walkthrough_test.php index 0523aa7705a9f..7d550a2ce4918 100644 --- a/question/behaviour/interactivecountback/tests/walkthrough_test.php +++ b/question/behaviour/interactivecountback/tests/walkthrough_test.php @@ -28,8 +28,8 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../../../engine/lib.php'); -require_once(dirname(__FILE__) . '/../../../engine/tests/helpers.php'); +require_once(__DIR__ . '/../../../engine/lib.php'); +require_once(__DIR__ . '/../../../engine/tests/helpers.php'); /** diff --git a/question/behaviour/manualgraded/tests/behaviourtype_test.php b/question/behaviour/manualgraded/tests/behaviourtype_test.php index e5718dd3f9be5..b0a987b0f55ae 100644 --- a/question/behaviour/manualgraded/tests/behaviourtype_test.php +++ b/question/behaviour/manualgraded/tests/behaviourtype_test.php @@ -27,8 +27,8 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../../../engine/lib.php'); -require_once(dirname(__FILE__) . '/../../../engine/tests/helpers.php'); +require_once(__DIR__ . '/../../../engine/lib.php'); +require_once(__DIR__ . '/../../../engine/tests/helpers.php'); /** diff --git a/question/behaviour/manualgraded/tests/walkthrough_test.php b/question/behaviour/manualgraded/tests/walkthrough_test.php index d7abd66ec95a7..4494d3f5a4708 100644 --- a/question/behaviour/manualgraded/tests/walkthrough_test.php +++ b/question/behaviour/manualgraded/tests/walkthrough_test.php @@ -28,8 +28,8 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../../../engine/lib.php'); -require_once(dirname(__FILE__) . '/../../../engine/tests/helpers.php'); +require_once(__DIR__ . '/../../../engine/lib.php'); +require_once(__DIR__ . '/../../../engine/tests/helpers.php'); /** diff --git a/question/behaviour/missing/tests/behaviourtype_test.php b/question/behaviour/missing/tests/behaviourtype_test.php index ad1482ea162e1..3fd521452073f 100644 --- a/question/behaviour/missing/tests/behaviourtype_test.php +++ b/question/behaviour/missing/tests/behaviourtype_test.php @@ -27,8 +27,8 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../../../engine/lib.php'); -require_once(dirname(__FILE__) . '/../../../engine/tests/helpers.php'); +require_once(__DIR__ . '/../../../engine/lib.php'); +require_once(__DIR__ . '/../../../engine/tests/helpers.php'); /** diff --git a/question/behaviour/missing/tests/missingbehaviour_test.php b/question/behaviour/missing/tests/missingbehaviour_test.php index 7c02042850b1e..31328b9434609 100644 --- a/question/behaviour/missing/tests/missingbehaviour_test.php +++ b/question/behaviour/missing/tests/missingbehaviour_test.php @@ -27,9 +27,9 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../../../engine/lib.php'); -require_once(dirname(__FILE__) . '/../../../engine/tests/helpers.php'); -require_once(dirname(__FILE__) . '/../behaviour.php'); +require_once(__DIR__ . '/../../../engine/lib.php'); +require_once(__DIR__ . '/../../../engine/tests/helpers.php'); +require_once(__DIR__ . '/../behaviour.php'); /** diff --git a/question/edit.php b/question/edit.php index b8cdb7fcd95ca..86ad9b5fd19bc 100644 --- a/question/edit.php +++ b/question/edit.php @@ -24,7 +24,7 @@ */ -require_once(dirname(__FILE__) . '/../config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->dirroot . '/question/editlib.php'); list($thispageurl, $contexts, $cmid, $cm, $module, $pagevars) = diff --git a/question/engine/bank.php b/question/engine/bank.php index 99e2de529f5be..b5fb62c9412cf 100644 --- a/question/engine/bank.php +++ b/question/engine/bank.php @@ -30,7 +30,7 @@ defined('MOODLE_INTERNAL') || die(); -require_once(dirname(__FILE__) . '/../type/questiontypebase.php'); +require_once(__DIR__ . '/../type/questiontypebase.php'); /** diff --git a/question/engine/lib.php b/question/engine/lib.php index 2d5fa317bd705..b6092596b30e4 100644 --- a/question/engine/lib.php +++ b/question/engine/lib.php @@ -27,19 +27,19 @@ defined('MOODLE_INTERNAL') || die(); require_once($CFG->libdir . '/filelib.php'); -require_once(dirname(__FILE__) . '/questionusage.php'); -require_once(dirname(__FILE__) . '/questionattempt.php'); -require_once(dirname(__FILE__) . '/questionattemptstep.php'); -require_once(dirname(__FILE__) . '/states.php'); -require_once(dirname(__FILE__) . '/datalib.php'); -require_once(dirname(__FILE__) . '/renderer.php'); -require_once(dirname(__FILE__) . '/bank.php'); -require_once(dirname(__FILE__) . '/../type/questiontypebase.php'); -require_once(dirname(__FILE__) . '/../type/questionbase.php'); -require_once(dirname(__FILE__) . '/../type/rendererbase.php'); -require_once(dirname(__FILE__) . '/../behaviour/behaviourtypebase.php'); -require_once(dirname(__FILE__) . '/../behaviour/behaviourbase.php'); -require_once(dirname(__FILE__) . '/../behaviour/rendererbase.php'); +require_once(__DIR__ . '/questionusage.php'); +require_once(__DIR__ . '/questionattempt.php'); +require_once(__DIR__ . '/questionattemptstep.php'); +require_once(__DIR__ . '/states.php'); +require_once(__DIR__ . '/datalib.php'); +require_once(__DIR__ . '/renderer.php'); +require_once(__DIR__ . '/bank.php'); +require_once(__DIR__ . '/../type/questiontypebase.php'); +require_once(__DIR__ . '/../type/questionbase.php'); +require_once(__DIR__ . '/../type/rendererbase.php'); +require_once(__DIR__ . '/../behaviour/behaviourtypebase.php'); +require_once(__DIR__ . '/../behaviour/behaviourbase.php'); +require_once(__DIR__ . '/../behaviour/rendererbase.php'); require_once($CFG->libdir . '/questionlib.php'); diff --git a/question/engine/tests/datalib_reporting_queries_test.php b/question/engine/tests/datalib_reporting_queries_test.php index 5288fdba5fe81..8bbe0c81340ac 100644 --- a/question/engine/tests/datalib_reporting_queries_test.php +++ b/question/engine/tests/datalib_reporting_queries_test.php @@ -27,8 +27,8 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../lib.php'); -require_once(dirname(__FILE__) . '/helpers.php'); +require_once(__DIR__ . '/../lib.php'); +require_once(__DIR__ . '/helpers.php'); /** diff --git a/question/engine/tests/datalib_test.php b/question/engine/tests/datalib_test.php index 0e0cbf08b7139..af8b9d613a58d 100644 --- a/question/engine/tests/datalib_test.php +++ b/question/engine/tests/datalib_test.php @@ -27,8 +27,8 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../lib.php'); -require_once(dirname(__FILE__) . '/helpers.php'); +require_once(__DIR__ . '/../lib.php'); +require_once(__DIR__ . '/helpers.php'); /** diff --git a/question/engine/tests/qubaid_condition_test.php b/question/engine/tests/qubaid_condition_test.php index 123f38700f914..816b8e112cb4e 100644 --- a/question/engine/tests/qubaid_condition_test.php +++ b/question/engine/tests/qubaid_condition_test.php @@ -27,7 +27,7 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../lib.php'); +require_once(__DIR__ . '/../lib.php'); /** diff --git a/question/engine/tests/questionattempt_db_test.php b/question/engine/tests/questionattempt_db_test.php index bef878838b599..9ebdf6b7a4a19 100644 --- a/question/engine/tests/questionattempt_db_test.php +++ b/question/engine/tests/questionattempt_db_test.php @@ -30,8 +30,8 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../lib.php'); -require_once(dirname(__FILE__) . '/helpers.php'); +require_once(__DIR__ . '/../lib.php'); +require_once(__DIR__ . '/helpers.php'); /** diff --git a/question/engine/tests/questionattempt_test.php b/question/engine/tests/questionattempt_test.php index 3469ec6f067b7..51ed547457677 100644 --- a/question/engine/tests/questionattempt_test.php +++ b/question/engine/tests/questionattempt_test.php @@ -30,8 +30,8 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../lib.php'); -require_once(dirname(__FILE__) . '/helpers.php'); +require_once(__DIR__ . '/../lib.php'); +require_once(__DIR__ . '/helpers.php'); /** diff --git a/question/engine/tests/questionattempt_with_steps_test.php b/question/engine/tests/questionattempt_with_steps_test.php index a5cddbd9313f2..05f745c8b8741 100644 --- a/question/engine/tests/questionattempt_with_steps_test.php +++ b/question/engine/tests/questionattempt_with_steps_test.php @@ -30,8 +30,8 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../lib.php'); -require_once(dirname(__FILE__) . '/helpers.php'); +require_once(__DIR__ . '/../lib.php'); +require_once(__DIR__ . '/helpers.php'); /** diff --git a/question/engine/tests/questionattemptiterator_test.php b/question/engine/tests/questionattemptiterator_test.php index ddc648182efbf..71ed67c382058 100644 --- a/question/engine/tests/questionattemptiterator_test.php +++ b/question/engine/tests/questionattemptiterator_test.php @@ -27,8 +27,8 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../lib.php'); -require_once(dirname(__FILE__) . '/helpers.php'); +require_once(__DIR__ . '/../lib.php'); +require_once(__DIR__ . '/helpers.php'); /** diff --git a/question/engine/tests/questionattemptstep_db_test.php b/question/engine/tests/questionattemptstep_db_test.php index a9b1581151e6c..6be658941278a 100644 --- a/question/engine/tests/questionattemptstep_db_test.php +++ b/question/engine/tests/questionattemptstep_db_test.php @@ -27,8 +27,8 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../lib.php'); -require_once(dirname(__FILE__) . '/helpers.php'); +require_once(__DIR__ . '/../lib.php'); +require_once(__DIR__ . '/helpers.php'); /** diff --git a/question/engine/tests/questionattemptstep_test.php b/question/engine/tests/questionattemptstep_test.php index 8878f8fd0f860..4c6955dd0b55a 100644 --- a/question/engine/tests/questionattemptstep_test.php +++ b/question/engine/tests/questionattemptstep_test.php @@ -27,8 +27,8 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../lib.php'); -require_once(dirname(__FILE__) . '/helpers.php'); +require_once(__DIR__ . '/../lib.php'); +require_once(__DIR__ . '/helpers.php'); /** diff --git a/question/engine/tests/questionattemptstepiterator_test.php b/question/engine/tests/questionattemptstepiterator_test.php index a0101cfcc2e77..c3715af85f46c 100644 --- a/question/engine/tests/questionattemptstepiterator_test.php +++ b/question/engine/tests/questionattemptstepiterator_test.php @@ -27,8 +27,8 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../lib.php'); -require_once(dirname(__FILE__) . '/helpers.php'); +require_once(__DIR__ . '/../lib.php'); +require_once(__DIR__ . '/helpers.php'); /** diff --git a/question/engine/tests/questionbank_test.php b/question/engine/tests/questionbank_test.php index d7f78c12f5dfe..873507909bf7b 100644 --- a/question/engine/tests/questionbank_test.php +++ b/question/engine/tests/questionbank_test.php @@ -27,7 +27,7 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../lib.php'); +require_once(__DIR__ . '/../lib.php'); /** diff --git a/question/engine/tests/questionengine_test.php b/question/engine/tests/questionengine_test.php index ffbe544e1a4e2..a4f7f2692ad8b 100644 --- a/question/engine/tests/questionengine_test.php +++ b/question/engine/tests/questionengine_test.php @@ -27,7 +27,7 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../lib.php'); +require_once(__DIR__ . '/../lib.php'); /** diff --git a/question/engine/tests/questionstate_test.php b/question/engine/tests/questionstate_test.php index b1077fc59087f..1fc8123158718 100644 --- a/question/engine/tests/questionstate_test.php +++ b/question/engine/tests/questionstate_test.php @@ -27,7 +27,7 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../lib.php'); +require_once(__DIR__ . '/../lib.php'); require_once($CFG->libdir . '/questionlib.php'); diff --git a/question/engine/tests/questionusage_autosave_test.php b/question/engine/tests/questionusage_autosave_test.php index e846bc5ff999b..cb7d7c294deb7 100644 --- a/question/engine/tests/questionusage_autosave_test.php +++ b/question/engine/tests/questionusage_autosave_test.php @@ -27,8 +27,8 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../lib.php'); -require_once(dirname(__FILE__) . '/helpers.php'); +require_once(__DIR__ . '/../lib.php'); +require_once(__DIR__ . '/helpers.php'); /** diff --git a/question/engine/tests/questionusagebyactivity_data_test.php b/question/engine/tests/questionusagebyactivity_data_test.php index 27fcfdf029e52..c4c2011525f8f 100644 --- a/question/engine/tests/questionusagebyactivity_data_test.php +++ b/question/engine/tests/questionusagebyactivity_data_test.php @@ -26,8 +26,8 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../lib.php'); -require_once(dirname(__FILE__) . '/helpers.php'); +require_once(__DIR__ . '/../lib.php'); +require_once(__DIR__ . '/helpers.php'); /** diff --git a/question/engine/tests/questionusagebyactivity_test.php b/question/engine/tests/questionusagebyactivity_test.php index c0b38a24f098b..7f82f3d011888 100644 --- a/question/engine/tests/questionusagebyactivity_test.php +++ b/question/engine/tests/questionusagebyactivity_test.php @@ -26,8 +26,8 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../lib.php'); -require_once(dirname(__FILE__) . '/helpers.php'); +require_once(__DIR__ . '/../lib.php'); +require_once(__DIR__ . '/helpers.php'); /** diff --git a/question/engine/tests/questionutils_test.php b/question/engine/tests/questionutils_test.php index ab4559c7e7e62..84c5673c8f9a8 100644 --- a/question/engine/tests/questionutils_test.php +++ b/question/engine/tests/questionutils_test.php @@ -27,7 +27,7 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../lib.php'); +require_once(__DIR__ . '/../lib.php'); /** diff --git a/question/engine/tests/unitofwork_test.php b/question/engine/tests/unitofwork_test.php index 873b8570c3f10..5e795052cf7e8 100644 --- a/question/engine/tests/unitofwork_test.php +++ b/question/engine/tests/unitofwork_test.php @@ -27,8 +27,8 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../lib.php'); -require_once(dirname(__FILE__) . '/helpers.php'); +require_once(__DIR__ . '/../lib.php'); +require_once(__DIR__ . '/helpers.php'); /** diff --git a/question/engine/upgrade/tests/helper.php b/question/engine/upgrade/tests/helper.php index 82102114dcc8f..02c2a449124a6 100644 --- a/question/engine/upgrade/tests/helper.php +++ b/question/engine/upgrade/tests/helper.php @@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../upgradelib.php'); +require_once(__DIR__ . '/../upgradelib.php'); /** diff --git a/question/export.php b/question/export.php index 44350bd526a6a..b52a9db665ee7 100644 --- a/question/export.php +++ b/question/export.php @@ -24,7 +24,7 @@ */ -require_once(dirname(__FILE__) . '/../config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->dirroot . '/question/editlib.php'); require_once($CFG->dirroot . '/question/export_form.php'); require_once($CFG->dirroot . '/question/format.php'); diff --git a/question/import.php b/question/import.php index 9904eca0914aa..e75932ee8ee5b 100644 --- a/question/import.php +++ b/question/import.php @@ -24,7 +24,7 @@ */ -require_once(dirname(__FILE__) . '/../config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->dirroot . '/question/editlib.php'); require_once($CFG->dirroot . '/question/import_form.php'); require_once($CFG->dirroot . '/question/format.php'); diff --git a/question/preview.php b/question/preview.php index a67aeb0ccb981..8c7947fc26c2c 100644 --- a/question/preview.php +++ b/question/preview.php @@ -30,9 +30,9 @@ */ -require_once(dirname(__FILE__) . '/../config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->libdir . '/questionlib.php'); -require_once(dirname(__FILE__) . '/previewlib.php'); +require_once(__DIR__ . '/previewlib.php'); /** * The maximum number of variants previewable. If there are more variants than this for a question diff --git a/question/question.php b/question/question.php index c47be70219862..984bc6cc58a63 100644 --- a/question/question.php +++ b/question/question.php @@ -24,8 +24,8 @@ */ -require_once(dirname(__FILE__) . '/../config.php'); -require_once(dirname(__FILE__) . '/editlib.php'); +require_once(__DIR__ . '/../config.php'); +require_once(__DIR__ . '/editlib.php'); require_once($CFG->libdir . '/filelib.php'); require_once($CFG->libdir . '/formslib.php'); diff --git a/question/type/missingtype/tests/missingtype_test.php b/question/type/missingtype/tests/missingtype_test.php index 97f81bb9bf052..541436d6994c7 100644 --- a/question/type/missingtype/tests/missingtype_test.php +++ b/question/type/missingtype/tests/missingtype_test.php @@ -27,9 +27,9 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -require_once(dirname(__FILE__) . '/../../../engine/tests/helpers.php'); -require_once(dirname(__FILE__) . '/../../../behaviour/deferredfeedback/behaviour.php'); -require_once(dirname(__FILE__) . '/../question.php'); +require_once(__DIR__ . '/../../../engine/tests/helpers.php'); +require_once(__DIR__ . '/../../../behaviour/deferredfeedback/behaviour.php'); +require_once(__DIR__ . '/../question.php'); /** diff --git a/report/completion/index.php b/report/completion/index.php index 5cd4f9e83b4cb..b9f34a4a6cf10 100644 --- a/report/completion/index.php +++ b/report/completion/index.php @@ -24,7 +24,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__).'/../../config.php'); +require_once(__DIR__.'/../../config.php'); require_once("{$CFG->libdir}/completionlib.php"); /** diff --git a/report/configlog/index.php b/report/configlog/index.php index 1358c0c5a5651..3d30e253a7f82 100644 --- a/report/configlog/index.php +++ b/report/configlog/index.php @@ -23,7 +23,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require(dirname(__FILE__).'/../../config.php'); +require(__DIR__.'/../../config.php'); require_once($CFG->libdir.'/adminlib.php'); // page parameters diff --git a/report/log/locallib.php b/report/log/locallib.php index 2300483efc956..19a9755bff781 100644 --- a/report/log/locallib.php +++ b/report/log/locallib.php @@ -30,7 +30,7 @@ define('REPORT_LOG_MAX_DISPLAY', 150); // days } -require_once(dirname(__FILE__).'/lib.php'); +require_once(__DIR__.'/lib.php'); /** * This function is used to generate and display the log activity graph diff --git a/report/outline/locallib.php b/report/outline/locallib.php index 9f3dc0759ade6..a69351d11b524 100644 --- a/report/outline/locallib.php +++ b/report/outline/locallib.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die; -require_once(dirname(__FILE__).'/lib.php'); +require_once(__DIR__.'/lib.php'); require_once($CFG->dirroot.'/course/lib.php'); function report_outline_print_row($mod, $instance, $result) { diff --git a/report/questioninstances/index.php b/report/questioninstances/index.php index dbcea346b413e..91c14e112df4d 100644 --- a/report/questioninstances/index.php +++ b/report/questioninstances/index.php @@ -23,7 +23,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require(dirname(__FILE__).'/../../config.php'); +require(__DIR__.'/../../config.php'); require_once($CFG->libdir.'/adminlib.php'); require_once($CFG->libdir.'/questionlib.php'); diff --git a/report/stats/locallib.php b/report/stats/locallib.php index e2de2e261d18e..61fef2818db5b 100644 --- a/report/stats/locallib.php +++ b/report/stats/locallib.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die; -require_once(dirname(__FILE__).'/lib.php'); +require_once(__DIR__.'/lib.php'); require_once($CFG->dirroot.'/lib/statslib.php'); function report_stats_mode_menu($course, $mode, $time, $url) { diff --git a/repository/dropbox/lib.php b/repository/dropbox/lib.php index 46611afa177d4..b432e96d2336a 100644 --- a/repository/dropbox/lib.php +++ b/repository/dropbox/lib.php @@ -24,7 +24,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once($CFG->dirroot . '/repository/lib.php'); -require_once(dirname(__FILE__).'/locallib.php'); +require_once(__DIR__.'/locallib.php'); /** * Repository to access Dropbox files diff --git a/repository/dropbox/thumbnail.php b/repository/dropbox/thumbnail.php index 6a4887e7b80e9..2cd30b1fc94e9 100644 --- a/repository/dropbox/thumbnail.php +++ b/repository/dropbox/thumbnail.php @@ -25,8 +25,8 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); -require_once(dirname(__FILE__).'/lib.php'); +require(__DIR__.'/../../config.php'); +require_once(__DIR__.'/lib.php'); $repo_id = optional_param('repo_id', 0, PARAM_INT); // Repository ID $contextid = optional_param('ctx_id', SYSCONTEXTID, PARAM_INT); // Context ID diff --git a/repository/equella/callback.php b/repository/equella/callback.php index dcc4838342a3d..0772a859b505a 100644 --- a/repository/equella/callback.php +++ b/repository/equella/callback.php @@ -22,7 +22,7 @@ * @copyright 2012 Dongsheng Cai {@link http://dongsheng.org} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); +require(__DIR__.'/../../config.php'); $json = required_param('tlelinks', PARAM_RAW); require_login(); diff --git a/repository/flickr_public/lib.php b/repository/flickr_public/lib.php index bde541e13876e..37be696bf59b0 100644 --- a/repository/flickr_public/lib.php +++ b/repository/flickr_public/lib.php @@ -24,7 +24,7 @@ */ require_once($CFG->dirroot . '/repository/lib.php'); require_once($CFG->libdir.'/flickrlib.php'); -require_once(dirname(__FILE__) . '/image.php'); +require_once(__DIR__ . '/image.php'); /** * repository_flickr_public class diff --git a/repository/manage_instances.php b/repository/manage_instances.php index 07e3c349ac6de..bd1f62bb91655 100644 --- a/repository/manage_instances.php +++ b/repository/manage_instances.php @@ -26,7 +26,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(__FILE__)) . '/config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->dirroot . '/repository/lib.php'); $edit = optional_param('edit', 0, PARAM_INT); diff --git a/repository/repository_ajax.php b/repository/repository_ajax.php index 1fe3b8994d796..a8c5e825467b1 100644 --- a/repository/repository_ajax.php +++ b/repository/repository_ajax.php @@ -26,9 +26,9 @@ define('AJAX_SCRIPT', true); -require_once(dirname(dirname(__FILE__)).'/config.php'); -require_once(dirname(dirname(__FILE__)).'/lib/filelib.php'); -require_once(dirname(__FILE__).'/lib.php'); +require_once(__DIR__ . '/../config.php'); +require_once(__DIR__ . '/../lib/filelib.php'); +require_once(__DIR__.'/lib.php'); $err = new stdClass(); diff --git a/repository/repository_callback.php b/repository/repository_callback.php index b657d29373e78..83fb5e38e57c0 100644 --- a/repository/repository_callback.php +++ b/repository/repository_callback.php @@ -26,9 +26,9 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(dirname(__FILE__)).'/config.php'); -require_once(dirname(dirname(__FILE__)).'/lib/filelib.php'); -require_once(dirname(__FILE__).'/lib.php'); +require_once(__DIR__ . '/../config.php'); +require_once(__DIR__ . '/../lib/filelib.php'); +require_once(__DIR__.'/lib.php'); require_login(); diff --git a/repository/url/lib.php b/repository/url/lib.php index 3de7982e7a418..b3664a193b0ab 100644 --- a/repository/url/lib.php +++ b/repository/url/lib.php @@ -24,7 +24,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once($CFG->dirroot . '/repository/lib.php'); -require_once(dirname(__FILE__).'/locallib.php'); +require_once(__DIR__.'/locallib.php'); /** * repository_url class diff --git a/repository/wikimedia/lib.php b/repository/wikimedia/lib.php index 3fcd05540c4be..9d155975bde73 100644 --- a/repository/wikimedia/lib.php +++ b/repository/wikimedia/lib.php @@ -24,7 +24,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once($CFG->dirroot . '/repository/lib.php'); -require_once(dirname(__FILE__) . '/wikimedia.php'); +require_once(__DIR__ . '/wikimedia.php'); /** * repository_wikimedia class diff --git a/theme/index.php b/theme/index.php index 788e3e8998cd9..96feb41d95d7f 100644 --- a/theme/index.php +++ b/theme/index.php @@ -21,7 +21,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->libdir . '/adminlib.php'); $choose = optional_param('choose', '', PARAM_PLUGIN); diff --git a/user/portfolio.php b/user/portfolio.php index 10206fe9ee7ce..ed64277de18de 100644 --- a/user/portfolio.php +++ b/user/portfolio.php @@ -22,7 +22,7 @@ * @package core_user */ -require_once(dirname(dirname(__FILE__)) . '/config.php'); +require_once(__DIR__ . '/../config.php'); if (empty($CFG->enableportfolios)) { print_error('disabled', 'portfolio'); diff --git a/user/portfoliologs.php b/user/portfoliologs.php index 422d57c912b47..7251b7d9f2752 100644 --- a/user/portfoliologs.php +++ b/user/portfoliologs.php @@ -22,7 +22,7 @@ * @package core_user */ -require_once(dirname(dirname(__FILE__)) . '/config.php'); +require_once(__DIR__ . '/../config.php'); if (empty($CFG->enableportfolios)) { print_error('disabled', 'portfolio'); diff --git a/user/profile.php b/user/profile.php index b14f81bffe920..22acc92ca4d5f 100644 --- a/user/profile.php +++ b/user/profile.php @@ -32,7 +32,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->dirroot . '/my/lib.php'); require_once($CFG->dirroot . '/user/profile/lib.php'); require_once($CFG->dirroot . '/user/lib.php'); diff --git a/user/profilesys.php b/user/profilesys.php index 302f5cdd16d17..a6a00724daba6 100644 --- a/user/profilesys.php +++ b/user/profilesys.php @@ -27,7 +27,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -require_once(dirname(__FILE__) . '/../config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->dirroot . '/my/lib.php'); require_once($CFG->libdir.'/adminlib.php'); diff --git a/user/repository.php b/user/repository.php index dcabb9246b9f0..1f69deed8f916 100644 --- a/user/repository.php +++ b/user/repository.php @@ -22,7 +22,7 @@ * @package core_user */ -require_once(dirname(dirname(__FILE__)) . '/config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->dirroot . '/repository/lib.php'); $config = optional_param('config', 0, PARAM_INT); diff --git a/user/selector/search.php b/user/selector/search.php index 9125d0b6ea149..a9cedce85149d 100644 --- a/user/selector/search.php +++ b/user/selector/search.php @@ -24,7 +24,7 @@ define('AJAX_SCRIPT', true); -require_once(dirname(__FILE__) . '/../../config.php'); +require_once(__DIR__ . '/../../config.php'); require_once($CFG->dirroot . '/user/selector/lib.php'); $PAGE->set_context(context_system::instance()); diff --git a/webservice/pluginfile.php b/webservice/pluginfile.php index 2d3cdadbb3921..ba95f722012f3 100644 --- a/webservice/pluginfile.php +++ b/webservice/pluginfile.php @@ -34,7 +34,7 @@ define('NO_MOODLE_COOKIES', true); -require_once(dirname(dirname(__FILE__)) . '/config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->libdir . '/filelib.php'); require_once($CFG->dirroot . '/webservice/lib.php'); diff --git a/webservice/upload.php b/webservice/upload.php index 7df73d92f9207..e4fb7b5fa7a01 100644 --- a/webservice/upload.php +++ b/webservice/upload.php @@ -44,7 +44,7 @@ */ define('NO_MOODLE_COOKIES', true); -require_once(dirname(dirname(__FILE__)) . '/config.php'); +require_once(__DIR__ . '/../config.php'); require_once($CFG->dirroot . '/webservice/lib.php'); $filepath = optional_param('filepath', '/', PARAM_PATH); // The default file area is 'private' for user private files. This