Merge branch 'w43_MDL-29283_m22_tcpdf' of git://github.com/skodak/moodle
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 1 Nov 2011 16:23:20 +0000 (17:23 +0100)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 1 Nov 2011 16:23:20 +0000 (17:23 +0100)
345 files changed:
admin/cli/install_database.php
admin/renderer.php
admin/settings/development.php
blocks/search/README.txt [deleted file]
blocks/search/block_search.php [deleted file]
blocks/search/db/install.php [deleted file]
blocks/search/db/install.xml [deleted file]
blocks/search/db/upgrade.php [deleted file]
blocks/search/lang/en/block_search.php [deleted file]
blocks/search/settings.php [deleted file]
calendar/lib.php
calendar/renderer.php
calendar/set.php
enrol/index.php
enrol/manual/lib.php
enrol/self/lang/en/enrol_self.php
enrol/self/lib.php
enrol/self/locallib.php
enrol/self/version.php
filter/data/db/install.php [new file with mode: 0644]
filter/data/filter.php [new file with mode: 0644]
filter/data/lang/en/filter_data.php [moved from blocks/search/version.php with 68% similarity]
filter/data/version.php [moved from blocks/search/db/upgradelib.php with 54% similarity]
filter/glossary/db/install.php [new file with mode: 0644]
filter/glossary/filter.php [new file with mode: 0644]
filter/glossary/lang/en/filter_glossary.php [moved from question/format/qti_two/lang/en/qformat_qti_two.php with 66% similarity]
filter/glossary/styles.css [new file with mode: 0644]
filter/glossary/version.php [new file with mode: 0644]
filter/glossary/yui/autolinker/autolinker.js [moved from mod/glossary/yui/autolinker/autolinker.js with 90% similarity]
group/clientlib.js
lang/en/admin.php
lang/en/question.php
lib/accesslib.php
lib/db/upgrade.php
lib/enrollib.php
lib/filterlib.php
lib/javascript-static.js
lib/moodlelib.php
lib/mp3player/index.html [deleted file]
lib/mp3player/mp3player.fla.zip [deleted file]
lib/mp3player/mp3player.swf [deleted file]
lib/mp3player/readme.txt [deleted file]
lib/navigationlib.php
lib/pluginlib.php
lib/resourcelib.php
lib/smarty/COPYING.lib [deleted file]
lib/smarty/Config_File.class.php [deleted file]
lib/smarty/Smarty.class.php [deleted file]
lib/smarty/Smarty_Compiler.class.php [deleted file]
lib/smarty/debug.tpl [deleted file]
lib/smarty/internals/core.assemble_plugin_filepath.php [deleted file]
lib/smarty/internals/core.assign_smarty_interface.php [deleted file]
lib/smarty/internals/core.create_dir_structure.php [deleted file]
lib/smarty/internals/core.display_debug_console.php [deleted file]
lib/smarty/internals/core.get_include_path.php [deleted file]
lib/smarty/internals/core.get_microtime.php [deleted file]
lib/smarty/internals/core.get_php_resource.php [deleted file]
lib/smarty/internals/core.is_secure.php [deleted file]
lib/smarty/internals/core.is_trusted.php [deleted file]
lib/smarty/internals/core.load_plugins.php [deleted file]
lib/smarty/internals/core.load_resource_plugin.php [deleted file]
lib/smarty/internals/core.process_cached_inserts.php [deleted file]
lib/smarty/internals/core.process_compiled_include.php [deleted file]
lib/smarty/internals/core.read_cache_file.php [deleted file]
lib/smarty/internals/core.rm_auto.php [deleted file]
lib/smarty/internals/core.rmdir.php [deleted file]
lib/smarty/internals/core.run_insert_handler.php [deleted file]
lib/smarty/internals/core.smarty_include_php.php [deleted file]
lib/smarty/internals/core.write_cache_file.php [deleted file]
lib/smarty/internals/core.write_compiled_include.php [deleted file]
lib/smarty/internals/core.write_compiled_resource.php [deleted file]
lib/smarty/internals/core.write_file.php [deleted file]
lib/smarty/plugins/block.textformat.php [deleted file]
lib/smarty/plugins/compiler.assign.php [deleted file]
lib/smarty/plugins/function.assign_debug_info.php [deleted file]
lib/smarty/plugins/function.config_load.php [deleted file]
lib/smarty/plugins/function.counter.php [deleted file]
lib/smarty/plugins/function.cycle.php [deleted file]
lib/smarty/plugins/function.debug.php [deleted file]
lib/smarty/plugins/function.eval.php [deleted file]
lib/smarty/plugins/function.fetch.php [deleted file]
lib/smarty/plugins/function.html_checkboxes.php [deleted file]
lib/smarty/plugins/function.html_image.php [deleted file]
lib/smarty/plugins/function.html_options.php [deleted file]
lib/smarty/plugins/function.html_radios.php [deleted file]
lib/smarty/plugins/function.html_select_date.php [deleted file]
lib/smarty/plugins/function.html_select_time.php [deleted file]
lib/smarty/plugins/function.html_table.php [deleted file]
lib/smarty/plugins/function.mailto.php [deleted file]
lib/smarty/plugins/function.math.php [deleted file]
lib/smarty/plugins/function.popup.php [deleted file]
lib/smarty/plugins/function.popup_init.php [deleted file]
lib/smarty/plugins/modifier.capitalize.php [deleted file]
lib/smarty/plugins/modifier.cat.php [deleted file]
lib/smarty/plugins/modifier.count_characters.php [deleted file]
lib/smarty/plugins/modifier.count_paragraphs.php [deleted file]
lib/smarty/plugins/modifier.count_sentences.php [deleted file]
lib/smarty/plugins/modifier.count_words.php [deleted file]
lib/smarty/plugins/modifier.date_format.php [deleted file]
lib/smarty/plugins/modifier.debug_print_var.php [deleted file]
lib/smarty/plugins/modifier.default.php [deleted file]
lib/smarty/plugins/modifier.escape.php [deleted file]
lib/smarty/plugins/modifier.indent.php [deleted file]
lib/smarty/plugins/modifier.lower.php [deleted file]
lib/smarty/plugins/modifier.nl2br.php [deleted file]
lib/smarty/plugins/modifier.regex_replace.php [deleted file]
lib/smarty/plugins/modifier.replace.php [deleted file]
lib/smarty/plugins/modifier.spacify.php [deleted file]
lib/smarty/plugins/modifier.string_format.php [deleted file]
lib/smarty/plugins/modifier.strip.php [deleted file]
lib/smarty/plugins/modifier.strip_tags.php [deleted file]
lib/smarty/plugins/modifier.truncate.php [deleted file]
lib/smarty/plugins/modifier.upper.php [deleted file]
lib/smarty/plugins/modifier.wordwrap.php [deleted file]
lib/smarty/plugins/outputfilter.trimwhitespace.php [deleted file]
lib/smarty/plugins/shared.escape_special_chars.php [deleted file]
lib/smarty/plugins/shared.make_timestamp.php [deleted file]
lib/smarty/readme_moodle.txt [deleted file]
lib/weblib.php
mod/assignment/lib.php
mod/assignment/type/upload/assignment.class.php
mod/data/filter.php [deleted file]
mod/data/version.php
mod/feedback/README.txt
mod/feedback/analysis.php
mod/feedback/analysis_course.php
mod/feedback/analysis_to_excel.php
mod/feedback/backup/moodle1/lib.php
mod/feedback/backup/moodle2/backup_feedback_activity_task.class.php
mod/feedback/backup/moodle2/backup_feedback_settingslib.php
mod/feedback/backup/moodle2/backup_feedback_stepslib.php
mod/feedback/backup/moodle2/restore_feedback_activity_task.class.php
mod/feedback/backup/moodle2/restore_feedback_stepslib.php
mod/feedback/choose_group_form.php
mod/feedback/complete.php
mod/feedback/complete_guest.php
mod/feedback/db/access.php
mod/feedback/db/install.php
mod/feedback/db/install.xml
mod/feedback/db/log.php
mod/feedback/db/messages.php
mod/feedback/db/upgrade.php
mod/feedback/delete_completed.php
mod/feedback/delete_completed_form.php
mod/feedback/delete_item.php
mod/feedback/delete_item_form.php
mod/feedback/delete_template.php
mod/feedback/delete_template_form.php
mod/feedback/edit.php
mod/feedback/edit_form.php
mod/feedback/edit_item.php
mod/feedback/export.php
mod/feedback/import.php
mod/feedback/import_form.php
mod/feedback/index.php
mod/feedback/item/captcha/captcha_form.php
mod/feedback/item/captcha/lib.php
mod/feedback/item/captcha/print_captcha.php
mod/feedback/item/feedback_item_class.php
mod/feedback/item/feedback_item_form_class.php
mod/feedback/item/info/info_form.php
mod/feedback/item/info/lib.php
mod/feedback/item/label/label_form.php
mod/feedback/item/label/lib.php
mod/feedback/item/multichoice/lib.php
mod/feedback/item/multichoice/multichoice_form.php
mod/feedback/item/multichoicerated/lib.php
mod/feedback/item/multichoicerated/multichoicerated_form.php
mod/feedback/item/numeric/lib.php
mod/feedback/item/numeric/numeric_form.php
mod/feedback/item/textarea/lib.php
mod/feedback/item/textarea/textarea_form.php
mod/feedback/item/textfield/lib.php
mod/feedback/item/textfield/textfield_form.php
mod/feedback/lang/en/feedback.php
mod/feedback/lib.php
mod/feedback/mapcourse.php
mod/feedback/mod_form.php
mod/feedback/print.php
mod/feedback/settings.php
mod/feedback/show_entries.php
mod/feedback/show_entries_anonym.php
mod/feedback/show_nonrespondents.php
mod/feedback/styles.css
mod/feedback/tabs.php
mod/feedback/unmapcourse.php
mod/feedback/use_templ.php
mod/feedback/use_templ_form.php
mod/feedback/version.php
mod/feedback/view.php
mod/forum/lib.php
mod/glossary/filter.php [deleted file]
mod/glossary/styles.css
mod/glossary/version.php
mod/quiz/lang/en/quiz.php
mod/scorm/player.php
mod/scorm/report/basic/report.php
mod/url/lang/en/url.php
mod/url/lib.php
mod/url/locallib.php
mod/url/mod_form.php
mod/url/simpletest/testlib.php [new file with mode: 0644]
mod/url/version.php
mod/url/view.php
mod/workshop/form/accumulative/assessment_form.php
mod/workshop/form/accumulative/lang/en/workshopform_accumulative.php
mod/workshop/form/numerrors/assessment_form.php
mod/workshop/form/numerrors/lib.php
question/format/qti_two/custommediafilter.php [deleted file]
question/format/qti_two/format.php [deleted file]
question/format/qti_two/qt_common.php [deleted file]
question/format/qti_two/templates/choice.tpl [deleted file]
question/format/qti_two/templates/choiceMultiple.tpl [deleted file]
question/format/qti_two/templates/composite.tpl [deleted file]
question/format/qti_two/templates/extendedText.tpl [deleted file]
question/format/qti_two/templates/extendedText_simpleEssay.tpl [deleted file]
question/format/qti_two/templates/graphicGapMatch.tpl [deleted file]
question/format/qti_two/templates/imsmanifest.tpl [deleted file]
question/format/qti_two/templates/match.tpl [deleted file]
question/format/qti_two/templates/mmchoiceMultiple.tpl [deleted file]
question/format/qti_two/templates/notimplemented.tpl [deleted file]
question/format/qti_two/templates/numerical.tpl [deleted file]
question/format/qti_two/templates/textEntry.tpl [deleted file]
question/type/questiontypebase.php
repository/filepicker.js
repository/repository_ajax.php
search/.cvsignore [deleted file]
search/LISEZMOI.txt [deleted file]
search/README.txt [deleted file]
search/README_ARCHIVE.txt [deleted file]
search/Zend/Exception.php [deleted file]
search/Zend/IMPORTANT.txt [deleted file]
search/Zend/LICENSE.txt [deleted file]
search/Zend/Search/Exception.php [deleted file]
search/Zend/Search/Lucene.php [deleted file]
search/Zend/Search/Lucene/Analysis/Analyzer.php [deleted file]
search/Zend/Search/Lucene/Analysis/Analyzer/Common.php [deleted file]
search/Zend/Search/Lucene/Analysis/Analyzer/Common/Text.php [deleted file]
search/Zend/Search/Lucene/Analysis/Analyzer/Common/Text/CaseInsensitive.php [deleted file]
search/Zend/Search/Lucene/Analysis/Analyzer/Common/TextNum.php [deleted file]
search/Zend/Search/Lucene/Analysis/Analyzer/Common/TextNum/CaseInsensitive.php [deleted file]
search/Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8.php [deleted file]
search/Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8/CaseInsensitive.php [deleted file]
search/Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8Num.php [deleted file]
search/Zend/Search/Lucene/Analysis/Analyzer/Common/Utf8Num/CaseInsensitive.php [deleted file]
search/Zend/Search/Lucene/Analysis/Token.php [deleted file]
search/Zend/Search/Lucene/Analysis/TokenFilter.php [deleted file]
search/Zend/Search/Lucene/Analysis/TokenFilter/LowerCase.php [deleted file]
search/Zend/Search/Lucene/Analysis/TokenFilter/LowerCaseUtf8.php [deleted file]
search/Zend/Search/Lucene/Analysis/TokenFilter/ShortWords.php [deleted file]
search/Zend/Search/Lucene/Analysis/TokenFilter/StopWords.php [deleted file]
search/Zend/Search/Lucene/Document.php [deleted file]
search/Zend/Search/Lucene/Document/Html.php [deleted file]
search/Zend/Search/Lucene/Exception.php [deleted file]
search/Zend/Search/Lucene/FSM.php [deleted file]
search/Zend/Search/Lucene/FSMAction.php [deleted file]
search/Zend/Search/Lucene/Field.php [deleted file]
search/Zend/Search/Lucene/Index/DictionaryLoader.php [deleted file]
search/Zend/Search/Lucene/Index/FieldInfo.php [deleted file]
search/Zend/Search/Lucene/Index/SegmentInfo.php [deleted file]
search/Zend/Search/Lucene/Index/SegmentInfoPriorityQueue.php [deleted file]
search/Zend/Search/Lucene/Index/SegmentMerger.php [deleted file]
search/Zend/Search/Lucene/Index/SegmentWriter.php [deleted file]
search/Zend/Search/Lucene/Index/SegmentWriter/DocumentWriter.php [deleted file]
search/Zend/Search/Lucene/Index/SegmentWriter/StreamWriter.php [deleted file]
search/Zend/Search/Lucene/Index/Term.php [deleted file]
search/Zend/Search/Lucene/Index/TermInfo.php [deleted file]
search/Zend/Search/Lucene/Index/Writer.php [deleted file]
search/Zend/Search/Lucene/Interface.php [deleted file]
search/Zend/Search/Lucene/LockManager.php [deleted file]
search/Zend/Search/Lucene/PriorityQueue.php [deleted file]
search/Zend/Search/Lucene/Proxy.php [deleted file]
search/Zend/Search/Lucene/Search/BooleanExpressionRecognizer.php [deleted file]
search/Zend/Search/Lucene/Search/Query.php [deleted file]
search/Zend/Search/Lucene/Search/Query/Boolean.php [deleted file]
search/Zend/Search/Lucene/Search/Query/Empty.php [deleted file]
search/Zend/Search/Lucene/Search/Query/Fuzzy.php [deleted file]
search/Zend/Search/Lucene/Search/Query/Insignificant.php [deleted file]
search/Zend/Search/Lucene/Search/Query/MultiTerm.php [deleted file]
search/Zend/Search/Lucene/Search/Query/Phrase.php [deleted file]
search/Zend/Search/Lucene/Search/Query/Range.php [deleted file]
search/Zend/Search/Lucene/Search/Query/Term.php [deleted file]
search/Zend/Search/Lucene/Search/Query/Wildcard.php [deleted file]
search/Zend/Search/Lucene/Search/QueryEntry.php [deleted file]
search/Zend/Search/Lucene/Search/QueryEntry/Phrase.php [deleted file]
search/Zend/Search/Lucene/Search/QueryEntry/Subquery.php [deleted file]
search/Zend/Search/Lucene/Search/QueryEntry/Term.php [deleted file]
search/Zend/Search/Lucene/Search/QueryHit.php [deleted file]
search/Zend/Search/Lucene/Search/QueryLexer.php [deleted file]
search/Zend/Search/Lucene/Search/QueryParser.php [deleted file]
search/Zend/Search/Lucene/Search/QueryParserContext.php [deleted file]
search/Zend/Search/Lucene/Search/QueryParserException.php [deleted file]
search/Zend/Search/Lucene/Search/QueryToken.php [deleted file]
search/Zend/Search/Lucene/Search/Similarity.php [deleted file]
search/Zend/Search/Lucene/Search/Similarity/Default.php [deleted file]
search/Zend/Search/Lucene/Search/Weight.php [deleted file]
search/Zend/Search/Lucene/Search/Weight/Boolean.php [deleted file]
search/Zend/Search/Lucene/Search/Weight/Empty.php [deleted file]
search/Zend/Search/Lucene/Search/Weight/MultiTerm.php [deleted file]
search/Zend/Search/Lucene/Search/Weight/Phrase.php [deleted file]
search/Zend/Search/Lucene/Search/Weight/Term.php [deleted file]
search/Zend/Search/Lucene/Storage/Directory.php [deleted file]
search/Zend/Search/Lucene/Storage/Directory/Filesystem.php [deleted file]
search/Zend/Search/Lucene/Storage/File.php [deleted file]
search/Zend/Search/Lucene/Storage/File/Filesystem.php [deleted file]
search/Zend/Search/Lucene/Storage/File/Memory.php [deleted file]
search/Zend/Search/TODO.txt [deleted file]
search/add.php [deleted file]
search/cron.php [deleted file]
search/cron_php5.php [deleted file]
search/delete.php [deleted file]
search/documents/assignment_document.php [deleted file]
search/documents/chat_document.php [deleted file]
search/documents/data_document.php [deleted file]
search/documents/document.php [deleted file]
search/documents/forum_document.php [deleted file]
search/documents/glossary_document.php [deleted file]
search/documents/label_document.php [deleted file]
search/documents/lesson_document.php [deleted file]
search/documents/physical_doc.php [deleted file]
search/documents/physical_htm.php [deleted file]
search/documents/physical_html.php [deleted file]
search/documents/physical_odt.php [deleted file]
search/documents/physical_pdf.php [deleted file]
search/documents/physical_ppt.php [deleted file]
search/documents/physical_swf.php [deleted file]
search/documents/physical_txt.php [deleted file]
search/documents/physical_xml.php [deleted file]
search/documents/resource_document.php [deleted file]
search/documents/user_document.php [deleted file]
search/documents/wiki_document.php [deleted file]
search/index.php [deleted file]
search/indexer.php [deleted file]
search/indexersplash.php [deleted file]
search/indexlib.php [deleted file]
search/lib.php [deleted file]
search/query.php [deleted file]
search/querylib.php [deleted file]
search/searchtypes.php [deleted file]
search/stats.php [deleted file]
search/tests/index.php [deleted file]
search/update.php [deleted file]
theme/canvas/style/pagelayout.css
theme/overlay/style/core.css
version.php

