���ѧۧݧ�ӧ�� �ާ֧ߧ֧էا֧� - ���֧էѧܧ�ڧ��ӧѧ�� - /home3/cpr76684/public_html/index.php.tar
���ѧ٧ѧ�
home3/cpr76684/public_html/Aem/grade/index.php 0000644 00000002060 15151174162 0014671 0 ustar 00 <?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * This page is provided for compatability and redirects the user to the default grade report * * @package core_grades * @copyright 2005 onwards Martin Dougiamas {@link http://moodle.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once '../config.php'; $id = required_param('id', PARAM_INT); redirect('report/index.php?id='.$id); home3/cpr76684/public_html/Aem/admin/index.php 0000644 00000116536 15151206720 0014711 0 ustar 00 <?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Main administration script. * * @package core * @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ // Check that config.php exists, if not then call the install script if (!file_exists('../config.php')) { header('Location: ../install.php'); die(); } // Check that PHP is of a sufficient version as soon as possible. require_once(__DIR__.'/../lib/phpminimumversionlib.php'); moodle_require_minimum_php_version(); // make sure iconv is available and actually works if (!function_exists('iconv')) { // this should not happen, this must be very borked install echo 'Moodle requires the iconv PHP extension. Please install or enable the iconv extension.'; die(); } // Make sure php5-json is available. if (!function_exists('json_encode') || !function_exists('json_decode')) { // This also shouldn't happen. echo 'Moodle requires the json PHP extension. Please install or enable the json extension.'; die(); } // Make sure xml extension is available. if (!extension_loaded('xml')) { echo 'Moodle requires the xml PHP extension. Please install or enable the xml extension.'; die(); } // Make sure mbstring extension is available. if (!extension_loaded('mbstring')) { echo 'Moodle requires the mbstring PHP extension. Please install or enable the mbstring extension.'; die(); } define('NO_OUTPUT_BUFFERING', true); if (isset($_POST['upgradekey'])) { // Before you start reporting issues about the collision attacks against // SHA-1, you should understand that we are not actually attempting to do // any cryptography here. This is hashed purely so that the key is not // that apparent in the address bar itself. Anyone who catches the HTTP // traffic can immediately use it as a valid admin key. header('Location: index.php?cache=0&upgradekeyhash='.sha1($_POST['upgradekey'])); die(); } if ((isset($_GET['cache']) and $_GET['cache'] === '0') or (isset($_POST['cache']) and $_POST['cache'] === '0') or (!isset($_POST['cache']) and !isset($_GET['cache']) and empty($_GET['sesskey']) and empty($_POST['sesskey']))) { // Prevent caching at all cost when visiting this page directly, // we redirect to self once we known no upgrades are necessary. // Note: $_GET and $_POST are used here intentionally because our param cleaning is not loaded yet. // Note2: the sesskey is present in all block editing hacks, we can not redirect there, so enable caching. define('CACHE_DISABLE_ALL', true); // Force OPcache reset if used, we do not want any stale caches // when detecting if upgrade necessary or when running upgrade. if (function_exists('opcache_reset')) { opcache_reset(); } $cache = 0; } else { $cache = 1; } require('../config.php'); // Invalidate the cache of version.php in any circumstances to help core_component // detecting if the version has changed and component cache should be reset. if (function_exists('opcache_invalidate')) { opcache_invalidate($CFG->dirroot . '/version.php', true); } // Make sure the component cache gets rebuilt if necessary, any method that // indirectly calls the protected init() method is good here. core_component::get_core_subsystems(); if (is_major_upgrade_required() && isloggedin()) { // A major upgrade is required. // Terminate the session and redirect back here before anything DB-related happens. redirect_if_major_upgrade_required(); } require_once($CFG->libdir.'/adminlib.php'); // various admin-only functions require_once($CFG->libdir.'/upgradelib.php'); // general upgrade/install related functions $confirmupgrade = optional_param('confirmupgrade', 0, PARAM_BOOL); // Core upgrade confirmed? $confirmrelease = optional_param('confirmrelease', 0, PARAM_BOOL); // Core release info and server checks confirmed? $confirmplugins = optional_param('confirmplugincheck', 0, PARAM_BOOL); // Plugins check page confirmed? $showallplugins = optional_param('showallplugins', 0, PARAM_BOOL); // Show all plugins on the plugins check page? $agreelicense = optional_param('agreelicense', 0, PARAM_BOOL); // GPL license confirmed for installation? $fetchupdates = optional_param('fetchupdates', 0, PARAM_BOOL); // Should check for available updates? $newaddonreq = optional_param('installaddonrequest', null, PARAM_RAW); // Plugin installation requested at moodle.org/plugins. $upgradekeyhash = optional_param('upgradekeyhash', null, PARAM_ALPHANUM); // Hash of provided upgrade key. $installdep = optional_param('installdep', null, PARAM_COMPONENT); // Install given missing dependency (required plugin). $installdepx = optional_param('installdepx', false, PARAM_BOOL); // Install all missing dependencies. $confirminstalldep = optional_param('confirminstalldep', false, PARAM_BOOL); // Installing dependencies confirmed. $abortinstall = optional_param('abortinstall', null, PARAM_COMPONENT); // Cancel installation of the given new plugin. $abortinstallx = optional_param('abortinstallx', null, PARAM_BOOL); // Cancel installation of all new plugins. $confirmabortinstall = optional_param('confirmabortinstall', false, PARAM_BOOL); // Installation cancel confirmed. $abortupgrade = optional_param('abortupgrade', null, PARAM_COMPONENT); // Cancel upgrade of the given existing plugin. $abortupgradex = optional_param('abortupgradex', null, PARAM_BOOL); // Cancel upgrade of all upgradable plugins. $confirmabortupgrade = optional_param('confirmabortupgrade', false, PARAM_BOOL); // Upgrade cancel confirmed. $installupdate = optional_param('installupdate', null, PARAM_COMPONENT); // Install given available update. $installupdateversion = optional_param('installupdateversion', null, PARAM_INT); // Version of the available update to install. $installupdatex = optional_param('installupdatex', false, PARAM_BOOL); // Install all available plugin updates. $confirminstallupdate = optional_param('confirminstallupdate', false, PARAM_BOOL); // Available update(s) install confirmed? if (!empty($CFG->disableupdateautodeploy)) { // Invalidate all requests to install plugins via the admin UI. $newaddonreq = null; $installdep = null; $installdepx = false; $abortupgrade = null; $abortupgradex = null; $installupdate = null; $installupdateversion = null; $installupdatex = false; } // Set up PAGE. $url = new moodle_url('/admin/index.php'); $url->param('cache', $cache); if (isset($upgradekeyhash)) { $url->param('upgradekeyhash', $upgradekeyhash); } $PAGE->set_url($url); unset($url); // Are we returning from an add-on installation request at moodle.org/plugins? if ($newaddonreq and !$cache and empty($CFG->disableupdateautodeploy)) { $target = new moodle_url('/admin/tool/installaddon/index.php', array( 'installaddonrequest' => $newaddonreq, 'confirm' => 0)); if (!isloggedin() or isguestuser()) { // Login and go the the add-on tool page. $SESSION->wantsurl = $target->out(); redirect(get_login_url()); } redirect($target); } $PAGE->set_pagelayout('admin'); // Set a default pagelayout $documentationlink = '<a href="http://docs.moodle.org/en/Installation">Installation docs</a>'; // Check some PHP server settings if (ini_get_bool('session.auto_start')) { throw new \moodle_exception('phpvaroff', 'debug', '', (object)array('name' => 'session.auto_start', 'link' => $documentationlink)); } if (!ini_get_bool('file_uploads')) { throw new \moodle_exception('phpvaron', 'debug', '', (object)array('name' => 'file_uploads', 'link' => $documentationlink)); } if (is_float_problem()) { throw new \moodle_exception('phpfloatproblem', 'admin', '', $documentationlink); } // Set some necessary variables during set-up to avoid PHP warnings later on this page if (!isset($CFG->release)) { $CFG->release = ''; } if (!isset($CFG->version)) { $CFG->version = ''; } if (!isset($CFG->branch)) { $CFG->branch = ''; } $version = null; $release = null; $branch = null; require("$CFG->dirroot/version.php"); // defines $version, $release, $branch and $maturity $CFG->target_release = $release; // used during installation and upgrades if (!$version or !$release) { throw new \moodle_exception('withoutversion', 'debug'); // Without version, stop. } if (!core_tables_exist()) { $PAGE->set_pagelayout('maintenance'); $PAGE->set_popup_notification_allowed(false); // fake some settings $CFG->docroot = 'http://docs.moodle.org'; $strinstallation = get_string('installation', 'install'); // remove current session content completely \core\session\manager::terminate_current(); if (empty($agreelicense)) { $strlicense = get_string('license'); $PAGE->navbar->add($strlicense); $PAGE->set_title($strinstallation.' - Moodle '.$CFG->target_release); $PAGE->set_heading($strinstallation); $PAGE->set_cacheable(false); $output = $PAGE->get_renderer('core', 'admin'); echo $output->install_licence_page(); die(); } if (empty($confirmrelease)) { require_once($CFG->libdir.'/environmentlib.php'); list($envstatus, $environmentresults) = check_moodle_environment(normalize_version($release), ENV_SELECT_RELEASE); $strcurrentrelease = get_string('currentrelease'); $PAGE->navbar->add($strcurrentrelease); $PAGE->set_title($strinstallation); $PAGE->set_heading($strinstallation . ' - Moodle ' . $CFG->target_release); $PAGE->set_cacheable(false); $output = $PAGE->get_renderer('core', 'admin'); echo $output->install_environment_page($maturity, $envstatus, $environmentresults, $release); die(); } // check plugin dependencies $failed = array(); if (!core_plugin_manager::instance()->all_plugins_ok($version, $failed, $CFG->branch)) { $PAGE->navbar->add(get_string('pluginscheck', 'admin')); $PAGE->set_title($strinstallation); $PAGE->set_heading($strinstallation . ' - Moodle ' . $CFG->target_release); $output = $PAGE->get_renderer('core', 'admin'); $url = new moodle_url($PAGE->url, array('agreelicense' => 1, 'confirmrelease' => 1, 'lang' => $CFG->lang)); echo $output->unsatisfied_dependencies_page($version, $failed, $url); die(); } unset($failed); //TODO: add a page with list of non-standard plugins here $strdatabasesetup = get_string('databasesetup'); upgrade_init_javascript(); $PAGE->navbar->add($strdatabasesetup); $PAGE->set_title($strinstallation.' - Moodle '.$CFG->target_release); $PAGE->set_heading($strinstallation); $PAGE->set_cacheable(false); $output = $PAGE->get_renderer('core', 'admin'); echo $output->header(); if (!$DB->setup_is_unicodedb()) { if (!$DB->change_db_encoding()) { // If could not convert successfully, throw error, and prevent installation throw new \moodle_exception('unicoderequired', 'admin'); } } install_core($version, true); } // Check version of Moodle code on disk compared with database // and upgrade if possible. if (!$cache) { // Do not try to do anything fancy in non-cached mode, // this prevents themes from fetching data from non-existent tables. $PAGE->set_pagelayout('maintenance'); $PAGE->set_popup_notification_allowed(false); } $stradministration = get_string('administration'); $PAGE->set_context(context_system::instance()); if (empty($CFG->version)) { throw new \moodle_exception('missingconfigversion', 'debug'); } // Detect config cache inconsistency, this happens when you switch branches on dev servers. if ($CFG->version != $DB->get_field('config', 'value', array('name'=>'version'))) { purge_all_caches(); redirect(new moodle_url($PAGE->url), 'Config cache inconsistency detected, resetting caches...'); } if (!$cache and $version > $CFG->version) { // upgrade $PAGE->set_url(new moodle_url($PAGE->url, array( 'confirmupgrade' => $confirmupgrade, 'confirmrelease' => $confirmrelease, 'confirmplugincheck' => $confirmplugins, ))); check_upgrade_key($upgradekeyhash); // Warning about upgrading a test site. $testsite = false; if (defined('BEHAT_SITE_RUNNING')) { $testsite = 'behat'; } if (isset($CFG->themerev)) { // Store the themerev to restore after purging caches. $themerev = $CFG->themerev; } // We purge all of MUC's caches here. // Caches are disabled for upgrade by CACHE_DISABLE_ALL so we must set the first arg to true. // This ensures a real config object is loaded and the stores will be purged. // This is the only way we can purge custom caches such as memcache or APC. // Note: all other calls to caches will still used the disabled API. cache_helper::purge_all(true); // We then purge the regular caches. purge_all_caches(); if (isset($themerev)) { // Restore the themerev set_config('themerev', $themerev); } $output = $PAGE->get_renderer('core', 'admin'); if (upgrade_stale_php_files_present()) { $PAGE->set_title($stradministration); $PAGE->set_cacheable(false); echo $output->upgrade_stale_php_files_page(); die(); } if (empty($confirmupgrade)) { $a = new stdClass(); $a->oldversion = "$CFG->release (".sprintf('%.2f', $CFG->version).")"; $a->newversion = "$release (".sprintf('%.2f', $version).")"; $strdatabasechecking = get_string('databasechecking', '', $a); $PAGE->set_title($stradministration); $PAGE->set_heading($strdatabasechecking); $PAGE->set_cacheable(false); echo $output->upgrade_confirm_page($a->newversion, $maturity, $testsite); die(); } else if (empty($confirmrelease)) { require_once($CFG->libdir.'/environmentlib.php'); list($envstatus, $environmentresults) = check_moodle_environment($release, ENV_SELECT_RELEASE); $strcurrentrelease = get_string('currentrelease'); $PAGE->navbar->add($strcurrentrelease); $PAGE->set_title($strcurrentrelease); $PAGE->set_heading($strcurrentrelease); $PAGE->set_cacheable(false); echo $output->upgrade_environment_page($release, $envstatus, $environmentresults); die(); } else if (empty($confirmplugins)) { $strplugincheck = get_string('plugincheck'); $PAGE->navbar->add($strplugincheck); $PAGE->set_title($strplugincheck); $PAGE->set_heading($strplugincheck); $PAGE->set_cacheable(false); $pluginman = core_plugin_manager::instance(); // Check for available updates. if ($fetchupdates) { // No sesskey support guaranteed here, because sessions might not work yet. $updateschecker = \core\update\checker::instance(); if ($updateschecker->enabled()) { $updateschecker->fetch(); } redirect($PAGE->url); } // Cancel all plugin installations. if ($abortinstallx) { // No sesskey support guaranteed here, because sessions might not work yet. $abortables = $pluginman->list_cancellable_installations(); if ($abortables) { if ($confirmabortinstall) { foreach ($abortables as $plugin) { $pluginman->cancel_plugin_installation($plugin->component); } redirect($PAGE->url); } else { $continue = new moodle_url($PAGE->url, array('abortinstallx' => $abortinstallx, 'confirmabortinstall' => 1)); echo $output->upgrade_confirm_abort_install_page($abortables, $continue); die(); } } redirect($PAGE->url); } // Cancel single plugin installation. if ($abortinstall) { // No sesskey support guaranteed here, because sessions might not work yet. if ($confirmabortinstall) { $pluginman->cancel_plugin_installation($abortinstall); redirect($PAGE->url); } else { $continue = new moodle_url($PAGE->url, array('abortinstall' => $abortinstall, 'confirmabortinstall' => 1)); $abortable = $pluginman->get_plugin_info($abortinstall); if ($pluginman->can_cancel_plugin_installation($abortable)) { echo $output->upgrade_confirm_abort_install_page(array($abortable), $continue); die(); } redirect($PAGE->url); } } // Cancel all plugins upgrades (that is, restore archived versions). if ($abortupgradex) { // No sesskey support guaranteed here, because sessions might not work yet. $restorable = $pluginman->list_restorable_archives(); if ($restorable) { upgrade_install_plugins($restorable, $confirmabortupgrade, get_string('cancelupgradehead', 'core_plugin'), new moodle_url($PAGE->url, array('abortupgradex' => 1, 'confirmabortupgrade' => 1)) ); } redirect($PAGE->url); } // Cancel single plugin upgrade (that is, install the archived version). if ($abortupgrade) { // No sesskey support guaranteed here, because sessions might not work yet. $restorable = $pluginman->list_restorable_archives(); if (isset($restorable[$abortupgrade])) { $restorable = array($restorable[$abortupgrade]); upgrade_install_plugins($restorable, $confirmabortupgrade, get_string('cancelupgradehead', 'core_plugin'), new moodle_url($PAGE->url, array('abortupgrade' => $abortupgrade, 'confirmabortupgrade' => 1)) ); } redirect($PAGE->url); } // Install all available missing dependencies. if ($installdepx) { // No sesskey support guaranteed here, because sessions might not work yet. $installable = $pluginman->filter_installable($pluginman->missing_dependencies(true)); upgrade_install_plugins($installable, $confirminstalldep, get_string('dependencyinstallhead', 'core_plugin'), new moodle_url($PAGE->url, array('installdepx' => 1, 'confirminstalldep' => 1)) ); } // Install single available missing dependency. if ($installdep) { // No sesskey support guaranteed here, because sessions might not work yet. $installable = $pluginman->filter_installable($pluginman->missing_dependencies(true)); if (!empty($installable[$installdep])) { $installable = array($installable[$installdep]); upgrade_install_plugins($installable, $confirminstalldep, get_string('dependencyinstallhead', 'core_plugin'), new moodle_url($PAGE->url, array('installdep' => $installdep, 'confirminstalldep' => 1)) ); } } // Install all available updates. if ($installupdatex) { // No sesskey support guaranteed here, because sessions might not work yet. $installable = $pluginman->filter_installable($pluginman->available_updates()); upgrade_install_plugins($installable, $confirminstallupdate, get_string('updateavailableinstallallhead', 'core_admin'), new moodle_url($PAGE->url, array('installupdatex' => 1, 'confirminstallupdate' => 1)) ); } // Install single available update. if ($installupdate and $installupdateversion) { // No sesskey support guaranteed here, because sessions might not work yet. if ($pluginman->is_remote_plugin_installable($installupdate, $installupdateversion)) { $installable = array($pluginman->get_remote_plugin_info($installupdate, $installupdateversion, true)); upgrade_install_plugins($installable, $confirminstallupdate, get_string('updateavailableinstallallhead', 'core_admin'), new moodle_url($PAGE->url, array('installupdate' => $installupdate, 'installupdateversion' => $installupdateversion, 'confirminstallupdate' => 1) ) ); } } echo $output->upgrade_plugin_check_page(core_plugin_manager::instance(), \core\update\checker::instance(), $version, $showallplugins, $PAGE->url, new moodle_url($PAGE->url, array('confirmplugincheck' => 1))); die(); } else { // Always verify plugin dependencies! $failed = array(); if (!core_plugin_manager::instance()->all_plugins_ok($version, $failed, $CFG->branch)) { echo $output->unsatisfied_dependencies_page($version, $failed, new moodle_url($PAGE->url, array('confirmplugincheck' => 0))); die(); } unset($failed); // Launch main upgrade. upgrade_core($version, true); } } else if ($version < $CFG->version) { // better stop here, we can not continue with plugin upgrades or anything else throw new moodle_exception('downgradedcore', 'error', new moodle_url('/admin/')); } // Updated human-readable release version if necessary if (!$cache and $release <> $CFG->release) { // Update the release version set_config('release', $release); } if (!$cache and $branch <> $CFG->branch) { // Update the branch set_config('branch', $branch); } if (!$cache and moodle_needs_upgrading()) { $PAGE->set_url(new moodle_url($PAGE->url, array( 'confirmrelease' => $confirmrelease, 'confirmplugincheck' => $confirmplugins, ))); check_upgrade_key($upgradekeyhash); if (!$PAGE->headerprinted) { // means core upgrade or installation was not already done $pluginman = core_plugin_manager::instance(); $output = $PAGE->get_renderer('core', 'admin'); if (empty($confirmrelease)) { require_once($CFG->libdir . '/environmentlib.php'); list($envstatus, $environmentresults) = check_moodle_environment($release, ENV_SELECT_RELEASE); $strcurrentrelease = get_string('currentrelease'); $PAGE->navbar->add($strcurrentrelease); $PAGE->set_title($strcurrentrelease); $PAGE->set_heading($strcurrentrelease); $PAGE->set_cacheable(false); echo $output->upgrade_environment_page($release, $envstatus, $environmentresults); die(); } else if (!$confirmplugins) { $strplugincheck = get_string('plugincheck'); $PAGE->navbar->add($strplugincheck); $PAGE->set_title($strplugincheck); $PAGE->set_heading($strplugincheck); $PAGE->set_cacheable(false); // Check for available updates. if ($fetchupdates) { require_sesskey(); $updateschecker = \core\update\checker::instance(); if ($updateschecker->enabled()) { $updateschecker->fetch(); } redirect($PAGE->url); } // Cancel all plugin installations. if ($abortinstallx) { require_sesskey(); $abortables = $pluginman->list_cancellable_installations(); if ($abortables) { if ($confirmabortinstall) { foreach ($abortables as $plugin) { $pluginman->cancel_plugin_installation($plugin->component); } redirect($PAGE->url); } else { $continue = new moodle_url($PAGE->url, array('abortinstallx' => $abortinstallx, 'confirmabortinstall' => 1)); echo $output->upgrade_confirm_abort_install_page($abortables, $continue); die(); } } redirect($PAGE->url); } // Cancel single plugin installation. if ($abortinstall) { require_sesskey(); if ($confirmabortinstall) { $pluginman->cancel_plugin_installation($abortinstall); redirect($PAGE->url); } else { $continue = new moodle_url($PAGE->url, array('abortinstall' => $abortinstall, 'confirmabortinstall' => 1)); $abortable = $pluginman->get_plugin_info($abortinstall); if ($pluginman->can_cancel_plugin_installation($abortable)) { echo $output->upgrade_confirm_abort_install_page(array($abortable), $continue); die(); } redirect($PAGE->url); } } // Cancel all plugins upgrades (that is, restore archived versions). if ($abortupgradex) { require_sesskey(); $restorable = $pluginman->list_restorable_archives(); if ($restorable) { upgrade_install_plugins($restorable, $confirmabortupgrade, get_string('cancelupgradehead', 'core_plugin'), new moodle_url($PAGE->url, array('abortupgradex' => 1, 'confirmabortupgrade' => 1)) ); } redirect($PAGE->url); } // Cancel single plugin upgrade (that is, install the archived version). if ($abortupgrade) { require_sesskey(); $restorable = $pluginman->list_restorable_archives(); if (isset($restorable[$abortupgrade])) { $restorable = array($restorable[$abortupgrade]); upgrade_install_plugins($restorable, $confirmabortupgrade, get_string('cancelupgradehead', 'core_plugin'), new moodle_url($PAGE->url, array('abortupgrade' => $abortupgrade, 'confirmabortupgrade' => 1)) ); } redirect($PAGE->url); } // Install all available missing dependencies. if ($installdepx) { require_sesskey(); $installable = $pluginman->filter_installable($pluginman->missing_dependencies(true)); upgrade_install_plugins($installable, $confirminstalldep, get_string('dependencyinstallhead', 'core_plugin'), new moodle_url($PAGE->url, array('installdepx' => 1, 'confirminstalldep' => 1)) ); } // Install single available missing dependency. if ($installdep) { require_sesskey(); $installable = $pluginman->filter_installable($pluginman->missing_dependencies(true)); if (!empty($installable[$installdep])) { $installable = array($installable[$installdep]); upgrade_install_plugins($installable, $confirminstalldep, get_string('dependencyinstallhead', 'core_plugin'), new moodle_url($PAGE->url, array('installdep' => $installdep, 'confirminstalldep' => 1)) ); } } // Install all available updates. if ($installupdatex) { require_sesskey(); $installable = $pluginman->filter_installable($pluginman->available_updates()); upgrade_install_plugins($installable, $confirminstallupdate, get_string('updateavailableinstallallhead', 'core_admin'), new moodle_url($PAGE->url, array('installupdatex' => 1, 'confirminstallupdate' => 1)) ); } // Install single available update. if ($installupdate and $installupdateversion) { require_sesskey(); if ($pluginman->is_remote_plugin_installable($installupdate, $installupdateversion)) { $installable = array($pluginman->get_remote_plugin_info($installupdate, $installupdateversion, true)); upgrade_install_plugins($installable, $confirminstallupdate, get_string('updateavailableinstallallhead', 'core_admin'), new moodle_url($PAGE->url, array('installupdate' => $installupdate, 'installupdateversion' => $installupdateversion, 'confirminstallupdate' => 1) ) ); } } // Show plugins info. echo $output->upgrade_plugin_check_page($pluginman, \core\update\checker::instance(), $version, $showallplugins, new moodle_url($PAGE->url), new moodle_url($PAGE->url, array('confirmplugincheck' => 1, 'cache' => 0))); die(); } // Make sure plugin dependencies are always checked. $failed = array(); if (!$pluginman->all_plugins_ok($version, $failed, $CFG->branch)) { $output = $PAGE->get_renderer('core', 'admin'); echo $output->unsatisfied_dependencies_page($version, $failed, new moodle_url($PAGE->url, array('confirmplugincheck' => 0))); die(); } unset($failed); } // install/upgrade all plugins and other parts upgrade_noncore(true); } // If this is the first install, indicate that this site is fully configured // except the admin password if (during_initial_install()) { set_config('rolesactive', 1); // after this, during_initial_install will return false. set_config('adminsetuppending', 1); set_config('registrationpending', 1); // Remind to register site after all other setup is finished. // Apply default preset, if it is defined in $CFG and has a valid value. if (!empty($CFG->setsitepresetduringinstall)) { \core_adminpresets\helper::change_default_preset($CFG->setsitepresetduringinstall); } // we need this redirect to setup proper session upgrade_finished("index.php?sessionstarted=1&lang=$CFG->lang"); } // make sure admin user is created - this is the last step because we need // session to be working properly in order to edit admin account if (!empty($CFG->adminsetuppending)) { $sessionstarted = optional_param('sessionstarted', 0, PARAM_BOOL); if (!$sessionstarted) { redirect("index.php?sessionstarted=1&lang=$CFG->lang"); } else { $sessionverify = optional_param('sessionverify', 0, PARAM_BOOL); if (!$sessionverify) { $SESSION->sessionverify = 1; redirect("index.php?sessionstarted=1&sessionverify=1&lang=$CFG->lang"); } else { if (empty($SESSION->sessionverify)) { throw new \moodle_exception('installsessionerror', 'admin', "index.php?sessionstarted=1&lang=$CFG->lang"); } unset($SESSION->sessionverify); } } // Cleanup SESSION to make sure other code does not complain in the future. unset($SESSION->has_timed_out); unset($SESSION->wantsurl); // at this stage there can be only one admin unless more were added by install - users may change username, so do not rely on that $adminids = explode(',', $CFG->siteadmins); $adminuser = get_complete_user_data('id', reset($adminids)); if ($adminuser->password === 'adminsetuppending') { // prevent installation hijacking if ($adminuser->lastip !== getremoteaddr()) { throw new \moodle_exception('installhijacked', 'admin'); } // login user and let him set password and admin details $adminuser->newadminuser = 1; complete_user_login($adminuser); redirect("$CFG->wwwroot/user/editadvanced.php?id=$adminuser->id"); // Edit thyself } else { unset_config('adminsetuppending'); } } else { // just make sure upgrade logging is properly terminated upgrade_finished('upgradesettings.php'); } if (has_capability('moodle/site:config', context_system::instance())) { if ($fetchupdates) { require_sesskey(); $updateschecker = \core\update\checker::instance(); if ($updateschecker->enabled()) { $updateschecker->fetch(); } redirect(new moodle_url('/admin/index.php', array('cache' => 0))); } } // Now we can be sure everything was upgraded and caches work fine, // redirect if necessary to make sure caching is enabled. if (!$cache) { redirect(new moodle_url('/admin/index.php', array('cache' => 1))); } // Check for valid admin user - no guest autologin require_login(0, false); if (isguestuser()) { // Login as real user! $SESSION->wantsurl = (string)new moodle_url('/admin/index.php'); redirect(get_login_url()); } $context = context_system::instance(); if (!has_capability('moodle/site:config', $context)) { // Do not throw exception display an empty page with administration menu if visible for current user. $PAGE->set_title($SITE->fullname); $PAGE->set_heading($SITE->fullname); echo $OUTPUT->header(); echo $OUTPUT->footer(); exit; } // check that site is properly customized $site = get_site(); if (empty($site->shortname)) { // probably new installation - lets return to frontpage after this step // remove settings that we want uninitialised unset_config('registerauth'); unset_config('timezone'); // Force admin to select timezone! redirect('upgradesettings.php?return=site'); } // setup critical warnings before printing admin tree block $insecuredataroot = is_dataroot_insecure(true); $SESSION->admin_critical_warning = ($insecuredataroot==INSECURE_DATAROOT_ERROR); $adminroot = admin_get_root(); $PAGE->set_primary_active_tab('siteadminnode'); // Check if there are any new admin settings which have still yet to be set if (any_new_admin_settings($adminroot)) { redirect('upgradesettings.php'); } // Return to original page that started the plugin uninstallation if necessary. if (isset($SESSION->pluginuninstallreturn)) { $return = $SESSION->pluginuninstallreturn; unset($SESSION->pluginuninstallreturn); if ($return) { redirect($return); } } // If site registration needs updating, redirect. \core\hub\registration::registration_reminder('/admin/index.php'); // Everything should now be set up, and the user is an admin // Print default admin page with notifications. $errorsdisplayed = defined('WARN_DISPLAY_ERRORS_ENABLED'); $lastcron = get_config('tool_task', 'lastcronstart'); $cronoverdue = ($lastcron < time() - 3600 * 24); $lastcroninterval = get_config('tool_task', 'lastcroninterval'); $expectedfrequency = $CFG->expectedcronfrequency ?? MINSECS; $croninfrequent = !$cronoverdue && ($lastcroninterval > ($expectedfrequency + MINSECS) || $lastcron < time() - $expectedfrequency); $dbproblems = $DB->diagnose(); $maintenancemode = !empty($CFG->maintenance_enabled); // Available updates for Moodle core. $updateschecker = \core\update\checker::instance(); $availableupdates = array(); $availableupdatesfetch = null; if ($updateschecker->enabled()) { // Only compute the update information when it is going to be displayed to the user. $availableupdates['core'] = $updateschecker->get_update_info('core', array('minmaturity' => $CFG->updateminmaturity, 'notifybuilds' => $CFG->updatenotifybuilds)); // Available updates for contributed plugins $pluginman = core_plugin_manager::instance(); foreach ($pluginman->get_plugins() as $plugintype => $plugintypeinstances) { foreach ($plugintypeinstances as $pluginname => $plugininfo) { $pluginavailableupdates = $plugininfo->available_updates(); if (!empty($pluginavailableupdates)) { foreach ($pluginavailableupdates as $pluginavailableupdate) { if (!isset($availableupdates[$plugintype.'_'.$pluginname])) { $availableupdates[$plugintype.'_'.$pluginname] = array(); } $availableupdates[$plugintype.'_'.$pluginname][] = $pluginavailableupdate; } } } } // The timestamp of the most recent check for available updates $availableupdatesfetch = $updateschecker->get_last_timefetched(); } $buggyiconvnomb = (!function_exists('mb_convert_encoding') and @iconv('UTF-8', 'UTF-8//IGNORE', '100'.chr(130).'€') !== '100€'); //check if the site is registered on Moodle.org $registered = \core\hub\registration::is_registered(); // Check if there are any cache warnings. $cachewarnings = cache_helper::warnings(); // Check if there are events 1 API handlers. $eventshandlers = $DB->get_records_sql('SELECT DISTINCT component FROM {events_handlers}'); $themedesignermode = !empty($CFG->themedesignermode); $mobileconfigured = !empty($CFG->enablemobilewebservice); $invalidforgottenpasswordurl = !empty($CFG->forgottenpasswordurl) && empty(clean_param($CFG->forgottenpasswordurl, PARAM_URL)); // Check if a directory with development libraries exists. if (empty($CFG->disabledevlibdirscheck) && (is_dir($CFG->dirroot.'/vendor') || is_dir($CFG->dirroot.'/node_modules'))) { $devlibdir = true; } else { $devlibdir = false; } // Check if the site is being foced onto ssl. $overridetossl = !empty($CFG->overridetossl); // Check if moodle campaign content setting is enabled or not. $showcampaigncontent = !isset($CFG->showcampaigncontent) || $CFG->showcampaigncontent; // Encourage admins to enable the user feedback feature if it is not enabled already. $showfeedbackencouragement = empty($CFG->enableuserfeedback); // Check if the service and support content setting is enabled or not. $servicesandsupportcontent = !isset($CFG->showservicesandsupportcontent) || $CFG->showservicesandsupportcontent; // Check whether the XML-RPC protocol is enabled or not. require_once($CFG->libdir . '/environmentlib.php'); $result = new environment_results('custom_checks'); $result = check_xmlrpc_usage($result); $xmlrpcwarning = !is_null($result) ? get_string($result->getFeedbackStr(), 'admin') : ''; admin_externalpage_setup('adminnotifications'); $output = $PAGE->get_renderer('core', 'admin'); echo $output->admin_notifications_page($maturity, $insecuredataroot, $errorsdisplayed, $cronoverdue, $dbproblems, $maintenancemode, $availableupdates, $availableupdatesfetch, $buggyiconvnomb, $registered, $cachewarnings, $eventshandlers, $themedesignermode, $devlibdir, $mobileconfigured, $overridetossl, $invalidforgottenpasswordurl, $croninfrequent, $showcampaigncontent, $showfeedbackencouragement, $servicesandsupportcontent, $xmlrpcwarning); home3/cpr76684/public_html/Aem/admin/tool/admin_presets/index.php 0000644 00000004245 15151236171 0020517 0 ustar 00 <?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Admin tool presets plugin to load some settings. * * @package tool_admin_presets * @copyright 2021 Pimenko <support@pimenko.com><pimenko.com> * @author Jordan Kesraoui | Sylvain Revenu | Pimenko based on David Monllaó <david.monllao@urv.cat> code * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once(__DIR__ . '/../../../config.php'); global $CFG, $PAGE; $action = optional_param('action', 'base', PARAM_ALPHA); $mode = optional_param('mode', 'show', PARAM_ALPHAEXT); require_login(); if (!$context = context_system::instance()) { throw new moodle_exception('wrongcontext', 'error'); } require_capability('moodle/site:config', $context); // Loads the required action class and form. $fileclassname = $action; $classname = 'tool_admin_presets\\local\\action\\'.$action; if (!class_exists($classname)) { throw new moodle_exception('falseaction', 'tool_admin_presets', $action); } $url = new moodle_url('/admin/tool/admin_presets/index.php'); $url->param('action', $action); $url->param('mode', $mode); $PAGE->set_url($url); $PAGE->set_pagelayout('admin'); $PAGE->set_context($context); $PAGE->set_primary_active_tab('siteadminnode'); // Executes the required action. $instance = new $classname(); if (!method_exists($instance, $mode)) { throw new moodle_exception('falsemode', 'tool_admin_presets', $mode); } // Executes the required method and displays output. $instance->$mode(); $instance->log(); $instance->display(); home3/cpr76684/public_html/Aem/report/outline/index.php 0000644 00000025250 15151251404 0016602 0 ustar 00 <?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Display user activity reports for a course (totals) * * @package report * @subpackage outline * @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ use core\report_helper; require('../../config.php'); require_once($CFG->dirroot.'/report/outline/locallib.php'); $id = required_param('id',PARAM_INT); // course id $startdate = optional_param('startdate', null, PARAM_INT); $enddate = optional_param('enddate', null, PARAM_INT); $course = $DB->get_record('course', array('id'=>$id), '*', MUST_EXIST); $pageparams = array('id' => $id); if ($startdate) { $pageparams['startdate'] = $startdate; } if ($enddate) { $pageparams['enddate'] = $enddate; } $PAGE->set_url('/report/outline/index.php', $pageparams); $PAGE->set_pagelayout('report'); require_login($course); $context = context_course::instance($course->id); require_capability('report/outline:view', $context); // Handle form to filter access logs by date. $filterform = new \report_outline\filter_form(); $filterform->set_data(['id' => $course->id, 'filterstartdate' => $startdate, 'filterenddate' => $enddate]); if ($filterform->is_cancelled()) { $redir = $PAGE->url; $redir->remove_params(['startdate', 'enddate']); redirect($redir); } if ($filter = $filterform->get_data()) { $redir = $PAGE->url; if ($filter->filterstartdate) { $redir->param('startdate', $filter->filterstartdate); } if ($filter->filterenddate) { $redir->param('enddate', $filter->filterenddate); } redirect($redir); } // Trigger an activity report viewed event. $event = \report_outline\event\activity_report_viewed::create(array('context' => $context)); $event->trigger(); $showlastaccess = true; $hiddenfields = explode(',', $CFG->hiddenuserfields); if (array_search('lastaccess', $hiddenfields) !== false and !has_capability('moodle/user:viewhiddendetails', $context)) { $showlastaccess = false; } $stractivityreport = get_string('pluginname', 'report_outline'); $stractivity = get_string('activity'); $strlast = get_string('lastaccess'); $strreports = get_string('reports'); $strviews = get_string('views'); $strrelatedblogentries = get_string('relatedblogentries', 'blog'); $PAGE->set_title($course->shortname .': '. $stractivityreport); $PAGE->set_heading($course->fullname); echo $OUTPUT->header(); // Print selector drop down. $pluginname = get_string('pluginname', 'report_outline'); report_helper::print_report_selector($pluginname); list($uselegacyreader, $useinternalreader, $minloginternalreader, $logtable) = report_outline_get_common_log_variables(); // If no legacy and no internal log then don't proceed. if (!$uselegacyreader && !$useinternalreader) { echo $OUTPUT->box_start('generalbox', 'notice'); echo $OUTPUT->notification(get_string('nologreaderenabled', 'report_outline')); echo $OUTPUT->box_end(); echo $OUTPUT->footer(); die(); } // We want to display the time we are beginning to get logs from in the heading. // If we are using the legacy reader check the minimum time in that log table. if ($uselegacyreader) { $minlog = $DB->get_field_sql('SELECT min(time) FROM {log}'); } // If we are using the internal reader check the minimum time in that table. if ($useinternalreader) { // If new log table has older data then don't use the minimum time obtained from the legacy table. if (empty($minlog) || ($minloginternalreader <= $minlog)) { $minlog = $minloginternalreader; } } $filterform->display(); echo $OUTPUT->container(get_string('computedfromlogs', 'admin', userdate($minlog)), 'loginfo'); $outlinetable = new html_table(); $outlinetable->attributes['class'] = 'generaltable boxaligncenter'; $outlinetable->cellpadding = 5; $outlinetable->id = 'outlinetable'; $outlinetable->head = array($stractivity, $strviews); if (!empty($CFG->enableblogs) && $CFG->useblogassociations) { $outlinetable->head[] = $strrelatedblogentries; } if ($showlastaccess) { $outlinetable->head[] = $strlast; } $modinfo = get_fast_modinfo($course); // If using legacy log then get users from old table. if ($uselegacyreader) { // If we are going to use the internal (not legacy) log table, we should only get records // from the legacy table that exist before we started adding logs to the new table. $params = array('courseid' => $course->id, 'action' => 'view%', 'visible' => 1); $limittime = ''; if (!empty($minloginternalreader)) { $limittime = ' AND time < :timeto '; $params['timeto'] = $minloginternalreader; } if ($startdate) { $limittime .= ' AND time >= :startdate '; $params['startdate'] = $startdate; } if ($enddate) { $limittime .= ' AND time < :enddate '; $params['enddate'] = $enddate; } // Check if we need to show the last access. $sqllasttime = ''; if ($showlastaccess) { $sqllasttime = ", MAX(time) AS lasttime"; } $logactionlike = $DB->sql_like('l.action', ':action'); $sql = "SELECT cm.id, COUNT('x') AS numviews, COUNT(DISTINCT userid) AS distinctusers $sqllasttime FROM {course_modules} cm JOIN {modules} m ON m.id = cm.module JOIN {log} l ON l.cmid = cm.id WHERE cm.course = :courseid AND $logactionlike AND m.visible = :visible $limittime GROUP BY cm.id"; $views = $DB->get_records_sql($sql, $params); } // Get record from sql_internal_table_reader and merge with records obtained from legacy log (if needed). if ($useinternalreader) { // Check if we need to show the last access. $sqllasttime = ''; if ($showlastaccess) { $sqllasttime = ", MAX(timecreated) AS lasttime"; } $params = array('courseid' => $course->id, 'contextmodule' => CONTEXT_MODULE); $limittime = ''; if ($startdate) { $limittime .= ' AND timecreated >= :startdate '; $params['startdate'] = $startdate; } if ($enddate) { $limittime .= ' AND timecreated < :enddate '; $params['enddate'] = $enddate; } $sql = "SELECT contextinstanceid as cmid, COUNT('x') AS numviews, COUNT(DISTINCT userid) AS distinctusers $sqllasttime FROM {" . $logtable . "} l WHERE courseid = :courseid AND anonymous = 0 AND crud = 'r' AND contextlevel = :contextmodule $limittime GROUP BY contextinstanceid"; $v = $DB->get_records_sql($sql, $params); if (empty($views)) { $views = $v; } else { // Merge two view arrays. foreach ($v as $key => $value) { if (isset($views[$key]) && !empty($views[$key]->numviews)) { $views[$key]->numviews += $value->numviews; if ($value->lasttime > $views[$key]->lasttime) { $views[$key]->lasttime = $value->lasttime; } } else { $views[$key] = $value; } } } } $prevsecctionnum = 0; foreach ($modinfo->sections as $sectionnum=>$section) { foreach ($section as $cmid) { $cm = $modinfo->cms[$cmid]; if (!$cm->has_view()) { continue; } if (!$cm->uservisible) { continue; } if ($prevsecctionnum != $sectionnum) { $sectionrow = new html_table_row(); $sectionrow->attributes['class'] = 'section'; $sectioncell = new html_table_cell(); $sectioncell->colspan = count($outlinetable->head); $sectiontitle = get_section_name($course, $sectionnum); $sectioncell->text = $OUTPUT->heading($sectiontitle, 3); $sectionrow->cells[] = $sectioncell; $outlinetable->data[] = $sectionrow; $prevsecctionnum = $sectionnum; } $dimmed = $cm->visible ? '' : 'class="dimmed"'; $modulename = get_string('modulename', $cm->modname); $reportrow = new html_table_row(); $activitycell = new html_table_cell(); $activitycell->attributes['class'] = 'activity'; $activityicon = $OUTPUT->pix_icon('monologo', $modulename, $cm->modname, array('class'=>'icon')); $attributes = array(); if (!$cm->visible) { $attributes['class'] = 'dimmed'; } $activitycell->text = $activityicon . html_writer::link("$CFG->wwwroot/mod/$cm->modname/view.php?id=$cm->id", format_string($cm->name), $attributes); $reportrow->cells[] = $activitycell; $numviewscell = new html_table_cell(); $numviewscell->attributes['class'] = 'numviews'; if (!empty($views[$cm->id]->numviews)) { $numviewscell->text = get_string('numviews', 'report_outline', $views[$cm->id]); } else { $numviewscell->text = '-'; } $reportrow->cells[] = $numviewscell; if (!empty($CFG->enableblogs) && $CFG->useblogassociations) { require_once($CFG->dirroot.'/blog/lib.php'); $blogcell = new html_table_cell(); $blogcell->attributes['class'] = 'blog'; if ($blogcount = blog_get_associated_count($course->id, $cm->id)) { $blogurl = new moodle_url('/blog/index.php', array('modid' => $cm->id)); $blogcell->text = html_writer::link($blogurl, $blogcount); } else { $blogcell->text = '-'; } $reportrow->cells[] = $blogcell; } if ($showlastaccess) { $lastaccesscell = new html_table_cell(); $lastaccesscell->attributes['class'] = 'lastaccess'; if (isset($views[$cm->id]->lasttime)) { $timeago = format_time(time() - $views[$cm->id]->lasttime); $lastaccesscell->text = userdate($views[$cm->id]->lasttime)." ($timeago)"; } $reportrow->cells[] = $lastaccesscell; } $outlinetable->data[] = $reportrow; } } echo html_writer::table($outlinetable); echo $OUTPUT->footer(); home3/cpr76684/public_html/Aem/admin/tool/profiling/index.php 0000644 00000017430 15151251772 0017657 0 ustar 00 <?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Profiling tool. * * @package tool_profiling * @copyright 2010 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ // TODO: Move all the DB stuff to profiling_db_xxxx() function in xhprof_moodle.php // TODO: it is wrong when core lib references ANY plugin lang strings, maybe more login could be moved here (skodak) require_once(__DIR__ . '/../../../config.php'); require_once($CFG->libdir.'/adminlib.php'); require_once($CFG->libdir . '/xhprof/xhprof_moodle.php'); define('PROFILING_RUNSPERPAGE', 50); // page parameters $script = optional_param('script', null, PARAM_PATH); $runid = optional_param('runid', null, PARAM_ALPHANUM); $runid2 = optional_param('runid2', null, PARAM_ALPHANUM); $listurl = optional_param('listurl', null, PARAM_PATH); $runreference= optional_param('runreference', 0, PARAM_INT); $runcomment = optional_param('runcomment', null, PARAM_TEXT); $dbfields = 'runid, url, totalexecutiontime, totalcputime, ' . 'totalcalls, totalmemory, runreference, runcomment, timecreated'; admin_externalpage_setup('toolprofiling'); // Always add listurl if available if ($listurl) { $listurlnav = new moodle_url('/admin/tool/profiling/index.php', array('listurl' => $listurl)); $PAGE->navbar->add($listurl, $listurlnav); } // Add a new nav item to make $listurl clickable for the Boost theme. if (isset($script)) { $lastrunnav = get_string('lastrun', 'tool_profiling'); $PAGE->navbar->add($lastrunnav); } // Header echo $OUTPUT->header(); // We have requested the last available run for one script if (isset($script)) { // Get the last available run for the given script $run = $DB->get_record_sql("SELECT $dbfields FROM {profiling} WHERE url = ? AND id = (SELECT MAX(id) FROM {profiling} WHERE url = ?)", array($script, $script), IGNORE_MISSING); // No run found for script, warn and exit if (!$run) { notice(get_string('cannotfindanyrunforurl', 'tool_profiling', $script), 'index.php'); } // Check if there is any previous run marked as reference one $prevreferences = $DB->get_records_select('profiling', 'url = ? AND runreference = 1 AND timecreated < ?', array($run->url, $run->timecreated), 'timecreated DESC', 'runid, runcomment, timecreated', 0, 10); echo $OUTPUT->box_start('generalbox boxwidthwide boxaligncenter'); $header = get_string('lastrunof', 'tool_profiling', $script); echo $OUTPUT->heading($header); $table = profiling_print_run($run, $prevreferences); echo $table; echo $OUTPUT->box_end(); // We have requested the diff between 2 runs } else if (isset($runid) && isset($runid2)) { $run1 = $DB->get_record('profiling', array('runid'=>$runid), $dbfields, MUST_EXIST); $run2 = $DB->get_record('profiling', array('runid'=>$runid2), $dbfields, MUST_EXIST); if ($run1->url == $run2->url && $run1->runid != $run2->runid) { if ($run2->timecreated < $run1->timecreated) { $runtemp = $run1; $run1 = $run2; $run2 = $runtemp; } echo $OUTPUT->box_start('generalbox boxwidthwide boxaligncenter'); $header = get_string('differencesbetween2runsof', 'tool_profiling', $run1->url); echo $OUTPUT->heading($header); $table = profiling_print_rundiff($run1, $run2); echo $table; echo $OUTPUT->box_end(); } // We have requested one run, invoke it } else if (isset($runid)) { // Check if we are trying to update the runreference/runcomment for the run if (isset($runcomment) && confirm_sesskey()) { $id = $DB->get_field('profiling', 'id', array('runid' => $runid), MUST_EXIST); $rec = new stdClass(); $rec->id = $id; $rec->runreference = (bool)$runreference; $rec->runcomment = $runcomment; $DB->update_record('profiling', $rec); } // Get the requested runid $run = $DB->get_record('profiling', array('runid'=>$runid), $dbfields, IGNORE_MISSING); // No run found for runid, warn and exit if (!$run) { notice(get_string('cannotfindanyrunforrunid', 'tool_profiling', $runid), 'index.php'); } // Check if there is any previous run marked as reference one $prevreferences = $DB->get_records_select('profiling', 'url = ? AND runreference = 1 AND timecreated < ?', array($run->url, $run->timecreated), 'timecreated DESC', 'runid, runcomment, timecreated', 0, 10); echo $OUTPUT->box_start('generalbox boxwidthwide boxaligncenter'); $header = get_string('summaryof', 'tool_profiling', $run->url); echo $OUTPUT->heading($header); $table = profiling_print_run($run, $prevreferences); echo $table; echo $OUTPUT->box_end(); // Default: List one page of runs } else { // The flexitable that will root listings $table = new xhprof_table_sql('profiling-list-table'); $baseurl = $CFG->wwwroot . '/'.$CFG->admin.'/tool/profiling/index.php'; // Check if we are listing all or some URL ones $sqlconditions = ''; $sqlparams = array(); if (!isset($listurl)) { $header = get_string('pluginname', 'tool_profiling'); $sqlconditions = '1 = 1'; $table->set_listurlmode(false); } else { $header = get_string('profilingrunsfor', 'tool_profiling', $listurl); $sqlconditions = 'url = :url'; $sqlparams['url'] = $listurl; $table->set_listurlmode(true); $baseurl .= '?listurl=' . urlencode($listurl); } echo $OUTPUT->heading($header); // Print the controller block with different options. echo profiling_list_controls($listurl); // TODO: Fix flexitable to validate tsort/thide/tshow/tifirs/tilast/page // TODO: Fix table_sql to allow it to work without WHERE clause // add silly condition (1 = 1) because of table_sql bug $table->set_sql($dbfields, '{profiling}', $sqlconditions, $sqlparams); $table->set_count_sql("SELECT COUNT(*) FROM {profiling} WHERE $sqlconditions", $sqlparams); $columns = array( 'url', 'timecreated', 'totalexecutiontime', 'totalcputime', 'totalcalls', 'totalmemory', 'runcomment'); $headers = array( get_string('url'), get_string('date'), get_string('executiontime', 'tool_profiling'), get_string('cputime', 'tool_profiling'), get_string('calls', 'tool_profiling'), get_string('memory', 'tool_profiling'), get_string('comment', 'tool_profiling')); $table->define_columns($columns); $table->define_headers($headers); $table->sortable(true, 'timecreated', SORT_DESC); $table->define_baseurl($baseurl); $table->column_suppress('url'); $table->out(PROFILING_RUNSPERPAGE, true); } // Footer. echo $OUTPUT->footer(); home3/cpr76684/public_html/Aem/admin/tool/analytics/index.php 0000644 00000002454 15151252256 0017653 0 ustar 00 <?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Prediction models tool frontend. * * @package tool_analytics * @copyright 2016 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once(__DIR__ . '/../../../config.php'); require_once($CFG->libdir . '/adminlib.php'); admin_externalpage_setup('analyticmodels', '', null, '', array('pagelayout' => 'report')); $models = \core_analytics\manager::get_all_models(); echo $OUTPUT->header(); $templatable = new \tool_analytics\output\models_list($models); echo $PAGE->get_renderer('tool_analytics')->render($templatable); echo $OUTPUT->footer(); home3/cpr76684/public_html/Aem/admin/tool/multilangupgrade/index.php 0000644 00000011711 15151252421 0021216 0 ustar 00 <?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Search and replace strings throughout all texts in the whole database. * * Unfortunately it was a bad idea to use spans for multilang because it * can not support nesting. Hopefully this will get thrown away soon.... * * @package tool * @subpackage multilangupgrade * @copyright 2006 Petr Skoda (http://skodak.org) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ define('NO_OUTPUT_BUFFERING', true); require('../../../config.php'); require_once($CFG->dirroot.'/course/lib.php'); require_once($CFG->libdir.'/adminlib.php'); admin_externalpage_setup('toolmultilangupgrade'); $go = optional_param('go', 0, PARAM_BOOL); ################################################################### echo $OUTPUT->header(); echo $OUTPUT->heading(get_string('pluginname', 'tool_multilangupgrade')); $strmultilangupgrade = get_String('multilangupgradeinfo', 'tool_multilangupgrade'); if (!$go or !data_submitted() or !confirm_sesskey()) { /// Print a form $optionsyes = array('go'=>1, 'sesskey'=>sesskey()); echo $OUTPUT->confirm($strmultilangupgrade, new moodle_url('/admin/tool/multilangupgrade/index.php', $optionsyes), new moodle_url('/admin/')); echo $OUTPUT->footer(); die; } if (!$tables = $DB->get_tables() ) { // No tables yet at all. throw new \moodle_exception('notables', 'debug'); } echo $OUTPUT->box_start(); /// Turn off time limits, sometimes upgrades can be slow. core_php_time_limit::raise(); echo '<strong>Progress:</strong>'; $i = 0; $skiptables = array('config', 'block_instances', 'sessions'); // we can not process tables with serialised data here foreach ($tables as $table) { if (strpos($table,'pma') === 0) { // Not our tables continue; } if (in_array($table, $skiptables)) { // Don't process these continue; } $fulltable = $DB->get_prefix().$table; if ($columns = $DB->get_columns($table)) { if (!array_key_exists('id', $columns)) { continue; // moodle tables have id } foreach ($columns as $column => $data) { if (in_array($data->type, array('text','mediumtext','longtext','varchar'))) { // Text stuff only // first find candidate records $sql = "SELECT id, $column FROM $fulltable WHERE $column LIKE '%</lang>%' OR $column LIKE '%<span lang=%'"; $rs = $DB->get_recordset_sql($sql); foreach ($rs as $data) { $text = $data->$column; $id = $data->id; if ($i % 600 == 0) { echo '<br />'; } if ($i % 10 == 0) { echo '.'; } $i++; if (empty($text) or is_numeric($text)) { continue; // nothing to do } $search = '/(<(?:lang|span) lang="[a-zA-Z0-9_-]*".*?>.+?<\/(?:lang|span)>)(\s*<(?:lang|span) lang="[a-zA-Z0-9_-]*".*?>.+?<\/(?:lang|span)>)+/is'; $newtext = preg_replace_callback($search, 'multilangupgrade_impl', $text); if (is_null($newtext)) { continue; // regex error } if ($newtext != $text) { $DB->execute("UPDATE $fulltable SET $column=? WHERE id=?", array($newtext, $id)); } } $rs->close(); } } } } // set conversion flag - switches to new plugin automatically set_config('filter_multilang_converted', 1); echo $OUTPUT->box_end(); /// Rebuild course cache which might be incorrect now echo $OUTPUT->notification('Rebuilding course cache...', 'notifysuccess'); rebuild_course_cache(0, true); echo $OUTPUT->notification('...finished', 'notifysuccess'); echo $OUTPUT->continue_button(new moodle_url('/admin/')); echo $OUTPUT->footer(); die; function multilangupgrade_impl($langblock) { $searchtosplit = '/<(?:lang|span) lang="([a-zA-Z0-9_-]*)".*?>(.+?)<\/(?:lang|span)>/is'; preg_match_all($searchtosplit, $langblock[0], $rawlanglist); $return = ''; foreach ($rawlanglist[1] as $index=>$lang) { $return .= '<span lang="'.$lang.'" class="multilang">'.$rawlanglist[2][$index].'</span>'; } return $return; } home3/cpr76684/public_html/Aem/tag/index.php 0000644 00000011073 15151264152 0014365 0 ustar 00 <?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * @package core_tag * @category tag * @copyright 2007 Luiz Cruz <luiz.laydner@gmail.com> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once('../config.php'); require_once($CFG->dirroot . '/lib/weblib.php'); require_once($CFG->dirroot . '/blog/lib.php'); require_login(); if (empty($CFG->usetags)) { throw new \moodle_exception('tagsaredisabled', 'tag'); } $tagid = optional_param('id', 0, PARAM_INT); // tag id $tagname = optional_param('tag', '', PARAM_TAG); // tag $tagareaid = optional_param('ta', 0, PARAM_INT); // Tag area id. $exclusivemode = optional_param('excl', 0, PARAM_BOOL); // Exclusive mode (show entities in one tag area only). $page = optional_param('page', 0, PARAM_INT); // Page to display. $fromctx = optional_param('from', null, PARAM_INT); $ctx = optional_param('ctx', null, PARAM_INT); $rec = optional_param('rec', 1, PARAM_INT); $edit = optional_param('edit', -1, PARAM_BOOL); $systemcontext = context_system::instance(); if ($tagname) { $tagcollid = optional_param('tc', 0, PARAM_INT); if (!$tagcollid) { // Tag name specified but tag collection was not. Try to guess it. $tags = core_tag_tag::guess_by_name($tagname, '*'); if (count($tags) > 1) { // This tag was found in more than one collection, redirect to search. redirect(new moodle_url('/tag/search.php', array('query' => $tagname))); } else if (count($tags) == 1) { $tag = reset($tags); } } else { if (!$tag = core_tag_tag::get_by_name($tagcollid, $tagname, '*')) { redirect(new moodle_url('/tag/search.php', array('tc' => $tagcollid, 'query' => $tagname))); } } } else if ($tagid) { $tag = core_tag_tag::get($tagid, '*'); } unset($tagid); if (empty($tag)) { redirect(new moodle_url('/tag/search.php')); } if ($ctx && ($context = context::instance_by_id($ctx, IGNORE_MISSING)) && $context->contextlevel >= CONTEXT_COURSE) { list($context, $course, $cm) = get_context_info_array($context->id); require_login($course, false, $cm, false, true); $PAGE->set_secondary_navigation(false); } else { $PAGE->set_context($systemcontext); } $tagcollid = $tag->tagcollid; $pageurl = $tag->get_view_url($exclusivemode, $fromctx, $ctx, $rec); $PAGE->set_url($pageurl); $PAGE->set_subpage($tag->id); $tagnode = $PAGE->navigation->find('tags', null); $tagnode->make_active(); $PAGE->set_pagelayout('standard'); $PAGE->set_blocks_editing_capability('moodle/tag:editblocks'); $buttons = ''; if (has_capability('moodle/tag:manage', context_system::instance())) { $buttons .= $OUTPUT->single_button(new moodle_url('/tag/manage.php'), get_string('managetags', 'tag'), 'GET'); } if ($PAGE->user_allowed_editing()) { if ($edit != -1) { $USER->editing = $edit; } $buttons .= $OUTPUT->edit_button(clone($PAGE->url)); } $PAGE->navbar->add($tagname, $pageurl); $PAGE->set_title(get_string('tag', 'tag') .' - '. $tag->get_display_name()); $PAGE->set_heading($COURSE->fullname); $PAGE->set_button($buttons); // Find all areas in this collection and their items tagged with this tag. $tagareas = core_tag_collection::get_areas($tagcollid); if ($tagareaid) { $tagareas = array_intersect_key($tagareas, array($tagareaid => 1)); } if (!$tagareaid && count($tagareas) == 1) { // Automatically set "exclusive" mode for tag collection with one tag area only. $exclusivemode = 1; } $entities = array(); foreach ($tagareas as $ta) { $entities[] = $tag->get_tag_index($ta, $exclusivemode, $fromctx, $ctx, $rec, $page); } $entities = array_filter($entities); $tagrenderer = $PAGE->get_renderer('core', 'tag'); $pagecontents = $tagrenderer->tag_index_page($tag, array_filter($entities), $tagareaid, $exclusivemode, $fromctx, $ctx, $rec, $page); echo $OUTPUT->header(); echo $pagecontents; echo $OUTPUT->footer(); home3/cpr76684/public_html/Aem/blog/index.php 0000644 00000014342 15151264753 0014546 0 ustar 00 <?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * file index.php * index page to view blogs. if no blog is specified then site wide entries are shown * if a blog id is specified then the latest entries from that blog are shown */ 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'); require_once($CFG->dirroot .'/comment/lib.php'); $id = optional_param('id', null, PARAM_INT); $start = optional_param('formstart', 0, PARAM_INT); $tag = optional_param('tag', '', PARAM_NOTAGS); $userid = optional_param('userid', null, PARAM_INT); $tagid = optional_param('tagid', null, PARAM_INT); $modid = optional_param('modid', null, PARAM_INT); $entryid = optional_param('entryid', null, PARAM_INT); $groupid = optional_param('groupid', null, PARAM_INT); $courseid = optional_param('courseid', null, PARAM_INT); $search = optional_param('search', null, PARAM_RAW); comment::init(); $urlparams = compact('id', 'start', 'tag', 'userid', 'tagid', 'modid', 'entryid', 'groupid', 'courseid', 'search'); foreach ($urlparams as $var => $val) { if (empty($val)) { unset($urlparams[$var]); } } $PAGE->set_url('/blog/index.php', $urlparams); // Correct tagid if a text tag is provided as a param. if (!empty($tag)) { if ($tagrec = $DB->get_record('tag', array('name' => $tag))) { $tagid = $tagrec->id; } else { unset($tagid); } } // Set the userid to the entry author if we have the entry ID. if ($entryid and !isset($userid)) { $entry = new blog_entry($entryid); $userid = $entry->userid; } if (isset($userid) && empty($courseid) && empty($modid)) { $context = context_user::instance($userid); } else if (!empty($courseid) && $courseid != SITEID) { $context = context_course::instance($courseid); } else { $context = context_system::instance(); } $PAGE->set_context($context); if (isset($userid) && $USER->id == $userid && !$PAGE->has_secondary_navigation()) { $blognode = $PAGE->navigation->find('siteblog', null); if ($blognode) { $blognode->make_inactive(); } } // Check basic permissions. if ($CFG->bloglevel == BLOG_GLOBAL_LEVEL) { // Everybody can see anything - no login required unless site is locked down using forcelogin. if ($CFG->forcelogin) { require_login(); } } else if ($CFG->bloglevel == BLOG_SITE_LEVEL) { // Users must log in and can not be guests. require_login(); if (isguestuser()) { // They must have entered the url manually. throw new \moodle_exception('noguest'); } } else if ($CFG->bloglevel == BLOG_USER_LEVEL) { // Users can see own blogs only! with the exception of people with special cap. require_login(); } else { // Weird! throw new \moodle_exception('blogdisable', 'blog'); } if (empty($CFG->enableblogs)) { throw new \moodle_exception('blogdisable', 'blog'); } list($courseid, $userid) = blog_validate_access($courseid, $modid, $groupid, $entryid, $userid); $courseid = (empty($courseid)) ? SITEID : $courseid; if ($courseid != SITEID) { $course = get_course($courseid); require_login($course); } if (!empty($userid)) { $user = core_user::get_user($userid, '*', MUST_EXIST); $PAGE->navigation->extend_for_user($user); } $blogheaders = blog_get_headers(); $rsscontext = null; $filtertype = null; $thingid = null; $rsstitle = ''; if ($CFG->enablerssfeeds) { list($thingid, $rsscontext, $filtertype) = blog_rss_get_params($blogheaders['filters']); if (empty($rsscontext)) { $rsscontext = context_system::instance(); } $rsstitle = $blogheaders['heading']; // Check we haven't started output by outputting an error message. if ($PAGE->state == moodle_page::STATE_BEFORE_HEADER) { blog_rss_add_http_header($rsscontext, $rsstitle, $filtertype, $thingid, $tagid); } } $usernode = $PAGE->navigation->find('user'.$userid, null); if ($usernode && $courseid != SITEID) { $courseblogsnode = $PAGE->navigation->find('courseblogs', null); if ($courseblogsnode) { $courseblogsnode->remove(); } $blogurl = new moodle_url($PAGE->url); $blognode = $usernode->add(get_string('blogscourse', 'blog'), $blogurl); $blognode->make_active(); } if ($courseid != SITEID) { $PAGE->set_heading($course->fullname); echo $OUTPUT->header(); if (!empty($user)) { $backurl = new moodle_url('/user/view.php', ['id' => $user->id, 'course' => $courseid]); echo $OUTPUT->single_button($backurl, get_string('back'), 'get', ['class' => 'mb-3']); $headerinfo = array('heading' => fullname($user), 'user' => $user); echo $OUTPUT->context_header($headerinfo, 2); } } else if (isset($userid)) { $PAGE->set_heading(fullname($user)); echo $OUTPUT->header(); } else if ($courseid == SITEID) { echo $OUTPUT->header(); } echo $OUTPUT->heading($blogheaders['heading'], 2); $bloglisting = new blog_listing($blogheaders['filters']); $bloglisting->print_entries(); if ($CFG->enablerssfeeds) { blog_rss_print_link($rsscontext, $filtertype, $thingid, $tagid, get_string('rssfeed', 'blog')); } echo $OUTPUT->footer(); $eventparams = array( 'other' => array('entryid' => $entryid, 'tagid' => $tagid, 'userid' => $userid, 'modid' => $modid, 'groupid' => $groupid, 'search' => $search, 'fromstart' => $start) ); if (!empty($userid)) { $eventparams['relateduserid'] = $userid; } $eventparams['other']['courseid'] = ($courseid === SITEID) ? 0 : $courseid; $event = \core\event\blog_entries_viewed::create($eventparams); $event->trigger(); home3/cpr76684/public_html/Aem/mod/page/index.php 0000644 00000006635 15151777306 0015327 0 ustar 00 <?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * List of all pages in course * * @package mod_page * @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require('../../config.php'); $id = required_param('id', PARAM_INT); // course id $course = $DB->get_record('course', array('id'=>$id), '*', MUST_EXIST); require_course_login($course, true); $PAGE->set_pagelayout('incourse'); // Trigger instances list viewed event. $event = \mod_page\event\course_module_instance_list_viewed::create(array('context' => context_course::instance($course->id))); $event->add_record_snapshot('course', $course); $event->trigger(); $strpage = get_string('modulename', 'page'); $strpages = get_string('modulenameplural', 'page'); $strname = get_string('name'); $strintro = get_string('moduleintro'); $strlastmodified = get_string('lastmodified'); $PAGE->set_url('/mod/page/index.php', array('id' => $course->id)); $PAGE->set_title($course->shortname.': '.$strpages); $PAGE->set_heading($course->fullname); $PAGE->navbar->add($strpages); echo $OUTPUT->header(); echo $OUTPUT->heading($strpages); if (!$pages = get_all_instances_in_course('page', $course)) { notice(get_string('thereareno', 'moodle', $strpages), "$CFG->wwwroot/course/view.php?id=$course->id"); exit; } $usesections = course_format_uses_sections($course->format); $table = new html_table(); $table->attributes['class'] = 'generaltable mod_index'; if ($usesections) { $strsectionname = get_string('sectionname', 'format_'.$course->format); $table->head = array ($strsectionname, $strname, $strintro); $table->align = array ('center', 'left', 'left'); } else { $table->head = array ($strlastmodified, $strname, $strintro); $table->align = array ('left', 'left', 'left'); } $modinfo = get_fast_modinfo($course); $currentsection = ''; foreach ($pages as $page) { $cm = $modinfo->cms[$page->coursemodule]; if ($usesections) { $printsection = ''; if ($page->section !== $currentsection) { if ($page->section) { $printsection = get_section_name($course, $page->section); } if ($currentsection !== '') { $table->data[] = 'hr'; } $currentsection = $page->section; } } else { $printsection = '<span class="smallinfo">'.userdate($page->timemodified)."</span>"; } $class = $page->visible ? '' : 'class="dimmed"'; // hidden modules are dimmed $table->data[] = array ( $printsection, "<a $class href=\"view.php?id=$cm->id\">".format_string($page->name)."</a>", format_module_intro('page', $page, $cm->id)); } echo html_writer::table($table); echo $OUTPUT->footer(); home3/cpr76684/public_html/Aem/admin/tool/monitor/index.php 0000644 00000015616 15152011633 0017350 0 ustar 00 <?php // This file is part of Moodle - http://moodle.org/ // // Moodle is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Moodle is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Moodle. If not, see <http://www.gnu.org/licenses/>. /** * This page lets users to manage rules for a given course. * * @package tool_monitor * @copyright 2014 onwards Ankit Agarwal <ankit.agrr@gmail.com> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once(__DIR__ . '/../../../config.php'); require_once($CFG->libdir.'/adminlib.php'); require_once($CFG->dirroot.'/'.$CFG->admin.'/tool/monitor/lib.php'); $courseid = optional_param('courseid', 0, PARAM_INT); $action = optional_param('action', '', PARAM_ALPHA); $cmid = optional_param('cmid', 0, PARAM_INT); $ruleid = optional_param('ruleid', 0, PARAM_INT); $subscriptionid = optional_param('subscriptionid', 0, PARAM_INT); $confirm = optional_param('confirm', false, PARAM_BOOL); $choose = false; // Validate course id. if (empty($courseid)) { require_login(null, false); $context = context_system::instance(); // check system level capability. if (!has_capability('tool/monitor:subscribe', $context)) { // If not system level then check to see if they have access to any course level rules. if (tool_monitor_can_subscribe()) { // Make them choose a course. $choose = true; } else { // return error. throw new \moodle_exception('rulenopermission', 'tool_monitor'); } } } else { // They might want to see rules for this course. $course = get_course($courseid); require_login($course); $context = context_course::instance($course->id); // Check for caps. require_capability('tool/monitor:subscribe', $context); } if (!get_config('tool_monitor', 'enablemonitor')) { // This should never happen as the this page does not appear in navigation when the tool is disabled. throw new coding_exception('Event monitoring is disabled'); } // Use the user context here so that the header shows user information. $PAGE->set_context(context_user::instance($USER->id)); // Set up the page. $indexurl = new moodle_url('/admin/tool/monitor/index.php', array('courseid' => $courseid)); $PAGE->set_url($indexurl); $PAGE->set_pagelayout('report'); $PAGE->set_title(get_string('managesubscriptions', 'tool_monitor')); $PAGE->set_heading(fullname($USER)); $settingsnode = $PAGE->settingsnav->find('monitor', null); if ($settingsnode) { $settingsnode->make_active(); } // Create/delete subscription if needed. if (!empty($action)) { require_sesskey(); switch ($action) { case 'subscribe' : $rule = \tool_monitor\rule_manager::get_rule($ruleid); $rule->subscribe_user($courseid, $cmid); echo $OUTPUT->header(); echo $OUTPUT->notification(get_string('subcreatesuccess', 'tool_monitor'), 'notifysuccess'); break; case 'unsubscribe' : // If the subscription does not exist, then redirect back as the subscription must have already been deleted. if (!$subscription = $DB->record_exists('tool_monitor_subscriptions', array('id' => $subscriptionid))) { redirect(new moodle_url('/admin/tool/monitor/index.php', array('courseid' => $courseid))); } // Set the URLs. $confirmurl = new moodle_url('/admin/tool/monitor/index.php', array('subscriptionid' => $subscriptionid, 'courseid' => $courseid, 'action' => 'unsubscribe', 'confirm' => true, 'sesskey' => sesskey())); $cancelurl = new moodle_url('/admin/tool/monitor/index.php', array('subscriptionid' => $subscriptionid, 'courseid' => $courseid, 'sesskey' => sesskey())); if ($confirm) { \tool_monitor\subscription_manager::delete_subscription($subscriptionid); echo $OUTPUT->header(); echo $OUTPUT->notification(get_string('subdeletesuccess', 'tool_monitor'), 'notifysuccess'); } else { $subscription = \tool_monitor\subscription_manager::get_subscription($subscriptionid); echo $OUTPUT->header(); echo $OUTPUT->confirm(get_string('subareyousure', 'tool_monitor', $subscription->get_name($context)), $confirmurl, $cancelurl); echo $OUTPUT->footer(); exit(); } break; default: } } else { echo $OUTPUT->header(); } $renderer = $PAGE->get_renderer('tool_monitor', 'managesubs'); // Render the course selector. $totalrules = \tool_monitor\rule_manager::count_rules_by_courseid($courseid); $rules = new \tool_monitor\output\managesubs\rules('toolmonitorrules', $indexurl, $courseid); $usercourses = $rules->get_user_courses_select($choose); // There must be user courses otherwise we wouldn't make it this far. echo $renderer->render($usercourses); // Render the current subscriptions list. $totalsubs = \tool_monitor\subscription_manager::count_user_subscriptions(); if (!empty($totalsubs) && !$choose) { // Show the subscriptions section only if there are subscriptions. $subs = new \tool_monitor\output\managesubs\subs('toolmonitorsubs', $indexurl, $courseid); echo $OUTPUT->heading(get_string('currentsubscriptions', 'tool_monitor'), 3); echo $renderer->render($subs); } // Render the potential rules list. if (!$choose) { echo $OUTPUT->heading(get_string('rulescansubscribe', 'tool_monitor'), 3); echo $renderer->render($rules); } // Check if the user can manage the course rules we are viewing. $canmanagerules = has_capability('tool/monitor:managerules', $context); if (empty($totalrules)) { // No rules present. Show a link to manage rules page if permissions permit. echo html_writer::start_div(); echo html_writer::tag('span', get_string('norules', 'tool_monitor')); if ($canmanagerules) { $manageurl = new moodle_url("/admin/tool/monitor/managerules.php", array('courseid' => $courseid)); $a = html_writer::link($manageurl, get_string('managerules', 'tool_monitor')); $link = " "; $link .= html_writer::tag('span', get_string('manageruleslink', 'tool_monitor', $a)); echo $link; } echo html_writer::end_div(); } else if ($canmanagerules) { $manageurl = new moodle_url("/admin/tool/monitor/managerules.php", array('courseid' => $courseid)); echo $renderer->render_rules_link($manageurl); } echo $OUTPUT->footer();
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | ���֧ߧ֧�ѧ�ڧ� ����ѧߧڧ��: 0 |
proxy
|
phpinfo
|
���ѧ����ۧܧ