--adminuser=USERNAME Username for the moodle admin account. Default is admin.
--adminpass=PASSWORD Password for the moodle admin account.
--agree-license Indicates agreement with software license.
---fullname Name of the site
---shortname Name of the site
+--fullname=STRING Name of the site
+--shortname=STRING Name of the site
-h, --help Print out this help
Example:
if (is_null($otherplugin)) {
$ok = false;
}
- if ($requiredversion != ANY_VERSION and $otherplugin->versiondb < $requiredversion) {
+ if ($requiredversion != ANY_VERSION and $otherplugin->versiondisk < $requiredversion) {
$ok = false;
}
// Experimental settings page
$ADMIN->add('development', new admin_category('experimental', get_string('experimental','admin')));
- require_once($CFG->dirroot .'/search/lib.php');
$temp = new admin_settingpage('experimentalsettings', get_string('experimentalsettings', 'admin'));
- $englobalsearch = new admin_setting_configcheckbox('enableglobalsearch', get_string('enableglobalsearch', 'admin'), get_string('configenableglobalsearch', 'admin'), 0);
- $englobalsearch->set_updatedcallback('search_updatedcallback');
- $temp->add($englobalsearch);
//TODO: Re-enable cc-import once re-implemented in 2.0.x
//$temp->add(new admin_setting_configcheckbox('enableimsccimport', get_string('enable_cc_import', 'imscc'), get_string('enable_cc_import_description', 'imscc'), 0));
$temp->add(new admin_setting_configcheckbox('enablesafebrowserintegration', get_string('enablesafebrowserintegration', 'admin'), get_string('configenablesafebrowserintegration', 'admin'), 0));
$c = '<h3>General information</h3>';
$c .= 'Moodle release: ' . $CFG->release . '<br />';
- $c .= 'PDF producer: ' . PDF_PRODUCER . '<br />';
+ $c .= 'PDF producer: TCPDF ' . $doc->getTCPDFVersion() . ' (http://www.tcpdf.org) <br />';
$c .= 'Font of this test page: ' . $fontfamily . '<br />';
$c .= '<h3>Current settings</h3>';
$c .= '<h3>Installed languages and their alphabets</h3>';
$languages = array();
$langdirs = get_list_of_plugins('lang', '', $CFG->dataroot);
- array_unshift($langdirs, 'Moodle core English');
+ array_unshift($langdirs, 'en');
foreach ($langdirs as $langdir) {
- if ('Moodle core English' == $langdir) {
- $langconfig = $CFG->dirroot . '/lang/en_utf8/langconfig.php';
+ if ('en' == $langdir) {
+ $langconfig = $CFG->dirroot . '/lang/en/langconfig.php';
} else {
$langconfig = $CFG->dataroot . '/lang/' . $langdir . '/langconfig.php';
}
$c .= '<dl>';
foreach ($languages as $langcode => $language) {
$c .= '<dt>' . $language->langname . ' (' . $langcode . ')</dt>';
- $c .= '<dd>' . $language->alphabet . '</dd>';
+ $c .= '<dd>"' . $language->alphabet . '"</dd>';
}
$c .= '</dl>';
$outcome = $restore->process();
if (!$restore->is_independent()) {
if ($restore->get_stage() == restore_ui::STAGE_PROCESS && !$restore->requires_substage()) {
- $restore->execute();
+ try {
+ $restore->execute();
+ } catch(Exception $e) {
+ $restore->cleanup();
+ throw new moodle_exception((string)$e);
+ }
} else {
$restore->save_controller();
}
* @return string
*/
public function course_selector(moodle_url $nextstageurl, $wholecourse = true, restore_category_search $categories = null, restore_course_search $courses=null, $currentcourse = null) {
- global $CFG;
+ global $CFG, $PAGE;
require_once($CFG->dirroot.'/course/lib.php');
$nextstageurl->param('sesskey', sesskey());
$html .= $this->output->heading(get_string('restoretonewcourse', 'backup'), 2, array('class'=>'header'));
$html .= $this->backup_detail_input(get_string('restoretonewcourse', 'backup'), 'radio', 'target', backup::TARGET_NEW_COURSE, array('checked'=>'checked'));
$html .= $this->backup_detail_pair(get_string('selectacategory', 'backup'), $this->render($categories));
- $html .= $this->backup_detail_pair('', html_writer::empty_tag('input', array('type'=>'submit', 'value'=>get_string('continue'))));
+ $html .= $this->backup_detail_pair('', html_writer::empty_tag('input', array('type'=>'submit', 'value'=>get_string('continue'), 'class'=>'newcoursecontinue')));
$html .= html_writer::end_tag('div');
$html .= html_writer::end_tag('form');
+ $config = new stdClass;
+ $config->title = get_string('confirmnewcoursecontinue', 'backup');
+ $config->question = get_string('confirmnewcoursecontinuequestion', 'backup');
+ $config->yesLabel = get_string('continue');
+ $config->noLabel = get_string('cancel');
+ $PAGE->requires->yui_module('moodle-backup-confirmcancel', 'M.core_backup.watch_newcoursecontinue_buttons', array($config));
}
if ($wholecourse && !empty($currentcourse)) {
$this->stage = new restore_ui_stage_complete($this, $this->stage->get_params(), $this->controller->get_results());
return true;
}
+
+ /**
+ * Delete course which is created by restore process
+ */
+ public function cleanup() {
+ $courseid = $this->controller->get_courseid();
+ if ($this->is_temporary_course_created($courseid)) {
+ delete_course($courseid, false);
+ }
+ }
+
+ /**
+ * Checks if the course is not restored fully and current controller has created it.
+ * @param int $courseid id of the course which needs to be checked
+ * @return bool
+ */
+ protected function is_temporary_course_created($courseid) {
+ global $DB;
+ //Check if current controller instance has created new course.
+ if ($this->controller->get_target() == backup::TARGET_NEW_COURSE) {
+ $results = $DB->record_exists_sql("SELECT bc.itemid
+ FROM {backup_controllers} bc, {course} c
+ WHERE bc.operation = 'restore'
+ AND bc.type = 'course'
+ AND bc.itemid = c.id
+ AND bc.itemid = ?",
+ array($courseid)
+ );
+ return $results;
+ }
+ return false;
+ }
+
/**
* Returns true if enforce_dependencies changed any settings
* @return bool
/**
* Cancels the current restore and redirects the user back to the relevant place
*/
- public function cancel_restore() {
- global $PAGE;
- // Determine the approriate URL to redirect the user to
- if ($PAGE->context->contextlevel == CONTEXT_MODULE && $PAGE->cm !== null) {
- $relevanturl = new moodle_url('/mod/'.$PAGE->cm->modname.'/view.php', array('id'=>$PAGE->cm->id));
- } else {
- $relevanturl = new moodle_url('/course/view.php', array('id'=>$PAGE->course->id));
+ public function cancel_process() {
+ //Delete temporary restore course if exists.
+ if ($this->controller->get_target() == backup::TARGET_NEW_COURSE) {
+ $this->cleanup();
}
- redirect($relevanturl);
+ parent::cancel_process();
}
/**
* Gets an array of progress bar items that can be displayed through the restore renderer.
$form = $this->initialise_stage_form();
if ($form->is_cancelled()) {
- $this->ui->cancel_restore();
+ $this->ui->cancel_process();
}
$data = $form->get_data();
});
}
+M.core_backup.watch_newcoursecontinue_buttons = function(config) {
+ Y.all('.newcoursecontinue').each(function(){
+ this._confirmationListener = this._confirmationListener || this.on('click', function(e){
+ // Prevent the default event (sumbit) from firing
+ e.preventDefault();
+ // Create the confirm box
+ var confirm = new M.core.confirm(config);
+ // If the user clicks yes
+ confirm.on('complete-yes', function(e){
+ // Detach the listener for the confirm box so it doesn't fire again.
+ this._confirmationListener.detach();
+ // Simulate the original cancel button click
+ this.simulate('click');
+ }, this);
+ // Show the confirm box
+ confirm.show();
+ }, this);
+ });
+}
+
}, '@VERSION@', {'requires':['base','node','node-event-simulate','moodle-enrol-notification']});
\ No newline at end of file
return true;
}
+
+ /**
+ * The block should only be dockable when the title of the block is not empty
+ * and when parent allows docking.
+ *
+ * @return bool
+ */
+ public function instance_can_be_docked() {
+ return (!empty($this->config->title) && parent::instance_can_be_docked());
+ }
}
+++ /dev/null
-This block is a revamping of the Google Summer Of Code Project (2006) on Global Search engine
-for Moodle. New block version is completed and internationalized according to Moodle multilengual support.
-
-This block instanciates a startup database model for the search engine.
-
-## Installing
-
-You need installing the following elements in order the global search to be available :
-
-1. The global search bloc (this block)
-2. update the /search root package from CVS
-3. The antiword libraries
-4. The xpdf libraries
-
-Both last libraries are provided as a patch called "global_search_libraries" in the contrib section.
\ No newline at end of file
+++ /dev/null
-<?php
-
-/** This is the global search shortcut block - a single query can be entered, and
- * the user will be redirected to the query page where they can enter more
- * advanced queries, and view the results of their search. When searching from
- * this block, the broadest possible selection of documents is searched.
- *
- * @package search
- * @subpackage search block
- * @author: Michael Champanis (mchampan), reengineered by Valery Fremaux
- * @date: 2006 06 25
- */
-
-class block_search extends block_base {
-
- function init() {
- $this->title = get_string('pluginname', 'block_search');
- } //init
-
- // only one instance of this block is required
- function instance_allow_multiple() {
- return false;
- } //instance_allow_multiple
-
- // label and button values can be set in admin
- function has_config() {
- return true;
- } //has_config
-
- function get_content() {
- global $CFG;
-
- if (empty($CFG->enableglobalsearch)) {
- return '';
- }
-
- //cache block contents
- if ($this->content !== NULL) {
- return $this->content;
- } //if
-
- $this->content = new stdClass;
-
- //basic search form
- $this->content->text =
- '<form id="searchquery" method="get" action="'. $CFG->wwwroot .'/search/query.php"><div>'
- . '<label for="block_search_q">' . get_string('searchmoodle', 'block_search') . '</label>'
- . '<input id="block_search_q" type="text" name="query_string" />'
- . '<input id="block_instance_id" type="hidden" name="block_instanceid" value="' . $this->instance->id . '"/>'
- . '<input type="submit" value="' . s(get_string('go', 'block_search')) . '" />'
- . '</div></form>';
-
- //no footer, thanks
- $this->content->footer = '';
-
- return $this->content;
- } //get_content
-
- function specialisation() {
- //empty!
- } //specialisation
-
- /**
- * wraps up to search engine cron
- */
- function cron(){
- global $CFG;
-
- include($CFG->dirroot.'/search/cron.php');
- }
-
- } //block_search
-
+++ /dev/null
-<?php
-
-function xmldb_block_search_install() {
- global $DB;
-
- // Disable this block by default as its experimental.
- $DB->set_field('block', 'visible', 0, array('name'=>'search'));
-
-}
-
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="blocks/search/db" VERSION="20101012" COMMENT="XMLDB file for Moodle search engine"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
->
- <TABLES>
- <TABLE NAME="block_search_documents" COMMENT="table to store search index backups">
- <FIELDS>
- <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="docid"/>
- <FIELD NAME="docid" TYPE="char" LENGTH="32" NOTNULL="true" SEQUENCE="false" PREVIOUS="id" NEXT="doctype"/>
- <FIELD NAME="doctype" TYPE="char" LENGTH="32" NOTNULL="true" DEFAULT="none" SEQUENCE="false" PREVIOUS="docid" NEXT="itemtype"/>
- <FIELD NAME="itemtype" TYPE="char" LENGTH="32" NOTNULL="true" DEFAULT="standard" SEQUENCE="false" PREVIOUS="doctype" NEXT="title"/>
- <FIELD NAME="title" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" PREVIOUS="itemtype" NEXT="url"/>
- <FIELD NAME="url" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" PREVIOUS="title" NEXT="docdate"/>
- <FIELD NAME="docdate" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="url" NEXT="updated"/>
- <FIELD NAME="updated" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="docdate" NEXT="courseid"/>
- <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="updated" NEXT="groupid"/>
- <FIELD NAME="groupid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="courseid"/>
- </FIELDS>
- <KEYS>
- <KEY NAME="primary" TYPE="primary" FIELDS="id" />
- </KEYS>
- <INDEXES>
- <INDEX NAME="mdl_search_docid" UNIQUE="false" FIELDS="docid" NEXT="mdl_search_doctype"/>
- <INDEX NAME="mdl_search_doctype" UNIQUE="false" FIELDS="doctype" PREVIOUS="mdl_search_docid" NEXT="mdl_search_itemtype"/>
- <INDEX NAME="mdl_search_itemtype" UNIQUE="false" FIELDS="itemtype" PREVIOUS="mdl_search_doctype"/>
- </INDEXES>
- </TABLE>
- </TABLES>
-</XMLDB>
\ No newline at end of file
+++ /dev/null
-<?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/>.
-
-/**
- * Keeps track of upgrades to the global search block
- *
- * @package blocks
- * @subpackage search
- * @copyright 2010 Aparup Banerjee <aparup@moodle.com>
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-defined('MOODLE_INTERNAL') || die();
-
-function xmldb_block_search_upgrade($oldversion) {
- global $CFG, $DB;
-
- require('upgradelib.php');
- $result = TRUE;
- $dbman = $DB->get_manager();
-
- if ($oldversion < 2010101800) {
- // See MDL-24374
- // Changing type of field docdate on table block_search_documents to int
- // Changing type of field updated on table block_search_documents to int
- $table = new xmldb_table('block_search_documents');
-
- $field_docdate_new = new xmldb_field('docdate_new', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'docdate');
- $field_updated_new = new xmldb_field('updated_new', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'updated');
- $field_docdate_old = new xmldb_field('docdate');
- $field_updated_old = new xmldb_field('updated');
-
- // Conditionally launch add temporary fields
- if (!$dbman->field_exists($table, $field_docdate_new)) {
- $dbman->add_field($table, $field_docdate_new);
- }
- if (!$dbman->field_exists($table, $field_updated_new)) {
- $dbman->add_field($table, $field_updated_new);
- }
-
- $sql = "SELECT id, docdate, updated FROM {block_search_documents}";
- $search_documents = $DB->get_records_sql($sql);
- if ($search_documents) {
- foreach ($search_documents as $sd) {
- $sd->docdate_new = convert_datetime_upgrade($sd->docdate);
- $sd->updated_new = convert_datetime_upgrade($sd->updated);
- $DB->update_record('block_search_documents', $sd);
- }
- }
- // Conditionally launch drop the old fields
- if ($dbman->field_exists($table, $field_docdate_old)) {
- $dbman->drop_field($table, $field_docdate_old);
- }
- if ($dbman->field_exists($table, $field_updated_old)) {
- $dbman->drop_field($table, $field_updated_old);
- }
-
- //rename the new fields to the original field names.
- $dbman->rename_field($table, $field_docdate_new, 'docdate');
- $dbman->rename_field($table, $field_updated_new, 'updated');
-
- // search savepoint reached
- upgrade_block_savepoint(true, 2010101800, 'search');
- }
-
- if ($oldversion < 2010110900) {
- unset_config('block_search_text');
- unset_config('block_search_button');
- upgrade_block_savepoint(true, 2010110900, 'search');
- }
-
- if ($oldversion < 2010111100) {
- // set block to hidden if global search is disabled.
- if ($CFG->enableglobalsearch != 1) {
- $DB->set_field('block', 'visible', 0, array('name'=>'search')); // Hide block
- }
- upgrade_block_savepoint(true, 2010111100, 'search');
- }
- return $result;
-}
+++ /dev/null
-<?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/>.
-
-/**
- * Strings for component 'block_search', language 'en', branch 'MOODLE_20_STABLE'
- *
- * @package block_search
- * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-$string['blockssearchswitches'] = 'Indexer activation for blocks';
-$string['bytes'] = 'bytes (0 stands for no limits)';
-$string['configenablefileindexing'] = 'Enable file indexing';
-$string['configfiletypes'] = 'File types handled';
-$string['configlimitindexbody'] = 'Indexed body size limitation';
-$string['configpdftotextcmd'] = 'Path to command pdftotext';
-$string['configtypetotxtcmd'] = 'Converter\'s command line';
-$string['configtypetotxtenv'] = 'Environment define for converter';
-$string['configwordtotextcmd'] = 'Path to command doctotext';
-$string['configwordtotextenv'] = 'Environment setting for the MSWord converter';
-$string['cmdtoconverttotextfor'] = 'Command to convert {$a} to text';
-$string['enablefileindexing'] = 'Turn on indexing of different file types';
-$string['enableindexinginmodule'] = 'Allow indexing of the {$a} module';
-$string['enableindexinginblock'] = 'Allow indexing of the {$a} block';
-$string['envforcmdtotextfor'] = 'Environment for {$a} conversion command to text';
-$string['go'] = 'Go!';
-$string['handlingfor'] = 'Extra handling for';
-$string['indexbodylimit'] = 'The limit of indexing the body';
-$string['listoffiletypes'] = 'The list of file types handled';
-$string['modulessearchswitches'] = 'Indexer activation for modules';
-$string['nosearchableblocks'] = 'No searchable blocks';
-$string['nosearchablemodules'] = 'No searchable modules';
-$string['pdfhandling'] = 'Acrobat PDF handling';
-$string['pdftotextcmd'] = 'Command to convert PDF to text';
-$string['pluginname'] = 'Global search';
-$string['searchdiscovery'] = 'Searchable items discovery';
-$string['searchmoodle'] = 'Search Moodle';
-$string['usemoodleroot'] = 'Use moodle root for external converters';
-$string['usemoodlerootdescription'] = 'Use moodle root for external converters';
-$string['wordhandling'] = 'Microsoft Word handling';
-$string['wordtotextcmd'] = 'Command to convert Microsoft Word to text';
-$string['wordtotextenv'] = 'Environment setup for Microsoft Word to text converter';
+++ /dev/null
-<?php
-
-defined('MOODLE_INTERNAL') || die;
-
-if ($ADMIN->fulltree) {
-
- //Enable file indexing (y/n)
- $settings->add(new admin_setting_configcheckbox('block_search_enable_file_indexing', get_string('configenablefileindexing', 'block_search'),
- get_string('enablefileindexing', 'block_search'), 0, 1, 0));
-
- //file types
- $defaultfiletypes = 'PDF,TXT,HTML,PPT,XML,DOC,HTM';
- $settings->add(new admin_setting_configtext('block_search_filetypes', get_string('configfiletypes', 'block_search'),
- get_string('listoffiletypes', 'block_search'), $defaultfiletypes, PARAM_TEXT));
-
- // usemoodleroot
- $settings->add(new admin_setting_configcheckbox('block_search_usemoodleroot', get_string('usemoodleroot', 'block_search'),
- get_string('usemoodlerootdescription', 'block_search'), 1, 1, 0));
-
- //limit_index_body
- $settings->add(new admin_setting_configtext('block_search_limit_index_body', get_string('configlimitindexbody', 'block_search'),
- get_string('indexbodylimit', 'block_search'), '', PARAM_INT));
-
- //setup default paths for following configs.
- if ($CFG->ostype == 'WINDOWS') {
- $default_pdf_to_text_cmd = "lib/xpdf/win32/pdftotext.exe -eol dos -enc UTF-8 -q";
- $default_word_to_text_cmd = "lib/antiword/win32/antiword/antiword.exe ";
- $default_word_to_text_env = "HOME={$CFG->dirroot}\\lib\\antiword\\win32";
- } else {
- $default_pdf_to_text_cmd = "lib/xpdf/linux/pdftotext -enc UTF-8 -eol unix -q";
- $default_word_to_text_cmd = "lib/antiword/linux/usr/bin/antiword";
- $default_word_to_text_env = "ANTIWORDHOME={$CFG->dirroot}/lib/antiword/linux/usr/share/antiword";
- }
-
- //pdf_to_text_cmd
- $settings->add(new admin_setting_configtext('block_search_pdf_to_text_cmd', get_string('configpdftotextcmd', 'block_search'),
- get_string('pdftotextcmd', 'block_search'), $default_pdf_to_text_cmd, PARAM_RAW, 60));
-
- //word_to_text_cmd
- $settings->add(new admin_setting_configtext('block_search_word_to_text_cmd', get_string('configwordtotextcmd', 'block_search'),
- get_string('wordtotextcmd', 'block_search'), $default_word_to_text_cmd, PARAM_RAW, 60));
-
- //word_to_text_env
- $settings->add(new admin_setting_configtext('block_search_word_to_text_env', get_string('configwordtotextenv', 'block_search'),
- get_string('wordtotextenv', 'block_search'), $default_word_to_text_env, PARAM_RAW, 60));
-
-
- // modules activations
- if (isset($CFG->block_search_filetypes)) {
- $types = explode(',', $CFG->block_search_filetypes);
- } else {
- $types = explode(',', $defaultfiletypes);
- }
-
- if (!empty($types)) {
- foreach($types as $type) {
- $utype = strtoupper($type);
- $type = strtolower($type);
- $type = trim($type);
- if (preg_match("/\\b$type\\b/i", $defaultfiletypes)) continue;
-
- //header
- $propname = 'block_search_'.$type.'_to_text';
- $settings->add(new admin_setting_heading($propname, get_string('handlingfor', 'block_search').' '.$utype , ''));
-
- //word_to_text_cmd
- $propname = 'block_search_'.$type.'_to_text_cmd';
- $settings->add(new admin_setting_configtext($propname, get_string('configtypetotxtcmd', 'block_search'),
- get_string('cmdtoconverttotextfor', 'block_search', $type), '', PARAM_PATH, 60));
-
- //word_to_text_env
- $propname = 'block_search_'.$type.'_to_text_env';
- $settings->add(new admin_setting_configtext($propname, get_string('configtypetotxtenv', 'block_search'),
- get_string('envforcmdtotextfor', 'block_search', $type), '', PARAM_PATH, 60));
-
- }
- }
-
- require_once($CFG->dirroot.'/search/lib.php' );
- $searchnames = search_collect_searchables(true, false);
- list($searchable_list, $params) = $DB->get_in_or_equal($searchnames);
-
- //header
- $propname = 'block_search_'.$type.'_to_text';
- $settings->add(new admin_setting_heading($propname, get_string('searchdiscovery', 'block_search') , ''));
-
- $found_searchable_modules = 0;
- if ($modules = $DB->get_records_select('modules', "name $searchable_list", $params, 'name', 'id,name')){
- foreach($modules as $module){
- $keyname = 'search_in_'.$module->name;
- $settings->add(new admin_setting_configcheckbox($keyname, get_string('modulename', $module->name),
- get_string('enableindexinginmodule', 'block_search', $module->name), 1, 1, 0));
- $found_searchable_modules = 1;
- }
- }
-
- if (!$found_searchable_modules) {
- //header
- $propname = 'block_search_nosearchablemodules';
- $settings->add(new admin_setting_heading($propname, get_string('nosearchablemodules', 'block_search') , ''));
- }
-
- //header
- $propname = 'block_search_searchswitches';
- $settings->add(new admin_setting_heading($propname, get_string('blockssearchswitches', 'block_search') , ''));
-
- $found_searchable_blocks = 0;
- if ($blocks = $DB->get_records_select('block', "name $searchable_list", $params, 'name', 'id,name')){
- foreach($blocks as $block){
- $keyname = 'search_in_'.$block->name;
- $settings->add(new admin_setting_configcheckbox($keyname, get_string('pluginname', 'block_'.$block->name),
- get_string('enableindexinginblock', 'block_search', $block->name), 1, 1, 0));
- $found_searchable_blocks = 1;
- }
- }
- if (!$found_searchable_blocks) {
- //header
- $propname = 'block_search_nosearchableblocks';
- $settings->add(new admin_setting_heading($propname, get_string('nosearchableblocks', 'block_search') , ''));
- }
-
-}
-
$id = optional_param( 'id',0,PARAM_INT );
- $seturl = new moodle_url('/calendar/set.php', array('return' => $returnurl));
+ $seturl = new moodle_url('/calendar/set.php', array('return' => base64_encode($returnurl->out(false)), 'sesskey'=>sesskey()));
$content = '<table>';
$content .= '<tr>';
$output .= html_writer::start_tag('tr');
// Global events
- $link = new moodle_url(CALENDAR_URL.'set.php', array('var' => 'showglobal', 'return' => $returnurl));
+ $link = new moodle_url(CALENDAR_URL.'set.php', array('var' => 'showglobal', 'return' => base64_encode($returnurl->out(false)), 'sesskey'=>sesskey()));
if (calendar_show_event_type(CALENDAR_EVENT_GLOBAL)) {
$output .= html_writer::tag('td', '', array('class'=>'calendar_event_global', 'style'=>'width:8px;'));
$output .= html_writer::tag('td', html_writer::tag('strong', get_string('globalevents', 'calendar')).' '.get_string('shown', 'calendar').' ('.html_writer::link($link, get_string('clickhide', 'calendar')).')');
}
// Course events
- $link = new moodle_url(CALENDAR_URL.'set.php', array('var'=>'showcourses', 'return' => $returnurl));
+ $link = new moodle_url(CALENDAR_URL.'set.php', array('var'=>'showcourses', 'return' => base64_encode($returnurl->out(false)), 'sesskey'=>sesskey()));
if (calendar_show_event_type(CALENDAR_EVENT_COURSE)) {
$output .= html_writer::tag('td', '', array('class'=>'calendar_event_course', 'style'=>'width:8px;'));
$output .= html_writer::tag('td', html_writer::tag('strong', get_string('courseevents', 'calendar')).' '.get_string('shown', 'calendar').' ('.html_writer::link($link, get_string('clickhide', 'calendar')).')');
if(isloggedin() && !isguestuser()) {
$output .= html_writer::start_tag('tr');
// Group events
- $link = new moodle_url(CALENDAR_URL.'set.php', array('var'=>'showgroups', 'return' => $returnurl));
+ $link = new moodle_url(CALENDAR_URL.'set.php', array('var'=>'showgroups', 'return' => base64_encode($returnurl->out(false)), 'sesskey'=>sesskey()));
if (calendar_show_event_type(CALENDAR_EVENT_GROUP)) {
$output .= html_writer::tag('td', '', array('class'=>'calendar_event_group', 'style'=>'width:8px;'));
$output .= html_writer::tag('td', html_writer::tag('strong', get_string('groupevents', 'calendar')).' '.get_string('shown', 'calendar').' ('.html_writer::link($link, get_string('clickhide', 'calendar')).')');
$output .= html_writer::tag('td', html_writer::tag('strong', get_string('groupevents', 'calendar')).' '.get_string('hidden', 'calendar').' ('.html_writer::link($link, get_string('clickshow', 'calendar')).')');
}
// User events
- $link = new moodle_url(CALENDAR_URL.'set.php', array('var'=>'showuser', 'return' => $returnurl));
+ $link = new moodle_url(CALENDAR_URL.'set.php', array('var'=>'showuser', 'return' => base64_encode($returnurl->out(false)), 'sesskey'=>sesskey()));
if (calendar_show_event_type(CALENDAR_EVENT_USER)) {
$output .= html_writer::tag('td', '', array('class'=>'calendar_event_user', 'style'=>'width:8px;'));
$output .= html_writer::tag('td', html_writer::tag('strong', get_string('userevents', 'calendar')).' '.get_string('shown', 'calendar').' ('.html_writer::link($link, get_string('clickhide', 'calendar')).')');
} else {
$selected = '';
}
- $select = new single_select(new moodle_url(CALENDAR_URL.'set.php', array('return' => $returnurl, 'var' => 'setcourse')), 'id', $courseoptions, $selected, null);
+ $select = new single_select(new moodle_url(CALENDAR_URL.'set.php', array('return' => base64_encode($returnurl->out(false)), 'var' => 'setcourse', 'sesskey'=>sesskey())), 'id', $courseoptions, $selected, null);
$select->class = 'cal_courses_flt';
if ($label !== null) {
$select->label = $label;
require_once('../config.php');
require_once($CFG->dirroot.'/calendar/lib.php');
-$return = required_param('return', PARAM_URL);
+require_sesskey();
+
$var = required_param('var', PARAM_ALPHA);
+$return = clean_param(base64_decode(required_param('return', PARAM_RAW)), PARAM_URL);
-$url = new moodle_url('/calendar/set.php', array('return'=>$return,'var'=>$var));
+$url = new moodle_url('/calendar/set.php', array('return'=>base64_encode($return),'var'=>$var, 'sesskey'=>sesskey()));
$PAGE->set_url($url);
-$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM)); //TODO: wrong
+$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
switch($var) {
case 'showgroups':
break;
}
-redirect($return);
\ No newline at end of file
+redirect($return);
if (!empty($info->extraclasses)) {
$mod[$seq]->extraclasses = $info->extraclasses;
}
+ if (!empty($info->iconurl)) {
+ $mod[$seq]->iconurl = $info->iconurl;
+ }
if (!empty($info->onclick)) {
$mod[$seq]->onclick = $info->onclick;
}
// Minimise the database size by unsetting default options when they are
// 'empty'. This list corresponds to code in the cm_info constructor.
foreach (array('idnumber', 'groupmode', 'groupingid', 'groupmembersonly',
- 'indent', 'completion', 'extra', 'extraclasses', 'onclick', 'content',
+ 'indent', 'completion', 'extra', 'extraclasses', 'iconurl', 'onclick', 'content',
'icon', 'iconcomponent', 'customdata', 'showavailability', 'availablefrom',
'availableuntil', 'conditionscompletion', 'conditionsgrade',
'completionview', 'completionexpected', 'score', 'showdescription')
$PAGE->navbar->add(get_string('enrolmentoptions','enrol'));
echo $OUTPUT->header();
+echo $OUTPUT->heading(get_string('enrolmentoptions','enrol'));
//TODO: find if future enrolments present and display some info
$startdateoptions = array();
$timeformat = get_string('strftimedatefullshort');
if ($startdate > 0) {
- $today = time();
- $today = make_timestamp(date('Y', $today), date('m', $today), date('d', $today), 0, 0, 0);
$startdateoptions[2] = get_string('coursestart') . ' (' . userdate($startdate, $timeformat) . ')';
}
+ $today = time();
+ $today = make_timestamp(date('Y', $today), date('m', $today), date('d', $today), 0, 0, 0);
$startdateoptions[3] = get_string('today') . ' (' . userdate($today, $timeformat) . ')' ;
$modules = array('moodle-enrol_manual-quickenrolment', 'moodle-enrol_manual-quickenrolment-skin');
$string['maxenrolled'] = 'Max enrolled users';
$string['maxenrolled_help'] = 'Specifies the maximum number of users that can self enrol. 0 means no limit.';
$string['maxenrolledreached'] = 'Maximum number of users allowed to self-enrol was already reached.';
+$string['nopassword'] = 'No enrolment key required.';
$string['password'] = 'Enrolment key';
$string['password_help'] = 'An enrolment key enables access to the course to be restricted to only those who know the key.
return null;
}
- if ($instance->customint3 > 0) {
- // max enrol limit specified
- $count = $DB->count_records('user_enrolments', array('enrolid'=>$instance->id));
- if ($count >= $instance->customint3) {
- // bad luck, no more self enrolments here
- return $OUTPUT->notification(get_string('maxenrolledreached', 'enrol_self'));
- }
- }
-
require_once("$CFG->dirroot/enrol/self/locallib.php");
require_once("$CFG->dirroot/group/lib.php");
class enrol_self_enrol_form extends moodleform {
protected $instance;
+ protected $toomany = false;
/**
* Overriding this function to get unique form id for multiple self enrolments
}
public function definition() {
+ global $DB;
+
$mform = $this->_form;
$instance = $this->_customdata;
$this->instance = $instance;
$plugin = enrol_get_plugin('self');
+ $heading = $plugin->get_instance_name($instance);
+ $mform->addElement('header', 'selfheader', $heading);
+
+ if ($instance->customint3 > 0) {
+ // max enrol limit specified
+ $count = $DB->count_records('user_enrolments', array('enrolid'=>$instance->id));
+ if ($count >= $instance->customint3) {
+ // bad luck, no more self enrolments here
+ $this->toomany = true;
+ $mform->addElement('static', 'notice', '', get_string('maxenrolledreached', 'enrol_self'));
+ return;
+ }
+ }
+
if ($instance->password) {
- $heading = $plugin->get_instance_name($instance);
- $mform->addElement('header', 'selfheader', $heading);
//change the id of self enrolment key input as there can be multiple self enrolment methods
$mform->addElement('passwordunmask', 'enrolpassword', get_string('password', 'enrol_self'),
array('id' => $instance->id."_enrolpassword"));
} else {
- // nothing?
+ $mform->addElement('static', 'nokey', '', get_string('nopassword', 'enrol_self'));
}
$this->add_action_buttons(false, get_string('enrolme', 'enrol_self'));
$errors = parent::validation($data, $files);
$instance = $this->instance;
+ if ($this->toomany) {
+ $errors['notice'] = get_string('error');
+ return $errors;
+ }
+
if ($instance->password) {
if ($data['enrolpassword'] !== $instance->password) {
if ($instance->customint1) {
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2010090501;
+$plugin->version = 2010090502;
$plugin->cron = 180;
\ No newline at end of file
--- /dev/null
+<?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/>.
+
+/**
+ * Database activity filter post install hook
+ *
+ * @package filter
+ * @subpackage data
+ * @copyright 2011 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+function xmldb_filter_data_install() {
+ global $DB;
+
+ // If the legacy mod/data filter is installed we need to:
+ // 1- Delete new filter (filter_active and filter_config) information, in order to
+ // 2- Usurpate the identity of the legacy filter by moving all its
+ // information to filter/data
+ // If the legacy mod/data filter was not installed, no action is needed
+ if ($DB->record_exists('filter_active', array('filter' => 'mod/data'))) {
+ $DB->delete_records('filter_active', array('filter' => 'filter/data'));
+ $DB->set_field('filter_active', 'filter', 'filter/data', array('filter' => 'mod/data'));
+ }
+}
--- /dev/null
+<?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 filter provides automatic linking to database activity entries
+ * when found inside every Moodle text.
+ *
+ * @package filter
+ * @subpackage data
+ * @copyright 2006 Vy-Shane Sin Fat
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Database activity filtering
+ */
+class filter_data extends moodle_text_filter {
+
+ public function filter($text, array $options = array()) {
+ global $CFG, $DB;
+
+ // Trivial-cache - keyed on $cachedcontextid
+ static $cachedcontextid;
+ static $contentlist;
+
+ static $nothingtodo;
+
+ // Try to get current course
+ if (!$courseid = get_courseid_from_context($this->context)) {
+ $courseid = 0;
+ }
+
+ // Initialise/invalidate our trivial cache if dealing with a different context
+ if (!isset($cachedcontextid) || $cachedcontextid !== $this->context->id) {
+ $cachedcontextid = $this->context->id;
+ $contentlist = array();
+ $nothingtodo = false;
+ }
+
+ if ($nothingtodo === true) {
+ return $text;
+ }
+
+ // Create a list of all the resources to search for. It may be cached already.
+ if (empty($contentlist)) {
+ $coursestosearch = $courseid ? array($courseid) : array(); // Add courseid if found
+ if (get_site()->id != $courseid) { // Add siteid if was not courseid
+ $coursestosearch[] = get_site()->id;
+ }
+ // We look for text field contents only if have autolink enabled (param1)
+ list ($coursesql, $params) = $DB->get_in_or_equal($coursestosearch);
+ $sql = 'SELECT dc.id AS contentid, dr.id AS recordid, dc.content AS content, d.id AS dataid
+ FROM {data} d
+ JOIN {data_fields} df ON df.dataid = d.id
+ JOIN {data_records} dr ON dr.dataid = d.id
+ JOIN {data_content} dc ON dc.fieldid = df.id AND dc.recordid = dr.id
+ WHERE d.course ' . $coursesql . '
+ AND df.type = \'text\'
+ AND ' . $DB->sql_compare_text('df.param1', 1) . ' = 1';
+
+ if (!$contents = $DB->get_records_sql($sql, $params)) {
+ $nothingtodo = true;
+ return $text;
+ }
+
+ foreach ($contents as $key => $content) {
+ // Trim empty or unlinkable concepts
+ $currentcontent = trim(strip_tags($content->content));
+ if (empty($currentcontent)) {
+ unset($contents[$key]);
+ continue;
+ } else {
+ $contents[$key]->content = $currentcontent;
+ }
+
+ // Rule out any small integers. See bug 1446
+ $currentint = intval($currentcontent);
+ if ($currentint && (strval($currentint) == $currentcontent) && $currentint < 1000) {
+ unset($contents[$key]);
+ }
+ }
+
+ if (empty($contents)) {
+ $nothingtodo = true;
+ return $text;
+ }
+
+ usort($contents, 'filter_data::sort_entries_by_length');
+
+ foreach ($contents as $content) {
+ $href_tag_begin = '<a class="data autolink dataid'.$content->dataid.'" title="'.$content->content.'" '.
+ 'href="'.$CFG->wwwroot.'/mod/data/view.php?d='.$content->dataid.
+ '&rid='.$content->recordid.'">';
+ $contentlist[] = new filterobject($content->content, $href_tag_begin, '</a>', false, true);
+ }
+
+ $contentlist = filter_remove_duplicates($contentlist); // Clean dupes
+ }
+ return filter_phrases($text, $contentlist); // Look for all these links in the text
+ }
+
+ private static function sort_entries_by_length($content0, $content1) {
+ $len0 = strlen($content0->content);
+ $len1 = strlen($content1->content);
+
+ if ($len0 < $len1) {
+ return 1;
+ } else if ($len0 > $len1) {
+ return -1;
+ } else {
+ return 0;
+ }
+ }
+}
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
-$plugin->version = 2010111100;
-$plugin->cron = 1;
+/**
+ * Strings for filter_data
+ *
+ * @package filter
+ * @subpackage data
+ * @copyright 2011 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$string['filtername'] = 'Database auto-linking';
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * Global search block upgrade related helper functions
+ * Data activity filter version information
*
- * @package blocks
- * @subpackage search
- * @copyright 2010 Aparup Banerjee
+ * @package filter
+ * @subpackage data
+ * @copyright 2011 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
-/*
-* Function to turn a mysql(datetime) or postgres(timestamp without timezone data) or any generic date string (YYYY-MM-DD HH:MM:SS)
-* read in from a database's date/time field (ie:valid) into a unix timestamp
-* @param str The string to be converted to timestamp
-* @return timestamp or 0
-*/
-
-function convert_datetime_upgrade($str) {
-
- $timestamp = strtotime($str);
- //process different failure returns due to different php versions
- if ($timestamp === false || $timestamp < 1) {
- return 0;
- } else {
- return $timestamp;
- }
-}
+$plugin->version = 2011102800;
+$plugin->requires = 2011102700; // Requires this Moodle version
+$plugin->component= 'filter_data';
+$plugin->dependencies = array('mod_data' => 2011102800);
--- /dev/null
+<?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/>.
+
+/**
+ * Glossary filter post install hook
+ *
+ * @package filter
+ * @subpackage glossary
+ * @copyright 2011 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+function xmldb_filter_glossary_install() {
+ global $DB;
+
+ // If the legacy mod/glossary filter is installed we need to:
+ // 1- Delete new filter (filter_active and filter_config) information, in order to
+ // 2- Usurpate the identity of the legacy filter by moving all its
+ // information to filter/glossary
+ // If the legacy mod/glossary filter was not installed, no action is needed
+ if ($DB->record_exists('filter_active', array('filter' => 'mod/glossary'))) {
+ $DB->delete_records('filter_active', array('filter' => 'filter/glossary'));
+ $DB->set_field('filter_active', 'filter', 'filter/glossary', array('filter' => 'mod/glossary'));
+ }
+}
--- /dev/null
+<?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 filter provides automatic linking to
+ * glossary entries, aliases and categories when
+ * found inside every Moodle text
+ *
+ * @package filter
+ * @subpackage glossary
+ * @copyright 2004 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Glossary filtering
+ *
+ * TODO: erase the $GLOSSARY_EXCLUDECONCEPTS global => require format_text()
+ * to be able to pass arbitrary $options['filteroptions']['glossary'] to filter_text()
+ */
+class filter_glossary extends moodle_text_filter {
+
+ public function filter($text, array $options = array()) {
+ global $CFG, $DB, $GLOSSARY_EXCLUDECONCEPTS, $PAGE;
+
+ // Trivial-cache - keyed on $cachedcontextid
+ static $cachedcontextid;
+ static $conceptlist;
+
+ static $jsinitialised; // To control unique js init
+ static $nothingtodo; // To avoid processing if no glossaries / concepts are found
+
+ // Try to get current course
+ if (!$courseid = get_courseid_from_context($this->context)) {
+ $courseid = 0;
+ }
+
+ // Initialise/invalidate our trivial cache if dealing with a different context
+ if (!isset($cachedcontextid) || $cachedcontextid !== $this->context->id) {
+ $cachedcontextid = $this->context->id;
+ $conceptlist = array();
+ $nothingtodo = false;
+ }
+
+ if ($nothingtodo === true) {
+ return $text;
+ }
+
+ // Create a list of all the concepts to search for. It may be cached already.
+ if (empty($conceptlist)) {
+
+ // Find all the glossaries we need to examine
+ if (!$glossaries = $DB->get_records_sql_menu('
+ SELECT g.id, g.name
+ FROM {glossary} g, {course_modules} cm, {modules} m
+ WHERE m.name = \'glossary\'
+ AND cm.module = m.id
+ AND cm.visible = 1
+ AND g.id = cm.instance
+ AND g.usedynalink != 0
+ AND (g.course = ? OR g.globalglossary = 1)
+ ORDER BY g.globalglossary, g.id', array($courseid))) {
+ $nothingtodo = true;
+ return $text;
+ }
+
+ // Make a list of glossary IDs for searching
+ $glossarylist = implode(',', array_keys($glossaries));
+
+ // Pull out all the raw data from the database for entries, categories and aliases
+ $entries = $DB->get_records_select('glossary_entries',
+ 'glossaryid IN ('.$glossarylist.') AND usedynalink != 0 AND approved != 0 ', null, '',
+ 'id,glossaryid, concept, casesensitive, 0 AS category, fullmatch');
+
+ $categories = $DB->get_records_select('glossary_categories',
+ 'glossaryid IN ('.$glossarylist.') AND usedynalink != 0', null, '',
+ 'id,glossaryid,name AS concept, 1 AS casesensitive, 1 AS category, 1 AS fullmatch');
+
+ $aliases = $DB->get_records_sql('
+ SELECT ga.id, ge.id AS entryid, ge.glossaryid,
+ ga.alias AS concept, ge.concept AS originalconcept,
+ casesensitive, 0 AS category, fullmatch
+ FROM {glossary_alias} ga,
+ {glossary_entries} ge
+ WHERE ga.entryid = ge.id
+ AND ge.glossaryid IN ('.$glossarylist.')
+ AND ge.usedynalink != 0
+ AND ge.approved != 0', null);
+
+ // Combine them into one big list
+ $concepts = array();
+ if ($entries and $categories) {
+ $concepts = array_merge($entries, $categories);
+ } else if ($categories) {
+ $concepts = $categories;
+ } else if ($entries) {
+ $concepts = $entries;
+ }
+
+ if ($aliases) {
+ $concepts = array_merge($concepts, $aliases);
+ }
+
+ if (!empty($concepts)) {
+ foreach ($concepts as $key => $concept) {
+ // Trim empty or unlinkable concepts
+ $currentconcept = trim(strip_tags($concept->concept));
+ if (empty($currentconcept)) {
+ unset($concepts[$key]);
+ continue;
+ } else {
+ $concepts[$key]->concept = $currentconcept;
+ }
+
+ // Rule out any small integers. See bug 1446
+ $currentint = intval($currentconcept);
+ if ($currentint && (strval($currentint) == $currentconcept) && $currentint < 1000) {
+ unset($concepts[$key]);
+ }
+ }
+ }
+
+ if (empty($concepts)) {
+ $nothingtodo = true;
+ return $text;
+ }
+
+ usort($concepts, 'filter_glossary::sort_entries_by_length');
+
+ $strcategory = get_string('category', 'glossary');
+
+ // Loop through all the concepts, setting up our data structure for the filter
+ $conceptlist = array(); // We will store all the concepts here
+
+ foreach ($concepts as $concept) {
+ $glossaryname = str_replace(':', '-', $glossaries[$concept->glossaryid]);
+ if ($concept->category) { // Link to a category
+ // TODO: Fix this string usage
+ $title = strip_tags($glossaryname.': '.$strcategory.' '.$concept->concept);
+ $href_tag_begin = '<a class="glossary autolink category glossaryid'.$concept->glossaryid.'" title="'.$title.'" '.
+ 'href="'.$CFG->wwwroot.'/mod/glossary/view.php?g='.$concept->glossaryid.
+ '&mode=cat&hook='.$concept->id.'">';
+ } else { // Link to entry or alias
+ if (!empty($concept->originalconcept)) { // We are dealing with an alias (so show and point to original)
+ $title = str_replace('"', "'", strip_tags($glossaryname.': '.$concept->originalconcept));
+ $concept->id = $concept->entryid;
+ } else { // This is an entry
+ $title = str_replace('"', "'", strip_tags($glossaryname.': '.$concept->concept));
+ }
+ // hardcoding dictionary format in the URL rather than defaulting
+ // to the current glossary format which may not work in a popup.
+ // for example "entry list" means the popup would only contain
+ // a link that opens another popup.
+ $link = new moodle_url('/mod/glossary/showentry.php', array('courseid'=>$courseid, 'eid'=>$concept->id, 'displayformat'=>'dictionary'));
+ $attributes = array(
+ 'href' => $link,
+ 'title'=> $title,
+ 'class'=> 'glossary autolink concept glossaryid'.$concept->glossaryid);
+
+ // this flag is optionally set by resource_pluginfile()
+ // if processing an embedded file use target to prevent getting nested Moodles
+ if (isset($CFG->embeddedsoforcelinktarget) && $CFG->embeddedsoforcelinktarget) {
+ $attributes['target'] = '_top';
+ }
+
+ $href_tag_begin = html_writer::start_tag('a', $attributes);
+ }
+ $conceptlist[] = new filterobject($concept->concept, $href_tag_begin, '</a>',
+ $concept->casesensitive, $concept->fullmatch);
+ }
+
+ $conceptlist = filter_remove_duplicates($conceptlist);
+
+ if (empty($jsinitialised)) {
+ // Add a JavaScript event to open popup's here. This only ever need to be
+ // added once!
+ $PAGE->requires->yui_module(
+ 'moodle-filter_glossary-autolinker',
+ 'M.filter_glossary.init_filter_autolinking',
+ array(array('courseid' => $courseid)));
+ $jsinitialised = true;
+ }
+ }
+
+ if (!empty($GLOSSARY_EXCLUDECONCEPTS)) {
+ $reducedconceptlist=array();
+ foreach($conceptlist as $concept) {
+ if(!in_array($concept->phrase,$GLOSSARY_EXCLUDECONCEPTS)) {
+ $reducedconceptlist[]=$concept;
+ }
+ }
+ return filter_phrases($text, $reducedconceptlist);
+ }
+
+ return filter_phrases($text, $conceptlist); // Actually search for concepts!
+ }
+
+
+ private static function sort_entries_by_length($entry0, $entry1) {
+ $len0 = strlen($entry0->concept);
+ $len1 = strlen($entry1->concept);
+
+ if ($len0 < $len1) {
+ return 1;
+ } else if ($len0 > $len1) {
+ return -1;
+ } else {
+ return 0;
+ }
+ }
+}
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * Strings for component 'qformat_qti_two', language 'en', branch 'MOODLE_20_STABLE'
+ * Strings for filter_glossary
*
- * @package qformat
- * @subpackage qti_two
- * @copyright 2010 Helen Foster
+ * @package filter
+ * @subpackage glossary
+ * @copyright 2011 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-$string['qti_two'] = 'IMS QTI 2.0 format';
-$string['qti_two_help'] = 'This format enables questions to be exported in the standard IMS QTI format (version 2.0) via a zip file.';
-$string['qti_two_link'] = 'qformat/qti/two';
+defined('MOODLE_INTERNAL') || die();
+
+$string['filtername'] = 'Glossary auto-linking';
--- /dev/null
+#glossaryfilteroverlayprogress {position:fixed;top:50%;width:100%;text-align:center;}
--- /dev/null
+<?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/>.
+
+/**
+ * Glossary filter version information
+ *
+ * @package filter
+ * @subpackage glossary
+ * @copyright 2011 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$plugin->version = 2011102800;
+$plugin->requires = 2011102700; // Requires this Moodle version
+$plugin->component= 'filter_glossary';
+
+$plugin->dependencies = array('mod_glossary' => 2011102800);
-YUI.add('moodle-mod_glossary-autolinker', function(Y) {
+YUI.add('moodle-filter_glossary-autolinker', function(Y) {
- var AUTOLINKERNAME = 'Glossary autolinker',
+ var AUTOLINKERNAME = 'Glossary filter autolinker',
URL = 'url',
POPUPNAME = 'name',
POPUPOPTIONS = 'options',
//display a progress indicator
var title = '';
- var content = Y.Node.create('<div id="glossaryoverlayprogress"><img src="'+M.cfg.loadingicon+'" class="spinner" /></div>');
+ var content = Y.Node.create('<div id="glossaryfilteroverlayprogress"><img src="'+M.cfg.loadingicon+'" class="spinner" /></div>');
var o = new Y.Overlay({
headerContent : title,
bodyContent : content
};
Y.io(fullurl, cfg);
- }, Y.one(document.body), 'a.glossary.autolink');
+ }, Y.one(document.body), 'a.glossary.autolink.concept');
},
display_callback : function(content) {
try {
}
});
- M.mod_glossary = M.mod_glossary || {};
- M.mod_glossary.init_filter_autolinking = function(config) {
+ M.filter_glossary = M.filter_glossary || {};
+ M.filter_glossary.init_filter_autolinking = function(config) {
return new AUTOLINKER(config);
}
-}, '@VERSION@', {requires:['base','node','event-delegate','overlay','moodle-enrol-notification']});
\ No newline at end of file
+}, '@VERSION@', {requires:['base','node','event-delegate','overlay','moodle-enrol-notification']});
}
var loadingImg = document.createElement("img");
- loadingImg.setAttribute("src", M.util.image_url('moodle', '/i/ajaxloader'));
+ loadingImg.setAttribute("src", M.util.image_url('/i/ajaxloader', 'moodle'));
loadingImg.setAttribute("class", elClass);
loadingImg.setAttribute("alt", "Loading");
loadingImg.setAttribute("id", "loaderImg");
$string['availablelangs'] = 'List of available languages';
$string['chooselanguagehead'] = 'Choose a language';
$string['chooselanguagesub'] = 'Please choose a language for the installation. This language will also be used as the default language for the site, though it may be changed later.';
-$string['clialreadyinstalled'] = 'File config.php already exists, please use admin/cli/upgrade.php if you want to upgrade your site.';
+$string['clialreadyconfigured'] = 'File config.php already exists, please use admin/cli/install_database.php if you want to install this site.';
+$string['clialreadyinstalled'] = 'File config.php already exists, please use admin/cli/upgrade.php if you want to upgrade this site.';
$string['cliinstallheader'] = 'Moodle {$a} command line installation program';
$string['databasehost'] = 'Database host';
$string['databasename'] = 'Database name';
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+$string['clianswerno'] = 'ei';
+$string['cliansweryes'] = 'jah';
$string['environmentrequireinstall'] = 'on nõutud, et oleks installeeritud ja võimaldatud';
$string['environmentrequireversion'] = 'versioon {$a->needed} on nõutud, Sinul on jooksmas versioon {$a->current}';
$string['availablelangs'] = 'Liste des langues disponibles';
$string['chooselanguagehead'] = 'Choisissez une langue';
$string['chooselanguagesub'] = 'Veuillez choisir la langue d\'installation. Cette langue sera utilisée comme langue par défaut du site, que vous pourrez modifier ultérieurement.';
-$string['clialreadyinstalled'] = 'Le fichier config.php existe déjà . Veuillez utiliser admin/cli/upgrade.php si vous désirez mettre à jour votre site.';
+$string['clialreadyconfigured'] = 'Le fichier config.php existe déjà . Veuillez utiliser admin/cli/install_database.php si vous désirez mettre à jour ce site.';
+$string['clialreadyinstalled'] = 'Le fichier config.php existe déjà . Veuillez utiliser admin/cli/upgrade.php si vous désirez mettre à jour ce site.';
$string['cliinstallheader'] = 'Programme d\'installation de Moodle {$a} en ligne de commande';
$string['databasehost'] = 'Serveur de base de données';
$string['databasename'] = 'Nom de la base de données';
$string['configenablecalendarexport'] = 'Enable exporting or subscribing to calendars.';
$string['configenablecomments'] = 'Enable comments';
$string['configenablecourserequests'] = 'This will allow any user to request a course be created.';
-$string['configenableglobalsearch'] = 'This setting enables global text searching in resources and activities, it is not compatible with PHP 4.';
$string['configenablegroupmembersonly'] = 'If enabled, access to activities can be restricted to group members only. This may result in an increased server load. In addition, gradebook categories must be set up in a certain way to ensure that activities are hidden from non-group members.';
$string['configenablemobilewebservice'] = 'Enable mobile service for the official Moodle app or other app requesting it. For more information, read the {$a}';
$string['configenablerssfeeds'] = 'This switch will enable RSS feeds from across the site. To actually see any change you will need to enable RSS feeds in the individual modules too - go to the Modules settings under Admin Configuration.';
$string['enablecourseajax_desc'] = 'Allow AJAX when editing main course pages. Note that the course format and the theme must support AJAX editing and the user has to enable AJAX in their profiles, too.';
$string['enablecourserequests'] = 'Enable course requests';
$string['enabledevicedetection'] = 'Enable device detection';
-$string['enableglobalsearch'] = 'Enable global search';
$string['enablegravatar'] = 'Enable Gravatar';
$string['enablegravatar_help'] = 'When enabled Moodle will attempt to fetch a user profile picture from Gravatar if the user has not uploaded an image.';
$string['enablegroupmembersonly'] = 'Enable group members only';
Any information you have entered will be lost.';
$string['confirmcancelyes'] = 'Cancel';
$string['confirmcancelno'] = 'Stay';
+$string['confirmnewcoursecontinue'] = 'New course warning';
+$string['confirmnewcoursecontinuequestion'] = 'A temporary (hidden) course will be created by the course restoration process. To abort restoration click cancel. Do not close the browser while restoring.';
$string['coursecategory'] = 'Category the course will be restored into';
$string['courseid'] = 'Original ID';
$string['coursesettings'] = 'Course settings';
$string['nopermissionadd'] = 'You don\'t have permission to add questions here.';
$string['nopermissionmove'] = 'You don\'t have permission to move questions from here. You must save the question in this category or save it as a new question.';
$string['noprobs'] = 'No problems found in your question database.';
+$string['noquestionsinfile'] = 'There are no questions in the import file';
$string['notenoughanswers'] = 'This type of question requires at least {$a} answers';
$string['notenoughdatatoeditaquestion'] = 'Neither a question id, nor a category id and question type, was specified.';
$string['notenoughdatatomovequestions'] = 'You need to provide the question ids of questions you want to move.';
* of this function can_access_course and require_login. Doing so WILL break future
* versions.
*
- * @param context $context
- * @param stdClass|null $user
+ * @param stdClass $course record
+ * @param stdClass|int|null $user user record or id, current user if null
* @param string $withcapability Check for this capability as well.
* @param bool $onlyactive consider only active enrolments in enabled plugins and time restrictions
- * @param boolean $trustcache If set to false guest access will always be checked
- * against the enrolment plugins from the course, rather
- * than the cache generated by require_login.
* @return boolean Returns true if the user is able to access the course
*/
-function can_access_course(context $context, $user = null, $withcapability = '', $onlyactive = false, $trustcache = true) {
+function can_access_course(stdClass $course, $user = null, $withcapability = '', $onlyactive = false) {
global $DB, $USER;
- $coursecontext = $context->get_course_context();
- $courseid = $coursecontext->instanceid;
+ // this function originally accepted $coursecontext parameter
+ if ($course instanceof context) {
+ if ($course instanceof context_course) {
+ debugging('deprecated context parameter, please use $course record');
+ $coursecontext = $course;
+ $course = $DB->get_record('course', array('id'=>$coursecontext->instanceid));
+ } else {
+ debugging('Invalid context parameter, please use $course record');
+ return false;
+ }
+ } else {
+ $coursecontext = context_course::instance($course->id);
+ }
- // First check the obvious, is the user viewing or is the user enrolled.
- if (is_viewing($coursecontext, $user, $withcapability) || is_enrolled($coursecontext, $user, $withcapability, $onlyactive)) {
- // How easy was that!
+ if (!isset($USER->id)) {
+ // should never happen
+ $USER->id = 0;
+ }
+
+ // make sure there is a user specified
+ if ($user === null) {
+ $userid = $USER->id;
+ } else {
+ $userid = is_object($user) ? $user->id : $user;
+ }
+ unset($user);
+
+ if ($withcapability and !has_capability($withcapability, $coursecontext, $userid)) {
+ return false;
+ }
+
+ if ($userid == $USER->id) {
+ if (!empty($USER->access['rsw'][$coursecontext->path])) {
+ // the fact that somebody switched role means they can access the course no matter to what role they switched
+ return true;
+ }
+ }
+
+ if (!$course->visible and !has_capability('moodle/course:viewhiddencourses', $coursecontext, $userid)) {
+ return false;
+ }
+
+ if (is_viewing($coursecontext, $userid)) {
return true;
}
- $access = false;
+ if ($userid != $USER->id) {
+ // for performance reasons we do not verify temporary guest access for other users, sorry...
+ return is_enrolled($coursecontext, $userid, '', $onlyactive);
+ }
+
+ // === from here we deal only with $USER ===
+
+ // verify our caches
if (!isset($USER->enrol)) {
- // Cache hasn't been generated yet so we can't trust it
- $trustcache = false;
/**
* These flags within the $USER object should NEVER be used outside of this
* function can_access_course and the function require_login.
$USER->enrol['enrolled'] = array();
$USER->enrol['tempguest'] = array();
}
+ if (isset($USER->enrol['enrolled'][$course->id])) {
+ if ($USER->enrol['enrolled'][$course->id] == 0) {
+ return true;
+ } else if ($USER->enrol['enrolled'][$course->id] > time()) {
+ return true;
+ }
+ }
+ if (isset($USER->enrol['tempguest'][$course->id])) {
+ if ($USER->enrol['tempguest'][$course->id] == 0) {
+ return true;
+ } else if ($USER->enrol['tempguest'][$course->id] > time()) {
+ return true;
+ }
+ }
- // If we don't trust the cache we need to check with the courses enrolment
- // plugin instances to see if the user can access the course as a guest.
- if (!$trustcache) {
- // Ok, off to the database we go!
- $instances = $DB->get_records('enrol', array('courseid'=>$courseid, 'status'=>ENROL_INSTANCE_ENABLED), 'sortorder, id ASC');
- $enrols = enrol_get_plugins(true);
- foreach($instances as $instance) {
- if (!isset($enrols[$instance->enrol])) {
- continue;
- }
- $until = $enrols[$instance->enrol]->try_guestaccess($instance);
- if ($until !== false) {
- // Never use me anywhere but here and require_login
- $USER->enrol['tempguest'][$courseid] = $until;
- $access = true;
- break;
- }
+ if (is_enrolled($coursecontext, $USER, '', true)) {
+ // active participants may always access
+ // TODO: refactor this into some new function
+ $now = time();
+ $sql = "SELECT MAX(ue.timeend)
+ FROM {user_enrolments} ue
+ JOIN {enrol} e ON (e.id = ue.enrolid AND e.courseid = :courseid)
+ JOIN {user} u ON u.id = ue.userid
+ WHERE ue.userid = :userid AND ue.status = :active AND e.status = :enabled AND u.deleted = 0
+ AND ue.timestart < :now1 AND (ue.timeend = 0 OR ue.timeend > :now2)";
+ $params = array('enabled'=>ENROL_INSTANCE_ENABLED, 'active'=>ENROL_USER_ACTIVE,
+ 'userid'=>$USER->id, 'courseid'=>$coursecontext->instanceid, 'now1'=>$now, 'now2'=>$now);
+ $until = $DB->get_field_sql($sql, $params);
+ if (!$until or $until > time() + ENROL_REQUIRE_LOGIN_CACHE_PERIOD) {
+ $until = time() + ENROL_REQUIRE_LOGIN_CACHE_PERIOD;
}
+
+ $USER->enrol['enrolled'][$course->id] = $until;
+
+ // remove traces of previous temp guest access
+ remove_temp_course_roles($coursecontext);
+
+ return true;
}
+ unset($USER->enrol['enrolled'][$course->id]);
- // If we don't already have access (from above) check the cache and see whether
- // there is record of it in there.
- if (!$access && isset($USER->enrol['tempguest'][$courseid])) {
- // Never use me anywhere but here and require_login
- if ($USER->enrol['tempguest'][$courseid] == 0) {
- $access = true;
- } else if ($USER->enrol['tempguest'][$courseid] > time()) {
- $access = true;
- } else {
- //expired
- unset($USER->enrol['tempguest'][$courseid]);
+ // if not enrolled try to gain temporary guest access
+ $instances = $DB->get_records('enrol', array('courseid'=>$course->id, 'status'=>ENROL_INSTANCE_ENABLED), 'sortorder, id ASC');
+ $enrols = enrol_get_plugins(true);
+ foreach($instances as $instance) {
+ if (!isset($enrols[$instance->enrol])) {
+ continue;
+ }
+ // Get a duration for the guestaccess, a timestamp in the future or false.
+ $until = $enrols[$instance->enrol]->try_guestaccess($instance);
+ if ($until !== false) {
+ $USER->enrol['tempguest'][$course->id] = $until;
+ return true;
}
}
- return $access;
+ unset($USER->enrol['tempguest'][$course->id]);
+
+ return false;
}
/**
upgrade_main_savepoint(true, 2011101900.02);
}
+ if ($oldversion < 2011102700.01) {
+ // purge everything related to abandoned experimental global search
+
+ // unset setting - this disables it in case user does not delete the dirs
+ unset_config('enableglobalsearch');
+
+ // Delete block, instances and db table
+ $table = new xmldb_table('block_search_documents');
+ if ($dbman->table_exists($table)) {
+ $instances = $DB->get_records('block_instances', array('blockname'=>'search'));
+ foreach($instances as $instance) {
+ context_helper::delete_instance(CONTEXT_BLOCK, $instance->id);
+ $DB->delete_records('block_positions', array('blockinstanceid' => $instance->id));
+ $DB->delete_records('block_instances', array('id' => $instance->id));
+ }
+ $DB->delete_records('block', array('name'=>'search'));
+
+ $dbman->drop_table($table);
+ }
+
+ // purge all settings used by the search block
+ $like = $DB->sql_like('name', '?', true, true, false, '|');
+ $params = array($DB->sql_like_escape('block_search_', '|') . '%', $DB->sql_like_escape('search_in_', '|') . '%');
+ $settings = $DB->get_records_select('config', "$like OR $like", $params);
+ foreach ($settings as $setting) {
+ unset_config($setting->name);
+ }
+
+ upgrade_main_savepoint(true, 2011102700.01);
+ }
+
+
return true;
}
$inserted = true;
}
- if ($roleid) {
- if ($this->roles_protected()) {
- role_assign($roleid, $userid, $context->id, 'enrol_'.$name, $instance->id);
- } else {
- role_assign($roleid, $userid, $context->id);
- }
- }
-
if ($inserted) {
// add extra info and trigger event
$ue->courseid = $courseid;
events_trigger('user_enrol_modified', $ue);
}
+ if ($roleid) {
+ // this must be done after the enrolment event so that the role_assigned event is trigerred aftwerwards
+ if ($this->roles_protected()) {
+ role_assign($roleid, $userid, $context->id, 'enrol_'.$name, $instance->id);
+ } else {
+ role_assign($roleid, $userid, $context->id);
+ }
+ }
+
// reset primitive require_login() caching
if ($userid == $USER->id) {
if (isset($USER->enrol['enrolled'][$courseid])) {
<node ID="_Freemind_Link_810187762" TEXT=".wmv"/>
<node ID="_Freemind_Link_763870397" TEXT=".asf"/>
<node TEXT=".ogv"/>
+<node TEXT=".f4v"/>
+<node TEXT=".m4v"/>
+<node TEXT=".webm"/>
</node>
<node ID="_Freemind_Link_1019644700" TEXT="non_web_video">
<node ID="_Freemind_Link_190589975" TEXT=".avi"/>
function filter_get_all_installed() {
global $CFG;
$filternames = array();
+ // TODO: deprecated in 2.2, delete support for "mod" legacy filters location in 2.3. MDL-29996
$filterlocations = array('mod', 'filter');
foreach ($filterlocations as $filterlocation) {
+ // TODO: move get_list_of_plugins() to get_plugin_list()
$filters = get_list_of_plugins($filterlocation);
foreach ($filters as $filter) {
+ // MDL-29994 - Ignore mod/data and mod/glossary filters forever, this will be out in 2.3
+ if ($filterlocation == 'mod' && ($filter == 'data' || $filter == 'glossary')) {
+ continue;
+ }
$path = $filterlocation . '/' . $filter;
if (is_readable($CFG->dirroot . '/' . $path . '/filter.php')) {
$strfiltername = filter_get_name($path);
rule = '';
if (/^\.mp3flowplayer_.*Color$/.test(allrules[i].selectorText)) {
if (typeof(allrules[i].cssText) != 'undefined') {
- rule = allrules[i].style.cssText;
+ rule = allrules[i].cssText;
} else if (typeof(allrules[i].style.cssText) != 'undefined') {
rule = allrules[i].style.cssText;
}
*/
protected function _fontFamilyCB($m)
{
- $m[1] = preg_replace('/
- \\s*
- (
- "[^"]+" # 1 = family in double qutoes
- |\'[^\']+\' # or 1 = family in single quotes
- |[\\w\\-]+ # or 1 = unquoted family
- )
- \\s*
- /x', '$1', $m[1]);
- return 'font-family:' . $m[1] . $m[2];
+ // Issue 210: must not eliminate WS between words in unquoted families
+ $pieces = preg_split('/(\'[^\']+\'|"[^"]+")/', $m[1], null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
+ $out = 'font-family:';
+ while (null !== ($piece = array_shift($pieces))) {
+ if ($piece[0] !== '"' && $piece[0] !== "'") {
+ $piece = preg_replace('/\\s+/', ' ', $piece);
+ $piece = preg_replace('/\\s?,\\s?/', ',', $piece);
+ }
+ $out .= $piece;
+ }
+ return $out . $m[2];
}
}
* Removed .htaccess - Not needed
* Changed config.php - Changed settings to Moodle specific settings incase this
ever gets accidentally used.
+ * Updated lib/Minify/CSS/Compressor.php - Applied an upstream fix for MDL-29864
+ to allow usage of unquoted font-familes with spaces in CSS.
+ http://code.google.com/p/minify/issues/detail?id=210
*/
private $extraclasses;
+ /**
+ * @var moodle_url full external url pointing to icon image for activity
+ */
+ private $iconurl;
+
/**
* @var string
*/
/**
* Note: Will collect view data, if not already obtained.
- * @return string Extra HTML code to display after link
+ * @return string Extra HTML code to display after link
*/
public function get_after_link() {
$this->obtain_view_data();
if (!$output) {
$output = $OUTPUT;
}
- if (!empty($this->icon)) {
+ // Support modules setting their own, external, icon image
+ if (!empty($this->iconurl)) {
+ $icon = $this->iconurl;
+
+ // Fallback to normal local icon + component procesing
+ } else if (!empty($this->icon)) {
if (substr($this->icon, 0, 4) === 'mod/') {
list($modname, $iconname) = explode('/', substr($this->icon, 4), 2);
$icon = $output->pix_url($iconname, $modname);
$this->extraclasses = $extraclasses;
}
+ /**
+ * Sets the external full url that points to the icon being used
+ * by the activity. Useful for external-tool modules (lti...)
+ * If set, takes precedence over $icon and $iconcomponent
+ *
+ * @param moodle_url $iconurl full external url pointing to icon image for activity
+ * @return void
+ */
+ public function set_icon_url(moodle_url $iconurl) {
+ $this->iconurl = $iconurl;
+ }
+
/**
* Sets value of on-click attribute for JavaScript.
* Note: May not be called from _cm_info_view (only _cm_info_dynamic).
$this->indent = isset($mod->indent) ? $mod->indent : 0;
$this->extra = isset($mod->extra) ? $mod->extra : '';
$this->extraclasses = isset($mod->extraclasses) ? $mod->extraclasses : '';
+ $this->iconurl = isset($mod->iconurl) ? $mod->iconurl : '';
$this->onclick = isset($mod->onclick) ? $mod->onclick : '';
$this->content = isset($mod->content) ? $mod->content : '';
$this->icon = isset($mod->icon) ? $mod->icon : '';
*/
public $extraclasses;
+ /**
+ * External URL image to be used by activity as icon, useful for some external-tool modules
+ * like lti. If set, takes precedence over $icon and $iconcomponent
+ * @var $moodle_url
+ */
+ public $iconurl;
+
/**
* Content of onclick JavaScript; escaped HTML to be inserted as attribute value
* @var string
*/
public $onclick;
-}
\ No newline at end of file
+}
if (!empty($CFG->langcache) and !empty($this->menucache)) {
// cache the list so that it can be used next time
collatorlib::asort($languages);
+ check_dir_exists(dirname($this->menucache), true, true);
file_put_contents($this->menucache, json_encode($languages));
}
}
+++ /dev/null
-Many aspects of the appearance and behaviour of the mp3 player can be customised,
-these custom values are set by passing variables to the flash movie using "flashvars".
-flashvars are supplied to the movie using
-
-<param name="flashvars" value="some value">
-
-alongside the other param tags, and with an extra attribute in the embed tag
-
-flashvars="some value"
-
-the "some value" part is a list of urlencoded variables
-
-&variableName=value&anotherVariable=anotherValue&
-
- +--------------------------------------------------------------------------------------------------------------------+
- | Variable Name | Possible Values | What it does |
- |--------------------------------------------------------------------------------------------------------------------|
- | bgColour | a colour in the format RRGGBB where | sets the background colour of the player. |
- | | RR, GG and BB are hexadecimal values | |
- | | (00 to FF) representing the Red, Green | |
- | | and Blue parts of the colour. eg | |
- | | ffffff is white, 000000 is black, | |
- | | ff9900 is orange, 000033 is a dark blue. | |
- | | the default colour is black. | |
- |--------------------------------------------------------------------------------------------------------------------|
- | btnColour | the same as bgColour, the default colour | sets the colour of the play and pause buttons. |
- | | is white. | |
- |--------------------------------------------------------------------------------------------------------------------|
- | btnBorderColour | the same as bgColour, the default colour | the colour of the border around the buttons. |
- | | is grey. | make this the same as btnColour if you don't want |
- | | | a border. |
- |--------------------------------------------------------------------------------------------------------------------|
- | iconColour | the same as bgColour, the default colour | the colour of the play/pause icons. |
- | | is black. | |
- |--------------------------------------------------------------------------------------------------------------------|
- | iconOverColour | the same as bgColour, the default colour | the colour of the play/pause icons when the mouse |
- | | is green. | is over the button. |
- |--------------------------------------------------------------------------------------------------------------------|
- | handleColour | the same as bgColour, the default colour | the colour of the handles on the playback slider, |
- | | is white. | volume and pan controls. |
- |--------------------------------------------------------------------------------------------------------------------|
- | trackColour | the same as bgColour, the default colour | the colour of the track for the playback slider, |
- | | is grey. | volume and pan controls. |
- |--------------------------------------------------------------------------------------------------------------------|
- | loaderColour | the same as bgColour, the default colour | the colour of the loading bar. |
- | | is white. | |
- |--------------------------------------------------------------------------------------------------------------------|
- | font | a name of a font, eg verdana. the | the font used in the movie. |
- | | default value is Trebuchet MS. | |
- |--------------------------------------------------------------------------------------------------------------------|
- | fontColour | the same as bgColour, the default colour | the colour of the text. |
- | | is white | |
- |--------------------------------------------------------------------------------------------------------------------|
- | waitForPlay | yes or no, the default is no. | should the player wait until the play button is |
- | | | pressed before starting to download the file? |
- |--------------------------------------------------------------------------------------------------------------------|
- | autoPlay | yes or no, the default is yes. | will the player wait until the play button is |
- | | | pressed before starting to play the file? if |
- |--------------------------------------------------------------------------------------------------------------------|
- | buffer | a value in seconds, the default is 20. | how many seconds of the file should be buffered |
- | | | before playback starts? |
- |--------------------------------------------------------------------------------------------------------------------|
- | volText | a string (could this come from the | the text used in the player to label the volume |
- | | language pack?) the default is "Vol". | control. |
- |--------------------------------------------------------------------------------------------------------------------|
- | panText | the same as volText. the default is "Pan". | the text used in the player to label the pan |
- | | | control. |
- +--------------------------------------------------------------------------------------------------------------------+
-
-
-a brightly coloured example ;)
-
-<param name="flashvars" value="&bgColour=ffff00&btnColour=00ff00&&btnBorderColour=ff9900iconColour=000000&iconOverColour=ff00ff&handleColour=ff00ff&trackColour=000000&loaderColour=ff9900&font=verdana&fontColour=ff0000&waitForPlay=no&dontAutoPlay=yes&buffer=30&">
-
-the content of the value attribute would need to be repeated and included as the value of
-the flashvars attribute in the embed tag.
-
-
-extra notes...
-
-the song information comes from 2 sources, initally the player displays the filename (minus the file extension)
-as the title, once the file is fully loaded it checks the id3 data in the mp3 file for the songname, artist and year
-and displays this information instead of the filename.
-
-
-Andy Walker (www.altoncollege.ac.uk)
-
// If the user is not enrolled then we only want to show the
// course node and not populate it.
- $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
// Not enrolled, can't view, and hasn't switched roles
- if (!can_access_course($coursecontext)) {
+ if (!can_access_course($course)) {
// TODO: very ugly hack - do not force "parents" to enrol into course their child is enrolled in,
// this hack has been propagated from user/view.php to display the navigation node. (MDL-25805)
$isparent = false;
// If the user is not enrolled then we only want to show the
// course node and not populate it.
- $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
- if (!can_access_course($coursecontext)) {
+ if (!can_access_course($course)) {
$coursenode->make_active();
$canviewcourseprofile = false;
break;
// If the user is not enrolled then we only want to show the
// course node and not populate it.
- $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
- if (!can_access_course($coursecontext)) {
+ if (!can_access_course($course)) {
$coursenode->make_active();
$canviewcourseprofile = false;
break;
*/
protected function add_category(stdClass $category, navigation_node $parent) {
if (array_key_exists($category->id, $this->addedcategories)) {
- continue;
+ return;
}
$url = new moodle_url('/course/category.php', array('id' => $category->id));
$context = get_context_instance(CONTEXT_COURSECAT, $category->id);
$usercoursenode->add(get_string('notes', 'notes'), $url, self::TYPE_SETTING);
}
- if (can_access_course(get_context_instance(CONTEXT_COURSE, $usercourse->id), $user->id)) {
+ if (can_access_course($usercourse, $user->id)) {
$usercoursenode->add(get_string('entercourse'), new moodle_url('/course/view.php', array('id'=>$usercourse->id)), self::TYPE_SETTING, null, null, new pix_icon('i/course', ''));
}
} else {
$canviewusercourse = has_capability('moodle/user:viewdetails', $coursecontext);
$canaccessallgroups = has_capability('moodle/site:accessallgroups', $coursecontext);
- if ((!$canviewusercourse && !$canviewuser) || !can_access_course($coursecontext, $user->id)) {
+ if ((!$canviewusercourse && !$canviewuser) || !can_access_course($course, $user->id)) {
return false;
}
if (!$canaccessallgroups && groups_get_course_groupmode($course) == SEPARATEGROUPS) {
$this->l['a_meta_dir'] = get_string('thisdirection', 'langconfig');
}
+ /**
+ * Send the document to a given destination: string, local file or browser.
+ * In the last case, the plug-in may be used (if present) or a download ("Save as" dialog box) may be forced.<br />
+ * The method first calls Close() if necessary to terminate the document.
+ * @param $name (string) The name of the file when saved. Note that special characters are removed and blanks characters are replaced with the underscore character.
+ * @param $dest (string) Destination where to send the document. It can take one of the following values:<ul><li>I: send the file inline to the browser (default). The plug-in is used if available. The name given by name is used when one selects the "Save as" option on the link generating the PDF.</li><li>D: send to the browser and force a file download with the name given by name.</li><li>F: save to a local server file with the name given by name.</li><li>S: return the document as a string (name is ignored).</li><li>FI: equivalent to F + I option</li><li>FD: equivalent to F + D option</li><li>E: return the document as base64 mime multi-part email attachment (RFC 2045)</li></ul>
+ * @public
+ * @since 1.0
+ * @see Close()
+ */
+ public function Output($name='doc.pdf', $dest='I') {
+ $olddebug = error_reporting(0);
+ $result = parent::output($name, $dest);
+ error_reporting($olddebug);
+ return $result;
+ }
+
/**
* Return fonts path
* Overriding TCPDF::_getfontpath()
return false;
}
- if ($requiredversion != ANY_VERSION and $otherplugin->versiondb < $requiredversion) {
+ if ($requiredversion != ANY_VERSION and $otherplugin->versiondisk < $requiredversion) {
return false;
}
}
'login', 'mentees', 'messages', 'mnet_hosts', 'myprofile',
'navigation', 'news_items', 'online_users', 'participants',
'private_files', 'quiz_results', 'recent_activity',
- 'rss_client', 'search', 'search_forums', 'section_links',
+ 'rss_client', 'search_forums', 'section_links',
'selfcompletion', 'settings', 'site_main_menu',
'social_activities', 'tag_flickr', 'tag_youtube', 'tags'
),
'qformat' => array(
'aiken', 'blackboard', 'blackboard_six', 'examview', 'gift',
- 'learnwise', 'missingword', 'multianswer', 'qti_two', 'webct',
+ 'learnwise', 'missingword', 'multianswer', 'webct',
'xhtml', 'xml'
),
if ($fullurl instanceof moodle_url) {
$fullurl = $fullurl->out(false);
+ } else {
+ $fullurl = str_replace('&', '&', $fullurl);
}
$id = 'resource_mp3_'.time(); //we need something unique because it might be stored in text cache
if ($fullurl instanceof moodle_url) {
$fullurl = $fullurl->out(false);
+ } else {
+ $fullurl = str_replace('&', '&', $fullurl);
}
$id = 'resource_flv_'.time(); //we need something unique because it might be stored in text cache
+++ /dev/null
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-\f
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard. To achieve this, non-free programs must be
-allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-\f
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-\f
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-\f
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-\f
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at
- least three years, to give the same user the materials
- specified in Subsection 6a, above, for a charge no more
- than the cost of performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-\f
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-\f
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded. In such case, this License incorporates the limitation as if
-written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-\f
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
+++ /dev/null
-<?php
-
-/**
- * Config_File class.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * For questions, help, comments, discussion, etc., please join the
- * Smarty mailing list. Send a blank e-mail to
- * smarty-discussion-subscribe@googlegroups.com
- *
- * @link http://www.smarty.net/
- * @version 2.6.26
- * @copyright Copyright: 2001-2005 New Digital Group, Inc.
- * @author Andrei Zmievski <andrei@php.net>
- * @access public
- * @package Smarty
- */
-
-/* $Id$ */
-
-/**
- * Config file reading class
- * @package Smarty
- */
-class Config_File {
- /**#@+
- * Options
- * @var boolean
- */
- /**
- * Controls whether variables with the same name overwrite each other.
- */
- var $overwrite = true;
-
- /**
- * Controls whether config values of on/true/yes and off/false/no get
- * converted to boolean values automatically.
- */
- var $booleanize = true;
-
- /**
- * Controls whether hidden config sections/vars are read from the file.
- */
- var $read_hidden = true;
-
- /**
- * Controls whether or not to fix mac or dos formatted newlines.
- * If set to true, \r or \r\n will be changed to \n.
- */
- var $fix_newlines = true;
- /**#@-*/
-
- /** @access private */
- var $_config_path = "";
- var $_config_data = array();
- /**#@-*/
-
- /**
- * Constructs a new config file class.
- *
- * @param string $config_path (optional) path to the config files
- */
- function Config_File($config_path = NULL)
- {
- if (isset($config_path))
- $this->set_path($config_path);
- }
-
-
- /**
- * Set the path where configuration files can be found.
- *
- * @param string $config_path path to the config files
- */
- function set_path($config_path)
- {
- if (!empty($config_path)) {
- if (!is_string($config_path) || !file_exists($config_path) || !is_dir($config_path)) {
- $this->_trigger_error_msg("Bad config file path '$config_path'");
- return;
- }
- if(substr($config_path, -1) != DIRECTORY_SEPARATOR) {
- $config_path .= DIRECTORY_SEPARATOR;
- }
-
- $this->_config_path = $config_path;
- }
- }
-
-
- /**
- * Retrieves config info based on the file, section, and variable name.
- *
- * @param string $file_name config file to get info for
- * @param string $section_name (optional) section to get info for
- * @param string $var_name (optional) variable to get info for
- * @return string|array a value or array of values
- */
- function get($file_name, $section_name = NULL, $var_name = NULL)
- {
- if (empty($file_name)) {
- $this->_trigger_error_msg('Empty config file name');
- return;
- } else {
- $file_name = $this->_config_path . $file_name;
- if (!isset($this->_config_data[$file_name]))
- $this->load_file($file_name, false);
- }
-
- if (!empty($var_name)) {
- if (empty($section_name)) {
- return $this->_config_data[$file_name]["vars"][$var_name];
- } else {
- if(isset($this->_config_data[$file_name]["sections"][$section_name]["vars"][$var_name]))
- return $this->_config_data[$file_name]["sections"][$section_name]["vars"][$var_name];
- else
- return array();
- }
- } else {
- if (empty($section_name)) {
- return (array)$this->_config_data[$file_name]["vars"];
- } else {
- if(isset($this->_config_data[$file_name]["sections"][$section_name]["vars"]))
- return (array)$this->_config_data[$file_name]["sections"][$section_name]["vars"];
- else
- return array();
- }
- }
- }
-
-
- /**
- * Retrieves config info based on the key.
- *
- * @param $file_name string config key (filename/section/var)
- * @return string|array same as get()
- * @uses get() retrieves information from config file and returns it
- */
- function &get_key($config_key)
- {
- list($file_name, $section_name, $var_name) = explode('/', $config_key, 3);
- $result = &$this->get($file_name, $section_name, $var_name);
- return $result;
- }
-
- /**
- * Get all loaded config file names.
- *
- * @return array an array of loaded config file names
- */
- function get_file_names()
- {
- return array_keys($this->_config_data);
- }
-
-
- /**
- * Get all section names from a loaded file.
- *
- * @param string $file_name config file to get section names from
- * @return array an array of section names from the specified file
- */
- function get_section_names($file_name)
- {
- $file_name = $this->_config_path . $file_name;
- if (!isset($this->_config_data[$file_name])) {
- $this->_trigger_error_msg("Unknown config file '$file_name'");
- return;
- }
-
- return array_keys($this->_config_data[$file_name]["sections"]);
- }
-
-
- /**
- * Get all global or section variable names.
- *
- * @param string $file_name config file to get info for
- * @param string $section_name (optional) section to get info for
- * @return array an array of variables names from the specified file/section
- */
- function get_var_names($file_name, $section = NULL)
- {
- if (empty($file_name)) {
- $this->_trigger_error_msg('Empty config file name');
- return;
- } else if (!isset($this->_config_data[$file_name])) {
- $this->_trigger_error_msg("Unknown config file '$file_name'");
- return;
- }
-
- if (empty($section))
- return array_keys($this->_config_data[$file_name]["vars"]);
- else
- return array_keys($this->_config_data[$file_name]["sections"][$section]["vars"]);
- }
-
-
- /**
- * Clear loaded config data for a certain file or all files.
- *
- * @param string $file_name file to clear config data for
- */
- function clear($file_name = NULL)
- {
- if ($file_name === NULL)
- $this->_config_data = array();
- else if (isset($this->_config_data[$file_name]))
- $this->_config_data[$file_name] = array();
- }
-
-
- /**
- * Load a configuration file manually.
- *
- * @param string $file_name file name to load
- * @param boolean $prepend_path whether current config path should be
- * prepended to the filename
- */
- function load_file($file_name, $prepend_path = true)
- {
- if ($prepend_path && $this->_config_path != "")
- $config_file = $this->_config_path . $file_name;
- else
- $config_file = $file_name;
-
- ini_set('track_errors', true);
- $fp = @fopen($config_file, "r");
- if (!is_resource($fp)) {
- $this->_trigger_error_msg("Could not open config file '$config_file'");
- return false;
- }
-
- $contents = ($size = filesize($config_file)) ? fread($fp, $size) : '';
- fclose($fp);
-
- $this->_config_data[$config_file] = $this->parse_contents($contents);
- return true;
- }
-
- /**
- * Store the contents of a file manually.
- *
- * @param string $config_file file name of the related contents
- * @param string $contents the file-contents to parse
- */
- function set_file_contents($config_file, $contents)
- {
- $this->_config_data[$config_file] = $this->parse_contents($contents);
- return true;
- }
-
- /**
- * parse the source of a configuration file manually.
- *
- * @param string $contents the file-contents to parse
- */
- function parse_contents($contents)
- {
- if($this->fix_newlines) {
- // fix mac/dos formatted newlines
- $contents = preg_replace('!\r\n?!', "\n", $contents);
- }
-
- $config_data = array();
- $config_data['sections'] = array();
- $config_data['vars'] = array();
-
- /* reference to fill with data */
- $vars =& $config_data['vars'];
-
- /* parse file line by line */
- preg_match_all('!^.*\r?\n?!m', $contents, $match);
- $lines = $match[0];
- for ($i=0, $count=count($lines); $i<$count; $i++) {
- $line = $lines[$i];
- if (empty($line)) continue;
-
- if ( substr($line, 0, 1) == '[' && preg_match('!^\[(.*?)\]!', $line, $match) ) {
- /* section found */
- if (substr($match[1], 0, 1) == '.') {
- /* hidden section */
- if ($this->read_hidden) {
- $section_name = substr($match[1], 1);
- } else {
- /* break reference to $vars to ignore hidden section */
- unset($vars);
- $vars = array();
- continue;
- }
- } else {
- $section_name = $match[1];
- }
- if (!isset($config_data['sections'][$section_name]))
- $config_data['sections'][$section_name] = array('vars' => array());
- $vars =& $config_data['sections'][$section_name]['vars'];
- continue;
- }
-
- if (preg_match('/^\s*(\.?\w+)\s*=\s*(.*)/s', $line, $match)) {
- /* variable found */
- $var_name = rtrim($match[1]);
- if (strpos($match[2], '"""') === 0) {
- /* handle multiline-value */
- $lines[$i] = substr($match[2], 3);
- $var_value = '';
- while ($i<$count) {
- if (($pos = strpos($lines[$i], '"""')) === false) {
- $var_value .= $lines[$i++];
- } else {
- /* end of multiline-value */
- $var_value .= substr($lines[$i], 0, $pos);
- break;
- }
- }
- $booleanize = false;
-
- } else {
- /* handle simple value */
- $var_value = preg_replace('/^([\'"])(.*)\1$/', '\2', rtrim($match[2]));
- $booleanize = $this->booleanize;
-
- }
- $this->_set_config_var($vars, $var_name, $var_value, $booleanize);
- }
- /* else unparsable line / means it is a comment / means ignore it */
- }
- return $config_data;
- }
-
- /**#@+ @access private */
- /**
- * @param array &$container
- * @param string $var_name
- * @param mixed $var_value
- * @param boolean $booleanize determines whether $var_value is converted to
- * to true/false
- */
- function _set_config_var(&$container, $var_name, $var_value, $booleanize)
- {
- if (substr($var_name, 0, 1) == '.') {
- if (!$this->read_hidden)
- return;
- else
- $var_name = substr($var_name, 1);
- }
-
- if (!preg_match("/^[a-zA-Z_]\w*$/", $var_name)) {
- $this->_trigger_error_msg("Bad variable name '$var_name'");
- return;
- }
-
- if ($booleanize) {
- if (preg_match("/^(on|true|yes)$/i", $var_value))
- $var_value = true;
- else if (preg_match("/^(off|false|no)$/i", $var_value))
- $var_value = false;
- }
-
- if (!isset($container[$var_name]) || $this->overwrite)
- $container[$var_name] = $var_value;
- else {
- settype($container[$var_name], 'array');
- $container[$var_name][] = $var_value;
- }
- }
-
- /**
- * @uses trigger_error() creates a PHP warning/error
- * @param string $error_msg
- * @param integer $error_type one of
- */
- function _trigger_error_msg($error_msg, $error_type = E_USER_WARNING)
- {
- trigger_error("Config_File error: $error_msg", $error_type);
- }
- /**#@-*/
-}
-
-?>
+++ /dev/null
-<?php
-
-/**
- * Project: Smarty: the PHP compiling template engine
- * File: Smarty.class.php
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * For questions, help, comments, discussion, etc., please join the
- * Smarty mailing list. Send a blank e-mail to
- * smarty-discussion-subscribe@googlegroups.com
- *
- * @link http://www.smarty.net/
- * @copyright 2001-2005 New Digital Group, Inc.
- * @author Monte Ohrt <monte at ohrt dot com>
- * @author Andrei Zmievski <andrei@php.net>
- * @package Smarty
- * @version 2.6.26
- */
-
-/* $Id$ */
-
-/**
- * DIR_SEP isn't used anymore, but third party apps might
- */
-if(!defined('DIR_SEP')) {
- define('DIR_SEP', DIRECTORY_SEPARATOR);
-}
-
-/**
- * set SMARTY_DIR to absolute path to Smarty library files.
- * if not defined, include_path will be used. Sets SMARTY_DIR only if user
- * application has not already defined it.
- */
-
-if (!defined('SMARTY_DIR')) {
- define('SMARTY_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR);
-}
-
-if (!defined('SMARTY_CORE_DIR')) {
- define('SMARTY_CORE_DIR', SMARTY_DIR . 'internals' . DIRECTORY_SEPARATOR);
-}
-
-define('SMARTY_PHP_PASSTHRU', 0);
-define('SMARTY_PHP_QUOTE', 1);
-define('SMARTY_PHP_REMOVE', 2);
-define('SMARTY_PHP_ALLOW', 3);
-
-/**
- * @package Smarty
- */
-class Smarty
-{
- /**#@+
- * Smarty Configuration Section
- */
-
- /**
- * The name of the directory where templates are located.
- *
- * @var string
- */
- var $template_dir = 'templates';
-
- /**
- * The directory where compiled templates are located.
- *
- * @var string
- */
- var $compile_dir = 'templates_c';
-
- /**
- * The directory where config files are located.
- *
- * @var string
- */
- var $config_dir = 'configs';
-
- /**
- * An array of directories searched for plugins.
- *
- * @var array
- */
- var $plugins_dir = array('plugins');
-
- /**
- * If debugging is enabled, a debug console window will display
- * when the page loads (make sure your browser allows unrequested
- * popup windows)
- *
- * @var boolean
- */
- var $debugging = false;
-
- /**
- * When set, smarty does uses this value as error_reporting-level.
- *
- * @var integer
- */
- var $error_reporting = null;
-
- /**
- * This is the path to the debug console template. If not set,
- * the default one will be used.
- *
- * @var string
- */
- var $debug_tpl = '';
-
- /**
- * This determines if debugging is enable-able from the browser.
- * <ul>
- * <li>NONE => no debugging control allowed</li>
- * <li>URL => enable debugging when SMARTY_DEBUG is found in the URL.</li>
- * </ul>
- * @link http://www.foo.dom/index.php?SMARTY_DEBUG
- * @var string
- */
- var $debugging_ctrl = 'NONE';
-
- /**
- * This tells Smarty whether to check for recompiling or not. Recompiling
- * does not need to happen unless a template or config file is changed.
- * Typically you enable this during development, and disable for
- * production.
- *
- * @var boolean
- */
- var $compile_check = true;
-
- /**
- * This forces templates to compile every time. Useful for development
- * or debugging.
- *
- * @var boolean
- */
- var $force_compile = false;
-
- /**
- * This enables template caching.
- * <ul>
- * <li>0 = no caching</li>
- * <li>1 = use class cache_lifetime value</li>
- * <li>2 = use cache_lifetime in cache file</li>
- * </ul>
- * @var integer
- */
- var $caching = 0;
-
- /**
- * The name of the directory for cache files.
- *
- * @var string
- */
- var $cache_dir = 'cache';
-
- /**
- * This is the number of seconds cached content will persist.
- * <ul>
- * <li>0 = always regenerate cache</li>
- * <li>-1 = never expires</li>
- * </ul>
- *
- * @var integer
- */
- var $cache_lifetime = 3600;
-
- /**
- * Only used when $caching is enabled. If true, then If-Modified-Since headers
- * are respected with cached content, and appropriate HTTP headers are sent.
- * This way repeated hits to a cached page do not send the entire page to the
- * client every time.
- *
- * @var boolean
- */
- var $cache_modified_check = false;
-
- /**
- * This determines how Smarty handles "<?php ... ?>" tags in templates.
- * possible values:
- * <ul>
- * <li>SMARTY_PHP_PASSTHRU -> print tags as plain text</li>
- * <li>SMARTY_PHP_QUOTE -> escape tags as entities</li>
- * <li>SMARTY_PHP_REMOVE -> remove php tags</li>
- * <li>SMARTY_PHP_ALLOW -> execute php tags</li>
- * </ul>
- *
- * @var integer
- */
- var $php_handling = SMARTY_PHP_PASSTHRU;
-
- /**
- * This enables template security. When enabled, many things are restricted
- * in the templates that normally would go unchecked. This is useful when
- * untrusted parties are editing templates and you want a reasonable level
- * of security. (no direct execution of PHP in templates for example)
- *
- * @var boolean
- */
- var $security = false;
-
- /**
- * This is the list of template directories that are considered secure. This
- * is used only if {@link $security} is enabled. One directory per array
- * element. {@link $template_dir} is in this list implicitly.
- *
- * @var array
- */
- var $secure_dir = array();
-
- /**
- * These are the security settings for Smarty. They are used only when
- * {@link $security} is enabled.
- *
- * @var array
- */
- var $security_settings = array(
- 'PHP_HANDLING' => false,
- 'IF_FUNCS' => array('array', 'list',
- 'isset', 'empty',
- 'count', 'sizeof',
- 'in_array', 'is_array',
- 'true', 'false', 'null'),
- 'INCLUDE_ANY' => false,
- 'PHP_TAGS' => false,
- 'MODIFIER_FUNCS' => array('count'),
- 'ALLOW_CONSTANTS' => false,
- 'ALLOW_SUPER_GLOBALS' => true
- );
-
- /**
- * This is an array of directories where trusted php scripts reside.
- * {@link $security} is disabled during their inclusion/execution.
- *
- * @var array
- */
- var $trusted_dir = array();
-
- /**
- * The left delimiter used for the template tags.
- *
- * @var string
- */
- var $left_delimiter = '{';
-
- /**
- * The right delimiter used for the template tags.
- *
- * @var string
- */
- var $right_delimiter = '}';
-
- /**
- * The order in which request variables are registered, similar to
- * variables_order in php.ini E = Environment, G = GET, P = POST,
- * C = Cookies, S = Server
- *
- * @var string
- */
- var $request_vars_order = 'EGPCS';
-
- /**
- * Indicates wether $HTTP_*_VARS[] (request_use_auto_globals=false)
- * are uses as request-vars or $_*[]-vars. note: if
- * request_use_auto_globals is true, then $request_vars_order has
- * no effect, but the php-ini-value "gpc_order"
- *
- * @var boolean
- */
- var $request_use_auto_globals = true;
-
- /**
- * Set this if you want different sets of compiled files for the same
- * templates. This is useful for things like different languages.
- * Instead of creating separate sets of templates per language, you
- * set different compile_ids like 'en' and 'de'.
- *
- * @var string
- */
- var $compile_id = null;
-
- /**
- * This tells Smarty whether or not to use sub dirs in the cache/ and
- * templates_c/ directories. sub directories better organized, but
- * may not work well with PHP safe mode enabled.
- *
- * @var boolean
- *
- */
- var $use_sub_dirs = false;
-
- /**
- * This is a list of the modifiers to apply to all template variables.
- * Put each modifier in a separate array element in the order you want
- * them applied. example: <code>array('escape:"htmlall"');</code>
- *
- * @var array
- */
- var $default_modifiers = array();
-
- /**
- * This is the resource type to be used when not specified
- * at the beginning of the resource path. examples:
- * $smarty->display('file:index.tpl');
- * $smarty->display('db:index.tpl');
- * $smarty->display('index.tpl'); // will use default resource type
- * {include file="file:index.tpl"}
- * {include file="db:index.tpl"}
- * {include file="index.tpl"} {* will use default resource type *}
- *
- * @var array
- */
- var $default_resource_type = 'file';
-
- /**
- * The function used for cache file handling. If not set, built-in caching is used.
- *
- * @var null|string function name
- */
- var $cache_handler_func = null;
-
- /**
- * This indicates which filters are automatically loaded into Smarty.
- *
- * @var array array of filter names
- */
- var $autoload_filters = array();
-
- /**#@+
- * @var boolean
- */
- /**
- * This tells if config file vars of the same name overwrite each other or not.
- * if disabled, same name variables are accumulated in an array.
- */
- var $config_overwrite = true;
-
- /**
- * This tells whether or not to automatically booleanize config file variables.
- * If enabled, then the strings "on", "true", and "yes" are treated as boolean
- * true, and "off", "false" and "no" are treated as boolean false.
- */
- var $config_booleanize = true;
-
- /**
- * This tells whether hidden sections [.foobar] are readable from the
- * tempalates or not. Normally you would never allow this since that is
- * the point behind hidden sections: the application can access them, but
- * the templates cannot.
- */
- var $config_read_hidden = false;
-
- /**
- * This tells whether or not automatically fix newlines in config files.
- * It basically converts \r (mac) or \r\n (dos) to \n
- */
- var $config_fix_newlines = true;
- /**#@-*/
-
- /**
- * If a template cannot be found, this PHP function will be executed.
- * Useful for creating templates on-the-fly or other special action.
- *
- * @var string function name
- */
- var $default_template_handler_func = '';
-
- /**
- * The file that contains the compiler class. This can a full
- * pathname, or relative to the php_include path.
- *
- * @var string
- */
- var $compiler_file = 'Smarty_Compiler.class.php';
-
- /**
- * The class used for compiling templates.
- *
- * @var string
- */
- var $compiler_class = 'Smarty_Compiler';
-
- /**
- * The class used to load config vars.
- *
- * @var string
- */
- var $config_class = 'Config_File';
-
-/**#@+
- * END Smarty Configuration Section
- * There should be no need to touch anything below this line.
- * @access private
- */
- /**
- * where assigned template vars are kept
- *
- * @var array
- */
- var $_tpl_vars = array();
-
- /**
- * stores run-time $smarty.* vars
- *
- * @var null|array
- */
- var $_smarty_vars = null;
-
- /**
- * keeps track of sections
- *
- * @var array
- */
- var $_sections = array();
-
- /**
- * keeps track of foreach blocks
- *
- * @var array
- */
- var $_foreach = array();
-
- /**
- * keeps track of tag hierarchy
- *
- * @var array
- */
- var $_tag_stack = array();
-
- /**
- * configuration object
- *
- * @var Config_file
- */
- var $_conf_obj = null;
-
- /**
- * loaded configuration settings
- *
- * @var array
- */
- var $_config = array(array('vars' => array(), 'files' => array()));
-
- /**
- * md5 checksum of the string 'Smarty'
- *
- * @var string
- */
- var $_smarty_md5 = 'f8d698aea36fcbead2b9d5359ffca76f';
-
- /**
- * Smarty version number
- *
- * @var string
- */
- var $_version = '2.6.26';
-
- /**
- * current template inclusion depth
- *
- * @var integer
- */
- var $_inclusion_depth = 0;
-
- /**
- * for different compiled templates
- *
- * @var string
- */
- var $_compile_id = null;
-
- /**
- * text in URL to enable debug mode
- *
- * @var string
- */
- var $_smarty_debug_id = 'SMARTY_DEBUG';
-
- /**
- * debugging information for debug console
- *
- * @var array
- */
- var $_smarty_debug_info = array();
-
- /**
- * info that makes up a cache file
- *
- * @var array
- */
- var $_cache_info = array();
-
- /**
- * default file permissions
- *
- * @var integer
- */
- var $_file_perms = 0644;
-
- /**
- * default dir permissions
- *
- * @var integer
- */
- var $_dir_perms = 0771;
-
- /**
- * registered objects
- *
- * @var array
- */
- var $_reg_objects = array();
-
- /**
- * table keeping track of plugins
- *
- * @var array
- */
- var $_plugins = array(
- 'modifier' => array(),
- 'function' => array(),
- 'block' => array(),
- 'compiler' => array(),
- 'prefilter' => array(),
- 'postfilter' => array(),
- 'outputfilter' => array(),
- 'resource' => array(),
- 'insert' => array());
-
-
- /**
- * cache serials
- *
- * @var array
- */
- var $_cache_serials = array();
-
- /**
- * name of optional cache include file
- *
- * @var string
- */
- var $_cache_include = null;
-
- /**
- * indicate if the current code is used in a compiled
- * include
- *
- * @var string
- */
- var $_cache_including = false;
-
- /**#@-*/
- /**
- * The class constructor.
- */
- function Smarty()
- {
- $this->assign('SCRIPT_NAME', isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME']
- : @$GLOBALS['HTTP_SERVER_VARS']['SCRIPT_NAME']);
- }
-
- /**
- * assigns values to template variables
- *
- * @param array|string $tpl_var the template variable name(s)
- * @param mixed $value the value to assign
- */
- function assign($tpl_var, $value = null)
- {
- if (is_array($tpl_var)){
- foreach ($tpl_var as $key => $val) {
- if ($key != '') {
- $this->_tpl_vars[$key] = $val;
- }
- }
- } else {
- if ($tpl_var != '')
- $this->_tpl_vars[$tpl_var] = $value;
- }
- }
-
- /**
- * assigns values to template variables by reference
- *
- * @param string $tpl_var the template variable name
- * @param mixed $value the referenced value to assign
- */
- function assign_by_ref($tpl_var, &$value)
- {
- if ($tpl_var != '')
- $this->_tpl_vars[$tpl_var] = &$value;
- }
-
- /**
- * appends values to template variables
- *
- * @param array|string $tpl_var the template variable name(s)
- * @param mixed $value the value to append
- */
- function append($tpl_var, $value=null, $merge=false)
- {
- if (is_array($tpl_var)) {
- // $tpl_var is an array, ignore $value
- foreach ($tpl_var as $_key => $_val) {
- if ($_key != '') {
- if(!@is_array($this->_tpl_vars[$_key])) {
- settype($this->_tpl_vars[$_key],'array');
- }
- if($merge && is_array($_val)) {
- foreach($_val as $_mkey => $_mval) {
- $this->_tpl_vars[$_key][$_mkey] = $_mval;
- }
- } else {
- $this->_tpl_vars[$_key][] = $_val;
- }
- }
- }
- } else {
- if ($tpl_var != '' && isset($value)) {
- if(!@is_array($this->_tpl_vars[$tpl_var])) {
- settype($this->_tpl_vars[$tpl_var],'array');
- }
- if($merge && is_array($value)) {
- foreach($value as $_mkey => $_mval) {
- $this->_tpl_vars[$tpl_var][$_mkey] = $_mval;
- }
- } else {
- $this->_tpl_vars[$tpl_var][] = $value;
- }
- }
- }
- }
-
- /**
- * appends values to template variables by reference
- *
- * @param string $tpl_var the template variable name
- * @param mixed $value the referenced value to append
- */
- function append_by_ref($tpl_var, &$value, $merge=false)
- {
- if ($tpl_var != '' && isset($value)) {
- if(!@is_array($this->_tpl_vars[$tpl_var])) {
- settype($this->_tpl_vars[$tpl_var],'array');
- }
- if ($merge && is_array($value)) {
- foreach($value as $_key => $_val) {
- $this->_tpl_vars[$tpl_var][$_key] = &$value[$_key];
- }
- } else {
- $this->_tpl_vars[$tpl_var][] = &$value;
- }
- }
- }
-
-
- /**
- * clear the given assigned template variable.
- *
- * @param string $tpl_var the template variable to clear
- */
- function clear_assign($tpl_var)
- {
- if (is_array($tpl_var))
- foreach ($tpl_var as $curr_var)
- unset($this->_tpl_vars[$curr_var]);
- else
- unset($this->_tpl_vars[$tpl_var]);
- }
-
-
- /**
- * Registers custom function to be used in templates
- *
- * @param string $function the name of the template function
- * @param string $function_impl the name of the PHP function to register
- */
- function register_function($function, $function_impl, $cacheable=true, $cache_attrs=null)
- {
- $this->_plugins['function'][$function] =
- array($function_impl, null, null, false, $cacheable, $cache_attrs);
-
- }
-
- /**
- * Unregisters custom function
- *
- * @param string $function name of template function
- */
- function unregister_function($function)
- {
- unset($this->_plugins['function'][$function]);
- }
-
- /**
- * Registers object to be used in templates
- *
- * @param string $object name of template object
- * @param object &$object_impl the referenced PHP object to register
- * @param null|array $allowed list of allowed methods (empty = all)
- * @param boolean $smarty_args smarty argument format, else traditional
- * @param null|array $block_functs list of methods that are block format
- */
- function register_object($object, &$object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())
- {
- settype($allowed, 'array');
- settype($smarty_args, 'boolean');
- $this->_reg_objects[$object] =
- array(&$object_impl, $allowed, $smarty_args, $block_methods);
- }
-
- /**
- * Unregisters object
- *
- * @param string $object name of template object
- */
- function unregister_object($object)
- {
- unset($this->_reg_objects[$object]);
- }
-
-
- /**
- * Registers block function to be used in templates
- *
- * @param string $block name of template block
- * @param string $block_impl PHP function to register
- */
- function register_block($block, $block_impl, $cacheable=true, $cache_attrs=null)
- {
- $this->_plugins['block'][$block] =
- array($block_impl, null, null, false, $cacheable, $cache_attrs);
- }
-
- /**
- * Unregisters block function
- *
- * @param string $block name of template function
- */
- function unregister_block($block)
- {
- unset($this->_plugins['block'][$block]);
- }
-
- /**
- * Registers compiler function
- *
- * @param string $function name of template function
- * @param string $function_impl name of PHP function to register
- */
- function register_compiler_function($function, $function_impl, $cacheable=true)
- {
- $this->_plugins['compiler'][$function] =
- array($function_impl, null, null, false, $cacheable);
- }
-
- /**
- * Unregisters compiler function
- *
- * @param string $function name of template function
- */
- function unregister_compiler_function($function)
- {
- unset($this->_plugins['compiler'][$function]);
- }
-
- /**
- * Registers modifier to be used in templates
- *
- * @param string $modifier name of template modifier
- * @param string $modifier_impl name of PHP function to register
- */
- function register_modifier($modifier, $modifier_impl)
- {
- $this->_plugins['modifier'][$modifier] =
- array($modifier_impl, null, null, false);
- }
-
- /**
- * Unregisters modifier
- *
- * @param string $modifier name of template modifier
- */
- function unregister_modifier($modifier)
- {
- unset($this->_plugins['modifier'][$modifier]);
- }
-
- /**
- * Registers a resource to fetch a template
- *
- * @param string $type name of resource
- * @param array $functions array of functions to handle resource
- */
- function register_resource($type, $functions)
- {
- if (count($functions)==4) {
- $this->_plugins['resource'][$type] =
- array($functions, false);
-
- } elseif (count($functions)==5) {
- $this->_plugins['resource'][$type] =
- array(array(array(&$functions[0], $functions[1])
- ,array(&$functions[0], $functions[2])
- ,array(&$functions[0], $functions[3])
- ,array(&$functions[0], $functions[4]))
- ,false);
-
- } else {
- $this->trigger_error("malformed function-list for '$type' in register_resource");
-
- }
- }
-
- /**
- * Unregisters a resource
- *
- * @param string $type name of resource
- */
- function unregister_resource($type)
- {
- unset($this->_plugins['resource'][$type]);
- }
-
- /**
- * Registers a prefilter function to apply
- * to a template before compiling
- *
- * @param callback $function
- */
- function register_prefilter($function)
- {
- $this->_plugins['prefilter'][$this->_get_filter_name($function)]
- = array($function, null, null, false);
- }
-
- /**
- * Unregisters a prefilter function
- *
- * @param callback $function
- */
- function unregister_prefilter($function)
- {
- unset($this->_plugins['prefilter'][$this->_get_filter_name($function)]);
- }
-
- /**
- * Registers a postfilter function to apply
- * to a compiled template after compilation
- *
- * @param callback $function
- */
- function register_postfilter($function)
- {
- $this->_plugins['postfilter'][$this->_get_filter_name($function)]
- = array($function, null, null, false);
- }
-
- /**
- * Unregisters a postfilter function
- *
- * @param callback $function
- */
- function unregister_postfilter($function)
- {
- unset($this->_plugins['postfilter'][$this->_get_filter_name($function)]);
- }
-
- /**
- * Registers an output filter function to apply
- * to a template output
- *
- * @param callback $function
- */
- function register_outputfilter($function)
- {
- $this->_plugins['outputfilter'][$this->_get_filter_name($function)]
- = array($function, null, null, false);
- }
-
- /**
- * Unregisters an outputfilter function
- *
- * @param callback $function
- */
- function unregister_outputfilter($function)
- {
- unset($this->_plugins['outputfilter'][$this->_get_filter_name($function)]);
- }
-
- /**
- * load a filter of specified type and name
- *
- * @param string $type filter type
- * @param string $name filter name
- */
- function load_filter($type, $name)
- {
- switch ($type) {
- case 'output':
- $_params = array('plugins' => array(array($type . 'filter', $name, null, null, false)));
- require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
- smarty_core_load_plugins($_params, $this);
- break;
-
- case 'pre':
- case 'post':
- if (!isset($this->_plugins[$type . 'filter'][$name]))
- $this->_plugins[$type . 'filter'][$name] = false;
- break;
- }
- }
-
- /**
- * clear cached content for the given template and cache id
- *
- * @param string $tpl_file name of template file
- * @param string $cache_id name of cache_id
- * @param string $compile_id name of compile_id
- * @param string $exp_time expiration time
- * @return boolean
- */
- function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null, $exp_time = null)
- {
-
- if (!isset($compile_id))
- $compile_id = $this->compile_id;
-
- if (!isset($tpl_file))
- $compile_id = null;
-
- $_auto_id = $this->_get_auto_id($cache_id, $compile_id);
-
- if (!empty($this->cache_handler_func)) {
- return call_user_func_array($this->cache_handler_func,
- array('clear', &$this, &$dummy, $tpl_file, $cache_id, $compile_id, $exp_time));
- } else {
- $_params = array('auto_base' => $this->cache_dir,
- 'auto_source' => $tpl_file,
- 'auto_id' => $_auto_id,
- 'exp_time' => $exp_time);
- require_once(SMARTY_CORE_DIR . 'core.rm_auto.php');
- return smarty_core_rm_auto($_params, $this);
- }
-
- }
-
-
- /**
- * clear the entire contents of cache (all templates)
- *
- * @param string $exp_time expire time
- * @return boolean results of {@link smarty_core_rm_auto()}
- */
- function clear_all_cache($exp_time = null)
- {
- return $this->clear_cache(null, null, null, $exp_time);
- }
-
-
- /**
- * test to see if valid cache exists for this template
- *
- * @param string $tpl_file name of template file
- * @param string $cache_id
- * @param string $compile_id
- * @return string|false results of {@link _read_cache_file()}
- */
- function is_cached($tpl_file, $cache_id = null, $compile_id = null)
- {
- if (!$this->caching)
- return false;
-
- if (!isset($compile_id))
- $compile_id = $this->compile_id;
-
- $_params = array(
- 'tpl_file' => $tpl_file,
- 'cache_id' => $cache_id,
- 'compile_id' => $compile_id
- );
- require_once(SMARTY_CORE_DIR . 'core.read_cache_file.php');
- return smarty_core_read_cache_file($_params, $this);
- }
-
-
- /**
- * clear all the assigned template variables.
- *
- */
- function clear_all_assign()
- {
- $this->_tpl_vars = array();
- }
-
- /**
- * clears compiled version of specified template resource,
- * or all compiled template files if one is not specified.
- * This function is for advanced use only, not normally needed.
- *
- * @param string $tpl_file
- * @param string $compile_id
- * @param string $exp_time
- * @return boolean results of {@link smarty_core_rm_auto()}
- */
- function clear_compiled_tpl($tpl_file = null, $compile_id = null, $exp_time = null)
- {
- if (!isset($compile_id)) {
- $compile_id = $this->compile_id;
- }
- $_params = array('auto_base' => $this->compile_dir,
- 'auto_source' => $tpl_file,
- 'auto_id' => $compile_id,
- 'exp_time' => $exp_time,
- 'extensions' => array('.inc', '.php'));
- require_once(SMARTY_CORE_DIR . 'core.rm_auto.php');
- return smarty_core_rm_auto($_params, $this);
- }
-
- /**
- * Checks whether requested template exists.
- *
- * @param string $tpl_file
- * @return boolean
- */
- function template_exists($tpl_file)
- {
- $_params = array('resource_name' => $tpl_file, 'quiet'=>true, 'get_source'=>false);
- return $this->_fetch_resource_info($_params);
- }
-
- /**
- * Returns an array containing template variables
- *
- * @param string $name
- * @param string $type
- * @return array
- */
- function &get_template_vars($name=null)
- {
- if(!isset($name)) {
- return $this->_tpl_vars;
- } elseif(isset($this->_tpl_vars[$name])) {
- return $this->_tpl_vars[$name];
- } else {
- // var non-existant, return valid reference
- $_tmp = null;
- return $_tmp;
- }
- }
-
- /**
- * Returns an array containing config variables
- *
- * @param string $name
- * @param string $type
- * @return array
- */
- function &get_config_vars($name=null)
- {
- if(!isset($name) && is_array($this->_config[0])) {
- return $this->_config[0]['vars'];
- } else if(isset($this->_config[0]['vars'][$name])) {
- return $this->_config[0]['vars'][$name];
- } else {
- // var non-existant, return valid reference
- $_tmp = null;
- return $_tmp;
- }
- }
-
- /**
- * trigger Smarty error
- *
- * @param string $error_msg
- * @param integer $error_type
- */
- function trigger_error($error_msg, $error_type = E_USER_WARNING)
- {
- trigger_error("Smarty error: $error_msg", $error_type);
- }
-
-
- /**
- * executes & displays the template results
- *
- * @param string $resource_name
- * @param string $cache_id
- * @param string $compile_id
- */
- function display($resource_name, $cache_id = null, $compile_id = null)
- {
- $this->fetch($resource_name, $cache_id, $compile_id, true);
- }
-
- /**
- * executes & returns or displays the template results
- *
- * @param string $resource_name
- * @param string $cache_id
- * @param string $compile_id
- * @param boolean $display
- */
- function fetch($resource_name, $cache_id = null, $compile_id = null, $display = false)
- {
- static $_cache_info = array();
-
- $_smarty_old_error_level = $this->debugging ? error_reporting() : error_reporting(isset($this->error_reporting)
- ? $this->error_reporting : error_reporting() & ~E_NOTICE);
-
- if (!$this->debugging && $this->debugging_ctrl == 'URL') {
- $_query_string = $this->request_use_auto_globals ? $_SERVER['QUERY_STRING'] : $GLOBALS['HTTP_SERVER_VARS']['QUERY_STRING'];
- if (@strstr($_query_string, $this->_smarty_debug_id)) {
- if (@strstr($_query_string, $this->_smarty_debug_id . '=on')) {
- // enable debugging for this browser session
- @setcookie('SMARTY_DEBUG', true);
- $this->debugging = true;
- } elseif (@strstr($_query_string, $this->_smarty_debug_id . '=off')) {
- // disable debugging for this browser session
- @setcookie('SMARTY_DEBUG', false);
- $this->debugging = false;
- } else {
- // enable debugging for this page
- $this->debugging = true;
- }
- } else {
- $this->debugging = (bool)($this->request_use_auto_globals ? @$_COOKIE['SMARTY_DEBUG'] : @$GLOBALS['HTTP_COOKIE_VARS']['SMARTY_DEBUG']);
- }
- }
-
- if ($this->debugging) {
- // capture time for debugging info
- $_params = array();
- require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
- $_debug_start_time = smarty_core_get_microtime($_params, $this);
- $this->_smarty_debug_info[] = array('type' => 'template',
- 'filename' => $resource_name,
- 'depth' => 0);
- $_included_tpls_idx = count($this->_smarty_debug_info) - 1;
- }
-
- if (!isset($compile_id)) {
- $compile_id = $this->compile_id;
- }
-
- $this->_compile_id = $compile_id;
- $this->_inclusion_depth = 0;
-
- if ($this->caching) {
- // save old cache_info, initialize cache_info
- array_push($_cache_info, $this->_cache_info);
- $this->_cache_info = array();
- $_params = array(
- 'tpl_file' => $resource_name,
- 'cache_id' => $cache_id,
- 'compile_id' => $compile_id,
- 'results' => null
- );
- require_once(SMARTY_CORE_DIR . 'core.read_cache_file.php');
- if (smarty_core_read_cache_file($_params, $this)) {
- $_smarty_results = $_params['results'];
- if (!empty($this->_cache_info['insert_tags'])) {
- $_params = array('plugins' => $this->_cache_info['insert_tags']);
- require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
- smarty_core_load_plugins($_params, $this);
- $_params = array('results' => $_smarty_results);
- require_once(SMARTY_CORE_DIR . 'core.process_cached_inserts.php');
- $_smarty_results = smarty_core_process_cached_inserts($_params, $this);
- }
- if (!empty($this->_cache_info['cache_serials'])) {
- $_params = array('results' => $_smarty_results);
- require_once(SMARTY_CORE_DIR . 'core.process_compiled_include.php');
- $_smarty_results = smarty_core_process_compiled_include($_params, $this);
- }
-
-
- if ($display) {
- if ($this->debugging)
- {
- // capture time for debugging info
- $_params = array();
- require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');
- $this->_smarty_debug_info[$_included_tpls_idx]['exec_time'] = smarty_core_get_microtime($_params, $this) - $_debug_start_time;
- require_once(SMARTY_CORE_DIR . 'core.display_debug_console.php');
- $_smarty_results .= smarty_core_display_debug_console($_params, $this);
- }
- if ($this->cache_modified_check) {
- $_server_vars = ($this->request_use_auto_globals) ? $_SERVER : $GLOBALS['HTTP_SERVER_VARS'];
- $_last_modified_date = @substr($_server_vars['HTTP_IF_MODIFIED_SINCE'], 0, strpos($_server_vars['HTTP_IF_MODIFIED_SINCE'], 'GMT') + 3);
- $_gmt_mtime = gmdate('D, d M Y H:i:s', $this->_cache_info['timestamp']).' GMT';
- if (@count($this->_cache_info['insert_tags']) == 0
- && !$this->_cache_serials
- && $_gmt_mtime == $_last_modified_date) {
- if (php_sapi_name()=='cgi')
- header('Status: 304 Not Modified');
- else
- header('HTTP/1.1&nb