index 2ee2f82..2524c41 100644 (file)
@@ -46,8 +46,8 @@ Options:
 --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:
index 7c23e2c..be5780b 100644 (file)
@@ -598,7 +598,7 @@ class core_admin_renderer extends plugin_renderer_base {
             if (is_null($otherplugin)) {
                 $ok = false;
             }
-            if ($requiredversion != ANY_VERSION and $otherplugin->versiondb < $requiredversion) {
+            if ($requiredversion != ANY_VERSION and $otherplugin->versiondisk < $requiredversion) {
                 $ok = false;
             }
 
index 192df5b..d6c9e4f 100644 (file)
@@ -7,11 +7,7 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
     // 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));
diff --git a/blocks/search/README.txt b/blocks/search/README.txt
deleted file mode 100644 (file)
index 48dfb9f..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-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
diff --git a/blocks/search/block_search.php b/blocks/search/block_search.php
deleted file mode 100644 (file)
index 1aeb08c..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-<?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
-
diff --git a/blocks/search/db/install.php b/blocks/search/db/install.php
deleted file mode 100644 (file)
index f8a13cf..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<?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'));
-
-}
-
diff --git a/blocks/search/db/install.xml b/blocks/search/db/install.xml
deleted file mode 100644 (file)
index c5c2b52..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-<?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
diff --git a/blocks/search/db/upgrade.php b/blocks/search/db/upgrade.php
deleted file mode 100644 (file)
index 952a129..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-<?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;
-}
diff --git a/blocks/search/lang/en/block_search.php b/blocks/search/lang/en/block_search.php
deleted file mode 100644 (file)
index 06df0ed..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-<?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';
diff --git a/blocks/search/settings.php b/blocks/search/settings.php
deleted file mode 100644 (file)
index 44fee6c..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-<?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') , ''));
-    }
-
-}
-
index 95f3e9a..5255a72 100644 (file)
@@ -842,7 +842,7 @@ function calendar_filter_controls(moodle_url $returnurl) {
 
     $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>';
index 8e502a8..48d1ef3 100644 (file)
@@ -580,7 +580,7 @@ class core_calendar_renderer extends plugin_renderer_base {
         $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')).')');
@@ -590,7 +590,7 @@ class core_calendar_renderer extends plugin_renderer_base {
         }
 
         // 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')).')');
@@ -603,7 +603,7 @@ class core_calendar_renderer extends plugin_renderer_base {
         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')).')');
@@ -612,7 +612,7 @@ class core_calendar_renderer extends plugin_renderer_base {
                 $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')).')');
@@ -701,7 +701,7 @@ class core_calendar_renderer extends plugin_renderer_base {
         } 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;
index 020a636..2633369 100644 (file)
 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':
@@ -63,4 +65,4 @@ switch($var) {
         break;
 }
 
-redirect($return);
\ No newline at end of file
+redirect($return);
index 02004b4..5c3caa8 100644 (file)
@@ -82,6 +82,7 @@ $PAGE->set_heading($course->fullname);
 $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
 
index 206ee89..92d5e74 100644 (file)
@@ -209,10 +209,10 @@ class enrol_manual_plugin extends enrol_plugin {
         $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');
index 14a62f8..a1edd91 100644 (file)
@@ -47,6 +47,7 @@ $string['longtimenosee_help'] = 'If users haven\'t accessed a course for a long
 $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.
 
index d86d0cb..378b54a 100644 (file)
@@ -189,15 +189,6 @@ class enrol_self_plugin extends enrol_plugin {
             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");
 
index 2d74493..1742339 100644 (file)
@@ -30,6 +30,7 @@ require_once("$CFG->libdir/formslib.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
@@ -42,19 +43,33 @@ class enrol_self_enrol_form extends moodleform {
     }
 
     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'));
@@ -74,6 +89,11 @@ class enrol_self_enrol_form extends moodleform {
         $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) {
index e0178ca..b23c042 100644 (file)
@@ -26,5 +26,5 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version = 2010090501;
+$plugin->version = 2010090502;
 $plugin->cron    = 180;
\ No newline at end of file
diff --git a/filter/data/db/install.php b/filter/data/db/install.php
new file mode 100644 (file)
index 0000000..dd171b8
--- /dev/null
@@ -0,0 +1,40 @@
+<?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'));
+    }
+}
diff --git a/filter/data/filter.php b/filter/data/filter.php
new file mode 100644 (file)
index 0000000..60ca85f
--- /dev/null
@@ -0,0 +1,129 @@
+<?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.
+                                  '&amp;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;
+        }
+    }
+}
similarity index 68%
rename from blocks/search/version.php
rename to filter/data/lang/en/filter_data.php
index b745682..a6d1f4d 100644 (file)
@@ -1,5 +1,4 @@
 <?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';
similarity index 54%
rename from blocks/search/db/upgradelib.php
rename to filter/data/version.php
index a85c452..a6ec47b 100644 (file)
@@ -1,5 +1,4 @@
 <?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);
diff --git a/filter/glossary/db/install.php b/filter/glossary/db/install.php
new file mode 100644 (file)
index 0000000..76bf66f
--- /dev/null
@@ -0,0 +1,40 @@
+<?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'));
+    }
+}
diff --git a/filter/glossary/filter.php b/filter/glossary/filter.php
new file mode 100644 (file)
index 0000000..8592626
--- /dev/null
@@ -0,0 +1,226 @@
+<?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.
+                                      '&amp;mode=cat&amp;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';
diff --git a/filter/glossary/styles.css b/filter/glossary/styles.css
new file mode 100644 (file)
index 0000000..8a78bdb
--- /dev/null
@@ -0,0 +1 @@
+#glossaryfilteroverlayprogress {position:fixed;top:50%;width:100%;text-align:center;}
diff --git a/filter/glossary/version.php b/filter/glossary/version.php
new file mode 100644 (file)
index 0000000..4628335
--- /dev/null
@@ -0,0 +1,32 @@
+<?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);
similarity index 90%
rename from mod/glossary/yui/autolinker/autolinker.js
rename to filter/glossary/yui/autolinker/autolinker.js
index e8935f3..46d04bc 100644 (file)
@@ -1,6 +1,6 @@
-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',
@@ -33,7 +33,7 @@ YUI.add('moodle-mod_glossary-autolinker', function(Y) {
 
                 //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
@@ -61,7 +61,7 @@ YUI.add('moodle-mod_glossary-autolinker', function(Y) {
                 };
                 Y.io(fullurl, cfg);
 
-            }, Y.one(document.body), 'a.glossary.autolink');
+            }, Y.one(document.body), 'a.glossary.autolink.concept');
         },
         display_callback : function(content) {
             try {
@@ -126,9 +126,9 @@ YUI.add('moodle-mod_glossary-autolinker', function(Y) {
         }
     });
 
-    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']});
index 44d738d..9b0c41f 100644 (file)
@@ -183,7 +183,7 @@ var createLoaderImg = function (elClass, parentId, wwwRoot) {
     }
     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");
index 5dfe0f2..fcb3a95 100644 (file)
@@ -189,7 +189,6 @@ $string['configenableajax'] = 'This setting allows you to control the use of AJA
 $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.';
@@ -468,7 +467,6 @@ $string['enablecourseajax'] = 'Enable AJAX course editing';
 $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';
index c963b3e..947fbbc 100644 (file)
@@ -219,6 +219,7 @@ $string['nocate'] = 'No such category {$a}!';
 $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.';
index 6ef78db..4479379 100644 (file)
@@ -1969,31 +1969,70 @@ function is_enrolled(context $context, $user = null, $withcapability = '', $only
  * 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.
@@ -2003,41 +2042,64 @@ function can_access_course(context $context, $user = null, $withcapability = '',
         $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;
 }
 
 /**
index 0184da5..647f27d 100644 (file)
@@ -6808,6 +6808,38 @@ FROM
         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;
 }
 
index c3ce81c..5ddf736 100644 (file)
@@ -1133,14 +1133,6 @@ abstract class enrol_plugin {
             $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;
@@ -1152,6 +1144,15 @@ abstract class enrol_plugin {
             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])) {
index 7dd5b93..3feb6de 100644 (file)
@@ -508,10 +508,16 @@ function filter_get_name($filter) {
 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);
index f19b97b..5bbc9c3 100644 (file)
@@ -1692,7 +1692,7 @@ M.util.load_flowplayer = function() {
                     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;
                         }
index 2a9fed0..7780f7f 100644 (file)
@@ -6383,6 +6383,7 @@ class core_string_manager implements string_manager {
             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));
             }
         }
diff --git a/lib/mp3player/index.html b/lib/mp3player/index.html
deleted file mode 100644 (file)
index 8d1c8b6..0000000
+++ /dev/null
@@ -1 +0,0 @@
diff --git a/lib/mp3player/mp3player.fla.zip b/lib/mp3player/mp3player.fla.zip
deleted file mode 100644 (file)
index 23c26ae..0000000
Binary files a/lib/mp3player/mp3player.fla.zip and /dev/null differ
diff --git a/lib/mp3player/mp3player.swf b/lib/mp3player/mp3player.swf
deleted file mode 100644 (file)
index de481d5..0000000
Binary files a/lib/mp3player/mp3player.swf and /dev/null differ
diff --git a/lib/mp3player/readme.txt b/lib/mp3player/readme.txt
deleted file mode 100644 (file)
index c300929..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-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)
-
index e5463fd..e48f419 100644 (file)
@@ -1112,10 +1112,9 @@ class global_navigation extends navigation_node {
 
                 // 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;
@@ -1164,8 +1163,7 @@ class global_navigation extends navigation_node {
 
                 // 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;
@@ -1232,8 +1230,7 @@ class global_navigation extends navigation_node {
 
                     // 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;
@@ -1507,7 +1504,7 @@ class global_navigation extends navigation_node {
      */
     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);
@@ -2089,7 +2086,7 @@ class global_navigation extends navigation_node {
                     $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', ''));
                 }
 
@@ -3614,7 +3611,7 @@ class settings_navigation extends navigation_node {
             } 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) {
index 02719a7..fec3617 100644 (file)
@@ -241,7 +241,7 @@ class plugin_manager {
                 return false;
             }
 
-            if ($requiredversion != ANY_VERSION and $otherplugin->versiondb < $requiredversion) {
+            if ($requiredversion != ANY_VERSION and $otherplugin->versiondisk < $requiredversion) {
                 return false;
             }
         }
@@ -298,7 +298,7 @@ class plugin_manager {
                 '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'
             ),
@@ -385,7 +385,7 @@ class plugin_manager {
 
             'qformat' => array(
                 'aiken', 'blackboard', 'blackboard_six', 'examview', 'gift',
-                'learnwise', 'missingword', 'multianswer', 'qti_two', 'webct',
+                'learnwise', 'missingword', 'multianswer', 'webct',
                 'xhtml', 'xml'
             ),
 
index 25c8e72..4df0be9 100644 (file)
@@ -233,6 +233,8 @@ function resourcelib_embed_mp3($fullurl, $title, $clicktoopen) {
 
     if ($fullurl instanceof moodle_url) {
         $fullurl = $fullurl->out(false);
+    } else {
+        $fullurl = str_replace('&amp;', '&', $fullurl);
     }
 
     $id = 'resource_mp3_'.time(); //we need something unique because it might be stored in text cache
@@ -259,6 +261,8 @@ function resourcelib_embed_flashvideo($fullurl, $title, $clicktoopen) {
 
     if ($fullurl instanceof moodle_url) {
         $fullurl = $fullurl->out(false);
+    } else {
+        $fullurl = str_replace('&amp;', '&', $fullurl);
     }
 
     $id = 'resource_flv_'.time(); //we need something unique because it might be stored in text cache
diff --git a/lib/smarty/COPYING.lib b/lib/smarty/COPYING.lib
deleted file mode 100644 (file)
index 3b20440..0000000
+++ /dev/null
@@ -1,458 +0,0 @@
-                 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
diff --git a/lib/smarty/Config_File.class.php b/lib/smarty/Config_File.class.php
deleted file mode 100644 (file)
index ae0c3be..0000000
+++ /dev/null
@@ -1,393 +0,0 @@
-<?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);
-    }
-    /**#@-*/
-}
-
-?>
diff --git a/lib/smarty/Smarty.class.php b/lib/smarty/Smarty.class.php
deleted file mode 100644 (file)
index a3e2ed8..0000000
+++ /dev/null
@@ -1,1961 +0,0 @@
-<?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 304 Not Modified');
-
-                        } else {
-                            header('Last-Modified: '.$_gmt_mtime);
-                            echo $_smarty_results;
-                        }
-                    } else {
-                            echo $_smarty_results;
-                    }
-                    error_reporting($_smarty_old_error_level);
-                    // restore initial cache_info
-                    $this->_cache_info = array_pop($_cache_info);
-                    return true;
-                } else {
-                    error_reporting($_smarty_old_error_level);
-                    // restore initial cache_info
-                    $this->_cache_info = array_pop($_cache_info);
-                    return $_smarty_results;
-                }
-            } else {
-                $this->_cache_info['template'][$resource_name] = true;
-                if ($this->cache_modified_check && $display) {
-                    header('Last-Modified: '.gmdate('D, d M Y H:i:s', time()).' GMT');
-                }
-            }
-        }
-
-        // load filters that are marked as autoload
-        if (count($this->autoload_filters)) {
-            foreach ($this->autoload_filters as $_filter_type => $_filters) {
-                foreach ($_filters as $_filter) {
-                    $this->load_filter($_filter_type, $_filter);
-                }
-            }
-        }
-
-        $_smarty_compile_path = $this->_get_compile_path($resource_name);
-
-        // if we just need to display the results, don't perform output
-        // buffering - for speed
-        $_cache_including = $this->_cache_including;
-        $this->_cache_including = false;
-        if ($display && !$this->caching && count($this->_plugins['outputfilter']) == 0) {
-            if ($this->_is_compiled($resource_name, $_smarty_compile_path)
-                    || $this->_compile_resource($resource_name, $_smarty_compile_path))
-            {
-                include($_smarty_compile_path);
-            }
-        } else {
-            ob_start();
-            if ($this->_is_compiled($resource_name, $_smarty_compile_path)
-                    || $this->_compile_resource($resource_name, $_smarty_compile_path))
-            {
-                include($_smarty_compile_path);
-            }
-            $_smarty_results = ob_get_contents();
-            ob_end_clean();
-
-            foreach ((array)$this->_plugins['outputfilter'] as $_output_filter) {
-                $_smarty_results = call_user_func_array($_output_filter[0], array($_smarty_results, &$this));
-            }
-        }
-
-        if ($this->caching) {
-            $_params = array('tpl_file' => $resource_name,
-                        'cache_id' => $cache_id,
-                        'compile_id' => $compile_id,
-                        'results' => $_smarty_results);
-            require_once(SMARTY_CORE_DIR . 'core.write_cache_file.php');
-            smarty_core_write_cache_file($_params, $this);
-            require_once(SMARTY_CORE_DIR . 'core.process_cached_inserts.php');
-            $_smarty_results = smarty_core_process_cached_inserts($_params, $this);
-
-            if ($this->_cache_serials) {
-                // strip nocache-tags from output
-                $_smarty_results = preg_replace('!(\{/?nocache\:[0-9a-f]{32}#\d+\})!s'
-                                                ,''
-                                                ,$_smarty_results);
-            }
-            // restore initial cache_info
-            $this->_cache_info = array_pop($_cache_info);
-        }
-        $this->_cache_including = $_cache_including;
-
-        if ($display) {
-            if (isset($_smarty_results)) { echo $_smarty_results; }
-            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');
-                echo smarty_core_display_debug_console($_params, $this);
-            }
-            error_reporting($_smarty_old_error_level);
-            return;
-        } else {
-            error_reporting($_smarty_old_error_level);
-            if (isset($_smarty_results)) { return $_smarty_results; }
-        }
-    }
-
-    /**
-     * load configuration values
-     *
-     * @param string $file
-     * @param string $section
-     * @param string $scope
-     */
-    function config_load($file, $section = null, $scope = 'global')
-    {
-        require_once($this->_get_plugin_filepath('function', 'config_load'));
-        smarty_function_config_load(array('file' => $file, 'section' => $section, 'scope' => $scope), $this);
-    }
-
-    /**
-     * return a reference to a registered object
-     *
-     * @param string $name
-     * @return object
-     */
-    function &get_registered_object($name) {
-        if (!isset($this->_reg_objects[$name]))
-        $this->_trigger_fatal_error("'$name' is not a registered object");
-
-        if (!is_object($this->_reg_objects[$name][0]))
-        $this->_trigger_fatal_error("registered '$name' is not an object");
-
-        return $this->_reg_objects[$name][0];
-    }
-
-    /**
-     * clear configuration values
-     *
-     * @param string $var
-     */
-    function clear_config($var = null)
-    {
-        if(!isset($var)) {
-            // clear all values
-            $this->_config = array(array('vars'  => array(),
-                                         'files' => array()));
-        } else {
-            unset($this->_config[0]['vars'][$var]);
-        }
-    }
-
-    /**
-     * get filepath of requested plugin
-     *
-     * @param string $type
-     * @param string $name
-     * @return string|false
-     */
-    function _get_plugin_filepath($type, $name)
-    {
-        $_params = array('type' => $type, 'name' => $name);
-        require_once(SMARTY_CORE_DIR . 'core.assemble_plugin_filepath.php');
-        return smarty_core_assemble_plugin_filepath($_params, $this);
-    }
-
-   /**
-     * test if resource needs compiling
-     *
-     * @param string $resource_name
-     * @param string $compile_path
-     * @return boolean
-     */
-    function _is_compiled($resource_name, $compile_path)
-    {
-        if (!$this->force_compile && file_exists($compile_path)) {
-            if (!$this->compile_check) {
-                // no need to check compiled file
-                return true;
-            } else {
-                // get file source and timestamp
-                $_params = array('resource_name' => $resource_name, 'get_source'=>false);
-                if (!$this->_fetch_resource_info($_params)) {
-                    return false;
-                }
-                if ($_params['resource_timestamp'] <= filemtime($compile_path)) {
-                    // template not expired, no recompile
-                    return true;
-                } else {
-                    // compile template
-                    return false;
-                }
-            }
-        } else {
-            // compiled template does not exist, or forced compile
-            return false;
-        }
-    }
-
-   /**
-     * compile the template
-     *
-     * @param string $resource_name
-     * @param string $compile_path
-     * @return boolean
-     */
-    function _compile_resource($resource_name, $compile_path)
-    {
-
-        $_params = array('resource_name' => $resource_name);
-        if (!$this->_fetch_resource_info($_params)) {
-            return false;
-        }
-
-        $_source_content = $_params['source_content'];
-        $_cache_include    = substr($compile_path, 0, -4).'.inc';
-
-        if ($this->_compile_source($resource_name, $_source_content, $_compiled_content, $_cache_include)) {
-            // if a _cache_serial was set, we also have to write an include-file:
-            if ($this->_cache_include_info) {
-                require_once(SMARTY_CORE_DIR . 'core.write_compiled_include.php');
-                smarty_core_write_compiled_include(array_merge($this->_cache_include_info, array('compiled_content'=>$_compiled_content, 'resource_name'=>$resource_name)),  $this);
-            }
-
-            $_params = array('compile_path'=>$compile_path, 'compiled_content' => $_compiled_content);
-            require_once(SMARTY_CORE_DIR . 'core.write_compiled_resource.php');
-            smarty_core_write_compiled_resource($_params, $this);
-
-            return true;
-        } else {
-            return false;
-        }
-
-    }
-
-   /**
-     * compile the given source
-     *
-     * @param string $resource_name
-     * @param string $source_content
-     * @param string $compiled_content
-     * @return boolean
-     */
-    function _compile_source($resource_name, &$source_content, &$compiled_content, $cache_include_path=null)
-    {
-        if (file_exists(SMARTY_DIR . $this->compiler_file)) {
-            require_once(SMARTY_DIR . $this->compiler_file);
-        } else {
-            // use include_path
-            require_once($this->compiler_file);
-        }
-
-
-        $smarty_compiler = new $this->compiler_class;
-
-        $smarty_compiler->template_dir      = $this->template_dir;
-        $smarty_compiler->compile_dir       = $this->compile_dir;
-        $smarty_compiler->plugins_dir       = $this->plugins_dir;
-        $smarty_compiler->config_dir        = $this->config_dir;
-        $smarty_compiler->force_compile     = $this->force_compile;
-        $smarty_compiler->caching           = $this->caching;
-        $smarty_compiler->php_handling      = $this->php_handling;
-        $smarty_compiler->left_delimiter    = $this->left_delimiter;
-        $smarty_compiler->right_delimiter   = $this->right_delimiter;
-        $smarty_compiler->_version          = $this->_version;
-        $smarty_compiler->security          = $this->security;
-        $smarty_compiler->secure_dir        = $this->secure_dir;
-        $smarty_compiler->security_settings = $this->security_settings;
-        $smarty_compiler->trusted_dir       = $this->trusted_dir;
-        $smarty_compiler->use_sub_dirs      = $this->use_sub_dirs;
-        $smarty_compiler->_reg_objects      = &$this->_reg_objects;
-        $smarty_compiler->_plugins          = &$this->_plugins;
-        $smarty_compiler->_tpl_vars         = &$this->_tpl_vars;
-        $smarty_compiler->default_modifiers = $this->default_modifiers;
-        $smarty_compiler->compile_id        = $this->_compile_id;
-        $smarty_compiler->_config            = $this->_config;
-        $smarty_compiler->request_use_auto_globals  = $this->request_use_auto_globals;
-
-        if (isset($cache_include_path) && isset($this->_cache_serials[$cache_include_path])) {
-            $smarty_compiler->_cache_serial = $this->_cache_serials[$cache_include_path];
-        }
-        $smarty_compiler->_cache_include = $cache_include_path;
-
-
-        $_results = $smarty_compiler->_compile_file($resource_name, $source_content, $compiled_content);
-
-        if ($smarty_compiler->_cache_serial) {
-            $this->_cache_include_info = array(
-                'cache_serial'=>$smarty_compiler->_cache_serial
-                ,'plugins_code'=>$smarty_compiler->_plugins_code
-                ,'include_file_path' => $cache_include_path);
-
-        } else {
-            $this->_cache_include_info = null;
-
-        }
-
-        return $_results;
-    }
-
-    /**
-     * Get the compile path for this resource
-     *
-     * @param string $resource_name
-     * @return string results of {@link _get_auto_filename()}
-     */
-    function _get_compile_path($resource_name)
-    {
-        return $this->_get_auto_filename($this->compile_dir, $resource_name,
-                                         $this->_compile_id) . '.php';
-    }
-
-    /**
-     * fetch the template info. Gets timestamp, and source
-     * if get_source is true
-     *
-     * sets $source_content to the source of the template, and
-     * $resource_timestamp to its time stamp
-     * @param string $resource_name
-     * @param string $source_content
-     * @param integer $resource_timestamp
-     * @param boolean $get_source
-     * @param boolean $quiet
-     * @return boolean
-     */
-
-    function _fetch_resource_info(&$params)
-    {
-        if(!isset($params['get_source'])) { $params['get_source'] = true; }
-        if(!isset($params['quiet'])) { $params['quiet'] = false; }
-
-        $_return = false;
-        $_params = array('resource_name' => $params['resource_name']) ;
-        if (isset($params['resource_base_path']))
-            $_params['resource_base_path'] = $params['resource_base_path'];
-        else
-            $_params['resource_base_path'] = $this->template_dir;
-
-        if ($this->_parse_resource_name($_params)) {
-            $_resource_type = $_params['resource_type'];
-            $_resource_name = $_params['resource_name'];
-            switch ($_resource_type) {
-                case 'file':
-                    if ($params['get_source']) {
-                        $params['source_content'] = $this->_read_file($_resource_name);
-                    }
-                    $params['resource_timestamp'] = filemtime($_resource_name);
-                    $_return = is_file($_resource_name) && is_readable($_resource_name);
-                    break;
-
-                default:
-                    // call resource functions to fetch the template source and timestamp
-                    if ($params['get_source']) {
-                        $_source_return = isset($this->_plugins['resource'][$_resource_type]) &&
-                            call_user_func_array($this->_plugins['resource'][$_resource_type][0][0],
-                                                 array($_resource_name, &$params['source_content'], &$this));
-                    } else {
-                        $_source_return = true;
-                    }
-
-                    $_timestamp_return = isset($this->_plugins['resource'][$_resource_type]) &&
-                        call_user_func_array($this->_plugins['resource'][$_resource_type][0][1],
-                                             array($_resource_name, &$params['resource_timestamp'], &$this));
-
-                    $_return = $_source_return && $_timestamp_return;
-                    break;
-            }
-        }
-
-        if (!$_return) {
-            // see if we can get a template with the default template handler
-            if (!empty($this->default_template_handler_func)) {
-                if (!is_callable($this->default_template_handler_func)) {
-                    $this->trigger_error("default template handler function \"$this->default_template_handler_func\" doesn't exist.");
-                } else {
-                    $_return = call_user_func_array(
-                        $this->default_template_handler_func,
-                        array($_params['resource_type'], $_params['resource_name'], &$params['source_content'], &$params['resource_timestamp'], &$this));
-                }
-            }
-        }
-
-        if (!$_return) {
-            if (!$params['quiet']) {
-                $this->trigger_error('unable to read resource: "' . $params['resource_name'] . '"');
-            }
-        } else if ($_return && $this->security) {
-            require_once(SMARTY_CORE_DIR . 'core.is_secure.php');
-            if (!smarty_core_is_secure($_params, $this)) {
-                if (!$params['quiet'])
-                    $this->trigger_error('(secure mode) accessing "' . $params['resource_name'] . '" is not allowed');
-                $params['source_content'] = null;
-                $params['resource_timestamp'] = null;
-                return false;
-            }
-        }
-        return $_return;
-    }
-
-
-    /**
-     * parse out the type and name from the resource
-     *
-     * @param string $resource_base_path
-     * @param string $resource_name
-     * @param string $resource_type
-     * @param string $resource_name
-     * @return boolean
-     */
-
-    function _parse_resource_name(&$params)
-    {
-
-        // split tpl_path by the first colon
-        $_resource_name_parts = explode(':', $params['resource_name'], 2);
-
-        if (count($_resource_name_parts) == 1) {
-            // no resource type given
-            $params['resource_type'] = $this->default_resource_type;
-            $params['resource_name'] = $_resource_name_parts[0];
-        } else {
-            if(strlen($_resource_name_parts[0]) == 1) {
-                // 1 char is not resource type, but part of filepath
-                $params['resource_type'] = $this->default_resource_type;
-                $params['resource_name'] = $params['resource_name'];
-            } else {
-                $params['resource_type'] = $_resource_name_parts[0];
-                $params['resource_name'] = $_resource_name_parts[1];
-            }
-        }
-
-        if ($params['resource_type'] == 'file') {
-            if (!preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $params['resource_name'])) {
-                // relative pathname to $params['resource_base_path']
-                // use the first directory where the file is found
-                foreach ((array)$params['resource_base_path'] as $_curr_path) {
-                    $_fullpath = $_curr_path . DIRECTORY_SEPARATOR . $params['resource_name'];
-                    if (file_exists($_fullpath) && is_file($_fullpath)) {
-                        $params['resource_name'] = $_fullpath;
-                        return true;
-                    }
-                    // didn't find the file, try include_path
-                    $_params = array('file_path' => $_fullpath);
-                    require_once(SMARTY_CORE_DIR . 'core.get_include_path.php');
-                    if(smarty_core_get_include_path($_params, $this)) {
-                        $params['resource_name'] = $_params['new_file_path'];
-                        return true;
-                    }
-                }
-                return false;
-            } else {
-                /* absolute path */
-                return file_exists($params['resource_name']);
-            }
-        } elseif (empty($this->_plugins['resource'][$params['resource_type']])) {
-            $_params = array('type' => $params['resource_type']);
-            require_once(SMARTY_CORE_DIR . 'core.load_resource_plugin.php');
-            smarty_core_load_resource_plugin($_params, $this);
-        }
-
-        return true;
-    }
-
-
-    /**
-     * Handle modifiers
-     *
-     * @param string|null $modifier_name
-     * @param array|null $map_array
-     * @return string result of modifiers
-     */
-    function _run_mod_handler()
-    {
-        $_args = func_get_args();
-        list($_modifier_name, $_map_array) = array_splice($_args, 0, 2);
-        list($_func_name, $_tpl_file, $_tpl_line) =
-            $this->_plugins['modifier'][$_modifier_name];
-
-        $_var = $_args[0];
-        foreach ($_var as $_key => $_val) {
-            $_args[0] = $_val;
-            $_var[$_key] = call_user_func_array($_func_name, $_args);
-        }
-        return $_var;
-    }
-
-    /**
-     * Remove starting and ending quotes from the string
-     *
-     * @param string $string
-     * @return string
-     */
-    function _dequote($string)
-    {
-        if ((substr($string, 0, 1) == "'" || substr($string, 0, 1) == '"') &&
-            substr($string, -1) == substr($string, 0, 1))
-            return substr($string, 1, -1);
-        else
-            return $string;
-    }
-
-
-    /**
-     * read in a file
-     *
-     * @param string $filename
-     * @return string
-     */
-    function _read_file($filename)
-    {
-        if ( file_exists($filename) && is_readable($filename) && ($fd = @fopen($filename, 'rb')) ) {
-            $contents = '';
-            while (!feof($fd)) {
-                $contents .= fread($fd, 8192);
-            }
-            fclose($fd);
-            return $contents;
-        } else {
-            return false;
-        }
-    }
-
-    /**
-     * get a concrete filename for automagically created content
-     *
-     * @param string $auto_base
-     * @param string $auto_source
-     * @param string $auto_id
-     * @return string
-     * @staticvar string|null
-     * @staticvar string|null
-     */
-    function _get_auto_filename($auto_base, $auto_source = null, $auto_id = null)
-    {
-        $_compile_dir_sep =  $this->use_sub_dirs ? DIRECTORY_SEPARATOR : '^';
-        $_return = $auto_base . DIRECTORY_SEPARATOR;
-
-        if(isset($auto_id)) {
-            // make auto_id safe for directory names
-            $auto_id = str_replace('%7C',$_compile_dir_sep,(urlencode($auto_id)));
-            // split into separate directories
-            $_return .= $auto_id . $_compile_dir_sep;
-        }
-
-        if(isset($auto_source)) {
-            // make source name safe for filename
-            $_filename = urlencode(basename($auto_source));
-            $_crc32 = sprintf('%08X', crc32($auto_source));
-            // prepend %% to avoid name conflicts with
-            // with $params['auto_id'] names
-            $_crc32 = substr($_crc32, 0, 2) . $_compile_dir_sep .
-                      substr($_crc32, 0, 3) . $_compile_dir_sep . $_crc32;
-            $_return .= '%%' . $_crc32 . '%%' . $_filename;
-        }
-
-        return $_return;
-    }
-
-    /**
-     * unlink a file, possibly using expiration time
-     *
-     * @param string $resource
-     * @param integer $exp_time
-     */
-    function _unlink($resource, $exp_time = null)
-    {
-        if(isset($exp_time)) {
-            if(time() - @filemtime($resource) >= $exp_time) {
-                return @unlink($resource);
-            }
-        } else {
-            return @unlink($resource);
-        }
-    }
-
-    /**
-     * returns an auto_id for auto-file-functions
-     *
-     * @param string $cache_id
-     * @param string $compile_id
-     * @return string|null
-     */
-    function _get_auto_id($cache_id=null, $compile_id=null) {
-    if (isset($cache_id))
-        return (isset($compile_id)) ? $cache_id . '|' . $compile_id  : $cache_id;
-    elseif(isset($compile_id))
-        return $compile_id;
-    else
-        return null;
-    }
-
-    /**
-     * trigger Smarty plugin error
-     *
-     * @param string $error_msg
-     * @param string $tpl_file
-     * @param integer $tpl_line
-     * @param string $file
-     * @param integer $line
-     * @param integer $error_type
-     */
-    function _trigger_fatal_error($error_msg, $tpl_file = null, $tpl_line = null,
-            $file = null, $line = null, $error_type = E_USER_ERROR)
-    {
-        if(isset($file) && isset($line)) {
-            $info = ' ('.basename($file).", line $line)";
-        } else {
-            $info = '';
-        }
-        if (isset($tpl_line) && isset($tpl_file)) {
-            $this->trigger_error('[in ' . $tpl_file . ' line ' . $tpl_line . "]: $error_msg$info", $error_type);
-        } else {
-            $this->trigger_error($error_msg . $info, $error_type);
-        }
-    }
-
-
-    /**
-     * callback function for preg_replace, to call a non-cacheable block
-     * @return string
-     */
-    function _process_compiled_include_callback($match) {
-        $_func = '_smarty_tplfunc_'.$match[2].'_'.$match[3];
-        ob_start();
-        $_func($this);
-        $_ret = ob_get_contents();
-        ob_end_clean();
-        return $_ret;
-    }
-
-
-    /**
-     * called for included templates
-     *
-     * @param string $_smarty_include_tpl_file
-     * @param string $_smarty_include_vars
-     */
-
-    // $_smarty_include_tpl_file, $_smarty_include_vars
-
-    function _smarty_include($params)
-    {
-        if ($this->debugging) {
-            $_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'  => $params['smarty_include_tpl_file'],
-                                                  'depth'     => ++$this->_inclusion_depth);
-            $included_tpls_idx = count($this->_smarty_debug_info) - 1;
-        }
-
-        $this->_tpl_vars = array_merge($this->_tpl_vars, $params['smarty_include_vars']);
-
-        // config vars are treated as local, so push a copy of the
-        // current ones onto the front of the stack
-        array_unshift($this->_config, $this->_config[0]);
-
-        $_smarty_compile_path = $this->_get_compile_path($params['smarty_include_tpl_file']);
-
-
-        if ($this->_is_compiled($params['smarty_include_tpl_file'], $_smarty_compile_path)
-            || $this->_compile_resource($params['smarty_include_tpl_file'], $_smarty_compile_path))
-        {
-            include($_smarty_compile_path);
-        }
-
-        // pop the local vars off the front of the stack
-        array_shift($this->_config);
-
-        $this->_inclusion_depth--;
-
-        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;
-        }
-
-        if ($this->caching) {
-            $this->_cache_info['template'][$params['smarty_include_tpl_file']] = true;
-        }
-    }
-
-
-    /**
-     * get or set an array of cached attributes for function that is
-     * not cacheable
-     * @return array
-     */
-    function &_smarty_cache_attrs($cache_serial, $count) {
-        $_cache_attrs =& $this->_cache_info['cache_attrs'][$cache_serial][$count];
-
-        if ($this->_cache_including) {
-            /* return next set of cache_attrs */
-            $_return = current($_cache_attrs);
-            next($_cache_attrs);
-            return $_return;
-
-        } else {
-            /* add a reference to a new set of cache_attrs */
-            $_cache_attrs[] = array();
-            return $_cache_attrs[count($_cache_attrs)-1];
-
-        }
-
-    }
-
-
-    /**
-     * wrapper for include() retaining $this
-     * @return mixed
-     */
-    function _include($filename, $once=false, $params=null)
-    {
-        if ($once) {
-            return include_once($filename);
-        } else {
-            return include($filename);
-        }
-    }
-
-
-    /**
-     * wrapper for eval() retaining $this
-     * @return mixed
-     */
-    function _eval($code, $params=null)
-    {
-        return eval($code);
-    }
-    
-    /**
-     * Extracts the filter name from the given callback
-     * 
-     * @param callback $function
-     * @return string
-     */
-       function _get_filter_name($function)
-       {
-               if (is_array($function)) {
-                       $_class_name = (is_object($function[0]) ?
-                               get_class($function[0]) : $function[0]);
-                       return $_class_name . '_' . $function[1];
-               }
-               else {
-                       return $function;
-               }
-       }
-  
-    /**#@-*/
-
-}
-
-/* vim: set expandtab: */
-
-?>
diff --git a/lib/smarty/Smarty_Compiler.class.php b/lib/smarty/Smarty_Compiler.class.php
deleted file mode 100644 (file)
index f6a278d..0000000
+++ /dev/null
@@ -1,2365 +0,0 @@
-<?php
-
-/**
- * Project:     Smarty: the PHP compiling template engine
- * File:        Smarty_Compiler.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
- *
- * @link http://smarty.php.net/
- * @author Monte Ohrt <monte at ohrt dot com>
- * @author Andrei Zmievski <andrei@php.net>
- * @version 2.6.26
- * @copyright 2001-2005 New Digital Group, Inc.
- * @package Smarty
- */
-
-/* $Id$ */
-
-/**
- * Template compiling class
- * @package Smarty
- */
-class Smarty_Compiler extends Smarty {
-
-    // internal vars
-    /**#@+
-     * @access private
-     */
-    var $_folded_blocks         =   array();    // keeps folded template blocks
-    var $_current_file          =   null;       // the current template being compiled
-    var $_current_line_no       =   1;          // line number for error messages
-    var $_capture_stack         =   array();    // keeps track of nested capture buffers
-    var $_plugin_info           =   array();    // keeps track of plugins to load
-    var $_init_smarty_vars      =   false;
-    var $_permitted_tokens      =   array('true','false','yes','no','on','off','null');
-    var $_db_qstr_regexp        =   null;        // regexps are setup in the constructor
-    var $_si_qstr_regexp        =   null;
-    var $_qstr_regexp           =   null;
-    var $_func_regexp           =   null;
-    var $_reg_obj_regexp        =   null;
-    var $_var_bracket_regexp    =   null;
-    var $_num_const_regexp      =   null;
-    var $_dvar_guts_regexp      =   null;
-    var $_dvar_regexp           =   null;
-    var $_cvar_regexp           =   null;
-    var $_svar_regexp           =   null;
-    var $_avar_regexp           =   null;
-    var $_mod_regexp            =   null;
-    var $_var_regexp            =   null;
-    var $_parenth_param_regexp  =   null;
-    var $_func_call_regexp      =   null;
-    var $_obj_ext_regexp        =   null;
-    var $_obj_start_regexp      =   null;
-    var $_obj_params_regexp     =   null;
-    var $_obj_call_regexp       =   null;
-    var $_cacheable_state       =   0;
-    var $_cache_attrs_count     =   0;
-    var $_nocache_count         =   0;
-    var $_cache_serial          =   null;
-    var $_cache_include         =   null;
-
-    var $_strip_depth           =   0;
-    var $_additional_newline    =   "\n";
-
-    /**#@-*/
-    /**
-     * The class constructor.
-     */
-    function Smarty_Compiler()
-    {
-        // matches double quoted strings:
-        // "foobar"
-        // "foo\"bar"
-        $this->_db_qstr_regexp = '"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"';
-
-        // matches single quoted strings:
-        // 'foobar'
-        // 'foo\'bar'
-        $this->_si_qstr_regexp = '\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'';
-
-        // matches single or double quoted strings
-        $this->_qstr_regexp = '(?:' . $this->_db_qstr_regexp . '|' . $this->_si_qstr_regexp . ')';
-
-        // matches bracket portion of vars
-        // [0]
-        // [foo]
-        // [$bar]
-        $this->_var_bracket_regexp = '\[\$?[\w\.]+\]';
-
-        // matches numerical constants
-        // 30
-        // -12
-        // 13.22
-        $this->_num_const_regexp = '(?:\-?\d+(?:\.\d+)?)';
-
-        // matches $ vars (not objects):
-        // $foo
-        // $foo.bar
-        // $foo.bar.foobar
-        // $foo[0]
-        // $foo[$bar]
-        // $foo[5][blah]
-        // $foo[5].bar[$foobar][4]
-        $this->_dvar_math_regexp = '(?:[\+\*\/\%]|(?:-(?!>)))';
-        $this->_dvar_math_var_regexp = '[\$\w\.\+\-\*\/\%\d\>\[\]]';
-        $this->_dvar_guts_regexp = '\w+(?:' . $this->_var_bracket_regexp
-                . ')*(?:\.\$?\w+(?:' . $this->_var_bracket_regexp . ')*)*(?:' . $this->_dvar_math_regexp . '(?:' . $this->_num_const_regexp . '|' . $this->_dvar_math_var_regexp . ')*)?';
-        $this->_dvar_regexp = '\$' . $this->_dvar_guts_regexp;
-
-        // matches config vars:
-        // #foo#
-        // #foobar123_foo#
-        $this->_cvar_regexp = '\#\w+\#';
-
-        // matches section vars:
-        // %foo.bar%
-        $this->_svar_regexp = '\%\w+\.\w+\%';
-
-        // matches all valid variables (no quotes, no modifiers)
-        $this->_avar_regexp = '(?:' . $this->_dvar_regexp . '|'
-           . $this->_cvar_regexp . '|' . $this->_svar_regexp . ')';
-
-        // matches valid variable syntax:
-        // $foo
-        // $foo
-        // #foo#
-        // #foo#
-        // "text"
-        // "text"
-        $this->_var_regexp = '(?:' . $this->_avar_regexp . '|' . $this->_qstr_regexp . ')';
-
-        // matches valid object call (one level of object nesting allowed in parameters):
-        // $foo->bar
-        // $foo->bar()
-        // $foo->bar("text")
-        // $foo->bar($foo, $bar, "text")
-        // $foo->bar($foo, "foo")
-        // $foo->bar->foo()
-        // $foo->bar->foo->bar()
-        // $foo->bar($foo->bar)
-        // $foo->bar($foo->bar())
-        // $foo->bar($foo->bar($blah,$foo,44,"foo",$foo[0].bar))
-        $this->_obj_ext_regexp = '\->(?:\$?' . $this->_dvar_guts_regexp . ')';
-        $this->_obj_restricted_param_regexp = '(?:'
-                . '(?:' . $this->_var_regexp . '|' . $this->_num_const_regexp . ')(?:' . $this->_obj_ext_regexp . '(?:\((?:(?:' . $this->_var_regexp . '|' . $this->_num_const_regexp . ')'
-                . '(?:\s*,\s*(?:' . $this->_var_regexp . '|' . $this->_num_const_regexp . '))*)?\))?)*)';
-        $this->_obj_single_param_regexp = '(?:\w+|' . $this->_obj_restricted_param_regexp . '(?:\s*,\s*(?:(?:\w+|'
-                . $this->_var_regexp . $this->_obj_restricted_param_regexp . ')))*)';
-        $this->_obj_params_regexp = '\((?:' . $this->_obj_single_param_regexp
-                . '(?:\s*,\s*' . $this->_obj_single_param_regexp . ')*)?\)';
-        $this->_obj_start_regexp = '(?:' . $this->_dvar_regexp . '(?:' . $this->_obj_ext_regexp . ')+)';
-        $this->_obj_call_regexp = '(?:' . $this->_obj_start_regexp . '(?:' . $this->_obj_params_regexp . ')?(?:' . $this->_dvar_math_regexp . '(?:' . $this->_num_const_regexp . '|' . $this->_dvar_math_var_regexp . ')*)?)';
-        
-        // matches valid modifier syntax:
-        // |foo
-        // |@foo
-        // |foo:"bar"
-        // |foo:$bar
-        // |foo:"bar":$foobar
-        // |foo|bar
-        // |foo:$foo->bar
-        $this->_mod_regexp = '(?:\|@?\w+(?::(?:\w+|' . $this->_num_const_regexp . '|'
-           . $this->_obj_call_regexp . '|' . $this->_avar_regexp . '|' . $this->_qstr_regexp .'))*)';
-
-        // matches valid function name:
-        // foo123
-        // _foo_bar
-        $this->_func_regexp = '[a-zA-Z_]\w*';
-
-        // matches valid registered object:
-        // foo->bar
-        $this->_reg_obj_regexp = '[a-zA-Z_]\w*->[a-zA-Z_]\w*';
-
-        // matches valid parameter values:
-        // true
-        // $foo
-        // $foo|bar
-        // #foo#
-        // #foo#|bar
-        // "text"
-        // "text"|bar
-        // $foo->bar
-        $this->_param_regexp = '(?:\s*(?:' . $this->_obj_call_regexp . '|'
-           . $this->_var_regexp . '|' . $this->_num_const_regexp  . '|\w+)(?>' . $this->_mod_regexp . '*)\s*)';
-
-        // matches valid parenthesised function parameters:
-        //
-        // "text"
-        //    $foo, $bar, "text"
-        // $foo|bar, "foo"|bar, $foo->bar($foo)|bar
-        $this->_parenth_param_regexp = '(?:\((?:\w+|'
-                . $this->_param_regexp . '(?:\s*,\s*(?:(?:\w+|'
-                . $this->_param_regexp . ')))*)?\))';
-
-        // matches valid function call:
-        // foo()
-        // foo_bar($foo)
-        // _foo_bar($foo,"bar")
-        // foo123($foo,$foo->bar(),"foo")
-        $this->_func_call_regexp = '(?:' . $this->_func_regexp . '\s*(?:'
-           . $this->_parenth_param_regexp . '))';
-    }
-
-    /**
-     * compile a resource
-     *
-     * sets $compiled_content to the compiled source
-     * @param string $resource_name
-     * @param string $source_content
-     * @param string $compiled_content
-     * @return true
-     */
-    function _compile_file($resource_name, $source_content, &$compiled_content)
-    {
-
-        if ($this->security) {
-            // do not allow php syntax to be executed unless specified
-            if ($this->php_handling == SMARTY_PHP_ALLOW &&
-                !$this->security_settings['PHP_HANDLING']) {
-                $this->php_handling = SMARTY_PHP_PASSTHRU;
-            }
-        }
-
-        $this->_load_filters();
-
-        $this->_current_file = $resource_name;
-        $this->_current_line_no = 1;
-        $ldq = preg_quote($this->left_delimiter, '~');
-        $rdq = preg_quote($this->right_delimiter, '~');
-
-        // run template source through prefilter functions
-        if (count($this->_plugins['prefilter']) > 0) {
-            foreach ($this->_plugins['prefilter'] as $filter_name => $prefilter) {
-                if ($prefilter === false) continue;
-                if ($prefilter[3] || is_callable($prefilter[0])) {
-                    $source_content = call_user_func_array($prefilter[0],
-                                                            array($source_content, &$this));
-                    $this->_plugins['prefilter'][$filter_name][3] = true;
-                } else {
-                    $this->_trigger_fatal_error("[plugin] prefilter '$filter_name' is not implemented");
-                }
-            }
-        }
-
-        /* fetch all special blocks */
-        $search = "~{$ldq}\*(.*?)\*{$rdq}|{$ldq}\s*literal\s*{$rdq}(.*?){$ldq}\s*/literal\s*{$rdq}|{$ldq}\s*php\s*{$rdq}(.*?){$ldq}\s*/php\s*{$rdq}~s";
-
-        preg_match_all($search, $source_content, $match,  PREG_SET_ORDER);
-        $this->_folded_blocks = $match;
-        reset($this->_folded_blocks);
-
-        /* replace special blocks by "{php}" */
-        $source_content = preg_replace($search.'e', "'"
-                                       . $this->_quote_replace($this->left_delimiter) . 'php'
-                                       . "' . str_repeat(\"\n\", substr_count('\\0', \"\n\")) .'"
-                                       . $this->_quote_replace($this->right_delimiter)
-                                       . "'"
-                                       , $source_content);
-
-        /* Gather all template tags. */
-        preg_match_all("~{$ldq}\s*(.*?)\s*{$rdq}~s", $source_content, $_match);
-        $template_tags = $_match[1];
-        /* Split content by template tags to obtain non-template content. */
-        $text_blocks = preg_split("~{$ldq}.*?{$rdq}~s", $source_content);
-
-        /* loop through text blocks */
-        for ($curr_tb = 0, $for_max = count($text_blocks); $curr_tb < $for_max; $curr_tb++) {
-            /* match anything resembling php tags */
-            if (preg_match_all('~(<\?(?:\w+|=)?|\?>|language\s*=\s*[\"\']?\s*php\s*[\"\']?)~is', $text_blocks[$curr_tb], $sp_match)) {
-                /* replace tags with placeholders to prevent recursive replacements */
-                $sp_match[1] = array_unique($sp_match[1]);
-                usort($sp_match[1], '_smarty_sort_length');
-                for ($curr_sp = 0, $for_max2 = count($sp_match[1]); $curr_sp < $for_max2; $curr_sp++) {
-                    $text_blocks[$curr_tb] = str_replace($sp_match[1][$curr_sp],'%%%SMARTYSP'.$curr_sp.'%%%',$text_blocks[$curr_tb]);
-                }
-                /* process each one */
-                for ($curr_sp = 0, $for_max2 = count($sp_match[1]); $curr_sp < $for_max2; $curr_sp++) {
-                    if ($this->php_handling == SMARTY_PHP_PASSTHRU) {
-                        /* echo php contents */
-                        $text_blocks[$curr_tb] = str_replace('%%%SMARTYSP'.$curr_sp.'%%%', '<?php echo \''.str_replace("'", "\'", $sp_match[1][$curr_sp]).'\'; ?>'."\n", $text_blocks[$curr_tb]);
-                    } else if ($this->php_handling == SMARTY_PHP_QUOTE) {
-                        /* quote php tags */
-                        $text_blocks[$curr_tb] = str_replace('%%%SMARTYSP'.$curr_sp.'%%%', htmlspecialchars($sp_match[1][$curr_sp]), $text_blocks[$curr_tb]);
-                    } else if ($this->php_handling == SMARTY_PHP_REMOVE) {
-                        /* remove php tags */
-                        $text_blocks[$curr_tb] = str_replace('%%%SMARTYSP'.$curr_sp.'%%%', '', $text_blocks[$curr_tb]);
-                    } else {
-                        /* SMARTY_PHP_ALLOW, but echo non php starting tags */
-                        $sp_match[1][$curr_sp] = preg_replace('~(<\?(?!php|=|$))~i', '<?php echo \'\\1\'?>'."\n", $sp_match[1][$curr_sp]);
-                        $text_blocks[$curr_tb] = str_replace('%%%SMARTYSP'.$curr_sp.'%%%', $sp_match[1][$curr_sp], $text_blocks[$curr_tb]);
-                    }
-                }
-            }
-        }
-        
-        /* Compile the template tags into PHP code. */
-        $compiled_tags = array();
-        for ($i = 0, $for_max = count($template_tags); $i < $for_max; $i++) {
-            $this->_current_line_no += substr_count($text_blocks[$i], "\n");
-            $compiled_tags[] = $this->_compile_tag($template_tags[$i]);
-            $this->_current_line_no += substr_count($template_tags[$i], "\n");
-        }
-        if (count($this->_tag_stack)>0) {
-            list($_open_tag, $_line_no) = end($this->_tag_stack);
-            $this->_syntax_error("unclosed tag \{$_open_tag} (opened line $_line_no).", E_USER_ERROR, __FILE__, __LINE__);
-            return;
-        }
-
-        /* Reformat $text_blocks between 'strip' and '/strip' tags,
-           removing spaces, tabs and newlines. */
-        $strip = false;
-        for ($i = 0, $for_max = count($compiled_tags); $i < $for_max; $i++) {
-            if ($compiled_tags[$i] == '{strip}') {
-                $compiled_tags[$i] = '';
-                $strip = true;
-                /* remove leading whitespaces */
-                $text_blocks[$i + 1] = ltrim($text_blocks[$i + 1]);
-            }
-            if ($strip) {
-                /* strip all $text_blocks before the next '/strip' */
-                for ($j = $i + 1; $j < $for_max; $j++) {
-                    /* remove leading and trailing whitespaces of each line */
-                    $text_blocks[$j] = preg_replace('![\t ]*[\r\n]+[\t ]*!', '', $text_blocks[$j]);
-                    if ($compiled_tags[$j] == '{/strip}') {                       
-                        /* remove trailing whitespaces from the last text_block */
-                        $text_blocks[$j] = rtrim($text_blocks[$j]);
-                    }
-                    $text_blocks[$j] = "<?php echo '" . strtr($text_blocks[$j], array("'"=>"\'", "\\"=>"\\\\")) . "'; ?>";
-                    if ($compiled_tags[$j] == '{/strip}') {
-                        $compiled_tags[$j] = "\n"; /* slurped by php, but necessary
-                                    if a newline is following the closing strip-tag */
-                        $strip = false;
-                        $i = $j;
-                        break;
-                    }
-                }
-            }
-        }
-        $compiled_content = '';
-        
-        $tag_guard = '%%%SMARTYOTG' . md5(uniqid(rand(), true)) . '%%%';
-        
-        /* Interleave the compiled contents and text blocks to get the final result. */
-        for ($i = 0, $for_max = count($compiled_tags); $i < $for_max; $i++) {
-            if ($compiled_tags[$i] == '') {
-                // tag result empty, remove first newline from following text block
-                $text_blocks[$i+1] = preg_replace('~^(\r\n|\r|\n)~', '', $text_blocks[$i+1]);
-            }
-            // replace legit PHP tags with placeholder
-            $text_blocks[$i] = str_replace('<?', $tag_guard, $text_blocks[$i]);
-            $compiled_tags[$i] = str_replace('<?', $tag_guard, $compiled_tags[$i]);
-            
-            $compiled_content .= $text_blocks[$i] . $compiled_tags[$i];
-        }
-        $compiled_content .= str_replace('<?', $tag_guard, $text_blocks[$i]);
-
-        // escape php tags created by interleaving
-        $compiled_content = str_replace('<?', "<?php echo '<?' ?>\n", $compiled_content);
-        $compiled_content = preg_replace("~(?<!')language\s*=\s*[\"\']?\s*php\s*[\"\']?~", "<?php echo 'language=php' ?>\n", $compiled_content);
-
-        // recover legit tags
-        $compiled_content = str_replace($tag_guard, '<?', $compiled_content); 
-        
-        // remove \n from the end of the file, if any
-        if (strlen($compiled_content) && (substr($compiled_content, -1) == "\n") ) {
-            $compiled_content = substr($compiled_content, 0, -1);
-        }
-
-        if (!empty($this->_cache_serial)) {
-            $compiled_content = "<?php \$this->_cache_serials['".$this->_cache_include."'] = '".$this->_cache_serial."'; ?>" . $compiled_content;
-        }
-
-        // run compiled template through postfilter functions
-        if (count($this->_plugins['postfilter']) > 0) {
-            foreach ($this->_plugins['postfilter'] as $filter_name => $postfilter) {
-                if ($postfilter === false) continue;
-                if ($postfilter[3] || is_callable($postfilter[0])) {
-                    $compiled_content = call_user_func_array($postfilter[0],
-                                                              array($compiled_content, &$this));
-                    $this->_plugins['postfilter'][$filter_name][3] = true;
-                } else {
-                    $this->_trigger_fatal_error("Smarty plugin error: postfilter '$filter_name' is not implemented");
-                }
-            }
-        }
-
-        // put header at the top of the compiled template
-        $template_header = "<?php /* Smarty version ".$this->_version.", created on ".strftime("%Y-%m-%d %H:%M:%S")."\n";
-        $template_header .= "         compiled from ".strtr(urlencode($resource_name), array('%2F'=>'/', '%3A'=>':'))." */ ?>\n";
-
-        /* Emit code to load needed plugins. */
-        $this->_plugins_code = '';
-        if (count($this->_plugin_info)) {
-            $_plugins_params = "array('plugins' => array(";
-            foreach ($this->_plugin_info as $plugin_type => $plugins) {
-                foreach ($plugins as $plugin_name => $plugin_info) {
-                    $_plugins_params .= "array('$plugin_type', '$plugin_name', '" . strtr($plugin_info[0], array("'" => "\\'", "\\" => "\\\\")) . "', $plugin_info[1], ";
-                    $_plugins_params .= $plugin_info[2] ? 'true),' : 'false),';
-                }
-            }
-            $_plugins_params .= '))';
-            $plugins_code = "<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');\nsmarty_core_load_plugins($_plugins_params, \$this); ?>\n";
-            $template_header .= $plugins_code;
-            $this->_plugin_info = array();
-            $this->_plugins_code = $plugins_code;
-        }
-
-        if ($this->_init_smarty_vars) {
-            $template_header .= "<?php require_once(SMARTY_CORE_DIR . 'core.assign_smarty_interface.php');\nsmarty_core_assign_smarty_interface(null, \$this); ?>\n";
-            $this->_init_smarty_vars = false;
-        }
-
-        $compiled_content = $template_header . $compiled_content;
-        return true;
-    }
-
-    /**
-     * Compile a template tag
-     *
-     * @param string $template_tag
-     * @return string
-     */
-    function _compile_tag($template_tag)
-    {
-        /* Matched comment. */
-        if (substr($template_tag, 0, 1) == '*' && substr($template_tag, -1) == '*')
-            return '';
-        
-        /* Split tag into two three parts: command, command modifiers and the arguments. */
-        if(! preg_match('~^(?:(' . $this->_num_const_regexp . '|' . $this->_obj_call_regexp . '|' . $this->_var_regexp
-                . '|\/?' . $this->_reg_obj_regexp . '|\/?' . $this->_func_regexp . ')(' . $this->_mod_regexp . '*))
-                      (?:\s+(.*))?$
-                    ~xs', $template_tag, $match)) {
-            $this->_syntax_error("unrecognized tag: $template_tag", E_USER_ERROR, __FILE__, __LINE__);
-        }
-        
-        $tag_command = $match[1];
-        $tag_modifier = isset($match[2]) ? $match[2] : null;
-        $tag_args = isset($match[3]) ? $match[3] : null;
-
-        if (preg_match('~^' . $this->_num_const_regexp . '|' . $this->_obj_call_regexp . '|' . $this->_var_regexp . '$~', $tag_command)) {
-            /* tag name is a variable or object */
-            $_return = $this->_parse_var_props($tag_command . $tag_modifier);
-            return "<?php echo $_return; ?>" . $this->_additional_newline;
-        }
-
-        /* If the tag name is a registered object, we process it. */
-        if (preg_match('~^\/?' . $this->_reg_obj_regexp . '$~', $tag_command)) {
-            return $this->_compile_registered_object_tag($tag_command, $this->_parse_attrs($tag_args), $tag_modifier);
-        }
-
-        switch ($tag_command) {
-            case 'include':
-                return $this->_compile_include_tag($tag_args);
-
-            case 'include_php':
-                return $this->_compile_include_php_tag($tag_args);
-
-            case 'if':
-                $this->_push_tag('if');
-                return $this->_compile_if_tag($tag_args);
-
-            case 'else':
-                list($_open_tag) = end($this->_tag_stack);
-                if ($_open_tag != 'if' && $_open_tag != 'elseif')
-                    $this->_syntax_error('unexpected {else}', E_USER_ERROR, __FILE__, __LINE__);
-                else
-                    $this->_push_tag('else');
-                return '<?php else: ?>';
-
-            case 'elseif':
-                list($_open_tag) = end($this->_tag_stack);
-                if ($_open_tag != 'if' && $_open_tag != 'elseif')
-                    $this->_syntax_error('unexpected {elseif}', E_USER_ERROR, __FILE__, __LINE__);
-                if ($_open_tag == 'if')
-                    $this->_push_tag('elseif');
-                return $this->_compile_if_tag($tag_args, true);
-
-            case '/if':
-                $this->_pop_tag('if');
-                return '<?php endif; ?>';
-
-            case 'capture':
-                return $this->_compile_capture_tag(true, $tag_args);
-
-            case '/capture':
-                return $this->_compile_capture_tag(false);
-
-            case 'ldelim':
-                return $this->left_delimiter;
-
-            case 'rdelim':
-                return $this->right_delimiter;
-
-            case 'section':
-                $this->_push_tag('section');
-                return $this->_compile_section_start($tag_args);
-
-            case 'sectionelse':
-                $this->_push_tag('sectionelse');
-                return "<?php endfor; else: ?>";
-                break;
-
-            case '/section':
-                $_open_tag = $this->_pop_tag('section');
-                if ($_open_tag == 'sectionelse')
-                    return "<?php endif; ?>";
-                else
-                    return "<?php endfor; endif; ?>";
-
-            case 'foreach':
-                $this->_push_tag('foreach');
-                return $this->_compile_foreach_start($tag_args);
-                break;
-
-            case 'foreachelse':
-                $this->_push_tag('foreachelse');
-                return "<?php endforeach; else: ?>";
-
-            case '/foreach':
-                $_open_tag = $this->_pop_tag('foreach');
-                if ($_open_tag == 'foreachelse')
-                    return "<?php endif; unset(\$_from); ?>";
-                else
-                    return "<?php endforeach; endif; unset(\$_from); ?>";
-                break;
-
-            case 'strip':
-            case '/strip':
-                if (substr($tag_command, 0, 1)=='/') {
-                    $this->_pop_tag('strip');
-                    if (--$this->_strip_depth==0) { /* outermost closing {/strip} */
-                        $this->_additional_newline = "\n";
-                        return '{' . $tag_command . '}';
-                    }
-                } else {
-           &n