]> git.mjollnir.org Git - moodle.git/commitdiff
cvsimport fixups -- cvshead had strayed from upstream
authorMartin Langhoff <martin@catalyst.net.nz>
Thu, 4 Jan 2007 00:15:04 +0000 (13:15 +1300)
committerMartin Langhoff <martin@catalyst.net.nz>
Thu, 4 Jan 2007 00:15:04 +0000 (13:15 +1300)
171 files changed:
admin/config.php [deleted file]
admin/configvars.php [deleted file]
admin/index.php
admin/roles/assign.php
admin/uploaduser.php
admin/utfdbmigrate.html [deleted file]
admin/utfdbmigrate.php [deleted file]
admin/xmldb/actions/get_db_directories/get_db_directories.class.php
backup/backuplib.php
backup/db/migrate2utf8.php [deleted file]
backup/db/migrate2utf8.xml [deleted file]
blocks/admin/block_admin.php
blocks/db/migrate2utf8.php [deleted file]
blocks/db/migrate2utf8.xml [deleted file]
blocks/online_users/block_online_users.php
blocks/pagedemo.php [deleted file]
blocks/quiz_results/block_quiz_results.php
blocks/rss_client/db/migrate2utf8.php [deleted file]
blocks/rss_client/db/migrate2utf8.xml [deleted file]
blog/header.php
blog/index.php
blog/lib.php
blog/rsslib.php
calendar/event.php
course/groups.php
course/lib.php
doc/COPYRIGHT.txt [deleted file]
doc/contents.php [deleted file]
doc/docstyles.css [deleted file]
doc/index.php [deleted file]
doc/install.html [deleted file]
doc/top.php [deleted file]
doc/view.php [deleted file]
enrol/authorize/db/migrate2utf8.xml [deleted file]
group/assign.php [new file with mode: 0644]
group/db/dbbasicgrouplib.php
group/db/dbgroupinglib.php
group/db/dbsetup.php
group/db/install.xml [new file with mode: 0644]
group/db/mysql.sql
group/db/postgres7.sql
group/db/upgrade.php [new file with mode: 0644]
group/group.php [new file with mode: 0644]
group/grouping.php [new file with mode: 0644]
group/install.php [deleted file]
group/install.sql [deleted file]
group/lib.php [new file with mode: 0644]
group/lib/basicgrouplib.php
group/lib/groupinglib.php
group/lib/legacylib.php
group/lib/utillib.php
group/simpletest/test_basicgrouplib.php
group/simpletest/test_groupinglib.php
group/version.php [new file with mode: 0644]
lang/en_utf8/group.php
lang/en_utf8/help/lesson/deleteattempts.html [new file with mode: 0644]
lib/accesslib.php
lib/adodb/adodb-connection.inc.php [deleted file]
lib/adodb/adodb-cryptsession.php [deleted file]
lib/adodb/adodb-recordset.inc.php [deleted file]
lib/adodb/adodb-session-clob.php [deleted file]
lib/adodb/adodb-session.php [deleted file]
lib/adodb/adodb-xmlschema-0.0.1-snap20030511/Changelog [deleted file]
lib/adodb/adodb-xmlschema-0.0.1-snap20030511/INSTALL [deleted file]
lib/adodb/adodb-xmlschema-0.0.1-snap20030511/LICENSE [deleted file]
lib/adodb/adodb-xmlschema-0.0.1-snap20030511/README [deleted file]
lib/adodb/adodb-xmlschema-0.0.1-snap20030511/adodb-xmlschema.inc.php [deleted file]
lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/blank.html [deleted file]
lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/classtrees_xmlschema.html [deleted file]
lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/elementindex.html [deleted file]
lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/elementindex_xmlschema.html [deleted file]
lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/errors.html [deleted file]
lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/index.html [deleted file]
lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/li_xmlschema.html [deleted file]
lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/media/stylesheet.css [deleted file]
lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/packages.html [deleted file]
lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/xmlschema/_adodb-xmlschema_php.html [deleted file]
lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/xmlschema/adoSchema.html [deleted file]
lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/xmlschema/package_xmlschema.html [deleted file]
lib/adodb/adodb-xmlschema-0.0.1-snap20030511/example.php [deleted file]
lib/adodb/adodb-xmlschema-0.0.1-snap20030511/example.xml [deleted file]
lib/adodb/adodb-xmlschema-0.0.1-snap20030511/xmlschema.dtd [deleted file]
lib/adodb/adodb-xmlschema-0.0.1-snap20030511/xmlschema.html [deleted file]
lib/adodb/adodb-xmlschema.inc.php
lib/adodb/adodb-xmlschema03.inc.php
lib/adodb/crypt.inc.php [deleted file]
lib/adodb/docs-adodb.htm [deleted file]
lib/adodb/docs-datadict.htm [deleted file]
lib/adodb/docs-perf.htm [deleted file]
lib/adodb/docs-session.htm [deleted file]
lib/adodb/pear/Auth/Container/ADOdb.php [deleted file]
lib/adodb/pear/readme.Auth.txt [deleted file]
lib/adodb/readme.htm [deleted file]
lib/adodb/tips_portable_sql.htm [deleted file]
lib/adodb/tute.htm [deleted file]
lib/datalib.php
lib/db/install.xml
lib/db/migrate2utf8.php [deleted file]
lib/db/migrate2utf8.xml [deleted file]
lib/db/mysql.sql
lib/db/postgres7.sql
lib/deprecatedlib.php
lib/editor/tinymce/jscripts/tiny_mce/plugins/advimage/editor_plugin_src.js
lib/editor/tinymce/jscripts/tiny_mce/plugins/fullscreen/editor_plugin_src.js
lib/editor/tinymce/jscripts/tiny_mce/themes/advanced/editor_template_src.js
lib/editor/tinymce/jscripts/tiny_mce/themes/simple/editor_template_src.js
lib/editor/tinymce/jscripts/tiny_mce/tiny_mce_gzip.php
lib/editor/tinymce/jscripts/tiny_mce/tiny_mce_popup.js
lib/editor/tinymce/jscripts/tiny_mce/utils/form_utils.js
lib/editor/tinymce/jscripts/tiny_mce/utils/mclayer.js
lib/editor/tinymce/jscripts/tiny_mce/utils/mctabs.js
lib/editor/tinymce/jscripts/tiny_mce/utils/validate.js
lib/filelib.php
lib/pear/HTML/QuickForm/Rule/Compare.php
lib/soap/nusoap.php
mod/assignment/db/migrate2utf8.php [deleted file]
mod/assignment/db/migrate2utf8.xml [deleted file]
mod/assignment/index.php
mod/chat/db/migrate2utf8.php [deleted file]
mod/chat/db/migrate2utf8.xml [deleted file]
mod/chat/gui_header_js/index.php
mod/chat/gui_sockets/index.php
mod/choice/db/migrate2utf8.php [deleted file]
mod/choice/db/migrate2utf8.xml [deleted file]
mod/data/db/migrate2utf8.php [deleted file]
mod/data/db/migrate2utf8.xml [deleted file]
mod/data/index.php
mod/exercise/db/migrate2utf8.php [deleted file]
mod/exercise/db/migrate2utf8.xml [deleted file]
mod/exercise/locallib.php
mod/exercise/view.php
mod/forum/db/migrate2utf8.php [deleted file]
mod/forum/db/migrate2utf8.xml [deleted file]
mod/forum/discuss.php
mod/forum/view.php
mod/glossary/db/migrate2utf8.php [deleted file]
mod/glossary/db/migrate2utf8.xml [deleted file]
mod/hotpot/db/migrate2utf8.php [deleted file]
mod/hotpot/db/migrate2utf8.xml [deleted file]
mod/hotpot/report.php
mod/journal/db/migrate2utf8.php [deleted file]
mod/journal/db/migrate2utf8.xml [deleted file]
mod/journal/lib.php
mod/journal/view.php
mod/label/db/migrate2utf8.php [deleted file]
mod/label/db/migrate2utf8.xml [deleted file]
mod/lams/db/migrate2utf8.php [deleted file]
mod/lams/db/migrate2utf8.xml [deleted file]
mod/lesson/db/migrate2utf8.php [deleted file]
mod/lesson/db/migrate2utf8.xml [deleted file]
mod/lesson/mod_form.php
mod/quiz/db/migrate2utf8.php [deleted file]
mod/quiz/db/migrate2utf8.xml [deleted file]
mod/quiz/lib.php
mod/quiz/report/analysis/report.php
mod/quiz/report/overview/report.php
mod/resource/db/migrate2utf8.php [deleted file]
mod/resource/db/migrate2utf8.xml [deleted file]
mod/scorm/db/migrate2utf8.php [deleted file]
mod/scorm/db/migrate2utf8.xml [deleted file]
mod/survey/db/migrate2utf8.php [deleted file]
mod/survey/db/migrate2utf8.xml [deleted file]
mod/survey/lib.php
mod/wiki/db/migrate2utf8.php [deleted file]
mod/wiki/db/migrate2utf8.xml [deleted file]
mod/wiki/lib.php
mod/workshop/db/migrate2utf8.php [deleted file]
mod/workshop/db/migrate2utf8.xml [deleted file]
user/index.php
user/tabs.php
user/view.php

diff --git a/admin/config.php b/admin/config.php
deleted file mode 100644 (file)
index fd1694b..0000000
+++ /dev/null
@@ -1,185 +0,0 @@
-<?php  // $Id$
-       // config.php - allows admin to edit all configuration variables
-
-    require_once('../config.php');
-
-    $focus = '';
-
-    if ($site = get_site()) {   // If false then this is a new installation
-        require_login();
-        require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
-    }
-
-/// This is to overcome the "insecure forms paradox"
-    if (isset($secureforms) and $secureforms == 0) {
-        $match = 'nomatch';
-    } else {
-        $match = '';
-    }
-
-/// If data submitted, then process and store.
-
-    if ($config = data_submitted($match)) {  
-
-        if (!empty($USER->id)) {            // Additional identity check
-            if (!confirm_sesskey()) {
-                error(get_string('confirmsesskeybad', 'error'));
-            }
-        }
-
-        validate_form($config, $err);
-
-        if (count($err) == 0) {
-            foreach ($config as $name => $value) {
-                if ($name == "sessioncookie") {
-                    $value = eregi_replace("[^a-zA-Z0-9_]", "", $value);
-                }
-                if ($name == "defaultallowedmodules") {
-                    $value = implode(',',$value);
-                }
-                if ($name == 'hiddenuserfields') {
-                    if (in_array('none', $value)) {
-                        $value = '';
-                    } else {
-                        $value = implode(',',$value);
-                    }
-                }
-                if ($name == "locale") {
-                    $value = trim($value);
-                }
-                $conf = new object();
-                $conf->name  = $name;
-                $conf->value = $value;
-                if ($current = get_record('config', 'name', $name)) {
-                    $conf->id = $current->id;
-                    if (! update_record('config', $conf)) {
-                        error("Error: Could not update $name to $value");
-                    }
-                } else {
-                    if (! insert_record('config', $conf)) {
-                        error("Error: could not add new variable $name !");
-                    }
-                }
-            }
-            redirect('index.php');
-            exit;
-
-        } else {
-            foreach ($err as $key => $value) {
-                $focus = "form.$key";
-            }
-        }
-    }
-
-/// Otherwise fill and print the form.
-
-    if (empty($config)) {
-        $config = $CFG;
-    }
-
-    $sesskey = !empty($USER->id) ? $USER->sesskey : '';
-
-
-    $stradmin = get_string('administration');
-    $strconfiguration = get_string('configuration');
-    $strconfigvariables = get_string('configvariables', 'admin');
-
-    if ($site) {
-        print_header("$site->shortname: $strconfigvariables", $site->fullname,
-                      "<a href=\"index.php\">$stradmin</a> -> ".
-                      "<a href=\"configure.php\">$strconfiguration</a> -> $strconfigvariables", $focus);
-        print_heading($strconfigvariables);
-    } else {
-        print_header();
-        print_heading($strconfigvariables);
-        print_simple_box(get_string('configintro', 'admin'), 'center', "50%");
-        echo '<br />';
-    }
-
-
-
-/// Get all the configuration fields and helptext
-    require('configvars.php');
-
-/// Cycle through the sections to get the sectionnames
-    $linktext = '';
-    foreach($configvars as $sectionname=>$section) {
-        if ($linktext !== '') {
-            $linktext .= ' | ';
-        }
-        $linktext .= '<a href="#configsection'.$sectionname.'">'.get_string('configsection'.$sectionname, 'admin').'</a>';
-    }
-        
-    echo "<center>$linktext</center>\n";
-
-    
-    echo '<form method="post" action="config.php" name="form">';
-    echo '<center><input type="submit" value="'.get_string('savechanges').'" /></center>';
-
-/// Cycle through each section of the configuration
-    foreach ($configvars as $sectionname=>$section) {
-
-        print_heading('<a name="configsection'.$sectionname.'"></a>'.get_string('configsection'.$sectionname, 'admin'));
-
-        $table = NULL;
-        $table->data = array();
-        foreach ($section as $configvariable=>$configobject) {
-            $table->data[] = array ( $configvariable.': ',
-                                     $configobject->field
-                                   );
-            if ($configobject->display_warning()) {
-                $table->data[] = array ( '&nbsp;',
-                                         '<span class="configwarning">'.$configobject->warning.'</span>'
-                                       );
-            }
-            $table->data[] = array ( '&nbsp;',
-                                     '<span class="confighelp">'.$configobject->help.'</span>'
-                                   );
-            $table->align = array ('right', 'left');
-        }
-        print_table($table);
-
-    }
-    echo '<center>';
-    echo '<input type="hidden" name="sesskey" value="'.$sesskey.'" />';
-    echo '<input type="submit" value="'.get_string('savechanges').'" />';
-    echo '</center>';
-                
-    echo '</form>';
-    
-
-
-    
-
-    /// Lock some options
-
-    $httpsurl = str_replace('http://', 'https://', $CFG->wwwroot);
-    if ($httpsurl != $CFG->wwwroot) {
-        if (ini_get('allow_url_fopen')) {
-            if ((($fh = @fopen($httpsurl, 'r')) == false) and ($config->loginhttps == 0)) {
-                echo '<script type="text/javascript">'."\n";
-                echo '<!--'."\n";
-                echo "eval('document.form.loginhttps.disabled=true');\n";
-                echo '-->'."\n";
-                echo '</script>'."\n";
-            }
-        }
-    }
-
-
-    if ($site) {
-        print_footer();
-    }
-
-    exit;
-
-/// Functions /////////////////////////////////////////////////////////////////
-
-function validate_form(&$form, &$err) {
-
-    // Currently no checks are needed ...
-
-    return true;
-}
-
-?>
diff --git a/admin/configvars.php b/admin/configvars.php
deleted file mode 100644 (file)
index b7fb49f..0000000
+++ /dev/null
@@ -1,660 +0,0 @@
-<?php // $Id$
-      // Shane Elliott
-defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
-
-/// Add new sitewide configuration variables to this file.
-
-
-/// $configvars is parsed by config.php
-/// It is an array of arrays of objects
-/// $configvars[sectionname][configvariablename] = configvar object
-    $configvars = array();
-
-
-/// no, yes strings and menu options are used in a number of places
-/// so we define them here to save time on repeatedly calling
-/// get_string()
-    $stryes = get_string('yes');
-    $strno  = get_string('no');
-
-    $noyesoptions[0] = $strno;
-    $noyesoptions[1] = $stryes;
-
-
-
-/// A class to hold the configurable information
-/// $field   - the html code for the form field
-/// $help    - help text for the field
-/// $warning - optional warning text to be displayed
-/// method display_warning() - a generic function that can be used in an extended class
-///     e.g. enablerssfeeds
-class configvar {
-
-    var $field;
-    var $help;
-    var $warning;
-
-    function configvar($help, $field, $warning='') {
-        $this->help    = $help;
-        $this->field   = $field;
-        $this->warning = $warning;
-    }
-
-    function display_warning() {
-        return false;
-    }
-}
-
-
-
-
-
-////////////////////////////////////////////////////////////////////
-/// Miscellaneous config variables
-////////////////////////////////////////////////////////////////////
-    $misc = array();
-
-
-/// maxeditingtime
-    unset($options);
-    $options[3600] = get_string('numminutes', '', 60);
-    $options[2700] = get_string('numminutes', '', 45);
-    $options[1800] = get_string('numminutes', '', 30);
-    $options[900]  = get_string('numminutes', '', 15);
-    $options[300]  = get_string('numminutes', '', 5);
-    $options[60]   = get_string('numminutes', '', 1);
-
-    $misc['maxeditingtime'] = new configvar (get_string('configmaxeditingtime', 'admin'),
-        choose_from_menu ($options, 'maxeditingtime', $config->maxeditingtime, '', '', '', true) );
-
-/// debug
-    unset($options);
-    $options[5]  = $strno;
-    $options[15] = $stryes;
-
-    $misc['debug'] = new configvar (get_string('configdebug', 'admin'),
-        choose_from_menu ($options, 'debug', $config->debug, '', '', '', true) );
-
-    $misc['perfdebug'] = new configvar (get_string('configperfdebug', 'admin'),
-        choose_from_menu ($options, 'perfdebug', $config->perfdebug, '', '', '', true) );
-
-/// enablerssfeeds
-class configvarrss extends configvar {
-    function display_warning() {
-        return (!function_exists('utf8_encode'));
-    }
-}
-
-    $misc['enablerssfeeds'] = new configvarrss (get_string('configenablerssfeeds', 'admin'),
-        choose_from_menu ($noyesoptions, 'enablerssfeeds', $config->enablerssfeeds, '', '', '', true),
-        '<font color="red"> You need to add XML support to your PHP installation.</font>' );
-
-    $misc['mymoodleredirect'] = new configvar (get_string('configmymoodleredirect','admin'),
-        choose_from_menu($noyesoptions,'mymoodleredirect',$config->mymoodleredirect,'','','',true));
-
-    unset($options);
-    $options[5] = get_string('worldblogs','blog');
-    $options[4] = get_string('siteblogs','blog');
-    $options[3] = get_string('courseblogs','blog');
-    $options[2] = get_string('groupblogs','blog');
-    $options[1] = get_string('personalblogs','blog');
-    $options[0] = get_string('disableblogs','blog');
-
-    $misc['bloglevel'] = new configvar (get_string('configbloglevel', 'admin'),
-        choose_from_menu ($options, 'bloglevel', $config->bloglevel,'','','',true));
-
-////////////////////////////////////////////////////////////////////
-/// OPERATING SYSTEM config variables
-////////////////////////////////////////////////////////////////////
-    $operatingsystem = array();
-
-/// gdversion
-    unset($options);
-    $options[0] = get_string('gdnot');
-    $options[1] = get_string('gd1');
-    $options[2] = get_string('gd2');
-
-    $installed  = check_gd_version();
-
-    $operatingsystem['gdversion'] = new configvar (get_string('configgdversion', 'admin'),
-        choose_from_menu ($options, 'gdversion', $installed, '', '', '', true) );
-
-/// dbsessions
-    $operatingsystem['dbsessions'] = new configvar (get_string('configdbsessions', 'admin'),
-        choose_from_menu ($noyesoptions, 'dbsessions', $config->dbsessions, '', '', '', true) );
-
-/// sessiontimeout
-    unset($options);
-    $options[14400] = get_string('numhours', '', 4);
-    $options[10800] = get_string('numhours', '', 3);
-    $options[7200]  = get_string('numhours', '', 2);
-    $options[5400]  = get_string('numhours', '', '1.5');
-    $options[3600]  = get_string('numminutes', '', 60);
-    $options[2700]  = get_string('numminutes', '', 45);
-    $options[1800]  = get_string('numminutes', '', 30);
-    $options[900]   = get_string('numminutes', '', 15);
-    $options[300]   = get_string('numminutes', '', 5);
-
-    $operatingsystem['sessiontimeout'] = new configvar (get_string('configsessiontimeout', 'admin'),
-        choose_from_menu ($options, 'sessiontimeout', $config->sessiontimeout, '', '', '', true) );
-
-/// sessioncookie
-    $operatingsystem['sessioncookie'] = new configvar (get_string('configsessioncookie', 'admin'),
-        '<input name="sessioncookie" type="text" size="10" value="'.s($config->sessioncookie).'" alt="sessioncookie" />' );
-    $operatingsystem['sessioncookiepath'] = new configvar (get_string('configsessioncookiepath', 'admin'),
-        '<input name="sessioncookiepath" type="text" size="10" value="'.s($config->sessioncookiepath).'" alt="sessioncookiepath" />' );
-
-/// zip
-    $operatingsystem['zip'] = new configvar (get_string('configzip', 'admin'),
-        '<input name="zip" type="text" size="30" value="'.s($config->zip).'" alt="zip" />' );
-
-/// unzip
-    $operatingsystem['unzip'] = new configvar (get_string('configunzip', 'admin'),
-        '<input name="unzip" type="text" size="30" value="'.s($config->unzip).'" alt="unzip" />' );
-
-    $operatingsystem['pathtodu'] = new configvar(get_string('configpathtodu', 'admin'),
-        '<input name="pathtodu" type="text" size="30" value="'.s($config->pathtodu).'" alt="pathtodu" />');                                                
-
-/// slasharguments
-    unset($options);
-    $options[0] = "file.php?file=/1/pic.jpg";
-    $options[1] = "file.php/1/pic.jpg";
-
-    $operatingsystem['slasharguments'] = new configvar (get_string('configslasharguments', 'admin'),
-        choose_from_menu ($options, 'slasharguments', $config->slasharguments, '', '', '', true) );
-
-/// proxyhost
-    $operatingsystem['proxyhost'] = new configvar (get_string('configproxyhost', 'admin'),
-        '<input name="proxyhost" type="text" size="30" value="'.s($config->proxyhost).'" alt="proxyhost" />' );
-
-/// proxyport
-    $operatingsystem['proxyport'] = new configvar ('',
-        '<input name="proxyport" type="text" size="5" value="'.s($config->proxyport).'" alt="proxyport" />' );
-
-
-
-////////////////////////////////////////////////////////////////////
-/// PERMISSIONS config variables
-////////////////////////////////////////////////////////////////////
-    $permissions = array();
-
-/// teacherassignteachers
-    $permissions['teacherassignteachers'] = new configvar (get_string('configteacherassignteachers', 'admin'),
-        choose_from_menu ($noyesoptions, 'teacherassignteachers', $config->teacherassignteachers, '', '', '', true) );
-
-/// allowunenroll
-    $permissions['allowunenroll'] = new configvar (get_string('configallowunenroll', 'admin'),
-        choose_from_menu ($noyesoptions, 'allowunenroll', $config->allowunenroll, '', '', '', true) );
-
-/// allusersaresitestudents
-    $permissions['allusersaresitestudents'] = new configvar (get_string('configallusersaresitestudents', 'admin'),
-        choose_from_menu ($noyesoptions, 'allusersaresitestudents', $config->allusersaresitestudents, '', '', '', true) );
-
-/// showsiteparticipantslist
-    unset($options);
-    $options[0]  = get_string('siteteachers');
-    $options[1]  = get_string('allteachers');
-    $options[2]  = get_string('studentsandteachers');
-
-    $permissions['showsiteparticipantslist'] = new configvar (get_string('configshowsiteparticipantslist', 'admin'),
-        choose_from_menu ($options, 'showsiteparticipantslist', $config->showsiteparticipantslist, '', '', '', true) );
-
-/// forcelogin
-    $permissions['forcelogin'] = new configvar (get_string('configforcelogin', 'admin'),
-        choose_from_menu ($noyesoptions, 'forcelogin', $config->forcelogin, '', '', '', true) );
-
-/// forceloginforprofiles
-   $permissions['forceloginforprofiles'] = new configvar (get_string('configforceloginforprofiles', 'admin'),
-        choose_from_menu ($noyesoptions, 'forceloginforprofiles', $config->forceloginforprofiles, '', '', '', true) );
-
-/// opentogoogle
-    $permissions['opentogoogle'] = new configvar (get_string('configopentogoogle', 'admin'),
-        choose_from_menu ($noyesoptions, 'opentogoogle', $config->opentogoogle, '', '', '', true) );
-
-/// maxbytes
-    $options = get_max_upload_sizes();
-
-    $permissions['maxbytes'] = new configvar (get_string('configmaxbytes', 'admin'),
-        choose_from_menu ($options, 'maxbytes', $config->maxbytes, '', '', 0, true) );
-
-/// messaging
-    $permissions['messaging'] = new configvar (get_string('configmessaging', 'admin'),
-        choose_from_menu ($noyesoptions, 'messaging', $config->messaging, '', '', '', true) );
-
-/// allowobjectembed
-    $permissions['allowobjectembed'] = new configvar (get_string('configallowobjectembed', 'admin'),
-        choose_from_menu ($noyesoptions, 'allowobjectembed', $config->allowobjectembed, '', '', '', true) );
-
-/// enabletrusttext
-    $permissions['enabletrusttext'] = new configvar (get_string('configenabletrusttext', 'admin'),
-        choose_from_menu ($noyesoptions, 'enabletrusttext', $config->enabletrusttext, '', '', '', true) );
-
-    unset($options);
-    $options['none'] = 'No courses';
-    $options['all'] = 'All courses';
-    $options['requested'] = 'Requested courses';
-
-    $permissions['restrictmodulesfor'] = new configvar (get_string('configrestrictmodulesfor','admin'),
-   ' <script language="JavaScript">
-    function togglemodules(index) {
-        if (index == 0) {
-            document.getElementById(\'allowedmodules\').disabled=true;
-        }
-        else {
-            document.getElementById(\'allowedmodules\').disabled=false;
-        }
-    }
-    </script>'.
-        choose_from_menu($options,'restrictmodulesfor',$config->restrictmodulesfor,'','togglemodules(this.selectedIndex);','',true) );
-
-    $permissions['restrictbydefault'] = new configvar (get_string('configrestrictbydefault','admin'),
-        choose_from_menu($noyesoptions, 'restrictbydefault',$config->restrictbydefault,'','','',true) );
-
-    $allowstr = '<select name="defaultallowedmodules[]" id="allowedmodules" multiple="multiple" size="10"'.((empty($config->restrictmodulesfor)) ? "disabled=\"disabled\"" : "").'>';
-
-    $allowedmodules = array();
-    if (!empty($config->defaultallowedmodules)) {
-        $allowedmodules = explode(',',$config->defaultallowedmodules);
-    }
-
-//  On a fresh install of Moodle, this could be empty; prevent a warning on the following loop.
-    if (!$mods = get_records("modules")) {
-        $mods = array();
-    }
-    $s = "selected=\"selected\"";
-    $allowstr .= '<option value="0" '.((empty($allowedmodules)) ? $s : '').'>'.get_string('allownone').'</option>'."\n";
-    foreach ($mods as $mod) {
-        $selected = "";
-        if (in_array($mod->id,$allowedmodules)) 
-            $selected = $s;
-        $allowstr .= '<option '.$selected.' value="'.$mod->id.'">'.$mod->name.'</option>'."\n";
-    }  
-    $allowstr .= '</select>';
-
-    $permissions['defaultallowedmodules'] = new configvar (get_string('configdefaultallowedmodules','admin'),$allowstr);
-
-
-/// course requests
-    $reqcourse['enablecourserequests'] = new configvar (get_string('configenablecourserequests', 'admin'),
-        choose_from_menu ($noyesoptions,'enablecourserequests',$config->enablecourserequests,'','','',true) );
-
-/// default category for course requests
-    require_once($CFG->dirroot.'/course/lib.php');
-    $reqcourse['defaultrequestedcategory'] = new configvar (get_string('configdefaultrequestedcategory', 'admin'),
-        choose_from_menu (make_categories_options(), 'defaultrequestedcategory',$config->defaultrequestedcategory,'','','',true) );
-
-    $reqcourse['requestedteachername'] = new configvar (get_string('configrequestedteachername','admin'),
-        '<input type="text" name="requestedteachername" size="20" maxlength="100" value="'.s($config->requestedteachername).'" />');
-
-    $reqcourse['requestedteachersname'] = new configvar (get_string('configrequestedteachersname','admin'),
-        '<input type="text" name="requestedteachersname" size="20" maxlength="100" value="'.s($config->requestedteachersname).'" />');
-
-    $reqcourse['requestedstudentname'] = new configvar (get_string('configrequestedstudentname','admin'),
-        '<input type="text" name="requestedstudentname" size="20" maxlength="100" value="'.s($config->requestedstudentname).'" />');
-
-    $reqcourse['requestedstudentsname'] = new configvar (get_string('configrequestedstudentsname','admin'),
-        '<input type="text" name="requestedstudentsname" size="20" maxlength="100" value="'.s($config->requestedstudentsname).'" />');
-
-////////////////////////////////////////////////////////////////////
-/// INTERFACE config variables
-////////////////////////////////////////////////////////////////////
-    $interface = array();
-
-/// language settings
-    $interface['lang'] = new configvar ( get_string('configlang', 'admin'),
-        choose_from_menu(get_list_of_languages(), 'lang', $config->lang, '', '', '', true) );
-
-/// language menu
-    $interface['langmenu'] = new configvar ( get_string('configlangmenu', 'admin'),
-        choose_from_menu($noyesoptions, 'langmenu', $config->langmenu, '', '', '', true) );
-
-/// language list
-    $interface['langlist'] = new configvar ( get_string('configlanglist', 'admin'),
-        '<input name="langlist" type="text" size="60" value="'.s($config->langlist).'" alt="langlist" />' );
-
-/// language menu
-    $interface['langcache'] = new configvar ( get_string('configlangcache', 'admin'),
-        choose_from_menu($noyesoptions, 'langcache', $config->langcache, '', '', '', true) );
-
-/// locale
-    $interface['locale'] = new configvar ( get_string('configlocale', 'admin'),
-        '<input name="locale" type="text" size="15" value="'.s($config->locale).'" alt="locale" />' );
-
-/// docroot
-    $interface['docroot'] = new configvar ( get_string('configdocroot', 'admin'),
-        '<input name="docroot" type="text" size="60" value="'.s($config->docroot).'" alt="docroot" />' );
-
-/// doctonewwindow
-    $interface['doctonewwindow'] = new configvar ( get_string('configdoctonewwindow', 'admin'),
-        choose_from_menu($noyesoptions, 'doctonewwindow', $config->doctonewwindow, '', '', '', true) );
-
-/// timezone
-    $interface['timezone'] = new configvar ( get_string('configtimezone', 'admin'),
-        choose_from_menu (get_list_of_timezones(), 'timezone', $config->timezone, get_string('serverlocaltime'), '', '99', true ) );
-
-/// country
-    $interface['country'] = new configvar ( get_string('configcountry', 'admin'),
-        choose_from_menu (get_list_of_countries(), 'country', $config->country, get_string('selectacountry'), '', 0, true) );
-
-/// framename
-    if (empty($config->framename)) {
-        $config->framename = "_top";
-    }
-
-    $interface['framename'] = new configvar (get_string('configframename', 'admin'),
-        '<input name="framename" type="text" size="15" value="'.s($config->framename).'" alt="framename" />' );
-
-/// language list
-    $interface['themelist'] = new configvar ( get_string('configthemelist', 'admin'),
-        '<input name="themelist" type="text" size="60" value="'.s($config->themelist).'" alt="themelist" />' );
-
-/// user themes
-    $interface['allowuserthemes'] = new configvar (get_string('configallowuserthemes', 'admin'),
-        choose_from_menu ($noyesoptions, 'allowuserthemes', $config->allowuserthemes, '', '', '', true) );
-
-/// course themes
-    $interface['allowcoursethemes'] = new configvar (get_string('configallowcoursethemes', 'admin'),
-        choose_from_menu ($noyesoptions, 'allowcoursethemes', $config->allowcoursethemes, '', '', '', true) );
-
-/// allowuserblockhiding
-    $interface['allowuserblockhiding'] = new configvar (get_string('configallowuserblockhiding', 'admin'),
-        choose_from_menu ($noyesoptions, 'allowuserblockhiding', $config->allowuserblockhiding, '', '', '', true) );
-
-/// showblocksonmodpages
-    $interface['showblocksonmodpages'] = new configvar (get_string('configshowblocksonmodpages', 'admin'),
-        choose_from_menu ($noyesoptions, 'showblocksonmodpages', $config->showblocksonmodpages, '', '', '', true) );
-
-
-/// tabselectedtofront
-    $interface['tabselectedtofront'] = new configvar (get_string('tabselectedtofront', 'admin'),
-        choose_from_menu ($noyesoptions, 'tabselectedtofront', $config->tabselectedtofront, '', '', '', true) );
-
-
-
-////////////////////////////////////////////////////////////////////
-/// USER config variables
-////////////////////////////////////////////////////////////////////
-    $user = array();
-
-/// sitepolicy
-    $user['sitepolicy'] = new configvar (get_string('configsitepolicy', 'admin'),
-        '<input type="text" name="sitepolicy" size="60" value="'.$config->sitepolicy.'" alt="sitepolicy" />' );
-
-
-/// fullnamedisplay
-    unset($options);
-    $options['language']  = get_string('language');
-    $options['firstname lastname']  = get_string('firstname') . ' + ' . get_string('lastname');
-    $options['lastname firstname']  = get_string('lastname') . ' + ' . get_string('firstname');
-    $options['firstname']  = get_string('firstname');
-
-    $user['fullnamedisplay'] = new configvar (get_string('configfullnamedisplay', 'admin'),
-        choose_from_menu ($options, 'fullnamedisplay', $config->fullnamedisplay, '', '', '', true) );
-
-/// extendedusernamechars
-    $user['extendedusernamechars'] = new configvar (get_string('configextendedusernamechars', 'admin'),
-        choose_from_menu ($noyesoptions, 'extendedusernamechars', $config->extendedusernamechars, '', '', '', true) );
-
-/// autologinguests
-    $user['autologinguests'] = new configvar (get_string('configautologinguests', 'admin'),
-        choose_from_menu ($noyesoptions, 'autologinguests', $config->autologinguests, '', '', '', true) );
-
-/// hiddenuserfields
-    $fields = array('none', 'description', 'city', 'country', 'webpage', 'icqnumber', 'skypeid', 'yahooid', 'aimid', 'msnid', 'lastaccess');
-    if (empty($config->hiddenuserfields)) {
-        $config->hiddenuserfields = 'none';
-    }
-    $configfields = array_flip(explode(',', $config->hiddenuserfields));
-    $fieldoptions = '';
-    foreach ($fields as $value) {
-        $fieldoptions .= '<option value="'.$value.'"';
-        if (isset($configfields[$value])) {
-            $fieldoptions .= ' selected="selected"';
-        }
-        $fieldoptions .= '>'.get_string($value).'</option>';
-    }
-
-    $user['hiddenuserfields'] = new configvar (get_string('confighiddenuserfields', 'admin'),
-        '<select id="menuhiddenuserfields" name="hiddenuserfields[]" size="10" multiple="multiple">'.$fieldoptions.'</select>' );
-
-
-
-
-////////////////////////////////////////////////////////////////////
-/// SECURITY config variables
-////////////////////////////////////////////////////////////////////
-    $security = array();
-
-/// displayloginfailures
-    unset($options);
-    $options[''] = get_string('nobody');
-    $options['admin'] = get_string('administrators');
-    $options['teacher'] = get_string('administratorsandteachers');
-    $options['everybody'] = get_string('everybody');
-
-    $security['displayloginfailures'] = new configvar (get_string('configdisplayloginfailures', 'admin'),
-        choose_from_menu($options, 'displayloginfailures', $config->displayloginfailures, '', '', '', true) );
-
-/// notifyloginfailures
-    unset($options);
-    $options[''] = get_string('nobody');
-    $options['mainadmin'] = get_string('administrator');
-    $options['alladmins'] = get_string('administratorsall');
-
-    $security['notifyloginfailures'] = new configvar (get_string('confignotifyloginfailures', 'admin'),
-        choose_from_menu($options, 'notifyloginfailures', $config->notifyloginfailures, '', '', '', true) );
-
-/// notifyloginthreshold
-    unset($options);
-    for ($i=1; $i<=100; $i++) {
-        $options[$i] = "$i";
-    }
-
-    $security['notifyloginthreshold'] = new configvar (get_string('confignotifyloginthreshold', 'admin'),
-        choose_from_menu($options, 'notifyloginthreshold', $config->notifyloginthreshold, '', '', '', true) );
-
-/// secureforms
-    $security['secureforms'] = new configvar (get_string('configsecureforms', 'admin'),
-        choose_from_menu ($noyesoptions, 'secureforms', $config->secureforms, '', '', '', true) );
-
-/// loginhttps
-    $security['loginhttps'] = new configvar (get_string('configloginhttps', 'admin'),
-        choose_from_menu ($noyesoptions, 'loginhttps', $config->loginhttps, '', '', '', true) );
-
-/// runclamonupload
-    $security['runclamonupload'] = new configvar (get_string('configrunclamonupload', 'admin'),
-        choose_from_menu($noyesoptions, 'runclamonupload', $config->runclamonupload, '', '', '', true) );
-
-/// pathtoclam
-    $security['pathtoclam'] = new configvar (get_string('configpathtoclam', 'admin'),
-        '<input type="text" name="pathtoclam" size="30" value="'.$config->pathtoclam.'" alt="pathtoclam" />' );
-
-/// quarantinedir
-    $security['quarantinedir'] = new configvar (get_string('configquarantinedir', 'admin'),
-        '<input type="text" name="quarantinedir" size="30" value="'.$config->quarantinedir.'" alt="quarantinedir" />' );
-
-/// clamfailureonupload
-    unset($options);
-    $options['donothing'] = get_string('configclamdonothing', 'admin');
-    $options['actlikevirus'] = get_string('configclamactlikevirus', 'admin');
-
-    $security['clamfailureonupload'] = new configvar (get_string('configclamfailureonupload', 'admin'),
-        choose_from_menu($options, 'clamfailureonupload', $config->clamfailureonupload, '', '', '', true) );
-
-
-
-
-////////////////////////////////////////////////////////////////////
-/// MAINTENANCE config variables
-////////////////////////////////////////////////////////////////////
-    $maintenance = array();
-
-/// longtimenosee
-    unset($options);
-    $options[0]    = get_string('never');
-    $options[1000] = get_string('numdays', '', 1000);
-    $options[365]  = get_string('numdays', '', 365);
-    $options[180]  = get_string('numdays', '', 180);
-    $options[150]  = get_string('numdays', '', 150);
-    $options[120]  = get_string('numdays', '', 120);
-    $options[90]   = get_string('numdays', '', 90);
-    $options[60]   = get_string('numdays', '', 60);
-    $options[30]   = get_string('numdays', '', 30);
-    $options[21]   = get_string('numdays', '', 21);
-    $options[14]   = get_string('numdays', '', 14);
-    $options[7]   = get_string('numdays', '', 7);
-
-    $maintenance['longtimenosee'] = new configvar (get_string('configlongtimenosee', 'admin'),
-        choose_from_menu ($options, 'longtimenosee', $config->longtimenosee, '', '', '', true) );
-
-/// deleteunconfirmed
-    unset($options);
-    $options[0]    = get_string('never');
-    $options[168]  = get_string('numdays', '', 7);
-    $options[144]  = get_string('numdays', '', 6);
-    $options[120]  = get_string('numdays', '', 5);
-    $options[96]   = get_string('numdays', '', 4);
-    $options[72]   = get_string('numdays', '', 3);
-    $options[48]   = get_string('numdays', '', 2);
-    $options[24]   = get_string('numdays', '', 1);
-    $options[12]   = get_string('numhours', '', 12);
-    $options[6]    = get_string('numhours', '', 6);
-    $options[1]    = get_string('numhours', '', 1);
-
-    $maintenance['deleteunconfirmed'] = new configvar (get_string('configdeleteunconfirmed', 'admin'),
-        choose_from_menu ($options, 'deleteunconfirmed', $config->deleteunconfirmed, '', '', '', true) );
-
-/// loglifetime
-    unset($options);
-    $options[0]    = get_string('neverdeletelogs');
-    $options[1000] = get_string('numdays', '', 1000);
-    $options[365]  = get_string('numdays', '', 365);
-    $options[180]  = get_string('numdays', '', 180);
-    $options[150]  = get_string('numdays', '', 150);
-    $options[120]  = get_string('numdays', '', 120);
-    $options[90]   = get_string('numdays', '', 90);
-    $options[60]   = get_string('numdays', '', 60);
-    $options[30]   = get_string('numdays', '', 30);
-
-    $maintenance['loglifetime'] = new configvar (get_string('configloglifetime', 'admin'),
-        choose_from_menu ($options, 'loglifetime', $config->loglifetime, '', '', '', true) );
-
-
-////////////////////////////////////////////////////////////////////
-/// MAIL config variables
-////////////////////////////////////////////////////////////////////
-    $mail = array();
-
-/// smtphosts
-    $mail['smtphosts'] = new configvar (get_string('configsmtphosts', 'admin'),
-        '<input name="smtphosts" type="text" size="30" value="'.s($config->smtphosts).'" alt="smtphosts" />' );
-
-/// smtpuser
-    $mail['smtpuser'] = new configvar (get_string('configsmtpuser', 'admin'),
-        '<input name="smtpuser" type="text" size="10" value="'.s($config->smtpuser).'" alt="smtpuser" />' );
-
-/// smtppass
-    $mail['smtppass'] = new configvar ('',
-        '<input name="smtppass" type="password" size="10" value="'.s($config->smtppass).'" alt="smtppass" />' );
-
-/// noreplyaddress
-    $mail['noreplyaddress'] = new configvar (get_string('confignoreplyaddress', 'admin'),
-        '<input name="noreplyaddress" type="text" size="30" value="'.s($config->noreplyaddress).'" alt="noreplyaddress" />' );
-
-/// digestmailtime
-    $hours = array();
-    for ($i=0; $i<=23; $i++) {
-        $hours[$i] = sprintf("%02d",$i);
-    }
-
-    $mail['digestmailtime'] = new configvar (get_string('configdigestmailtime', 'admin'),
-        choose_from_menu($hours, 'digestmailtime', $config->digestmailtime, '', '', 0, true) );
-
-/// allowemailaddresses
-    $mail['allowemailaddresses'] = new configvar (get_string('configallowemailaddresses', 'admin'),
-        '<input name="allowemailaddresses" type="text" size="60" value="'.s($config->allowemailaddresses).'" alt="allowemailaddresses" />' );
-
-/// denyemailaddresses
-    $mail['denyemailaddresses'] = new configvar (get_string('configdenyemailaddresses', 'admin'),
-        '<input name="denyemailaddresses" type="text" size="60" value="'.s($config->denyemailaddresses).'" alt="denyemailaddresses" />' );
-
-    if (!empty($CFG->unicodedb)) { ///These options are only available if running under unicodedb
-    /// sitemailcharset
-        unset($options);
-        unset($charsets);
-        $charsets = get_list_of_charsets();
-        $options['0'] = get_string('none');
-        $options = array_merge($options, $charsets);
-        $mail['sitemailcharset'] = new configvar (get_string('configsitemailcharset', 'admin'),
-            choose_from_menu($options, 'sitemailcharset', $config->sitemailcharset, '', '', '', true));
-
-    /// allowusermailcharset
-        $mail['allowusermailcharset'] = new configvar (get_string('configallowusermailcharset', 'admin'),
-            choose_from_menu($noyesoptions, 'allowusermailcharset', $config->allowusermailcharset, '', '', '', true));
-    }
-    
-/// enable stats
-if (empty($CFG->disablestatsprocessing)) {
-    $stats['enablestats'] = new configvar (get_string('configenablestats','admin'),
-        choose_from_menu($noyesoptions, 'enablestats', $config->enablestats, '', '', '', true) );
-
-    unset($options);
-    $options['none'] = get_string('none');
-    $options[60*60*24*7] = get_string('numweeks','moodle',1);
-    $options[60*60*24*14] = get_string('numweeks','moodle',2);
-    $options[60*60*24*21] = get_string('numweeks','moodle',3);
-    $options[60*60*24*28] = get_string('nummonths','moodle',1);
-    $options[60*60*24*56] = get_string('nummonths','moodle',2);
-    $options[60*60*24*84] = get_string('nummonths','moodle',3);
-    $options[60*60*24*112] = get_string('nummonths','moodle',4);
-    $options[60*60*24*140] = get_string('nummonths','moodle',5);
-    $options[60*60*24*168] = get_string('nummonths','moodle',6);
-    $options['all'] = get_string('all');
-    
-    $stats['statsfirstrun'] = new configvar (get_string('configstatsfirstrun','admin'),
-       choose_from_menu($options,'statsfirstrun',$config->statsfirstrun,'','','',true) );
-
-    unset($options);
-    $options[0] = get_string('untilcomplete');
-    $options[60*60] = '1 '.get_string('hour');
-    $options[60*60*2] = '2 '.get_string('hours');
-    $options[60*60*3] = '3 '.get_string('hours');
-    $options[60*60*4] = '4 '.get_string('hours');
-    $options[60*60*5] = '5 '.get_string('hours');
-    $options[60*60*6] = '6 '.get_string('hours');
-    $options[60*60*7] = '7 '.get_string('hours');
-    $options[60*60*8] = '8 '.get_string('hours');
-
-    if (empty($config->statsruntimestarthour)) {
-        $config->statsruntimestarthour = 0;
-    }
-    if (empty($config->statsruntimestartminute)) {
-        $config->statsruntimestartminute = 0;
-    }
-
-    $stats['statsmaxruntime'] = new configvar (get_string('configstatsmaxruntime','admin'),
-      choose_from_menu($options,'statsmaxruntime',$config->statsmaxruntime,'','','',true) );                                        
-
-    $stats['statsruntimestart'] = new configvar (get_string('configstatsruntimestart','admin'),
-      print_time_selector("statsruntimestarthour","statsruntimestartminute",make_timestamp(2000,1,1,$config->statsruntimestarthour,$config->statsruntimestartminute),5,true) );
-
-    $stats['statsuserthreshold'] = new configvar (get_string('configstatsuserthreshold','admin'),
-      '<input type="text" name="statsuserthreshold" size="4" value="'.$config->statsuserthreshold.'" />');
-}                                        
-
-////////////////////////////////////////////////////////////////////
-
-    $configvars['interface']       = $interface;
-    $configvars['security']        = $security;
-    $configvars['operatingsystem'] = $operatingsystem;
-    $configvars['maintenance']     = $maintenance;
-    $configvars['mail']            = $mail;
-    $configvars['user']            = $user;
-    $configvars['permissions']     = $permissions;
-    $configvars['requestedcourse'] = $reqcourse;
-    $configvars['misc']            = $misc;
-if (empty($CFG->disablestatsprocessing)) {
-    $configvars['stats']           = $stats;
-}
-
-?>
index ca9dc7624b3abf5565ec86e5fd74d86c33da1f3f..9c75be92f1d8ada5246d17bbf8b1321337420402 100644 (file)
     require_once("$CFG->dirroot/lib/locallib.php");
     upgrade_local_db("$CFG->wwwroot/$CFG->admin/index.php");  // Return here afterwards
 
+/// Check for new groups and upgrade if necessary. TODO:
+    require_once("$CFG->dirroot/group/db/upgrade.php");
+    upgrade_group_db("$CFG->wwwroot/$CFG->admin/index.php");  // Return here afterwards
+
 /// just make sure upgrade logging is properly terminated
     upgrade_log_finish();
 
index d49957c503730659190129ef785c8ad266816d9a..469ad31a472b467c02e38eefb95435b4348172e7 100755 (executable)
         /// In the .html file below we loop through these results and exclude any in $contextusers
 
         echo '<div align="center">'.$strcurrentcontext.': '.print_context_name($context).'<br/>';
-        echo $strroletoassign.': ';
+        echo '<label for="jump">'.$strroletoassign.'</label>: ';
         $assignableroles = array('0'=>get_string('listallroles', 'role').'...') + $assignableroles; 
         popup_form("$CFG->wwwroot/$CFG->admin/roles/assign.php?userid=$userid&amp;courseid=$courseid&amp;contextid=$contextid&amp;roleid=",
             $assignableroles, 'switchrole', $roleid, '');
index 3b5ac3dfc398b525c366dec5191ea4bf375544d4..413f09616aed176f59a3314992a464e5b448710f 100755 (executable)
@@ -304,8 +304,8 @@ if ($um->preprocess_files() && confirm_sesskey()) {
                             if (!$course[$i]) {
                                 notify(get_string('coursegroupunknown','error',$addgroup[$i]));
                             } else {
-                                if ($group = get_record("groups","courseid",$course[$i]->id,"name",$addgroup[$i])) {
-                                    $groupid[$i] = $group->id;
+                                if ($groupid = groups_get_group_by_name($course[$i]->id, $addgroup[$i])) { //TODO:check.
+                                    $groupid[$i] = $groupid;
                                 } else {
                                     notify(get_string('groupunknown','error',$addgroup[$i]));
                                 }
diff --git a/admin/utfdbmigrate.html b/admin/utfdbmigrate.html
deleted file mode 100644 (file)
index 1f118fa..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-   if (!isset($form->dbhost)) {
-       $form->dbhost = '';
-   }
-   if (!isset($form->dbname)) {
-       $form->dbname = '';
-   }
-   if (!isset($form->dbuser)) {
-       $form->dbuser = '';
-   }
-   if (!isset($form->dbpass)) {
-       $form->dbpass = '';
-   }
-   if (!isset($form->dbcluster)) {
-       $form->dbcluster = '';
-   }
-   if (!isset($form->pathtopgdump)) {
-       $form->pathtopgdump = '';
-   }
-   if (!isset($form->pathtopsql)) {
-       $form->pathtopsql = '';
-   }
-?>
-<form name="migratefrom" action="utfdbmigrate.php" method="POST">
-<input name="migrate" type="hidden" value="1" />
-<input name="sesskey" type="hidden" value="<?php echo sesskey() ?>" />
-<?php if (isset($err["dbconnect"])) formerr($err["dbconnect"]); ?>
-<?php if (isset($err["pathtopgdump"])) formerr($err["pathtopgdump"]); ?>
-<?php if (isset($err["pathtopsql"])) formerr($err["pathtopsql"]); ?>
-<table cellpadding="9" cellspacing="0" width="500">
-<tr valign="top">
-    <td align="right"><?php print_string("dbhost", "install") ?>:</td>
-    <td><input type="text" name="dbhost" value="<?php p($form->dbhost) ?>" />
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><?php print_string("database", "install") ?>:</td>
-    <td><input type="text" name="dbname" value="<?php p($form->dbname) ?>" />
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><?php print_string("user") ?>:</td>
-    <td><input type="text" name="dbuser" value="<?php p($form->dbuser) ?>" />
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><?php print_string("password") ?>:</td>
-    <td><input type="text" name="dbpass" value="<?php p($form->dbpass) ?>" />
-    </td>
-</tr>
-<tr valign="top">
-    <td align="right"><?php print_string("pgcluster", "admin") ?>:</td>
-    <td><input type="text" name="dbcluster" value="<?php p($form->dbcluster) ?>" />
-    <td><?php print_string("pgclusterdescription", "admin") ?></td>
-</tr>
-<tr valign="top">
-    <td align="right" nowrap="nowrap"><?php print_string("pathtopgdump","admin") ?>:</td>
-    <td><input type="text" name="pathtopgdump" value="<?php p($form->pathtopgdump) ?>" />
-    <td><?php print_string("pathtopgdumpdesc","admin"); ?></td>
-</tr>
-<tr valign="top">
-    <td align="right" nowrap="nowrap"><?php print_string("pathtopsql","admin") ?>:</td>
-    <td><input type="text" name="pathtopsql" value="<?php p($form->pathtopsql) ?>" />
-    <td><?php print_string("pathtopsqldesc","admin"); ?></td>
-</tr>
-</table>
-<center>
-<input type="submit" value="<?php print_string('continue') ?>"/>
-&nbsp;<input type="button" value="<?php print_string('cancel') ?>" onclick="javascript:history.go(-1)" />
-</center>
\ No newline at end of file
diff --git a/admin/utfdbmigrate.php b/admin/utfdbmigrate.php
deleted file mode 100755 (executable)
index f2ef9bc..0000000
+++ /dev/null
@@ -1,1238 +0,0 @@
-<?php //$Id$
-
-///dummy field names are used to help adding and dropping indexes. There's only 1 case now, in scorm_scoes_track
-//testing
-    require_once('../config.php');
-    require_once($CFG->libdir.'/adminlib.php');
-    require_once($CFG->libdir.'/environmentlib.php');
-    require_once($CFG->dirroot.'/course/lib.php');
-    require_once($CFG->libdir.'/ddllib.php');      //We are going to need DDL services here
-    require_once($CFG->dirroot.'/backup/lib.php');  //We are going to need BACKUP services here
-    define ('BACKUP_UNIQUE_CODE', '1100110011');    //One code in the past to store UTF8 temp indexes info
-    require_login();
-
-    // declare once
-    global $enc;
-    
-    $customlang = array();
-    
-    $enc = array('af' => 'iso-8859-1', 'ar' => 'windows-1256', 'be' => 'windows-1251', 'bg' => 'windows-1251', 'bs' => 'windows-1250', 'ca' => 'iso-8859-1', 'cs' => 'iso-8859-2', 'da' => 'iso-8859-1', 'de' => 'iso-8859-1', 'de_du' => 'iso-8859-1', 'de_utf8' => 'utf-8', 'el' => 'windows-1253', 'en' => 'iso-8859-1', 'en_ja' => 'euc-jp', 'en_us' => 'iso-8859-1', 'en_utf8' => 'utf-8', 'es' => 'iso-8859-1', 'es_ar' => 'iso-8859-1', 'es_es' => 'iso-8859-1', 'es_mx' => 'iso-8859-1', 'et' => 'iso-8859-1', 'eu' => 'iso-8859-1', 'fa' => 'windows-1256', 'fa_utf8' => 'utf-8', 'fi' => 'iso-8859-1', 'fil' => 'iso-8859-15', 'fr' => 'iso-8859-1', 'fr_ca' => 'iso-8859-15', 'ga' => 'iso-8859-1', 'gl' => 'iso-8859-1', 'he' => 'ISO-8859-8-I', 'he_utf8' => 'utf-8', 'hi' => 'iso-8859-1', 'hr' => 'windows-1250', 'hr_utf8' => 'utf-8', 'hu' => 'iso-8859-2', 'id' => 'iso-8859-1', 'is' => 'iso-8859-1', 'it' => 'iso-8859-1', 'ja' => 'EUC-JP', 'ja_utf8' => 'UTF-8', 'ka_utf8' => 'UTF-8', 'km_utf8' => 'UTF-8', 'kn_utf8' => 'utf-8', 'ko' => 'EUC-KR', 'ko_utf8' => 'UTF-8', 'lt' => 'windows-1257', 'lv' => 'ISO-8859-4', 'mi_nt' => 'iso-8859-1', 'mi_tn_utf8' => 'utf-8', 'ms' => 'iso-8859-1', 'nl' => 'iso-8859-1', 'nn' => 'iso-8859-1', 'no' => 'iso-8859-1', 'no_gr' => 'iso-8859-1', 'pl' => 'iso-8859-2', 'pt' => 'iso-8859-1', 'pt_br' => 'iso-8859-1', 'ro' => 'iso-8859-2', 'ru' => 'windows-1251', 'sk' => 'iso-8859-2', 'sl' => 'iso-8859-2', 'sl_utf8' => 'utf-8', 'so' => 'iso-8859-1', 'sq' => 'iso-8859-1', 'sr_utf8' => 'utf-8', 'sv' => 'iso-8859-1', 'th' => 'TIS-620', 'th_utf8' => 'UTF-8', 'tl' => 'iso-8859-15', 'tl_utf8' => 'UTF-8', 'tr' => 'iso-8859-9', 'uk' => 'windows-1251', 'vi_utf8' => 'UTF-8', 'zh_cn' => 'GB18030', 'zh_cn_utf8' => 'UTF-8', 'zh_tw' => 'Big5', 'zh_tw_utf8' => 'UTF-8');
-
-    /**************************************
-     * Custom lang pack handling           *
-     **************************************/
-    
-    // scan list of langs, including customs packs
-    $langs = get_list_of_languages();
-    
-    // foreach lang
-    foreach ($langs as $lang => $lang1) {
-      
-        if (in_array($lang, array_keys($enc))) {
-              // if already in array, ignore
-            continue;  
-        }
-        
-        // if this lang has got a charset    
-        
-        if ($result = get_string_from_file('thischarset',$CFG->dirroot.'/lang/'.$lang.'/moodle.php', "\$resultstring")) {
-            eval($result);    
-            $enc[$lang] = $resultstring;        
-        } else if ($result = get_string_from_file('parentlanguage',$CFG->dirroot.'/lang/'.$lang.'/moodle.php',"\$resultstring")) {
-        // else if there's a parent lang we can use
-            eval($result);
-              $enc[$lang] = $enc[$resultstring];  
-        } else {
-             notify ('unknown lang pack detected '.$lang); 
-        }
-
-    }    
-    
-    /**************************************
-     * End custom lang pack handling      *
-     **************************************/
-
-    require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
-
-    if (!$site = get_site()) {
-        redirect('index.php');
-    }
-
-    if (!empty($CFG->unicodedb)) {
-        error ('unicode db migration has already been performed!');
-    }
-
-    $migrate = optional_param('migrate', 0, PARAM_BOOL);
-    $confirm = optional_param('confirm', 0, PARAM_BOOL);
-    
-    $textlib = textlib_get_instance();
-
-    $stradministration   = get_string('administration');
-    $strdbmigrate = get_string('dbmigrate','admin');
-
-    $filename = $CFG->dataroot.'/'.SITEID.'/maintenance.html';    //maintenance file
-
-    print_header("$site->shortname: $stradministration", "$site->fullname",
-                 '<a href="index.php">'. "$stradministration</a> -> $strdbmigrate");
-
-    print_heading($strdbmigrate);
-
-    if ($CFG->dbtype == 'postgres7') {
-        $CFG->pagepath = 'admin/utfdbmigrate/postgresql';
-    }
-    //if $confirm
-    if ($confirm && confirm_sesskey()) {
-        //do the real migration of db
-        print_simple_box_start('center','50%');
-        print_string('importlangreminder','admin');
-        print_simple_box_end();
-        db_migrate2utf8();
-        print_heading('db unicode migration has been completed!');     
-        if (!get_config('', 'migrate_maintmode')) { // already in maint mode
-            unlink($filename);    //no longer in maintenance mode
-        }
-        unset_config('migrate_maintmode');
-        @require_logout();
-        print_continue($CFG->wwwroot.'/'.$CFG->admin.'/langimport.php');
-    }
-
-    //else if $migrate
-    else if ($migrate && confirm_sesskey()) {
-        if ($CFG->dbtype == 'postgres7' && !is_postgres_utf8()) {
-            $continue = false;
-            if (($form = data_submitted()) && isset($form->dbhost)) {
-                validate_form($form, $err);
-
-                if (count($err) == 0) {
-                    $_SESSION['newpostgresdb'] = $form;
-                    $continue = true;
-                }
-            }
-        } else {
-            $continue = true;
-        }
-        if ($continue) {
-            echo '<div align="center">';
-            print_simple_box_start('center','50%');
-            print_string('dbmigratewarning2','admin');
-            print_simple_box_end();
-            //put the site in maintenance mode
-            check_dir_exists($CFG->dataroot.'/'.SITEID, true);
-
-            if (file_exists($filename)) {
-                set_config('migrate_maintmode', 1); // already in maintenance mode
-            } else {
-                if (touch($filename)) {
-                    $file = fopen($filename, 'w');
-                    fwrite($file, get_string('maintinprogress','admin'));
-                    fclose($file);
-                } else {
-                    notify (get_string('maintfileopenerror','admin'));
-                }
-            }
-            //print second confirmation box
-            echo '<form name="migratefrom" action="utfdbmigrate.php" method="POST">';
-            echo '<input name="confirm" type="hidden" value="1" />';
-            echo '<input name="sesskey" type="hidden" value="'.sesskey().'" />';
-
-            $xmls = utf_get_xml();
-            $sumrecords = 0;   //this is the sum of all records of relavent tables.
-            foreach ($xmls as $xml) {    ///foreach xml file, we must get a list of tables
-                $dbtables = $xml['DBMIGRATION']['#']['TABLES'][0]['#']['TABLE'];    //real db tables
-            
-                foreach ($dbtables as $dbtable) {
-                    $dbtablename = $dbtable['@']['name'];
-                    
-                    if ($dbtablename=='adodb_logsql') {
-                        $prefix = '';
-                    } else {
-                        $prefix = $CFG->prefix;
-                    }
-                    $sumrecords += count_records_sql("SELECT COUNT(*) FROM {$prefix}$dbtablename");
-                }
-            }
-            echo 'Total number of records in your database is <b>'.$sumrecords.'</b>';
-            if ($sumrecords > 10000) {
-                echo '<br />Number of Records to process before halting (Leave blank for no limit) <input name="maxrecords" type="text" value="" />';
-            }
-
-            //print the "i-know-what-lang-to-use" menu
-
-            echo '<br />The whole site is in this encoding: (leave blank if you are not sure)';
-            echo '<select name="globallang"><option value="">I am not sure</option>';
-            foreach ($enc as $lang => $encoding) {
-                echo '<option value="'.$encoding.'">'.$lang.'</option>';
-            }
-            echo '</select>';
-        
-            echo '<p /><input type="submit" value="'.get_string('continue').'"/>';
-            echo '<input type="button" value="'.get_string('cancel').'" onclick="javascript:history.go(-1)" />';
-            echo '</form>';
-            echo '</div>';
-
-        } else {
-            echo '<div align="center">';
-            print_simple_box_start('center','50%');
-            print_string('dbmigratepostgres','admin');
-            print_simple_box_end();
-
-            print_simple_box_start("center", "");
-            include("utfdbmigrate.html");
-            print_simple_box_end();
-        }
-    }
-    
-    else {    //else, print welcome to migrate page message
-        echo '<div align="center">';
-        print_simple_box_start('center','50%');
-        print_string('dbmigratewarning','admin');
-        print_simple_box_end();
-        
-        /*************************************
-         * Eloy's environement checking code *
-         *************************************/
-        
-        $current_version = $CFG->release;
-
-    /// Gather and show results
-        $status = check_moodle_environment($current_version, $environment_results);
-
-        //end of env checking
-        
-    /// We only allow to continue if environmental checks have been passed ok
-        if ($status) {
-            echo '<form name="migratefrom" action="utfdbmigrate.php" method="POST">';
-            echo '<input name="migrate" type="hidden" value="1" />';
-            echo '<input name="sesskey" type="hidden" value="'.sesskey().'" />';
-            echo '<input type="submit" value="'.get_string('continue').'"/>';
-            echo '&nbsp;<input type="button" value="'.get_string('cancel').'" onclick="javascript:history.go(-1)" />';
-            echo '</form>';
-            echo '</div>';
-        }
-    }
-
-    print_footer();
-    
-  
-function db_migrate2utf8(){   //Eloy: Perhaps some type of limit parameter here
-                              //pointing to the num of records to process would be
-                              //useful. And it won't break anything, because the
-                              //crash system will continue the next time it was
-                              //executed. Also, the function could return:
-                              //0 = Some sort of error
-                              //1 = Finished completelly!
-                              //2 = Finished limit records
-                              //(using constants, of course ;-))
-                              //Then, all those errors, should be converted to
-                              //mtrace() and return 0. (showing the current 
-                              //table/field/recordid)
-
-    global $db, $CFG, $dbtablename, $fieldname, $record, $processedrecords;
-    $debug = debugging();
-
-    if ($CFG->dbtype == 'mysql') {
-        check_and_create_backup_dir(BACKUP_UNIQUE_CODE);  //Create the backup temp dir
-    }
-
-    ignore_user_abort(false); // see bug report 5352. This should kill this thread as soon as user aborts.
-    
-    @set_time_limit(0);
-    @ob_implicit_flush(true);
-    @ob_end_flush();
-
-    $maxrecords = optional_param('maxrecords', 0, PARAM_INT);
-    $globallang = optional_param('globallang', '', PARAM_FILE);
-    $processedrecords = 0;
-
-    $ignoretables = array();    //list of tables to ignore, optional
-    
-    //one gigantic array to hold all db table information read from all the migrate2utf8.xml file.
-    require_once($CFG->dirroot.'/lib/xmlize.php');
-    $xmls = utf_get_xml(1);
-    $tablestoconvert = 0; // total number of tables to convert
-    foreach ($xmls as $xml) {    ///foreach xml file, we must get a list of tables
-        $dbtables = $xml['DBMIGRATION']['#']['TABLES'][0]['#']['TABLE'];    //real db tables
-        foreach ($dbtables as $dbtable) {
-            $tablestoconvert++;
-        }
-    }
-    // progress bar handling
-    // first let's find out how many tables there are
-    
-    $done = 0;
-    print_progress($done, $tablestoconvert, 5, 1);
-    
-    
-    $textlib = textlib_get_instance();    //only 1 reference
-
-    //if unicodedb is set, migration is complete. die here;
-    if (!$crash = get_record('config','name','dbmigration')) {
-        //Duplicate the database if not unicode for postgres7
-        if ($CFG->dbtype == 'postgres7' && !is_postgres_utf8() && !is_postgres_setup()) {
-            echo '<script>';
-            echo 'document.getElementById("text").innerHTML = "Copying data to the UTF8 database for processing...";'."\n";
-            echo '</script>';
-
-            if ($_SESSION['newpostgresdb']->dbcluster) {
-                $cluster = ' --cluster ' . $_SESSION['newpostgresdb']->dbcluster;
-            } else {
-                $cluster = '';
-            }
-            $pgdump = 'pg_dump';
-            if (!empty($_SESSION['newpostgresdb']->pathtopgdump)) {
-                $pgdump = $_SESSION['newpostgresdb']->pathtopgdump;
-            }
-            $psql = 'psql';
-            if (!empty($_SESSION['newpostgresdb']->pathtopsql)) {
-                $pgsql = $_SESSION['newpostgresdb']->pathtopsql;
-            }
-            
-            $cmd = "PGPASSWORD={$CFG->dbpass} PGCLIENTENCODING='UNICODE' PGDATABASE={$CFG->dbname} $pgdump -Fp -O -x -U {$CFG->dbuser}$cluster";
-            if ($CFG->dbhost)  {
-                $host = split(":", $CFG->dbhost);
-                if ($host[0]) $cmd .= " -h {$host[0]}";
-                if (isset($host[1])) $cmd .= " -p {$host[1]}";
-            }
-            $cmds[] = $cmd;
-            $cmds[] = 'grep -v "COMMENT ON SCHEMA"';
-            $cmds[] = 'iconv -f UTF-8 -t UTF-8 -c';
-            $cmd = "PGPASSWORD={$_SESSION['newpostgresdb']->dbpass} PGDATABASE={$_SESSION['newpostgresdb']->dbname} $psql -q -U {$_SESSION['newpostgresdb']->dbuser} -v ON_ERROR_STOP=1$cluster";
-            if ($_SESSION['newpostgresdb']->dbhost)  {
-                $host = split(":", $_SESSION['newpostgresdb']->dbhost);
-                if ($host[0]) $cmd .= " -h {$host[0]}";
-                if (isset($host[1])) $cmd .= " -p {$host[1]}";
-            }
-            $cmds[] = $cmd;
-            foreach ($cmds as $key => $cmd) {
-                $files[] = tempnam($CFG->dataroot, 'utf8_');
-                $cmd = $cmd . ($key?" < {$files[$key-1]}":'') . " 2>&1 > {$files[$key]}";
-                if (stripos(PHP_OS, 'darwin') !== false && stripos($cmd,'iconv') !== false) {
-                    // I know this looks DREADFULLY hackish, but the iconv in mac os x seems to have a return code of 1 for warnings
-                    // and I cannot figure out why, it's a very different version of iconv to most *nix versions, even seems to be a 
-                    // different gnu project.
-                    // If someone can figure out a better way to do this, FEEL FREE :)
-                    // - Penny
-                    $cmd .= ' || true';
-                }
-                exec($cmd, $output, $return_var);
-                if ($key) {
-                    unlink($files[$key-1]);
-                }
-                if ($return_var) { // we are dead!
-                    unlink($files[$key]);
-                    echo '<br />';
-                    print_simple_box_start('center','50%');
-                    print_string('dbmigrationdupfailed','admin',htmlspecialchars(implode("\n", $output)));
-                    print_simple_box_end();
-                    print_footer();
-                    exit;
-                }
-            }
-            unlink(array_pop($files));
-        }
-
-        $migrationconfig = new object;
-        $migrationconfig->name = 'dbmigration';
-        $migrationconfig->value = '-1';
-        insert_record('config',$migrationconfig);  //process initiated
-        
-        //langs used, to help make recommendations on what lang packs to install
-        $langsused = new object;
-        $langsused->name = 'langsused';
-        $langsused->value = '';
-        insert_record('config',$langsused);
-
-    } else {
-
-        $crashdata = explode('##',$crash->value);
-        $crash->table = $crashdata[0];
-        $crash->field = $crashdata[1];
-        $crash->record = $crashdata[2];
-
-        notify("Resuming migration from: $crash->table / .$crash->field, Record: $crash->record");
-    }
-
-    /************************************************************************
-     * Now we got all our tables in order                                   *
-     ************************************************************************/
-    
-    foreach ($xmls as $xml) {    ///foreach xml file, we must get a list of tables
-        $dir = $xml['DBMIGRATION']['@']['type'];
-        $dbtables = $xml['DBMIGRATION']['#']['TABLES'][0]['#']['TABLE'];    //real db tables
-        
-        foreach ($dbtables as $dbtable) {
-
-            $done++;
-            print_progress($done, $tablestoconvert, 5, 1);
-            
-            $dbtablename = $dbtable['@']['name'];
-
-            // exception handling for adodb_logsql
-            // see bug 5003
-            if ($dbtablename == 'adodb_logsql') {
-                $prefix = '';
-            } else {
-                $prefix = $CFG->prefix;
-            }
-
-            if ($crash && ($dbtablename != $crash->table)) {  //resuming from crash
-                $done++; // need to update progress bar
-                continue;
-            }
-
-            if ($debug) {
-                print_heading("<br><b>Processsing db table ".$dbtablename.'...</b>');
-            }
-
-        /*  Insted of relying in the indexes defined for the table in utfmigrate.xml
-            files, we are going to use the MetaIndexes() DB call in order to detect
-            all the table indexes. Once fetched, they are saved in backup tables for
-            safe storage and they are dropped from the table.
-            At the end of the table, we'll fetch them from backup tables and all them
-            will be recreated again.
-            This will ensure that no index in lost in the UTF8 migration process and
-            they will be exactly the same for each server (custom indexes...)
-            Also this will leave free to keep the utfmigrate.xml files in sync for
-            all the existing indexes and we only have to maintain fields in such
-            files
-        */
-
-        /// Calculate all the indexes of the table
-            if ($CFG->dbtype == 'mysql' && $allindexes = $db->MetaIndexes($prefix.$dbtablename)) {
-            /// Send them to backup_ids table for temporal storage if crash
-                backup_putid(BACKUP_UNIQUE_CODE, $prefix.$dbtablename, 1, 1, $allindexes);
-            /// Drop all the indexes
-                $sqlarr = array();
-                foreach ($allindexes as $onekey => $oneindex) {
-                    $sqlarr[] = 'ALTER TABLE '.$prefix.$dbtablename.' DROP INDEX '.$onekey;
-                }
-                execute_sql_arr($sqlarr, true, $debug);
-            }
-
-            /**********************************************************
-             * This is the by pass structure. It allows us to process *
-             * tables on row basis instead of column/field basis      *
-             * It relies on a single function in migrate2utf8.php     *
-             **********************************************************/
-
-            /// first, check to see if there's a function for the whole table. By pass point (1)
-            if (file_exists($CFG->dirroot.'/'.$dir.'/db/migrate2utf8.php')) {
-                require_once($CFG->dirroot.'/'.$dir.'/db/migrate2utf8.php');
-                // this is a function to process table on role basis, e.g. user table in moodorg
-                $tablefunction = 'migrate2utf8_'.$dbtablename;
-            }
-            if ($CFG->dbtype=='mysql' && function_exists($tablefunction)) {
-                $tablefunction($dbtable['#']['FIELDS'][0]['#']['FIELD'], $crash, $debug, $maxrecords, $done, $tablestoconvert); // execute it.
-            } else {
-
-            /******************************************************
-             * No function for converting whole table, we proceed *
-             ******************************************************/
-             
-                if (!empty($dbtable['#']) && ($fields = $dbtable['#']['FIELDS'][0]['#']['FIELD']) and (!in_array($dbtablename, $ignoretables))) {
-
-                    $colnames = array();
-                    $coltypes = array();    //array to hold all column types for the table
-                    $collengths = array();    //array to hold all column lengths for the table
-                    $defaults = array();    //array to hold defaults, if any
-                    //reset holders
-                    $addindexarray = array();
-                    $adduniqueindexarray = array();
-                    $addprimaryarray = array();
-                    
-                    foreach ($fields as $field){
-
-                        //if in crash state, and field name is not the same as crash field name
-
-                        $fieldname = isset($field['@']['name'])?$field['@']['name']:"";
-                        $method = isset($field['@']['method'])?$field['@']['method']:"";
-                        $type = isset($field['@']['type'])?$field['@']['type']:"";
-                        $length = isset($field['@']['length'])?$field['@']['length']:"";
-
-                        if ($crash && ($crash->field != $fieldname)) {
-                            continue;
-                        }
-
-                        $dropindex = isset($field['@']['dropindex'])?$field['@']['dropindex']:"";
-                        $addindex = isset($field['@']['addindex'])?$field['@']['addindex']:"";
-                        $adduniqueindex = isset($field['@']['adduniqueindex'])?$field['@']['adduniqueindex']:"";
-
-                        $dropprimary = isset($field['@']['dropprimary'])?$field['@']['dropprimary']:"";
-                        $addprimary = isset($field['@']['addprimary'])?$field['@']['addprimary']:"";
-                        $default = isset($field['@']['default'])?"'".$field['@']['default']."'":"''";
-
-                        if ($fieldname != 'dummy') {
-                            $colnames[] = $fieldname;
-                            $coltypes[] = $type;
-                            $collengths[]= $length;
-                        }
-
-                        if ($debug) {
-                            echo "<br>--><b>processing db field ".$fieldname.'</b>';
-                            echo "<br>---><b>method ".$method.'</b>';
-                        }
-
-
-                        if ($CFG->dbtype == 'mysql') {
-
-                            /* Drop the index, because with index on, you can't change it to longblob
-                            
-                               NOTE: We aren't going to drop individual indexes anymore, because we have
-                                     dropped them at the begining of the table iteration, saving them to
-                                     backup temp tables. At the end of the table iteration we are going
-                                     to rebuild them back
-
-                            if ($dropindex){    //drop index if index is varchar, text etc type
-                                $SQL = 'ALTER TABLE '.$prefix.$dbtablename.' DROP INDEX '.$dropindex.';';
-                                $SQL1 = 'ALTER TABLE '.$prefix.$dbtablename.' DROP INDEX '.$CFG->prefix.$dropindex.';'; // see bug 5205
-                                if ($debug) {
-                                    $db->debug=999;
-                                }
-
-                                execute_sql($SQL, false); // see bug 5205
-                                execute_sql($SQL1, false); // see bug 5205
-
-                                if ($debug) {
-                                    $db->debug=0;
-                                }
-                            } else */
-                            if ($dropprimary) {    // drop primary key
-                                $SQL = 'ALTER TABLE '.$prefix.$dbtablename.' DROP PRIMARY KEY;';
-                                if ($debug) {
-                                    $db->debug=999;
-                                }
-                                execute_sql($SQL, $debug);
-                                if ($debug) {
-                                    $db->debug=0;
-                                }
-                            }
-
-                            /* Previously to change the field to LONGBLOB, we are going to
-                               use Meta info to fetch the NULL/NOT NULL status of the field.
-                               Then, when converting back the field to its final UTF8 status
-                               we'll apply such status (and default)
-                               This has been added on 1.7 because we are in the process of
-                               converting some fields to NULL and the assumption of all the 
-                               CHAR/TEXT fields being always NOT NULL isn't valid anymore! 
-                               Note that this code will leave remaining NOT NULL fiels
-                               unmodified at all, folowing the old approach 
-                            */
-                            if(($cols = $db->MetaColumns($prefix.$dbtablename)) && $fieldname != 'dummy') {
-                                $cols = array_change_key_case($cols, CASE_LOWER); ///lowercase col names
-                                $notnull = 'NOT NULL';  ///Old default
-                                if ($col = $cols[strtolower($fieldname)]) {
-                                /// If the column was null before UTF-8 migration, save it
-                                    if (!$col->not_null) {
-                                        $notnull = 'NULL';
-                                    /// And, if the column had an empty string as default, make it NULL now
-                                        if ($default == "''") {
-                                            $default = 'NULL';
-                                        }
-                                    }
-                                }
-                            }
-
-                            /* Change to longblob, serves 2 purposes:
-                               1. column loses encoding, so when we finally change it to unicode,
-                                  mysql does not do a double convertion
-                               2. longblobs puts no limit (ok, not really but it's large enough)
-                                  to handle most of the problems such as in bug 5194
-                            */
-
-                            $SQL = 'ALTER TABLE '.$prefix.$dbtablename;
-                            $SQL.= ' CHANGE '.$fieldname.' '.$fieldname.' LONGBLOB';
-
-                            /*
-                            if ($length > 0) {
-                                $SQL.='('.$length.') ';
-                            }
-                            $SQL .= ' CHARACTER SET binary NOT NULL DEFAULT '.$default.';';
-                            */
-                            if ($debug) {
-                                $db->debug=999;
-                            }
-                            if ($fieldname != 'dummy') {
-                                execute_sql($SQL, $debug);
-                            }
-                            if ($debug) {
-                                $db->debug=0;
-                            }
-
-                        }
-
-                        $patterns[]='/RECORDID/';    //for preg_replace
-                        $patterns[]='/\{\$CFG\-\>prefix\}/i';    //same here
-
-                        if ($method == 'PLAIN_SQL_UPDATE') {
-                            $sqldetectuser = $field['#']['SQL_DETECT_USER'][0]['#'];
-                            $sqldetectcourse = $field['#']['SQL_DETECT_COURSE'][0]['#'];
-                        }
-                        else if ($method == 'PHP_FUNCTION') {
-                            $phpfunction = 'migrate2utf8_'.$dbtablename.'_'.$fieldname;
-                        }
-
-                        ///get the total number of records for this field
-
-                        // could not use count_records because it addes prefix to adodb_logsql
-                        $totalrecords = count_records_sql("select count(*) from {$prefix}$dbtablename");
-                        $counter = 0;
-                        $recordsetsize = 50;
-
-                        if ($crash) {    //if resuming from crash
-                            //find the number of records with id smaller than the crash id
-                            $indexSQL = 'SELECT COUNT(*) FROM '.$prefix.$dbtablename.' WHERE id < '.$crash->record;
-                            $counter = count_records_sql($indexSQL);
-                        }
-
-                        if ($debug) {
-                            echo "<br>Total number of records is ..".$totalrecords;
-                            echo "<br/>Counter is $counter";
-                        }
-
-
-                        /**************************
-                         * converting each record *
-                         **************************/
-                        while(($counter < $totalrecords) and ($fieldname !='dummy') and ($method!='NO_CONV')) {    //while there is still something
-                            $SQL = 'SELECT * FROM '.$prefix.$dbtablename.' ORDER BY id ASC';
-                            if ($records = get_records_sql($SQL, $counter, $recordsetsize)) {
-                                foreach ($records as $record) {
-
-                                    //if we are up this far, either no crash, or crash with same table, field name.
-                                    if ($crash){
-                                        if ($crash->record != $record->id) {    //might set to < just in case record is deleted
-                                            continue;
-                                        } else {
-                                            $crash = 0;
-                                        }
-                                    }
-
-                                    $migrationconfig = get_record('config','name','dbmigration');
-                                    $migrationconfig->name = 'dbmigration';
-                                    $migrationconfig->value = $dbtablename.'##'.$fieldname.'##'.$record->id;
-                                    update_record('config',$migrationconfig);
-
-                                    $replacements = array();    //manual refresh
-                                    $replacements[] = $record->id;
-                                    $replacements[] = $prefix;
-
-                                    if (!empty($record->{$fieldname})) {    //only update if not empty
-                                        switch ($method){
-                                            case 'PLAIN_SQL_UPDATE':    //use the 2 statements to update
-
-                                                if ($debug) {
-                                                    $db->debug=999;
-                                                }
-
-                                                //if global lang is set, we just use that
-
-                                                if ($globallang) {
-                                                    $fromenc = $globallang;
-                                                } else {
-                                                    $userid = get_record_sql(preg_replace($patterns, $replacements, $sqldetectuser));
-                                                    $courseid = get_record_sql(preg_replace($patterns, $replacements, $sqldetectcourse));
-
-                                                    $sitelang   = $CFG->lang;
-                                                    $courselang = get_course_lang(isset($courseid->course)?$courseid->course:1);
-                                                    $userlang   = get_user_lang(isset($userid->userid)?$userid->userid:1);
-
-                                                    $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-                                                }
-
-                                                //only update if non utf8
-                                                if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-                                                    $result = utfconvert($record->{$fieldname}, $fromenc);
-                                                    $newrecord = new object;
-                                                    $newrecord->id = $record->id;
-                                                    $newrecord->{$fieldname} = $result;
-                                                    migrate2utf8_update_record($dbtablename,$newrecord);
-                                                }
-                                                if ($debug) {
-                                                    $db->debug=0;
-                                                }
-                                            break;
-
-                                            case 'PHP_FUNCTION':    //use the default php function to execute
-                                                if ($debug) {
-                                                    $db->debug=999;
-                                                }
-                                                require_once($CFG->dirroot.'/'.$dir.'/db/migrate2utf8.php');
-                                                $phpfunction($record->id);
-                                                if ($debug) {
-                                                    $db->debug=0;
-                                                }
-                                            break;
-
-                                            default:    //no_conv, don't do anything ;-)
-                                            break;
-                                        }
-                                    }
-                                    $counter++;
-                                    if ($maxrecords) {
-                                        if ($processedrecords == $maxrecords) {
-                                            notify($maxrecords.' records processed. Migration Process halted');
-                                            print_continue('utfdbmigrate.php?confirm=1&amp;maxrecords='.$maxrecords.'&amp;sesskey='.sesskey());
-                                            print_footer();
-                                            die();
-                                        }
-                                    }
-
-                                    $processedrecords++;
-                                    //print some output once in a while
-                                    if (($processedrecords) % 1000 == 0) {
-                                        print_progress($done, $tablestoconvert, 5, 1,
-                                                       'Processing: '.$dbtablename.'/'.$fieldname.' ');
-                                    }
-                                }
-                            }else {
-                                if ($debug) {
-                                    notify('no records found!');
-                                }
-                            }
-                        }   //close the while loop
-
-                        /********************
-                         * Drop index here **
-                         ********************/
-
-                        if ($CFG->dbtype == 'mysql') {
-
-                            /*********************************
-                             * Change column encoding 2 phase*
-                             *********************************/
-
-                            /*
-                            $SQL = 'ALTER TABLE '.$CFG->prefix.$dbtablename;
-                            $SQL.= ' CHANGE '.$fieldname.' '.$fieldname.' LONGTEXT';
-                           // if ($length > 0) {
-                           //     $SQL.='('.$length.') ';
-                           // }
-                            $SQL .= ' CHARACTER SET binary NOT NULL DEFAULT '.$default.';';
-                            if ($debug) {
-                                $db->debug=999;
-                            }
-                            if ($fieldname != 'dummy') {
-                                execute_sql($SQL, $debug);
-                            }
-                            if ($debug) {
-                                $db->debug=0;
-                            }*/
-                            //phase 2
-                            $SQL = 'ALTER TABLE '.$prefix.$dbtablename;
-                            $SQL.= ' CHANGE '.$fieldname.' '.$fieldname.' '.$type;
-                            if ($length > 0) {
-                                $SQL.='('.$length.') ';
-                            }
-                            $SQL.=' CHARACTER SET utf8 ' . $notnull . ' DEFAULT '. $default . ';';
-                            if ($debug) {
-                                $db->debug=999;
-                            }
-                            if ($fieldname != 'dummy') {
-                                execute_sql($SQL, $debug);
-                            }
-                            if ($debug) {
-                                $db->debug=0;
-                            }
-                            /********************************************
-                             * build an array to add index back together*
-                             ********************************************/
-                            if ($addindex){
-                                $addindexarray[] = $addindex;
-                            } else if ($adduniqueindex) {
-                                $adduniqueindexarray[] = $adduniqueindex;
-                            } else if ($addprimary) {
-                                $addprimaryarray[] = $addprimary;
-                            }
-
-                        } else {
-
-                        //posgresql code here
-                        //No we don't need to do anything here
-
-                        }
-
-                    }
-
-                    /********************************
-                     * Adding the index back        *
-                     ********************************/
-                    $alter = 0;
-
-                    if ($CFG->dbtype=='mysql'){
-
-                        $SQL = 'ALTER TABLE '.$prefix.$dbtablename;
-                    /*
-                        NOTE: We aren't going to create the indexes back here any more because they
-                              are going to be recreated at the end of the table iteration with
-                              the info saved at the begining of it.
-
-                        if (!empty($addindexarray)) {
-                            foreach ($addindexarray as $aidx){
-                                $SQL .= ' ADD INDEX '.$aidx.',';
-                                $alter++;
-                            }
-                        }
-
-                        if (!empty($adduniqueindexarray)) {
-                            foreach ($adduniqueindexarray as $auidx){
-                                $SQL .= ' ADD UNIQUE INDEX '.$auidx.',';
-                                $alter++;
-                            }
-                        }
-                    */
-
-                        if (!empty($addprimaryarray)) {
-                            foreach ($addprimaryarray as $apm){
-                                $SQL .= ' ADD PRIMARY KEY '.$apm.',';
-                                $alter++;
-                            }
-                        }
-
-                        $SQL = rtrim($SQL, ', ');
-                        $SQL.=';';
-
-                    } else {
-                      ///posgresql code here
-                      ///No we don't need to do anything here
-
-                    }
-
-                    if ($alter) {
-                        if ($debug) {
-                            $db->debug=999;
-                        }
-                        execute_sql($SQL, $debug);
-                        if ($debug) {
-                            $db->debug=0;
-                        }
-                    }
-
-                } //if there are fields
-            
-            
-            } /// Point 1 - bypass should end here.
-            
-            
-            /************************************
-             * now we modify the table encoding *
-             ************************************/
-            if ($CFG->dbtype=='mysql'){
-                $SQL = 'ALTER TABLE '.$prefix.$dbtablename.' CHARACTER SET utf8';
-                if ($debug) {
-                    $db->debug=999;
-                }
-                execute_sql($SQL, $debug);
-                if ($debug) {
-                    $db->debug=0;
-                }
-
-            } else {
-
-                ///posgresql code here
-                ///No we don't need to do anything here
-            }
-
-        /// Recreate all the indexes previously dropped and sent to backup
-        /// tables. Retrieve information from backup tables
-            if ($backupindexes = backup_getid(BACKUP_UNIQUE_CODE, $prefix.$dbtablename, 1)) {
-            /// Confirm we have indexes
-                if ($allindexes = $backupindexes->info) {
-                /// Recreate all the indexes
-                    $sqlarr = array();
-                    foreach ($allindexes as $onekey => $oneindex) {
-                        $unique = $oneindex['unique']? 'UNIQUE ' : '';
-                        $sqlarr[] = 'ALTER TABLE '.$prefix.$dbtablename.' ADD '.$unique.'INDEX '.$onekey.
-                                    ' ('.implode(', ', $oneindex['columns']).')';
-                    }
-                    execute_sql_arr($sqlarr, true, $debug);
-                }
-            }
-        }
-    }
-
-    if ($CFG->dbtype=='mysql') {
-        /*********************************
-         * now we modify the db encoding *
-         *********************************/
-        $SQL = 'ALTER DATABASE '.$CFG->dbname.' CHARACTER SET utf8';
-        execute_sql($SQL, $debug);
-    } else {
-        if (!is_postgres_utf8()) {
-            //This old database is now deprecated
-            set_config('migrated_to_new_db','1');
-        }
-    }
-    delete_records('config','name','dbmigration');    //bye bye
-    
-    //These have to go!
-    if ($debug) {
-        $db->debug=true;
-    }
-
-    if ($CFG->dbtype == 'postgres7') {
-        $backup_db = $GLOBALS['db'];
-        $GLOBALS['db'] = &get_postgres_db();
-    }
-
-    execute_sql('TRUNCATE TABLE '.$CFG->prefix.'cache_text', $debug);
-    execute_sql('TRUNCATE TABLE '.$CFG->prefix.'cache_filters', $debug);
-
-    if ($CFG->dbtype == 'postgres7') {
-        $GLOBALS['db'] = $backup_db;
-        unset($backup_db);
-    }
-    if ($debug) {
-        $db->debug=0;
-    }
-
-    //update site language
-    $sitelanguage = get_record('config','name', 'lang');
-    if (strstr($sitelanguage->value, 'utf8')===false and $sitelanguage->value) {
-        $sitelanguage->value.='_utf8';
-        migrate2utf8_update_record('config',$sitelanguage);
-    }
-
-    //finish the javascript bar
-    $done = $tablestoconvert;
-    print_progress($done, $tablestoconvert, 5, 1);
-    
-    //prints the list of langs used in this site
-    print_simple_box_start('center','50%');
-    echo '<div align="center">The following Language Packs are needed for your users and courses. Please install the following Language Packs:<br><b>';
-    $langsused = get_record('config','name', 'langsused');
-    $langs = explode (',',$langsused->value);
-    
-    foreach ($langs as $lang) {
-        if (!empty($lang) and $lang != 'en_utf8') {
-            echo $lang.', ';
-        }
-    }
-    echo '</b><br/><a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/langimport.php">Language Import Utility</a></div>';
-    print_simple_box_end();
-    delete_records('config','name','langsused');
-
-    //remove the cache file!
-    @unlink($CFG->dataroot.'/cache/languages');
-
-    //remove backup temp storage
-    if ($CFG->dbtype = 'mysql') {
-        $pref->backup_unique_code = BACKUP_UNIQUE_CODE;
-        clean_temp_data($pref);
-    }
-
-    // Regenerate some cached data
-    
-    if ($CFG->dbtype == 'mysql') {
-        $db->Execute("SET NAMES 'utf8'");
-    } else if ($CFG->dbtype == 'postgres7') {
-        $db->Execute("SET NAMES 'utf8'");
-    }
-    
-    rebuild_course_cache();
-
-    //set the final flag
-    migrate2utf8_set_config('unicodedb','true');    //this is the main flag for unicode db
-
-     //echo date("H:i:s");
-}
-
-
-/* returns the course lang
- * @param int courseid
- * @return string
- */
-function get_course_lang($courseid) {
-
-    static $coursecache;
-    
-    if (!isset($coursecache[$courseid])) {
-        if ($course = get_record('course','id',$courseid)){
-            $coursecache[$courseid] = $course->lang;
-            return $course->lang;
-        }
-        return false;
-    } else {
-        return $coursecache[$courseid];
-    }
-}
-
-/* returns the teacher's lang
- * @param int courseid
- * @return string
- */
-function get_main_teacher_lang($courseid) {
-    //editting teacher > non editting teacher
-    global $CFG;
-    static $mainteachercache;
-    
-    if ($courseid == SITEID || $courseid==0) {
-        $admin = get_admin();
-        $mainteachercache[$courseid] = $admin->lang;
-        return $admin->lang;
-    }
-    
-    if (!isset($mainteachercache[$courseid])) {
-        
-        /// this is a worse guess
-        if (!empty($CFG->rolesactive)) {
-            
-            $context = get_context_instance(CONTEXT_COURSE, $courseid);
-            $teachers = get_users_by_capability($context, 'moodle/legacy:editingteacher', 'u.id, u.lang', 'ra.id ASC', 0, 1); // only need first one
-            if (is_array($teachers)) {
-                $teacher = reset($teachers);
-                $mainteachercache[$courseid] = $teacher->lang;
-                return $teacher->lang;
-            }
-        /// this is a better guess
-        } else {
-      
-            $SQL = 'SELECT u.id, u.lang 
-                    FROM '.$CFG->prefix.'user_teachers ut,
-                         '.$CFG->prefix.'course c,
-                         '.$CFG->prefix.'user u 
-                    WHERE c.id = ut.course AND 
-                          ut.course = '.$courseid.' AND 
-                          u.id = ut.userid 
-                    ORDER BY ut.authority ASC';
-
-            if ($teacher = get_record_sql($SQL, true)) {
-                $mainteachercache[$courseid] = $teacher->lang;
-                return $teacher->lang;
-            }
-        }
-    /// Arriving here we haven't been able to select any teacher lang
-    /// so use the admin lang
-        $admin = get_admin();
-        $mainteachercache[$courseid] = $admin->lang;
-        return $admin->lang;
-    } else {
-        return $mainteachercache[$courseid];
-    }
-}
-
-function get_original_encoding($sitelang, $courselang, $userlang){
-
-    global $CFG, $enc;
-
-    $lang = '';
-    if ($courselang) {
-        $lang = $courselang;
-    }
-    else if ($userlang) {
-        $lang = $userlang;
-    }
-    else if ($sitelang) {
-        $lang = $sitelang;
-    }
-    else {
-        error ('no language found!');
-    }
-
-    if ($enc[$lang]) {
-        return $enc[$lang];
-    } else {
-        notify ('unknown language detected: '.$lang);
-        return false;
-    }
-}
-
-/* returns the user's lang
- * @param int userid
- * @return string
- */
-function get_user_lang($userid) {
-
-    static $usercache;
-    
-    if (!isset($usercache[$userid])) {
-        if ($user = get_record('user','id',$userid)) {
-            $usercache[$userid] = $user->lang;
-            return $user->lang;
-        }
-    } else {
-        return $usercache[$userid];
-    }
-    return false;
-}
-
-// a placeholder for now
-function log_the_problem_somewhere() {  //Eloy: Nice function, perhaps we could use it, perhpas no. :-)
-    global $CFG, $dbtablename, $fieldname, $record;
-    if ($CFG->debug>7) {
-        echo "<br />Problem converting: $dbtablename -> $fieldname -> {$record->id}!";
-    }
-}
-
-// only this function should be used during db migraton, because of addslashes at the end of the convertion
-function utfconvert($string, $enc, $slash=true) {
-    global $textlib;
-    if ($result = $textlib->convert($string, $enc)) {
-        if ($slash) {
-            $result = addslashes($result);
-        }
-    }
-    return $result;
-}
-
-function validate_form(&$form, &$err) {
-    global $CFG;
-
-    $newdb = &ADONewConnection('postgres7');
-    error_reporting(0);  // Hide errors
-    $dbconnected = $newdb->Connect($form->dbhost,$form->dbuser,$form->dbpass,$form->dbname);
-    error_reporting($CFG->debug);  // Show errors
-    if (!$dbconnected) {
-        $err['dbconnect'] = get_string('dbmigrateconnecerror', 'admin');
-        return;
-    }
-
-    if (!is_postgres_utf8($newdb)) {
-        $encoding = $newdb->GetOne('SHOW server_encoding');
-        $err['dbconnect'] = get_string('dbmigrateencodingerror', 'admin', $encoding);
-        return;
-    }
-
-    if (!empty($form->pathtopgdump) && !is_executable($form->pathtopgdump)) {
-        $err['pathtopgdump'] = get_string('pathtopgdumpinvalid','admin');
-        return;
-    }
-
-    if (!empty($form->pathtopsql) && !is_executable($form->pathtopsql)) {
-        $err['pathtopsql'] = get_string('pathtopsqlinvalid','admin');
-        return;
-    }                                   
-
-    return;
-}
-
-function is_postgres_utf8($thedb = null) {
-    if ($thedb === null) {
-        $thedb = &$GLOBALS['db'];
-    }
-
-    $db_encoding_postgres = $thedb->GetOne('SHOW server_encoding');
-    if (strtoupper($db_encoding_postgres) == 'UNICODE' || strtoupper($db_encoding_postgres) == 'UTF8') {
-        return true;
-    } else {
-        return false;
-    }
-}
-
-function &get_postgres_db() {
-    static $postgres_db;
-
-    if (!$postgres_db) {
-        if (is_postgres_utf8()) {
-            $postgres_db = &$GLOBALS['db'];
-        } else {
-            $postgres_db = &ADONewConnection('postgres7');
-            $postgres_db->Connect($_SESSION['newpostgresdb']->dbhost,$_SESSION['newpostgresdb']->dbuser,$_SESSION['newpostgresdb']->dbpass,$_SESSION['newpostgresdb']->dbname);
-        }
-    }
-
-    return $postgres_db;
-}
-
-function is_postgres_setup() {
-    $postgres_db = &get_postgres_db();
-
-    return $GLOBALS['db']->MetaTables() == $postgres_db->MetaTables();
-}
-
-function migrate2utf8_update_record($table,$record) {
-    global $CFG;
-
-    if ($CFG->dbtype == 'mysql') {
-        update_record($table,$record);
-    } else {
-        $backup_db = $GLOBALS['db'];
-        $GLOBALS['db'] = &get_postgres_db();
-        global $in;
-        $in = true;
-        update_record($table,$record);
-        $GLOBALS['db'] = $backup_db;
-    }
-}
-
-function migrate2utf8_set_config($name, $value, $plugin=NULL) {
-    global $CFG;
-    if ($CFG->dbtype == 'mysql') {
-        set_config($name, $value, $plugin);
-    } else {
-        $backup_db = $GLOBALS['db'];
-        $GLOBALS['db'] = &get_postgres_db();
-        set_config($name, $value, $plugin);
-        $GLOBALS['db'] = $backup_db;
-    }
-}
-
-// this needs to print an error when a mod does not have a migrate2utf8.xml
-function utf_get_xml ($mode=0) { // if mode is 1, do not perform check for script validity
-    global $CFG;
-
-    $xmls = array();
-    $noscript = 0; // we assume all mod and all blocks have migration scripts
-
-    /*****************************************************************************
-     * traverse order is mod->backup->block->block_plugin->enroll_plugin->global *
-     *****************************************************************************/
-
-    ///mod
-    if (!$mods = get_list_of_plugins('mod')) {
-        error('No modules installed!');
-    }
-
-    foreach ($mods as $mod){
-        if (file_exists($CFG->dirroot.'/mod/'.$mod.'/db/migrate2utf8.xml')) {
-            $xmls[] = xmlize(file_get_contents($CFG->dirroot.'/mod/'.$mod.'/db/migrate2utf8.xml'));
-        } else if (!$mode) {
-            $noscript = 1;
-            notify('warning, there is no migration script detected for this module - '.$mod);
-        }
-    }
-
-    ///Backups
-    $xmls[] = xmlize(file_get_contents($CFG->dirroot.'/backup/db/migrate2utf8.xml'));
-
-    ///Blocks
-    $xmls[] = xmlize(file_get_contents($CFG->dirroot.'/blocks/db/migrate2utf8.xml'));
-
-    ///Block Plugins
-    if (!$blocks = get_list_of_plugins('blocks')) {
-        //error('No blocks installed!');    //Eloy: Is this a cause to stop?
-    }
-
-    foreach ($blocks as $block){
-        if (file_exists($CFG->dirroot.'/blocks/'.$block.'/db/migrate2utf8.xml')) {
-            $xmls[] = xmlize(file_get_contents($CFG->dirroot.'/blocks/'.$block.'/db/migrate2utf8.xml'));
-        } else if (!$mode) {
-            if (file_exists($CFG->dirroot.'/blocks/'.$block.'/db/mysql.sql') && filesize($CFG->dirroot.'/blocks/'.$block.'/db/mysql.sql')) { // if no migration script, and have db script, we are in trouble
-                notify('warning, there is no migration script detected for this block - '.$block);
-                $noscript = 1;
-            }
-        }
-    }
-
-    ///Enrol
-
-    if (!$enrols = get_list_of_plugins('enrol')) {
-        //error('No enrol installed!');   //Eloy: enrol, not blocks :-) Is this a cause to stop?
-    }
-
-    foreach ($enrols as $enrol){
-        if (file_exists($CFG->dirroot.'/enrol/'.$enrol.'/db/migrate2utf8.xml')) {
-           $xmls[] = xmlize(file_get_contents($CFG->dirroot.'/enrol/'.$enrol.'/db/migrate2utf8.xml'));
-        }
-    }
-
-    ///Lastly, globals
-
-    $xmls[] = xmlize(file_get_contents($CFG->dirroot.'/lib/db/migrate2utf8.xml'));
-    
-    if ($noscript) {
-        notify ('Some of your modules or Blocks do not have a migration script. It is very likely that these are contrib modules. If your Moodle site uses non-UTF8 language packs and non-en language packs, data inside these moduels or blocks will not be displayed correctly after the migration. Please proceed with caution.');
-    }
-    
-    return $xmls;
-
-}
index 172f2e6b6b506db2cd0e1c0896609dec0522e591..2f3ea496fd931c197ad6c0afbeeb571e5c0898e6 100644 (file)
@@ -141,6 +141,14 @@ class get_db_directories extends XMLDBAction {
                 $XMLDB->dbdirs[$dbdir->path]->path_exists = file_exists($dbdir->path);  //Update status
             }
         }
+        
+    /// Now, groups
+        $dbdir->path = $CFG->dirroot . '/group/db';
+        if (!isset($XMLDB->dbdirs[$dbdir->path])) {
+            $XMLDB->dbdirs[$dbdir->path] = $dbdir;
+        }
+        $XMLDB->dbdirs[$dbdir->path]->path_exists = file_exists($dbdir->path);  //Update status
+        
     /// Sort by key
         ksort($XMLDB->dbdirs);
 
index 611e9321228908f1149cd2f21f6a9151cba0e0e3..987d000eaede5a55ae6e907200a6e416cdedb794 100644 (file)
         $status2 = true;
 
         //Get groups 
-        $groups = get_records("groups","courseid",$preferences->backup_course);
+        $groups = get_groups($preferences->backup_course); //TODO:check.
 
         //Pring groups header
         if ($groups) {
         $status = true;
 
         //Get groups_members
-        $groups_members = get_records("groups_members","groupid",$groupid);
+        $groups_members = groups_get_members($groupid); //TODO:check.
         
         //Pring groups_members header
         if ($groups_members) {
                 //Iterate
                 foreach ($list as $dir) {
                     //Look for dir like group in groups table
-                    $data = get_record ('groups', 'courseid', $preferences->backup_course,
-                                                  'id',$dir);
+                    $data = groups_group_belongs_to_course($dir, $preferences->backup_course);
+                    //TODO:check. get_record ('groups', 'courseid', $preferences->backup_course,'id',$dir);
                     //If exists, copy it
                     if ($data) {
                         $status = backup_copy_file($rootdir."/".$dir,
diff --git a/backup/db/migrate2utf8.php b/backup/db/migrate2utf8.php
deleted file mode 100755 (executable)
index b3af4d4..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php // $Id$
-
-function migrate2utf8_backup_ids_info($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$backupids= get_record('backup_ids', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = null;
-        $userlang   = null; //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// Initialise $result
-    $result = $backupids->info;
-
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($backupids->info, $fromenc);
-
-        $newbackupids = new object;
-        $newbackupids->id = $recordid;
-        $newbackupids->info = $result;
-        migrate2utf8_update_record('backup_ids',$newbackupids);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-?>
diff --git a/backup/db/migrate2utf8.xml b/backup/db/migrate2utf8.xml
deleted file mode 100755 (executable)
index 65719b7..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-<DBMIGRATION type="backup" VERSION="2005120100">
-  <TABLES>
-    <TABLE name="backup_config">
-      <FIELDS>
-        <FIELD name="name" method="NO_CONV" type="varchar" length="255" dropindex="name" adduniqueindex="name (name(255))"/>
-        <FIELD name="value" method="NO_CONV" type="varchar" length="255" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="backup_courses">
-      <FIELDS>
-        <FIELD name="laststatus" method="NO_CONV" type="char" length="1" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="backup_files">
-      <FIELDS>
-        <FIELD name="file_type" method="NO_CONV" type="varchar" length="10" dropindex="backup_files_uk" />
-        <FIELD name="path" method="NO_CONV" type="varchar" length="255" adduniqueindex="backup_files_uk (backup_code, file_type(10), path(255))"/>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="backup_ids">
-      <FIELDS>
-        <FIELD name="table_name" method="NO_CONV" type="varchar" length="30" dropindex="backup_ids_uk" adduniqueindex=" backup_ids_uk(backup_code, table_name(30), old_id)"/>
-        <FIELD name="info" method="PHP_FUNCTION" type="mediumtext" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_backup_ids_info(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="backup_log">
-      <FIELDS>
-        <FIELD name="info" method="NO_CONV" type="varchar" length="255" />
-      </FIELDS>
-    </TABLE>
-  </TABLES>
-</DBMIGRATION>
index f8c11688cd481ca874867d7622eab231c1ee0474..4284cc3024ae31578c2275662e1e7b9bca88c26b 100644 (file)
@@ -88,7 +88,7 @@ class block_admin extends block_list {
 
         if (($course->groupmode || !$course->groupmodeforce) && has_capability('moodle/course:managegroups', $context) && ($course->id!==SITEID)) {
             $strgroups = get_string('groups');
-            $this->content->items[]='<a title="'.$strgroups.'" href="'.$CFG->wwwroot.'/course/groups.php?id='.$this->instance->pageid.'">'.$strgroups.'</a>';
+            $this->content->items[]='<a title="'.$strgroups.'" href="'.groups_home_url($this->instance->pageid).'">'.$strgroups.'</a>';
             $this->content->icons[]='<img src="'.$CFG->pixpath.'/i/group.gif" alt="" />';
         }
 
diff --git a/blocks/db/migrate2utf8.php b/blocks/db/migrate2utf8.php
deleted file mode 100755 (executable)
index a19c5b4..0000000
+++ /dev/null
@@ -1,190 +0,0 @@
-<?php // $Id$
-function migrate2utf8_block_instance_configdata($recordid){
-    global $CFG, $globallang;
-
-    $blockinstance = get_record('block_instance','id',$recordid);
-
-    //get block instance type, we only need to worry about HTML blocks... right?????????
-    
-    $blocktype = get_record('block','id',$blockinstance->blockid);
-    
-    if ($blocktype -> name == 'html') {
-
-        ///find course
-        if ($globallang) {
-            $fromenc = $globallang;
-        } else {
-            $sitelang   = $CFG->lang;
-            $courselang = get_course_lang($blockinstance->pageid);  //Non existing!
-            $userlang   = get_main_teacher_lang($blockinstance->pageid); //N.E.!!
-
-            $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-        }
-       
-        $blah = unserialize(base64_decode($blockinstance->configdata));
-    /// We are going to use textlib facilities
-        
-    /// Convert the text
-        $blah->title = utfconvert($blah->title, $fromenc, false);
-        $blah->text = utfconvert($blah->text, $fromenc, false);
-        
-        $blockinstance->configdata = base64_encode(serialize($blah));
-
-        migrate2utf8_update_record('block_instance',$blockinstance);
-
-        return $blah;
-
-    } else if ($blocktype -> name == 'rss_client'){
-
-        ///find course
-        if ($globallang) {
-            $fromenc = $globallang;
-        } else {
-            $sitelang   = $CFG->lang;
-            $courselang = get_course_lang($blockinstance->pageid);  //Non existing!
-            $userlang   = get_main_teacher_lang($blockinstance->pageid); //N.E.!!
-
-            $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-        }
-
-        $blah = unserialize(base64_decode($blockinstance->configdata));
-
-    /// We are going to use textlib facilities
-        
-    /// Convert the text
-        $blah->title = utfconvert($blah->title, $fromenc, false);
-
-        $blockinstance->configdata = base64_encode(serialize($blah));
-
-        migrate2utf8_update_record('block_instance',$blockinstance);
-
-        return $blah;
-
-    } else if ($blocktype -> name == 'glossary_random'){
-
-        ///find course
-        if ($globallang) {
-            $fromenc = $globallang;
-        } else {
-            $sitelang   = $CFG->lang;
-            $courselang = get_course_lang($blockinstance->pageid);  //Non existing!
-            $userlang   = get_main_teacher_lang($blockinstance->pageid); //N.E.!!
-
-            $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-        }
-
-        $blah = unserialize(base64_decode($blockinstance->configdata));
-
-    /// We are going to use textlib facilities
-
-    /// Convert the text
-        $blah->title = utfconvert($blah->title, $fromenc, false);
-        $blah->addentry = utfconvert($blah->addentry, $fromenc, false);
-        $blah->viewglossary = utfconvert($blah->viewglossary, $fromenc, false);
-        $blah->invisible = utfconvert($blah->invisible, $fromenc, false);
-
-        $blockinstance->configdata = base64_encode(serialize($blah));
-
-        migrate2utf8_update_record('block_instance',$blockinstance);
-
-        return $blah;
-
-    }
-
-}
-
-function migrate2utf8_block_pinned_configdata($recordid){
-global $CFG, $globallang;
-
-    $blockpinned = get_record('block_pinned','id',$recordid);
-
-    //get block instance type, we only need to worry about HTML blocks... right?????????
-
-    $blocktype = get_record('block','id',$blockpinned->blockid);
-
-    if ($blocktype -> name == 'html') {
-
-        ///find course
-        if ($globallang) {
-            $fromenc = $globallang;
-        } else {
-            $sitelang   = $CFG->lang;
-            $courselang = get_course_lang($blockpinned->pageid);  //Non existing!
-            $userlang   = get_main_teacher_lang($blockpinned->pageid); //N.E.!!
-
-            $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-        }
-
-        $blah = unserialize(base64_decode($blockpinned->configdata));
-
-    /// We are going to use textlib facilities
-
-    /// Convert the text
-        $blah->title = utfconvert($blah->title, $fromenc, false);
-        $blah->text = utfconvert($blah->text, $fromenc, false);
-
-        $blockpinned->configdata = base64_encode(serialize($blah));
-
-        migrate2utf8_update_record('blockpinned',$blockpinned);
-
-        return $blah;
-
-    } else if ($blocktype -> name == 'rss_client'){
-
-        ///find course
-        if ($globallang) {
-            $fromenc = $globallang;
-        } else {
-            $sitelang   = $CFG->lang;
-            $courselang = get_course_lang($blockpinned->pageid);  //Non existing!
-            $userlang   = get_main_teacher_lang($blockpinned->pageid); //N.E.!!
-
-            $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-        }
-
-        $blah = unserialize(base64_decode($blockpinned->configdata));
-
-    /// We are going to use textlib facilities
-
-    /// Convert the text
-        $blah->title = utfconvert($blah->title, $fromenc, false);
-
-        $blockpinned->configdata = base64_encode(serialize($blah));
-
-        migrate2utf8_update_record('blockpinned',$blockblockpinned);
-
-        return $blah;
-
-    } else if ($blocktype -> name == 'glossary_random'){
-
-        ///find course
-        if ($globallang) {
-            $fromenc = $globallang;
-        } else {
-            $sitelang   = $CFG->lang;
-            $courselang = get_course_lang($blockpinned->pageid);  //Non existing!
-            $userlang   = get_main_teacher_lang($blockpinned->pageid); //N.E.!!
-
-            $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-        }
-
-        $blah = unserialize(base64_decode($blockpinned->configdata));
-
-    /// We are going to use textlib facilities
-
-    /// Convert the text
-        $blah->title = utfconvert($blah->title, $fromenc, false);
-        $blah->addentry = utfconvert($blah->addentry, $fromenc, false);
-        $blah->viewglossary = utfconvert($blah->viewglossary, $fromenc, false);
-        $blah->invisible = utfconvert($blah->invisible, $fromenc, false);
-
-        $blockinstance->configdata = base64_encode(serialize($blah));
-
-        migrate2utf8_update_record('block_instance',$blockinstance);
-
-        return $blah;
-
-    }
-}
-?>
diff --git a/blocks/db/migrate2utf8.xml b/blocks/db/migrate2utf8.xml
deleted file mode 100755 (executable)
index c6cbd2f..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-<DBMIGRATION type="blocks" VERSION="2005120100">
-  <TABLES>
-    <TABLE name="block">
-      <FIELDS>
-        <FIELD name="name" method="NO_CONV" type="varchar" length="40" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="block_instance">
-      <FIELDS>
-        <FIELD name="pagetype" method="NO_CONV" type="varchar" length="20" dropindex="pagetype" addindex="pagetype (pagetype(20))"/>
-        <FIELD name="position" method="NO_CONV" type="varchar" length="10" />
-        <FIELD name="configdata" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_block_instance_configdata(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="block_pinned">
-      <FIELDS>
-        <FIELD name="pagetype" method="NO_CONV" type="varchar" length="20" dropindex="pagetype" addindex="pagetype (pagetype(20))"/>
-        <FIELD name="position" method="NO_CONV" type="varchar" length="10" />
-        <FIELD name="configdata" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_block_pinned_configdata(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-  </TABLES>
-</DBMIGRATION>
index c0d10062f1a875e9877682cc33000e9627a470ee..b7c2a2627f6a24cd7f5b6c5b064507b548dbf234 100644 (file)
@@ -50,8 +50,8 @@ class block_online_users extends block_base {
 
         //Add this to the SQL to show only group users
         if ($currentgroup !== NULL) {
-            $groupmembers = ", {$CFG->prefix}groups_members gm ";
-            $groupselect .= " AND u.id = gm.userid AND gm.groupid = '$currentgroup'";
+            $groupmembers = ', '.groups_members_from_sql(); //TODO: ", {$CFG->prefix}groups_members gm ";
+            $groupselect .= groups_members_where_sql($currentgroup, 'u.id'); //" AND u.id = gm.userid AND gm.groupid = '$currentgroup'";
         }
 
         if ($COURSE->id == SITEID) {  // Site-level
diff --git a/blocks/pagedemo.php b/blocks/pagedemo.php
deleted file mode 100644 (file)
index c6de2ab..0000000
+++ /dev/null
@@ -1,204 +0,0 @@
-<?php  // $Id$
-
-    die; //must be fixed before enabling again, see SC#971
-
-    // All of this is standard Moodle fixtures
-
-    require_once('../config.php');
-    require_once($CFG->dirroot .'/course/lib.php');
-    require_once($CFG->dirroot .'/lib/blocklib.php');
-    require_once($CFG->dirroot .'/mod/resource/lib.php');
-    require_once($CFG->dirroot .'/mod/forum/lib.php');
-
-    optional_param('blockaction');
-    optional_param('instanceid', 0, PARAM_INT);
-    optional_param('blockid',    0, PARAM_INT);
-
-    require_login();
-
-    // Begin snippet -----------------------------------------------------------------
-    // This snippet should normally be defined in another file, but I 've put it all
-    // in here to keep it simple.
-
-    // First of all define the string identifier for this "type" of page.
-    define('MOODLE_PAGE_TEST', 'testpage');
-
-    // Also, define identifiers for any non-standard block positions we want to support.
-    define('BLOCK_POS_CENTERUP', 'cu');
-    define('BLOCK_POS_CENTERDOWN', 'cd');
-
-    // The actual Page derived class
-    class page_test extends page_base {
-
-        // Mandatory; should return our identifier.
-        function get_type() {
-            return MOODLE_PAGE_TEST;
-        }
-
-        // For this test page, only admins are going to be allowed editing (for simplicity).
-        function user_allowed_editing() {
-            return isadmin();
-        }
-
-        // Also, admins are considered to have "always on" editing (I wanted to avoid duplicating
-        // the code that turns editing on/off here; you can roll your own or copy course/view.php).
-        function user_is_editing() {
-            return isadmin();
-        }
-
-        // Simple method that accepts one parameter and prints the header. Here we just ignore
-        // the parameter entirely.
-        function print_header($title) {
-            print_header("Page testing page", 'SAMPLE CUSTOM PAGE', 'home');
-        }
-        
-        // This should point to the script that displays us; it's straightforward in this case.
-        function url_get_path() {
-            global $CFG;
-            return $CFG->wwwroot .'/blocks/pagedemo.php';
-        }
-
-        // We do not need any special request variables such as ID in this case, so we 're not
-        // going to have to override url_get_parameters() here; the default suits us nicely.
-
-        // Having defined all identifiers we need, here we declare which block positions we are
-        // going to support.
-        function blocks_get_positions() {
-           return array(BLOCK_POS_LEFT, BLOCK_POS_RIGHT, BLOCK_POS_CENTERUP, BLOCK_POS_CENTERDOWN);
-        }
-
-        // And here we declare where new blocks will appear (arbitrary choice).
-        function blocks_default_position() {
-            return BLOCK_POS_CENTERUP;
-        }
-
-        // Since we 're not going to be creating multiple instances of this "page" (as we do with
-        // courses), we don't need  to provide default blocks. Otherwise we 'd need to override
-        // the blocks_get_default() method.
-
-        // And finally, a little block move logic. Given a block's previous position and where
-        // we want to move it to, return its new position. Pretty self-documenting.
-        function blocks_move_position(&$instance, $move) {
-            if($instance->position == BLOCK_POS_LEFT && $move == BLOCK_MOVE_RIGHT) {
-                return BLOCK_POS_CENTERUP;
-            } else if ($instance->position == BLOCK_POS_RIGHT && $move == BLOCK_MOVE_LEFT) {
-                return BLOCK_POS_CENTERUP;
-            } else if (($instance->position == BLOCK_POS_CENTERUP || $instance->position == BLOCK_POS_CENTERDOWN) && $move == BLOCK_MOVE_LEFT) {
-                return BLOCK_POS_LEFT;
-            } else if (($instance->position == BLOCK_POS_CENTERUP || $instance->position == BLOCK_POS_CENTERDOWN) && $move == BLOCK_MOVE_RIGHT) {
-                return BLOCK_POS_RIGHT;
-            } else if ($instance->position == BLOCK_POS_CENTERUP && $move == BLOCK_MOVE_DOWN) {
-                return BLOCK_POS_CENTERDOWN;
-            } else if ($instance->position == BLOCK_POS_CENTERDOWN && $move == BLOCK_MOVE_UP) {
-                return BLOCK_POS_CENTERUP;
-            }
-            return $instance->position;
-        }
-    }
-    // End snippet -------------------------------------------------------------------
-
-    /// Bounds for block widths on this page
-    define('BLOCK_L_MIN_WIDTH', 160);
-    define('BLOCK_L_MAX_WIDTH', 210);
-    define('BLOCK_R_MIN_WIDTH', 160);
-    define('BLOCK_R_MAX_WIDTH', 210);
-    define('BLOCK_C_MIN_WIDTH', 250);
-    define('BLOCK_C_MAX_WIDTH', 350);
-
-
-    // Before creating our page object, we need to map our page identifier to the actual name
-    // of the class which will be handling its operations. Pretty simple, but essential.
-    page_map_class(MOODLE_PAGE_TEST, 'page_test');
-
-    // Now, create our page object. The identifier "1" is passed arbitrarily because we don't
-    // have multiple "testpages"; if we did, that would be the "testpageid" from the database.
-    $PAGE = page_create_object(MOODLE_PAGE_TEST, 1);
-
-    $PAGE->print_header(NULL);
-    $editing = $PAGE->user_is_editing();
-
-    // That's it! From now on, everything is simply copy-pasted from course/view.php with a few
-    // minor tweaks to display the page layout!
-
-    // Calculate the preferred width for left, right and center (both center positions will use the same)
-    if (empty($preferred_width_left)) {
-        $preferred_width_left =  blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]);
-    }
-    if (empty($preferred_width_right)) {
-        $preferred_width_right = blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]);
-    }
-    if (empty($preferred_width_centerup)) {
-        $preferred_width_centerup = blocks_preferred_width($pageblocks[BLOCK_POS_CENTERUP]);
-    }
-    if (empty($preferred_width_centerdown)) {
-        $preferred_width_centerdown =  blocks_preferred_width($pageblocks[BLOCK_POS_CENTERDOWN]);
-    }
-    $preferred_width_left = min($preferred_width_left, BLOCK_L_MAX_WIDTH);
-    $preferred_width_left = max($preferred_width_left, BLOCK_L_MIN_WIDTH);
-    $preferred_width_right = min($preferred_width_right, BLOCK_R_MAX_WIDTH);
-    $preferred_width_right = max($preferred_width_right, BLOCK_R_MIN_WIDTH);
-    $preferred_width_center = max($preferred_width_centerup, $preferred_width_centerdown);
-    $preferred_width_center = min($preferred_width_center, BLOCK_C_MAX_WIDTH);
-    $preferred_width_center = max($preferred_width_center, BLOCK_C_MIN_WIDTH);
-
-    // Display the blocks and allow blocklib to handle any block action requested
-    $pageblocks = blocks_get_by_page($PAGE);
-
-    if($editing) {
-        if (!empty($blockaction) && confirm_sesskey()) {
-            if (!empty($blockid)) {
-                blocks_execute_action($PAGE, $pageblocks, strtolower($blockaction), intval($blockid));
-                
-            }
-            else if (!empty($instanceid)) {
-                $instance = blocks_find_instance($instanceid, $pageblocks);
-                blocks_execute_action($PAGE, $pageblocks, strtolower($blockaction), $instance);
-            }
-            // This re-query could be eliminated by judicious programming in blocks_execute_action(),
-            // but I'm not sure if it's worth the complexity increase...
-            $pageblocks = blocks_get_by_page($PAGE);
-        }
-    }
-    
-    // The actual display logic is here
-    echo '<table style="width: 100%;"><tr>';
-
-    if(blocks_have_content($pageblocks,BLOCK_POS_LEFT) || $editing) {
-        echo '<td style="vertical-align: top; width: '.$preferred_width_left.'px;">';
-        blocks_print_group($PAGE, $pageblocks,BLOCK_POS_LEFT);
-        echo '</td>';
-    }
-
-    echo '<td style="border: 1px black solid; width: '.$preferred_width_center.'px;"><p style="text-align: center; padding: 10px; background: black; color: white;">Center-up position:</p>';
-    if(blocks_have_content($pageblocks,BLOCK_POS_CENTERUP) || $editing) {
-        blocks_print_group($PAGE, $pageblocks,BLOCK_POS_CENTERUP);
-    }
-
-    echo '<div style="padding: 10px; background: gold; text-align: center;">Content Here';
-    
-    print_object(make_timestamp(2005, 6, 1, 0, 0, 0));
-
-    echo '</div>';
-
-    echo '<p style="text-align: center; padding: 10px; background: black; color: white;">Center-down position:</p>';
-    if(blocks_have_content($pageblocks,BLOCK_POS_CENTERDOWN) || $editing) {
-        blocks_print_group($PAGE, $pageblocks,BLOCK_POS_CENTERDOWN);
-    }
-    echo '</td>';
-
-    if(blocks_have_content($pageblocks,BLOCK_POS_RIGHT) || $editing) {
-        echo '<td style="vertical-align: top; width: '.$preferred_width_right.'px;">';
-        blocks_print_group($PAGE, $pageblocks,BLOCK_POS_RIGHT);
-        if ($editing) {
-            blocks_print_adminblock($PAGE, $pageblocks);
-        }
-        echo '</td>';
-    }
-
-    // Finished! :-)
-
-    echo '</tr></table>';
-    print_footer();
-
-
-?>
index c6e54093e7a90d5661f6862d8e09ce8bcf4b1b45..f0e8aaff75fb804d91acee11a228032e67a28fff 100644 (file)
@@ -127,10 +127,10 @@ class block_quiz_results extends block_base {
             }
 
             // Now find which groups these users belong in
-            $groupofuser = get_records_sql(
+            $groupofuser = groups_get_groups_users($userids, $courseid); /*TODO: get_records_sql(
             'SELECT m.userid, m.groupid, g.name FROM '.$CFG->prefix.'groups g LEFT JOIN '.$CFG->prefix.'groups_members m ON g.id = m.groupid '.
             'WHERE g.courseid = '.$courseid.' AND m.userid IN ('.implode(',', $userids).')'
-            );
+            );*/
 
             $groupgrades = array();
 
diff --git a/blocks/rss_client/db/migrate2utf8.php b/blocks/rss_client/db/migrate2utf8.php
deleted file mode 100755 (executable)
index 7149f45..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-<?php // $Id$
-function migrate2utf8_block_rss_client_title($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$rssclient = get_record('block_rss_client','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $user = get_record('user','id',$rssclient->userid);
-
-        $sitelang   = $CFG->lang;
-        $courselang = NULL;  //Non existing!
-        $userlang   = $user->lang; //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($rssclient->title, $fromenc);
-
-        $newrssclient = new object;
-        $newrssclient->id = $recordid;
-        $newrssclient->title = $result;
-        migrate2utf8_update_record('block_rss_client',$newrssclient);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_block_rss_client_preferredtitle($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT brc.userid
-           FROM {$CFG->prefix}block_rss_client brc
-           WHERE brc.id = $recordid";
-
-    if (!$rssuserid = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$rssclient = get_record('block_rss_client','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $user = get_record('user','id',$rssuserid->userid);
-        $sitelang   = $CFG->lang;
-        $courselang = NULL;  //Non existing!
-        $userlang   = $user->lang; //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($rssclient->preferredtitle, $fromenc);
-
-        $newrssclient = new object;
-        $newrssclient->id = $recordid;
-        $newrssclient->preferredtitle = $result;
-        migrate2utf8_update_record('block_rss_client',$newrssclient);
-/// And finally, just return the converted field
-    }
-    return $result;
-}
-
-function migrate2utf8_block_rss_client_description($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT brc.userid
-           FROM {$CFG->prefix}block_rss_client brc
-           WHERE brc.id = $recordid";
-
-    if (!$rssuserid = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$rssclient = get_record('block_rss_client','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $user = get_record('user','id',$rssuserid->userid);
-        $sitelang   = $CFG->lang;
-        $courselang = NULL;  //Non existing!
-        $userlang   = $user->lang; //N.E.!!
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($rssclient->description, $fromenc);
-
-        $newrssclient = new object;
-        $newrssclient->id = $recordid;
-        $newrssclient->description = $result;
-        migrate2utf8_update_record('block_rss_client',$newrssclient);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-?>
diff --git a/blocks/rss_client/db/migrate2utf8.xml b/blocks/rss_client/db/migrate2utf8.xml
deleted file mode 100755 (executable)
index 86188be..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<DBMIGRATION type="blocks/rss_client" VERSION="2005120100">
-  <TABLES>
-    <TABLE name="block_rss_client">
-      <FIELDS>
-        <FIELD name="title" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_block_rss_client_title(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="preferredtitle" method="PHP_FUNCTION" type="varchar" length="64">
-          <PHP_FUNCTION>
-            migrate2utf8_block_rss_client_preferredtitle(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="description" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_block_rss_client_description(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="url" method="NO_CONV" type="varchar" length="255" />
-      </FIELDS>
-    </TABLE>
-  </TABLES>
-</DBMIGRATION>
index b127250957fc3cd011aac2f09852fc686aad56e5..a5c1002bdf39c9ab21eeb90ed7a7ab0eae4afe88 100755 (executable)
@@ -127,17 +127,18 @@ if (!$course = get_record('course', 'id', $courseid)) {
 
         case 'group':
 
-            $thisgroup = get_record('groups', 'id', $filterselect);
-
-            if ($tagid || !empty($tag)) {
-                print_header("$course->shortname: $blogstring", $course->fullname,
+            if ($thisgroup = groups_get_group($filterselect, false)) { //TODO:
+               if ($tagid || !empty($tag)) {
+                       print_header("$course->shortname: $blogstring", $course->fullname,
                             '<a href="'.$CFG->wwwroot.'/user/index.php?id='.$course->id.'&amp;group='.$filterselect.'">'.$thisgroup->name.'</a> ->
                             <a href="index.php?filtertype=group&amp;filterselect='.$filterselect.'">'. "$blogstring</a> -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string());
-            } else {
-                print_header("$course->shortname: $blogstring", $course->fullname,
+               } else {
+                       print_header("$course->shortname: $blogstring", $course->fullname,
                             '<a href="'.$CFG->wwwroot.'/user/index.php?id='.$course->id.'&amp;group='.$filterselect.'">'.$thisgroup->name."</a> ->
                             $blogstring",'','',true,$PAGE->get_extra_header_string());
-
+                }
+            } else {
+                print_error('Unable to find group');
             }
 
         break;
index c1465945f3b3e9a0f0120374a13e80c0f4d7af72..4ea6ceccb5b8d17b3549b71d00f2ea79442404fe 100755 (executable)
@@ -84,7 +84,7 @@ switch ($filtertype) {
         if ($CFG->bloglevel < BLOG_GROUP_LEVEL) {
             error('Group blogs is not enabled');
         }
-        if (!$group = get_record('groups','id',$groupid)) {
+        if (! $group = groups_get_group($groupid)) { //TODO:check.
             error('Incorrect group id specified');
         }
         if (!$course = get_record('course', 'id', $group->courseid)) {
index 655e14bbb24562992511a0eb9d98cc4a39634d91..f2c89f13786444f2d804cc4a24459ffbe4cabff9 100755 (executable)
             case 'group':
 
                 $SQL = 'SELECT '.$requiredfields.' FROM '.$CFG->prefix.'post p, '.$tagtablesql
+                        .groups_members_from_sql().', '.$CFG->prefix.'user u
+                        WHERE '.groups_members_where_sql($filterselect, 'p.userid').'
+                        AND u.id = p.userid
+                        AND u.deleted = 0
+                        AND '.$permissionsql;
+
+                        /*'SELECT '.$requiredfields.' FROM '.$CFG->prefix.'post p, '.$tagtablesql
                         .$CFG->prefix.'groups_members m, '.$CFG->prefix.'user u
                         WHERE p.userid = m.userid '.$tagquerysql.'
                         AND u.id = p.userid
                         AND m.groupid = '.$filterselect.'
                         AND u.deleted = 0
                         AND '.$permissionsql;
-
+                        */
             break;
 
             case 'user':
index f8e7ec20fc86eb7c6d8581cdb66922070122959c..722b79a08c2daec3a922593955a39fc0c5135924 100755 (executable)
@@ -99,7 +99,8 @@
                 $info = $SITE->fullname;
                 break;
             case 'group':
-                $info = get_field('groups', 'name', 'id', $id);
+                $group = groups_get_group($id, false);
+                $info = $group->name; //TODO: get_field('groups', 'name', 'id', $id)
                 break;
             default:
                 $info = '';
index d5491c24580ce3051384e5140c2bb11121916749..bc6e76a579c14353ce4cd70ee9d66977b6c01b03 100644 (file)
                 break;
                 case 'group':
                     $groupid = optional_param('groupid', 0, PARAM_INT);
-                    if(!($group = get_record('groups', 'id', $groupid) )) {
+                    if (! ($group = groups_get_group($groupid))) { //TODO:check.
                         calendar_get_allowed_types($allowed);
                         $eventtype = 'select';
                     }
@@ -604,14 +604,14 @@ function calendar_add_event_allowed($event) {
             return has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_COURSE, $event->courseid));
 
         case 'group':
-            if (!$group = get_record('groups', 'id', $event->groupid)) {
+            if (! groups_group_exists($event->groupid)) { //TODO:check.
                 return false;
             } 
             // this is ok because if you have this capability at course level, you should be able 
             // to edit group calendar too
             // there is no need to check membership, because if you have this capability
             // you will have a role in this group context
-            return has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_GROUP, $group->id));
+            return has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_GROUP, $event->groupid));
 
         case 'user':
             if ($event->userid == $USER->id) {
index 00d2b690e85d6e2d4b78416fa0abce42adeb6e00..5419d1d6eb465ef09f589f4aab9a7437033c066f 100644 (file)
 
     $sesskey = !empty($USER->id) ? $USER->sesskey : '';
 
+//DONOTCOMMIT: TODO:
+if (debugging()) {
+    echo '<p>[ <a href="../group/groupui/?id='. $courseid .'">AJAX groups</a>
+         | <a href="../group/index.php?id='. $courseid .'">New groups</a> - debugging.]</p>';
+}
+
 /// Print out the complete form
 
     print_heading(get_string('groups'));
 
     print_footer($course);
 
-?>
+?>
\ No newline at end of file
index 373a956b9094ff2e2effd4c3abf4ee69a2a78a4c..eb3b708afc856ca7e5fc35f945378dab91ea4f22 100644 (file)
@@ -177,7 +177,7 @@ function print_recent_selector_form($course, $advancedfilter=0, $selecteduser=0,
         $groupmode =  groupmode($course);
 
         if ($groupmode == VISIBLEGROUPS or ($groupmode and has_capability('moodle/course:managegroups', get_context_instance(CONTEXT_COURSE, $course->id)))) {
-            if ($groups = get_records_menu("groups", "courseid", $course->id, "name ASC", "id,name")) {
+            if ($groups_names = groups_get_groups_names($course->id)) { //TODO:check.
             echo '<td><b>';
                 if ($groupmode == VISIBLEGROUPS) {
                     print_string('groupsvisible');
@@ -185,7 +185,7 @@ function print_recent_selector_form($course, $advancedfilter=0, $selecteduser=0,
                     print_string('groupsseparate');
                 }
                 echo ':</b></td><td>';
-                choose_from_menu($groups, "selectedgroup", $selectedgroup, get_string("allgroups"), "", "");
+                choose_from_menu($groups_names, "selectedgroup", $selectedgroup, get_string("allgroups"), "", "");
                 echo '</td>';
             }
         }
@@ -305,7 +305,7 @@ function build_logs_array($course, $user=0, $date=0, $order="l.time ASC", $limit
 
     /// Getting all members of a group.
     if ($groupid and !$user) {
-        if ($gusers = get_records('groups_members', 'groupid', $groupid)) {
+        if ($gusers = groups_get_members($groupid)) { //TODO:check.
             $first = true;
             foreach($gusers as $guser) {
                 if ($first) {
diff --git a/doc/COPYRIGHT.txt b/doc/COPYRIGHT.txt
deleted file mode 100644 (file)
index 0e3c1dd..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-Moodle - Modular Object-Oriented Dynamic Learning Environment
-http://moodle.org
-
-Copyright (C) 1999-2004  Martin Dougiamas  martin@dougiamas.com
-http://dougiamas.com
-
-This program 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 2 of the License, or
-(at your option) any later version.
-
-This program 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 this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
diff --git a/doc/contents.php b/doc/contents.php
deleted file mode 100755 (executable)
index 243b520..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<?PHP  // $Id$\r
-\r
-    require("../config.php");\r
-\r
-    if (! $info = document_file("files.php", false)) {\r
-        error("404 - File Not Found");\r
-    }\r
-
-    $string = array();
-    if ($CFG->forcelogin) {\r
-        require_login();\r
-    }\r
-\r
-    include($info->filepath);\r
-\r
-    print_header();\r
-
-    $ulopen = false;
-
-    foreach ($string as $file => $filename) {\r
-        if (substr($file,0,1) == "-") {
-            if($ulopen) {
-                echo '</ul>';
-            }
-            echo '<h1>'.$filename.'</h1><ul>';
-            $ulopen = true;
-        } else {\r
-            echo '<li><a target="main" href="'.$CFG->wwwroot.'/doc/?file='.$file.'">'.$filename.'</a></li>';\r
-        }\r
-    }\r
-    if($ulopen) {
-        echo '</ul>';
-    }
-
-    // Sloppy way to produce valid markup... there should be a print_footer_minimal().
-    echo '</div></div></body></html>';
-    \r
-?>\r
diff --git a/doc/docstyles.css b/doc/docstyles.css
deleted file mode 100755 (executable)
index 5e388c8..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-body, td, th, li {
-    font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
-}
-
-th {
-    font-weight: bold; 
-}
-
-a:link {
-    text-decoration: none; 
-    color: blue;
-}
-
-a:visited {
-    text-decoration: none; 
-    color: blue;
-}
-
-a:hover {
-    text-decoration: underline; 
-    color: red;
-}
-
-form { 
-    margin-bottom: 0;
-}
-
-
-li {
-    margin-bottom: 10px;
-
-}
-
-.question {
-    font-size: medium;
-    font-weight: bold;
-    font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
-    border: 1px dotted;
-    padding: 10px;
-    background-color: #EEEEEE;
-}
-
-.answer {
-    font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
-    font-size: medium;
-    border: none;
-    padding-left: 40px;
-}
-
-.normaltext {
-    font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
-    font-size: medium;
-    border: none;
-    margin-left: 30px;
-
-}
-
-.answercode {
-    font-family: "Courier New", Courier, mono;
-    font-size: small;
-    border: none;
-    padding-left: 60px;
-}
-
-.questionlink {
-    font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
-    font-size: medium;
-    border: none;
-    padding-left: 40px;
-}
-
-.examplecode {
-    font-family: "Courier New", Courier, mono;
-    font-size: small;
-    border: thin dashed #999999;
-    background-color: #FBFBFB;
-    margin: auto;
-    padding: 30px;
-    height: auto;
-    width: auto;
-}
-h1 {
-    font-weight: bold;
-    color: #000000;
-    background-color: #CCCCCC;
-    padding: 5px;
-    font-size: large;
-    border-width: 1px;
-    border-color: #CCCCCC;
-    -moz-border-radius: 10px;
-}
-h2 {
-    font-weight: bold;
-    color: #FFFFFF;
-    background-color: #666666;
-    padding: 5px;
-    font-size: medium;
-    border-width: 1px;
-    border-color: #666666;
-    -moz-border-radius: 10px;
-}
-h3 {
-    font-weight: normal;
-    color: #FFFFFF;
-    background-color: #666666;
-    padding: 5px;
-    font-size: medium;
-    -moz-border-radius: 10px;
-}
-.spaced {
-
-    margin-bottom: 30px;
-}
-
-ul {
-    margin-top: 10px;
-
-}
-.commandline {
-    font-family: "Courier New", Courier, mono;
-    font-size: x-small;
-    background-color: #FBFBFB;
-    margin: auto auto 20px 30px;
-    padding: 5px;
-    width: compact;
-    font-weight: bold;
-    border: 1px solid #999999;
-    white-space: nowrap;
-    clear: both;
-    float: none;
-}
diff --git a/doc/index.php b/doc/index.php
deleted file mode 100644 (file)
index b4cb0f0..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-<?PHP  // $Id$
-
-    require("../config.php");
-
-    $file  = optional_param('file', "", PARAM_FILE);  // docs file to view straight
-    $frame = optional_param('frame', "", PARAM_FILE); // docs file to view in frame
-    $sub   = optional_param('sub', "", PARAM_CLEAN);  // sub-section (named anchor)
-
-    if ($CFG->forcelogin) {
-        require_login();
-    }
-
-    if (!empty($sub)) {
-        $sub = '#'.s($sub);
-    } else {
-        $sub = "";
-    }
-
-    if (empty($file)) {
-        $include = false;
-        if (empty($frame)) {
-            $file = "intro.html";
-        } else {
-            $file = $frame;
-        }
-    } else {
-        $include = true;
-    }
-
-    if (! document_file($file, $include)) {
-        error("Error 404 - File Not Found");
-    }
-
-    if ($include) {
-        exit;
-    }
-
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" 
-    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-    <title><?php print_string("documentation")?></title>
-    <meta http-equiv="Content-Type" content="text/html; charset=<?php echo current_charset(); ?>" />
-</head>
-
-<frameset rows="70,*">
-    <frame name="top" src="top.php" />
-    <frameset cols="200,*">
-        <frame name="contents" src="contents.php" />
-        <frame name="main" src="index.php?file=<?php echo "$file$sub"; ?>" />
-    </frameset>
-</frameset>
-</html>
diff --git a/doc/install.html b/doc/install.html
deleted file mode 100755 (executable)
index 3df339d..0000000
+++ /dev/null
@@ -1,421 +0,0 @@
-<head>
-    
-<title>Moodle Docs: Installation</title>
-  
-<link rel="stylesheet" href="docstyles.css" type="TEXT/CSS">
-    
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-</head>
-
-<body bgcolor="#FFFFFF">
-<h1>Installing Moodle</h1>
-<blockquote>
-  <p>This guide explains how to install Moodle for the first time.  It goes into some detail
-   about some of the steps, in order to cover the wide variety of small differences between
-   web server setups, so this document may look long and complicated.  Don't be put off by this 
-   - I usually set Moodle up in a few minutes!</p>
-  <p>Take your time and work through this document carefully - it will save you time later on.</p>
-  <p>Sections in this document:</p>
-  <ol>
-    <li><a href="#requirements">Requirements</a></li>
-    <li><a href="#downloading">Download</a></li>
-    <li><a href="#site">Site structure</a></li>
-    <li><a href="#data">Create a data directory</a></li>
-    <li><a href="#database">Create a database</a></li>
-    <li><a href="#webserver">Check web server settings</a></li>
-    <li><a href="#config">Edit config.php</a></li>
-    <li><a href="#admin">Go to the admin page</a></li>
-    <li><a href="#cron">Set up cron</a></li>
-    <li><a href="#course">Create a new course</a></li>
-  </ol>
-  <p>&nbsp;</p>
-</blockquote>
-<h3 class="sectionheading"><a name="requirements"></a>1. Requirements</h3>
-<blockquote> 
-  <p>Moodle is primarily developed in Linux using Apache, MySQL and PHP (also 
-    sometimes known as the LAMP platform), but is also regularly tested with PostgreSQL 
-    and on Windows XP, Mac OS X and Netware 6 operating systems</p>
-  <p>The requirements for Moodle are as follows:</p>
-  <ol>
-    <li>Web server software. Most people use <a href="http://www.apache.org/" target="_blank">Apache</a>, 
-      but Moodle should work fine under any web server that supports PHP, such 
-      as IIS on Windows platforms.</li>
-    <li><a href="http://www.php.net/" target="_blank">PHP</a> scripting language (version 4.1.0 
-      or later), with the following settings: 
-      <ul>
-        <li><a href="http://www.boutell.com/gd/" target="_blank">GD library</a> 
-          turned ON, with support for JPG and PNG formats</li>
-        <li>zlib library turned ON (if you want to use backup/restore on Windows)</li>
-        <li>Sessions support turned ON</li>
-        <li>File uploading turned ON</li>
-        <li>Safe Mode must be turned OFF (see the forums on moodle.org for problems 
-          caused by Safe Mode)</li>
-      </ul>
-    </li>
-    <li>a working database server: <a href="http://www.mysql.com/" target="_blank">MySQL</a> 
-      or <a href="http://www.postgresql.org/" target="_blank">PostgreSQL</a> are 
-      completely supported and recommended for use with Moodle 1.1. All other 
-      databases will be supported fully in the next release.</li>
-  </ol>
-  <p>Most web hosts support all of this by default. If you are signed up with 
-    one of the few webhosts that does not support these features ask them why, 
-    and consider taking your business elsewhere.</p>
-  <p>If you want to run Moodle on your own computer and all this looks a bit daunting, 
-    then please see our guide: <a href="http://moodle.org/doc/?file=installamp.html">Installing 
-    Apache, MySQL and PHP</a>. It provides some step-by-step instructions to install 
-    all this on most popular platforms.</p>
-  <p>&nbsp;</p>
-</blockquote>
-<h3 class="sectionheading"><a name="downloading"></a>2. Download</h3>
-<blockquote>
-  <p>There are two ways to get Moodle, as a compressed package and via CVS. These 
-    are explained in detail on the download page: <a href="http://moodle.org/download/" target="_blank">http://moodle.org/download/</a></p>
-  <p>After downloading and unpacking the archive, or checking out the files via 
-    CVS, you will be left with a directory called &quot;moodle&quot;, containing 
-    a number of files and folders. </p>
-  <p>You can either place the whole folder in your web server documents directory, 
-    in which case the site will be located at <b>http://yourwebserver.com/moodle</b>, 
-    or you can copy all the contents straight into the main web server documents 
-    directory, in which case the site will be simply <b>http://yourwebserver.com</b>.</p>
-</blockquote>
-<p>&nbsp;</p>
-<h3 class="sectionheading"><a name="site"></a>3. Site structure</h3>
-<blockquote>
-  <p>Here is a quick summary of the contents of the Moodle folder, to help get 
-    you oriented:</p>
-  <blockquote>
-    <p>config.php - the ONLY file you need to edit to get started<br />
-      version.php - defines the current version of Moodle code<br />
-      index.php - the front page of the site</p>
-    <ul>
-      <li>admin/ - code to administrate the whole server </li>
-      <li>auth/ - plugin modules to authenticate users  </li>
-      <li>course/ - code to display and manage courses </li>
-      <li>doc/ - help documentation for Moodle (eg this page)</li>
-      <li>files/ - code to display and manage uploaded files</li>
-      <li>lang/ - texts in different languages, one directory per language </li>
-      <li>lib/ - libraries of core Moodle code </li>
-      <li>login/ - code to handle login and account creation </li>
-      <li>mod/ - all Moodle course modules</li>
-      <li>pix/ - generic site graphics</li>
-      <li>theme/ - theme packs/skins to change the look of the site.</li>
-      <li>user/ - code to display and manage users</li>
-    </ul>
-    <p>&nbsp;</p>
-  </blockquote>
-</blockquote>
-<h3 class="sectionheading"><a name="data"></a>4. Create a data directory</h3>
-<blockquote>
-  <p>Moodle will also need some space on your hard disk to store uploaded files, 
-    such as course documents and user pictures.</p>
-  <p>Create a directory for this purpose somewhere.  For security, it's best that 
-     this directory is NOT accessible directly via the web.  The easiest way to do this
-     is to simply locate it OUTSIDE the web directory, otherwise protect it 
-     by creating a file in the data directory called .htaccess, containing this line:
-  <blockquote>
-     
-    <pre>deny from all<br />AllowOverride None</pre>
-  </blockquote>
-  <p>To make sure that Moodle can save uploaded files in this directory, check that 
-     the web server software (eg Apache) has permission to write 
-    to this directory. On Unix machines, this means setting the owner of the directory 
-    to be something like &quot;nobody&quot; or &quot;apache&quot;.</p>
-  <p>On many shared hosting servers, you will probably need to restrict all file access 
-     to your "group" (to prevent other webhost customers from looking at or changing your files), 
-     but provide full read/write access to everyone else (which will allow the web server
-     to access your files).  Speak to your server administrator if you are having 
-     trouble setting this up securely.</p>
-</blockquote>
-<p>&nbsp;</p>
-<h3 class="sectionheading"><a name="database"></a>5. Create a database</h3>
-<blockquote>
-  <p>You need to create an empty database (eg "moodle") in your database system 
-    along with a special user (eg "moodleuser") that has access to that database 
-    (and that database only). You could use the "root" user if you wanted to, but 
-    this is not recommended for a production system: if hackers manage to discover
-    the password then your whole database system would be at risk, rather than 
-    just one database.
-</p>
-  <p>Example command lines for MySQL: </p>
-  <pre>
-   # mysql -u root -p
-   > CREATE DATABASE moodle; 
-   > GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,ALTER ON moodle.* 
-           TO moodleuser@localhost IDENTIFIED BY 'yourpassword'; 
-   > quit 
-   # mysqladmin -p reload
-</pre>
-  <p>Example command lines for PostgreSQL: </p>
-  <pre>
-   # su - postgres
-   > psql -c "create user moodleuser createdb;" template1
-   > psql -c "create database moodle;" -U moodleuser template1
-   > psql -c "alter user moodleuser nocreatedb;" template1
-</pre>
-  <p>(For MySQL I highly recommend the use of <a href="http://phpmyadmin.sourceforge.net/">phpMyAdmin</a> 
-    to manage your databases - you can do all this via a web interface).</p>
-  <p>As of version 1.0.8, Moodle now supports table prefixes, and so can safely share 
-   a database with tables from other applications.</p>
-</blockquote>
-<p>&nbsp;</p>
-<h3 class="sectionheading"><a name="webserver" id="webserver"></a>6. Check your web server settings</h3>
-<blockquote>
-  <p>Firstly, make sure that your web server is set up to use index.php as a default 
-    page (perhaps in addition to index.html, default.htm and so on).</p>
-  <p>In Apache, this is done using a DirectoryIndex parameter in your httpd.conf 
-    file. Mine usually looks like this:</p>
-  <blockquote>
-    <pre><strong>DirectoryIndex</strong> index.php index.html index.htm </pre>
-  </blockquote>
-  <p>Just make sure index.php is in the list (and preferably towards the start 
-    of the list, for efficiency).</p>
-  <p>Secondly, <b>if you are using Apache 2</b>, then you should turn on the <i>AcceptPathInfo</i>
-     variable, which allows scripts to be passed arguments like http://server/file.php/arg1/arg2.
-     This is essential to allow relative links between your resources, and also 
-     provides a performance boost for people using your Moodle web site.  You can 
-     turn this on by adding these lines to your httpd.conf file.</p>
-  <blockquote>
-    <pre><strong>AcceptPathInfo</strong> on </pre>
-  </blockquote>
-  <p>Thirdly, Moodle requires a number of PHP settings to be active for it to 
-     work.  <b>On most servers these will already be the default settings.</b>
-     However, some PHP servers (and some of the more recent PHP versions) may 
-     have things set differently.  These are defined in PHP's configuration
-     file (usually called php.ini):</p>
-  <blockquote>
-
-    <pre>magic_quotes_gpc = 1    (preferred but not necessary)
-magic_quotes_runtime = 0    (necessary)
-file_uploads = 1
-session.auto_start = 0
-session.bug_compat_warn = 0
-</pre>
-  </blockquote>
-  <p>If you don't have access to httpd.conf or php.ini on your server, or you 
-    have Moodle on a server with other applications that require different settings, 
-    then don't worry, you can still OVERRIDE all of the default settings. 
-  <p>To do this, you need to create a file called <b>.htaccess</b> in Moodle's
-     main directory that contains definitions for these settings.
-     This only works on Apache servers and only when Overrides have been allowed.
-     
-  <blockquote>
-    <pre>
-DirectoryIndex index.php index.html index.htm
-
-&lt;IfDefine APACHE2>
-     <b>AcceptPathInfo</b> on
-&lt;/IfDefine>
-
-php_flag magic_quotes_gpc 1
-php_flag magic_quotes_runtime 0
-php_flag file_uploads 1
-php_flag session.auto_start 0
-php_flag session.bug_compat_warn 0</pre>
-  </blockquote>
-  <p>You can also do things like define the maximum size for uploaded files:
-     
-  <blockquote>
-    <pre>
-LimitRequestBody 0
-php_value upload_max_filesize 2M
-php_value post_max_size 2M
-     </pre>
-  </blockquote>
-  <p>The easiest thing to do is just copy the sample file from lib/htaccess 
-     and edit it to suit your needs.  It contains further instructions.  For 
-     example, in a Unix shell:
-  <blockquote>
-    <pre>cp lib/htaccess .htaccess</pre>
-  </blockquote>
-</blockquote>
-<p>&nbsp;</p>
-<h3 class="sectionheading"><a name="config"></a>7. Edit config.php</h3>
-<blockquote>
-  <p>Now you can edit the configuration file, <strong>config.php</strong>, using a 
-     text editor. This file is used by all other files in Moodle.</p>
-  <p>To start with, make a copy of <strong>config-dist.php</strong> and name it 
-    config.php. We do this so that your config.php won't be overwritten in case 
-    you upgrade Moodle later on. </p>
-  <p>Edit <strong>config.php</strong> to specify the database details that you 
-    just defined (including a table prefix - notice that this is REQUIRED for 
-    PostgreSQL), as well as the site address, file system directory and data directory. 
-    The config file itself has detailed directions and examples.</p>
-  <p>Once you have done this the rest of the installation is via a web interface. 
-    For the rest of this installation document we will assume your site is at: 
-    <u>http://example.com/moodle</u></p>
-</blockquote>
-<p>&nbsp;</p>
-<h3 class="sectionheading"><a name="admin"></a>8. Go to the admin page</h3>
-<blockquote> 
-  <p>The admin page should now be working at: <u>http://example.com/moodle/admin</u>. 
-    If you try and access the front page of your site you'll be taken there automatically 
-    anyway. The first time you access this admin page, you will be presented with 
-    a GPL &quot;shrinkwrap&quot; agreement with which you must agree before you 
-    can continue with the setup.</p>
-  <p>(Moodle will also try to set some cookies in your browser. If you have your 
-    browser set up to let you choose to accept cookies, then you <b>must</b> accept 
-    the Moodle cookies, or Moodle won't work properly.) 
-  <p>Now Moodle will start setting up your database and creating tables to store 
-    data. Firstly, the main database tables are created. You should see a number 
-    of SQL statements followed by status messages (in green or red) that look 
-    like this:</p>
-  <blockquote> 
-    <p>CREATE TABLE course ( id int(10) unsigned NOT NULL auto_increment, category 
-      int(10) unsigned NOT NULL default '0', password varchar(50) NOT NULL default 
-      '', fullname varchar(254) NOT NULL default '', shortname varchar(15) NOT 
-      NULL default '', summary text NOT NULL, format tinyint(4) NOT NULL default 
-      '1', teacher varchar(100) NOT NULL default 'Teacher', startdate int(10) 
-      unsigned NOT NULL default '0', enddate int(10) unsigned NOT NULL default 
-      '0', timemodified int(10) unsigned NOT NULL default '0', PRIMARY KEY (id)) 
-      TYPE=MyISAM</p>
-    <p><font color="#006600">SUCCESS</font></p>
-    <p>...and so on, followed by: <font color="#006600">Main databases set up 
-      successfully.</font> </p>
-  </blockquote>
-  <p>If you don't see these, then there must have been some problem with the database 
-    or the configuration settings you defined in config.php. Check that PHP isn't 
-    in a restricted "Safe Mode" (commercial web hosts sometimes have safe mode 
-    turned on). You can check PHP variables by creating a little file containing 
-    &lt? phpinfo() ?&gt and looking at it through a browser. Check all these and 
-    try this page again.</p>
-  <p>Scroll down the very bottom of the page and press the &quot;Continue&quot; 
-    link.</p>
-  <p>Next you will see a similar page that sets up all the tables required by 
-    each Moodle module. As before, they should all be <font color="#006600">green</font>.</p>
-  <p>Scroll down the very bottom of the page and press the &quot;Continue&quot; 
-    link.</p>
-  <p>You should now see a form where you can define more configuration variables 
-    for your installation, such as the default language, SMTP hosts and so on. 
-    Don't worry too much about getting everything right just now - you can always 
-    come back and edit these later on using the admin interface. Scroll down to 
-    the bottom and click &quot;Save changes&quot;.</p>
-  <p>If (and only if) you find yourself getting stuck on this page, unable to 
-    continue, then your server probably has what I call the "buggy referrer" problem. 
-    This is easy to fix: just turn off the &quot;secureforms&quot; setting, then 
-    try to continue again.</p>
-  <p>The next page is a form where you can define parameters for your Moodle site 
-    and the front page, such as the name, format, description and so on. Fill 
-    this out (you can always come back and change these later) and then press 
-    &quot;Save changes&quot;.</p>
-  <p>Finally, you will then be asked to create a top-level administration user 
-    for future access to the admin pages. Fill out the details with your own name, 
-    email etc and then click &quot;Save changes&quot;. Not all the fields are 
-    required, but if you miss any important fields you'll be re-prompted for them. 
-  </p>
-  <blockquote> 
-    <blockquote> 
-      <blockquote> 
-        <blockquote> 
-          <blockquote> 
-            <p><strong>Make sure you remember the username and password you chose 
-              for the administration user account, as they will be necessary to 
-              access the administration page in future.</strong></p>
-          </blockquote>
-        </blockquote>
-      </blockquote>
-    </blockquote>
-  </blockquote>
-  <p>(If for any reason your install is interrupted, or there is a system error 
-    of some kind that prevents you from logging in using the admin account, you 
-    can usually log in using the default username of &quot;<strong>admin</strong>&quot;, 
-    with password &quot;<strong>admin</strong>&quot;.)</p>
-  <p>Once successful, you will be returned to home page of your site. Note the 
-    administration links that appear down the left hand side of the page (these 
-    items also appear on a separate Admin page) - these items are only visible 
-    to you because you are logged in as the admin user. All your further administration 
-    of Moodle can now be done using this menu, such as:</p>
-  <ul>
-    <li>creating and deleting courses</li>
-    <li>creating and editing user accounts</li>
-    <li>administering teacher accounts</li>
-    <li>changing site-wide settings like themes etc</li>
-  </ul>
-</blockquote>
-<p>&nbsp;</p>
-<h3 class="sectionheading"><a name="cron"></a>9. Set up cron</h3>
-<blockquote> 
-  <p>Some of Moodle's modules require continual checks to perform tasks. For example, 
-    Moodle needs to check the discussion forums so it can mail out copies of posts 
-    to people who have subscribed.</p>
-  <p>The script that does all this is located in the admin directory, and is called 
-    cron.php. However, it can not run itself, so you need to set up a mechanism 
-    where this script is run regularly (eg every five or ten minutes). This provides 
-    a &quot;heartbeat&quot; so that the script can perform functions at periods 
-    defined by each module.</p>
-  <p>Note that the machine performing the cron <b>does not need to be the same 
-    machine that is running Moodle</b>. For example, if you have a limited web 
-    hosting service that does not have cron, then you can might choose to run 
-    cron on another server or on your home computer. All that matters is that 
-    the cron.php file is called regularly. </p>
-  <p>The load of this script is not very high, so 5 minutes is usually reasonable, 
-    but if you're worried about it you can reduce the time period to something 
-    like 15 minutes or even 30 minutes. It's best not to make the time period 
-    too long, as delaying mail-outs can slow down activity within the course.</p>
-  <p>First, test that the script works by running it directly from your browser:</p>
-  <blockquote> 
-    <pre>http://example.com/moodle/admin/cron.php</pre>
-  </blockquote>
-  <p>Now, you need to set up some of way of running the script automatically and 
-    regularly. </p>
-  <h4> Running the script from a command line</h4>
-  <p>You can call the page from the command line just as you did in the example 
-    above. For example, you can use a Unix utility like 'wget':</p>
-  <blockquote>
-    <pre>wget -q -O /dev/null http://example.com/moodle/admin/cron.php</pre>
-  </blockquote>
-  <p>Note in this example that the output is thrown away (to /dev/null).</p>
-  <p>The same thing using lynx:</p>
-  <blockquote>
-    <pre>lynx -dump http://example.com/moodle/admin/cron.php &gt; /dev/null</pre>
-  </blockquote>
-  <p>Alternatively you could use a standalone version of PHP, compiled to be run 
-    on the command line. The advantage with doing this is that your web server 
-    logs aren't filled with constant requests to cron.php. The disadvantage is 
-    that you need to have access to a command-line version of php.</p>
-  <blockquote>
-    <pre>/opt/bin/php /web/moodle/admin/cron.php
-
-
-(Windows) C:\apache\php\php.exe C:\apache\htdocs\moodle\admin\cron.php
-
-</pre>
-  </blockquote>
-  <h4>Automatically running the script every 5 minutes</h4>
-  <p><b>On Unix systems</b>: Use <b>cron</b>. Edit your cron settings from the commandline 
-    using &quot;crontab -e&quot; and add a line like:</p>
-  <blockquote>
-    <pre>*/5 * * * * wget -q -O /dev/null http://example.com/moodle/admin/cron.php</pre>
-  </blockquote>
-  <p>Usually, the "crontab" command will put you into the 'vi' editor. You enter 
-     "insert mode" by pressing "i", then type in the line as above, then exit insert mode by 
-     pressing ESC.  You save and exit by typing ":wq", or quit without saving using ":q!" (without the quotes).</p>
-  <p><b>On Windows systems</b>: The simplest way is to use this little package <a href="http://moodle.org/download/moodle-cron-for-windows.zip" title="Click to download this package (150k)" target="_blank">moodle-cron-for-windows.zip</a> 
-    which makes this whole thing very easy. You can also explore using the built-in 
-    Windows feature for "Scheduled Tasks".</p>
-  <p>On web hosts: Your web-based control panel may have a web page that allows 
-    you to set up this cron process. Ask your administrator for details on how 
-    it works.</p>
-  <p></p>
-</blockquote>
-<h3 class="sectionheading"><a name="course"></a>10. Create a new course</h3>
-<blockquote>
-  <p>Now that Moodle is running properly, you can create a course. </p>
-  <p>Select &quot;Create a new course&quot; from the Admin page (or the admin 
-    links on the home page).</p>
-  <p>Fill out the form, paying special attention to the course format. You don't 
-    have to worry about the details too much at this stage, as everything can 
-    be changed later by the teacher.</p>
-  <p>Press &quot;Save changes&quot;, and you will be taken to a new form where 
-    you can assign teachers to the course. You can only add existing user accounts 
-    from this form - if you want to create a new teacher account then either ask 
-    the teacher to create one for themselves (see the login page), or create one 
-    for them using the &quot;Add a new user&quot; on the Admin page.</p>
-  <p>Once done, the course is ready to customise, and is accessible via the &quot;Courses&quot; 
-    link on the home page.</p>
-  <p>See the &quot;<a href="./?file=teacher.html">Teacher Manual</a>&quot; for more details 
-    on course-building.</p>
-</blockquote>
-<p>&nbsp;</p>
-<p align="CENTER"><font size="1"><a href="." target="_top">Moodle Documentation</a></font></p>
-<p align="CENTER"><font size="1">Version: $Id$</font></p>
-</body>
diff --git a/doc/top.php b/doc/top.php
deleted file mode 100644 (file)
index bef501e..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<?PHP  // $Id$
-
-    require("../config.php");
-
-    if ($CFG->forcelogin) {
-        require_login();
-    }
-
-    if (empty($CFG->langmenu)) {
-        $langmenu = "";
-    } else {
-        $currlang = current_language();
-        $langs    = get_list_of_languages();
-        $langmenu = popup_form ("$CFG->wwwroot/doc/?lang=", $langs, "chooselang", $currlang, "", "", "", true, "parent");
-    }
-
-    if (! $site = get_site()) {
-        error("Site is misconfigured");
-    }
-    $strdocumentation = get_string("documentation");
-    print_header("$site->shortname: $strdocumentation", "$site->fullname", "$strdocumentation", "", "", true, $langmenu, navmenu($site, NULL, "parent"));
-    
-?>
-
diff --git a/doc/view.php b/doc/view.php
deleted file mode 100644 (file)
index 6e91b59..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-<?PHP  // $Id$
-
-    require("../config.php");
-
-    $id = optional_param('id',0,PARAM_INT); // course context
-    $file = required_param('file',PARAM_FILE);    // file in this directory to view
-
-    $file = clean_filename($file);
-
-    if ($CFG->forcelogin) {
-        require_login();
-    }
-
-    if ($id) {
-        if (! $course = get_record("course", "id", $id)) {
-            error("Course is misconfigured");
-        }
-        $strhelp = get_string("help");
-        print_header("$course->shortname: $strhelp", "$course->fullname", 
-                     "<a href=\"../course/view.php?id=$course->id\">$course->shortname</a> -> $strhelp");
-    } else {
-        if (! $site = get_site()) {
-            error("Site is misconfigured");
-        }
-        $strdocumentation = get_string("documentation");
-        print_header("$site->shortname: $strhelp", "$site->fullname", 
-                     "<a href=\"view.php?file=contents.html\">$strdocumentation</a>");
-        
-    }
-
-    echo "<blockquote>";
-
-    if (! document_file($file, true)) {
-        notify("404 - File Not Found");
-    }
-
-    echo "</blockquote>";
-
-?>
-
diff --git a/enrol/authorize/db/migrate2utf8.xml b/enrol/authorize/db/migrate2utf8.xml
deleted file mode 100755 (executable)
index 02fad90..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<DBMIGRATION type="enrol/authorize" VERSION="2005120100">
-  <TABLES>
-    <TABLE name="enrol_authorize">
-      <FIELDS>
-        <FIELD name="ccname" method="NO_CONV" type="varchar" length="255" />
-        <FIELD name="transid" method="NO_CONV" type="varchar" length="255" />
-        <FIELD name="amount" method="NO_CONV" type="varchar" length="10" />
-        <FIELD name="currency" method="NO_CONV" type="char" length="3" />
-        <FIELD name="paymentmethod" method="NO_CONV" type="enum('cc', 'echeck')" length="0" default="cc"/>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="enrol_authorize_refunds">
-      <FIELDS>
-        <FIELD name="amount" method="NO_CONV" type="varchar" length="10" />
-      </FIELDS>   
-    </TABLE>
-  </TABLES>
-</DBMIGRATION>
diff --git a/group/assign.php b/group/assign.php
new file mode 100644 (file)
index 0000000..d81e0c6
--- /dev/null
@@ -0,0 +1,182 @@
+<?php
+/**
+ * Add/remove members from group.
+ *
+ * @copyright &copy; 2006 The Open University
+ * @author N.D.Freear AT open.ac.uk
+ * @author J.White AT open.ac.uk 
+ * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
+ * @package groups
+ */
+require_once('../config.php');
+require_once('lib.php');
+require_once($CFG->libdir.'/moodlelib.php');
+
+$success = true;
+
+$courseid   = required_param('courseid', PARAM_INT);         
+$groupingid = required_param('grouping', PARAM_INT);
+$groupid    = required_param('group', PARAM_INT);
+
+// Get the course information so we can print the header and
+// check the course id is valid
+$course = groups_get_course_info($courseid);
+if (! $course) {
+    $success = false;
+    print_error('The course ID is invalid');
+}
+
+if ($success) {
+    // Make sure that the user has permissions to manage groups.
+    require_login($courseid);
+
+    $context = get_context_instance(CONTEXT_COURSE, $courseid);
+    if (! has_capability('moodle/course:managegroups', $context)) {
+        redirect();
+    }
+    
+    if ($frm = data_submitted() and confirm_sesskey()) { 
+
+        if (isset($frm->cancel)) {
+            redirect('index.php?id='. $courseid
+                .'&groupingid='. $groupingid .'&groupid='. $groupid);
+        }
+        elseif (isset($frm->add) and !empty($frm->addselect)) {
+
+            foreach ($frm->addselect as $userid) {
+                if (! $userid = clean_param($userid, PARAM_INT)) {
+                    continue;
+                }
+                //echo "Try user $userid, group $groupid<br>\n";
+                $success = groups_add_member($groupid, $userid);
+                if (! $success) {
+                    print_error('Failed to add user $userid to group.');
+                }
+            }
+        }
+        elseif (isset($frm->remove) and !empty($frm->removeselect)) {
+
+            foreach ($frm->removeselect as $userid) {
+                if (! $userid = clean_param($userid, PARAM_INT)) {
+                    continue;
+                }
+                $success = groups_remove_member($groupid, $userid);
+                if (! $success) {
+                    print_error('Failed to remove user $userid from group.');
+                }
+            }
+        }
+    }
+
+    // Print the page and form
+    $strgroups = get_string('groups');
+    $strparticipants = get_string('participants');
+
+    $groupname = groups_get_group_displayname($groupid);
+
+    print_header("$course->shortname: $strgroups", 
+                 "$course->fullname", 
+                 "<a href=\"$CFG->wwwroot/course/view.php?id=$courseid\">$course->shortname</a> ".
+                 "-> <a href=\"$CFG->wwwroot/user/index.php?id=$courseid\">$strparticipants</a> ".
+                 "-> $strgroups", '', '', true, '', user_login_string($course, $USER));
+
+    //require_once('assign-form.html');
+?>
+<div id="addmembersform">
+    <h3 class="main"><?php print_string('adduserstogroup', 'group'); echo " $groupname"; ?></h3>
+
+    <form name="assignform" id="assignform" method="post" action="">
+
+    <input type="hidden" name="sesskey" value="<?php p(sesskey()); ?>" />
+    <input type="hidden" name="courseid" value="<?php p($courseid); ?>" />
+    <input type="hidden" name="grouping" value="<?php echo $groupingid; ?>" />
+    <input type="hidden" name="group" value="<?php echo $groupid; ?>" />
+
+    <table summary="" align="center" cellpadding="5" cellspacing="0">
+    <tr>
+      <td valign="top">
+          <label for="removeselect"><?php print_string('existingusers', 'role'); //count($contextusers) ?></label>
+          <br />
+          <select name="removeselect[]" size="20" id="removeselect" multiple="multiple"
+                  onfocus="document.assignform.add.disabled=true;
+                           document.assignform.remove.disabled=false;
+                           document.assignform.addselect.selectedIndex=-1;">
+<?php
+    $userids = groups_get_members($groupid);
+    
+    if ($userids != false) {
+        // Put the groupings into a hash and sorts them
+        foreach ($userids as $userid) {
+            $listmembers[$userid] = groups_get_user_displayname($userid, $courseid);       
+        }
+        natcasesort($listmembers);
+
+        // Print out the HTML
+        foreach($listmembers as $id => $name) {
+            echo "<option value=\"$id\">$name</option>\n";
+        }
+    }
+?>
+          </select></td>
+      <td valign="top">
+<?php // Hidden assignment? ?>
+
+        <?php check_theme_arrows(); ?>
+        <p class="arrow_button">
+            <input name="add" id="add" type="submit" value="<?php echo '&nbsp;'.$THEME->larrow.' &nbsp; &nbsp; '.get_string('add'); ?>" title="<?php print_string('add'); ?>" />
+            <br />
+            <input name="remove" id="remove" type="submit" value="<?php echo '&nbsp; '.$THEME->rarrow.' &nbsp; &nbsp; '.get_string('remove'); ?>" title="<?php print_string('remove'); ?>" />
+        </p>
+      </td>
+      <td valign="top">
+          <label for="addselect"><?php print_string('potentialusers', 'role'); //$usercount ?></label>
+          <br />
+          <select name="addselect[]" size="20" id="addselect" multiple="multiple"
+                  onfocus="document.assignform.add.disabled=false;
+                           document.assignform.remove.disabled=true;
+                           document.assignform.removeselect.selectedIndex=-1;">
+    <?php
+    $showall = 0;
+    unset($userids);
+    if ($showall == 0 && $groupingid != GROUP_NOT_IN_GROUPING) {
+        $userids = groups_get_users_not_in_any_group_in_grouping($courseid, $groupingid, $groupid);
+    } else {
+        $userids = groups_get_users_not_in_group($courseid, $groupid);
+    }
+    
+    if ($userids != false) {
+        // Put the groupings into a hash and sorts them
+        foreach ($userids as $userid) {
+            $nonmembers[$userid] = groups_get_user_displayname($userid, $courseid);       
+        }
+        natcasesort($nonmembers);
+
+        // Print out the HTML
+        foreach($nonmembers as $id => $name) {
+            echo "<option value=\"$id\">$name</option>\n";
+        }
+    }
+    ?>
+         </select>
+         <br />
+         <?php //TODO: Search box 
+         
+              if (!empty($searchtext)) {
+                  echo '<input name="showall" id="showall" type="submit" value="'.$strshowall.'" />'."\n";
+              }
+         ?>
+       </td>
+    </tr>
+    <tr><td>
+        <input type="submit" name="cancel" value="<?php print_string('return', 'group'); ?>" />    
+    </td></tr>
+    </table>
+
+    </form>
+</div>
+
+<?php
+    print_footer($course);
+}
+
+?>
index cf1348f7016cccd1855b71cfccadfb3001c942dc..f60566c0cae0e1d4984785c49bc52cebe0a006cc 100644 (file)
@@ -2,7 +2,7 @@
 /**
  * Functions to make changes to groups in the database i.e. functions that 
  * access tables:
- *     groups_courses_groups, groups_groups and groups_groups_users.
+ *     groups_courses_groups, groups and groups_members.
  *
  * @copyright &copy; 2006 The Open University
  * @author J.White AT open.ac.uk
@@ -10,7 +10,7 @@
  * @package groups
  */
 require_once($CFG->libdir.'/datalib.php');
-require_once($CFG->dirroot.'/group/lib/lib.php');
+require_once($CFG->dirroot.'/group/lib.php');
 
 
 /*******************************************************************************
@@ -73,7 +73,7 @@ function groups_db_get_members($groupid) {
     if (!$groupid) {
         $userids = false;
     } else {
-        $users = get_records('groups_groups_users', 'groupid ', $groupid, '', 
+        $users = get_records('groups_members', 'groupid ', $groupid, '', 
                              $fields='id, userid');
         if (!$users) {
                $userids = false;
@@ -98,13 +98,13 @@ function groups_db_get_members($groupid) {
  */
 function groups_db_get_groups_for_user($userid, $courseid) {
     if (!$userid or !$courseid) {
-        $groupid = false;
+        $groupids = false;
     } else {  
         global $CFG;
         $table_prefix = $CFG->prefix;
         $sql = "SELECT g.id, userid 
-                FROM {$table_prefix}groups_groups_users AS gm 
-                INNER JOIN {$table_prefix}groups_groups AS g
+                FROM {$table_prefix}groups_members AS gm 
+                INNER JOIN {$table_prefix}groups AS g
                 ON gm.groupid = g.id
                 INNER JOIN {$table_prefix}groups_courses_groups AS cg
                 ON g.id = cg.groupid
@@ -131,19 +131,23 @@ function groups_db_get_groups_for_user($userid, $courseid) {
  * Get the group settings object for a group - this contains the following 
  * properties:
  * name, description, lang, theme, picture, hidepicture
- * @param int $groupid The id of the gruop
+ * @param int $groupid The id of the group
+ * @param $courseid Optionally add the course ID, for backwards compatibility.
  * @return object The group settings object 
  */
-function groups_db_get_group_settings($groupid) {
+function groups_db_get_group_settings($groupid, $courseid=false) {
    if (!$groupid) {
         $groupsettings = false;
     } else {
         global $CFG;
         $tableprefix = $CFG->prefix;
         $sql = "SELECT id, name, description, lang, theme, picture, hidepicture 
-                FROM {$tableprefix}groups_groups
+                FROM {$tableprefix}groups
                 WHERE id = $groupid";
         $groupsettings = get_record_sql($sql);
+        if ($courseid && $groupsettings) {
+            $groupsettings->courseid = $courseid;
+        }
     }
 
     return $groupsettings;     
@@ -188,7 +192,7 @@ function groups_db_group_exists($groupid) {
     if (!$groupid) {
         $exists = false;
     } else {
-        $exists = record_exists($table = 'groups_groups', 'id', $groupid);
+        $exists = record_exists($table = 'groups', 'id', $groupid);
     }
 
     return $exists;
@@ -205,7 +209,7 @@ function groups_db_is_member($groupid, $userid) {
     if (!$groupid or !$userid) {
         $ismember = false;
     } else {
-        $ismember = record_exists($table = 'groups_groups_users', 'groupid', 
+        $ismember = record_exists($table = 'groups_members', 'groupid', 
                                   $groupid, 'userid', $userid);
     }
     
@@ -253,7 +257,7 @@ function groups_db_create_group($courseid, $groupsettings = false) {
         $record->timecreated = time();
         $record->timemodified = time();
         //print_r($record);
-        $groupid = insert_record('groups_groups', $record);
+        $groupid = insert_record('groups', $record);
 
         if ($groupid != false) {
             $record2 = new Object();
@@ -289,7 +293,7 @@ function groups_db_add_member($groupid, $userid) {
                $record->groupid = $groupid;
                $record->userid = $userid;
                $record->timeadded = time();
-               $useradded = insert_record($table = 'groups_groups_users', $record);
+               $useradded = insert_record($table = 'groups_members', $record);
        }
 
        return $useradded;
@@ -311,7 +315,7 @@ function groups_db_set_group_settings($groupid, $groupsettings) {
        $record = $groupsettings;
         $record->id = $groupid;
         $record->timemodified = time();
-        $result = update_record('groups_groups', $record);
+        $result = update_record('groups', $record);
         if (!$result) {
             $success = false;
         }
@@ -336,7 +340,7 @@ function groups_db_remove_member($groupid, $userid) {
     if (!$userid or !$groupid) {
         $success = false;
     } else {
-        $results = delete_records('groups_groups_users', 
+        $results = delete_records('groups_members', 
                                   'groupid', $groupid, 'userid', $userid);
         // delete_records returns an array of the results from the sql call, 
         // not a boolean, so we have to set our return variable
@@ -392,7 +396,7 @@ function groups_db_delete_group($groupid) {
                }
 
         // Delete the group itself
-        $results = delete_records($table = 'groups_groups', $field1 = 'id', 
+        $results = delete_records($table = 'groups', $field1 = 'id', 
                                   $value1 = $groupid);
         // delete_records returns an array of the results from the sql call, 
         // not a boolean, so we have to set our return variable
@@ -404,4 +408,57 @@ function groups_db_delete_group($groupid) {
     return $success;
 }
 
+/**
+ * Internal function to set the time a group was modified.
+ */
+function groups_db_set_group_modified($groupid) {
+    return set_field('groups', 'timemodified', time(), 'id', $groupid);
+}
+
+
+/******************************************************************************
+ * Groups SQL clauses for modules and core.
+ */
+
+/**
+ * Returns the table in which group members are stored, with a prefix 'gm'.
+ * @return SQL string.
+ */
+function groups_members_from_sql() {
+    global $CFG;
+    return " {$CFG->prefix}groups_members gm ";
+}
+
+/**
+ * Returns a join testing user.id against member's user ID.
+ * Relies on 'user' table being included as 'user u'.
+ * Used in Quiz module reports.
+ * @param group ID, optional to include a test for this in the SQL.
+ * @return SQL string.
+ */
+function groups_members_join_sql($groupid=false) {    
+    $sql = ' JOIN '.groups_members_from_sql().' ON u.id = gm.userid ';
+    if ($groupid) {
+        $sql = "AND gm.groupid = '$groupid' ";
+    }
+    return $sql;
+    //return ' INNER JOIN '.$CFG->prefix.'role_assignments ra ON u.id=ra.userid'.
+    //       ' INNER JOIN '.$CFG->prefix.'context c ON ra.contextid=c.id AND c.contextlevel='.CONTEXT_GROUP.' AND c.instanceid='.$groupid;
+}
+
+/**
+ * Returns SQL for a WHERE clause testing the group ID.
+ * Optionally test the member's ID against another table's user ID column. 
+ * @param groupid
+ * @param userid_sql Optional user ID column selector, example "mdl_user.id", or false.
+ * @return SQL string.
+ */
+function groups_members_where_sql($groupid, $userid_sql=false) {
+    $sql = " gm.groupid = '$groupid' ";
+    if ($userid_sql) {
+        $sql .= "AND $userid_sql = gm.userid ";
+    }
+    return $sql;
+}
+
 ?>
\ No newline at end of file
index 409fe194b0a0f28727bf0e6d26eed0165f7e874e..8cffcde6b3f0d49583f2ac10010c6b048741b3de 100644 (file)
@@ -24,12 +24,12 @@ require_once($CFG->libdir.'/datalib.php');
  */
 function groups_db_get_groupings($courseid) {
     if (!$courseid) {
-        $groupingid = false;
+        $groupingids = false;
     } else {
         $groupings = get_records('groups_courses_groupings', 'courseid ', 
                                  $courseid, '', $fields='id, groupingid');
                if (!$groupings) {
-                       $groupingsids = false;
+                       $groupingids = false;
                } else {
                // Put the results into an array
                $groupingids = array();
@@ -217,7 +217,7 @@ function groups_db_grouping_exists($groupingid) {
         $tableprefix = $CFG->prefix;
         $sql = "SELECT gm.id
         FROM {$tableprefix}groups_groupings_groups AS gg
-        INNER JOIN {$tableprefix}groups_groups_users AS gm
+        INNER JOIN {$tableprefix}groups_members AS gm
         ON gg.groupid = gm.groupid
         WHERE gm.userid = $userid AND gg.groupingid = $groupingid";
         $belongstogroup = record_exists_sql($sql);
index 274c100ce3c12cf1c4445bfdb5ab9ec6e0027e36..cab2cdca3d1548c408fcaba956adb1a2bfe3e70f 100644 (file)
@@ -6,7 +6,7 @@
  *
  * @copyright &copy; 2006 The Open University
  * @author J.White AT open.ac.uk
- * @author N.D.Freear@open.ac.uk
+ * @author N.D.Freear AT open.ac.uk
  * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
  * @package groups
  */
@@ -96,15 +96,15 @@ function groups_create_database_tables() {
 
         $creategroupingstablesql = "CREATE TABLE `{$CFG->prefix}groups_groupings` (
                             `id` int(10) unsigned NOT NULL auto_increment,
-                            `name` varchar(254) collate latin1_general_ci NOT NULL default '',
-                            `description` text collate latin1_general_ci NOT NULL,
-                            `timecreated` int(10) unsigned NOT NULL default '0',
-                            `viewowngroup` binary(1) NOT NULL,
-                            `viewallgroupsmembers` binary(1) NOT NULL,
-                            `viewallgroupsactivities` binary(1) NOT NULL,
-                            `teachersgroupmark` binary(1) NOT NULL,
-                            `teachersgroupview` binary(1) NOT NULL,
-                            `teachersoverride` binary(1) NOT NULL,
+                            `name` varchar(254) collate latin1_general_ci NOT NULL,
+                            `description` text collate latin1_general_ci NOT NULL default '',
+                            `timecreated` int(10) unsigned NOT NULL default 0,
+                            `viewowngroup` binary(1) NOT NULL default 1,
+                            `viewallgroupsmembers` binary(1) NOT NULL default 0,
+                            `viewallgroupsactivities` binary(1) NOT NULL default 0,
+                            `teachersgroupmark` binary(1) NOT NULL default 0,
+                            `teachersgroupview` binary(1) NOT NULL default 0,
+                            `teachersoverride` binary(1) NOT NULL default 0,
                             PRIMARY KEY  (`id`),
                             UNIQUE KEY `id` (`id`)
                           ) ";
@@ -132,7 +132,7 @@ function groups_create_database_tables() {
 
         $creategroupstablesql = "CREATE TABLE {$CFG->prefix}groups_groups (
                             id SERIAL PRIMARY KEY,
-                            name varchar(255) NOT NULL default '',
+                            name varchar(255) NOT NULL,
                             description text NOT NULL default '',
                             enrolmentkey varchar(50) NOT NULL default '',
                             lang varchar(10) NOT NULL default 'en',
@@ -165,15 +165,15 @@ function groups_create_database_tables() {
                                       
         $creategroupingstablesql = "CREATE TABLE {$CFG->prefix}groups_groupings (
                             id SERIAL PRIMARY KEY,
-                            name varchar(254) NOT NULL default '',
-                            description text NOT NULL,
-                            timecreated integer NOT NULL default '0',
-                            viewowngroup integer NOT NULL,
-                            viewallgroupsmembers integer NOT NULL,
-                            viewallgroupsactivities integer NOT NULL,
-                            teachersgroupmark integer NOT NULL,
-                            teachersgroupview integer NOT NULL,
-                            teachersoverride integer NOT NULL
+                            name varchar(254) NOT NULL default,
+                            description text NOT NULL default '',
+                            timecreated integer NOT NULL default 0,
+                            viewowngroup integer NOT NULL default 1,
+                            viewallgroupsmembers integer NOT NULL default 0,
+                            viewallgroupsactivities integer NOT NULL default 0,
+                            teachersgroupmark integer NOT NULL default 0,
+                            teachersgroupview integer NOT NULL default 0,
+                            teachersoverride integer NOT NULL default 0
                           ) ";
 
         $creategroupingsgroupstablesql = "CREATE TABLE {$CFG->prefix}groups_groupings_groups (
diff --git a/group/db/install.xml b/group/db/install.xml
new file mode 100644 (file)
index 0000000..9782943
--- /dev/null
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<XMLDB PATH="group/db" VERSION="20061209" COMMENT="XMLDB file for Moodle groups."
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
+>
+  <TABLES>
+    <TABLE NAME="groups" COMMENT="Each record represents a group." NEXT="groups_members">
+      <FIELDS>
+        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="name"/>
+        <FIELD NAME="name" TYPE="char" LENGTH="254" NOTNULL="true" SEQUENCE="false" ENUM="false" COMMENT="Short human readable unique name for the group." PREVIOUS="id" NEXT="description"/>
+        <FIELD NAME="description" TYPE="text" LENGTH="small" NOTNULL="true" DEFAULT="" SEQUENCE="false" ENUM="false" PREVIOUS="name" NEXT="enrolmentkey"/>
+        <FIELD NAME="enrolmentkey" TYPE="char" LENGTH="50" NOTNULL="true" DEFAULT="" SEQUENCE="false" ENUM="false" PREVIOUS="description" NEXT="lang"/>
+        <FIELD NAME="lang" TYPE="char" LENGTH="10" NOTNULL="true" DEFAULT="en" SEQUENCE="false" ENUM="false" PREVIOUS="enrolmentkey" NEXT="theme"/>
+        <FIELD NAME="theme" TYPE="char" LENGTH="50" NOTNULL="true" DEFAULT="" SEQUENCE="false" ENUM="false" PREVIOUS="lang" NEXT="picture"/>
+        <FIELD NAME="picture" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="theme" NEXT="hidepicture"/>
+        <FIELD NAME="hidepicture" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="picture" NEXT="timecreated"/>
+        <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="hidepicture" NEXT="timemodified"/>
+        <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="timecreated"/>
+      </FIELDS>
+      <KEYS>
+        <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for groups"/>
+      </KEYS>
+    </TABLE>
+    <TABLE NAME="groups_members" COMMENT="Link a user to a group." PREVIOUS="groups" NEXT="groups_groupings">
+      <FIELDS>
+        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="groupid"/>
+        <FIELD NAME="groupid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="userid"/>
+        <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="groupid" NEXT="timeadded"/>
+        <FIELD NAME="timeadded" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="userid"/>
+      </FIELDS>
+      <KEYS>
+        <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for groups_members"/>
+      </KEYS>
+      <INDEXES>
+        <INDEX NAME="groupid" UNIQUE="false" FIELDS="groupid" NEXT="userid"/>
+        <INDEX NAME="userid" UNIQUE="false" FIELDS="userid" PREVIOUS="groupid"/>
+      </INDEXES>
+    </TABLE>
+    <TABLE NAME="groups_groupings" COMMENT="A grouping is a collection of groups." PREVIOUS="groups_members" NEXT="groups_courses_groups">
+      <FIELDS>
+        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" SEQUENCE="true" ENUM="false" COMMENT="id of the table, please edit me" NEXT="name"/>
+        <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" COMMENT="Short human readable unique name for group." PREVIOUS="id" NEXT="description"/>
+        <FIELD NAME="description" TYPE="text" LENGTH="small" NOTNULL="true" DEFAULT="" SEQUENCE="false" ENUM="false" PREVIOUS="name" NEXT="timecreated"/>
+        <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="description" NEXT="viewowngroup"/>
+        <FIELD NAME="viewowngroup" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="1" SEQUENCE="false" ENUM="false" PREVIOUS="timecreated" NEXT="viewallgroupsmembers"/>
+        <FIELD NAME="viewallgroupsmembers" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="viewowngroup" NEXT="viewallgroupsactivities"/>
+        <FIELD NAME="viewallgroupsactivities" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="viewallgroupsmembers" NEXT="teachersgroupmark"/>
+        <FIELD NAME="teachersgroupmark" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="viewallgroupsactivities" NEXT="teachersgroupview"/>
+        <FIELD NAME="teachersgroupview" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="teachersgroupmark" NEXT="teachersoverride"/>
+        <FIELD NAME="teachersoverride" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="teachersgroupview" NEXT="teacherdeletable"/>
+        <FIELD NAME="teacherdeletable" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="teachersoverride"/>
+      </FIELDS>
+      <KEYS>
+        <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for groups_groupings"/>
+      </KEYS>
+    </TABLE>
+    <TABLE NAME="groups_courses_groups" COMMENT="Link a group to a course (or the site)." PREVIOUS="groups_groupings" NEXT="groups_courses_groupings">
+      <FIELDS>
+        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" SEQUENCE="true" ENUM="false" COMMENT="id of the table, please edit me" NEXT="courseid"/>
+        <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="groupid"/>
+        <FIELD NAME="groupid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" COMMENT="Default comment for the field, please edit me" PREVIOUS="courseid"/>
+      </FIELDS>
+      <KEYS>
+        <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for groups_courses_groups"/>
+      </KEYS>
+    </TABLE>
+    <TABLE NAME="groups_courses_groupings" COMMENT="Link a grouping to a course (or the site)." PREVIOUS="groups_courses_groups" NEXT="groups_groupings_groups">
+      <FIELDS>
+        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" SEQUENCE="true" ENUM="false" COMMENT="id of the table, please edit me" NEXT="courseid"/>
+        <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="groupingid"/>
+        <FIELD NAME="groupingid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="courseid"/>
+      </FIELDS>
+      <KEYS>
+        <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for groups_courses_groupings"/>
+      </KEYS>
+    </TABLE>
+    <TABLE NAME="groups_groupings_groups" COMMENT="Link a group to a grouping." PREVIOUS="groups_courses_groupings">
+      <FIELDS>
+        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" SEQUENCE="true" ENUM="false" COMMENT="id of the table, please edit me" NEXT="groupingid"/>
+        <FIELD NAME="groupingid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="groupid"/>
+        <FIELD NAME="groupid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="groupingid" NEXT="timeadded"/>
+        <FIELD NAME="timeadded" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="groupid"/>
+      </FIELDS>
+      <KEYS>
+        <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for groups_groupings_groups"/>
+      </KEYS>
+    </TABLE>
+  </TABLES>
+  <STATEMENTS>
+    <STATEMENT NAME="insert log_display" TYPE="insert" TABLE="log_display" COMMENT="Initial insert of records on table log_display">
+      <SENTENCES>
+        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('group', 'view', 'groups', 'name')" />
+      </SENTENCES>
+    </STATEMENT>
+  </STATEMENTS>
+</XMLDB>
index 1173d49faef4a9fbe0de7474cc1f4bef2dc6eadc..bf9b69147ce627bfeb6d7f7abb830b20bb327b5b 100644 (file)
@@ -19,7 +19,7 @@
 CREATE TABLE `prefix_groups_courses_groupings` (
   `id` int(10) unsigned NOT NULL auto_increment,
   `courseid` int(10) unsigned NOT NULL default '0',
-  `groupingid` mediumint(9) NOT NULL,
+  `groupingid` mediumint(9) NOT NULL default '0',
   PRIMARY KEY  (`id`),
   UNIQUE KEY `id` (`id`),
   KEY `courseid` (`courseid`)
@@ -34,7 +34,7 @@ CREATE TABLE `prefix_groups_courses_groupings` (
 CREATE TABLE `prefix_groups_courses_groups` (
   `id` int(10) unsigned NOT NULL auto_increment,
   `courseid` int(10) unsigned NOT NULL default '0',
-  `groupid` int(11) NOT NULL,
+  `groupid` int(11) NOT NULL default '0',
   PRIMARY KEY  (`id`),
   UNIQUE KEY `id` (`id`),
   KEY `courseid` (`courseid`)
@@ -48,16 +48,16 @@ CREATE TABLE `prefix_groups_courses_groups` (
 
 CREATE TABLE `prefix_groups_groupings` (
   `id` int(10) unsigned NOT NULL auto_increment,
-  `name` varchar(254) character set latin1 collate latin1_general_ci NOT NULL default '',
-  `description` text character set latin1 collate latin1_general_ci NOT NULL,
+  `name` varchar(254) NOT NULL,
+  `description` text NOT NULL default '',
   `timecreated` int(10) unsigned NOT NULL default '0',
-  `viewowngroup` tinyint(1) NOT NULL,
-  `viewallgroupsmembers` tinyint(1) NOT NULL,
-  `viewallgroupsactivities` tinyint(1) NOT NULL,
-  `teachersgroupmark` tinyint(1) NOT NULL,
-  `teachersgroupview` binary(1) NOT NULL,
-  `teachersoverride` binary(1) NOT NULL,
-  `teacherdeletable` binary(1) NOT NULL,
+  `viewowngroup` tinyint(1) NOT NULL default 1,
+  `viewallgroupsmembers` tinyint(1) NOT NULL default 0,
+  `viewallgroupsactivities` tinyint(1) NOT NULL default 0,
+  `teachersgroupmark` tinyint(1) NOT NULL default 0,
+  `teachersgroupview` binary(1) NOT NULL default 0,
+  `teachersoverride` binary(1) NOT NULL default 0,
+  `teacherdeletable` binary(1) NOT NULL default 0,
   PRIMARY KEY  (`id`),
   UNIQUE KEY `id` (`id`)
 ) ENGINE=MyISAM ;
@@ -71,7 +71,7 @@ CREATE TABLE `prefix_groups_groupings` (
 CREATE TABLE `prefix_groups_groupings_groups` (
   `id` int(10) unsigned NOT NULL auto_increment,
   `groupingid` int(10) unsigned default '0',
-  `groupid` int(10) NOT NULL,
+  `groupid` int(10) NOT NULL default '0',
   `timeadded` int(10) unsigned NOT NULL default '0',
   PRIMARY KEY  (`id`),
   UNIQUE KEY `id` (`id`),
@@ -81,16 +81,16 @@ CREATE TABLE `prefix_groups_groupings_groups` (
 # --------------------------------------------------------
 
 # 
-# Table structure for table `prefix_groups_groups`
+# Table structure for table `prefix_groups`
 # 
 
-CREATE TABLE `prefix_groups_groups` (
+CREATE TABLE `prefix_groups` (
   `id` int(10) unsigned NOT NULL auto_increment,
-  `name` varchar(254) character set latin1 collate latin1_general_ci NOT NULL default '',
-  `description` text character set latin1 collate latin1_general_ci NOT NULL,
-  `enrolmentkey` varchar(50) character set latin1 collate latin1_general_ci NOT NULL default '',
-  `lang` varchar(10) character set latin1 collate latin1_general_ci NOT NULL default 'en',
-  `theme` varchar(50) character set latin1 collate latin1_general_ci NOT NULL default '',
+  `name` varchar(255) NOT NULL,
+  `description` text NOT NULL default '',
+  `enrolmentkey` varchar(50) NOT NULL default '',
+  `lang` varchar(10) NOT NULL default 'en',
+  `theme` varchar(50) NOT NULL default '',
   `picture` int(10) unsigned NOT NULL default '0',
   `hidepicture` int(1) unsigned NOT NULL default '0',
   `timecreated` int(10) unsigned NOT NULL default '0',
@@ -102,10 +102,10 @@ CREATE TABLE `prefix_groups_groups` (
 # --------------------------------------------------------
 
 # 
-# Table structure for table `prefix_groups_groups_users`
+# Table structure for table `prefix_groups_members`
 # 
 
-CREATE TABLE `prefix_groups_groups_users` (
+CREATE TABLE `prefix_groups_members` (
   `id` int(10) unsigned NOT NULL auto_increment,
   `groupid` int(10) unsigned NOT NULL default '0',
   `userid` int(10) unsigned NOT NULL default '0',
index b4594e8553392f4183642f795037904a5057594e..a21609b3527e0d145b5b226cd7f396163ebeb6b9 100644 (file)
@@ -1,59 +1,65 @@
 
-CREATE TABLE prefix_groups_courses_groups (
-                            id SERIAL PRIMARY KEY,
-                            courseid integer NOT NULL default '0',
-                            groupid integer NOT NULL default '0'
-                          );
-CREATE INDEX prefix_groups_courses_groups_courseid_idx ON prefix_groups_courses_groups (courseid);
-
-CREATE TABLE prefix_groups_groups (
-                            id SERIAL PRIMARY KEY,
-                            name varchar(255) NOT NULL default '',
-                            description text NOT NULL default '',
-                            enrolmentkey varchar(50) NOT NULL default '',
-                            lang varchar(10) NOT NULL default 'en',
-                            theme varchar(50) NOT NULL default '',
-                            picture integer NOT NULL default '0',
-                            hidepicture integer NOT NULL default '0',
-                            timecreated integer NOT NULL default '0',
-                            timemodified integer NOT NULL default '0'
-                          );
-
-CREATE TABLE prefix_groups_groups_users (
-                            id SERIAL PRIMARY KEY,
-                            groupid integer NOT NULL default '0',
-                            userid integer NOT NULL default '0',
-                            timeadded integer NOT NULL default '0'
-                          );
-CREATE INDEX prefix_groups_groups_users_groupid_idx ON prefix_groups_groups_users (groupid);
-CREATE INDEX prefix_groups_groups_users_userid_idx ON prefix_groups_groups_users (userid);
-COMMENT ON TABLE prefix_groups_groups_users IS 'New groupings (OU).';
 
 CREATE TABLE prefix_groups_courses_groupings (
-                            id SERIAL PRIMARY KEY,
-                            courseid integer NOT NULL default '0',
-                            groupingid integer NOT NULL
-                          );
+    id SERIAL PRIMARY KEY,
+    courseid integer NOT NULL default 0,
+    groupingid integer NOT NULL default 0
+);
 CREATE INDEX prefix_groups_courses_groupings_courseid_idx ON prefix_groups_courses_groupings (courseid);
 COMMENT ON TABLE prefix_groups_courses_groupings IS 'New groupings (OU).';
-                                      
+
+
+CREATE TABLE prefix_groups_courses_groups (
+    id SERIAL PRIMARY KEY,
+    courseid integer NOT NULL default '0',
+    groupid integer NOT NULL default '0'
+);
+CREATE INDEX prefix_groups_courses_groups_courseid_idx ON prefix_groups_courses_groups (courseid);
+
+
 CREATE TABLE prefix_groups_groupings (
-                            id SERIAL PRIMARY KEY,
-                            name varchar(254) NOT NULL default '',
-                            description text NOT NULL,
-                            timecreated integer NOT NULL default '0',
-                            viewowngroup integer NOT NULL,
-                            viewallgroupsmembers integer NOT NULL,
-                            viewallgroupsactivities integer NOT NULL,
-                            teachersgroupmark integer NOT NULL,
-                            teachersgroupview integer NOT NULL,
-                            teachersoverride integer NOT NULL
-                          );
+    id SERIAL PRIMARY KEY,
+    name varchar(254) NOT NULL,
+    description text NOT NULL default '',
+    timecreated integer NOT NULL default 0,
+    viewowngroup integer NOT NULL default 1,
+    viewallgroupsmembers integer NOT NULL default 0,
+    viewallgroupsactivities integer NOT NULL default 0,
+    teachersgroupmark integer NOT NULL default 0,
+    teachersgroupview integer NOT NULL default 0,
+    teachersoverride integer NOT NULL default 0
+);
+
 
 CREATE TABLE prefix_groups_groupings_groups (
-                            id SERIAL PRIMARY KEY,
-                            groupingid integer default '0',
-                            groupid integer NOT NULL,
-                            timeadded integer NOT NULL default '0'
-                          );
+    id SERIAL PRIMARY KEY,
+    groupingid integer NOT NULL default 0,
+    groupid integer NOT NULL default 0,
+    timeadded integer NOT NULL default 0
+);
 CREATE INDEX prefix_groups_groupings_groups_groupingid_idx ON prefix_groups_groupings_groups (groupingid);
+
+
+CREATE TABLE prefix_groups (
+    id SERIAL PRIMARY KEY,
+    name varchar(255) NOT NULL,
+    description text NOT NULL default '',
+    enrolmentkey varchar(50) NOT NULL default '',
+    lang varchar(10) NOT NULL default 'en',
+    theme varchar(50) NOT NULL default '',
+    picture integer NOT NULL default '0',
+    hidepicture integer NOT NULL default '0',
+    timecreated integer NOT NULL default '0',
+    timemodified integer NOT NULL default '0'
+);
+
+
+CREATE TABLE prefix_groups_members (
+    id SERIAL PRIMARY KEY,
+    groupid integer NOT NULL default '0',
+    userid integer NOT NULL default '0',
+    timeadded integer NOT NULL default '0'
+);
+CREATE INDEX prefix_groups_members_groupid_idx ON prefix_groups_members (groupid);
+CREATE INDEX prefix_groups_members_userid_idx ON prefix_groups_members (userid);
+COMMENT ON TABLE prefix_groups_members IS 'New groupings (OU).';
diff --git a/group/db/upgrade.php b/group/db/upgrade.php
new file mode 100644 (file)
index 0000000..a5486df
--- /dev/null
@@ -0,0 +1,223 @@
+<?php  //$Id: upgrade.php,v 1.2 2007/01/03 04:55:20 moodler Exp $
+
+// This file keeps track of upgrades to 
+// groups
+//
+// Sometimes, changes between versions involve
+// alterations to database structures and other
+// major things that may break installations.
+//
+// The upgrade function in this file will attempt
+// to perform all the necessary actions to upgrade
+// your older installtion to the current version.
+//
+// If there's something it cannot do itself, it
+// will tell you what you need to do.
+//
+// The commands in here will all be database-neutral,
+// using the functions defined in lib/ddllib.php
+
+function upgrade_group_db($continueto) {
+/// This function upgrades the group tables, if necessary
+/// It's called from admin/index.php.
+
+    global $CFG, $db;
+
+    $group_version = '';  // Get code versions
+    require_once ("$CFG->dirroot/group/version.php");
+
+    if (empty($CFG->group_version)) {  // New groups have never been installed...
+        $status = false;
+
+        $strdatabaseupgrades = get_string('databaseupgrades');
+        print_header($strdatabaseupgrades, $strdatabaseupgrades, $strdatabaseupgrades, '', 
+                '<script type="text/javascript" src="' . $CFG->wwwroot . '/lib/scroll_to_errors.js"></script>',
+                false, "&nbsp;", "&nbsp;");
+
+        upgrade_log_start();
+        print_heading('group');
+        $db->debug=true;
+
+        //TODO: for testing, revert to 'old' groups.
+        if (! get_config('group_version')) {
+            $status = revert_group_db();
+        }
+
+        //... But Moodle is already installed.
+        if (table_exists($t_groups = new XMLDBTable('groups'))) {
+            $status = rename_table($t_groups, 'groups_temp');
+            $status = rename_table(new XMLDBTable('groups_members'), 'groups_members_temp');
+        }
+
+    /// Both old .sql files and new install.xml are supported
+    /// but we prioritize install.xml (XMLDB) if present
+
+        if (file_exists($CFG->dirroot . '/group/db/install.xml')) {
+            $status = install_from_xmldb_file($CFG->dirroot . '/group/db/install.xml'); //New method
+        } else if (file_exists($CFG->dirroot . '/group/db/' . $CFG->dbtype . '.sql')) {
+            $status = modify_database($CFG->dirroot . '/group/db/' . $CFG->dbtype . '.sql'); //Old method
+        }
+
+        $status = transfer_group_db();
+
+        $db->debug = false;
+    
+        if (set_config('group_version', $group_version)) { //and set_config('group_release', $group_release)) {
+            //initialize default group settings now
+            $adminroot = admin_get_root();
+            apply_default_settings($adminroot->locate('groups'));
+            notify(get_string('databasesuccess'), 'green');
+            notify(get_string('databaseupgradegroups', '', $group_version), 'green');
+            print_continue($continueto);
+            exit;
+        } else {
+            error("Upgrade of group system failed! (Could not update version in config table)");
+        }
+    }
+
+/// Upgrading code starts here
+    $oldupgrade = false;
+    $newupgrade = false;
+    if (is_readable($CFG->dirroot . '/group/db/' . $CFG->dbtype . '.php')) {
+        include_once($CFG->dirroot . '/group/db/' . $CFG->dbtype . '.php');  // defines old upgrading function
+        $oldupgrade = true;
+    }
+    if (is_readable($CFG->dirroot . '/group/db/upgrade.php')) {
+        include_once($CFG->dirroot . '/group/db/upgrade.php');  // defines new upgrading function
+        $newupgrade = true;
+    }
+
+    if ($group_version > $CFG->group_version) {       // Upgrade tables
+        $strdatabaseupgrades = get_string('databaseupgrades');
+        print_header($strdatabaseupgrades, $strdatabaseupgrades, $strdatabaseupgrades, '',
+                 '<script type="text/javascript" src="' . $CFG->wwwroot . '/lib/scroll_to_errors.js"></script>');
+
+        upgrade_log_start();
+        print_heading('group');
+
+    /// Run de old and new upgrade functions for the module
+        $oldupgrade_function = 'group_upgrade';
+        $newupgrade_function = 'xmldb_group_upgrade';
+
+    /// First, the old function if exists
+        $oldupgrade_status = true;
+        if ($oldupgrade && function_exists($oldupgrade_function)) {
+            $db->debug = true;
+            $oldupgrade_status = $oldupgrade_function($CFG->group_version);
+        } else if ($oldupgrade) {
+            notify ('Upgrade function ' . $oldupgrade_function . ' was not available in ' .
+                    '/group/db/' . $CFG->dbtype . '.php');
+        }
+
+    /// Then, the new function if exists and the old one was ok
+        $newupgrade_status = true;
+        if ($newupgrade && function_exists($newupgrade_function) && $oldupgrade_status) {
+            $db->debug = true;
+            $newupgrade_status = $newupgrade_function($CFG->group_version);
+        } else if ($newupgrade) {
+            notify ('Upgrade function ' . $newupgrade_function . ' was not available in ' .
+                    '/group/db/upgrade.php');
+        }
+
+        $db->debug=false;
+    /// Now analyze upgrade results
+        if ($oldupgrade_status && $newupgrade_status) {    // No upgrading failed
+            if (set_config('group_version', $group_version)) { //and set_config('group_release', $group_release))
+                notify(get_string('databasesuccess'), 'green');
+                notify(get_string('databaseupgradegroups', '', $group_version), 'green');
+                print_continue($continueto);
+                exit;
+            } else {
+                error("Upgrade of group system failed! (Could not update version in config table)");
+            }
+        } else {
+            error("Upgrade failed!  See group/version.php");
+        }
+
+        upgrade_log_finish();
+        print_footer();
+
+    } else if ($group_version < $CFG->group_version) {
+        upgrade_log_start();
+        notify("WARNING!!!  The code you are using is OLDER than the version that made these databases!");
+
+        upgrade_log_finish();
+        print_footer();
+    }
+}
+
+
+function transfer_group_db() {
+    $status = true;
+    
+    if (table_exists($t_groups = new XMLDBTable('groups_temp'))) {
+        $status = (bool)$groups_r = get_records('groups_temp');
+        $status = (bool)$members_r= get_records('groups_members_temp');
+
+        if (! $groups_r) {
+            return $status;
+        }
+        foreach ($groups_r as $group) {
+            if (debugging()) {
+                print_object($group);
+            }
+            $group->enrolmentkey = $group->password;
+            ///unset($group->password);
+            ///unset($group->courseid);
+            $status = (bool)$newgroupid = groups_create_group($group->courseid, $group);
+            if ($members_r) {
+                foreach ($members_r as $member) {
+                    if ($member->groupid == $group->id) {
+                        $status = groups_add_member($newgroupid, $member->userid);
+                    }
+                }
+            }
+            echo 'Status: '.$status;
+        }
+        ///$status = drop_table($t_groups);
+        ///$status = drop_table(new XMLDBTable('groups_members_temp'));
+    }
+    return $status;
+}
+
+
+/**
+ * For testing, it's useful to be able to revert to 'old' groups.
+ */
+function revert_group_db() {
+    $status = false;
+    //$status = (bool)$rs = delete_records('config', 'name', 'group_version');
+    if (!get_config('group_version') && table_exists(new XMLDBTable('groups_groupings'))) { //debugging()
+        $status = drop_table(new XMLDBTable('groups'));
+        $status = drop_table(new XMLDBTable('groups_members'));
+        $status = drop_table(new XMLDBTable('groups_groupings'));
+        $status = drop_table(new XMLDBTable('groups_courses_groups'));
+        $status = drop_table(new XMLDBTable('groups_courses_groupings'));
+        $status = drop_table(new XMLDBTable('groups_groupings_groups'));
+
+        $status = rename_table(new XMLDBTable('groups_temp'), 'groups');
+        $status = rename_table(new XMLDBTable('groups_members_temp'), 'groups_members');
+    }
+    return $status;
+}
+
+
+function xmldb_group_upgrade($oldversion=0) {
+
+    //global $CFG, $THEME, $db;
+
+    $result = true;
+
+/// And upgrade begins here. For each one, you'll need one 
+/// block of code similar to the next one. Please, delete 
+/// this comment lines once this file start handling proper
+/// upgrade code.
+
+/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
+///     $result = result of "/lib/ddllib.php" function calls
+/// }
+
+    return $result;
+}
+
+?>
diff --git a/group/group.php b/group/group.php
new file mode 100644 (file)
index 0000000..7c51a00
--- /dev/null
@@ -0,0 +1,208 @@
+<?php
+/**
+ * Create group OR edit group settings.
+ *
+ * @copyright &copy; 2006 The Open University
+ * @author N.D.Freear AT open.ac.uk
+ * @author J.White AT open.ac.uk 
+ * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
+ * @package groups
+ */
+require_once('../config.php');
+require_once('lib.php');
+require_once($CFG->libdir.'/moodlelib.php');
+require_once($CFG->libdir.'/uploadlib.php');
+
+$success = true;
+$err = array();
+
+$courseid   = required_param('courseid', PARAM_INT);         
+$groupingid = optional_param('grouping', false, PARAM_INT);
+$groupid    = optional_param('group', false, PARAM_INT);
+
+$groupsettings->name       = optional_param('name', PARAM_ALPHANUM);
+$groupsettings->description= optional_param('description', PARAM_ALPHANUM);
+$groupsettings->enrolmentkey= optional_param('enrolmentkey', PARAM_ALPHANUM);
+$groupsettings->hidepicture= optional_param('hidepicture', PARAM_BOOL);
+
+$delete = optional_param('delete', false, PARAM_BOOL);
+
+// Get the course information so we can print the header and
+// check the course id is valid
+$course = groups_get_course_info($courseid);
+if (! $course) {
+    $success = false;
+    print_error('The course ID is invalid');
+}
+
+if ($success) {
+    // Make sure that the user has permissions to manage groups.
+    require_login($courseid);
+
+    $context = get_context_instance(CONTEXT_COURSE, $courseid);
+    if (! has_capability('moodle/course:managegroups', $context)) {
+        redirect();
+    }
+
+/// If data submitted, then process and store.
+
+    if ($frm = data_submitted() and confirm_sesskey()) { 
+
+        if (isset($frm->cancel)) {
+            redirect(groups_home_url($courseid, $groupid, $groupingid, false));
+        }
+        elseif (isset($frm->confirmdelete)) {
+            ///TODO:
+        }
+        elseif (empty($frm->name)) {
+            $err['name'] = get_string('missingname');
+        }
+        elseif (isset($frm->update)) {
+            if (GROUP_NOT_IN_GROUPING == $groupingid) {
+                print_error('errornotingrouping', 'group', groups_home_url($courseid), get_string('notingrouping', 'group'));
+            }
+            if (! $groupid) {
+                $success = (bool)$groupid = groups_create_group($courseid); //$groupsettings);
+                $success = groups_add_group_to_grouping($groupid, $groupingid);
+            }
+            if ($success) {
+                //require_once($CFG->dirroot.'/lib/uploadlib.php');
+
+                $um = new upload_manager('imagefile',false,false,null,false,0,true,true);
+                if ($um->preprocess_files()) {
+                    require_once("$CFG->libdir/gdlib.php");
+                
+                    if (save_profile_image($groupid, $um, 'groups')) {
+                        $groupsettings->picture = 1;
+                    } 
+                }
+
+                $success = (bool)groups_set_group_settings($groupid, $groupsettings);
+            }
+            if ($success) {
+                redirect(groups_home_url($courseid, $groupid, $groupingid, false));
+            }
+            else {
+                print_error('Error creating/updating group.');
+            }
+        }
+    }
+
+/// OR, prepare the form.
+
+    if ($groupid) {
+        // Form to edit existing group.
+        $group = groups_get_group_settings($groupid);
+        if (! $group) {
+            print_error('The group ID is invalid.');
+        }
+        $strname = s($group->name);
+        $strdesc = s($group->description);
+
+        $strbutton  = get_string('save', 'group'); 
+        $strheading = get_string('editgroupsettings', 'group');
+    } else {
+        // Form to create a new one.
+        $strname = get_string('defaultgroupname', 'group');
+        $strdesc = '';
+        $strbutton = $strheading = get_string('creategroup', 'group');
+    }
+    $strgroups = get_string('groups');
+    $strparticipants = get_string('participants');
+    if ($delete) {
+        $strheading = get_string('deleteselectedgroup', 'group');
+    } //else { $strheader = get_string('groupinfoedit'); }
+
+    $maxbytes = get_max_upload_file_size($CFG->maxbytes, $course->maxbytes);
+    if (!empty($CFG->gdversion) and $maxbytes) {
+        $printuploadpicture = true;
+    } else {
+        $printuploadpicture = false;
+    }
+
+/// Print the page and form
+
+    print_header("$course->shortname: ". $strheading,
+                 "$course->fullname", 
+                 "<a href=\"$CFG->wwwroot/course/view.php?id=$courseid\">$course->shortname</a> ".
+                 "-> <a href=\"$CFG->wwwroot/user/index.php?id=$courseid\">$strparticipants</a> ".
+                 "-> $strgroups", '', '', true, '', user_login_string($course, $USER));
+
+    $usehtmleditor = false;
+?>
+<h3 class="main"><?php echo $strheading ?></h3>
+
+<form action="group.php" method="post" class="mform notmform" id="groupform">
+
+<input type="hidden" name="sesskey" value="<?php p(sesskey()); ?>" />
+<input type="hidden" name="courseid" value="<?php p($courseid); ?>" />
+<input type="hidden" name="grouping" value="<?php p($groupingid); ?>" />
+<?php
+    if ($groupid) {
+        echo '<input type="hidden" name="group" value="'. $groupid .'" />';
+    }
+
+    if ($delete) {
+        /*echo 'Are you sure you want to delete group X ?';
+        choose_from_menu_yesno('confirmdelete', false, '', true);*/
+?>
+
+        <p>Are you sure you want to delete group '<?php p($strname) ?>'?</p>
+        <input type="hidden" name="delete" value="1" />
+        <input type="submit" name="confirmdelete" value="Yes" />
+        <input type="submit" name="cancel" value="<?php print_string('cancel', 'group'); ?>" />
+<?php
+    } else {
+?>
+
+<div class="fitem">
+<p><label for="groupname"><?php
+   print_string('groupname', 'group');
+   if (isset($err['name'])) {
+       echo' ';
+       formerr($err['name']);
+   } ?>&nbsp; </label></p>
+<p class="felement"><input id="groupname" name="name" type="text" size="40" value="<?php echo $strname; ?>" /></p>
+</div>
+
+<p><label for="edit-description"><?php print_string('groupdescription', 'group'); ?>&nbsp;</label></p>
+<p><?php print_textarea($usehtmleditor, 5, 45, 200, 400, 'description', $strdesc); ?></p>
+
+<p><label for="enrolmentkey"><?php print_string('enrolmentkey', 'group'); ?>&nbsp;</label></p>
+<p><input id="enrolmentkey" name="enrolmentkey" type="text" size="25" /></p>
+
+<?php if ($printuploadpicture) {  ?>
+    <p><label for="menuhidepicture"><?php print_string('hidepicture', 'group'); ?>&nbsp;</label></p>
+    <p><?php $options = array();
+             $options[0] = get_string('no');
+             $options[1] = get_string('yes');
+             choose_from_menu($options, 'hidepicture', isset($group)? $group->hidepicture: 1, '');?></p>
+
+    <p><label ><?php /* for="groupicon" */ print_string('newpicture', 'group');
+        helpbutton('picture', get_string('helppicture'));
+        print_string('maxsize', '', display_size($maxbytes), 'group');
+        if (isset($err['imagefile'])) formerr($err['imagefile']);
+     ?>&nbsp;</label></p>
+    <p><?php upload_print_form_fragment(1, array('groupicon'), null,false,null,0,0,false); ?></p>
+<?php 
+    }  
+?>
+
+<p class="fitem">
+  <label for="id_submit">&nbsp;</label>
+  <span class="f--element fsubmit">
+    <input type="submit" name="update" id="id_submit" value="<?php echo $strbutton; ?>" />
+    <input type="submit" name="cancel" value="<?php print_string('cancel', 'group'); ?>" />
+  </span>
+</p>
+
+<?php } //IF($delete) ?>
+
+<span class="clearer">&nbsp;</span>
+
+</form>
+<?php
+    print_footer($course);
+}
+
+?>
diff --git a/group/grouping.php b/group/grouping.php
new file mode 100644 (file)
index 0000000..dbdfd7a
--- /dev/null
@@ -0,0 +1,132 @@
+<?php
+/**
+ * Create grouping OR edit grouping settings.
+ *
+ * @copyright &copy; 2006 The Open University
+ * @author N.D.Freear AT open.ac.uk
+ * @author J.White AT open.ac.uk 
+ * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
+ * @package groups
+ */
+require_once('../config.php');
+require_once('lib.php');
+require_once($CFG->libdir.'/moodlelib.php');
+
+$success = true;
+$courseid   = required_param('courseid', PARAM_INT);         
+$groupingid = optional_param('grouping', false, PARAM_INT);
+
+$groupingsettings->name       = optional_param('name', PARAM_ALPHANUM);
+$groupingsettings->description= optional_param('description', PARAM_ALPHANUM);
+
+// Get the course information so we can print the header and
+// check the course id is valid
+$course = groups_get_course_info($courseid);
+if (! $course) {
+    $success = false;
+    print_error('The course ID is invalid');
+}
+
+if ($success) {
+    // Make sure that the user has permissions to manage groups.
+    require_login($courseid);
+
+    $context = get_context_instance(CONTEXT_COURSE, $courseid);
+    if (! has_capability('moodle/course:managegroups', $context)) {
+        redirect();
+    }
+    
+/// If data submitted, then process and store.
+
+    if ($frm = data_submitted() and confirm_sesskey()) { 
+
+        if (isset($frm->cancel)) {
+            redirect(groups_home_url($courseid, null, $groupingid, false));
+        }
+        elseif (empty($frm->name)) {
+            $err['name'] = get_string('missingname');
+        }
+        elseif (isset($frm->update)) {
+        
+            if ($groupingid) {
+                $success = (bool)groups_set_grouping_settings($groupingid, $groupingsettings);
+            }
+            else {
+                $success = (bool)$groupingid = groups_create_grouping($courseid, $groupingsettings);
+            }
+            if ($success) {
+                redirect(groups_home_url($courseid, null, $groupingid, false));
+            }
+            else {
+                print_error('Error creating/updating grouping.');
+            }
+        }
+    }
+
+/// OR, prepare the form.
+
+    if ($groupingid) {
+        // Form to edit existing grouping.
+        $grouping = groups_get_grouping_settings($groupingid);
+        if (! $grouping) {
+            print_error('errorinvalidgrouping', 'group', groups_home_url($courseid));
+        }
+        $strname = s($grouping->name);
+        $strdesc = s($grouping->description);
+
+        $strbutton  = get_string('save', 'group'); 
+        $strheading = get_string('editgroupingsettings', 'group');
+    } else {
+        // Form to create a new one.
+        $strname = get_string('defaultgroupingname', 'group');
+        $strdesc = '';
+        $strbutton = $strheading = get_string('creategrouping', 'group');
+    }
+    $strgroups = get_string('groups');
+    $strparticipants = get_string('participants');
+
+/// Print the page and form
+
+    print_header("$course->shortname: $strgroups", 
+                 "$course->fullname", 
+                 "<a href=\"$CFG->wwwroot/course/view.php?id=$courseid\">$course->shortname</a> ".
+                 "-> <a href=\"$CFG->wwwroot/user/index.php?id=$courseid\">$strparticipants</a> ".
+                 "-> $strgroups", '', '', true, '', user_login_string($course, $USER));
+
+    $usehtmleditor = false;
+?>
+<h3 class="main"><?php echo $strheading ?></h3>
+
+<form action="grouping.php" method="post" class="mform notmform" id="groupingform">
+<input type="hidden" name="sesskey" value="<?php p(sesskey()); ?>" />
+<input type="hidden" name="courseid" value="<?php p($courseid); ?>" />
+<?php
+    if ($groupingid) {
+        echo '<input type="hidden" name="grouping" value="'. $groupingid .'" />';
+    }
+?>
+
+<div class="f-item">
+<p><label for="groupingname"><?php print_string('groupingname', 'group'); ?>&nbsp;</label></p>
+<p><input id="groupingname" name="name" type="text" size="40" value="<?php echo $strname; ?>" /></p>
+</div>
+
+<p><label for="edit-description"><?php print_string('groupingdescription', 'group'); ?>&nbsp;</label></p>
+<p><?php print_textarea($usehtmleditor, 5, 45, 200, 400, 'description', $strdesc); ?></p>
+
+<p class="fitem">
+  <label for="id_submit">&nbsp;</label>
+  <span class="f-element fsubmit">
+    <input type="submit" name="update" id="id_submit" value="<?php echo $strbutton; ?>" />
+    <input type="submit" name="cancel" value="<?php print_string('cancel', 'group'); ?>" />
+  </span>
+</p>
+<span class="clearer">&nbsp;</span>
+
+</form>
+<?php
+    print_footer($course);
+}
+
+?>
diff --git a/group/install.php b/group/install.php
deleted file mode 100644 (file)
index c578b55..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-/**
- * Functions required for setting up the database to use the new groups.
- *
- * @copyright &copy; 2006 The Open University
- * @author J.White AT open.ac.uk
- * @author N.D.Freear@open.ac.uk
- * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
- * @package groups
- */
-require_once('../config.php');
-require_once($CFG->dirroot.'/group/db/dbsetup.php');
-require_once($CFG->dirroot.'/group/lib/utillib.php');
-
-// Set up the database 
-groups_create_database_tables();
-
-
-// Change database tables - course table need to remove two fields add groupingid field
-// Move everything over
-// Course module instance need to add groupingid field
-// Module table - add group support field. 
-// Add deletable by teacher field. 
-
-/**
- * Copies the moodle groups to a new grouping within IMS groups
- * @param int $courseid The id of the course
- * @return int The id of the grouping to which the groups have been copied, or false if an error occurred. 
- */
-function groups_copy_moodle_groups_to_groups($courseid) {
-    $groupingsettings = new Object();
-       $groupingsettings->name = 'Old moodle groups';
-       $groupingid = groups_create_grouping($courseid, $groupingsettings);
-
-       $groupids = groups_get_moodle_groups($courseid);
-       if (!$groupids) {
-               $groupingid = false;
-       } else {
-               
-               foreach($groupids as $groupid) {
-                       $groupcopied = groups_db_copy_moodle_group_to_imsgroup($groupid, $courseid);
-                       if (!$groupcopied) {
-                               $groupingid = false;
-                       }
-                       
-                       $groupadded = groups_add_group_to_grouping($groupid, $groupingid);
-                       if (!$groupadded) {
-                               $groupingid = false;
-                       }
-               }
-       }
-       
-       return $groupingid;
-}      
-
-?>
\ No newline at end of file
diff --git a/group/install.sql b/group/install.sql
deleted file mode 100644 (file)
index 22feae9..0000000
+++ /dev/null
@@ -1,199 +0,0 @@
--- phpMyAdmin SQL Dump
--- version 2.8.1
--- http://www.phpmyadmin.net
--- 
--- Host: localhost
--- Generation Time: Oct 24, 2006 at 05:23 PM
--- Server version: 5.0.21
--- PHP Version: 4.4.2-pl1
--- 
--- Database: `moodle`
--- 
-
--- --------------------------------------------------------
-
--- 
--- Table structure for table `mdl_course`
--- 
-
-CREATE TABLE `mdl_course` (
-  `id` int(10) unsigned NOT NULL auto_increment,
-  `category` int(10) unsigned NOT NULL default '0',
-  `sortorder` int(10) unsigned NOT NULL default '0',
-  `password` varchar(50) collate utf8_unicode_ci NOT NULL default '',
-  `fullname` varchar(254) collate utf8_unicode_ci NOT NULL default '',
-  `shortname` varchar(100) collate utf8_unicode_ci NOT NULL default '',
-  `idnumber` varchar(100) collate utf8_unicode_ci NOT NULL default '',
-  `summary` text collate utf8_unicode_ci NOT NULL,
-  `format` varchar(10) collate utf8_unicode_ci NOT NULL default 'topics',
-  `showgrades` smallint(2) unsigned NOT NULL default '1',
-  `modinfo` longtext collate utf8_unicode_ci NOT NULL,
-  `newsitems` smallint(5) unsigned NOT NULL default '1',
-  `teacher` varchar(100) collate utf8_unicode_ci NOT NULL default 'Teacher',
-  `teachers` varchar(100) collate utf8_unicode_ci NOT NULL default 'Teachers',
-  `student` varchar(100) collate utf8_unicode_ci NOT NULL default 'Student',
-  `students` varchar(100) collate utf8_unicode_ci NOT NULL default 'Students',
-  `guest` tinyint(2) unsigned NOT NULL default '0',
-  `startdate` int(10) unsigned NOT NULL default '0',
-  `enrolperiod` int(10) unsigned NOT NULL default '0',
-  `numsections` smallint(5) unsigned NOT NULL default '1',
-  `marker` int(10) unsigned NOT NULL default '0',
-  `maxbytes` int(10) unsigned NOT NULL default '0',
-  `showreports` int(4) unsigned NOT NULL default '0',
-  `visible` int(1) unsigned NOT NULL default '1',
-  `hiddensections` int(2) unsigned NOT NULL default '0',
-  `groupmode` int(4) unsigned NOT NULL default '0',
-  `groupmodeforce` int(4) unsigned NOT NULL default '0',
-  `lang` varchar(10) collate utf8_unicode_ci NOT NULL default '',
-  `theme` varchar(50) collate utf8_unicode_ci NOT NULL default '',
-  `cost` varchar(10) collate utf8_unicode_ci NOT NULL default '',
-  `currency` char(3) collate utf8_unicode_ci NOT NULL default 'USD',
-  `timecreated` int(10) unsigned NOT NULL default '0',
-  `timemodified` int(10) unsigned NOT NULL default '0',
-  `metacourse` int(1) unsigned NOT NULL default '0',
-  `requested` int(1) unsigned NOT NULL default '0',
-  `restrictmodules` int(1) unsigned NOT NULL default '0',
-  `expirynotify` tinyint(1) unsigned NOT NULL default '0',
-  `expirythreshold` int(10) unsigned NOT NULL default '0',
-  `notifystudents` tinyint(1) unsigned NOT NULL default '0',
-  `enrollable` tinyint(1) unsigned NOT NULL default '1',
-  `enrolstartdate` int(10) unsigned NOT NULL default '0',
-  `enrolenddate` int(10) unsigned NOT NULL default '0',
-  `enrol` varchar(20) collate utf8_unicode_ci NOT NULL default '',
-  PRIMARY KEY  (`id`),
-  KEY `category` (`category`),
-  KEY `idnumber` (`idnumber`),
-  KEY `shortname` (`shortname`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=7 ;
-
--- --------------------------------------------------------
-
--- 
--- Table structure for table `mdl_course_modules`
--- 
-
-CREATE TABLE `mdl_course_modules` (
-  `id` int(10) unsigned NOT NULL auto_increment,
-  `course` int(10) unsigned NOT NULL default '0',
-  `module` int(10) unsigned NOT NULL default '0',
-  `instance` int(10) unsigned NOT NULL default '0',
-  `section` int(10) unsigned NOT NULL default '0',
-  `added` int(10) unsigned NOT NULL default '0',
-  `score` tinyint(4) NOT NULL default '0',
-  `indent` int(5) unsigned NOT NULL default '0',
-  `visible` tinyint(1) NOT NULL default '1',
-  `visibleold` tinyint(1) NOT NULL default '1',
-  `groupingid` int(10) NOT NULL default '0',
-  PRIMARY KEY  (`id`),
-  UNIQUE KEY `id` (`id`),
-  KEY `visible` (`visible`),
-  KEY `course` (`course`),
-  KEY `module` (`module`),
-  KEY `instance` (`instance`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ;
-
--- --------------------------------------------------------
-
--- 
--- Table structure for table `mdl_groups_courses_groupings`
--- 
-
-CREATE TABLE `mdl_groups_courses_groupings` (
-  `id` int(10) unsigned NOT NULL auto_increment,
-  `courseid` int(10) unsigned NOT NULL default '0',
-  `groupingid` mediumint(9) NOT NULL,
-  PRIMARY KEY  (`id`),
-  UNIQUE KEY `id` (`id`),
-  KEY `courseid` (`courseid`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=87 ;
-
--- --------------------------------------------------------
-
--- 
--- Table structure for table `mdl_groups_courses_groups`
--- 
-
-CREATE TABLE `mdl_groups_courses_groups` (
-  `id` int(10) unsigned NOT NULL auto_increment,
-  `courseid` int(10) unsigned NOT NULL default '0',
-  `groupid` int(11) NOT NULL,
-  PRIMARY KEY  (`id`),
-  UNIQUE KEY `id` (`id`),
-  KEY `courseid` (`courseid`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=132 ;
-
--- --------------------------------------------------------
-
--- 
--- Table structure for table `mdl_groups_groupings`
--- 
-
-CREATE TABLE `mdl_groups_groupings` (
-  `id` int(10) unsigned NOT NULL auto_increment,
-  `name` varchar(254) character set latin1 collate latin1_general_ci NOT NULL default '',
-  `description` text character set latin1 collate latin1_general_ci NOT NULL,
-  `timecreated` int(10) unsigned NOT NULL default '0',
-  `viewowngroup` tinyint(1) NOT NULL,
-  `viewallgroupsmembers` tinyint(1) NOT NULL,
-  `viewallgroupsactivities` tinyint(1) NOT NULL,
-  `teachersgroupmark` tinyint(1) NOT NULL,
-  `teachersgroupview` binary(1) NOT NULL,
-  `teachersoverride` binary(1) NOT NULL,
-  `teacherdeletable` binary(1) NOT NULL,
-  PRIMARY KEY  (`id`),
-  UNIQUE KEY `id` (`id`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=87 ;
-
--- --------------------------------------------------------
-
--- 
--- Table structure for table `mdl_groups_groupings_groups`
--- 
-
-CREATE TABLE `mdl_groups_groupings_groups` (
-  `id` int(10) unsigned NOT NULL auto_increment,
-  `groupingid` int(10) unsigned default '0',
-  `groupid` int(10) NOT NULL,
-  `timecreated` int(10) unsigned NOT NULL default '0',
-  PRIMARY KEY  (`id`),
-  UNIQUE KEY `id` (`id`),
-  KEY `courseid` (`groupingid`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=67 ;
-
--- --------------------------------------------------------
-
--- 
--- Table structure for table `mdl_groups_groups`
--- 
-
-CREATE TABLE `mdl_groups_groups` (
-  `id` int(10) unsigned NOT NULL auto_increment,
-  `name` varchar(254) character set latin1 collate latin1_general_ci NOT NULL default '',
-  `description` text character set latin1 collate latin1_general_ci NOT NULL,
-  `enrolmentkey` varchar(50) character set latin1 collate latin1_general_ci NOT NULL default '',
-  `lang` varchar(10) character set latin1 collate latin1_general_ci NOT NULL default 'en',
-  `theme` varchar(50) character set latin1 collate latin1_general_ci NOT NULL default '',
-  `picture` int(10) unsigned NOT NULL default '0',
-  `hidepicture` int(1) unsigned NOT NULL default '0',
-  `timecreated` int(10) unsigned NOT NULL default '0',
-  `timemodified` int(10) unsigned NOT NULL default '0',
-  PRIMARY KEY  (`id`),
-  UNIQUE KEY `id` (`id`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=132 ;
-
--- --------------------------------------------------------
-
--- 
--- Table structure for table `mdl_groups_groups_users`
--- 
-
-CREATE TABLE `mdl_groups_groups_users` (
-  `id` int(10) unsigned NOT NULL auto_increment,
-  `groupid` int(10) unsigned NOT NULL default '0',
-  `userid` int(10) unsigned NOT NULL default '0',
-  `timeadded` int(10) unsigned NOT NULL default '0',
-  PRIMARY KEY  (`id`),
-  UNIQUE KEY `id` (`id`),
-  KEY `groupid` (`groupid`),
-  KEY `userid` (`userid`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=175 ;
diff --git a/group/lib.php b/group/lib.php
new file mode 100644 (file)
index 0000000..d01b021
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Library including new groups and groupings.
+ *
+ * @copyright &copy; 2006 The Open University
+ * @author J.White AT open.ac.uk
+ * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
+ * @package groups
+ */
+
+require_once($CFG->dirroot.'/group/lib/basicgrouplib.php');
+
+require_once($CFG->dirroot.'/group/lib/groupinglib.php');
+
+require_once($CFG->dirroot.'/group/lib/utillib.php');
+
+require_once($CFG->dirroot.'/group/lib/automaticgroupinglib.php');
+
+require_once($CFG->dirroot.'/group/lib/legacylib.php');
+
+?>
index 02e005c25f5802f20ad524be9aa95546db5be669..18bf935a31151a82c9a837f7745d9bec1c404ea8 100644 (file)
@@ -28,10 +28,10 @@ require_once($CFG->dirroot.'/group/db/dbbasicgrouplib.php');
  *****************************/
 
 /**
- * Gets a list of the group ids for a specified course id 
- * @param int $courseid The id of the course. 
- * @return array | false Returns an array of the userids or false if no records
- * or an error occurred. 
+ * Gets a list of the group IDs for a specified course.
+ * @param int $courseid The id of the course.
+ * @return array | false Returns an array of the group IDs or false if no records
+ * or an error occurred.
  */
 function groups_get_groups($courseid) {
        $groupids = groups_db_get_groups($courseid);
@@ -50,6 +50,7 @@ function groups_get_groups($courseid) {
  */
 function groups_get_members($groupid, $membertype = false) {
        $userids = groups_db_get_members($groupid);
+
     return $userids;
 }
 
@@ -67,6 +68,19 @@ function groups_get_groups_for_user($userid, $courseid) {
     return $groupids;
 }
 
+function groups_get_all_groups_for_user($userid) {
+    $groups = get_records('groups_members', 'userid', $userid);
+    if (! $groups) {
+        return false;
+    }
+    // Put the results into an array
+    $groupids = array();
+    foreach ($groups as $group) {
+        array_push($groupids, $group->id);    
+    }
+    return $groupids;
+}
+
 /**
  * Gets the groups for the current user and specified course 
  * @param int $courseid The id of the course
@@ -89,8 +103,8 @@ function groups_get_groups_for_current_user($courseid) {
  * @param int $groupid The id of the gruop
  * @return object The group settings object 
  */
-function groups_get_group_settings($groupid) {
-       return groups_db_get_group_settings($groupid);
+function groups_get_group_settings($groupid, $courseid=false) {
+       return groups_db_get_group_settings($groupid, $courseid);
 }
 
 /**
@@ -100,8 +114,8 @@ function groups_get_group_settings($groupid) {
  * @return string The path of the image for the group
  */
 function groups_get_group_image_path($groupid) {
-    $image = ''; //TODO: ??
-       return $CFG->dataroot.'/groups/'.$groupid.'/'.$image;
+    //TODO: groupid=1, /user/pixgroup.php/1/f1.jpg ??
+       return $CFG->wwwroot.'/pixgroup.php/'.$groupid.'/f1.jpg';
 }
 
 /**
@@ -111,7 +125,10 @@ function groups_get_group_image_path($groupid) {
  */
 function groups_get_group_name($groupid) {
        $settings = groups_get_group_settings($groupid);
-       return $settings->name;
+       if ($settings) {
+        return $settings->name;
+    }
+    return false;
 }
 
 /**
@@ -168,8 +185,9 @@ function groups_group_exists($groupid) {
  * @return boolean True if the user is a member of the group, false otherwise
  */
  function groups_is_member($groupid, $userid) { 
-       $ismember = groups_db_is_member($groupid, $userid);
-       return $ismember;
+    $ismember = groups_db_is_member($groupid, $userid);
+    
+    return $ismember;
 }
 
 
@@ -254,7 +272,7 @@ function groups_create_group($courseid, $groupsettings = false) {
  * @return boolean True if info was added successfully, false otherwise. 
  */
 function groups_set_group_settings($groupid, $groupsettings) { 
-       return  groups_db_set_group_settings($groupid, $groupsettings);
+       return groups_db_set_group_settings($groupid, $groupsettings);
 }
 
 
@@ -277,7 +295,9 @@ function groups_add_member($groupid, $userid) {
     } else {
                $useradded = groups_db_add_member($groupid, $userid);
     }
-
+    if ($useradded) {
+        $useradded = groups_db_set_group_modified($groupid);
+    }
        return $useradded;
 }
 
@@ -294,11 +314,22 @@ function groups_add_member($groupid, $userid) {
  * See comment above on web service autoupdating. 
  */
 function groups_delete_group($groupid) {
-       $groupdeleted = groups_db_delete_group($groupid);
+    $groupdeleted = groups_db_delete_group($groupid);
 
     return $groupdeleted;
 }
 
+/*function groups_delete_groups($groupids) {
+    if (! $groupids) {
+        return false;
+    }
+    $success = true;
+    foreach ($groupids as $id) {
+        $success = $success && groups_db_delete_group($id);
+    }
+    return $success;
+}*/
+
 
 /**
  * Deletes the specified user from the specified group
@@ -308,7 +339,29 @@ function groups_delete_group($groupid) {
  * See comment above on web service autoupdating. 
  */
 function groups_remove_member($groupid, $userid) {
-       return  groups_db_remove_member($groupid, $userid);
+       $success = groups_db_remove_member($groupid, $userid);    
+    if ($success) {
+        $success = groups_db_set_group_modified($groupid);
+    }
+    return $success;
+}
+
+function groups_remove_all_members($groupid) {
+    if (! groups_group_exists($groupid)) {
+        //Woops, delete group last!
+        return false;
+    }
+    $userids = groups_get_members($groupid);
+    if (! $userids) {
+        return false;
+    }
+    $success = true;
+    foreach ($userids as $id) {
+        $success = $success && groups_db_remove_member($groupid, $id);
+    }
+    $success = $success && groups_db_set_group_modified($groupid);
+    return $success;
 }
 
+
 ?>
\ No newline at end of file
index 48eb8634fd0b5560654ed41dede456d824f581d5..59eac11202d3857ee6d4186c198e1f5b04351745 100644 (file)
@@ -12,6 +12,7 @@
 require_once($CFG->dirroot.'/group/lib/basicgrouplib.php');
 require_once($CFG->dirroot.'/group/db/dbgroupinglib.php');
 
+define('GROUP_NOT_IN_GROUPING', -1);
 
 /*****************************
         Access/List functions  
@@ -73,7 +74,7 @@ function groups_get_groups_for_user_in_grouping($userid, $groupingid) {
 }
 
 /**
- * Gets a list of the groups not a specified grouping
+ * Gets a list of the groups not in a specified grouping
  * @param int $groupingid The grouping specified
  * @return array An array of the group ids
  */
@@ -88,6 +89,33 @@ function groups_get_groups_not_in_grouping($groupingid, $courseid) {
     return $groupids;
 }
 
+/**
+ * TODO: move to dbgroupinglib.php
+ */
+function groups_get_groups_not_in_any_grouping($courseid) {
+    global $CFG;
+/* SELECT g.id
+     FROM headmdl_groups AS g
+     WHERE g.id NOT IN 
+       (SELECT groupid FROM headmdl_groups_groupings_groups);
+*/
+    $sql = "SELECT g.id
+        FROM {$CFG->prefix}groups AS g
+        WHERE g.id NOT IN 
+        (SELECT groupid FROM {$CFG->prefix}groups_groupings_groups)";
+
+    $records = get_records_sql($sql);
+    $groupids = array();
+    if ($records) {
+        foreach ($records as $r) {
+            $groupids[] = $r->id;
+        }
+    } else {
+        return false;
+    }
+    return $groupids;
+}
+
 /**
  * Gets the users for the course who are not in any group of a grouping.
  * @param int $courseid The id of the course
@@ -101,19 +129,18 @@ function groups_get_users_not_in_any_group_in_grouping($courseid, $groupingid,
        $users = get_course_users($courseid);
     $userids = groups_users_to_userids($users); 
     $nongroupmembers = array();
-    if ($userids) {
-           foreach($userids as $userid) {
-               if (!groups_is_member_of_some_group_in_grouping($userid, 
-                                                               $groupingid)) {
-                       // If a group has been specified don't include members of that 
-                       // group
-                       if ($groupid  and !groups_is_member($userid, $groupid)) {
-                       array_push($nongroupmembers, $userid);
-                       } else {
-                               array_push($nongroupmembers, $userid);
-                       }
-               }
-           }
+    if (! $userids) {
+        return $nongroupmembers;
+    }
+    foreach($userids as $userid) {
+           if (!groups_is_member_of_some_group_in_grouping($userid, $groupingid)) {
+               // If a group has been specified don't include members of that group
+               if ($groupid  and !groups_is_member($userid, $groupid)) {
+                       array_push($nongroupmembers, $userid);
+               } else {
+                       ///array_push($nongroupmembers, $userid);
+               }
+        }
     }
     return $nongroupmembers;
 }
@@ -282,7 +309,10 @@ function groups_create_grouping($courseid, $groupingsettings = false) {
  * doesn't belong to the same course as the grouping. 
  */
 function groups_add_group_to_grouping($groupid, $groupingid) {
-       $belongstogrouping = groups_belongs_to_grouping($groupid, $groupingid);
+       if (GROUP_NOT_IN_GROUPING == $groupingid) {
+        return false;
+    }
+    $belongstogrouping = groups_belongs_to_grouping($groupid, $groupingid);
        if (!groups_grouping_exists($groupingid)) {
                $groupadded = false;
        } elseif (!$belongstogrouping) {
index a18e8e6e3a8b4cfdedf5b3e9d08f8a5b66d751ac..2b616316ec005152853b2413a126112480b4ef05 100644 (file)
@@ -1,9 +1,13 @@
 <?php
 /**
- * Legacy groups functions - these were in moodlelib.php.
+ * Legacy groups functions - these were in moodlelib.php, datalib.php, weblib.php
  *
  * @@@ Don't look at this file - still tons to do! 
  *
+ * TODO: For the moment these functions are in /lib/deprecatedlib.php
+ *   get_group_students
+ *   get_group_teachers
+ *
  * @copyright &copy; 2006 The Open University
  * @author J.White AT open.ac.uk and others
  * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
  * This is needed to support upload of users into the database
  * @param int $courseid The id of the course
  * @param string $groupname
- * @return int $groupname
+ * @return int $groupid
  */
 function groups_get_group_by_name($courseid, $groupname) {
-       // TO DO                                 
+       //uploaduser.php, get_record("groups","courseid",$course[$i]->id,"name",$addgroup[$i])
+    $groupids = groups_db_get_groups($courseid);
+    if (! $groupids) {
+        return false;
+    }
+    foreach ($groupids as $id) {
+        if (groups_get_group_name($id) == $groupname) {
+            return $id;
+        }
+    }
+    return false;
 }
 
 /**
@@ -41,8 +55,8 @@ function get_groups($courseid, $userid=0) {
        } else {
                $groupids = groups_get_groups($courseid);
        }
-       
-       return groups_groupids_to_groups($groupids);
+
+       return groups_groupids_to_groups($groupids, $courseid);
 }
 
 
@@ -110,68 +124,6 @@ function get_group_users($groupid, $sort='u.lastaccess DESC', $exceptions='',
 
 
 
-/**
- * Returns an array of user objects
- *
- * @uses $CFG
- * @param int $groupid The group(s) in question.
- * @param string $sort How to sort the results
- * @return object (changed to groupids)
- */
-function get_group_students($groupids, $sort='u.lastaccess DESC') {
-
-    global $CFG;
-
-    if (is_array($groupids)){
-        $groups = $groupids;
-        $groupstr = '(m.groupid = '.array_shift($groups);
-        foreach ($groups as $index => $value){
-            $groupstr .= ' OR m.groupid = '.$value;
-        }
-        $groupstr .= ')';
-    }
-    else {
-        $groupstr = 'm.groupid = '.$groupids;
-    }
-
-    return get_records_sql("SELECT DISTINCT u.*
-                              FROM {$CFG->prefix}user u,
-                                   {$CFG->prefix}groups_members m,
-                                   {$CFG->prefix}groups g,
-                                   {$CFG->prefix}user_students s
-                             WHERE $groupstr
-                               AND m.userid = u.id
-                               AND m.groupid = g.id
-                               AND g.courseid = s.course
-                               AND s.userid = u.id
-                          ORDER BY $sort");
-}
-
-/**
- * Returns list of all the teachers who can access a group
- *
- * @uses $CFG
- * @param int $courseid The course in question.
- * @param int $groupid The group in question.
- * @return object
- */
-function get_group_teachers($courseid, $groupid) {
-/// Returns a list of all the teachers who can access a group
-    if ($teachers = get_course_teachers($courseid)) {
-        foreach ($teachers as $key => $teacher) {
-            if ($teacher->editall) {             // These can access anything
-                continue;
-            }
-            if (($teacher->authority > 0) and ismember($groupid, $teacher->id)) 
-            {  // Specific group teachers
-                continue;
-            }
-            unset($teachers[$key]);
-        }
-    }
-    return $teachers;
-}
-
 
 /**
  * Add a user to a group, return true upon success or if user already a group 
@@ -187,18 +139,17 @@ function add_user_to_group($groupid, $userid) {
 
 
 /**
- * Get the group ID of the current user in the given course
+ * Get the IDs for the user's groups in the given course.
  *
  * @uses $USER
- * @param int $courseid The course being examined - relates to id field in 
- * 'course' table.
- * @return array An array of the groupids that the user belongs to. 
+ * @param int $courseid The course being examined - the 'course' table id field.
+ * @return array An _array_ of groupids.
+ * (Was return $groupids[0] - consequences!)
  */
 function mygroupid($courseid) {
     global $USER;
-       // TODO: check whether needs to be groups or groupids. 
        $groupids = groups_get_groups_for_user($USER->id, $courseid);
-       return $groupids[0];
+       return $groupids;
 }
 
 /**
@@ -207,12 +158,17 @@ function mygroupid($courseid) {
  */
 function groupmode($course, $cm=null) {
 
-    if ($cm and !$course->groupingid) {
+    if ($cm and !$course->groupmodeforce) {
+        return $cm->groupmode;
+    }
+    return $course->groupmode;
+    
+    /*if ($cm and !$course->groupingid) {
         //TODO: was $coursemodule
         return groups_has_groups_setup_for_instance($cm);
     } else {
        return groups_has_groups_setup($course->id);
-    }
+    }*/
 }
 
 
@@ -245,15 +201,20 @@ function set_current_group($courseid, $groupid) {
  */
 function get_current_group($courseid, $full = false) {
     global $SESSION;
-    
+
+    $mygroupid = mygroupid($courseid);
+    if (is_array($mygroupid)) {
+        $mygroupid = array_shift($mygroupid);
+    }
+
     if (isset($SESSION->currentgroup[$courseid])) {
        $currentgroup = $SESSION->currentgroup[$courseid];
     } else {
-       $currentgroup = mygroupid($courseid);
+       $currentgroup = $mygroupid;
     }
     
     if ($currentgroup) {
-       $SESSION->currentgroup[$courseid] = mygroupid($courseid);
+       $SESSION->currentgroup[$courseid] = $mygroupid;
     }
 
     if ($full) {
@@ -294,19 +255,19 @@ function get_and_set_current_group($course, $groupmode, $groupid=-1) {
 
     $context = get_context_instance(CONTEXT_COURSE, $course->id);
     if ($groupid) {      // Try to change the current group to this groupid
-        if ($group = get_record('groups', 'id', $groupid, 'courseid', $course->id)) { // Exists
+        if (groups_group_belongs_to_course($groupid, $course->id)) { // Exists  TODO:check.
             if (has_capability('moodle/site:accessallgroups', $context)) {  // Sets current default group
-                $currentgroupid = set_current_group($course->id, $group->id);
+                $currentgroupid = set_current_group($course->id, $groupid);
 
             } elseif ($groupmode == VISIBLEGROUPS) {
                   // All groups are visible
                 //if (ismember($group->id)){
-                    $currentgroupid = set_current_group($course->id, $group->id); //set this since he might post
+                    $currentgroupid = set_current_group($course->id, $groupid); //set this since he might post
                 /*)}else {
                     $currentgroupid = $group->id;*/
             } elseif ($groupmode == SEPARATEGROUPS) { // student in separate groups switching
                 if (ismember($group->id)) { //check if is a member
-                    $currentgroupid = set_current_group($course->id, $group->id); //might need to set_current_group?
+                    $currentgroupid = set_current_group($course->id, $groupid); //might need to set_current_group?
                 }
                 else {
                     echo($group->id);
@@ -362,7 +323,7 @@ function setup_and_print_groups($course, $groupmode, $urlroot) {
         groups_instance_print_grouping_selector();
     }//added code here to allow non-editting teacher to swap in-between his own groups
     //added code for students in separategrous to swtich groups
-    else if ($groupmode == SEPARATEGROUPS and (isteacher($course->id) or isstudent($course->id))) {
+    else if ($groupmode == SEPARATEGROUPS and has_capability('moodle/course:view', $context)) {
         groups_instance_print_group_selector();
     }
 
@@ -370,6 +331,14 @@ function setup_and_print_groups($course, $groupmode, $urlroot) {
 }
 
 
+function groups_instance_print_grouping_selector() {
+    //TODO: ??
+}
+function groups_instance_print_group_selector() {
+    //TODO: ??
+}
+
+
 function oldgroups_print_user_group_info($currentgroup, $isseparategroups, $courseid) {
        global $CFG;
        $context = get_context_instance(CONTEXT_COURSE, $courseid);
@@ -394,4 +363,50 @@ function oldgroups_print_user_group_info($currentgroup, $isseparategroups, $cour
     }
 }
 
+/**
+ * Get the group object, including the course ID by default.
+ * @param groupid ID of the group.
+ * @param getcourse (default true), include the course ID in the return.
+ * @return group object, optionally including 'courseid'.
+ */
+function groups_get_group($groupid, $getcourse=true) {
+    $group = groups_db_get_group_settings($groupid);
+    if ($group && $getcourse) {
+        $group->courseid = groups_get_course($groupid);
+    }
+    return $group;
+}
+
+
+/**
+ * Get an array of groups, as id => name.
+ * Replaces, get_records_menu("groups", "courseid", $course->id, "name ASC", "id,name")
+ * (For /user/index.php)
+ */
+function groups_get_groups_names($courseid) {
+    $groupids = groups_db_get_groups($courseid);
+    if (! $groupids) {
+        return false;
+    }
+    $groups_names = array();
+    foreach ($groupids as $id) {
+        $groups_names[$id] = groups_get_group_name($id);
+    }
+//TODO: sort. SQL?
+    return $groups_names;
+}
+
+/**
+ * Get the groups that a number of users are in.
+ * (For block_quiz_results.php)
+ */
+function groups_get_groups_users($userids, $courseid) {
+    global $CFG;
+    $groups_users = get_records_sql(
+        'SELECT gm.userid, gm.groupid, g.name FROM '.$CFG->prefix.'groups g LEFT JOIN '.$CFG->prefix.'groups_members gm ON g.id = gm.groupid '.
+        'WHERE g.courseid = '.$courseid.' AND gm.userid IN ('.implode(',', $userids).')'
+        );
+    return $groups_users;
+}
+
 ?>
\ No newline at end of file
index dffb55ca93ef23adc69a10a124c56157838a45a4..a2008ba635ae4db23b331fbefa486d8dd4fd791d 100644 (file)
@@ -106,6 +106,9 @@ function groups_get_group_displayname($groupid) {
  * @return string The display name of the grouping
  */
 function groups_get_grouping_displayname($groupingid) {
+    if (GROUP_NOT_IN_GROUPING == $groupingid) {
+        return get_string('notingrouping', 'group');
+    }    
        $groupingsettings = groups_get_grouping_settings($groupingid);
     if ($groupingsettings) {   
         $groupingname = $groupingsettings->name;
@@ -152,8 +155,19 @@ function groups_groups_to_groupids($groups) {
 function groups_groupid_to_group($groupid) {
 }
 
-// @@@ TO DO 
-function groups_groupids_to_groups($groupids) {
+/**
+ * Given an array of group IDs get an array of group objects.
+ * TODO: quick and dirty. Replace with SQL?
+ */
+function groups_groupids_to_groups($groupids, $courseid=false) {
+    if (! $groupids) {
+        return false;
+    }
+    $groups = array();
+    foreach ($groupids as $id) {
+        $groups[] = groups_get_group_settings($id, $courseid);
+    }
+    return $groups;
 }
 
 
@@ -196,4 +210,68 @@ function groups_get_course($groupid) {
     return false;
 }
 
+/**
+ * Return the address for the group settings page.
+ * (For /user/index.php etc.)
+ * @param $courseid
+ * @param $groupid
+ * @param $groupingid Optional grouping ID
+ * @param $html True for HTML pages, eg. on error. False for HTTP redirects.
+ * @param $param Extra parameters.
+ */
+function groups_group_edit_url($courseid, $groupid, $groupingid=false, $html=true, $param=false) {
+    global $CFG;
+    $html ? $sep = '&amp;' : $sep = '&';
+    $url = $CFG->wwwroot.'/group/group.php?courseid='.$courseid;
+    if ($groupid) {
+        $url .= $sep.'group='.$groupid;
+    }
+    if ($groupingid) {
+        $url .= $sep.'grouping='.$groupingid;
+    }
+    if ($param) {
+        $url .= $sep.$param;
+    }
+    return $url;
+}
+
+/** Internal use only. */
+function groups_grouping_edit_url($courseid, $groupingid=false, $html=true) {
+    global $CFG;
+    $html ? $sep = '&amp;' : $sep = '&';
+    $url = $CFG->wwwroot.'/group/grouping.php?courseid='.$courseid;
+    if ($groupingid) {
+        $url .= $sep.'grouping='.$groupingid;
+    }
+    return $url;
+}
+
+/** Internal use only. */
+function groups_members_add_url($courseid, $groupid, $groupingid=false, $html=true) {
+    global $CFG;
+    $html ? $sep = '&amp;' : $sep = '&';
+    $url = $CFG->wwwroot.'/group/assign.php?courseid='.$courseid.$sep.'group='.$groupid;
+    if ($groupingid) {
+        $url .= $sep.'grouping='.$groupingid;
+    }
+    return $url;
+}
+
+/**
+ * Return the address for the main group management page.
+ * (For admin block.)
+ */
+function groups_home_url($courseid, $groupid=false, $groupingid=false, $html=true) {
+    global $CFG;
+    $html ? $sep = '&amp;' : $sep = '&';
+    $url = $CFG->wwwroot.'/group/index.php?id='.$courseid;
+    if ($groupid) {
+        $url .= $sep.'group='.$groupid;
+    }
+    if ($groupingid) {
+        $url .= $sep.'grouping='.$groupingid;
+    }
+    return $url;
+}
+
 ?>
\ No newline at end of file
index 08e5650b4b4a4481e5a49827769993f01896cad4..d753206d061abfecd9ddb56e845c1808aa0deddc 100644 (file)
@@ -5,7 +5,7 @@
  * /admin/report/simpletest/index.php?showpasses=1&showsearch=1&path=course%2Fgroups
  *
  * @copyright &copy; 2006 The Open University
- * @author N.D.Freear@open.ac.uk
+ * @author N.D.Freear AT open.ac.uk
  * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
  * @package groups
  *
@@ -25,6 +25,12 @@ class basicgrouplib_test extends UnitTestCase {
     var $userid_2= 0;
     var $groupid = 0;
 
+    function __construct() {
+       parent::UnitTestCase();
+
+       groups_create_role();   
+    }
+
     function test_get_user() {
         $this->assertTrue($user = groups_get_user(2)); //Primary admin.
         if (isset($user)) {
@@ -53,6 +59,7 @@ class basicgrouplib_test extends UnitTestCase {
         $groupinfo->name = 'Group '. $this->getLabel();  //'Temporary Group Name'
         $this->assertTrue(groups_set_group_settings($this->groupid, $groupinfo));
         $this->assertTrue($groupinfo->name == groups_get_group_name($this->groupid));
+        $this->assertTrue($this->courseid == groups_get_course($this->groupid));
     }
 
     function test_add_member() {
index 56ce99f7650622202d694141ee38c4f9838930fd..04881e6957b12270572dc399ced2397092c1c16e 100644 (file)
@@ -3,7 +3,7 @@
  * Unit tests for new Moodle Groups - groupinglib.php
  *
  * @copyright &copy; 2006 The Open University
- * @author N.D.Freear@open.ac.uk
+ * @author N.D.Freear AT open.ac.uk
  * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
  * @package groups
  */
diff --git a/group/version.php b/group/version.php
new file mode 100644 (file)
index 0000000..6efb625
--- /dev/null
@@ -0,0 +1,11 @@
+<?php
+
+////////////////////////////////////////////////////////////////////////////////
+//  Code fragment to define the group version etc.
+//  This fragment is called by /admin/index.php
+////////////////////////////////////////////////////////////////////////////////
+
+$group_version  = 2006120401;
+//$module->requires = 2006120400;  // Requires this Moodle version
+
+?>
index 32ae88948b223be1de071d890fabaf5b712707ea..e8df7c97cd513f0adc73df8c75fd759fb598f9c7 100644 (file)
@@ -1,4 +1,18 @@
 <?php
+/**
+ * Language strings for new Moodle Groups (cvs:/group/) 
+ *
+ * @copyright &copy; 2006 The Open University
+ * @author J.White AT open.ac.uk
+ * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
+ * @package groups
+ */
+
+$string['groupmember'] = 'Group Member';
+$string['groupmemberdesc'] = 'Standard role for a member of a group.';
+$string['notingrouping'] = '[Not in a grouping]';
+
+$string['errornotingrouping'] = 'Sorry, you can\'t create a group in $a';
 
 $string['groupings'] = 'Groupings';
 $string['grouping'] = 'Grouping';
@@ -22,7 +36,7 @@ $string['addexistinggroupstogrouping'] = 'Add existing groups to grouping';
 $string['addgroupstogrouping'] = 'Add groups to grouping';
 
 $string['removeselectedusers'] = 'Remove selected users';
-$string['adduserstogroup'] = 'Add users to group';
+$string['adduserstogroup'] = 'Add/remove users from group'; //'Add users to group';
 
 $string['groupingname'] = 'Grouping name';
 $string['defaultgroupingname'] = 'Grouping';
@@ -52,9 +66,9 @@ $string['displaygrouping'] = 'Display grouping';
 $string['addgroupstogrouping'] = 'Add groups to grouping';
 $string['showusersalreadyingroup'] = 'Show users already in a group in the grouping';
 
-$string ['save'] = 'Save';
+$string['save'] = 'Save';
 $string['cancel'] = 'Cancel';
-
+$string['return'] = 'Return';
 
 $string['groupfor'] = "for group";
 $string['groupinfo'] = 'Info about selected group';
diff --git a/lang/en_utf8/help/lesson/deleteattempts.html b/lang/en_utf8/help/lesson/deleteattempts.html
new file mode 100644 (file)
index 0000000..821e4a3
--- /dev/null
@@ -0,0 +1,3 @@
+<p align="center"><b>Delete student attempts for this lesson (user id)</b></p>
+
+<p>Type a username in here and click "Save Changes" to delete all attempts and grades for that user.</p>
\ No newline at end of file
index 33d5f8f5d674aef92f1c9817ed638ca1802fe03c..32f13680228597e7e7556da7540ee3e87ad77a4d 100755 (executable)
@@ -37,6 +37,7 @@ define('RISK_XSS',         0x0004);
 define('RISK_PERSONAL',    0x0008);
 define('RISK_SPAM',        0x0010);
 
+require_once($CFG->dirroot.'/group/lib.php');
 
 $context_cache    = array();    // Cache of all used context objects for performance (by level and instance)
 $context_cache_id = array();    // Index to above cache by id
@@ -442,8 +443,8 @@ function has_capability($capability, $context=NULL, $userid=NULL, $doanything=tr
 
             case CONTEXT_GROUP:
                 // Find course.
-                $group = get_record('groups','id',$context->instanceid);
-                $courseinstance = get_context_instance(CONTEXT_COURSE, $group->courseid);
+                $courseid = groups_get_course($context->instanceid);
+                $courseinstance = get_context_instance(CONTEXT_COURSE, $courseid);
 
                 $parentcats = get_parent_cats($courseinstance, CONTEXT_COURSE);
                 foreach ($parentcats as $parentcat) {
@@ -601,8 +602,8 @@ function capability_search($capability, $context, $capabilities, $switchroleacti
         break;
 
         case CONTEXT_GROUP: // 1 to 1 to course
-            $group = get_record('groups','id',$context->instanceid);
-            $parentcontext = get_context_instance(CONTEXT_COURSE, $group->courseid);
+            $courseid = groups_get_course($context->instanceid);
+            $parentcontext = get_context_instance(CONTEXT_COURSE, $courseid);
             $permission = capability_search($capability, $parentcontext, $capabilities);
         break;
 
@@ -1150,10 +1151,10 @@ function capability_prohibits($capability, $context, $sum='', $array='') {
 
         case CONTEXT_GROUP:
             // 1 to 1 to course.
-            if (!$group = get_record('groups','id',$context->instanceid)) {
+            if (!$courseid = groups_get_course($context->instanceid)) {
                 return false;
             }
-            $parent = get_context_instance(CONTEXT_COURSE, $group->courseid);
+            $parent = get_context_instance(CONTEXT_COURSE, $courseid);
             return capability_prohibits($capability, $parent);
         break;
 
@@ -1528,7 +1529,8 @@ function validate_context($contextlevel, $instanceid) {
             return (boolean)count_records('course', 'id', $instanceid);
 
         case CONTEXT_GROUP:
-            return (boolean)count_records('groups', 'id', $instanceid);
+            //return (boolean)count_records('groups_groups', 'id', $instanceid); //TODO:DONOTCOMMIT:
+            return groups_group_exists($instanceid);
 
         case CONTEXT_MODULE:
             return (boolean)count_records('course_modules', 'id', $instanceid);
@@ -1858,7 +1860,7 @@ function role_assign($roleid, $userid, $groupid, $contextid, $timestart=0, $time
         return false;
     }
 
-    if ($groupid && !record_exists('groups', 'id', $groupid)) {
+    if ($groupid && !groups_group_exists($groupid)) {
         debugging('Group ID '.intval($groupid).' does not exist!');
         return false;
     }
@@ -2337,8 +2339,8 @@ function print_context_name($context) {
             break;
 
         case CONTEXT_GROUP: // 1 to 1 to course
-            if ($group = get_record('groups', 'id', $context->instanceid)) {
-                $name = get_string('group').': '.$group->name;
+            if ($name = groups_get_group_name($context->instanceid)) {
+                $name = get_string('group').': '. $name;
             }
             break;
 
@@ -2598,7 +2600,7 @@ function get_parent_contexts($context) {
         break;
 
         case CONTEXT_GROUP: // 1 to 1 to course
-            if (!$group = get_record('groups','id',$context->instanceid)) {
+            if (! $group = groups_get_group($context->instanceid)) {
                 return array();
             }
             if ($parent = get_context_instance(CONTEXT_COURSE, $group->courseid)) {
@@ -3374,4 +3376,4 @@ function user_has_role_assignment($userid, $roleid, $contextid=0) {
         return record_exists('role_assignments', 'userid', $userid, 'roleid', $roleid);
     }
 }
-?>
+?>
\ No newline at end of file
diff --git a/lib/adodb/adodb-connection.inc.php b/lib/adodb/adodb-connection.inc.php
deleted file mode 100644 (file)
index 8d6d540..0000000
+++ /dev/null
@@ -1,1787 +0,0 @@
-<?php
-/** 
- * @version V3.40 7 April 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.
- * Released under both BSD license and Lesser GPL library license. 
- * Whenever there is any discrepancy between the two licenses, 
- * the BSD license will take precedence. 
- *
- * Set tabs to 4 for best viewing.
- * 
- * Latest version is available at http://php.weblogs.com
- *
- */
-
-    
-    function ADODB_TransMonitor($dbms, $fn, $errno, $errmsg, $p1, $p2, &$thisConnection)
-    {
-        /* print "Errorno ($fn errno=$errno m=$errmsg) "; */
-        
-        $thisConnection->_transOK = false;
-        if ($thisConnection->_oldRaiseFn) {
-            $fn = $thisConnection->_oldRaiseFn;
-            $fn($dbms, $fn, $errno, $errmsg, $p1, $p2,$thisConnection);
-        }
-    }
-    
-    
-    /**
-     * Connection object. For connecting to databases, and executing queries.
-     */ 
-    class ADOConnection {
-    /*  */
-    /*  PUBLIC VARS  */
-    /*  */
-    var $dataProvider = 'native';
-    var $databaseType = '';     /* / RDBMS currently in use, eg. odbc, mysql, mssql                 */
-    var $database = '';         /* / Name of database to be used.   */
-    var $host = '';         /* / The hostname of the database server    */
-    var $user = '';         /* / The username which is used to connect to the database server.  */
-    var $password = '';     /* / Password for the username. For security, we no longer store it. */
-    var $debug = false;     /* / if set to true will output sql statements */
-    var $maxblobsize = 256000;  /* / maximum size of blobs or large text fields -- some databases die otherwise like foxpro */
-    var $concat_operator = '+'; /* / default concat operator -- change to || for Oracle/Interbase       */
-    var $fmtDate = "'Y-m-d'";   /* / used by DBDate() as the default date format used by the database */
-    var $fmtTimeStamp = "'Y-m-d, h:i:s A'"; /* / used by DBTimeStamp as the default timestamp fmt. */
-    var $true = '1';            /* / string that represents TRUE for a database */
-    var $false = '0';           /* / string that represents FALSE for a database */
-    var $replaceQuote = "\\'";  /* / string to use to replace quotes */
-    var $charSet=false;     /* / character set to use - only for interbase */
-    var $metaTablesSQL = '';
-    /* -- */
-    var $hasInsertID = false;       /* / supports autoincrement ID? */
-    var $hasAffectedRows = false;   /* / supports affected rows for update/delete? */
-    var $hasTop = false;            /* / support mssql/access SELECT TOP 10 * FROM TABLE */
-    var $hasLimit = false;          /* / support pgsql/mysql SELECT * FROM TABLE LIMIT 10 */
-    var $readOnly = false;          /* / this is a readonly database - used by phpLens */
-    var $hasMoveFirst = false;  /* / has ability to run MoveFirst(), scrolling backwards */
-    var $hasGenID = false;      /* / can generate sequences using GenID(); */
-    var $hasTransactions = true; /* / has transactions */
-    /* -- */
-    var $genID = 0;         /* / sequence id used by GenID(); */
-    var $raiseErrorFn = false;  /* / error function to call */
-    var $upperCase = false; /* / uppercase function to call for searching/where */
-    var $isoDates = false; /* / accepts dates in ISO format */
-    var $cacheSecs = 3600; /* / cache for 1 hour */
-    var $sysDate = false; /* / name of function that returns the current date */
-    var $sysTimeStamp = false; /* / name of function that returns the current timestamp */
-    var $arrayClass = 'ADORecordSet_array'; /* / name of class used to generate array recordsets, which are pre-downloaded recordsets */
-    
-    var $noNullStrings = false; /* / oracle specific stuff - if true ensures that '' is converted to ' ' */
-    var $numCacheHits = 0; 
-    var $numCacheMisses = 0;
-    var $pageExecuteCountRows = true;
-    var $uniqueSort = false; /* / indicates that all fields in order by must be unique */
-    var $leftOuter = false; /* / operator to use for left outer join in WHERE clause */
-    var $rightOuter = false; /* / operator to use for right outer join in WHERE clause */
-    var $ansiOuter = false; /* / whether ansi outer join syntax supported */
-    var $autoRollback = false; /*  autoRollback on PConnect(). */
-    var $poorAffectedRows = false; /*  affectedRows not working or unreliable */
-    
-    var $fnExecute = false;
-    var $fnCacheExecute = false;
-    var $blobEncodeType = false; /*  false=not required, 'I'=encode to integer, 'C'=encode to char */
-    var $dbxDriver = false;
-    
-     /*  */
-     /*  PRIVATE VARS */
-     /*  */
-    var $_oldRaiseFn =  false;
-    var $_transOK = null;
-    var $_connectionID = false; /* / The returned link identifier whenever a successful database connection is made.    */
-    var $_errorMsg = '';    /* / A variable which was used to keep the returned last error message.  The value will */
-                                /* / then returned by the errorMsg() function   */
-                        
-    var $_queryID = false;  /* / This variable keeps the last created result link identifier */
-    
-    var $_isPersistentConnection = false;   /* / A boolean variable to state whether its a persistent connection or normal connection.  */
-    var $_bindInputArray = false; /* / set to true if ADOConnection.Execute() permits binding of array parameters. */
-    var $autoCommit = true; /* / do not modify this yourself - actually private */
-    var $transOff = 0;  /* / temporarily disable transactions */
-    var $transCnt = 0;  /* / count of nested transactions */
-    
-    var $fetchMode=false;
-    
-    /**
-     * Constructor
-     */
-    function ADOConnection()
-    {
-        die('Virtual Class -- cannot instantiate');
-    }
-    
-    /**
-        Get server version info...
-        
-        @returns An array with 2 elements: $arr['string'] is the description string, 
-            and $arr[version] is the version (also a string).
-    */
-    function ServerInfo()
-    {
-        return array('description' => '', 'version' => '');
-    }
-    
-    function _findvers($str)
-    {
-        if (preg_match('/([0-9]+\.([0-9\.])+)/',$str, $arr)) return $arr[1];
-        else return '';
-    }
-    
-    /**
-    * All error messages go through this bottleneck function.
-    * You can define your own handler by defining the function name in ADODB_OUTP.
-    */
-    function outp($msg,$newline=true)
-    {
-    global $HTTP_SERVER_VARS;
-    
-        if (defined('ADODB_OUTP')) {
-            $fn = ADODB_OUTP;
-            $fn($msg,$newline);
-            return;
-        }
-        
-        if ($newline) $msg .= "<br />\n";
-        
-        if (isset($HTTP_SERVER_VARS['HTTP_USER_AGENT'])) echo $msg;
-        else echo strip_tags($msg);
-        flush();
-    }
-    
-    /**
-     * Connect to database
-     *
-     * @param [argHostname]            Host to connect to
-     * @param [argUsername]            Userid to login
-     * @param [argPassword]            Associated password
-     * @param [argDatabaseName]        database
-     * @param [forceNew]        force new connection
-     *
-     * @return true or false
-     */          
-    function Connect($argHostname = "", $argUsername = "", $argPassword = "", $argDatabaseName = "", $forceNew = false) 
-    {
-        if ($argHostname != "") $this->host = $argHostname;
-        if ($argUsername != "") $this->user = $argUsername;
-        if ($argPassword != "") $this->password = $argPassword; /*  not stored for security reasons */
-        if ($argDatabaseName != "") $this->database = $argDatabaseName;
-        
-        $this->_isPersistentConnection = false;        
-        if ($fn = $this->raiseErrorFn) {
-            if ($forceNew) {
-                if ($this->_nconnect($this->host, $this->user, $this->password, $this->database)) return true;
-            } else {
-                 if ($this->_connect($this->host, $this->user, $this->password, $this->database)) return true;
-            }
-            $err = $this->ErrorMsg();
-            if (empty($err)) $err = "Connection error to server '$argHostname' with user '$argUsername'";
-            $fn($this->databaseType,'CONNECT',$this->ErrorNo(),$err,$this->host,$this->database,$this);
-        } else {
-            if ($forceNew) {
-                if ($this->_nconnect($this->host, $this->user, $this->password, $this->database)) return true;
-            } else {
-                if ($this->_connect($this->host, $this->user, $this->password, $this->database)) return true;
-            }
-        }
-        if ($this->debug) ADOConnection::outp( $this->host.': '.$this->ErrorMsg());
-        
-        return false;
-    }  
-    
-     function _nconnect($argHostname, $argUsername, $argPassword, $argDatabaseName)
-     {
-         return $this->_connect($argHostname, $argUsername, $argPassword, $argDatabaseName);
-     }
-    
-    
-    /**
-     * Always force a new connection to database - currently only works with oracle
-     *
-     * @param [argHostname]            Host to connect to
-     * @param [argUsername]            Userid to login
-     * @param [argPassword]            Associated password
-     * @param [argDatabaseName]        database
-     *
-     * @return true or false
-     */          
-    function NConnect($argHostname = "", $argUsername = "", $argPassword = "", $argDatabaseName = "") 
-    {
-        return $this->Connect($argHostname, $argUsername, $argPassword, $argDatabaseName, true);
-    }
-    
-    /**
-     * Establish persistent connect to database
-     *
-     * @param [argHostname]            Host to connect to
-     * @param [argUsername]            Userid to login
-     * @param [argPassword]            Associated password
-     * @param [argDatabaseName]        database
-     *
-     * @return return true or false
-     */        
-    function PConnect($argHostname = "", $argUsername = "", $argPassword = "", $argDatabaseName = "")
-    {
-        if (defined('ADODB_NEVER_PERSIST')) 
-            return $this->Connect($argHostname,$argUsername,$argPassword,$argDatabaseName);
-        
-        if ($argHostname != "") $this->host = $argHostname;
-        if ($argUsername != "") $this->user = $argUsername;
-        if ($argPassword != "") $this->password = $argPassword;
-        if ($argDatabaseName != "") $this->database = $argDatabaseName;
-            
-        $this->_isPersistentConnection = true;
-        
-        if ($fn = $this->raiseErrorFn) {
-            if ($this->_pconnect($this->host, $this->user, $this->password, $this->database)) return true;
-            $err = $this->ErrorMsg();
-            if (empty($err)) $err = "Connection error to server '$argHostname' with user '$argUsername'";
-            $fn($this->databaseType,'PCONNECT',$this->ErrorNo(),$err,$this->host,$this->database,$this);
-        } else 
-            if ($this->_pconnect($this->host, $this->user, $this->password, $this->database)) return true;
-
-        if ($this->debug) ADOConnection::outp( $this->host.': '.$this->ErrorMsg());
-        
-        return false;
-    }
-
-    /*  Format date column in sql string given an input format that understands Y M D */
-    function SQLDate($fmt, $col=false)
-    {  
-        if (!$col) $col = $this->sysDate;
-        return $col; /*  child class implement */
-    }
-    
-    /**
-     * Should prepare the sql statement and return the stmt resource.
-     * For databases that do not support this, we return the $sql. To ensure
-     * compatibility with databases that do not support prepare:
-     *
-     *   $stmt = $db->Prepare("insert into table (id, name) values (?,?)");
-     *   $db->Execute($stmt,array(1,'Jill')) or die('insert failed');
-     *   $db->Execute($stmt,array(2,'Joe')) or die('insert failed');
-     *
-     * @param sql   SQL to send to database
-     *
-     * @return return FALSE, or the prepared statement, or the original sql if
-     *          if the database does not support prepare.
-     *
-     */        
-    function Prepare($sql)
-    {
-        return $sql;
-    }
-
-    /**
-     * Some databases, eg. mssql require a different function for preparing
-     * stored procedures. So we cannot use Prepare().
-     *
-     * Should prepare the stored procedure  and return the stmt resource.
-     * For databases that do not support this, we return the $sql. To ensure
-     * compatibility with databases that do not support prepare:
-     *
-     * @param sql   SQL to send to database
-     *
-     * @return return FALSE, or the prepared statement, or the original sql if
-     *          if the database does not support prepare.
-     *
-     */        
-    function PrepareSP($sql)
-    {
-        return $this->Prepare($sql);
-    }
-    
-    /**
-    * PEAR DB Compat
-    */
-    function Quote($s)
-    {
-        return $this->qstr($s,false);
-    }
-
-    
-    /**
-    * PEAR DB Compat - do not use internally. 
-    */
-    function ErrorNative()
-    {
-        return $this->ErrorNo();
-    }
-
-    
-   /**
-    * PEAR DB Compat - do not use internally. 
-    */
-    function nextId($seq_name)
-    {
-        return $this->GenID($seq_name);
-    }
-
-    /**
-    *   Lock a row, will escalate and lock the table if row locking not supported
-    *   will normally free the lock at the end of the transaction
-    *
-    *  @param $table    name of table to lock
-    *  @param $where    where clause to use, eg: "WHERE row=12". If left empty, will escalate to table lock
-    */
-    function RowLock($table,$where)
-    {
-        return false;
-    }
-    
-    function CommitLock($table)
-    {
-        return $this->CommitTrans();
-    }
-    
-    function RollbackLock($table)
-    {
-        return $this->RollbackTrans();
-    }
-    
-    /**
-    * PEAR DB Compat - do not use internally. 
-    *
-    * The fetch modes for NUMERIC and ASSOC for PEAR DB and ADODB are identical
-    *   for easy porting :-)
-    *
-    * @param mode   The fetchmode ADODB_FETCH_ASSOC or ADODB_FETCH_NUM
-    * @returns      The previous fetch mode
-    */
-    function SetFetchMode($mode)
-    {  
-        $old = $this->fetchMode;
-        $this->fetchMode = $mode;
-        
-        if ($old === false) {
-        global $ADODB_FETCH_MODE;
-            return $ADODB_FETCH_MODE;
-        }
-        return $old;
-    }
-    
-
-    /**
-    * PEAR DB Compat - do not use internally. 
-    */
-    function &Query($sql, $inputarr=false)
-    {
-        $rs = &$this->Execute($sql, $inputarr);
-        if (!$rs && defined('ADODB_PEAR')) return ADODB_PEAR_Error();
-        return $rs;
-    }
-
-    
-    /**
-    * PEAR DB Compat - do not use internally
-    */
-    function &LimitQuery($sql, $offset, $count)
-    {
-        $rs = &$this->SelectLimit($sql, $count, $offset); /*  swap  */
-        if (!$rs && defined('ADODB_PEAR')) return ADODB_PEAR_Error();
-        return $rs;
-    }
-
-    
-    /**
-    * PEAR DB Compat - do not use internally
-    */
-    function Disconnect()
-    {
-        return $this->Close();
-    }
-
-    /* 
-    Usage in oracle
-        $stmt = $db->Prepare('select * from table where id =:myid and group=:group');
-        $db->Parameter($stmt,$id,'myid');
-        $db->Parameter($stmt,$group,'group',64);
-        $db->Execute();
-        
-        @param $stmt Statement returned by Prepare() or PrepareSP().
-        @param $var PHP variable to bind to
-        @param $name Name of stored procedure variable name to bind to.
-        @param [$isOutput] Indicates direction of parameter 0/false=IN  1=OUT  2= IN/OUT. This is ignored in oci8.
-        @param [$maxLen] Holds an maximum length of the variable.
-        @param [$type] The data type of $var. Legal values depend on driver.
-
-    */
-    function Parameter(&$stmt,&$var,$name,$isOutput=false,$maxLen=4000,$type=false)
-    {
-        return false;
-    }
-    
-    /**
-        Improved method of initiating a transaction. Used together with CompleteTrans().
-        Advantages include:
-        
-        a. StartTrans/CompleteTrans is nestable, unlike BeginTrans/CommitTrans/RollbackTrans.
-           Only the outermost block is treated as a transaction.<br />
-        b. CompleteTrans auto-detects SQL errors, and will rollback on errors, commit otherwise.<br />
-        c. All BeginTrans/CommitTrans/RollbackTrans inside a StartTrans/CompleteTrans block
-           are disabled, making it backward compatible.
-    */
-    function StartTrans($errfn = 'ADODB_TransMonitor')
-    {
-        
-        if ($this->transOff > 0) {
-            $this->transOff += 1;
-            return;
-        }
-        
-        $this->_oldRaiseFn = $this->raiseErrorFn;
-        $this->raiseErrorFn = $errfn;
-        $this->_transOK = true;
-        
-        if ($this->debug && $this->transCnt > 0) ADOConnection::outp("Bad Transaction: StartTrans called within BeginTrans");
-        $this->BeginTrans();
-        $this->transOff = 1;
-    }
-    
-    /**
-        Used together with StartTrans() to end a transaction. Monitors connection
-        for sql errors, and will commit or rollback as appropriate.
-        
-        @autoComplete if true, monitor sql errors and commit and rollback as appropriate, 
-        and if set to false force rollback even if no SQL error detected.
-        @returns true on commit, false on rollback.
-    */
-    function CompleteTrans($autoComplete = true)
-    {
-        if ($this->transOff > 1) {
-            $this->transOff -= 1;
-            return true;
-        }
-        $this->raiseErrorFn = $this->_oldRaiseFn;
-        
-        $this->transOff = 0;
-        if ($this->_transOK && $autoComplete) $this->CommitTrans();
-        else $this->RollbackTrans();
-        
-        return $this->_transOK;
-    }
-    
-    /*
-        At the end of a StartTrans/CompleteTrans block, perform a rollback.
-    */
-    function FailTrans()
-    {
-        if ($this->debug && $this->transOff == 0) {
-            ADOConnection::outp("FailTrans outside StartTrans/CompleteTrans");
-        }
-        $this->_transOK = false;
-    }
-    /**
-     * Execute SQL 
-     *
-     * @param sql              SQL statement to execute, or possibly an array holding prepared statement ($sql[0] will hold sql text)
-     * @param [inputarr]       holds the input data to bind to. Null elements will be set to null.
-     * @param [arg3]   reserved for john lim for future use
-     * @return                 RecordSet or false
-     */
-    function &Execute($sql,$inputarr=false,$arg3=false) 
-    {
-        if ($this->fnExecute) {
-            $fn = $this->fnExecute;
-            $fn($this,$sql,$inputarr);
-        }
-        if (!$this->_bindInputArray && $inputarr) {
-            $sqlarr = explode('?',$sql);
-            $sql = '';
-            $i = 0;
-            foreach($inputarr as $v) {
-
-                $sql .= $sqlarr[$i];
-                /*  from Ron Baldwin <ron.baldwin@sourceprose.com> */
-                /*  Only quote string types     */
-                if (gettype($v) == 'string')
-                    $sql .= $this->qstr($v);
-                else if ($v === null)
-                    $sql .= 'NULL';
-                else
-                    $sql .= $v;
-                $i += 1;
-    
-            }
-            $sql .= $sqlarr[$i];
-            if ($i+1 != sizeof($sqlarr))       
-                ADOConnection::outp( "Input Array does not match ?: ".htmlspecialchars($sql));
-            $inputarr = false;
-        }
-        /*  debug version of query */
-        if ($this->debug) {
-        global $HTTP_SERVER_VARS;
-        
-            $ss = '';
-            if ($inputarr) {
-                foreach ($inputarr as $kk => $vv)  {
-                    if (is_string($vv) && strlen($vv)>64) $vv = substr($vv,0,64).'...';
-                    $ss .= "($kk=>'$vv') ";
-                }
-                $ss = "[ $ss ]";
-            }
-            if (is_array($sql)) $sqlTxt = $sql[0];
-            else $sqlTxt = $sql;
-            
-            /*  check if running from browser or command-line */
-            $inBrowser = isset($HTTP_SERVER_VARS['HTTP_USER_AGENT']);
-            
-            if ($inBrowser)
-                ADOConnection::outp( "<hr />\n($this->databaseType): ".htmlspecialchars($sqlTxt)." &nbsp; <code>$ss</code>\n<hr />\n",false);
-            else
-                ADOConnection::outp(  "=----\n($this->databaseType): ".($sqlTxt)." \n-----\n",false);
-            flush();
-            
-            $this->_queryID = $this->_query($sql,$inputarr,$arg3);
-
-            /* 
-                Alexios Fakios notes that ErrorMsg() must be called before ErrorNo() for mssql
-                because ErrorNo() calls Execute('SELECT @ERROR'), causing recure
-            */
-            if ($this->databaseType == 'mssql') { 
-            /*  ErrorNo is a slow function call in mssql, and not reliable */
-            /*  in PHP 4.0.6 */
-                if($emsg = $this->ErrorMsg()) {
-                    $err = $this->ErrorNo();
-                    if ($err) {
-                        ADOConnection::outp($err.': '.$emsg);
-                        flush();
-                    }
-                }
-            } else 
-                if (!$this->_queryID) {
-                    $e = $this->ErrorNo();
-                    $m = $this->ErrorMsg();
-                    ADOConnection::outp($e .': '. $m );
-                    flush();
-                }
-        } else {
-            /*  non-debug version of query */
-            
-            $this->_queryID =@$this->_query($sql,$inputarr,$arg3);
-            
-        }
-        /*  error handling if query fails */
-        if ($this->_queryID === false) {
-            $fn = $this->raiseErrorFn;
-            if ($fn) {
-                $fn($this->databaseType,'EXECUTE',$this->ErrorNo(),$this->ErrorMsg(),$sql,$inputarr,$this);
-            }
-            return false;
-        } else if ($this->_queryID === true) {
-        /*  return simplified empty recordset for inserts/updates/deletes with lower overhead */
-            $rs = new ADORecordSet_empty();
-            return $rs;
-        }
-        
-        /*  return real recordset from select statement */
-        $rsclass = "ADORecordSet_".$this->databaseType;
-        $rs = new $rsclass($this->_queryID,$this->fetchMode); /*  &new not supported by older PHP versions */
-        $rs->connection = &$this; /*  Pablo suggestion */
-        $rs->Init();
-        if (is_array($sql)) $rs->sql = $sql[0];
-        else $rs->sql = $sql;
-        
-        if ($rs->_numOfRows <= 0) {
-        global $ADODB_COUNTRECS;
-        
-            if ($ADODB_COUNTRECS) {
-                if (!$rs->EOF){ 
-                    $rs = &$this->_rs2rs($rs,-1,-1,!is_array($sql));
-                    $rs->_queryID = $this->_queryID;
-                } else
-                    $rs->_numOfRows = 0;
-            }
-        }
-        return $rs;
-    }
-
-    function CreateSequence($seqname='adodbseq',$startID=1)
-    {
-        if (empty($this->_genSeqSQL)) return false;
-        return $this->Execute(sprintf($this->_genSeqSQL,$seqname,$startID));
-    }
-    
-    function DropSequence($seqname)
-    {
-        if (empty($this->_dropSeqSQL)) return false;
-        return $this->Execute(sprintf($this->_dropSeqSQL,$seqname));
-    }
-
-    /**
-     * Generates a sequence id and stores it in $this->genID;
-     * GenID is only available if $this->hasGenID = true;
-     *
-     * @param seqname       name of sequence to use
-     * @param startID       if sequence does not exist, start at this ID
-     * @return      0 if not supported, otherwise a sequence id
-     */
-
-    function GenID($seqname='adodbseq',$startID=1)
-    {
-        if (!$this->hasGenID) {
-            return 0; /*  formerly returns false pre 1.60 */
-        }
-        
-        $getnext = sprintf($this->_genIDSQL,$seqname);
-        $rs = @$this->Execute($getnext);
-        if (!$rs) {
-            $createseq = $this->Execute(sprintf($this->_genSeqSQL,$seqname,$startID));
-            $rs = $this->Execute($getnext);
-        }
-        if ($rs && !$rs->EOF) $this->genID = reset($rs->fields);
-        else $this->genID = 0; /*  false */
-    
-        if ($rs) $rs->Close();
-
-        return $this->genID;
-    }  
-
-    /**
-     * @return  the last inserted ID. Not all databases support this.
-     */ 
-        function Insert_ID()
-        {
-                if ($this->hasInsertID) return $this->_insertid();
-                if ($this->debug) ADOConnection::outp( '<p>Insert_ID error</p>');
-                return false;
-        }
-    
-    
-    /**
-     * Portable Insert ID. Pablo Roca <pabloroca@mvps.org>
-     *
-     * @return  the last inserted ID. All databases support this. But aware possible
-     * problems in multiuser environments. Heavy test this before deploying.
-     */ 
-        function PO_Insert_ID($table="", $id="") 
-        {
-           if ($this->hasInsertID){
-               return $this->Insert_ID();
-           } else {
-               return $this->GetOne("SELECT MAX($id) FROM $table");
-           }
-        }      
-    
-        
-     /**
-     * @return  # rows affected by UPDATE/DELETE
-     */ 
-     function Affected_Rows()
-     {
-          if ($this->hasAffectedRows) {
-                 $val = $this->_affectedrows();
-                 return ($val < 0) ? false : $val;
-          }
-                  
-          if ($this->debug) ADOConnection::outp( '<p>Affected_Rows error</p>',false);
-          return false;
-     }
-    
-    
-    /**
-     * @return  the last error message
-     */
-    function ErrorMsg()
-    {
-        return '!! '.strtoupper($this->dataProvider.' '.$this->databaseType).': '.$this->_errorMsg;
-    }
-    
-    
-    /**
-     * @return the last error number. Normally 0 means no error.
-     */
-    function ErrorNo() 
-    {
-        return ($this->_errorMsg) ? -1 : 0;
-    }
-    
-    function MetaError($err=false)
-    {
-        include_once(ADODB_DIR."/adodb-error.inc.php");
-        if ($err === false) $err = $this->ErrorNo();
-        return adodb_error($this->dataProvider,$this->databaseType,$err);
-    }
-    
-    function MetaErrorMsg($errno)
-    {
-        include_once(ADODB_DIR."/adodb-error.inc.php");
-        return adodb_errormsg($errno);
-    }
-    
-    /**
-     * @returns an array with the primary key columns in it.
-     */
-    function MetaPrimaryKeys($table, $owner=false)
-    {
-    /*  owner not used in base class - see oci8 */
-        $p = array();
-        $objs = $this->MetaColumns($table);
-        if ($objs) {
-            foreach($objs as $v) {
-                if (!empty($v->primary_key))
-                    $p[] = $v->name;
-            }
-        }
-        if (sizeof($p)) return $p;
-        return false;
-    }
-    
-    
-    /**
-     * Choose a database to connect to. Many databases do not support this.
-     *
-     * @param dbName    is the name of the database to select
-     * @return      true or false
-     */
-    function SelectDB($dbName) 
-    {return false;}
-    
-    
-    /**
-    * Will select, getting rows from $offset (1-based), for $nrows. 
-    * This simulates the MySQL "select * from table limit $offset,$nrows" , and
-    * the PostgreSQL "select * from table limit $nrows offset $offset". Note that
-    * MySQL and PostgreSQL parameter ordering is the opposite of the other.
-    * eg. 
-    *  SelectLimit('select * from table',3); will return rows 1 to 3 (1-based)
-    *  SelectLimit('select * from table',3,2); will return rows 3 to 5 (1-based)
-    *
-    * Uses SELECT TOP for Microsoft databases (when $this->hasTop is set)
-    * BUG: Currently SelectLimit fails with $sql with LIMIT or TOP clause already set
-    *
-    * @param sql
-    * @param [offset]   is the row to start calculations from (1-based)
-    * @param [nrows]        is the number of rows to get
-    * @param [inputarr]        array of bind variables
-    * @param [arg3]     is a private parameter only used by jlim
-    * @param [secs2cache]       is a private parameter only used by jlim
-    * @return       the recordset ($rs->databaseType == 'array')
-     */
-    function &SelectLimit($sql,$nrows=-1,$offset=-1, $inputarr=false,$arg3=false,$secs2cache=0)
-    {
-        if ($this->hasTop && $nrows > 0) {
-        /*  suggested by Reinhard Balling. Access requires top after distinct  */
-         /*  Informix requires first before distinct - F Riosa */
-            $ismssql = (strpos($this->databaseType,'mssql') !== false);
-            if ($ismssql) $isaccess = false;
-            else $isaccess = (strpos($this->databaseType,'access') !== false);
-            
-            if ($offset <= 0) {
-                
-                    /*  access includes ties in result */
-                    if ($isaccess) {
-                        $sql = preg_replace(
-                        '/(^\s*select\s+(distinctrow|distinct)?)/i','\\1 '.$this->hasTop.' '.$nrows.' ',$sql);
-
-                        if ($secs2cache>0) return $this->CacheExecute($secs2cache, $sql,$inputarr,$arg3);
-                        else return $this->Execute($sql,$inputarr,$arg3);
-                    } else if ($ismssql){
-                        $sql = preg_replace(
-                        '/(^\s*select\s+(distinctrow|distinct)?)/i','\\1 '.$this->hasTop.' '.$nrows.' ',$sql);
-                    } else {
-                        $sql = preg_replace(
-                        '/(^\s*select\s)/i','\\1 '.$this->hasTop.' '.$nrows.' ',$sql);
-                    }
-            } else {
-                $nn = $nrows + $offset;
-                if ($isaccess || $ismssql) {
-                    $sql = preg_replace(
-                    '/(^\s*select\s+(distinctrow|distinct)?)/i','\\1 '.$this->hasTop.' '.$nn.' ',$sql);
-                } else {
-                    $sql = preg_replace(
-                    '/(^\s*select\s)/i','\\1 '.$this->hasTop.' '.$nn.' ',$sql);
-                }
-            }
-        }
-        
-        /*  if $offset>0, we want to skip rows, and $ADODB_COUNTRECS is set, we buffer  rows */
-        /*  0 to offset-1 which will be discarded anyway. So we disable $ADODB_COUNTRECS. */
-        global $ADODB_COUNTRECS;
-        
-        $savec = $ADODB_COUNTRECS;
-        $ADODB_COUNTRECS = false;
-            
-        if ($offset>0){
-            if ($secs2cache>0) $rs = &$this->CacheExecute($secs2cache,$sql,$inputarr,$arg3);
-            else $rs = &$this->Execute($sql,$inputarr,$arg3);
-        } else {
-            if ($secs2cache>0) $rs = &$this->CacheExecute($secs2cache,$sql,$inputarr,$arg3);
-            else $rs = &$this->Execute($sql,$inputarr,$arg3);
-        }
-        $ADODB_COUNTRECS = $savec;
-        if ($rs && !$rs->EOF) {
-            return $this->_rs2rs($rs,$nrows,$offset);
-        }
-        /* print_r($rs); */
-        return $rs;
-    }
-    
-    
-    /**
-    * Convert database recordset to an array recordset
-    * input recordset's cursor should be at beginning, and
-    * old $rs will be closed.
-    *
-    * @param rs         the recordset to copy
-    * @param [nrows]        number of rows to retrieve (optional)
-    * @param [offset]       offset by number of rows (optional)
-    * @return           the new recordset
-    */
-    function &_rs2rs(&$rs,$nrows=-1,$offset=-1,$close=true)
-    {
-        if (! $rs) return false;
-        
-        $dbtype = $rs->databaseType;
-        if (!$dbtype) {
-            $rs = &$rs;  /*  required to prevent crashing in 4.2.1, but does not happen in 4.3.1 -- why ? */
-            return $rs;
-        }
-        if (($dbtype == 'array' || $dbtype == 'csv') && $nrows == -1 && $offset == -1) {
-            $rs->MoveFirst();
-            $rs = &$rs; /*  required to prevent crashing in 4.2.1, but does not happen in 4.3.1-- why ? */
-            return $rs;
-        }
-        
-        for ($i=0, $max=$rs->FieldCount(); $i < $max; $i++) {
-            $flds[] = $rs->FetchField($i);
-        }
-        $arr = $rs->GetArrayLimit($nrows,$offset);
-        /* print_r($arr); */
-        if ($close) $rs->Close();
-        
-        $arrayClass = $this->arrayClass;
-        
-        $rs2 = new $arrayClass();
-        $rs2->connection = &$this;
-        $rs2->sql = $rs->sql;
-        $rs2->dataProvider = $this->dataProvider;
-        $rs2->InitArrayFields($arr,$flds);
-        return $rs2;
-    }
-    
-    
-    /**
-    * Return first element of first row of sql statement. Recordset is disposed
-    * for you.
-    *
-    * @param sql            SQL statement
-    * @param [inputarr]     input bind array
-    */
-    function GetOne($sql,$inputarr=false)
-    {
-    global $ADODB_COUNTRECS;
-        $crecs = $ADODB_COUNTRECS;
-        $ADODB_COUNTRECS = false;
-        
-        $ret = false;
-        $rs = &$this->Execute($sql,$inputarr);
-        if ($rs) {
-            if (!$rs->EOF) $ret = reset($rs->fields);
-            $rs->Close();
-        } 
-        $ADODB_COUNTRECS = $crecs;
-        return $ret;
-    }
-    
-    function CacheGetOne($secs2cache,$sql=false,$inputarr=false)
-    {
-        $ret = false;
-        $rs = &$this->CacheExecute($secs2cache,$sql,$inputarr);
-        if ($rs) {
-            if (!$rs->EOF) $ret = reset($rs->fields);
-            $rs->Close();
-        } 
-        
-        return $ret;
-    }
-    
-    function GetCol($sql, $inputarr = false, $trim = false)
-    {
-          $rv = false;
-          $rs = &$this->Execute($sql, $inputarr);
-          if ($rs) {
-               if ($trim) {
-                while (!$rs->EOF) {
-                    $rv[] = trim(reset($rs->fields));
-                    $rs->MoveNext();
-                   }
-            } else {
-                while (!$rs->EOF) {
-                    $rv[] = reset($rs->fields);
-                    $rs->MoveNext();
-                   }
-            }
-               $rs->Close();
-          }
-          return $rv;
-    }
-    
-    function CacheGetCol($secs, $sql, $inputarr = false,$trim=false)
-    {
-          $rv = false;
-          $rs = &$this->CacheExecute($secs, $sql, $inputarr);
-          if ($rs) {
-            if ($trim) {
-                while (!$rs->EOF) {
-                    $rv[] = trim(reset($rs->fields));
-                    $rs->MoveNext();
-                   }
-            } else {
-                while (!$rs->EOF) {
-                    $rv[] = reset($rs->fields);
-                    $rs->MoveNext();
-                   }
-            }
-               $rs->Close();
-          }
-          return $rv;
-    }
-    /*
-        Calculate the offset of a date for a particular database and generate
-            appropriate SQL. Useful for calculating future/past dates and storing
-            in a database.
-            
-        If dayFraction=1.5 means 1.5 days from now, 1.0/24 for 1 hour.
-    */
-    function OffsetDate($dayFraction,$date=false)
-    {
-        if (!$date) $date = $this->sysDate;
-        return  '('.$date.'+'.$dayFraction.')';
-    }
-    
-    
-    /**
-    * Return all rows. Compat with PEAR DB
-    *
-    * @param sql            SQL statement
-    * @param [inputarr]     input bind array
-    */
-    function GetAll($sql,$inputarr=false)
-    {
-    global $ADODB_COUNTRECS;
-        
-        $savec = $ADODB_COUNTRECS;
-        $ADODB_COUNTRECS = false;
-        $rs = $this->Execute($sql,$inputarr);
-        $ADODB_COUNTRECS = $savec;
-        
-        if (!$rs) 
-            if (defined('ADODB_PEAR')) return ADODB_PEAR_Error();
-            else return false;
-        $arr = $rs->GetArray();
-        $rs->Close();
-        return $arr;
-    }
-    
-    function CacheGetAll($secs2cache,$sql=false,$inputarr=false)
-    {
-    global $ADODB_COUNTRECS;
-        
-        $savec = $ADODB_COUNTRECS;
-        $ADODB_COUNTRECS = false;
-        $rs = $this->CacheExecute($secs2cache,$sql,$inputarr);
-        $ADODB_COUNTRECS = $savec;
-        
-        if (!$rs) 
-            if (defined('ADODB_PEAR')) return ADODB_PEAR_Error();
-            else return false;
-        
-        $arr = $rs->GetArray();
-        $rs->Close();
-        return $arr;
-    }
-    
-    
-    
-    /**
-    * Return one row of sql statement. Recordset is disposed for you.
-    *
-    * @param sql            SQL statement
-    * @param [inputarr]     input bind array
-    */
-    function GetRow($sql,$inputarr=false)
-    {
-    global $ADODB_COUNTRECS;
-        $crecs = $ADODB_COUNTRECS;
-        $ADODB_COUNTRECS = false;
-        
-        $rs = $this->Execute($sql,$inputarr);
-        
-        $ADODB_COUNTRECS = $crecs;
-        if ($rs) {
-            $arr = false;
-            if (!$rs->EOF) $arr = $rs->fields;
-            $rs->Close();
-            return $arr;
-        }
-        
-        return false;
-    }
-    
-    function CacheGetRow($secs2cache,$sql=false,$inputarr=false)
-    {
-        $rs = $this->CacheExecute($secs2cache,$sql,$inputarr);
-        if ($rs) {
-            $arr = false;
-            if (!$rs->EOF) $arr = $rs->fields;
-            $rs->Close();
-            return $arr;
-        }
-        return false;
-    }
-    
-    /**
-    * Insert or replace a single record. Note: this is not the same as MySQL's replace. 
-    *  ADOdb's Replace() uses update-insert semantics, not insert-delete-duplicates of MySQL.
-    *
-    * $this->Replace('products', array('prodname' =>"'Nails'","price" => 3.99), 'prodname');
-    *
-    * $table        table name
-    * $fieldArray   associative array of data (you must quote strings yourself).
-    * $keyCol       the primary key field name or if compound key, array of field names
-    * autoQuote     set to true to use a hueristic to quote strings. Works with nulls and numbers
-    *                   but does not work with dates nor SQL functions.
-    * has_autoinc   the primary key is an auto-inc field, so skip in insert.
-    *
-    * Currently blob replace not supported
-    *
-    * returns 0 = fail, 1 = update, 2 = insert 
-    */
-    
-    function Replace($table, $fieldArray, $keyCol, $autoQuote=false, $has_autoinc=false)
-    {
-        if (count($fieldArray) == 0) return 0;
-        $first = true;
-        $uSet = '';
-        
-        if (!is_array($keyCol)) {
-            $keyCol = array($keyCol);
-        }
-        foreach($fieldArray as $k => $v) {
-            if ($autoQuote && !is_numeric($v) and $v[0] != "'" and strcasecmp($v,'null')!=0) {
-                $v = $this->qstr($v);
-                $fieldArray[$k] = $v;
-            }
-            if (in_array($k,$keyCol)) continue; /*  skip UPDATE if is key */
-            
-            if ($first) {
-                $first = false;
-                $uSet = "$k=$v";
-            } else
-                $uSet .= ",$k=$v";
-        }
-         
-        $first = true;
-        foreach ($keyCol as $v) {
-            if ($first) {
-                $first = false;
-                $where = "$v=$fieldArray[$v]";
-            } else {
-                $where .= " and $v=$fieldArray[$v]";
-            }
-        }
-        
-        if ($uSet) {
-            $update = "UPDATE $table SET $uSet WHERE $where";
-        
-            $rs = $this->Execute($update);
-            if ($rs) {
-                if ($this->poorAffectedRows) {
-                /*
-                 The Select count(*) wipes out any errors that the update would have returned. 
-                http://phplens.com/lens/lensforum/msgs.php?id=5696
-                */
-                    if ($this->ErrorNo()<>0) return 0;
-                    
-                # affected_rows == 0 if update field values identical to old values
-                # for mysql - which is silly. 
-            
-                    $cnt = $this->GetOne("select count(*) from $table where $where");
-                    if ($cnt > 0) return 1; /*  record already exists */
-                } else
-                     if (($this->Affected_Rows()>0)) return 1;
-            }
-                
-        }
-    /*         print "<p>Error=".$this->ErrorNo().'<p>'; */
-        $first = true;
-        foreach($fieldArray as $k => $v) {
-            if ($has_autoinc && in_array($k,$keyCol)) continue; /*  skip autoinc col */
-            
-            if ($first) {
-                $first = false;                        
-                $iCols = "$k";
-                $iVals = "$v";
-            } else {
-                $iCols .= ",$k";
-                $iVals .= ",$v";
-            }                          
-        }
-        $insert = "INSERT INTO $table ($iCols) VALUES ($iVals)"; 
-        $rs = $this->Execute($insert);
-        return ($rs) ? 2 : 0;
-    }
-    
-    
-    /**
-    * Will select, getting rows from $offset (1-based), for $nrows. 
-    * This simulates the MySQL "select * from table limit $offset,$nrows" , and
-    * the PostgreSQL "select * from table limit $nrows offset $offset". Note that
-    * MySQL and PostgreSQL parameter ordering is the opposite of the other.
-    * eg. 
-    *  CacheSelectLimit(15,'select * from table',3); will return rows 1 to 3 (1-based)
-    *  CacheSelectLimit(15,'select * from table',3,2); will return rows 3 to 5 (1-based)
-    *
-    * BUG: Currently CacheSelectLimit fails with $sql with LIMIT or TOP clause already set
-    *
-    * @param [secs2cache]   seconds to cache data, set to 0 to force query. This is optional
-    * @param sql
-    * @param [offset]   is the row to start calculations from (1-based)
-    * @param [nrows]    is the number of rows to get
-    * @param [inputarr]        array of bind variables
-    * @param [arg3]     is a private parameter only used by jlim
-    * @return       the recordset ($rs->databaseType == 'array')
-     */
-    function &CacheSelectLimit($secs2cache,$sql,$nrows=-1,$offset=-1,$inputarr=false, $arg3=false)
-    {  
-        if (!is_numeric($secs2cache)) {
-            if ($sql === false) $sql = -1;
-            if ($offset == -1) $offset = false;
-                                      /*  sql, nrows, offset,inputarr,arg3 */
-            return $this->SelectLimit($secs2cache,$sql,$nrows,$offset,$inputarr,$this->cacheSecs);
-        } else {
-            if ($sql === false) ADOConnection::outp( "Warning: \$sql missing from CacheSelectLimit()");
-            return $this->SelectLimit($sql,$nrows,$offset,$inputarr,$arg3,$secs2cache);
-        }
-    }
-    
-    /**
-    * Flush cached recordsets that match a particular $sql statement. 
-    * If $sql == false, then we purge all files in the cache.
-     */
-    function CacheFlush($sql=false,$inputarr=false)
-    {
-    global $ADODB_CACHE_DIR;
-    
-        if (strlen($ADODB_CACHE_DIR) > 1 && !$sql) {
-            if (strpos(strtoupper(PHP_OS),'WIN') !== false) {
-                $cmd = 'del /s '.str_replace('/','\\',$ADODB_CACHE_DIR).'\adodb_*.cache';
-            } else {
-                $cmd = 'rm -rf '.$ADODB_CACHE_DIR.'/??/adodb_*.cache'; 
-                /*  old version 'rm -f `find '.$ADODB_CACHE_DIR.' -name adodb_*.cache`'; */
-            }
-            if ($this->debug) {
-                ADOConnection::outp( "CacheFlush: $cmd<br /><pre>\n", system($cmd),"</pre>");
-            } else {
-                exec($cmd);
-            }
-            return;
-        } 
-        $f = $this->_gencachename($sql.serialize($inputarr),false);
-        adodb_write_file($f,''); /*  is adodb_write_file needed? */
-        @unlink($f);
-    }
-    
-    /**
-    * Private function to generate filename for caching.
-    * Filename is generated based on:
-    *
-    *  - sql statement
-    *  - database type (oci8, ibase, ifx, etc)
-    *  - database name
-    *  - userid
-    *
-    * We create 256 sub-directories in the cache directory ($ADODB_CACHE_DIR). 
-    * Assuming that we can have 50,000 files per directory with good performance, 
-    * then we can scale to 12.8 million unique cached recordsets. Wow!
-     */
-    function _gencachename($sql,$createdir)
-    {
-    global $ADODB_CACHE_DIR;
-        
-        $m = md5($sql.$this->databaseType.$this->database.$this->user);
-        $dir = $ADODB_CACHE_DIR.'/'.substr($m,0,2);
-        if ($createdir && !file_exists($dir)) {
-            $oldu = umask(0);
-            if (!mkdir($dir,0771)) 
-                if ($this->debug) ADOConnection::outp( "Unable to mkdir $dir for $sql");
-            umask($oldu);
-        }
-        return $dir.'/adodb_'.$m.'.cache';
-    }
-    
-    
-    /**
-     * Execute SQL, caching recordsets.
-     *
-     * @param [secs2cache]     seconds to cache data, set to 0 to force query. 
-     *                  This is an optional parameter.
-     * @param sql       SQL statement to execute
-     * @param [inputarr]    holds the input data  to bind to
-     * @param [arg3]    reserved for john lim for future use
-     * @return      RecordSet or false
-     */
-    function &CacheExecute($secs2cache,$sql=false,$inputarr=false,$arg3=false)
-    {
-        if (!is_numeric($secs2cache)) {
-            $arg3 = $inputarr;
-            $inputarr = $sql;
-            $sql = $secs2cache;
-            $secs2cache = $this->cacheSecs;
-        }
-        include_once(ADODB_DIR.'/adodb-csvlib.inc.php');
-        
-        $md5file = $this->_gencachename($sql.serialize($inputarr),true);
-        $err = '';
-        
-        if ($secs2cache > 0){
-            $rs = &csv2rs($md5file,$err,$secs2cache);
-            $this->numCacheHits += 1;
-        } else {
-            $err='Timeout 1';
-            $rs = false;
-            $this->numCacheMisses += 1;
-        }
-        if (!$rs) {
-        /*  no cached rs found */
-            if ($this->debug) {
-                if (get_magic_quotes_runtime()) {
-                    ADOConnection::outp("Please disable magic_quotes_runtime - it corrupts cache files :(");
-                }
-                ADOConnection::outp( " $md5file cache failure: $err (see sql below)");
-            }
-            $rs = &$this->Execute($sql,$inputarr,$arg3);
-            if ($rs) {
-                $eof = $rs->EOF;
-                $rs = &$this->_rs2rs($rs); /*  read entire recordset into memory immediately */
-                $txt = _rs2serialize($rs,false,$sql); /*  serialize */
-        
-                if (!adodb_write_file($md5file,$txt,$this->debug)) {
-                    if ($fn = $this->raiseErrorFn) {
-                        $fn($this->databaseType,'CacheExecute',-32000,"Cache write error",$md5file,$sql,$this);
-                    }
-                    if ($this->debug) ADOConnection::outp( " Cache write error");
-                }
-                if ($rs->EOF && !$eof) {
-                    $rs->MoveFirst();
-                    /* $rs = &csv2rs($md5file,$err);            */
-                    $rs->connection = &$this; /*  Pablo suggestion */
-                }  
-                
-            } else
-                @unlink($md5file);
-        } else {
-            if ($this->fnCacheExecute) {
-                $fn = $this->fnCacheExecute;
-                $fn($this, $secs2cache, $sql, $inputarr);
-            }
-        /*  ok, set cached object found */
-            $rs->connection = &$this; /*  Pablo suggestion */
-            if ($this->debug){ 
-            global $HTTP_SERVER_VARS;
-                    
-                $inBrowser = isset($HTTP_SERVER_VARS['HTTP_USER_AGENT']);
-                $ttl = $rs->timeCreated + $secs2cache - time();
-                $s = is_array($sql) ? $sql[0] : $sql;
-                if ($inBrowser) $s = '<i>'.htmlspecialchars($s).'</i>';
-                
-                ADOConnection::outp( " $md5file reloaded, ttl=$ttl [ $s ]");
-            }
-        }
-        return $rs;
-    }
-    
-    
-    /**
-     * Generates an Update Query based on an existing recordset.
-     * $arrFields is an associative array of fields with the value
-     * that should be assigned.
-     *
-     * Note: This function should only be used on a recordset
-     *      that is run against a single table and sql should only 
-     *      be a simple select stmt with no groupby/orderby/limit
-     *
-     * "Jonathan Younger" <jyounger@unilab.com>
-       */
-    function GetUpdateSQL(&$rs, $arrFields,$forceUpdate=false,$magicq=false)
-    {
-        include_once(ADODB_DIR.'/adodb-lib.inc.php');
-        return _adodb_getupdatesql($this,$rs,$arrFields,$forceUpdate,$magicq);
-    }
-
-
-    /**
-     * Generates an Insert Query based on an existing recordset.
-     * $arrFields is an associative array of fields with the value
-     * that should be assigned.
-     *
-     * Note: This function should only be used on a recordset
-     *      that is run against a single table.
-       */
-    function GetInsertSQL(&$rs, $arrFields,$magicq=false)
-    {  
-        include_once(ADODB_DIR.'/adodb-lib.inc.php');
-        return _adodb_getinsertsql($this,$rs,$arrFields,$magicq);
-    }
-    
-
-    /**
-    * Update a blob column, given a where clause. There are more sophisticated
-    * blob handling functions that we could have implemented, but all require
-    * a very complex API. Instead we have chosen something that is extremely
-    * simple to understand and use. 
-    *
-    * Note: $blobtype supports 'BLOB' and 'CLOB', default is BLOB of course.
-    *
-    * Usage to update a $blobvalue which has a primary key blob_id=1 into a 
-    * field blobtable.blobcolumn:
-    *
-    *   UpdateBlob('blobtable', 'blobcolumn', $blobvalue, 'blob_id=1');
-    *
-    * Insert example:
-    *
-    *   $conn->Execute('INSERT INTO blobtable (id, blobcol) VALUES (1, null)');
-    *   $conn->UpdateBlob('blobtable','blobcol',$blob,'id=1');
-    */
-    
-    function UpdateBlob($table,$column,$val,$where,$blobtype='BLOB')
-    {
-        return $this->Execute("UPDATE $table SET $column=? WHERE $where",array($val)) != false;
-    }
-
-    /**
-    * Usage:
-    *   UpdateBlob('TABLE', 'COLUMN', '/path/to/file', 'ID=1');
-    *
-    *   $blobtype supports 'BLOB' and 'CLOB'
-    *
-    *   $conn->Execute('INSERT INTO blobtable (id, blobcol) VALUES (1, null)');
-    *   $conn->UpdateBlob('blobtable','blobcol',$blobpath,'id=1');
-    */
-    function UpdateBlobFile($table,$column,$path,$where,$blobtype='BLOB')
-    {
-        $fd = fopen($path,'rb');
-        if ($fd === false) return false;
-        $val = fread($fd,filesize($path));
-        fclose($fd);
-        return $this->UpdateBlob($table,$column,$val,$where,$blobtype);
-    }
-    
-    function BlobDecode($blob)
-    {
-        return $blob;
-    }
-    
-    function BlobEncode($blob)
-    {
-        return $blob;
-    }
-    
-    /**
-    * Usage:
-    *   UpdateClob('TABLE', 'COLUMN', $var, 'ID=1', 'CLOB');
-    *
-    *   $conn->Execute('INSERT INTO clobtable (id, clobcol) VALUES (1, null)');
-    *   $conn->UpdateClob('clobtable','clobcol',$clob,'id=1');
-    */
-    function UpdateClob($table,$column,$val,$where)
-    {
-        return $this->UpdateBlob($table,$column,$val,$where,'CLOB');
-    }
-    
-    
-    /**
-     *  $meta   contains the desired type, which could be...
-     *  C for character. You will have to define the precision yourself.
-     *  X for teXt. For unlimited character lengths.
-     *  B for Binary
-     *  F for floating point, with no need to define scale and precision
-     *  N for decimal numbers, you will have to define the (scale, precision) yourself
-     *  D for date
-     *  T for timestamp
-     *  L for logical/Boolean
-     *  I for integer
-     *  R for autoincrement counter/integer
-     *  and if you want to use double-byte, add a 2 to the end, like C2 or X2.
-     * 
-     *
-     * @return the actual type of the data or false if no such type available
-    */
-     function ActualType($meta)
-    {
-        switch($meta) {
-        case 'C':
-        case 'X':
-            return 'VARCHAR';
-        case 'B':
-            
-        case 'D':
-        case 'T':
-        case 'L':
-        
-        case 'R':
-            
-        case 'I':
-        case 'N':
-            return false;
-        }
-    }
-
-    /*
-    * Maximum size of C field
-    */
-    function CharMax()
-    {
-        return 255; /*  make it conservative if not defined */
-    }
-    
-    
-    /*
-    * Maximum size of X field
-    */
-    function TextMax()
-    {
-        return 4000; /*  make it conservative if not defined */
-    }
-    
-    /**
-     * Close Connection
-     */
-    function Close() 
-    {
-        return $this->_close();
-        
-        /*  "Simon Lee" <simon@mediaroad.com> reports that persistent connections need  */
-        /*  to be closed too! */
-        /* if ($this->_isPersistentConnection != true) return $this->_close(); */
-        /* else return true;*/
-    }
-    
-    /**
-     * Begin a Transaction. Must be followed by CommitTrans() or RollbackTrans().
-     *
-     * @return true if succeeded or false if database does not support transactions
-     */
-    function BeginTrans() {return false;}
-    
-    
-    /**
-     * If database does not support transactions, always return true as data always commited
-     *
-     * @param $ok  set to false to rollback transaction, true to commit
-     *
-     * @return true/false.
-     */
-    function CommitTrans($ok=true) 
-    { return true;}
-    
-    
-    /**
-     * If database does not support transactions, rollbacks always fail, so return false
-     *
-     * @return true/false.
-     */
-    function RollbackTrans() 
-    { return false;}
-
-
-    /**
-     * return the databases that the driver can connect to. 
-     * Some databases will return an empty array.
-     *
-     * @return an array of database names.
-     */
-        function MetaDatabases() 
-        {return false;}
-        
-    /**
-     * @return  array of tables for current database.
-     */ 
-    function MetaTables() 
-    {
-    global $ADODB_FETCH_MODE;
-    
-        if ($this->metaTablesSQL) {
-            /*  complicated state saving by the need for backward compat */
-            $save = $ADODB_FETCH_MODE; 
-            $ADODB_FETCH_MODE = ADODB_FETCH_NUM; 
-            
-            if ($this->fetchMode !== false) $savem = $this->SetFetchMode(false);
-            
-            $rs = $this->Execute($this->metaTablesSQL);
-            if (isset($savem)) $this->SetFetchMode($savem);
-            $ADODB_FETCH_MODE = $save; 
-            
-            if ($rs === false) return false;
-            $arr = $rs->GetArray();
-            $arr2 = array();
-            for ($i=0; $i < sizeof($arr); $i++) {
-                $arr2[] = $arr[$i][0];
-            }
-            $rs->Close();
-            return $arr2;
-        }
-        return false;
-    }
-    
-    
-    /**
-     * List columns in a database as an array of ADOFieldObjects. 
-     * See top of file for definition of object.
-     *
-     * @param table    table name to query
-     * @param upper    uppercase table name (required by some databases)
-     *
-     * @return  array of ADOFieldObjects for current table.
-     */ 
-    function MetaColumns($table,$upper=true) 
-    {
-    global $ADODB_FETCH_MODE;
-    
-        if (!empty($this->metaColumnsSQL)) {
-            $save = $ADODB_FETCH_MODE;
-            $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
-            if ($this->fetchMode !== false) $savem = $this->SetFetchMode(false);
-            $rs = $this->Execute(sprintf($this->metaColumnsSQL,($upper)?strtoupper($table):$table));
-            if (isset($savem)) $this->SetFetchMode($savem);
-            $ADODB_FETCH_MODE = $save;
-            if ($rs === false) return false;
-
-            $retarr = array();
-            while (!$rs->EOF) { /* print_r($rs->fields); */
-                $fld = new ADOFieldObject();
-                $fld->name = $rs->fields[0];
-                $fld->type = $rs->fields[1];
-                $fld->max_length = $rs->fields[2];
-                $retarr[strtoupper($fld->name)] = $fld;        
-                
-                $rs->MoveNext();
-            }
-            $rs->Close();
-            return $retarr;    
-        }
-        return false;
-    }
-    
-    /**
-     * List columns names in a table as an array. 
-     * @param table    table name to query
-     *
-     * @return  array of column names for current table.
-     */ 
-    function MetaColumnNames($table) 
-    {
-        $objarr = $this->MetaColumns($table);
-        if (!is_array($objarr)) return false;
-        
-        $arr = array();
-        foreach($objarr as $v) {
-            $arr[] = $v->name;
-        }
-        return $arr;
-    }
-            
-    /**
-     * Different SQL databases used different methods to combine strings together.
-     * This function provides a wrapper. 
-     * 
-     * param s  variable number of string parameters
-     *
-     * Usage: $db->Concat($str1,$str2);
-     * 
-     * @return concatenated string
-     */
-    function Concat()
-    {  
-        $arr = func_get_args();
-        return implode($this->concat_operator, $arr);
-    }
-    
-    
-    /**
-     * Converts a date "d" to a string that the database can understand.
-     *
-     * @param d        a date in Unix date time format.
-     *
-     * @return  date string in database date format
-     */
-    function DBDate($d)
-    {
-    
-        if (empty($d) && $d !== 0) return 'null';
-
-        if (is_string($d) && !is_numeric($d)) 
-            if ($this->isoDates) return "'$d'";
-            else $d = ADOConnection::UnixDate($d);
-            
-        return adodb_date($this->fmtDate,$d);
-    }
-    
-    
-    /**
-     * Converts a timestamp "ts" to a string that the database can understand.
-     *
-     * @param ts    a timestamp in Unix date time format.
-     *
-     * @return  timestamp string in database timestamp format
-     */
-    function DBTimeStamp($ts)
-    {
-        if (empty($ts) && $ts !== 0) return 'null';
-
-        if (is_string($ts) && !is_numeric($ts)) 
-            if ($this->isoDates) return "'$ts'";
-            else $ts = ADOConnection::UnixTimeStamp($ts);
-            
-        return adodb_date($this->fmtTimeStamp,$ts);
-    }
-    
-    /**
-     * Also in ADORecordSet.
-     * @param $v is a date string in YYYY-MM-DD format
-     *
-     * @return date in unix timestamp format, or 0 if before TIMESTAMP_FIRST_YEAR, or false if invalid date format
-     */
-    function UnixDate($v)
-    {
-        if (!preg_match( "|^([0-9]{4})[-/\.]?([0-9]{1,2})[-/\.]?([0-9]{1,2})|", 
-            ($v), $rr)) return false;
-
-        if ($rr[1] <= TIMESTAMP_FIRST_YEAR) return 0;
-        /*  h-m-s-MM-DD-YY */
-        return @adodb_mktime(0,0,0,$rr[2],$rr[3],$rr[1]);
-    }
-    
-
-    /**
-     * Also in ADORecordSet.
-     * @param $v is a timestamp string in YYYY-MM-DD HH-NN-SS format
-     *
-     * @return date in unix timestamp format, or 0 if before TIMESTAMP_FIRST_YEAR, or false if invalid date format
-     */
-    function UnixTimeStamp($v)
-    {
-        if (!preg_match( 
-            "|^([0-9]{4})[-/\.]?([0-9]{1,2})[-/\.]?([0-9]{1,2})[ -]?(([0-9]{1,2}):?([0-9]{1,2}):?([0-9\.]{1,4}))?|", 
-            ($v), $rr)) return false;
-        if ($rr[1] <= TIMESTAMP_FIRST_YEAR && $rr[2]<= 1) return 0;
-    
-        /*  h-m-s-MM-DD-YY */
-        if (!isset($rr[5])) return  adodb_mktime(0,0,0,$rr[2],$rr[3],$rr[1]);
-        return  @adodb_mktime($rr[5],$rr[6],$rr[7],$rr[2],$rr[3],$rr[1]);
-    }
-    
-    /**
-     * Also in ADORecordSet.
-     *
-     * Format database date based on user defined format.
-     *
-     * @param v is the character date in YYYY-MM-DD format, returned by database
-     * @param fmt   is the format to apply to it, using date()
-     *
-     * @return a date formated as user desires
-     */
-     
-    function UserDate($v,$fmt='Y-m-d')
-    {
-        $tt = $this->UnixDate($v);
-        /*  $tt == -1 if pre TIMESTAMP_FIRST_YEAR */
-        if (($tt === false || $tt == -1) && $v != false) return $v;
-        else if ($tt == 0) return $this->emptyDate;
-        else if ($tt == -1) { /*  pre-TIMESTAMP_FIRST_YEAR */
-        }
-        
-        return adodb_date($fmt,$tt);
-    
-    }
-    
-    
-    /**
-     * Correctly quotes a string so that all strings are escaped. We prefix and append
-     * to the string single-quotes.
-     * An example is  $db->qstr("Don't bother",magic_quotes_runtime());
-     * 
-     * @param s         the string to quote
-     * @param [magic_quotes]   if $s is GET/POST var, set to get_magic_quotes_gpc().
-     *              This undoes the stupidity of magic quotes for GPC.
-     *
-     * @return  quoted string to be sent back to database
-     */
-    function qstr($s,$magic_quotes=false)
-    {  
-        if (!$magic_quotes) {
-        
-            if ($this->replaceQuote[0] == '\\'){
-                /*  only since php 4.0.5 */
-                $s = adodb_str_replace(array('\\',"\0"),array('\\\\',"\\\0"),$s);
-                /* $s = str_replace("\0","\\\0", str_replace('\\','\\\\',$s)); */
-            }
-            return  "'".str_replace("'",$this->replaceQuote,$s)."'";
-        }
-        
-        /*  undo magic quotes for " */
-        $s = str_replace('\\"','"',$s);
-        
-        if ($this->replaceQuote == "\\'")  /*  ' already quoted, no need to change anything */
-            return "'$s'";
-        else {/*  change \' to '' for sybase/mssql */
-            $s = str_replace('\\\\','\\',$s);
-            return "'".str_replace("\\'",$this->replaceQuote,$s)."'";
-        }
-    }
-    
-    
-    /**
-    * Will select the supplied $page number from a recordset, given that it is paginated in pages of 
-    * $nrows rows per page. It also saves two boolean values saying if the given page is the first 
-    * and/or last one of the recordset. Added by Iván Oliva to provide recordset pagination.
-    *
-    * See readme.htm#ex8 for an example of usage.
-    *
-    * @param sql
-    * @param nrows      is the number of rows per page to get
-    * @param page       is the page number to get (1-based)
-    * @param [inputarr]        array of bind variables
-    * @param [arg3]     is a private parameter only used by jlim
-    * @param [secs2cache]       is a private parameter only used by jlim
-    * @return       the recordset ($rs->databaseType == 'array')
-    *
-    * NOTE: phpLens uses a different algorithm and does not use PageExecute().
-    *
-    */
-    function &PageExecute($sql, $nrows, $page, $inputarr=false, $arg3=false, $secs2cache=0) 
-    {
-        include_once(ADODB_DIR.'/adodb-lib.inc.php');
-        if ($this->pageExecuteCountRows) return _adodb_pageexecute_all_rows($this, $sql, $nrows, $page, $inputarr, $arg3, $secs2cache);
-        return _adodb_pageexecute_no_last_page($this, $sql, $nrows, $page, $inputarr, $arg3, $secs2cache);
-
-    }
-    
-        
-    /**
-    * Will select the supplied $page number from a recordset, given that it is paginated in pages of 
-    * $nrows rows per page. It also saves two boolean values saying if the given page is the first 
-    * and/or last one of the recordset. Added by Iván Oliva to provide recordset pagination.
-    *
-    * @param secs2cache        seconds to cache data, set to 0 to force query
-    * @param sql
-    * @param nrows      is the number of rows per page to get
-    * @param page       is the page number to get (1-based)
-    * @param [inputarr]        array of bind variables
-    * @param [arg3]     is a private parameter only used by jlim
-    * @return       the recordset ($rs->databaseType == 'array')
-    */
-    function &CachePageExecute($secs2cache, $sql, $nrows, $page,$inputarr=false, $arg3=false) 
-    {
-        /*switch($this->dataProvider) {
-        case 'postgres':
-        case 'mysql': 
-            break;
-        default: $secs2cache = 0; break;
-        }*/
-        return $this->PageExecute($sql,$nrows,$page,$inputarr,$arg3,$secs2cache);
-    }
-
-} /*  end class ADOConnection */
-
-?>
\ No newline at end of file
diff --git a/lib/adodb/adodb-cryptsession.php b/lib/adodb/adodb-cryptsession.php
deleted file mode 100644 (file)
index 9292fad..0000000
+++ /dev/null
@@ -1,316 +0,0 @@
-<?php\r
-/*\r
-V4.01 23 Oct 2003  (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
-  Released under both BSD license and Lesser GPL library license. \r
-  Whenever there is any discrepancy between the two licenses, \r
-  the BSD license will take precedence.\r
-       Made table name configurable - by David Johnson djohnson@inpro.net\r
-       Encryption by Ari Kuorikoski <ari.kuorikoski@finebyte.com>\r
-       \r
-  Set tabs to 4 for best viewing.\r
-  \r
-  Latest version of ADODB is available at http://php.weblogs.com/adodb\r
-  ======================================================================\r
-  \r
- This file provides PHP4 session management using the ADODB database\r
-wrapper library.\r
\r
- Example\r
- =======\r
\r
-       GLOBAL $HTTP_SESSION_VARS;\r
-       include('adodb.inc.php');\r
-       #---------------------------------#\r
-       include('adodb-cryptsession.php'); \r
-       #---------------------------------#\r
-       session_start();\r
-       session_register('AVAR');\r
-       $HTTP_SESSION_VARS['AVAR'] += 1;\r
-       print "<p>\$HTTP_SESSION_VARS['AVAR']={$HTTP_SESSION_VARS['AVAR']}</p>";\r
-\r
\r
- Installation\r
- ============\r
- 1. Create a new database in MySQL or Access "sessions" like\r
-so:\r
\r
-  create table sessions (\r
-          SESSKEY char(32) not null,\r
-          EXPIRY int(11) unsigned not null,\r
-          EXPIREREF varchar(64),\r
-          DATA CLOB,\r
-         primary key (sesskey)\r
-  );\r
-  \r
-  2. Then define the following parameters. You can either modify\r
-     this file, or define them before this file is included:\r
-        \r
-       $ADODB_SESSION_DRIVER='database driver, eg. mysql or ibase';\r
-       $ADODB_SESSION_CONNECT='server to connect to';\r
-       $ADODB_SESSION_USER ='user';\r
-       $ADODB_SESSION_PWD ='password';\r
-       $ADODB_SESSION_DB ='database';\r
-       $ADODB_SESSION_TBL = 'sessions'\r
-       \r
-  3. Recommended is PHP 4.0.2 or later. There are documented\r
-session bugs in earlier versions of PHP.\r
-\r
-*/\r
-\r
-\r
-include_once('crypt.inc.php');\r
-\r
-if (!defined('_ADODB_LAYER')) {\r
-       include (dirname(__FILE__).'/adodb.inc.php');\r
-}\r
-\r
- /* if database time and system time is difference is greater than this, then give warning */\r
- define('ADODB_SESSION_SYNCH_SECS',60); \r
-\r
-if (!defined('ADODB_SESSION')) {\r
-\r
- define('ADODB_SESSION',1);\r
\r
-GLOBAL         $ADODB_SESSION_CONNECT, \r
-       $ADODB_SESSION_DRIVER,\r
-       $ADODB_SESSION_USER,\r
-       $ADODB_SESSION_PWD,\r
-       $ADODB_SESSION_DB,\r
-       $ADODB_SESS_CONN,\r
-       $ADODB_SESS_LIFE,\r
-       $ADODB_SESS_DEBUG,\r
-       $ADODB_SESS_INSERT,\r
-       $ADODB_SESSION_EXPIRE_NOTIFY; \r
-\r
-       //$ADODB_SESS_DEBUG = true;\r
-       \r
-       /* SET THE FOLLOWING PARAMETERS */\r
-if (empty($ADODB_SESSION_DRIVER)) {\r
-       $ADODB_SESSION_DRIVER='mysql';\r
-       $ADODB_SESSION_CONNECT='localhost';\r
-       $ADODB_SESSION_USER ='root';\r
-       $ADODB_SESSION_PWD ='';\r
-       $ADODB_SESSION_DB ='xphplens_2';\r
-}\r
-\r
-if (empty($ADODB_SESSION_TBL)){\r
-       $ADODB_SESSION_TBL = 'sessions';\r
-}\r
-\r
-if (empty($ADODB_SESSION_EXPIRE_NOTIFY)) {\r
-       $ADODB_SESSION_EXPIRE_NOTIFY = false;\r
-}\r
-\r
-function ADODB_Session_Key() \r
-{\r
-$ADODB_CRYPT_KEY = 'CRYPTED ADODB SESSIONS ROCK!';\r
-\r
-       /* USE THIS FUNCTION TO CREATE THE ENCRYPTION KEY FOR CRYPTED SESSIONS  */\r
-       /* Crypt the used key, $ADODB_CRYPT_KEY as key and session_ID as SALT   */\r
-       return crypt($ADODB_CRYPT_KEY, session_ID());\r
-}\r
-\r
-$ADODB_SESS_LIFE = ini_get('session.gc_maxlifetime');\r
-if ($ADODB_SESS_LIFE <= 1) {\r
-       // bug in PHP 4.0.3 pl 1  -- how about other versions?\r
-       //print "<h3>Session Error: PHP.INI setting <i>session.gc_maxlifetime</i>not set: $ADODB_SESS_LIFE</h3>";\r
-       $ADODB_SESS_LIFE=1440;\r
-}\r
-\r
-function adodb_sess_open($save_path, $session_name) \r
-{\r
-GLOBAL         $ADODB_SESSION_CONNECT, \r
-       $ADODB_SESSION_DRIVER,\r
-       $ADODB_SESSION_USER,\r
-       $ADODB_SESSION_PWD,\r
-       $ADODB_SESSION_DB,\r
-       $ADODB_SESS_CONN,\r
-       $ADODB_SESS_DEBUG;\r
-       \r
-       $ADODB_SESS_INSERT = false;\r
-       \r
-       if (isset($ADODB_SESS_CONN)) return true;\r
-       \r
-       $ADODB_SESS_CONN = ADONewConnection($ADODB_SESSION_DRIVER);\r
-       if (!empty($ADODB_SESS_DEBUG)) {\r
-               $ADODB_SESS_CONN->debug = true;\r
-               print" conn=$ADODB_SESSION_CONNECT user=$ADODB_SESSION_USER pwd=$ADODB_SESSION_PWD db=$ADODB_SESSION_DB ";\r
-       }\r
-       return $ADODB_SESS_CONN->PConnect($ADODB_SESSION_CONNECT,\r
-                       $ADODB_SESSION_USER,$ADODB_SESSION_PWD,$ADODB_SESSION_DB);\r
-       \r
-}\r
-\r
-function adodb_sess_close() \r
-{\r
-global $ADODB_SESS_CONN;\r
-\r
-       if ($ADODB_SESS_CONN) $ADODB_SESS_CONN->Close();\r
-       return true;\r
-}\r
-\r
-function adodb_sess_read($key) \r
-{\r
-$Crypt = new MD5Crypt;\r
-global $ADODB_SESS_CONN,$ADODB_SESS_INSERT,$ADODB_SESSION_TBL;\r
-       $rs = $ADODB_SESS_CONN->Execute("SELECT data FROM $ADODB_SESSION_TBL WHERE sesskey = '$key' AND expiry >= " . time());\r
-       if ($rs) {\r
-               if ($rs->EOF) {\r
-                       $ADODB_SESS_INSERT = true;\r
-                       $v = '';\r
-               } else {\r
-                       // Decrypt session data\r
-                       $v = rawurldecode($Crypt->Decrypt(reset($rs->fields), ADODB_Session_Key()));\r
-               }\r
-               $rs->Close();\r
-               return $v;\r
-       }\r
-       else $ADODB_SESS_INSERT = true;\r
-       \r
-       return '';\r
-}\r
-\r
-function adodb_sess_write($key, $val) \r
-{\r
-$Crypt = new MD5Crypt;\r
-       global $ADODB_SESS_INSERT,$ADODB_SESS_CONN, $ADODB_SESS_LIFE, $ADODB_SESSION_TBL,$ADODB_SESSION_EXPIRE_NOTIFY;\r
-\r
-       $expiry = time() + $ADODB_SESS_LIFE;\r
-\r
-       // encrypt session data..       \r
-       $val = $Crypt->Encrypt(rawurlencode($val), ADODB_Session_Key());\r
-       \r
-       $arr = array('sesskey' => $key, 'expiry' => $expiry, 'data' => $val);\r
-       if ($ADODB_SESSION_EXPIRE_NOTIFY) {\r
-               $var = reset($ADODB_SESSION_EXPIRE_NOTIFY);\r
-               global $$var;\r
-               $arr['expireref'] = $$var;\r
-       }\r
-       $rs = $ADODB_SESS_CONN->Replace($ADODB_SESSION_TBL,\r
-           $arr,\r
-       'sesskey',$autoQuote = true);\r
-\r
-       if (!$rs) {\r
-               ADOConnection::outp( '<p>Session Replace: '.$ADODB_SESS_CONN->ErrorMsg().'</p>',false);\r
-       } else {\r
-               // bug in access driver (could be odbc?) means that info is not commited\r
-               // properly unless select statement executed in Win2000\r
-       \r
-       if ($ADODB_SESS_CONN->databaseType == 'access') $rs = $ADODB_SESS_CONN->Execute("select sesskey from $ADODB_SESSION_TBL WHERE sesskey='$key'");\r
-       }\r
-       return isset($rs);\r
-}\r
-\r
-function adodb_sess_destroy($key) \r
-{\r
-       global $ADODB_SESS_CONN, $ADODB_SESSION_TBL,$ADODB_SESSION_EXPIRE_NOTIFY;\r
-       \r
-       if ($ADODB_SESSION_EXPIRE_NOTIFY) {\r
-               reset($ADODB_SESSION_EXPIRE_NOTIFY);\r
-               $fn = next($ADODB_SESSION_EXPIRE_NOTIFY);\r
-               $savem = $ADODB_SESS_CONN->SetFetchMode(ADODB_FETCH_NUM);\r
-               $rs = $ADODB_SESS_CONN->Execute("SELECT expireref,sesskey FROM $ADODB_SESSION_TBL WHERE sesskey='$key'");\r
-               $ADODB_SESS_CONN->SetFetchMode($savem);\r
-               if ($rs) {\r
-                       $ADODB_SESS_CONN->BeginTrans();\r
-                       while (!$rs->EOF) {\r
-                               $ref = $rs->fields[0];\r
-                               $key = $rs->fields[1];\r
-                               $fn($ref,$key);\r
-                               $del = $ADODB_SESS_CONN->Execute("DELETE FROM $ADODB_SESSION_TBL WHERE sesskey='$key'");\r
-                               $rs->MoveNext();\r
-                       }\r
-                       $ADODB_SESS_CONN->CommitTrans();\r
-               }\r
-       } else {\r
-               $qry = "DELETE FROM $ADODB_SESSION_TBL WHERE sesskey = '$key'";\r
-               $rs = $ADODB_SESS_CONN->Execute($qry);\r
-       }\r
-       return $rs ? true : false;\r
-}\r
-\r
-\r
-function adodb_sess_gc($maxlifetime) {\r
-       global $ADODB_SESS_CONN, $ADODB_SESSION_TBL,$ADODB_SESSION_EXPIRE_NOTIFY,$ADODB_SESS_DEBUG;\r
-\r
-       if ($ADODB_SESSION_EXPIRE_NOTIFY) {\r
-               reset($ADODB_SESSION_EXPIRE_NOTIFY);\r
-               $fn = next($ADODB_SESSION_EXPIRE_NOTIFY);\r
-               $savem = $ADODB_SESS_CONN->SetFetchMode(ADODB_FETCH_NUM);\r
-               $rs = $ADODB_SESS_CONN->Execute("SELECT expireref,sesskey FROM $ADODB_SESSION_TBL WHERE expiry < " . time());\r
-               $ADODB_SESS_CONN->SetFetchMode($savem);\r
-               if ($rs) {\r
-                       $ADODB_SESS_CONN->BeginTrans();\r
-                       while (!$rs->EOF) {\r
-                               $ref = $rs->fields[0];\r
-                               $key = $rs->fields[1];\r
-                               $fn($ref,$key);\r
-                               $del = $ADODB_SESS_CONN->Execute("DELETE FROM $ADODB_SESSION_TBL WHERE sesskey='$key'");\r
-                               $rs->MoveNext();\r
-                       }\r
-                       $ADODB_SESS_CONN->CommitTrans();\r
-               }\r
-       } else {\r
-               $qry = "DELETE FROM $ADODB_SESSION_TBL WHERE expiry < " . time();\r
-               $ADODB_SESS_CONN->Execute($qry);\r
-       }\r
-       \r
-       // suggested by Cameron, "GaM3R" <gamr@outworld.cx>\r
-       if (defined('ADODB_SESSION_OPTIMIZE'))\r
-       {\r
-               switch( $ADODB_SESSION_DRIVER ) {\r
-                       case 'mysql':\r
-                       case 'mysqlt':\r
-                               $opt_qry = 'OPTIMIZE TABLE '.$ADODB_SESSION_TBL;\r
-                               break;\r
-                       case 'postgresql':\r
-                       case 'postgresql7':\r
-                               $opt_qry = 'VACUUM '.$ADODB_SESSION_TBL;        \r
-                               break;\r
-               }\r
-       }\r
-       \r
-       if ($ADODB_SESS_CONN->dataProvider === 'oci8') $sql = 'select  TO_CHAR('.($ADODB_SESS_CONN->sysTimeStamp).', \'RRRR-MM-DD HH24:MI:SS\') from '. $ADODB_SESSION_TBL;\r
-       else $sql = 'select '.$ADODB_SESS_CONN->sysTimeStamp.' from '. $ADODB_SESSION_TBL;\r
-       \r
-       $rs =& $ADODB_SESS_CONN->SelectLimit($sql,1);\r
-       if ($rs && !$rs->EOF) {\r
-       \r
-               $dbts = reset($rs->fields);\r
-               $rs->Close();\r
-               $dbt = $ADODB_SESS_CONN->UnixTimeStamp($dbts);\r
-               $t = time();\r
-               if (abs($dbt - $t) >= ADODB_SESSION_SYNCH_SECS) {\r
-               global $HTTP_SERVER_VARS;\r
-                       $msg = \r
-                       __FILE__.": Server time for webserver {$HTTP_SERVER_VARS['HTTP_HOST']} not in synch with database: database=$dbt ($dbts), webserver=$t (diff=".(abs($dbt-$t)/3600)." hrs)";\r
-                       error_log($msg);\r
-                       if ($ADODB_SESS_DEBUG) ADOConnection::outp("<p>$msg</p>");\r
-               }\r
-       }\r
-       \r
-       return true;\r
-}\r
-\r
-session_module_name('user'); \r
-session_set_save_handler(\r
-       "adodb_sess_open",\r
-       "adodb_sess_close",\r
-       "adodb_sess_read",\r
-       "adodb_sess_write",\r
-       "adodb_sess_destroy",\r
-       "adodb_sess_gc");\r
-}\r
-\r
-/*  TEST SCRIPT -- UNCOMMENT */\r
-/*\r
-if (0) {\r
-GLOBAL $HTTP_SESSION_VARS;\r
-\r
-       session_start();\r
-       session_register('AVAR');\r
-       $HTTP_SESSION_VARS['AVAR'] += 1;\r
-       print "<p>\$HTTP_SESSION_VARS['AVAR']={$HTTP_SESSION_VARS['AVAR']}</p>";\r
-}\r
-*/\r
-?>\r
diff --git a/lib/adodb/adodb-recordset.inc.php b/lib/adodb/adodb-recordset.inc.php
deleted file mode 100644 (file)
index 6ac218c..0000000
+++ /dev/null
@@ -1,919 +0,0 @@
-<?php
-/** 
- * @version V3.40 7 April 2003 (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.
- * Released under both BSD license and Lesser GPL library license. 
- * Whenever there is any discrepancy between the two licenses, 
- * the BSD license will take precedence. 
- *
- * Set tabs to 4 for best viewing.
- * 
- * Latest version is available at http://php.weblogs.com
- *
- */
-
-   /**
-        * RecordSet class that represents the dataset returned by the database.
-        * To keep memory overhead low, this class holds only the current row in memory.
-        * No prefetching of data is done, so the RecordCount() can return -1 ( which
-        * means recordcount not known).
-        */
-       class ADORecordSet {
-       /*
-        * public variables     
-        */
-       var $dataProvider = "native";
-       var $fields = false;    /* / holds the current row data */
-       var $blobSize = 64;     /* / any varchar/char field this size or greater is treated as a blob */
-                                                       /* / in other words, we use a text area for editting. */
-       var $canSeek = false;   /* / indicates that seek is supported */
-       var $sql;                               /* / sql text */
-       var $EOF = false;               /* / Indicates that the current record position is after the last record in a Recordset object.  */
-       
-       var $emptyTimeStamp = '&nbsp;'; /* / what to display when $time==0 */
-       var $emptyDate = '&nbsp;'; /* / what to display when $time==0 */
-       var $debug = false;
-       var $timeCreated=0;     /* / datetime in Unix format rs created -- for cached recordsets */
-
-       var $bind = false;              /* / used by Fields() to hold array - should be private? */
-       var $fetchMode;                 /* / default fetch mode */
-       var $connection = false; /* / the parent connection */
-       /*
-        *      private variables       
-        */
-       var $_numOfRows = -1;   /** number of rows, or -1 */
-       var $_numOfFields = -1; /** number of fields in recordset */
-       var $_queryID = -1;             /** This variable keeps the result link identifier.     */
-       var $_currentRow = -1;  /** This variable keeps the current row in the Recordset.       */
-       var $_closed = false;   /** has recordset been closed */
-       var $_inited = false;   /** Init() should only be called once */
-       var $_obj;                              /** Used by FetchObj */
-       var $_names;                    /** Used by FetchObj */
-       
-       var $_currentPage = -1; /** Added by Iván Oliva to implement recordset pagination */
-       var $_atFirstPage = false;      /** Added by Iván Oliva to implement recordset pagination */
-       var $_atLastPage = false;       /** Added by Iván Oliva to implement recordset pagination */
-       var $_lastPageNo = -1; 
-       var $_maxRecordCount = 0;
-       var $dateHasTime = false;
-       
-       /**
-        * Constructor
-        *
-        * @param queryID       this is the queryID returned by ADOConnection->_query()
-        *
-        */
-       function ADORecordSet($queryID) 
-       {
-               $this->_queryID = $queryID;
-       }
-       
-       
-       
-       function Init()
-       {
-               if ($this->_inited) return;
-               $this->_inited = true;
-               if ($this->_queryID) @$this->_initrs();
-               else {
-                       $this->_numOfRows = 0;
-                       $this->_numOfFields = 0;
-               }
-               if ($this->_numOfRows != 0 && $this->_numOfFields && $this->_currentRow == -1) {
-                       $this->_currentRow = 0;
-                       if ($this->EOF = ($this->_fetch() === false)) {
-                               $this->_numOfRows = 0; /*  _numOfRows could be -1 */
-                       }
-               } else {
-                       $this->EOF = true;
-               }
-       }
-       
-       
-       /**
-        * Generate a SELECT tag string from a recordset, and return the string.
-        * If the recordset has 2 cols, we treat the 1st col as the containing 
-        * the text to display to the user, and 2nd col as the return value. Default
-        * strings are compared with the FIRST column.
-        *
-        * @param name                  name of SELECT tag
-        * @param [defstr]              the value to hilite. Use an array for multiple hilites for listbox.
-        * @param [blank1stItem]        true to leave the 1st item in list empty
-        * @param [multiple]            true for listbox, false for popup
-        * @param [size]                #rows to show for listbox. not used by popup
-        * @param [selectAttr]          additional attributes to defined for SELECT tag.
-        *                              useful for holding javascript onChange='...' handlers.
-        & @param [compareFields0]      when we have 2 cols in recordset, we compare the defstr with 
-        *                              column 0 (1st col) if this is true. This is not documented.
-        *
-        * @return HTML
-        *
-        * changes by glen.davies@cce.ac.nz to support multiple hilited items
-        */
-       function GetMenu($name,$defstr='',$blank1stItem=true,$multiple=false,
-                       $size=0, $selectAttr='',$compareFields0=true)
-       {
-               include_once(ADODB_DIR.'/adodb-lib.inc.php');
-               return _adodb_getmenu($this, $name,$defstr,$blank1stItem,$multiple,
-                       $size, $selectAttr,$compareFields0);
-       }
-       
-       /**
-        * Generate a SELECT tag string from a recordset, and return the string.
-        * If the recordset has 2 cols, we treat the 1st col as the containing 
-        * the text to display to the user, and 2nd col as the return value. Default
-        * strings are compared with the SECOND column.
-        *
-        */
-       function GetMenu2($name,$defstr='',$blank1stItem=true,$multiple=false,$size=0, $selectAttr='')  
-       {
-               include_once(ADODB_DIR.'/adodb-lib.inc.php');
-               return _adodb_getmenu($this,$name,$defstr,$blank1stItem,$multiple,
-                       $size, $selectAttr,false);
-       }
-
-
-       /**
-        * return recordset as a 2-dimensional array.
-        *
-        * @param [nRows]  is the number of rows to return. -1 means every row.
-        *
-        * @return an array indexed by the rows (0-based) from the recordset
-        */
-       function GetArray($nRows = -1) 
-       {
-       global $ADODB_EXTENSION; if ($ADODB_EXTENSION) return adodb_getall($this,$nRows);
-               
-               $results = array();
-               $cnt = 0;
-               while (!$this->EOF && $nRows != $cnt) {
-                       $results[] = $this->fields;
-                       $this->MoveNext();
-                       $cnt++;
-               }
-               return $results;
-       }
-       
-       /*
-       * Some databases allow multiple recordsets to be returned. This function
-       * will return true if there is a next recordset, or false if no more.
-       */
-       function NextRecordSet()
-       {
-               return false;
-       }
-       
-       /**
-        * return recordset as a 2-dimensional array. 
-        * Helper function for ADOConnection->SelectLimit()
-        *
-        * @param offset        is the row to start calculations from (1-based)
-        * @param [nrows]       is the number of rows to return
-        *
-        * @return an array indexed by the rows (0-based) from the recordset
-        */
-       function GetArrayLimit($nrows,$offset=-1) 
-       {       
-               if ($offset <= 0) {
-                       return $this->GetArray($nrows);
-               } 
-               
-               $this->Move($offset);
-               
-               $results = array();
-               $cnt = 0;
-               while (!$this->EOF && $nrows != $cnt) {
-                       $results[$cnt++] = $this->fields;
-                       $this->MoveNext();
-               }
-               
-               return $results;
-       }
-       
-       
-       /**
-        * Synonym for GetArray() for compatibility with ADO.
-        *
-        * @param [nRows]  is the number of rows to return. -1 means every row.
-        *
-        * @return an array indexed by the rows (0-based) from the recordset
-        */
-       function GetRows($nRows = -1) 
-       {
-               return $this->GetArray($nRows);
-       }
-       
-       /**
-        * return whole recordset as a 2-dimensional associative array if there are more than 2 columns. 
-        * The first column is treated as the key and is not included in the array. 
-        * If there is only 2 columns, it will return a 1 dimensional array of key-value pairs unless
-        * $force_array == true.
-        *
-        * @param [force_array] has only meaning if we have 2 data columns. If false, a 1 dimensional
-        *      array is returned, otherwise a 2 dimensional array is returned. If this sounds confusing,
-        *      read the source.
-        *
-        * @param [first2cols] means if there are more than 2 cols, ignore the remaining cols and 
-        * instead of returning array[col0] => array(remaining cols), return array[col0] => col1
-        *
-        * @return an associative array indexed by the first column of the array, 
-        *      or false if the  data has less than 2 cols.
-        */
-       function GetAssoc($force_array = false, $first2cols = false) {
-               $cols = $this->_numOfFields;
-               if ($cols < 2) {
-                       return false;
-               }
-               $numIndex = isset($this->fields[0]);
-               $results = array();
-               
-               if (!$first2cols && ($cols > 2 || $force_array)) {
-                       if ($numIndex) {
-                               while (!$this->EOF) {
-                                       $results[trim($this->fields[0])] = array_slice($this->fields, 1);
-                                       $this->MoveNext();
-                               }
-                       } else {
-                               while (!$this->EOF) {
-                                       $results[trim(reset($this->fields))] = array_slice($this->fields, 1);
-                                       $this->MoveNext();
-                               }
-                       }
-               } else {
-                       /*  return scalar values */
-                       if ($numIndex) {
-                               while (!$this->EOF) {
-                               /*  some bug in mssql PHP 4.02 -- doesn't handle references properly so we FORCE creating a new string */
-                                       $results[trim(($this->fields[0]))] = $this->fields[1];
-                                       $this->MoveNext();
-                               }
-                       } else {
-                               while (!$this->EOF) {
-                               /*  some bug in mssql PHP 4.02 -- doesn't handle references properly so we FORCE creating a new string */
-                                       $v1 = trim(reset($this->fields));
-                                       $v2 = ''.next($this->fields); 
-                                       $results[$v1] = $v2;
-                                       $this->MoveNext();
-                               }
-                       }
-               }
-               return $results; 
-       }
-       
-       
-       /**
-        *
-        * @param v     is the character timestamp in YYYY-MM-DD hh:mm:ss format
-        * @param fmt   is the format to apply to it, using date()
-        *
-        * @return a timestamp formated as user desires
-        */
-       function UserTimeStamp($v,$fmt='Y-m-d H:i:s')
-       {
-               $tt = $this->UnixTimeStamp($v);
-               /*  $tt == -1 if pre TIMESTAMP_FIRST_YEAR */
-               if (($tt === false || $tt == -1) && $v != false) return $v;
-               if ($tt == 0) return $this->emptyTimeStamp;
-               return adodb_date($fmt,$tt);
-       }
-       
-       
-       /**
-        * @param v     is the character date in YYYY-MM-DD format, returned by database
-        * @param fmt   is the format to apply to it, using date()
-        *
-        * @return a date formated as user desires
-        */
-       function UserDate($v,$fmt='Y-m-d')
-       {
-               $tt = $this->UnixDate($v);
-               /*  $tt == -1 if pre TIMESTAMP_FIRST_YEAR */
-               if (($tt === false || $tt == -1) && $v != false) return $v;
-               else if ($tt == 0) return $this->emptyDate;
-               else if ($tt == -1) { /*  pre-TIMESTAMP_FIRST_YEAR */
-               }
-               return adodb_date($fmt,$tt);
-       
-       }
-       
-       
-       /**
-        * @param $v is a date string in YYYY-MM-DD format
-        *
-        * @return date in unix timestamp format, or 0 if before TIMESTAMP_FIRST_YEAR, or false if invalid date format
-        */
-       function UnixDate($v)
-       {
-               
-               if (!preg_match( "|^([0-9]{4})[-/\.]?([0-9]{1,2})[-/\.]?([0-9]{1,2})|", 
-                       ($v), $rr)) return false;
-                       
-               if ($rr[1] <= 1903) return 0;
-               /*  h-m-s-MM-DD-YY */
-               return @adodb_mktime(0,0,0,$rr[2],$rr[3],$rr[1]);
-       }
-       
-
-       /**
-        * @param $v is a timestamp string in YYYY-MM-DD HH-NN-SS format
-        *
-        * @return date in unix timestamp format, or 0 if before TIMESTAMP_FIRST_YEAR, or false if invalid date format
-        */
-       function UnixTimeStamp($v)
-       {
-               
-               if (!preg_match( 
-                       "|^([0-9]{4})[-/\.]?([0-9]{1,2})[-/\.]?([0-9]{1,2})[ -]?(([0-9]{1,2}):?([0-9]{1,2}):?([0-9\.]{1,4}))?|", 
-                       ($v), $rr)) return false;
-               if ($rr[1] <= 1903 && $rr[2]<= 1) return 0;
-       
-               /*  h-m-s-MM-DD-YY */
-               if (!isset($rr[5])) return  adodb_mktime(0,0,0,$rr[2],$rr[3],$rr[1]);
-               return  @adodb_mktime($rr[5],$rr[6],$rr[7],$rr[2],$rr[3],$rr[1]);
-       }
-       
-       
-       /**
-       * PEAR DB Compat - do not use internally
-       */
-       function Free()
-       {
-               return $this->Close();
-       }
-       
-       
-       /**
-       * PEAR DB compat, number of rows
-       */
-       function NumRows()
-       {
-               return $this->_numOfRows;
-       }
-       
-       
-       /**
-       * PEAR DB compat, number of cols
-       */
-       function NumCols()
-       {
-               return $this->_numOfFields;
-       }
-       
-       /**
-       * Fetch a row, returning false if no more rows. 
-       * This is PEAR DB compat mode.
-       *
-       * @return false or array containing the current record
-       */
-       function FetchRow()
-       {
-               if ($this->EOF) return false;
-               $arr = $this->fields;
-               $this->_currentRow++;
-               if (!$this->_fetch()) $this->EOF = true;
-               return $arr;
-       }
-       
-       
-       /**
-       * Fetch a row, returning PEAR_Error if no more rows. 
-       * This is PEAR DB compat mode.
-       *
-       * @return DB_OK or error object
-       */
-       function FetchInto(&$arr)
-       {
-               if ($this->EOF) return (defined('PEAR_ERROR_RETURN')) ? new PEAR_Error('EOF',-1): false;
-               $arr = $this->fields;
-               $this->MoveNext();
-               return 1; /*  DB_OK */
-       }
-       
-       
-       /**
-        * Move to the first row in the recordset. Many databases do NOT support this.
-        *
-        * @return true or false
-        */
-       function MoveFirst() 
-       {
-               if ($this->_currentRow == 0) return true;
-               return $this->Move(0);                  
-       }                       
-
-       
-       /**
-        * Move to the last row in the recordset. 
-        *
-        * @return true or false
-        */
-       function MoveLast() 
-       {
-               if ($this->_numOfRows >= 0) return $this->Move($this->_numOfRows-1);
-               if ($this->EOF) return false;
-               while (!$this->EOF) {
-                       $f = $this->fields;
-                       $this->MoveNext();
-               }
-               $this->fields = $f;
-               $this->EOF = false;
-               return true;
-       }
-       
-       
-       /**
-        * Move to next record in the recordset.
-        *
-        * @return true if there still rows available, or false if there are no more rows (EOF).
-        */
-       function MoveNext() 
-       {
-               if (!$this->EOF) {
-                       $this->_currentRow++;
-                       if ($this->_fetch()) return true;
-               }
-               $this->EOF = true;
-               /* -- tested error handling when scrolling cursor -- seems useless.
-               $conn = $this->connection;
-               if ($conn && $conn->raiseErrorFn && ($errno = $conn->ErrorNo())) {
-                       $fn = $conn->raiseErrorFn;
-                       $fn($conn->databaseType,'MOVENEXT',$errno,$conn->ErrorMsg().' ('.$this->sql.')',$conn->host,$conn->database);
-               }
-               */
-               return false;
-       }       
-       
-       /**
-        * Random access to a specific row in the recordset. Some databases do not support
-        * access to previous rows in the databases (no scrolling backwards).
-        *
-        * @param rowNumber is the row to move to (0-based)
-        *
-        * @return true if there still rows available, or false if there are no more rows (EOF).
-        */
-       function Move($rowNumber = 0) 
-       {
-               $this->EOF = false;
-               if ($rowNumber == $this->_currentRow) return true;
-               if ($rowNumber >= $this->_numOfRows)
-                       if ($this->_numOfRows != -1) $rowNumber = $this->_numOfRows-2;
-                               
-               if ($this->canSeek) { 
-       
-                       if ($this->_seek($rowNumber)) {
-                               $this->_currentRow = $rowNumber;
-                               if ($this->_fetch()) {
-                                       return true;
-                               }
-                       } else {
-                               $this->EOF = true;
-                               return false;
-                       }
-               } else {
-                       if ($rowNumber < $this->_currentRow) return false;
-                       global $ADODB_EXTENSION;
-                       if ($ADODB_EXTENSION) {
-                               while (!$this->EOF && $this->_currentRow < $rowNumber) {
-                                       adodb_movenext($this);
-                               }
-                       } else {
-                       
-                               while (! $this->EOF && $this->_currentRow < $rowNumber) {
-                                       $this->_currentRow++;
-                                       
-                                       if (!$this->_fetch()) $this->EOF = true;
-                               }
-                       }
-                       return !($this->EOF);
-               }
-               
-               $this->fields = false;  
-               $this->EOF = true;
-               return false;
-       }
-       
-               
-       /**
-        * Get the value of a field in the current row by column name.
-        * Will not work if ADODB_FETCH_MODE is set to ADODB_FETCH_NUM.
-        * 
-        * @param colname  is the field to access
-        *
-        * @return the value of $colname column
-        */
-       function Fields($colname)
-       {
-               return $this->fields[$colname];
-       }
-       
-       function GetAssocKeys($upper=true)
-       {
-               $this->bind = array();
-               for ($i=0; $i < $this->_numOfFields; $i++) {
-                       $o = $this->FetchField($i);
-                       if ($upper === 2) $this->bind[$o->name] = $i;
-                       else $this->bind[($upper) ? strtoupper($o->name) : strtolower($o->name)] = $i;
-               }
-       }
-       
-  /**
-   * Use associative array to get fields array for databases that do not support
-   * associative arrays. Submitted by Paolo S. Asioli paolo.asioli@libero.it
-   *
-   * If you don't want uppercase cols, set $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC
-   * before you execute your SQL statement, and access $rs->fields['col'] directly.
-   *
-   * $upper  0 = lowercase, 1 = uppercase, 2 = whatever is returned by FetchField
-   */
-       function GetRowAssoc($upper=1)
-       {
-        
-               if (!$this->bind) {
-                       $this->GetAssocKeys($upper);
-               }
-               
-               $record = array();
-               foreach($this->bind as $k => $v) {
-                       $record[$k] = $this->fields[$v];
-               }
-
-               return $record;
-       }
-       
-       
-       /**
-        * Clean up recordset
-        *
-        * @return true or false
-        */
-       function Close() 
-       {
-               /*  free connection object - this seems to globally free the object */
-               /*  and not merely the reference, so don't do this... */
-               /*  $this->connection = false;  */
-               if (!$this->_closed) {
-                       $this->_closed = true;
-                       return $this->_close();         
-               } else
-                       return true;
-       }
-       
-       /**
-        * synonyms RecordCount and RowCount    
-        *
-        * @return the number of rows or -1 if this is not supported
-        */
-       function RecordCount() {return $this->_numOfRows;}
-       
-       
-       /*
-       * If we are using PageExecute(), this will return the maximum possible rows
-       * that can be returned when paging a recordset.
-       */
-       function MaxRecordCount()
-       {
-               return ($this->_maxRecordCount) ? $this->_maxRecordCount : $this->RecordCount();
-       }
-       
-       /**
-        * synonyms RecordCount and RowCount    
-        *
-        * @return the number of rows or -1 if this is not supported
-        */
-       function RowCount() {return $this->_numOfRows;} 
-       
-
-        /**
-        * Portable RecordCount. Pablo Roca <pabloroca@mvps.org>
-        *
-        * @return  the number of records from a previous SELECT. All databases support this.
-        *
-        * But aware possible problems in multiuser environments. For better speed the table
-        * must be indexed by the condition. Heavy test this before deploying.
-        */ 
-       function PO_RecordCount($table="", $condition="") {
-               
-               $lnumrows = $this->_numOfRows;
-               /*  the database doesn't support native recordcount, so we do a workaround */
-               if ($lnumrows == -1 && $this->connection) {
-                       IF ($table) {
-                               if ($condition) $condition = " WHERE " . $condition; 
-                               $resultrows = &$this->connection->Execute("SELECT COUNT(*) FROM $table $condition");
-                               if ($resultrows) $lnumrows = reset($resultrows->fields);
-                       }
-               }
-               return $lnumrows;
-       }
-       
-       /**
-        * @return the current row in the recordset. If at EOF, will return the last row. 0-based.
-        */
-       function CurrentRow() {return $this->_currentRow;}
-       
-       /**
-        * synonym for CurrentRow -- for ADO compat
-        *
-        * @return the current row in the recordset. If at EOF, will return the last row. 0-based.
-        */
-       function AbsolutePosition() {return $this->_currentRow;}
-       
-       /**
-        * @return the number of columns in the recordset. Some databases will set this to 0
-        * if no records are returned, others will return the number of columns in the query.
-        */
-       function FieldCount() {return $this->_numOfFields;}   
-
-
-       /**
-        * Get the ADOFieldObject of a specific column.
-        *
-        * @param fieldoffset   is the column position to access(0-based).
-        *
-        * @return the ADOFieldObject for that column, or false.
-        */
-       function &FetchField($fieldoffset) 
-       {
-               /*  must be defined by child class */
-       }       
-       
-       /**
-        * Get the ADOFieldObjects of all columns in an array.
-        *
-        */
-       function FieldTypesArray()
-       {
-               $arr = array();
-               for ($i=0, $max=$this->_numOfFields; $i < $max; $i++) 
-                       $arr[] = $this->FetchField($i);
-               return $arr;
-       }
-       
-       /**
-       * Return the fields array of the current row as an object for convenience.
-       * The default case is lowercase field names.
-       *
-       * @return the object with the properties set to the fields of the current row
-       */
-       function &FetchObj()
-       {
-               return FetchObject(false);
-       }
-       
-       /**
-       * Return the fields array of the current row as an object for convenience.
-       * The default case is uppercase.
-       * 
-       * @param $isupper to set the object property names to uppercase
-       *
-       * @return the object with the properties set to the fields of the current row
-       */
-       function &FetchObject($isupper=true)
-       {
-               if (empty($this->_obj)) {
-                       $this->_obj = new ADOFetchObj();
-                       $this->_names = array();
-                       for ($i=0; $i <$this->_numOfFields; $i++) {
-                               $f = $this->FetchField($i);
-                               $this->_names[] = $f->name;
-                       }
-               }
-               $i = 0;
-               $o = &$this->_obj;
-               for ($i=0; $i <$this->_numOfFields; $i++) {
-                       $name = $this->_names[$i];
-                       if ($isupper) $n = strtoupper($name);
-                       else $n = $name;
-                       
-                       $o->$n = $this->Fields($name);
-               }
-               return $o;
-       }
-       
-       /**
-       * Return the fields array of the current row as an object for convenience.
-       * The default is lower-case field names.
-       * 
-       * @return the object with the properties set to the fields of the current row,
-       *       or false if EOF
-       *
-       * Fixed bug reported by tim@orotech.net
-       */
-       function &FetchNextObj()
-       {
-               return $this->FetchNextObject(false);
-       }
-       
-       
-       /**
-       * Return the fields array of the current row as an object for convenience. 
-       * The default is upper case field names.
-       * 
-       * @param $isupper to set the object property names to uppercase
-       *
-       * @return the object with the properties set to the fields of the current row,
-       *       or false if EOF
-       *
-       * Fixed bug reported by tim@orotech.net
-       */
-       function &FetchNextObject($isupper=true)
-       {
-               $o = false;
-               if ($this->_numOfRows != 0 && !$this->EOF) {
-                       $o = $this->FetchObject($isupper);      
-                       $this->_currentRow++;
-                       if ($this->_fetch()) return $o;
-               }
-               $this->EOF = true;
-               return $o;
-       }
-       
-       /**
-        * Get the metatype of the column. This is used for formatting. This is because
-        * many databases use different names for the same type, so we transform the original
-        * type to our standardised version which uses 1 character codes:
-        *
-        * @param t  is the type passed in. Normally is ADOFieldObject->type.
-        * @param len is the maximum length of that field. This is because we treat character
-        *      fields bigger than a certain size as a 'B' (blob).
-        * @param fieldobj is the field object returned by the database driver. Can hold
-        *      additional info (eg. primary_key for mysql).
-        * 
-        * @return the general type of the data: 
-        *      C for character < 200 chars
-        *      X for teXt (>= 200 chars)
-        *      B for Binary
-        *      N for numeric floating point
-        *      D for date
-        *      T for timestamp
-        *      L for logical/Boolean
-        *      I for integer
-        *      R for autoincrement counter/integer
-        * 
-        *
-       */
-       function MetaType($t,$len=-1,$fieldobj=false)
-       {
-               if (is_object($t)) {
-                       $fieldobj = $t;
-                       $t = $fieldobj->type;
-                       $len = $fieldobj->max_length;
-               }
-       /*  changed in 2.32 to hashing instead of switch stmt for speed... */
-       static $typeMap = array(
-               'VARCHAR' => 'C',
-               'VARCHAR2' => 'C',
-               'CHAR' => 'C',
-               'C' => 'C',
-               'STRING' => 'C',
-               'NCHAR' => 'C',
-               'NVARCHAR' => 'C',
-               'VARYING' => 'C',
-               'BPCHAR' => 'C',
-               'CHARACTER' => 'C',
-               'INTERVAL' => 'C',  # Postgres
-               ##
-               'LONGCHAR' => 'X',
-               'TEXT' => 'X',
-               'M' => 'X',
-               'X' => 'X',
-               'CLOB' => 'X',
-               'NCLOB' => 'X',
-               'LVARCHAR' => 'X',
-               ##
-               'BLOB' => 'B',
-               'NTEXT' => 'B',
-               'BINARY' => 'B',
-               'VARBINARY' => 'B',
-               'LONGBINARY' => 'B',
-               'B' => 'B',
-               ##
-               'YEAR' => 'D', /*  mysql */
-               'DATE' => 'D',
-               'D' => 'D',
-               ##
-               'TIME' => 'T',
-               'TIMESTAMP' => 'T',
-               'DATETIME' => 'T',
-               'TIMESTAMPTZ' => 'T',
-               'T' => 'T',
-               ##
-               'BOOLEAN' => 'L', 
-               'BIT' => 'L',
-               'L' => 'L',
-               ##
-               'COUNTER' => 'R',
-               'R' => 'R',
-               'SERIAL' => 'R', /*  ifx */
-               ##
-               'INT' => 'I',
-               'INTEGER' => 'I',
-               'SHORT' => 'I',
-               'TINYINT' => 'I',
-               'SMALLINT' => 'I',
-               'I' => 'I',
-               ##
-               'LONG' => 'N', /*  interbase is numeric, oci8 is blob */
-               'BIGINT' => 'N', /*  this is bigger than PHP 32-bit integers */
-               'DECIMAL' => 'N',
-               'DEC' => 'N',
-               'REAL' => 'N',
-               'DOUBLE' => 'N',
-               'DOUBLE PRECISION' => 'N',
-               'SMALLFLOAT' => 'N',
-               'FLOAT' => 'N',
-               'NUMBER' => 'N',
-               'NUM' => 'N',
-               'NUMERIC' => 'N',
-               'MONEY' => 'N',
-               
-               ## informix 9.2
-               'SQLINT' => 'I', 
-               'SQLSERIAL' => 'I', 
-               'SQLSMINT' => 'I', 
-               'SQLSMFLOAT' => 'N', 
-               'SQLFLOAT' => 'N', 
-               'SQLMONEY' => 'N', 
-               'SQLDECIMAL' => 'N', 
-               'SQLDATE' => 'D', 
-               'SQLVCHAR' => 'C', 
-               'SQLCHAR' => 'C', 
-               'SQLDTIME' => 'T', 
-               'SQLINTERVAL' => 'N', 
-               'SQLBYTES' => 'B', 
-               'SQLTEXT' => 'X' 
-               );
-               
-               
-               $tmap = false;
-               $t = strtoupper($t);
-               $tmap = @$typeMap[$t];
-               switch ($tmap) {
-               case 'C':
-               
-                       /*  is the char field is too long, return as text field...  */
-                       if (!empty($this)) {
-                               if ($len > $this->blobSize) return 'X';
-                       } else if ($len > 250) {
-                               return 'X';
-                       }
-                       return 'C';
-                       
-               case 'I':
-                       if (!empty($fieldobj->primary_key)) return 'R';
-                       return 'I';
-               
-               case false:
-                       return 'N';
-                       
-               case 'B':
-                        if (isset($fieldobj->binary)) 
-                                return ($fieldobj->binary) ? 'B' : 'X';
-                       return 'B';
-               
-               case 'D':
-                       if ($this->dateHasTime) return 'T';
-                       return 'D';
-                       
-               default: 
-                       if ($t == 'LONG' && $this->dataProvider == 'oci8') return 'B';
-                       return $tmap;
-               }
-       }
-       
-       function _close() {}
-       
-       /**
-        * set/returns the current recordset page when paginating
-        */
-       function AbsolutePage($page=-1)
-       {
-               if ($page != -1) $this->_currentPage = $page;
-               return $this->_currentPage;
-       }
-       
-       /**
-        * set/returns the status of the atFirstPage flag when paginating
-        */
-       function AtFirstPage($status=false)
-       {
-               if ($status != false) $this->_atFirstPage = $status;
-               return $this->_atFirstPage;
-       }
-       
-       function LastPageNo($page = false)
-       {
-               if ($page != false) $this->_lastPageNo = $page;
-               return $this->_lastPageNo;
-       }
-       
-       /**
-        * set/returns the status of the atLastPage flag when paginating
-        */
-       function AtLastPage($status=false)
-       {
-               if ($status != false) $this->_atLastPage = $status;
-               return $this->_atLastPage;
-       }
-} /*  end class ADORecordSet */
-
-?>
\ No newline at end of file
diff --git a/lib/adodb/adodb-session-clob.php b/lib/adodb/adodb-session-clob.php
deleted file mode 100644 (file)
index e57162a..0000000
+++ /dev/null
@@ -1,439 +0,0 @@
-<?php\r
-/*\r
-  V4.01 23 Oct 2003  (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
-  Released under both BSD license and Lesser GPL library license. \r
-  Whenever there is any discrepancy between the two licenses, \r
-  the BSD license will take precedence.\r
-         Set tabs to 4 for best viewing.\r
-  \r
-  Latest version of ADODB is available at http://php.weblogs.com/adodb\r
-  ======================================================================\r
-  \r
- This file provides PHP4 session management using the ADODB database\r
- wrapper library, using Oracle CLOB's to store data. Contributed by achim.gosse@ddd.de.\r
-\r
- Example\r
- =======\r
\r
-       GLOBAL $HTTP_SESSION_VARS;\r
-       include('adodb.inc.php');\r
-       include('adodb-session.php');\r
-       session_start();\r
-       session_register('AVAR');\r
-       $HTTP_SESSION_VARS['AVAR'] += 1;\r
-       print "<p>\$HTTP_SESSION_VARS['AVAR']={$HTTP_SESSION_VARS['AVAR']}</p>";\r
-       \r
-To force non-persistent connections, call adodb_session_open first before session_start():\r
-\r
-       GLOBAL $HTTP_SESSION_VARS;\r
-       include('adodb.inc.php');\r
-       include('adodb-session.php');\r
-       adodb_session_open(false,false,false);\r
-       session_start();\r
-       session_register('AVAR');\r
-       $HTTP_SESSION_VARS['AVAR'] += 1;\r
-       print "<p>\$HTTP_SESSION_VARS['AVAR']={$HTTP_SESSION_VARS['AVAR']}</p>";\r
-\r
\r
- Installation\r
- ============\r
- 1. Create this table in your database (syntax might vary depending on your db):\r
\r
-  create table sessions (\r
-          SESSKEY char(32) not null,\r
-          EXPIRY int(11) unsigned not null,\r
-          EXPIREREF varchar(64),\r
-          DATA CLOB,\r
-         primary key (sesskey)\r
-  );\r
-\r
-\r
-  2. Then define the following parameters in this file:\r
-       $ADODB_SESSION_DRIVER='database driver, eg. mysql or ibase';\r
-       $ADODB_SESSION_CONNECT='server to connect to';\r
-       $ADODB_SESSION_USER ='user';\r
-       $ADODB_SESSION_PWD ='password';\r
-       $ADODB_SESSION_DB ='database';\r
-       $ADODB_SESSION_TBL = 'sessions'\r
-       $ADODB_SESSION_USE_LOBS = false; (or, if you wanna use CLOBS (= 'CLOB') or ( = 'BLOB')\r
-       \r
-  3. Recommended is PHP 4.0.6 or later. There are documented\r
-        session bugs in earlier versions of PHP.\r
-\r
-  4. If you want to receive notifications when a session expires, then\r
-        you can tag a session with an EXPIREREF, and before the session\r
-        record is deleted, we can call a function that will pass the EXPIREREF\r
-        as the first parameter, and the session key as the second parameter.\r
-        \r
-        To do this, define a notification function, say NotifyFn:\r
-        \r
-               function NotifyFn($expireref, $sesskey)\r
-               {\r
-               }\r
-        \r
-        Then you need to define a global variable $ADODB_SESSION_EXPIRE_NOTIFY.\r
-        This is an array with 2 elements, the first being the name of the variable\r
-        you would like to store in the EXPIREREF field, and the 2nd is the \r
-        notification function's name.\r
-        \r
-        In this example, we want to be notified when a user's session \r
-        has expired, so we store the user id in the global variable $USERID, \r
-        store this value in the EXPIREREF field:\r
-        \r
-               $ADODB_SESSION_EXPIRE_NOTIFY = array('USERID','NotifyFn');\r
-               \r
-       Then when the NotifyFn is called, we are passed the $USERID as the first\r
-       parameter, eg. NotifyFn($userid, $sesskey).\r
-*/\r
-\r
-if (!defined('_ADODB_LAYER')) {\r
-       include (dirname(__FILE__).'/adodb.inc.php');\r
-}\r
-\r
-if (!defined('ADODB_SESSION')) {\r
-\r
- define('ADODB_SESSION',1);\r
\r
- /* if database time and system time is difference is greater than this, then give warning */\r
- define('ADODB_SESSION_SYNCH_SECS',60); \r
-\r
-/****************************************************************************************\\r
-       Global definitions\r
-\****************************************************************************************/\r
-GLOBAL         $ADODB_SESSION_CONNECT, \r
-       $ADODB_SESSION_DRIVER,\r
-       $ADODB_SESSION_USER,\r
-       $ADODB_SESSION_PWD,\r
-       $ADODB_SESSION_DB,\r
-       $ADODB_SESS_CONN,\r
-       $ADODB_SESS_LIFE,\r
-       $ADODB_SESS_DEBUG,\r
-       $ADODB_SESSION_EXPIRE_NOTIFY,\r
-       $ADODB_SESSION_CRC,\r
-       $ADODB_SESSION_USE_LOBS;\r
-       \r
-       if (!isset($ADODB_SESSION_USE_LOBS)) $ADODB_SESSION_USE_LOBS = 'CLOB';\r
-       \r
-       $ADODB_SESS_LIFE = ini_get('session.gc_maxlifetime');\r
-       if ($ADODB_SESS_LIFE <= 1) {\r
-        // bug in PHP 4.0.3 pl 1  -- how about other versions?\r
-        //print "<h3>Session Error: PHP.INI setting <i>session.gc_maxlifetime</i>not set: $ADODB_SESS_LIFE</h3>";\r
-               $ADODB_SESS_LIFE=1440;\r
-       }\r
-       $ADODB_SESSION_CRC = false;\r
-       //$ADODB_SESS_DEBUG = true;\r
-       \r
-       //////////////////////////////////\r
-       /* SET THE FOLLOWING PARAMETERS */\r
-       //////////////////////////////////\r
-       \r
-       if (empty($ADODB_SESSION_DRIVER)) {\r
-               $ADODB_SESSION_DRIVER='mysql';\r
-               $ADODB_SESSION_CONNECT='localhost';\r
-               $ADODB_SESSION_USER ='root';\r
-               $ADODB_SESSION_PWD ='';\r
-               $ADODB_SESSION_DB ='xphplens_2';\r
-       }\r
-       \r
-       if (empty($ADODB_SESSION_EXPIRE_NOTIFY)) {\r
-               $ADODB_SESSION_EXPIRE_NOTIFY = false;\r
-       }\r
-       //  Made table name configurable - by David Johnson djohnson@inpro.net\r
-       if (empty($ADODB_SESSION_TBL)){\r
-               $ADODB_SESSION_TBL = 'sessions';\r
-       }\r
-       \r
-\r
-       // defaulting $ADODB_SESSION_USE_LOBS\r
-       if (!isset($ADODB_SESSION_USE_LOBS) || empty($ADODB_SESSION_USE_LOBS)) {\r
-               $ADODB_SESSION_USE_LOBS = false;\r
-       }\r
-\r
-       /*\r
-       $ADODB_SESS['driver'] = $ADODB_SESSION_DRIVER;\r
-       $ADODB_SESS['connect'] = $ADODB_SESSION_CONNECT;\r
-       $ADODB_SESS['user'] = $ADODB_SESSION_USER;\r
-       $ADODB_SESS['pwd'] = $ADODB_SESSION_PWD;\r
-       $ADODB_SESS['db'] = $ADODB_SESSION_DB;\r
-       $ADODB_SESS['life'] = $ADODB_SESS_LIFE;\r
-       $ADODB_SESS['debug'] = $ADODB_SESS_DEBUG;\r
-       \r
-       $ADODB_SESS['debug'] = $ADODB_SESS_DEBUG;\r
-       $ADODB_SESS['table'] = $ADODB_SESS_TBL;\r
-       */\r
-       \r
-/****************************************************************************************\\r
-       Create the connection to the database. \r
-       \r
-       If $ADODB_SESS_CONN already exists, reuse that connection\r
-\****************************************************************************************/\r
-function adodb_sess_open($save_path, $session_name,$persist=true) \r
-{\r
-GLOBAL $ADODB_SESS_CONN;\r
-       if (isset($ADODB_SESS_CONN)) return true;\r
-       \r
-GLOBAL         $ADODB_SESSION_CONNECT, \r
-       $ADODB_SESSION_DRIVER,\r
-       $ADODB_SESSION_USER,\r
-       $ADODB_SESSION_PWD,\r
-       $ADODB_SESSION_DB,\r
-       $ADODB_SESS_DEBUG;\r
-       \r
-       // cannot use & below - do not know why...\r
-       $ADODB_SESS_CONN = ADONewConnection($ADODB_SESSION_DRIVER);\r
-       if (!empty($ADODB_SESS_DEBUG)) {\r
-               $ADODB_SESS_CONN->debug = true;\r
-               ADOConnection::outp( " conn=$ADODB_SESSION_CONNECT user=$ADODB_SESSION_USER pwd=$ADODB_SESSION_PWD db=$ADODB_SESSION_DB ");\r
-       }\r
-       if ($persist) $ok = $ADODB_SESS_CONN->PConnect($ADODB_SESSION_CONNECT,\r
-                       $ADODB_SESSION_USER,$ADODB_SESSION_PWD,$ADODB_SESSION_DB);\r
-       else $ok = $ADODB_SESS_CONN->Connect($ADODB_SESSION_CONNECT,\r
-                       $ADODB_SESSION_USER,$ADODB_SESSION_PWD,$ADODB_SESSION_DB);\r
-       \r
-       if (!$ok) ADOConnection::outp( "<p>Session: connection failed</p>",false);\r
-}\r
-\r
-/****************************************************************************************\\r
-       Close the connection\r
-\****************************************************************************************/\r
-function adodb_sess_close() \r
-{\r
-global $ADODB_SESS_CONN;\r
-\r
-       if ($ADODB_SESS_CONN) $ADODB_SESS_CONN->Close();\r
-       return true;\r
-}\r
-\r
-/****************************************************************************************\\r
-       Slurp in the session variables and return the serialized string\r
-\****************************************************************************************/\r
-function adodb_sess_read($key) \r
-{\r
-global $ADODB_SESS_CONN,$ADODB_SESSION_TBL,$ADODB_SESSION_CRC;\r
-\r
-       $rs = $ADODB_SESS_CONN->Execute("SELECT data FROM $ADODB_SESSION_TBL WHERE sesskey = '$key' AND expiry >= " . time());\r
-       if ($rs) {\r
-               if ($rs->EOF) {\r
-                       $v = '';\r
-               } else \r
-                       $v = rawurldecode(reset($rs->fields));\r
-                       \r
-               $rs->Close();\r
-               \r
-               // new optimization adodb 2.1\r
-               $ADODB_SESSION_CRC = strlen($v).crc32($v);\r
-               \r
-               return $v;\r
-       }\r
-       \r
-       return ''; // thx to Jorma Tuomainen, webmaster#wizactive.com\r
-}\r
-\r
-/****************************************************************************************\\r
-       Write the serialized data to a database.\r
-       \r
-       If the data has not been modified since adodb_sess_read(), we do not write.\r
-\****************************************************************************************/\r
-function adodb_sess_write($key, $val) \r
-{\r
-       global\r
-               $ADODB_SESS_CONN, \r
-               $ADODB_SESS_LIFE, \r
-               $ADODB_SESSION_TBL,\r
-               $ADODB_SESS_DEBUG, \r
-               $ADODB_SESSION_CRC,\r
-               $ADODB_SESSION_EXPIRE_NOTIFY,\r
-               $ADODB_SESSION_DRIVER,                  // added\r
-               $ADODB_SESSION_USE_LOBS;                // added\r
-\r
-       $expiry = time() + $ADODB_SESS_LIFE;\r
-       \r
-       // crc32 optimization since adodb 2.1\r
-       // now we only update expiry date, thx to sebastian thom in adodb 2.32\r
-       if ($ADODB_SESSION_CRC !== false && $ADODB_SESSION_CRC == strlen($val).crc32($val)) {\r
-               if ($ADODB_SESS_DEBUG) echo "<p>Session: Only updating date - crc32 not changed</p>";\r
-               $qry = "UPDATE $ADODB_SESSION_TBL SET expiry=$expiry WHERE sesskey='$key' AND expiry >= " . time();\r
-               $rs = $ADODB_SESS_CONN->Execute($qry);  \r
-               return true;\r
-       }\r
-       $val = rawurlencode($val);\r
-       \r
-       $arr = array('sesskey' => $key, 'expiry' => $expiry, 'data' => $val);\r
-       if ($ADODB_SESSION_EXPIRE_NOTIFY) {\r
-               $var = reset($ADODB_SESSION_EXPIRE_NOTIFY);\r
-               global $$var;\r
-               $arr['expireref'] = $$var;\r
-       }\r
-\r
-       \r
-       if ($ADODB_SESSION_USE_LOBS === false) {        // no lobs, simply use replace()\r
-               $rs = $ADODB_SESS_CONN->Replace($ADODB_SESSION_TBL,$arr, 'sesskey',$autoQuote = true);\r
-               if (!$rs) {\r
-                       $err = $ADODB_SESS_CONN->ErrorMsg();\r
-               }\r
-       } else {\r
-               // what value shall we insert/update for lob row?\r
-               switch ($ADODB_SESSION_DRIVER) {\r
-                       // empty_clob or empty_lob for oracle dbs\r
-                       case "oracle":\r
-                       case "oci8":\r
-                       case "oci8po":\r
-                       case "oci805":\r
-                               $lob_value = sprintf("empty_%s()", strtolower($ADODB_SESSION_USE_LOBS));\r
-                               break;\r
-\r
-                       // null for all other\r
-                       default:\r
-                               $lob_value = "null";\r
-                               break;\r
-               }\r
-\r
-               // do we insert or update? => as for sesskey\r
-               $res = $ADODB_SESS_CONN->Execute("select count(*) as cnt from $ADODB_SESSION_TBL where sesskey = '$key'");\r
-               if ($res && reset($res->fields) > 0) {\r
-                       $qry = sprintf("update %s set expiry = %d, data = %s where sesskey = '%s'", $ADODB_SESSION_TBL, $expiry, $lob_value, $key);\r
-               } else {\r
-                       // insert\r
-                       $qry = sprintf("insert into %s (sesskey, expiry, data) values ('%s', %d, %s)", $ADODB_SESSION_TBL, $key, $expiry, $lob_value);\r
-               }\r
-\r
-               $err = "";\r
-               $rs1 = $ADODB_SESS_CONN->Execute($qry);\r
-               if (!$rs1) {\r
-                       $err .= $ADODB_SESS_CONN->ErrorMsg()."\n";\r
-               }\r
-               $rs2 = $ADODB_SESS_CONN->UpdateBlob($ADODB_SESSION_TBL, 'data', $val, "sesskey='$key'", strtoupper($ADODB_SESSION_USE_LOBS));\r
-               if (!$rs2) {\r
-                       $err .= $ADODB_SESS_CONN->ErrorMsg()."\n";\r
-               }\r
-               $rs = ($rs1 && $rs2) ? true : false;\r
-       }\r
-\r
-       if (!$rs) {\r
-               ADOConnection::outp( '<p>Session Replace: '.nl2br($err).'</p>',false);\r
-       }  else {\r
-               // bug in access driver (could be odbc?) means that info is not commited\r
-               // properly unless select statement executed in Win2000\r
-               if ($ADODB_SESS_CONN->databaseType == 'access') \r
-                       $rs = $ADODB_SESS_CONN->Execute("select sesskey from $ADODB_SESSION_TBL WHERE sesskey='$key'");\r
-       }\r
-       return !empty($rs);\r
-}\r
-\r
-function adodb_sess_destroy($key) \r
-{\r
-       global $ADODB_SESS_CONN, $ADODB_SESSION_TBL,$ADODB_SESSION_EXPIRE_NOTIFY;\r
-       \r
-       if ($ADODB_SESSION_EXPIRE_NOTIFY) {\r
-               reset($ADODB_SESSION_EXPIRE_NOTIFY);\r
-               $fn = next($ADODB_SESSION_EXPIRE_NOTIFY);\r
-               $savem = $ADODB_SESS_CONN->SetFetchMode(ADODB_FETCH_NUM);\r
-               $rs = $ADODB_SESS_CONN->Execute("SELECT expireref,sesskey FROM $ADODB_SESSION_TBL WHERE sesskey='$key'");\r
-               $ADODB_SESS_CONN->SetFetchMode($savem);\r
-               if ($rs) {\r
-                       $ADODB_SESS_CONN->BeginTrans();\r
-                       while (!$rs->EOF) {\r
-                               $ref = $rs->fields[0];\r
-                               $key = $rs->fields[1];\r
-                               $fn($ref,$key);\r
-                               $del = $ADODB_SESS_CONN->Execute("DELETE FROM $ADODB_SESSION_TBL WHERE sesskey='$key'");\r
-                               $rs->MoveNext();\r
-                       }\r
-                       $ADODB_SESS_CONN->CommitTrans();\r
-               }\r
-       } else {\r
-               $qry = "DELETE FROM $ADODB_SESSION_TBL WHERE sesskey = '$key'";\r
-               $rs = $ADODB_SESS_CONN->Execute($qry);\r
-       }\r
-       return $rs ? true : false;\r
-}\r
-\r
-function adodb_sess_gc($maxlifetime) \r
-{\r
-       global $ADODB_SESS_DEBUG, $ADODB_SESS_CONN, $ADODB_SESSION_TBL,$ADODB_SESSION_EXPIRE_NOTIFY;\r
-       \r
-       if ($ADODB_SESSION_EXPIRE_NOTIFY) {\r
-               reset($ADODB_SESSION_EXPIRE_NOTIFY);\r
-               $fn = next($ADODB_SESSION_EXPIRE_NOTIFY);\r
-               $savem = $ADODB_SESS_CONN->SetFetchMode(ADODB_FETCH_NUM);\r
-               $rs = $ADODB_SESS_CONN->Execute("SELECT expireref,sesskey FROM $ADODB_SESSION_TBL WHERE expiry < " . time());\r
-               $ADODB_SESS_CONN->SetFetchMode($savem);\r
-               if ($rs) {\r
-                       $ADODB_SESS_CONN->BeginTrans();\r
-                       while (!$rs->EOF) {\r
-                               $ref = $rs->fields[0];\r
-                               $key = $rs->fields[1];\r
-                               $fn($ref,$key);\r
-                               $del = $ADODB_SESS_CONN->Execute("DELETE FROM $ADODB_SESSION_TBL WHERE sesskey='$key'");\r
-                               $rs->MoveNext();\r
-                       }\r
-                       $ADODB_SESS_CONN->CommitTrans();\r
-               }\r
-       } else {\r
-               $qry = "DELETE FROM $ADODB_SESSION_TBL WHERE expiry < " . time();\r
-               $ADODB_SESS_CONN->Execute($qry);\r
-       \r
-               if ($ADODB_SESS_DEBUG) ADOConnection::outp("<p><b>Garbage Collection</b>: $qry</p>");\r
-       }\r
-       // suggested by Cameron, "GaM3R" <gamr@outworld.cx>\r
-       if (defined('ADODB_SESSION_OPTIMIZE')) {\r
-       global $ADODB_SESSION_DRIVER;\r
-       \r
-               switch( $ADODB_SESSION_DRIVER ) {\r
-                       case 'mysql':\r
-                       case 'mysqlt':\r
-                               $opt_qry = 'OPTIMIZE TABLE '.$ADODB_SESSION_TBL;\r
-                               break;\r
-                       case 'postgresql':\r
-                       case 'postgresql7':\r
-                               $opt_qry = 'VACUUM '.$ADODB_SESSION_TBL;        \r
-                               break;\r
-               }\r
-               if (!empty($opt_qry)) {\r
-                       $ADODB_SESS_CONN->Execute($opt_qry);\r
-               }\r
-       }\r
-       if ($ADODB_SESS_CONN->dataProvider === 'oci8') $sql = 'select  TO_CHAR('.($ADODB_SESS_CONN->sysTimeStamp).', \'RRRR-MM-DD HH24:MI:SS\') from '. $ADODB_SESSION_TBL;\r
-       else $sql = 'select '.$ADODB_SESS_CONN->sysTimeStamp.' from '. $ADODB_SESSION_TBL;\r
-       \r
-       $rs =& $ADODB_SESS_CONN->SelectLimit($sql,1);\r
-       if ($rs && !$rs->EOF) {\r
-       \r
-               $dbts = reset($rs->fields);\r
-               $rs->Close();\r
-               $dbt = $ADODB_SESS_CONN->UnixTimeStamp($dbts);\r
-               $t = time();\r
-               if (abs($dbt - $t) >= ADODB_SESSION_SYNCH_SECS) {\r
-               global $HTTP_SERVER_VARS;\r
-                       $msg = \r
-                       __FILE__.": Server time for webserver {$HTTP_SERVER_VARS['HTTP_HOST']} not in synch with database: database=$dbt ($dbts), webserver=$t (diff=".(abs($dbt-$t)/3600)." hrs)";\r
-                       error_log($msg);\r
-                       if ($ADODB_SESS_DEBUG) ADOConnection::outp("<p>$msg</p>");\r
-               }\r
-       }\r
-       \r
-       return true;\r
-}\r
-\r
-session_module_name('user'); \r
-session_set_save_handler(\r
-       "adodb_sess_open",\r
-       "adodb_sess_close",\r
-       "adodb_sess_read",\r
-       "adodb_sess_write",\r
-       "adodb_sess_destroy",\r
-       "adodb_sess_gc");\r
-}\r
-\r
-/*  TEST SCRIPT -- UNCOMMENT */\r
-\r
-if (0) {\r
-GLOBAL $HTTP_SESSION_VARS;\r
-\r
-       session_start();\r
-       session_register('AVAR');\r
-       $HTTP_SESSION_VARS['AVAR'] += 1;\r
-       ADOConnection::outp( "<p>\$HTTP_SESSION_VARS['AVAR']={$HTTP_SESSION_VARS['AVAR']}</p>",false);\r
-}\r
-\r
-?>\r
diff --git a/lib/adodb/adodb-session.php b/lib/adodb/adodb-session.php
deleted file mode 100644 (file)
index 7c2d004..0000000
+++ /dev/null
@@ -1,398 +0,0 @@
-<?php\r
-/*\r
-V4.01 23 Oct 2003  (c) 2000-2003 John Lim (jlim@natsoft.com.my). All rights reserved.\r
-  Released under both BSD license and Lesser GPL library license. \r
-  Whenever there is any discrepancy between the two licenses, \r
-  the BSD license will take precedence.\r
-         Set tabs to 4 for best viewing.\r
-  \r
-  Latest version of ADODB is available at http://php.weblogs.com/adodb\r
-  ======================================================================\r
-  \r
- This file provides PHP4 session management using the ADODB database\r
-wrapper library.\r
\r
- Example\r
- =======\r
\r
-       GLOBAL $HTTP_SESSION_VARS;\r
-       include('adodb.inc.php');\r
-       include('adodb-session.php');\r
-       session_start();\r
-       session_register('AVAR');\r
-       $HTTP_SESSION_VARS['AVAR'] += 1;\r
-       print "<p>\$HTTP_SESSION_VARS['AVAR']={$HTTP_SESSION_VARS['AVAR']}</p>";\r
-       \r
-To force non-persistent connections, call adodb_session_open first before session_start():\r
-\r
-       GLOBAL $HTTP_SESSION_VARS;\r
-       include('adodb.inc.php');\r
-       include('adodb-session.php');\r
-       adodb_sess_open(false,false,false);\r
-       session_start();\r
-       session_register('AVAR');\r
-       $HTTP_SESSION_VARS['AVAR'] += 1;\r
-       print "<p>\$HTTP_SESSION_VARS['AVAR']={$HTTP_SESSION_VARS['AVAR']}</p>";\r
-\r
\r
- Installation\r
- ============\r
- 1. Create this table in your database (syntax might vary depending on your db):\r
\r
-  create table sessions (\r
-          SESSKEY char(32) not null,\r
-          EXPIRY int(11) unsigned not null,\r
-          EXPIREREF varchar(64),\r
-          DATA text not null,\r
-         primary key (sesskey)\r
-  );\r
-  \r
-  For oracle:\r
-    create table sessions (\r
-          SESSKEY char(32) not null,\r
-          EXPIRY DECIMAL(16)  not null,\r
-          EXPIREREF varchar(64),\r
-          DATA varchar(4000) not null,\r
-         primary key (sesskey)\r
-  );\r
-\r
-\r
-  2. Then define the following parameters. You can either modify\r
-     this file, or define them before this file is included:\r
-        \r
-       $ADODB_SESSION_DRIVER='database driver, eg. mysql or ibase';\r
-       $ADODB_SESSION_CONNECT='server to connect to';\r
-       $ADODB_SESSION_USER ='user';\r
-       $ADODB_SESSION_PWD ='password';\r
-       $ADODB_SESSION_DB ='database';\r
-       $ADODB_SESSION_TBL = 'sessions'\r
-       \r
-  3. Recommended is PHP 4.0.6 or later. There are documented\r
-        session bugs in earlier versions of PHP.\r
-\r
-  4. If you want to receive notifications when a session expires, then\r
-        you can tag a session with an EXPIREREF, and before the session\r
-        record is deleted, we can call a function that will pass the EXPIREREF\r
-        as the first parameter, and the session key as the second parameter.\r
-        \r
-        To do this, define a notification function, say NotifyFn:\r
-        \r
-               function NotifyFn($expireref, $sesskey)\r
-               {\r
-               }\r
-        \r
-        Then you need to define a global variable $ADODB_SESSION_EXPIRE_NOTIFY.\r
-        This is an array with 2 elements, the first being the name of the variable\r
-        you would like to store in the EXPIREREF field, and the 2nd is the \r
-        notification function's name.\r
-        \r
-        In this example, we want to be notified when a user's session \r
-        has expired, so we store the user id in the global variable $USERID, \r
-        store this value in the EXPIREREF field:\r
-        \r
-               $ADODB_SESSION_EXPIRE_NOTIFY = array('USERID','NotifyFn');\r
-               \r
-       Then when the NotifyFn is called, we are passed the $USERID as the first\r
-       parameter, eg. NotifyFn($userid, $sesskey).\r
-*/\r
-\r
-if (!defined('_ADODB_LAYER')) {\r
-       include (dirname(__FILE__).'/adodb.inc.php');\r
-}\r
-\r
-if (!defined('ADODB_SESSION')) {\r
-\r
- define('ADODB_SESSION',1);\r
\r
- /* if database time and system time is difference is greater than this, then give warning */\r
- define('ADODB_SESSION_SYNCH_SECS',60); \r
-\r
-/****************************************************************************************\\r
-       Global definitions\r
-\****************************************************************************************/\r
-GLOBAL         $ADODB_SESSION_CONNECT, \r
-       $ADODB_SESSION_DRIVER,\r
-       $ADODB_SESSION_USER,\r
-       $ADODB_SESSION_PWD,\r
-       $ADODB_SESSION_DB,\r
-       $ADODB_SESS_CONN,\r
-       $ADODB_SESS_LIFE,\r
-       $ADODB_SESS_DEBUG,\r
-       $ADODB_SESSION_EXPIRE_NOTIFY,\r
-       $ADODB_SESSION_CRC;\r
-       \r
-       \r
-       $ADODB_SESS_LIFE = ini_get('session.gc_maxlifetime');\r
-       if ($ADODB_SESS_LIFE <= 1) {\r
-        // bug in PHP 4.0.3 pl 1  -- how about other versions?\r
-        //print "<h3>Session Error: PHP.INI setting <i>session.gc_maxlifetime</i>not set: $ADODB_SESS_LIFE</h3>";\r
-               $ADODB_SESS_LIFE=1440;\r
-       }\r
-       $ADODB_SESSION_CRC = false;\r
-       //$ADODB_SESS_DEBUG = true;\r
-       \r
-       //////////////////////////////////\r
-       /* SET THE FOLLOWING PARAMETERS */\r
-       //////////////////////////////////\r
-       \r
-       if (empty($ADODB_SESSION_DRIVER)) {\r
-               $ADODB_SESSION_DRIVER='mysql';\r
-               $ADODB_SESSION_CONNECT='localhost';\r
-               $ADODB_SESSION_USER ='root';\r
-               $ADODB_SESSION_PWD ='';\r
-               $ADODB_SESSION_DB ='xphplens_2';\r
-       }\r
-       \r
-       if (empty($ADODB_SESSION_EXPIRE_NOTIFY)) {\r
-               $ADODB_SESSION_EXPIRE_NOTIFY = false;\r
-       }\r
-       //  Made table name configurable - by David Johnson djohnson@inpro.net\r
-       if (empty($ADODB_SESSION_TBL)){\r
-               $ADODB_SESSION_TBL = 'sessions';\r
-       }\r
-       \r
-       /*\r
-       $ADODB_SESS['driver'] = $ADODB_SESSION_DRIVER;\r
-       $ADODB_SESS['connect'] = $ADODB_SESSION_CONNECT;\r
-       $ADODB_SESS['user'] = $ADODB_SESSION_USER;\r
-       $ADODB_SESS['pwd'] = $ADODB_SESSION_PWD;\r
-       $ADODB_SESS['db'] = $ADODB_SESSION_DB;\r
-       $ADODB_SESS['life'] = $ADODB_SESS_LIFE;\r
-       $ADODB_SESS['debug'] = $ADODB_SESS_DEBUG;\r
-       \r
-       $ADODB_SESS['debug'] = $ADODB_SESS_DEBUG;\r
-       $ADODB_SESS['table'] = $ADODB_SESS_TBL;\r
-       */\r
-       \r
-/****************************************************************************************\\r
-       Create the connection to the database. \r
-       \r
-       If $ADODB_SESS_CONN already exists, reuse that connection\r
-\****************************************************************************************/\r
-function adodb_sess_open($save_path, $session_name,$persist=true) \r
-{\r
-GLOBAL $ADODB_SESS_CONN;\r
-       if (isset($ADODB_SESS_CONN)) return true;\r
-       \r
-GLOBAL         $ADODB_SESSION_CONNECT, \r
-       $ADODB_SESSION_DRIVER,\r
-       $ADODB_SESSION_USER,\r
-       $ADODB_SESSION_PWD,\r
-       $ADODB_SESSION_DB,\r
-       $ADODB_SESS_DEBUG;\r
-       \r
-       // cannot use & below - do not know why...\r
-       $ADODB_SESS_CONN = ADONewConnection($ADODB_SESSION_DRIVER);\r
-       if (!empty($ADODB_SESS_DEBUG)) {\r
-               $ADODB_SESS_CONN->debug = true;\r
-               ADOConnection::outp( " conn=$ADODB_SESSION_CONNECT user=$ADODB_SESSION_USER pwd=$ADODB_SESSION_PWD db=$ADODB_SESSION_DB ");\r
-       }\r
-       if ($persist) $ok = $ADODB_SESS_CONN->PConnect($ADODB_SESSION_CONNECT,\r
-                       $ADODB_SESSION_USER,$ADODB_SESSION_PWD,$ADODB_SESSION_DB);\r
-       else $ok = $ADODB_SESS_CONN->Connect($ADODB_SESSION_CONNECT,\r
-                       $ADODB_SESSION_USER,$ADODB_SESSION_PWD,$ADODB_SESSION_DB);\r
-       \r
-       if (!$ok) ADOConnection::outp( "<p>Session: connection failed</p>",false);\r
-}\r
-\r
-/****************************************************************************************\\r
-       Close the connection\r
-\****************************************************************************************/\r
-function adodb_sess_close() \r
-{\r
-global $ADODB_SESS_CONN;\r
-\r
-       if ($ADODB_SESS_CONN) $ADODB_SESS_CONN->Close();\r
-       return true;\r
-}\r
-\r
-/****************************************************************************************\\r
-       Slurp in the session variables and return the serialized string\r
-\****************************************************************************************/\r
-function adodb_sess_read($key) \r
-{\r
-global $ADODB_SESS_CONN,$ADODB_SESSION_TBL,$ADODB_SESSION_CRC;\r
-\r
-       $rs = $ADODB_SESS_CONN->Execute("SELECT data FROM $ADODB_SESSION_TBL WHERE sesskey = '$key' AND expiry >= " . time());\r
-       if ($rs) {\r
-               if ($rs->EOF) {\r
-                       $v = '';\r
-               } else \r
-                       $v = rawurldecode(reset($rs->fields));\r
-                       \r
-               $rs->Close();\r
-               \r
-               // new optimization adodb 2.1\r
-               $ADODB_SESSION_CRC = strlen($v).crc32($v);\r
-               \r
-               return $v;\r
-       }\r
-       \r
-       return ''; // thx to Jorma Tuomainen, webmaster#wizactive.com\r
-}\r
-\r
-/****************************************************************************************\\r
-       Write the serialized data to a database.\r
-       \r
-       If the data has not been modified since adodb_sess_read(), we do not write.\r
-\****************************************************************************************/\r
-function adodb_sess_write($key, $val) \r
-{\r
-       global\r
-               $ADODB_SESS_CONN, \r
-               $ADODB_SESS_LIFE, \r
-               $ADODB_SESSION_TBL,\r
-               $ADODB_SESS_DEBUG, \r
-               $ADODB_SESSION_CRC,\r
-               $ADODB_SESSION_EXPIRE_NOTIFY;\r
-\r
-       $expiry = time() + $ADODB_SESS_LIFE;\r
-       \r
-       // crc32 optimization since adodb 2.1\r
-       // now we only update expiry date, thx to sebastian thom in adodb 2.32\r
-       if ($ADODB_SESSION_CRC !== false && $ADODB_SESSION_CRC == strlen($val).crc32($val)) {\r
-               if ($ADODB_SESS_DEBUG) echo "<p>Session: Only updating date - crc32 not changed</p>";\r
-               $qry = "UPDATE $ADODB_SESSION_TBL SET expiry=$expiry WHERE sesskey='$key' AND expiry >= " . time();\r
-               $rs = $ADODB_SESS_CONN->Execute($qry);  \r
-               return true;\r
-       }\r
-       $val = rawurlencode($val);\r
-       \r
-       $arr = array('sesskey' => $key, 'expiry' => $expiry, 'data' => $val);\r
-       if ($ADODB_SESSION_EXPIRE_NOTIFY) {\r
-               $var = reset($ADODB_SESSION_EXPIRE_NOTIFY);\r
-               global $$var;\r
-               $arr['expireref'] = $$var;\r
-       }\r
-       $rs = $ADODB_SESS_CONN->Replace($ADODB_SESSION_TBL,$arr,\r
-       'sesskey',$autoQuote = true);\r
-       \r
-       if (!$rs) {\r
-               ADOConnection::outp( '<p>Session Replace: '.$ADODB_SESS_CONN->ErrorMsg().'</p>',false);\r
-       }  else {\r
-               // bug in access driver (could be odbc?) means that info is not commited\r
-               // properly unless select statement executed in Win2000\r
-               if ($ADODB_SESS_CONN->databaseType == 'access') \r
-                       $rs = $ADODB_SESS_CONN->Execute("select sesskey from $ADODB_SESSION_TBL WHERE sesskey='$key'");\r
-       }\r
-       return !empty($rs);\r
-}\r
-\r
-function adodb_sess_destroy($key) \r
-{\r
-       global $ADODB_SESS_CONN, $ADODB_SESSION_TBL,$ADODB_SESSION_EXPIRE_NOTIFY;\r
-       \r
-       if ($ADODB_SESSION_EXPIRE_NOTIFY) {\r
-               reset($ADODB_SESSION_EXPIRE_NOTIFY);\r
-               $fn = next($ADODB_SESSION_EXPIRE_NOTIFY);\r
-               $savem = $ADODB_SESS_CONN->SetFetchMode(ADODB_FETCH_NUM);\r
-               $rs = $ADODB_SESS_CONN->Execute("SELECT expireref,sesskey FROM $ADODB_SESSION_TBL WHERE sesskey='$key'");\r
-               $ADODB_SESS_CONN->SetFetchMode($savem);\r
-               if ($rs) {\r
-                       $ADODB_SESS_CONN->BeginTrans();\r
-                       while (!$rs->EOF) {\r
-                               $ref = $rs->fields[0];\r
-                               $key = $rs->fields[1];\r
-                               $fn($ref,$key);\r
-                               $del = $ADODB_SESS_CONN->Execute("DELETE FROM $ADODB_SESSION_TBL WHERE sesskey='$key'");\r
-                               $rs->MoveNext();\r
-                       }\r
-                       $ADODB_SESS_CONN->CommitTrans();\r
-               }\r
-       } else {\r
-               $qry = "DELETE FROM $ADODB_SESSION_TBL WHERE sesskey = '$key'";\r
-               $rs = $ADODB_SESS_CONN->Execute($qry);\r
-       }\r
-       return $rs ? true : false;\r
-}\r
-\r
-function adodb_sess_gc($maxlifetime) \r
-{\r
-       global $ADODB_SESS_DEBUG, $ADODB_SESS_CONN, $ADODB_SESSION_TBL,$ADODB_SESSION_EXPIRE_NOTIFY;\r
-       \r
-       if ($ADODB_SESSION_EXPIRE_NOTIFY) {\r
-               reset($ADODB_SESSION_EXPIRE_NOTIFY);\r
-               $fn = next($ADODB_SESSION_EXPIRE_NOTIFY);\r
-               $savem = $ADODB_SESS_CONN->SetFetchMode(ADODB_FETCH_NUM);\r
-               $rs =& $ADODB_SESS_CONN->Execute("SELECT expireref,sesskey FROM $ADODB_SESSION_TBL WHERE expiry < " . time());\r
-               $ADODB_SESS_CONN->SetFetchMode($savem);\r
-               if ($rs) {\r
-                       $ADODB_SESS_CONN->BeginTrans();\r
-                       while (!$rs->EOF) {\r
-                               $ref = $rs->fields[0];\r
-                               $key = $rs->fields[1];\r
-                               $fn($ref,$key);\r
-                               $del = $ADODB_SESS_CONN->Execute("DELETE FROM $ADODB_SESSION_TBL WHERE sesskey='$key'");\r
-                               $rs->MoveNext();\r
-                       }\r
-                       $ADODB_SESS_CONN->CommitTrans();\r
-               }\r
-       } else {\r
-               $qry = "DELETE FROM $ADODB_SESSION_TBL WHERE expiry < " . time();\r
-               $ADODB_SESS_CONN->Execute($qry);\r
-       \r
-               if ($ADODB_SESS_DEBUG) ADOConnection::outp("<p><b>Garbage Collection</b>: $qry</p>");\r
-       }\r
-       // suggested by Cameron, "GaM3R" <gamr@outworld.cx>\r
-       if (defined('ADODB_SESSION_OPTIMIZE')) {\r
-       global $ADODB_SESSION_DRIVER;\r
-       \r
-               switch( $ADODB_SESSION_DRIVER ) {\r
-                       case 'mysql':\r
-                       case 'mysqlt':\r
-                               $opt_qry = 'OPTIMIZE TABLE '.$ADODB_SESSION_TBL;\r
-                               break;\r
-                       case 'postgresql':\r
-                       case 'postgresql7':\r
-                               $opt_qry = 'VACUUM '.$ADODB_SESSION_TBL;        \r
-                               break;\r
-               }\r
-               if (!empty($opt_qry)) {\r
-                       $ADODB_SESS_CONN->Execute($opt_qry);\r
-               }\r
-       }\r
-       if ($ADODB_SESS_CONN->dataProvider === 'oci8') $sql = 'select  TO_CHAR('.($ADODB_SESS_CONN->sysTimeStamp).', \'RRRR-MM-DD HH24:MI:SS\') from '. $ADODB_SESSION_TBL;\r
-       else $sql = 'select '.$ADODB_SESS_CONN->sysTimeStamp.' from '. $ADODB_SESSION_TBL;\r
-       \r
-       $rs =& $ADODB_SESS_CONN->SelectLimit($sql,1);\r
-       if ($rs && !$rs->EOF) {\r
-       \r
-               $dbts = reset($rs->fields);\r
-               $rs->Close();\r
-               $dbt = $ADODB_SESS_CONN->UnixTimeStamp($dbts);\r
-               $t = time();\r
-       \r
-               if (abs($dbt - $t) >= ADODB_SESSION_SYNCH_SECS) {\r
-               global $HTTP_SERVER_VARS;\r
-                       $msg = \r
-                       __FILE__.": Server time for webserver {$HTTP_SERVER_VARS['HTTP_HOST']} not in synch with database: database=$dbt ($dbts), webserver=$t (diff=".(abs($dbt-$t)/3600)." hrs)";\r
-                       error_log($msg);\r
-                       if ($ADODB_SESS_DEBUG) ADOConnection::outp("<p>$msg</p>");\r
-               }\r
-       }\r
-       \r
-       return true;\r
-}\r
-\r
-session_module_name('user'); \r
-session_set_save_handler(\r
-       "adodb_sess_open",\r
-       "adodb_sess_close",\r
-       "adodb_sess_read",\r
-       "adodb_sess_write",\r
-       "adodb_sess_destroy",\r
-       "adodb_sess_gc");\r
-}\r
-\r
-/*  TEST SCRIPT -- UNCOMMENT */\r
-\r
-if (0) {\r
-GLOBAL $HTTP_SESSION_VARS;\r
-\r
-       session_start();\r
-       session_register('AVAR');\r
-       $HTTP_SESSION_VARS['AVAR'] += 1;\r
-       ADOConnection::outp( "<p>\$HTTP_SESSION_VARS['AVAR']={$HTTP_SESSION_VARS['AVAR']}</p>",false);\r
-}\r
-\r
-?>
\ No newline at end of file
diff --git a/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/Changelog b/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/Changelog
deleted file mode 100644 (file)
index aeabe1d..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-2003-05-03 14:20  richtl
-
-       * INSTALL, xmlschema.html: Renamed adodb-xmlschema.php to
-       adodb-xmlschema.inc.php in the docs.
-
-2003-05-03 14:17  richtl
-
-       * adodb-xmlschema.inc.php, adodb-xmlschema.php: Renamed
-       adodb-xmlschema.php to adodb-xmlschema.inc.php to fit in with the
-       ADODB standard.
-
-2003-05-03 14:16  richtl
-
-       * xmlschema.html: Fixed a doc bug in the example.
-
-2003-05-03 14:15  richtl
-
-       * example.php, example.xml: Initial add to CVS
-
-2003-05-03 13:46  richtl
-
-       * adodb-xmlschema.php, xmlschema.html, INSTALL, LICENSE, README,
-       xmlschema.dtd, docs/blank.html, docs/classtrees_xmlschema.html,
-       docs/elementindex.html, docs/elementindex_xmlschema.html,
-       docs/errors.html, docs/index.html, docs/li_xmlschema.html,
-       docs/packages.html, docs/media/bg_left.png,
-       docs/media/stylesheet.css,
-       docs/xmlschema/_adodb-xmlschema_php.html,
-       docs/xmlschema/adoSchema.html,
-       docs/xmlschema/package_xmlschema.html: Initial import
-
-2003-05-03 13:46  richtl
-
-       * adodb-xmlschema.php, xmlschema.html, INSTALL, LICENSE, README,
-       xmlschema.dtd, docs/blank.html, docs/classtrees_xmlschema.html,
-       docs/elementindex.html, docs/elementindex_xmlschema.html,
-       docs/errors.html, docs/index.html, docs/li_xmlschema.html,
-       docs/packages.html, docs/media/bg_left.png,
-       docs/media/stylesheet.css,
-       docs/xmlschema/_adodb-xmlschema_php.html,
-       docs/xmlschema/adoSchema.html,
-       docs/xmlschema/package_xmlschema.html: Initial revision
-
diff --git a/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/INSTALL b/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/INSTALL
deleted file mode 100644 (file)
index 2735584..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-INSTALL
-
-To install adodb-xmlschema, simply copy the adodb-xmlschema.inc.php file into your ADODB directory.
-
-------------------------------------------------------------------------------------------------------------------------------------
-If you have any questions or comments, please email them to me at richtl@arscognita.com.
-
-$Id$
\ No newline at end of file
diff --git a/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/LICENSE b/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/LICENSE
deleted file mode 100644 (file)
index d15af7a..0000000
+++ /dev/null
@@ -1,544 +0,0 @@
-adodb-xmlschema is dual licensed using BSD-Style and LGPL. Where there is any di
-screpancy, the BSD-Style license will take precedence. In plain English, you do
-not need to distribute your application  in source code form, nor do you need to
- distribute adodb-xmlschema source code, provided you follow the rest of terms o
-f the BSD-style license.
-
-Commercial use of adodb-xmlschema is encouraged. Make money and multiply!
-
-BSD Style-License
-=================
-
-Copyright (c) 2003 ars Cognita, Inc. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification,
-
-are permitted provided that the following conditions are met:
-
-Redistributions of source code must retain the above copyright notice, this list
- of conditions and the following disclaimer.
-Redistributions in binary form must reproduce the above copyright notice, this l
-ist of conditions and the following disclaimer in the documentation and/or other
- materials provided with the distribution.
-Neither the name of the John Lim nor the names of its contributors may be used t
-o endorse or promote products derived from this software without specific prior
-written permission.
-
-DISCLAIMER:
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WA
-RRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIREC
-T, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR P
-ROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWI
-SE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE P
-OSSIBILITY OF SUCH DAMAGE.
-
-==========================================================
-
-                 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
-\f
-           How to Apply These Terms to Your New Libraries
-
-  If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change.  You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
-  To apply these terms, attach the following notices to the library.  It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the library's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    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 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
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the
-  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
-  <signature of Ty Coon>, 1 April 1990
-  Ty Coon, President of Vice
-
-That's all there is to it!
-
-
diff --git a/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/README b/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/README
deleted file mode 100644 (file)
index 2a290cc..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-adodb-xmlschema
-------------------------------------------------------------------------------------------------------------------------------------
-Written by Richard Tango-Lowy.
-For more information, contact richtl@arscognita.com or visit our site at www.arscognita.com.
-
-To report bugs or comments, see the ADOdb main README file.
-
-Introduction:
-
-adodb-xmlschema is a class that allows the user to quickly and easily build a database on any 
-ADOdb-supported platform using a simple XML format.
-
-This library is dual-licensed under a BSD-style license and under the GNU LESSER PUBLIC LICENSE.
-See the LICENSE file for more information.
-
-Features:
-
-  * Darned easy to install 
-  * Quickly to create schemas that build on any platform supported by ADODB.
-
-Notes:
-
-See the INSTALL file for installation notes.
-See docs/index.html for documentation, including installation, use, and tutorials.
-
-Thanks:
-
-Thanks to John Lim for giving us ADODB, and for the hard work that keeps it on top of things. 
-And particulary for the datadict code that made xmlschema possible.
-And to the kind folks at PHP Documentor. Cool tool.
-And to Linus. I thought the end of Amiga was the end of computing. Guess I was wrong :-)
-
-------------------------------------------------------------------------------------------------------------------------------------
-If you have any questions or comments, please email them to me at richtl@arscognita.com.
-
-$Id$
\ No newline at end of file
diff --git a/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/adodb-xmlschema.inc.php b/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/adodb-xmlschema.inc.php
deleted file mode 100644 (file)
index 64309aa..0000000
+++ /dev/null
@@ -1,722 +0,0 @@
-<?PHP
- /* ******************************************************************************
-    Released under both BSD license and Lesser GPL library license. 
-       Whenever there is any discrepancy between the two licenses, 
-       the BSD license will take precedence. 
-*******************************************************************************/
-/**
- * xmlschema is a class that allows the user to quickly and easily
- * build a database on any ADOdb-supported platform using a simple
- * XML schema.
- *
- * @author                     Richard Tango-Lowy
- * @version            $Revision$
- * @copyright  Copyright (c) 2003 ars Cognita Inc., all rights reserved
- *
- * @package            xmlschema
- */
-/**
-  * Include the main ADODB library
-  */
-if (!defined( '_ADODB_LAYER' ) ) {
-       require( 'adodb.inc.php' );
-}
-
-/**
- * Creates a table object in ADOdb's datadict format
- *
- * This class stores information about a database table. As charactaristics
- * of the table are loaded from the external source, methods and properties
- * of this class are used to build up the table description in ADOdb's
-*  datadict format.
- *
- * @package xmlschema
- * @access private
- */
-class dbTable {
-       
-       /**
-       * @var string   Table name
-       */
-       var $tableName;
-       
-       /**
-       * @var array    Field specifier: Meta-information about each field
-       */
-       var $fieldSpec;
-       
-       /**
-       * @var array    Table options: Table-level options
-       */
-       var $tableOpts;
-       
-       /**
-       * @var string   Field index: Keeps track of which field is currently being processed
-       */
-       var $currentField;
-       
-       /**
-       * Constructor. Iniitializes a new table object.
-       *
-       * @param string $name           Table name
-       */
-       function dbTable( $name ) {
-               $this->tableName = $name;
-       }
-       
-       /**
-       * Adds a field to a table object
-       *
-       * $name is the name of the table to which the field should be added. 
-       * $type is an ADODB datadict field type. The following field types
-       * are supported as of ADODB 3.40:
-       *       - C:  varchar
-       *       - X:  CLOB (character large object) or largest varchar size
-       *          if CLOB is not supported
-       *       - C2: Multibyte varchar
-       *       - X2: Multibyte CLOB
-       *       - B:  BLOB (binary large object)
-       *       - D:  Date (some databases do not support this, and we return a datetime type)
-       *       - T:  Datetime or Timestamp
-       *       - L:  Integer field suitable for storing booleans (0 or 1)
-       *       - I:  Integer (mapped to I4)
-       *       - I1: 1-byte integer
-       *       - I2: 2-byte integer
-       *       - I4: 4-byte integer
-       *       - I8: 8-byte integer
-       *       - F:  Floating point number
-       *       - N:  Numeric or decimal number
-       *
-       * @param string $name   Name of the table to which the field will be added.
-       * @param string $type           ADODB datadict field type.
-       * @param string $size           Field size
-       * @param array $opts            Field options array
-       * @return array Field specifier array
-       */
-       function addField( $name, $type, $size = NULL, $opts = NULL ) {
-       
-               // Set the field index so we know where we are
-               $this->currentField = $name;
-               
-               // Set the field type (required)
-               $this->fieldSpec[$name]['TYPE'] = $type;
-               
-               // Set the field size (optional)
-               if( isset( $size ) ) {
-                       $this->fieldSpec[$name]['SIZE'] = $size;
-               }
-               
-               // Set the field options
-               if( isset( $opts ) ) $this->fieldSpec[$name]['OPTS'] = $opts;
-               
-               // Return array containing field specifier
-               return $this->fieldSpec;
-       }
-       
-       /**
-       * Adds a field option to the current field specifier
-       *
-       * This method adds a field option allowed by the ADOdb datadict 
-       * and appends it to the given field.
-       *
-       * @param string $field          Field name
-       * @param string $opt            ADOdb field option
-       * @param mixed $value   Field option value
-       * @return array Field specifier array
-       */
-       function addFieldOpt( $field, $opt, $value = NULL ) {
-               
-               // Add the option to the field specifier
-               if(  $value === NULL ) { // No value, so add only the option
-                       $this->fieldSpec[$field]['OPTS'][] = $opt;
-               } else { // Add the option and value
-                       $this->fieldSpec[$field]['OPTS'][] = array( "$opt" => "$value" );
-               }
-       
-               // Return array containing field specifier
-               return $this->fieldSpec;
-       }
-       
-       /**
-       * Adds an option to the table
-       *
-       *This method takes a comma-separated list of table-level options
-       * and appends them to the table object.
-       *
-       * @param string $opt            Table option
-       * @return string        Option list
-       */
-       function addTableOpt( $opt ) {
-       
-               $optlist = &$this->tableOpts;
-               $optlist ? $optlist .= ", $opt" : $optlist = $opt;
-               
-               // Return the options list
-               return $optlist;
-       }
-       
-       /**
-       * Generates the SQL that will create the table in the database
-       *
-       * Returns SQL that will create the table represented by the object.
-       *
-       * @param object $dict           ADOdb data dictionary
-       * @return array Array containing table creation SQL
-       */
-       function create( $dict ) {
-       
-               // Loop through the field specifier array, building the associative array for the field options
-               $fldarray = array();
-               $i = 0;
-               
-               foreach( $this->fieldSpec as $field => $finfo ) {
-                       $i++;
-                       
-                       // Set an empty size if it isn't supplied
-                       if( !isset( $finfo['SIZE'] ) ) $finfo['SIZE'] = '';
-                       
-                       // Initialize the field array with the type and size
-                       $fldarray[$i] = array( $field, $finfo['TYPE'], $finfo['SIZE'] );
-                       
-                       // Loop through the options array and add the field options. 
-                       $opts = $finfo['OPTS'];
-                       if( $opts ) {
-                               foreach( $finfo['OPTS'] as $opt ) {
-                                       
-                                       if( is_array( $opt ) ) { // Option has an argument.
-                                               $key = key( $opt );
-                                               $value = $opt[key( $opt ) ];
-                                               $fldarray[$i][$key] = $value;
-                                       } else { // Option doesn't have arguments
-                                               array_push( $fldarray[$i], $opt );
-                                       }
-                               }
-                       }
-               }
-               
-               // Build table array
-               $sqlArray = $dict->CreateTableSQL( $this->tableName, $fldarray, $this->tableOpts );
-               
-               // Return the array containing the SQL to create the table
-               return $sqlArray;
-       }
-       
-       /**
-       * Destructor
-       */
-       function destroy() {
-               unset( $this );
-       }
-}
-
-/**
-* Creates an index object in ADOdb's datadict format
-*
-* This class stores information about a database index. As charactaristics
-* of the index are loaded from the external source, methods and properties
-* of this class are used to build up the index description in ADOdb's
-* datadict format.
-*
-* @package xmlschema
-* @access private
-*/
-class dbIndex {
-       
-       /**
-       * @var string   Index name
-       */
-       var $indexName;
-       
-       /**
-       * @var string   Name of the table this index is attached to
-       */
-       var $tableName;
-       
-       /**
-       * @var array    Indexed fields: Table columns included in this index
-       */
-       var $fields;
-       
-       /**
-       * Constructor. Initialize the index and table names.
-       *
-       * @param string $name   Index name
-       * @param string $table          Name of indexed table
-       */
-       function dbIndex( $name, $table ) {
-               $this->indexName = $name;
-               $this->tableName = $table;
-       }
-       
-       /**
-       * Adds a field to the index
-       * 
-       * This method adds the specified column to an index.
-       *
-       * @param string $name           Field name
-       * @return string        Field list
-       */
-       function addField( $name ) {
-               $fieldlist = &$this->fields;
-               $fieldlist ? $fieldlist .=" , $name" : $fieldlist = $name;
-               
-               // Return the field list
-               return $fieldlist;
-       }
-       
-       /**
-       * Generates the SQL that will create the index in the database
-       *
-       * Returns SQL that will create the index represented by the object.
-       *
-       * @param object $dict   ADOdb data dictionary object
-       * @return array Array containing index creation SQL
-       */
-       function create( $dict ) {
-       
-               // Build table array
-               $sqlArray = $dict->CreateIndexSQL( $this->indexName, $this->tableName, $this->fields );
-               
-               // Return the array containing the SQL to create the table
-               return $sqlArray;
-       }
-       
-       /**
-       * Destructor
-       */
-       function destroy() {
-               unset( $this );
-       }
-}
-
-/**
-* Creates the SQL to execute a list of provided SQL queries
-*
-* This class compiles a list of SQL queries specified in the external file.
-*
-* @package xmlschema
-* @access private
-*/
-class dbQuerySet {
-       
-       /**
-       * @var array    List of SQL queries
-       */
-       var $querySet;
-       
-       /**
-       * @var string   String used to build of a query line by line
-       */
-       var $query;
-       
-       /**
-       * Constructor. Initializes the queries array
-       */
-       function dbQuerySet() {
-               $this->querySet = array();
-               $this->query = '';
-       }
-       
-       /** 
-       * Appends a line to a query that is being built line by line
-       *
-       * $param string $data   Line of SQL data or NULL to initialize a new query
-       */
-       function buildQuery( $data = NULL ) {
-               isset( $data ) ? $this->query .= " " . trim( $data ) : $this->query = '';
-       }
-       
-       /**
-       * Adds a completed query to the query list
-       *
-       * @return string        SQL of added query
-       */
-       function addQuery() {
-               
-               // Push the query onto the query set array
-               $finishedQuery = $this->query;
-               array_push( $this->querySet, $finishedQuery );
-               
-               // Return the query set array
-               return $finishedQuery;
-       }
-       
-       /**
-       * Creates and returns the current query set
-       *
-       * @return array Query set
-       */
-       function create() {
-               return $this->querySet;
-       }
-       
-       /**
-       * Destructor
-       */
-       function destroy() {
-               unset( $this );
-       }
-}
-
-
-/**
-* Loads and parses an XML file, creating an array of "ready-to-run" SQL statements
-* 
-* This class is used to load and parse the XML file, to create an array of SQL statements
-* that can be used to build a database, and to build the database using the SQL array.
-*
-* @package xmlschema
-*/
-class adoSchema {
-       
-       /**
-       * @var array    Array containing SQL queries to generate all objects
-       */
-       var $sqlArray;
-       
-       /**
-       * @var object   XML Parser object
-       */
-       var $xmlParser;
-       
-       /**
-       * @var object   ADOdb connection object
-       */
-       var $dbconn;
-       
-       /**
-       * @var string   Database type (platform)
-       */
-       var $dbType;
-       
-       /**
-       * @var object   ADOdb Data Dictionary
-       */
-       var $dict;
-       
-       /**
-       * @var object   Temporary dbTable object
-       * @access private
-       */
-       var $table;
-       
-       /**
-       * @var object   Temporary dbIndex object
-       * @access private
-       */
-       var $index;
-       
-       /**
-       * @var object   Temporary dbQuerySet object
-       * @access private
-       */
-       var $querySet;
-       
-       /**
-       * @var string Current XML element
-       * @access private
-       */
-       var $currentElement;
-       
-       /**
-       * @var long     Original Magic Quotes Runtime value
-       * @access private
-       */
-       var $mgq;
-       
-       /**
-       * Constructor. Initializes the xmlschema object
-       *
-       * @param object $dbconn         ADOdb connection object
-       */
-       function adoSchema( $dbconn ) {
-               
-               // Initialize the environment
-               $this->mgq = get_magic_quotes_runtime();
-               set_magic_quotes_runtime(0);    
-               
-               $this->dbconn   =  &$dbconn;
-               $this->dbType = $dbconn->databaseType;
-               $this->sqlArray = array();
-               
-               // Create an ADOdb dictionary object
-               $this->dict = NewDataDictionary( $dbconn );
-       }
-       
-       /**
-       * Loads and parses an XML file
-       *
-       * This method accepts a path to an xmlschema-compliant XML file,
-       * loads it, parses it, and uses it to create the SQL to generate the objects
-       * described by the XML file.
-       *
-       * @param string $file           XML file
-       * @return array Array of SQL queries, ready to execute
-       */
-       function ParseSchema( $file ) {
-       
-               // Create the parser
-               $this->xmlParser = &$xmlParser;
-               $xmlParser = xml_parser_create();
-               xml_set_object( $xmlParser, &$this );
-               
-               // Initialize the XML callback functions
-               xml_set_element_handler( $xmlParser, "_xmlcb_startElement", "_xmlcb_endElement" );
-               xml_set_character_data_handler( $xmlParser, "_xmlcb_cData" );
-               
-               // Open the file
-               if( !( $fp = fopen( $file, "r" ) ) ) {
-                       die( "Unable to open file" );
-               }
-               
-               // Process the file
-               while( $data = fread( $fp, 4096 ) ) {
-                       if( !xml_parse( $xmlParser, $data, feof( $fp ) ) ) {
-                               die( sprint( "XML error: %s at line %d",
-                                       xml_error_string( xml_get_error_code( $xmlParser ) ),
-                                       xml_get_current_line_number( $xmlParser ) ) );
-                       }
-               }
-               
-               // Return the array of queries
-               return $this->sqlArray;
-       }
-       
-       /**
-       * Loads a schema into the database
-       *
-       * Accepts an array of SQL queries generated by the parser 
-       * and executes them.
-       *
-       * @param array $sqlArray        Array of SQL statements
-       * @param boolean $continueOnErr Don't fail out if an error is encountered
-       * @return integer       0 if failed, 1 if errors, 2 if successful
-       */
-       function ExecuteSchema( $sqlArray, $continueOnErr =  TRUE ) {
-               $err = $this->dict->ExecuteSQLArray( $sqlArray, $continueOnErr );
-               
-               // Return the success code
-               return $err;
-       }
-       
-       /**
-       * XML Callback to process start elements
-       *
-       * @access private
-       */
-       function _xmlcb_startElement( $parser, $name, $attrs ) {
-               
-               $dbType = $this->dbType;
-               if( isset( $this->table ) ) $table = &$this->table;
-               if( isset( $this->index ) ) $index = &$this->index;
-               if( isset( $this->querySet ) ) $querySet = &$this->querySet;
-               $this->currentElement = $name;
-               
-               // Process the element. Ignore unimportant elements.
-               if( in_array( trim( $name ),  array( "SCHEMA", "DESCR", "COL", "CONSTRAINT" ) ) ) {
-                       return FALSE;
-               }
-               
-               switch( $name ) {
-                               
-                       case "TABLE":   // Table element
-                               if( $this->supportedPlatform( $attrs['PLATFORM'] ) ) {
-                                       $this->table = new dbTable( $attrs['NAME'] );
-                               } else {
-                                       unset( $this->table );
-                               }
-                               break;
-                               
-                       case "FIELD":   // Table field
-                               if( isset( $this->table ) ) {
-                                       $fieldName = $attrs['NAME'];
-                                       $fieldType = $attrs['TYPE'];
-                                       isset( $attrs['SIZE'] ) ? $fieldSize = $attrs['SIZE'] : $fieldSize = NULL;
-                                       isset( $attrs['OPTS'] ) ? $fieldOpts = $attrs['OPTS'] : $fieldOpts = NULL;
-                                       $this->table->addField( $fieldName, $fieldType, $fieldSize, $fieldOpts );
-                               }
-                               break;
-                               
-                       case "KEY":     // Table field option
-                               if( isset( $this->table ) ) {
-                                       $this->table->addFieldOpt( $this->table->currentField, 'KEY' );
-                               }
-                               break;
-                               
-                       case "NOTNULL": // Table field option
-                               if( isset( $this->table ) ) {
-                                       $this->table->addFieldOpt( $this->table->currentField, 'NOTNULL' );
-                               }
-                               break;
-                               
-                       case "AUTOINCREMENT":   // Table field option
-                               if( isset( $this->table ) ) {
-                                       $this->table->addFieldOpt( $this->table->currentField, 'AUTOINCREMENT' );
-                               }
-                               break;
-                               
-                       case "DEFAULT": // Table field option
-                               if( isset( $this->table ) ) {
-                                       $this->table->addFieldOpt( $this->table->currentField, 'DEFAULT', $attrs['VALUE'] );
-                               }
-                               break;
-                               
-                       case "INDEX":   // Table index
-                               if( $this->supportedPlatform( $attrs['PLATFORM'] ) ) {
-                                       $this->index = new dbIndex( $attrs['NAME'], $attrs['TABLE'] );
-                               } else {
-                                       if( isset( $this->index ) ) unset( $this->index );
-                               }
-                               break;
-                               
-                       case "SQL":     // Freeform SQL queryset
-                               if( $this->supportedPlatform( $attrs['PLATFORM'] ) ) {
-                                       $this->querySet = new dbQuerySet( $attrs );
-                               } else {
-                                       if( isset( $this->querySet ) ) unset( $this->querySet );
-                               }
-                               break;
-                               
-                       case "QUERY":   // Queryset SQL query
-                               if( isset( $this->querySet ) ) {
-                                       // Ignore this query set if a platform is specified and it's different than the 
-                                       // current connection platform.
-                                       if( $this->supportedPlatform( $attrs['PLATFORM'] ) ) {
-                                               $this->querySet->buildQuery();
-                                       } else {
-                                               if( isset( $this->querySet->query ) ) unset( $this->querySet->query );
-                                       }
-                               }
-                               break;
-                               
-                       default:
-                               print "OPENING ELEMENT '$name'<BR/>\n";
-               }       
-       }
-
-       /**
-       * XML Callback to process cDATA elements
-       *
-       * @access private
-       */
-       function _xmlcb_cData( $parser, $data ) {
-               
-               $element = &$this->currentElement;
-               
-               if( trim( $data ) == "" ) return;
-               
-               // Process the data depending on the element
-               switch( $element ) {
-               
-                       case "COL":     // Index column
-                               if( isset( $this->index ) ) $this->index->addField( $data );
-                               break;
-                               
-                       case "DESCR":   // Description element
-                               // Display the description information
-                               if( isset( $this->table ) ) {
-                                       $name = "({$this->table->tableName}):  ";
-                               } elseif( isset( $this->index ) ) {
-                                       $name = "({$this->index->indexName}):  ";
-                               } else {
-                                       $name = "";
-                               }
-                               print "<LI> $name $data\n";
-                               break;
-                       
-                       case "QUERY":   // Query SQL data
-                               if( isset( $this->querySet ) and isset( $this->querySet->query ) ) $this->querySet->buildQuery( $data );
-                               break;
-                       
-                       case "CONSTRAINT":      // Table constraint
-                               if( isset( $this->table ) ) $this->table->addTableOpt( $data );
-                               break;
-                               
-                       default:
-                               print "<UL><LI>CDATA ($element) $data</UL>\n";
-               }
-       }
-
-       /**
-       * XML Callback to process end elements
-       *
-       * @access private
-       */
-       function _xmlcb_endElement( $parser, $name ) {
-               
-               // Process the element. Ignore unimportant elements.
-               if( in_array( trim( $name ), 
-                       array(  "SCHEMA", "DESCR", "KEY", "AUTOINCREMENT", "FIELD",
-                                               "DEFAULT", "NOTNULL", "CONSTRAINT", "COL" ) ) ) {
-                       return FALSE;
-               }
-               
-               switch( trim( $name ) ) {
-                       
-                       case "TABLE":   // Table element
-                               if( isset( $this->table ) ) {
-                                       $tableSQL = $this->table->create( $this->dict );
-                                       array_push( $this->sqlArray, $tableSQL[0] );
-                                       $this->table->destroy();
-                               }
-                               break;
-                               
-                       case "INDEX":   // Index element
-                               if( isset( $this->index ) ) {
-                                       $indexSQL = $this->index->create( $this->dict );
-                                       array_push( $this->sqlArray, $indexSQL[0] );
-                                       $this->index->destroy();
-                               }
-                               break;
-                       
-                       case "QUERY":   // Queryset element
-                               if( isset( $this->querySet ) and isset( $this->querySet->query ) ) $this->querySet->addQuery();
-                               break;
-                       
-                       case "SQL":     // Query SQL element
-                               if( isset( $this->querySet ) ) {
-                                       $querySQL = $this->querySet->create();
-                                       $this->sqlArray = array_merge( $this->sqlArray, $querySQL );;
-                                       $this->querySet->destroy();
-                               }
-                               break;
-                               
-                       default:
-                               print "<LI>CLOSING $name</UL>\n";
-               }
-       }
-       
-       /**
-       * Checks if element references a specific platform
-       *
-       * Returns TRUE is no platform is specified or if we are currently
-       * using the specified platform.
-       *
-       * @param string $platform       Requested platform
-       * @return boolean       TRUE if platform check succeeds
-       *
-       * @access private
-       */
-       function supportedPlatform( $platform = NULL ) {
-
-               $dbType = $this->dbType;
-               $regex = "/^(\w*\|)*" . $dbType . "(\|\w*)*$/";
-               
-               if( !isset( $platform ) or 
-                       preg_match( $regex, $platform ) ) {
-                       return TRUE;
-               } else {
-                       return FALSE;
-               }
-       }
-       
-       /**
-       * Destructor
-       */
-       function Destroy() {
-               xml_parser_free( $this->xmlParser );
-               set_magic_quotes_runtime( $this->mgq );
-               unset( $this );
-       }
-}
-?>
diff --git a/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/blank.html b/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/blank.html
deleted file mode 100644 (file)
index 3b434bf..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-<H1>adodb-xmlschema</H1>
-<P>Written by <a href="mailto:richtl@arscognita.com">Richard Tango-Lowy</a>.</P>
-<P>For more information, contact <a href="richtl@arscognita.com">richtl@arscognita.com</a> 
-or visit our site at <a href="http://www.arscognita.com">www.arscognita.com</a>.</P>
-<P>At the moment, you should report bugs by mailing them to me. (If I can't convince John to
-make this part of ADODB :-), I'll  create a project for it on SourceForge.)
-
-<H2>Introduction</H2>
-<P><B>adodb-xmlschema</B> is a class that allows the user to quickly and easily
-build a database on any ADOdb-supported platform using a simple XML format.</P>
-<P>This library is dual-licensed under a BSD-style license and under the <B><a href="http://opensource.org/licenses/lgpl-license.php">GNU Lesser Public License</a></B>.
-See the <B>LICENSE</B> file for more information.</P>
-
-<H2>Features</H2><UL>
-       <LI>Darned easy to install
-       <LI>Quickly to create schemas that build on any platform supported by ADODB.</UL>
-
-<H2>Installation</H2>
-<P>To install adodb-xmlschema, simply copy the <tt>adodb-xmlschema.php</tt> file into your
-<B>ADODB</B> directory.</P>
-
-<H2>Quick Start</H2>
-<P>First, create an XML database schema. Let's call it "schema.xml:"</P><PRE>
-&lt;?xml version="1.0"?&gt;
-&lt;schema&gt;
-  &lt;table name="mytable"&gt;
-    &lt;field name="row1" type="I"&gt;
-      &lt;descr&gt;An integer row that's a primary key and autoincrements&lt;/descr&gt;
-      &lt;KEY/&gt;
-      &lt;AUTOINCREMENT/&gt;
-    &lt;/field&gt;
-    &lt;field name="row2" type="C" size="16"&gt;
-      &lt;descr&gt;A 16 character varchar row that can't be null&lt;/descr&gt;
-      &lt;NOTNULL/&gt;
-    &lt;/field&gt;
-  &lt;/table&gt;
-  &lt;index name="myindex" table="mytable"&gt;
-    &lt;col&gt;row1&lt;/col&gt;
-    &lt;col&gt;row2&lt;/col&gt;
-  &lt;/index&gt;
-  &lt;sql&gt;
-    &lt;descr&gt;SQL to be executed only on specific platforms&lt;/descr&gt;
-    &lt;query platform="postgres|postgres7"&gt;
-      insert into mytable ( row1, row2 ) values ( 12, 'stuff' )
-    &lt;/query&gt;
-    &lt;query platform="mysql"&gt;
-      insert into mytable ( row1, row2 ) values ( 12, 'different stuff' )
-    &lt;/query&gt;
-  &lt;/sql&gt;
-&lt;/schema&gt;
-</PRE><P>Create a new database using the appropriate tool for your platform.
-Executing the following PHP code will create the a <i>mytable</i> and <i>myindex</i>
-in the database and insert two rows into <i>mytable</i>. </P><PRE>                             
-// To build the schema, start by creating a normal ADOdb connection:
-$db->NewADOConnection( 'mysql' );
-$db->Connect( ... );
-
-// Create the schema object and build the query array.
-$schema = <B>new adoSchema</B>( $db );
-
-// Build the SQL array
-$sql = $schema-><B>ParseSchema</B>( "schema.xml" );
-
-// Execute the SQL on the database
-$result = $schema-><B>ExecuteSchema</B>( $sql );
-
-// Finally, clean up after the XML parser
-// (PHP won't do this for you!)
-$schema-><B>Destroy</B>();
-</PRE>
-       
-<H2>XML Schema Format:</H2>
-<P>(See <a href="../xmlschema.dtd">ADOdb_schema.dtd</a> for the full specification)</P>
-<PRE>
-&lt;?xml version="1.0"?&gt;
-&lt;schema&gt;
-  &lt;table name="tablename" platform="platform1|platform2|..."&gt;
-    &lt;descr&gt;Optional description&lt;/descr&gt;
-    &lt;field name="fieldname" type="datadict_type" size="size"&gt;
-      &lt;KEY/&gt;
-      &lt;NOTNULL/&gt;
-      &lt;AUTOINCREMENT/&gt;
-      &lt;DEFAULT value="value"/&gt;
-    &lt;/field&gt;
-       ... <i>more fields</i>
-  &lt;/table&gt;
-  ... <i>more tables</i>
-  
-  &lt;index name="indexname" platform="platform1|platform2|..."&gt;
-    &lt;descr&gt;Optional description&lt;/descr&gt;
-    &lt;col&gt;fieldname&lt;/col&gt;
-    ... <i>more columns</i>
-  &lt;/index&gt;
-  ... <i>more indices</i>
-  
-  &lt;sql platform="platform1|platform2|..."&gt;
-    &lt;descr&gt;Optional description&lt;/descr&gt;
-    &lt;query platform="platform1|platform2|..."&gt;SQL query&lt;/query&gt;
-    ... <i>more queries</i>
-  &lt;/sql&gt;
-  ... <i>more SQL</i>
-  &lt;/schema&gt;
-</PRE>
-<HR>
-<H2>Thanks</H2>
-<P>Thanks to John Lim for giving us ADODB, and for the hard work that keeps it on top of things. 
-And particulary for the datadict code that made xmlschema possible.</P>
-<P>And to the kind folks at <a href="http://phpdoc.org">PHP Documentor</a>. Cool tool.</P>
-<P>And to Linus. I thought the end of Amiga was the end of computing. Guess I was wrong :-)</P>
-<HR>
-<address>If you have any questions or comments, please email them to me  at 
-<a href="mailto:richtl@arscognita.com">richtl@arscognita.com</a>.</address>
-
-<P><TT>$Id$</TT></P>
\ No newline at end of file
diff --git a/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/classtrees_xmlschema.html b/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/classtrees_xmlschema.html
deleted file mode 100644 (file)
index b2f326b..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
-       IE 6 makes the page to wide with the following doctype. I accept
-       standards if they help me, not if they make anything even harder!
-//-->
-<!--<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN' 'http://www.w3.org/TR/REC-html40/loose.dtd'>//-->
-<!--NewPage-->
-<HTML>
-<HEAD>
-       <!-- Generated by PhpDoc date: 'Sat,  3 May 2003 13:13:37 -0400' -->
-       <TITLE>Class Trees for Package xmlschema</TITLE>
-<LINK REL ='stylesheet' TYPE='text/css' HREF='media/stylesheet.css' TITLE='Style'>
-</HEAD>
-<BODY BGCOLOR='white'>
-<a name="top"><!-- --></a>
-<!-- Start of Class Data -->
-<H2>
-       Class Trees for Package xmlschema
-</H2>
-<SPAN class="code">Root class adoSchema</SPAN>
-<code class="vardefaultsummary"><ul>
-<li><a href="xmlschema/adoSchema.html">adoSchema</a></li></ul>
-</code>
-       <div id="credit">
-               <hr>
-               Documention generated on Sat,  3 May 2003 13:13:37 -0400 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.0rc1</a>
-       </div>
-</body>
-</html>
\ No newline at end of file
diff --git a/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/elementindex.html b/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/elementindex.html
deleted file mode 100644 (file)
index b3a5801..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-<!--
-       IE 6 makes the page to wide with the following doctype. I accept
-       standards if they help me, not if they make anything even harder!
-//-->
-<!--<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN' 'http://www.w3.org/TR/REC-html40/loose.dtd'>//-->
-<!--NewPage-->
-<HTML>
-<HEAD>
-       <!-- Generated by PhpDoc date: 'Sat,  3 May 2003 13:13:37 -0400' -->
-       <TITLE>Element Index</TITLE>
-<LINK REL ='stylesheet' TYPE='text/css' HREF='media/stylesheet.css' TITLE='Style'>
-</HEAD>
-<BODY BGCOLOR='white'>
-<a name="top"><!-- --></a><a name="top"></a>
-<h1>Index of All Elements</h1>
-<b>Indexes by package:</b><br />
-<a href="elementindex_xmlschema.html">xmlschema</a><br />
-<br />
-       <a href="elementindex.html#a">a</a>
-       <a href="elementindex.html#d">d</a>
-       <a href="elementindex.html#e">e</a>
-       <a href="elementindex.html#"></a>
-       <a href="elementindex.html#p">p</a>
-       <a href="elementindex.html#s">s</a>
-<table>
-<tr><td colspan = "2"><a name="a">&nbsp; </a>
-<a href="#top">top</a><br />
-<TABLE CELLPADDING='3' CELLSPACING='0' WIDTH='100%' CLASS="border">
-       <TR CLASS='TableHeadingColor'>
-               <TD>
-                       <FONT SIZE='+2'><B>a</B></FONT>
-               </TD>
-       </TR>
-</TABLE>
-</td></tr>
-               <tr><td><b>adodb-xmlschema.php</b></td><td width="100%" align="left" valign="top">procedural page <a href="xmlschema/_adodb-xmlschema_php.html">adodb-xmlschema.php</a></td></tr>
-               <tr><td><b>adoSchema</b></td><td width="100%" align="left" valign="top">in file adodb-xmlschema.php, method <a href="xmlschema/adoSchema.html#methodadoSchema">adoSchema::adoSchema()</a><br />&nbsp;&nbsp;&nbsp;&nbsp;Constructor.</td></tr>
-               <tr><td><b>adoSchema</b></td><td width="100%" align="left" valign="top">in file adodb-xmlschema.php, class <a href="xmlschema/adoSchema.html">adoSchema</a><br />&nbsp;&nbsp;&nbsp;&nbsp;Loads and parses an XML file, creating an array of "ready-to-run" SQL statements</td></tr>
-       <tr><td colspan = "2"><a name="d">&nbsp; </a>
-<a href="#top">top</a><br />
-<TABLE CELLPADDING='3' CELLSPACING='0' WIDTH='100%' CLASS="border">
-       <TR CLASS='TableHeadingColor'>
-               <TD>
-                       <FONT SIZE='+2'><B>d</B></FONT>
-               </TD>
-       </TR>
-</TABLE>
-</td></tr>
-               <tr><td><b>$dbconn</b></td><td width="100%" align="left" valign="top">in file adodb-xmlschema.php, variable <a href="xmlschema/adoSchema.html#var$dbconn">adoSchema::$dbconn</a></td></tr>
-               <tr><td><b>$dbType</b></td><td width="100%" align="left" valign="top">in file adodb-xmlschema.php, variable <a href="xmlschema/adoSchema.html#var$dbType">adoSchema::$dbType</a></td></tr>
-               <tr><td><b>$dict</b></td><td width="100%" align="left" valign="top">in file adodb-xmlschema.php, variable <a href="xmlschema/adoSchema.html#var$dict">adoSchema::$dict</a></td></tr>
-               <tr><td><b>Destroy</b></td><td width="100%" align="left" valign="top">in file adodb-xmlschema.php, method <a href="xmlschema/adoSchema.html#methodDestroy">adoSchema::Destroy()</a><br />&nbsp;&nbsp;&nbsp;&nbsp;Destructor</td></tr>
-       <tr><td colspan = "2"><a name="e">&nbsp; </a>
-<a href="#top">top</a><br />
-<TABLE CELLPADDING='3' CELLSPACING='0' WIDTH='100%' CLASS="border">
-       <TR CLASS='TableHeadingColor'>
-               <TD>
-                       <FONT SIZE='+2'><B>e</B></FONT>
-               </TD>
-       </TR>
-</TABLE>
-</td></tr>
-               <tr><td><b>ExecuteSchema</b></td><td width="100%" align="left" valign="top">in file adodb-xmlschema.php, method <a href="xmlschema/adoSchema.html#methodExecuteSchema">adoSchema::ExecuteSchema()</a><br />&nbsp;&nbsp;&nbsp;&nbsp;Loads a schema into the database</td></tr>
-       <tr><td colspan = "2"><a name="p">&nbsp; </a>
-<a href="#top">top</a><br />
-<TABLE CELLPADDING='3' CELLSPACING='0' WIDTH='100%' CLASS="border">
-       <TR CLASS='TableHeadingColor'>
-               <TD>
-                       <FONT SIZE='+2'><B>p</B></FONT>
-               </TD>
-       </TR>
-</TABLE>
-</td></tr>
-               <tr><td><b>ParseSchema</b></td><td width="100%" align="left" valign="top">in file adodb-xmlschema.php, method <a href="xmlschema/adoSchema.html#methodParseSchema">adoSchema::ParseSchema()</a><br />&nbsp;&nbsp;&nbsp;&nbsp;Loads and parses an XML file</td></tr>
-       <tr><td colspan = "2"><a name="s">&nbsp; </a>
-<a href="#top">top</a><br />
-<TABLE CELLPADDING='3' CELLSPACING='0' WIDTH='100%' CLASS="border">
-       <TR CLASS='TableHeadingColor'>
-               <TD>
-                       <FONT SIZE='+2'><B>s</B></FONT>
-               </TD>
-       </TR>
-</TABLE>
-</td></tr>
-               <tr><td><b>$sqlArray</b></td><td width="100%" align="left" valign="top">in file adodb-xmlschema.php, variable <a href="xmlschema/adoSchema.html#var$sqlArray">adoSchema::$sqlArray</a></td></tr>
-       <tr><td colspan = "2"><a name="x">&nbsp; </a>
-<a href="#top">top</a><br />
-<TABLE CELLPADDING='3' CELLSPACING='0' WIDTH='100%' CLASS="border">
-       <TR CLASS='TableHeadingColor'>
-               <TD>
-                       <FONT SIZE='+2'><B>x</B></FONT>
-               </TD>
-       </TR>
-</TABLE>
-</td></tr>
-               <tr><td><b>$xmlParser</b></td><td width="100%" align="left" valign="top">in file adodb-xmlschema.php, variable <a href="xmlschema/adoSchema.html#var$xmlParser">adoSchema::$xmlParser</a></td></tr>
-       </table>
-</body>
-</html>
\ No newline at end of file
diff --git a/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/elementindex_xmlschema.html b/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/elementindex_xmlschema.html
deleted file mode 100644 (file)
index dc3e436..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-<!--
-       IE 6 makes the page to wide with the following doctype. I accept
-       standards if they help me, not if they make anything even harder!
-//-->
-<!--<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN' 'http://www.w3.org/TR/REC-html40/loose.dtd'>//-->
-<!--NewPage-->
-<HTML>
-<HEAD>
-       <!-- Generated by PhpDoc date: 'Sat,  3 May 2003 13:13:37 -0400' -->
-       <TITLE>Package xmlschema Element Index</TITLE>
-<LINK REL ='stylesheet' TYPE='text/css' HREF='media/stylesheet.css' TITLE='Style'>
-</HEAD>
-<BODY BGCOLOR='white'>
-<a name="top"><!-- --></a><a name="top"></a>
-<h1>Element index for package xmlschema</h1>
-<br />
-<a href="elementindex.html"><b>Index of all elements</b></a><br />
-       <a href="elementindex_xmlschema.html#a">a</a>
-       <a href="elementindex_xmlschema.html#d">d</a>
-       <a href="elementindex_xmlschema.html#e">e</a>
-       <a href="elementindex_xmlschema.html#i">i</a>
-       <a href="elementindex_xmlschema.html#p">p</a>
-       <a href="elementindex_xmlschema.html#s">s</a>
-       <a href="elementindex_xmlschema.html#x">x</a>
-<table>
-<tr><td colspan = "2"><a name="a">&nbsp; </a>
-<a href="#top">top</a><br />
-<TABLE CELLPADDING='3' CELLSPACING='0' WIDTH='100%' CLASS="border">
-       <TR CLASS='TableHeadingColor'>
-               <TD>
-                       <FONT SIZE='+2'><B>a</B></FONT>
-               </TD>
-       </TR>
-</TABLE>
-</td></tr>
-               <tr><td><b>adodb-xmlschema.php</b></td><td width="100%" align="left" valign="top">procedural page <a href="xmlschema/_adodb-xmlschema_php.html">adodb-xmlschema.php</a></td></tr>
-               <tr><td><b>adoSchema</b></td><td width="100%" align="left" valign="top">in file adodb-xmlschema.php, method <a href="xmlschema/adoSchema.html#methodadoSchema">adoSchema::adoSchema()</a><br />&nbsp;&nbsp;&nbsp;&nbsp;Constructor.</td></tr>
-               <tr><td><b>adoSchema</b></td><td width="100%" align="left" valign="top">in file adodb-xmlschema.php, class <a href="xmlschema/adoSchema.html">adoSchema</a><br />&nbsp;&nbsp;&nbsp;&nbsp;Loads and parses an XML file, creating an array of "ready-to-run" SQL statements</td></tr>
-       <tr><td colspan = "2"><a name="d">&nbsp; </a>
-<a href="#top">top</a><br />
-<TABLE CELLPADDING='3' CELLSPACING='0' WIDTH='100%' CLASS="border">
-       <TR CLASS='TableHeadingColor'>
-               <TD>
-                       <FONT SIZE='+2'><B>d</B></FONT>
-               </TD>
-       </TR>
-</TABLE>
-</td></tr>
-               <tr><td><b>$dbconn</b></td><td width="100%" align="left" valign="top">in file adodb-xmlschema.php, variable <a href="xmlschema/adoSchema.html#var$dbconn">adoSchema::$dbconn</a></td></tr>
-               <tr><td><b>$dbType</b></td><td width="100%" align="left" valign="top">in file adodb-xmlschema.php, variable <a href="xmlschema/adoSchema.html#var$dbType">adoSchema::$dbType</a></td></tr>
-               <tr><td><b>$dict</b></td><td width="100%" align="left" valign="top">in file adodb-xmlschema.php, variable <a href="xmlschema/adoSchema.html#var$dict">adoSchema::$dict</a></td></tr>
-               <tr><td><b>Destroy</b></td><td width="100%" align="left" valign="top">in file adodb-xmlschema.php, method <a href="xmlschema/adoSchema.html#methodDestroy">adoSchema::Destroy()</a><br />&nbsp;&nbsp;&nbsp;&nbsp;Destructor</td></tr>
-       <tr><td colspan = "2"><a name="e">&nbsp; </a>
-<a href="#top">top</a><br />
-<TABLE CELLPADDING='3' CELLSPACING='0' WIDTH='100%' CLASS="border">
-       <TR CLASS='TableHeadingColor'>
-               <TD>
-                       <FONT SIZE='+2'><B>e</B></FONT>
-               </TD>
-       </TR>
-</TABLE>
-</td></tr>
-               <tr><td><b>ExecuteSchema</b></td><td width="100%" align="left" valign="top">in file adodb-xmlschema.php, method <a href="xmlschema/adoSchema.html#methodExecuteSchema">adoSchema::ExecuteSchema()</a><br />&nbsp;&nbsp;&nbsp;&nbsp;Loads a schema into the database</td></tr>
-       <tr><td colspan = "2"><a name="i">&nbsp; </a>
-<a href="#top">top</a><br />
-<TABLE CELLPADDING='3' CELLSPACING='0' WIDTH='100%' CLASS="border">
-       <TR CLASS='TableHeadingColor'>
-               <TD>
-                       <FONT SIZE='+2'><B>i</B></FONT>
-               </TD>
-       </TR>
-</TABLE>
-</td></tr>
-       <tr><td colspan = "2"><a name="p">&nbsp; </a>
-<a href="#top">top</a><br />
-<TABLE CELLPADDING='3' CELLSPACING='0' WIDTH='100%' CLASS="border">
-       <TR CLASS='TableHeadingColor'>
-               <TD>
-                       <FONT SIZE='+2'><B>p</B></FONT>
-               </TD>
-       </TR>
-</TABLE>
-</td></tr>
-               <tr><td><b>ParseSchema</b></td><td width="100%" align="left" valign="top">in file adodb-xmlschema.php, method <a href="xmlschema/adoSchema.html#methodParseSchema">adoSchema::ParseSchema()</a><br />&nbsp;&nbsp;&nbsp;&nbsp;Loads and parses an XML file</td></tr>
-       <tr><td colspan = "2"><a name="s">&nbsp; </a>
-<a href="#top">top</a><br />
-<TABLE CELLPADDING='3' CELLSPACING='0' WIDTH='100%' CLASS="border">
-       <TR CLASS='TableHeadingColor'>
-               <TD>
-                       <FONT SIZE='+2'><B>s</B></FONT>
-               </TD>
-       </TR>
-</TABLE>
-</td></tr>
-               <tr><td><b>$sqlArray</b></td><td width="100%" align="left" valign="top">in file adodb-xmlschema.php, variable <a href="xmlschema/adoSchema.html#var$sqlArray">adoSchema::$sqlArray</a></td></tr>
-       <tr><td colspan = "2"><a name="x">&nbsp; </a>
-<a href="#top">top</a><br />
-<TABLE CELLPADDING='3' CELLSPACING='0' WIDTH='100%' CLASS="border">
-       <TR CLASS='TableHeadingColor'>
-               <TD>
-                       <FONT SIZE='+2'><B>x</B></FONT>
-               </TD>
-       </TR>
-</TABLE>
-</td></tr>
-               <tr><td><b>$xmlParser</b></td><td width="100%" align="left" valign="top">in file adodb-xmlschema.php, variable <a href="xmlschema/adoSchema.html#var$xmlParser">adoSchema::$xmlParser</a></td></tr>
-       </table>
-</body>
-</html>
\ No newline at end of file
diff --git a/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/errors.html b/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/errors.html
deleted file mode 100644 (file)
index 18e0eaa..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<!--
-       IE 6 makes the page to wide with the following doctype. I accept
-       standards if they help me, not if they make anything even harder!
-//-->
-<!--<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN' 'http://www.w3.org/TR/REC-html40/loose.dtd'>//-->
-<!--NewPage-->
-<HTML>
-<HEAD>
-       <!-- Generated by PhpDoc date: 'Sat,  3 May 2003 13:13:39 -0400' -->
-       <TITLE>phpDocumentor Parser Errors and Warnings</TITLE>
-<LINK REL ='stylesheet' TYPE='text/css' HREF='media/stylesheet.css' TITLE='Style'>
-</HEAD>
-<BODY BGCOLOR='white'>
-<a name="top"><!-- --></a><a href="#Post-parsing">Post-parsing</a><br />
-       <div id="credit">
-               <hr>
-               Documention generated on Sat,  3 May 2003 13:13:39 -0400 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.0rc1</a>
-       </div>
-</body>
-</html>
\ No newline at end of file
diff --git a/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/index.html b/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/index.html
deleted file mode 100644 (file)
index 6ba6690..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
-<!--NewPage-->
-<HTML>
-<HEAD>
-       <!-- Generated by PhpDoc on Sat,  3 May 2003 13:13:37 -0400  -->
-       <TITLE>ADODB xmlschema Documentation</TITLE>
-</HEAD>
-<FRAMESET cols='220,*'>
-               <FRAME src='li_xmlschema.html' name='left_bottom'>
-       <FRAME src='xmlschema/package_xmlschema.html' name='right'>
-       <NOFRAMES>
-               <H2>Frame Alert</H2>
-               <P>This document is designed to be viewed using the frames feature.
-               If you see this message, you are using a non-frame-capable web client.</P>
-       </NOFRAMES>
-</FRAMESET>
-</HTML>
\ No newline at end of file
diff --git a/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/li_xmlschema.html b/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/li_xmlschema.html
deleted file mode 100644 (file)
index bccf691..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<!--
-       IE 6 makes the page to wide with the following doctype. I accept
-       standards if they help me, not if they make anything even harder!
-//-->
-<!--<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN' 'http://www.w3.org/TR/REC-html40/loose.dtd'>//-->
-<!--NewPage-->
-<HTML>
-<HEAD>
-       <!-- Generated by PhpDoc date: 'Sat,  3 May 2003 13:13:37 -0400' -->
-       <TITLE></TITLE>
-<LINK REL ='stylesheet' TYPE='text/css' HREF='media/stylesheet.css' TITLE='Style'>
-<STYLE type="text/css"><!--
-       BODY                                                            {
-                                                                                       background-image                : url("media/bg_left.png");
-                                                                                       background-repeat               : repeat-y;
-                                                                               }
-//--></STYLE>
-</HEAD>
-<BODY >
-<a name="top"><!-- --></a><b>Package xmlschema</b><br />
-<a href='classtrees_xmlschema.html' target='right'>Class Trees</a><br />
-<a href='elementindex_xmlschema.html' target='right'>Alphabetical Element Index</a><br />
-<a href="blank.html" target="right">xmlschema</a>
-
-       <H3>Files</H3>
-       <UL>
-                       <LI><a class="procedural" href='xmlschema/_adodb-xmlschema_php.html' target='right'>adodb-xmlschema.php</a></LI>
-               </UL>
-       <H3>Classes</H3>
-       <UL>
-                       <LI><a class="classes" href='xmlschema/adoSchema.html' target='right'>adoSchema</a></LI>
-               </UL>
-       <H3>Functions</H3>
-       <UL>
-               </UL>
-<font size="-1"><a href="http://www.phpdoc.org" target="_blank">phpDocumentor v <b>1.2.0rc1</b></a></font>
-</BODY>
-</HTML>
\ No newline at end of file
diff --git a/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/media/stylesheet.css b/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/media/stylesheet.css
deleted file mode 100644 (file)
index 506c90f..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-BODY, DIV, SPAN, PRE, CODE, TD, TH
-                                                                       {
-                                                                               line-height                             : 140%;
-                                                                               font-size                               : 10pt;
-                                                                       }
-
-A                                                                      {
-                                                                               text-decoration                 : none;
-                                                                       }
-
-A:link                                                         {
-                                                                               color                                   : #336699;
-                                                                       }
-
-A:visited                                                      {
-                                                                               color                                   : #003366;
-                                                                       }
-
-A:active, A:hover                                      {
-                                                                               color                                   : #6699CC;
-                                                                       }
-
-A:hover                                                                {
-                                                                               text-decoration                 : underline;
-                                                                       }
-
-SPAN.type                                                      {
-                                                                               color                                   : #336699;
-                                                                               font-size                               : xx-small;
-                                                                               font-weight                             : normal;
-                                                                       }
-
-PRE                                                                    {
-                                                                               background-color                : #EEEEEE;
-                                                                               padding                                 : 10px;
-                                                                               border-width                    : 1px;
-                                                                               border-color                    : #336699;
-                                                                               border-style                    : solid;
-                                                                       }
-
-HR                                                                     {
-                                                                               color                                   : #336699;
-                                                                               background-color                : #336699;
-                                                                               border-width                    : 0px;
-                                                                               height                                  : 1px;
-                                                                               filter                                  : Alpha (opacity=100,finishopacity=0,style=1);
-                                                                       }
-                                                                         
-DIV.sdesc                                                      {
-                                                                               font-weight                             : bold;
-                                                                               background-color                : #EEEEEE;
-                                                                               padding                                 : 10px;
-                                                                               border-width                    : 1px;
-                                                                               border-color                    : #336699;
-                                                                               border-style                    : solid;
-                                                                       }
-
-DIV.desc                                                       {
-                                                                               font-family                             : monospace;
-                                                                               background-color                : #EEEEEE;
-                                                                               padding                                 : 10px;
-                                                                               border-width                    : 1px;
-                                                                               border-color                    : #336699;
-                                                                               border-style                    : solid;
-                                                                       }
-
-SPAN.code                                                      {
-                                                                               font-family                             : monospace;
-                                                                       }
-
-CODE.varsummarydefault                         {
-                                                                               padding                                 : 1px;
-                                                                               border-width                    : 1px;
-                                                                               border-style                    : dashed;
-                                                                               border-color                    : #336699;
-                                                                       }
-
-UL.tute                                                                        {
-                                                                               margin:                 0px;
-                                                                               padding:                0px;
-                                                                               padding-left:           5px;
-                                                                       }
-
-LI.tute                                                                        {
-                                                                               line-height                             : 140%;
-                                                                               font-size                               : 10pt;
-                                                                               text-indent:            -15px;
-                                                                               padding-bottom:         2px;
-                                                                               padding-left:           14px;
-                                                                       }
-
-.small                                                         {
-                                                                               font-size                               : 9pt;
-                                                                       }
diff --git a/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/packages.html b/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/packages.html
deleted file mode 100644 (file)
index b8f89bd..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<!--
-       IE 6 makes the page to wide with the following doctype. I accept
-       standards if they help me, not if they make anything even harder!
-//-->
-<!--<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN' 'http://www.w3.org/TR/REC-html40/loose.dtd'>//-->
-<!--NewPage-->
-<HTML>
-<HEAD>
-       <!-- Generated by PhpDoc date: 'Sat,  3 May 2003 13:13:37 -0400' -->
-       <TITLE></TITLE>
-<LINK REL ='stylesheet' TYPE='text/css' HREF='media/stylesheet.css' TITLE='Style'>
-<STYLE type="text/css"><!--
-       BODY                                                            {
-                                                                                       background-image                : url("media/bg_left.png");
-                                                                                       background-repeat               : repeat-y;
-                                                                               }
-//--></STYLE>
-</HEAD>
-<BODY >
-<a name="top"><!-- --></a><h3>Packages</h3>
-<UL>
-       <LI><a class="package" href='li_xmlschema.html' target='left_bottom'>xmlschema</a></LI>
-</UL>
-</BODY>
-</HTML>
\ No newline at end of file
diff --git a/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/xmlschema/_adodb-xmlschema_php.html b/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/xmlschema/_adodb-xmlschema_php.html
deleted file mode 100644 (file)
index 5179ae6..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-<!--
-       IE 6 makes the page to wide with the following doctype. I accept
-       standards if they help me, not if they make anything even harder!
-//-->
-<!--<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN' 'http://www.w3.org/TR/REC-html40/loose.dtd'>//-->
-<!--NewPage-->
-<HTML>
-<HEAD>
-       <!-- Generated by PhpDoc date: 'Sat,  3 May 2003 13:13:37 -0400' -->
-       <TITLE>Docs for page adodb-xmlschema.php</TITLE>
-<LINK REL ='stylesheet' TYPE='text/css' HREF='../media/stylesheet.css' TITLE='Style'>
-</HEAD>
-<BODY BGCOLOR='white'>
-<a name="top"><!-- --></a><h3><SPAN class="type">File:</SPAN> Program_Root/adodb-xmlschema.php<HR>
-</h3>
-<!-- ========== Info from phpDoc block ========= -->
-<div class="sdesc">xmlschema is a class that allows the user to quickly and easily build a database on any ADOdb-supported platform using a simple XML schema.</div>
-<UL>
-               <LI><b>copyright:</b> <CODE>Copyright &copy; 2003 ars Cognita Inc., all rights reserved</CODE></LI>
-               <LI><b>version:</b> <CODE>$revision: $</CODE></LI>
-               <LI><b>author:</b> <CODE>Richard Tango-Lowy</CODE></LI>
-       </UL>
-Classes in this file:
-<dl>
-<dt></dt>
-       <dd>Creates a table object in ADOdb's datadict format</dd>
-<dt></dt>
-       <dd>Creates an index object in ADOdb's datadict format</dd>
-<dt></dt>
-       <dd>Creates the SQL to execute a list of provided SQL queries</dd>
-<dt><a href="../xmlschema/adoSchema.html">adoSchema</a></dt>
-       <dd>Loads and parses an XML file, creating an array of "ready-to-run" SQL statements</dd>
-</dl>
-<hr>
-<!-- =========== INCLUDE SUMMARY =========== -->
-<A NAME='include_summary'><!-- --></A>
-<H3>Include Statements Summary</H3>
-
-<UL>
-                       <LI><CODE><A HREF="#_adodb_inc_php">include</A></CODE> = <CODE class="varsummarydefault">"adodb.inc.php"</CODE>
-               <br />Include the main ADODB library
-       </UL>
-<hr>
-<!-- =========== GLOBAL VARIABLE SUMMARY =========== -->
-<A NAME='global_summary'><!-- --></A>
-<H3>Global Variable Summary</H3>
-
-<UL>
-       </UL>
-
-<hr>
-<!-- =========== CONSTANT SUMMARY =========== -->
-<A NAME='constant_summary'><!-- --></A>
-<H3>Constant Summary</H3>
-
-<UL>
-       </UL>
-<hr>
-<!-- =========== FUNCTION SUMMARY =========== -->
-<A NAME='function_summary'><!-- --></A>
-<H3>Function Summary</H3> 
-
-<UL>
-       </UL>
-<hr>
-<!-- ============ INCLUDE DETAIL =========== -->
-
-<A NAME='include_detail'></A>
-<H3>Include Statements Detail</H3>
-
-<UL>
-                       <A NAME="_adodb_inc_php"><!-- --></A>
-               <LI><SPAN class="code">include file:</SPAN> = <CODE class="varsummarydefault">"adodb.inc.php"</CODE> [line <span class="linenumber">31</span>]<br />
-               <br /><br />
-               <!-- ========== Info from phpDoc block ========= -->
-<div class="sdesc">Include the main ADODB library</div>
-<UL>
-       </UL>
-       </UL>
-<hr>
-<!-- ============ GLOBAL VARIABLE DETAIL =========== -->
-
-<A NAME='global_detail'></A>
-<H3>Global Variable Detail</H3>
-
-<UL>
-       </UL>
-<hr>
-<!-- ============ CONSTANT DETAIL =========== -->
-
-<A NAME='constant_detail'></A>
-<H3>Constant Detail</H3>
-
-<UL>
-       </UL>
-<hr>
-<!-- ============ FUNCTION DETAIL =========== -->
-
-<A NAME='function_detail'></A>
-<H3>Function Detail</H3>
-
-<UL>
-</UL>
-<hr>
-       <div id="credit">
-               <hr>
-               Documention generated on Sat,  3 May 2003 13:13:37 -0400 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.0rc1</a>
-       </div>
-</body>
-</html>
-</HTML>
\ No newline at end of file
diff --git a/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/xmlschema/adoSchema.html b/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/xmlschema/adoSchema.html
deleted file mode 100644 (file)
index e45fcfb..0000000
+++ /dev/null
@@ -1,235 +0,0 @@
-<!--
-       IE 6 makes the page to wide with the following doctype. I accept
-       standards if they help me, not if they make anything even harder!
-//-->
-<!--<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN' 'http://www.w3.org/TR/REC-html40/loose.dtd'>//-->
-<!--NewPage-->
-<HTML>
-<HEAD>
-       <!-- Generated by PhpDoc date: 'Sat,  3 May 2003 13:13:37 -0400' -->
-       <TITLE>Docs For Class adoSchema</TITLE>
-<LINK REL ='stylesheet' TYPE='text/css' HREF='../media/stylesheet.css' TITLE='Style'>
-</HEAD>
-<BODY BGCOLOR='white'>
-<a name="top"><!-- --></a><!-- Start of Class Data -->
-<H3>
-       <SPAN class="type">Class</SPAN> adoSchema
-       <HR>
-</H3>
-[line <span class="linenumber">379</span>]<br />
-<pre>
-</pre>
-<SPAN class="type">Location:</SPAN> Program_Root/adodb-xmlschema.php
-<hr>
-<!-- ========== Info from phpDoc block ========= -->
-<div class="sdesc">Loads and parses an XML file, creating an array of "ready-to-run" SQL statements</div>
-<div class="desc"><p>This class is used to load and parse the XML file, to create an array of SQL statements that can be used to build a database, and to build the database using the SQL array.</p></div>
-<UL>
-       </UL>
-<hr>
-<!-- =========== VAR SUMMARY =========== -->
-<A NAME='var_summary'><!-- --></A>
-<H3>Class Variable Summary</H3>
-
-<UL>
-               <!-- =========== Summary =========== -->
-               <LI><CODE><a href="../xmlschema/adoSchema.html#var$dbconn">$dbconn</a></CODE> = <CODE class="varsummarydefault"></CODE>
-               <br />
-               
-               <!-- =========== Summary =========== -->
-               <LI><CODE><a href="../xmlschema/adoSchema.html#var$dbType">$dbType</a></CODE> = <CODE class="varsummarydefault"></CODE>
-               <br />
-               
-               <!-- =========== Summary =========== -->
-               <LI><CODE><a href="../xmlschema/adoSchema.html#var$dict">$dict</a></CODE> = <CODE class="varsummarydefault"></CODE>
-               <br />
-               
-               <!-- =========== Summary =========== -->
-               <LI><CODE><a href="../xmlschema/adoSchema.html#var$sqlArray">$sqlArray</a></CODE> = <CODE class="varsummarydefault"></CODE>
-               <br />
-               
-               <!-- =========== Summary =========== -->
-               <LI><CODE><a href="../xmlschema/adoSchema.html#var$xmlParser">$xmlParser</a></CODE> = <CODE class="varsummarydefault"></CODE>
-               <br />
-               
-       </UL>
-<hr>
-<!-- =========== INHERITED VAR SUMMARY =========== -->
-<A NAME='inheritedvar_summary'><!-- --></A>
-<H3>Inherited Class Variable Summary</H3>
-
-
-<hr>
-<!-- =========== METHOD SUMMARY =========== -->
-<A NAME='method_summary'><!-- --></A>
-<H3>Method Summary</H3> 
-
-<UL>
-               <!-- =========== Summary =========== -->
-               <LI><CODE><A HREF='../xmlschema/adoSchema.html#methodadoSchema'>void adoSchema()</A></CODE>
-               <br />Constructor.
-               <!-- =========== Summary =========== -->
-               <LI><CODE><A HREF='../xmlschema/adoSchema.html#methodDestroy'>void Destroy()</A></CODE>
-               <br />Destructor
-               <!-- =========== Summary =========== -->
-               <LI><CODE><A HREF='../xmlschema/adoSchema.html#methodExecuteSchema'>integer ExecuteSchema()</A></CODE>
-               <br />Loads a schema into the database
-               <!-- =========== Summary =========== -->
-               <LI><CODE><A HREF='../xmlschema/adoSchema.html#methodParseSchema'>array ParseSchema()</A></CODE>
-               <br />Loads and parses an XML file
-       </UL>
-
-<!-- =========== INHERITED METHOD SUMMARY =========== -->
-<A NAME='methods_inherited'><!-- --></A>
-<H3>Inherited Method Summary</H3> 
-
-<hr>
-<!-- ============ METHOD DETAIL =========== -->
-
-<A NAME='method_detail'></A>
-<H3>Method Detail</H3>
-
-<UL>
-<A NAME='methodadoSchema'><!-- --></A>
-
-<LI><SPAN class="code">Constructor void adoSchema()</SPAN> [line <span class="linenumber">441</span>]
-<br /><br />
-<SPAN class="type">Usage:</SPAN> <SPAN class="code">adoSchema(
-object
-$dbconn)</SPAN>
-<br /><br />
-
-<!-- ========== Info from phpDoc block ========= -->
-<div class="sdesc">Constructor.</div>
-<div class="desc"><p>Initializes the xmlschema object</p></div>
-               <H4>Parameters</H4>
-       <UL>
-                       <LI><SPAN class="code">object $dbconn</SPAN> - ADOdb connection object
-               </UL>
-               
-       <H4>Info</H4>
-       <UL>
-               </UL>
-       <p class="top">[ <a href="#top">Top</a> ]</p>
-<br />
-<A NAME='methodDestroy'><!-- --></A>
-
-<LI><SPAN class="code">void Destroy()</SPAN> [line <span class="linenumber">725</span>]
-<br /><br />
-<SPAN class="type">Usage:</SPAN> <SPAN class="code">Destroy(
-)</SPAN>
-<br /><br />
-
-<!-- ========== Info from phpDoc block ========= -->
-<div class="sdesc">Destructor</div>
-               
-       <H4>Info</H4>
-       <UL>
-               </UL>
-       <p class="top">[ <a href="#top">Top</a> ]</p>
-<br />
-<A NAME='methodExecuteSchema'><!-- --></A>
-
-<LI><SPAN class="code">integer ExecuteSchema()</SPAN> [line <span class="linenumber">504</span>]
-<br /><br />
-<SPAN class="type">Usage:</SPAN> <SPAN class="code">ExecuteSchema(
-array
-$sqlArray, [boolean
-$continueOnErr = TRUE])</SPAN>
-<br /><br />
-
-<!-- ========== Info from phpDoc block ========= -->
-<div class="sdesc">Loads a schema into the database</div>
-<div class="desc"><p>Accepts an array of SQL queries generated by the parser  and executes them.</p></div>
-               <H4>Parameters</H4>
-       <UL>
-                       <LI><SPAN class="code">array $sqlArray</SPAN> - Array of SQL statements
-                       <LI><SPAN class="code">boolean $continueOnErr</SPAN> - Don't fail out if an error is encountered
-               </UL>
-               
-       <H4>Info</H4>
-       <UL>
-                       <LI><B>return</B>: <CODE>0 if failed, 1 if errors, 2 if successful</CODE>
-               </UL>
-       <p class="top">[ <a href="#top">Top</a> ]</p>
-<br />
-<A NAME='methodParseSchema'><!-- --></A>
-
-<LI><SPAN class="code">array ParseSchema()</SPAN> [line <span class="linenumber">465</span>]
-<br /><br />
-<SPAN class="type">Usage:</SPAN> <SPAN class="code">ParseSchema(
-string
-$file)</SPAN>
-<br /><br />
-
-<!-- ========== Info from phpDoc block ========= -->
-<div class="sdesc">Loads and parses an XML file</div>
-<div class="desc"><p>This method accepts a path to an xmlschema-compliant XML file, loads it, parses it, and uses it to create the SQL to generate the objects described by the XML file.</p></div>
-               <H4>Parameters</H4>
-       <UL>
-                       <LI><SPAN class="code">string $file</SPAN> - XML file
-               </UL>
-               
-       <H4>Info</H4>
-       <UL>
-                       <LI><B>return</B>: <CODE>Array of SQL queries, ready to execute</CODE>
-               </UL>
-       <p class="top">[ <a href="#top">Top</a> ]</p>
-<br />
-</UL>
-<hr>
-<!-- ============ VARIABLE DETAIL =========== -->
-
-<A NAME='variable_detail'></A>
-
-<H3>Variable Detail</H3>
-
-<UL>
-<A NAME="var$dbconn"><!-- --></A>
-<LI><SPAN class="code">$dbconn</SPAN> = <CODE class="varsummarydefault"></CODE> [line <span class="linenumber">394</span>]</LI>
-<LI><b>Data type:</b> <CODE class="varsummarydefault">ADOdb</CODE></LI>
-<!-- ========== Info from phpDoc block ========= -->
-<UL>
-               <LI><b>var:</b> <CODE>connection object</CODE></LI>
-       </UL>
-<br />
-<A NAME="var$dbType"><!-- --></A>
-<LI><SPAN class="code">$dbType</SPAN> = <CODE class="varsummarydefault"></CODE> [line <span class="linenumber">399</span>]</LI>
-<LI><b>Data type:</b> <CODE class="varsummarydefault">string</CODE></LI>
-<!-- ========== Info from phpDoc block ========= -->
-<UL>
-               <LI><b>var:</b> <CODE>Database type (platform)</CODE></LI>
-       </UL>
-<br />
-<A NAME="var$dict"><!-- --></A>
-<LI><SPAN class="code">$dict</SPAN> = <CODE class="varsummarydefault"></CODE> [line <span class="linenumber">404</span>]</LI>
-<LI><b>Data type:</b> <CODE class="varsummarydefault">ADOdb</CODE></LI>
-<!-- ========== Info from phpDoc block ========= -->
-<UL>
-               <LI><b>var:</b> <CODE>Data Dictionary</CODE></LI>
-       </UL>
-<br />
-<A NAME="var$sqlArray"><!-- --></A>
-<LI><SPAN class="code">$sqlArray</SPAN> = <CODE class="varsummarydefault"></CODE> [line <span class="linenumber">384</span>]</LI>
-<LI><b>Data type:</b> <CODE class="varsummarydefault">array</CODE></LI>
-<!-- ========== Info from phpDoc block ========= -->
-<UL>
-               <LI><b>var:</b> <CODE>Array containing SQL queries to generate all objects</CODE></LI>
-       </UL>
-<br />
-<A NAME="var$xmlParser"><!-- --></A>
-<LI><SPAN class="code">$xmlParser</SPAN> = <CODE class="varsummarydefault"></CODE> [line <span class="linenumber">389</span>]</LI>
-<LI><b>Data type:</b> <CODE class="varsummarydefault">XML</CODE></LI>
-<!-- ========== Info from phpDoc block ========= -->
-<UL>
-               <LI><b>var:</b> <CODE>Parser object</CODE></LI>
-       </UL>
-<br />
-</UL>
-<hr>
-       <div id="credit">
-               <hr>
-               Documention generated on Sat,  3 May 2003 13:13:37 -0400 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.0rc1</a>
-       </div>
-</body>
-</html>
\ No newline at end of file
diff --git a/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/xmlschema/package_xmlschema.html b/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/docs/xmlschema/package_xmlschema.html
deleted file mode 100644 (file)
index 3b434bf..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-<H1>adodb-xmlschema</H1>
-<P>Written by <a href="mailto:richtl@arscognita.com">Richard Tango-Lowy</a>.</P>
-<P>For more information, contact <a href="richtl@arscognita.com">richtl@arscognita.com</a> 
-or visit our site at <a href="http://www.arscognita.com">www.arscognita.com</a>.</P>
-<P>At the moment, you should report bugs by mailing them to me. (If I can't convince John to
-make this part of ADODB :-), I'll  create a project for it on SourceForge.)
-
-<H2>Introduction</H2>
-<P><B>adodb-xmlschema</B> is a class that allows the user to quickly and easily
-build a database on any ADOdb-supported platform using a simple XML format.</P>
-<P>This library is dual-licensed under a BSD-style license and under the <B><a href="http://opensource.org/licenses/lgpl-license.php">GNU Lesser Public License</a></B>.
-See the <B>LICENSE</B> file for more information.</P>
-
-<H2>Features</H2><UL>
-       <LI>Darned easy to install
-       <LI>Quickly to create schemas that build on any platform supported by ADODB.</UL>
-
-<H2>Installation</H2>
-<P>To install adodb-xmlschema, simply copy the <tt>adodb-xmlschema.php</tt> file into your
-<B>ADODB</B> directory.</P>
-
-<H2>Quick Start</H2>
-<P>First, create an XML database schema. Let's call it "schema.xml:"</P><PRE>
-&lt;?xml version="1.0"?&gt;
-&lt;schema&gt;
-  &lt;table name="mytable"&gt;
-    &lt;field name="row1" type="I"&gt;
-      &lt;descr&gt;An integer row that's a primary key and autoincrements&lt;/descr&gt;
-      &lt;KEY/&gt;
-      &lt;AUTOINCREMENT/&gt;
-    &lt;/field&gt;
-    &lt;field name="row2" type="C" size="16"&gt;
-      &lt;descr&gt;A 16 character varchar row that can't be null&lt;/descr&gt;
-      &lt;NOTNULL/&gt;
-    &lt;/field&gt;
-  &lt;/table&gt;
-  &lt;index name="myindex" table="mytable"&gt;
-    &lt;col&gt;row1&lt;/col&gt;
-    &lt;col&gt;row2&lt;/col&gt;
-  &lt;/index&gt;
-  &lt;sql&gt;
-    &lt;descr&gt;SQL to be executed only on specific platforms&lt;/descr&gt;
-    &lt;query platform="postgres|postgres7"&gt;
-      insert into mytable ( row1, row2 ) values ( 12, 'stuff' )
-    &lt;/query&gt;
-    &lt;query platform="mysql"&gt;
-      insert into mytable ( row1, row2 ) values ( 12, 'different stuff' )
-    &lt;/query&gt;
-  &lt;/sql&gt;
-&lt;/schema&gt;
-</PRE><P>Create a new database using the appropriate tool for your platform.
-Executing the following PHP code will create the a <i>mytable</i> and <i>myindex</i>
-in the database and insert two rows into <i>mytable</i>. </P><PRE>                             
-// To build the schema, start by creating a normal ADOdb connection:
-$db->NewADOConnection( 'mysql' );
-$db->Connect( ... );
-
-// Create the schema object and build the query array.
-$schema = <B>new adoSchema</B>( $db );
-
-// Build the SQL array
-$sql = $schema-><B>ParseSchema</B>( "schema.xml" );
-
-// Execute the SQL on the database
-$result = $schema-><B>ExecuteSchema</B>( $sql );
-
-// Finally, clean up after the XML parser
-// (PHP won't do this for you!)
-$schema-><B>Destroy</B>();
-</PRE>
-       
-<H2>XML Schema Format:</H2>
-<P>(See <a href="../xmlschema.dtd">ADOdb_schema.dtd</a> for the full specification)</P>
-<PRE>
-&lt;?xml version="1.0"?&gt;
-&lt;schema&gt;
-  &lt;table name="tablename" platform="platform1|platform2|..."&gt;
-    &lt;descr&gt;Optional description&lt;/descr&gt;
-    &lt;field name="fieldname" type="datadict_type" size="size"&gt;
-      &lt;KEY/&gt;
-      &lt;NOTNULL/&gt;
-      &lt;AUTOINCREMENT/&gt;
-      &lt;DEFAULT value="value"/&gt;
-    &lt;/field&gt;
-       ... <i>more fields</i>
-  &lt;/table&gt;
-  ... <i>more tables</i>
-  
-  &lt;index name="indexname" platform="platform1|platform2|..."&gt;
-    &lt;descr&gt;Optional description&lt;/descr&gt;
-    &lt;col&gt;fieldname&lt;/col&gt;
-    ... <i>more columns</i>
-  &lt;/index&gt;
-  ... <i>more indices</i>
-  
-  &lt;sql platform="platform1|platform2|..."&gt;
-    &lt;descr&gt;Optional description&lt;/descr&gt;
-    &lt;query platform="platform1|platform2|..."&gt;SQL query&lt;/query&gt;
-    ... <i>more queries</i>
-  &lt;/sql&gt;
-  ... <i>more SQL</i>
-  &lt;/schema&gt;
-</PRE>
-<HR>
-<H2>Thanks</H2>
-<P>Thanks to John Lim for giving us ADODB, and for the hard work that keeps it on top of things. 
-And particulary for the datadict code that made xmlschema possible.</P>
-<P>And to the kind folks at <a href="http://phpdoc.org">PHP Documentor</a>. Cool tool.</P>
-<P>And to Linus. I thought the end of Amiga was the end of computing. Guess I was wrong :-)</P>
-<HR>
-<address>If you have any questions or comments, please email them to me  at 
-<a href="mailto:richtl@arscognita.com">richtl@arscognita.com</a>.</address>
-
-<P><TT>$Id$</TT></P>
\ No newline at end of file
diff --git a/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/example.php b/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/example.php
deleted file mode 100644 (file)
index 125b020..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<?PHP
-require( "path_to_adodb/adodb-xmlschema.inc.php" );
-
-// To build the schema, start by creating a normal ADOdb connection:
-$db = ADONewConnection( 'mysql' );
-$db->Connect( 'localhost', 'someuser', '', 'schematest' );
-
-// Create the schema object and build the query array.
-$schema = new adoSchema( $db );
-
-// Build the SQL array
-$sql = $schema->ParseSchema( "example.xml" );
-
-print "Here's the SQL to do the build:\n";
-print_r( $sql );
-print "\n";
-
-// Execute the SQL on the database
-$result = $schema->ExecuteSchema( $sql );
-
-// Finally, clean up after the XML parser
-// (PHP won't do this for you!)
-$schema->Destroy();
-?>
\ No newline at end of file
diff --git a/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/example.xml b/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/example.xml
deleted file mode 100644 (file)
index 4e1d422..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0"?>
-<schema>
-  <table name="mytable">
-    <field name="row1" type="I">
-      <descr>An integer row that's a primary key and autoincrements</descr>
-      <KEY/>
-      <AUTOINCREMENT/>
-    </field>
-    <field name="row2" type="C" size="16">
-      <descr>A 16 character varchar row that can't be null</descr>
-      <NOTNULL/>
-    </field>
-  </table>
-  <index name="myindex" table="mytable">
-    <col>row1</col>
-    <col>row2</col>
-  </index>
-  <sql>
-    <descr>SQL to be executed only on specific platforms</descr>
-    <query platform="postgres|postgres7">
-      insert into mytable ( row1, row2 ) values ( 12, 'stuff' )
-    </query>
-    <query platform="mysql">
-      insert into mytable ( row1, row2 ) values ( 12, 'different stuff' )
-    </query>
-  </sql>
-</schema>
diff --git a/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/xmlschema.dtd b/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/xmlschema.dtd
deleted file mode 100644 (file)
index b412067..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE adodb_schema [
-<!ELEMENT schema (table*, index*, sql*)>
-<!ELEMENT table (field+, constraint*, replace?, descr?)>
-<!ELEMENT field ((NOTNULL|KEY|PRIMARY)?, (AUTO|AUTOINCREMENT)?, (DEFAULT|DEFDATE|DEFTIMESTAMP)?, NOQUOTE, constraint, descr?)>
-<!ELEMENT descr (#CDATA)>
-<!ELEMENT NOTNULL EMPTY>
-<!ELEMENT KEY EMPTY>
-<!ELEMENT PRIMARY EMPTY>
-<!ELEMENT AUTO EMPTY>
-<!ELEMENT AUTOINCREMENT EMPTY>
-<!ELEMENT DEFAULT EMPTY>
-<!ELEMENT DEFDATE EMPTY>
-<!ELEMENT DEFTIMESTAMP EMPTY>
-<!ELEMENT NOQUOTE EMPTY>
-<!ELEMENT constraint (#CDATA)>
-<!ATTLIST table name CDATA #REQUIRED platform CDATA #IMPLIED version CDATA #IMPLIED>
-<!ATTLIST field name CDATA #REQUIRED type (C|C2|X|X2|B|D|T|L|I|F|N) #REQUIRED size CDATA #IMPLIED>
-<!ATTLIST DEFAULT value CDATA #REQUIRED>
-<!ELEMENT index (col+, CLUSTERED?, BITMAP?, UNIQUE?, FULLTEXT?, HASH?, descr?)>
-<!ELEMENT col (#CDATA)>
-<!ELEMENT CLUSTERED EMPTY>
-<!ELEMENT BITMAP EMPTY>
-<!ELEMENT UNIQUE EMPTY>
-<!ELEMENT FULLTEXT EMPTY>
-<!ELEMENT HASH EMPTY>
-<!ATTLIST index name CDATA #REQUIRED table CDATA #REQUIRED>
-<!ELEMENT sql (query+, descr?)>
-<!ELEMENT query (#CDATA)>
-<!ATTLIST sql name CDATA #IMPLIED platform CDATA #IMPLIED>
-] >
diff --git a/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/xmlschema.html b/lib/adodb/adodb-xmlschema-0.0.1-snap20030511/xmlschema.html
deleted file mode 100644 (file)
index d528e1d..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-<H1>adodb-xmlschema</H1>
-<P>Written by <a href="mailto:richtl@arscognita.com">Richard Tango-Lowy</a>.</P>
-<P>For more information, contact <a href="richtl@arscognita.com">richtl@arscognita.com</a> 
-or visit our site at <a href="http://www.arscognita.com">www.arscognita.com</a>.</P>
-<P>At the moment, you should report bugs by mailing them to me. (If I can't convince John to
-make this part of ADODB :-), I'll  create a project for it on SourceForge.)
-
-<H2>Introduction</H2>
-<P><B>adodb-xmlschema</B> is a class that allows the user to quickly and easily
-build a database using the excellent 
-<a href="http://php.weblogs.com/ADODB">ADODB database library</a> and a simple 
-XML formatted file.</P>
-<P>This library is dual-licensed under a BSD-style license and under the <B><a href="http://opensource.org/licenses/lgpl-license.php">GNU Lesser Public License</a></B>.
-See the <B>LICENSE</B> file for more information.</P>
-
-<H2>Features</H2><UL>
-       <LI>Darned easy to install
-       <LI>Quickly to create schemas that build on any platform supported by ADODB.</UL>
-
-<H2>Installation</H2>
-<P>To install adodb-xmlschema, simply copy the <tt>adodb-xmlschema.inc.php</tt> file into your
-<B>ADODB</B> directory.</P>
-
-<H2>Quick Start</H2>
-<P>First, create an XML database schema. Let's call it "schema.xml:"</P><PRE>
-&lt;?xml version="1.0"?&gt;
-&lt;schema&gt;
-  &lt;table name="mytable"&gt;
-    &lt;field name="row1" type="I"&gt;
-      &lt;descr&gt;An integer row that's a primary key and autoincrements&lt;/descr&gt;
-      &lt;KEY/&gt;
-      &lt;AUTOINCREMENT/&gt;
-    &lt;/field&gt;
-    &lt;field name="row2" type="C" size="16"&gt;
-      &lt;descr&gt;A 16 character varchar row that can't be null&lt;/descr&gt;
-      &lt;NOTNULL/&gt;
-    &lt;/field&gt;
-  &lt;/table&gt;
-  &lt;index name="myindex" table="mytable"&gt;
-    &lt;col&gt;row1&lt;/col&gt;
-    &lt;col&gt;row2&lt;/col&gt;
-  &lt;/index&gt;
-  &lt;sql&gt;
-    &lt;descr&gt;SQL to be executed only on specific platforms&lt;/descr&gt;
-    &lt;query platform="postgres|postgres7"&gt;
-      insert into mytable ( row1, row2 ) values ( 12, 'stuff' )
-    &lt;/query&gt;
-    &lt;query platform="mysql"&gt;
-      insert into mytable ( row1, row2 ) values ( 12, 'different stuff' )
-    &lt;/query&gt;
-  &lt;/sql&gt;
-&lt;/schema&gt;
-</PRE><P>Create a new database using the appropriate tool for your platform.
-Executing the following PHP code will create the a <i>mytable</i> and <i>myindex</i>
-in the database and insert one row into <i>mytable</i> if the platform is postgres or mysql. </P><PRE>                         
-// To build the schema, start by creating a normal ADOdb connection:
-$db->NewADOConnection( 'mysql' );
-$db->Connect( ... );
-
-// Create the schema object and build the query array.
-$schema = <B>new adoSchema</B>( $db );
-
-// Build the SQL array
-$sql = $schema-><B>ParseSchema</B>( "schema.xml" );
-
-// Execute the SQL on the database
-$result = $schema-><B>ExecuteSchema</B>( $sql );
-
-// Finally, clean up after the XML parser
-// (PHP won't do this for you!)
-$schema-><B>Destroy</B>();
-</PRE>
-       
-<H2>XML Schema Format:</H2>
-<P>(See <a href="../xmlschema.dtd">ADOdb_schema.dtd</a> for the full specification)</P>
-<PRE>
-&lt;?xml version="1.0"?&gt;
-&lt;schema&gt;
-  &lt;table name="tablename" platform="platform1|platform2|..."&gt;
-    &lt;descr&gt;Optional description&lt;/descr&gt;
-    &lt;field name="fieldname" type="datadict_type" size="size"&gt;
-      &lt;KEY/&gt;
-      &lt;NOTNULL/&gt;
-      &lt;AUTOINCREMENT/&gt;
-      &lt;DEFAULT value="value"/&gt;
-    &lt;/field&gt;
-       ... <i>more fields</i>
-  &lt;/table&gt;
-  ... <i>more tables</i>
-  
-  &lt;index name="indexname" platform="platform1|platform2|..."&gt;
-    &lt;descr&gt;Optional description&lt;/descr&gt;
-    &lt;col&gt;fieldname&lt;/col&gt;
-    ... <i>more columns</i>
-  &lt;/index&gt;
-  ... <i>more indices</i>
-  
-  &lt;sql platform="platform1|platform2|..."&gt;
-    &lt;descr&gt;Optional description&lt;/descr&gt;
-    &lt;query platform="platform1|platform2|..."&gt;SQL query&lt;/query&gt;
-    ... <i>more queries</i>
-  &lt;/sql&gt;
-  ... <i>more SQL</i>
-  &lt;/schema&gt;
-</PRE>
-<HR>
-<H2>Thanks</H2>
-<P>Thanks to John Lim for giving us ADODB, and for the hard work that keeps it on top of things. 
-And particulary for the datadict code that made xmlschema possible.</P>
-<P>And to the kind folks at <a href="http://phpdoc.org">PHP Documentor</a>. Cool tool.</P>
-<P>And to Linus. I thought the end of Amiga was the end of computing. Guess I was wrong :-)</P>
-<HR>
-<address>If you have any questions or comments, please email them to me  at 
-<a href="mailto:richtl@arscognita.com">richtl@arscognita.com</a>.</address>
-
-<P><TT>$Id$</TT></P>
\ No newline at end of file
index c925f0b53d7463fa82f04bd3737e977a69d412a9..19612a6ac30c4449a96b0c8d3041a8f994b59e65 100644 (file)
@@ -10,9 +10,9 @@
  * build a database on any ADOdb-supported platform using a simple
  * XML schema.
  *
- * Last Editor: $Author$
+ * Last Editor: $Author: skodak $
  * @author Richard Tango-Lowy & Dan Cech
- * @version $Revision$
+ * @version $Revision: 1.14 $
  *
  * @package axmls
  * @tutorial getting_started.pkg
@@ -1209,7 +1209,7 @@ class dbQuerySet extends dbObject {
 * @tutorial getting_started.pkg
 *
 * @author Richard Tango-Lowy & Dan Cech
-* @version $Revision$
+* @version $Revision: 1.14 $
 *
 * @package axmls
 */
index cc98bec6bb2c6fd5ce8517fb383e8632fe4c53b0..40ae3a57fbda69131a0e9494da41f3d02bc8d935 100644 (file)
@@ -10,9 +10,9 @@
  * build a database on any ADOdb-supported platform using a simple
  * XML schema.
  *
- * Last Editor: $Author$
+ * Last Editor: $Author: skodak $
  * @author Richard Tango-Lowy & Dan Cech
- * @version $Revision$
+ * @version $Revision: 1.4 $
  *
  * @package axmls
  * @tutorial getting_started.pkg
@@ -1309,7 +1309,7 @@ class dbQuerySet extends dbObject {
 * @tutorial getting_started.pkg
 *
 * @author Richard Tango-Lowy & Dan Cech
-* @version $Revision$
+* @version $Revision: 1.4 $
 *
 * @package axmls
 */
diff --git a/lib/adodb/crypt.inc.php b/lib/adodb/crypt.inc.php
deleted file mode 100644 (file)
index b99bbba..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-<?php
-//      Session Encryption by Ari Kuorikoski <ari.kuorikoski@finebyte.com>
-class MD5Crypt{
-               function keyED($txt,$encrypt_key)
-               {
-                               $encrypt_key = md5($encrypt_key);
-                               $ctr=0;
-                               $tmp = "";
-                               for ($i=0;$i<strlen($txt);$i++){
-                                               if ($ctr==strlen($encrypt_key)) $ctr=0;
-                                               $tmp.= substr($txt,$i,1) ^ substr($encrypt_key,$ctr,1);
-                                               $ctr++;
-                               }
-                               return $tmp;
-               }
-
-               function Encrypt($txt,$key)
-               {
-                               srand((double)microtime()*1000000);
-                               $encrypt_key = md5(rand(0,32000));
-                               $ctr=0;
-                               $tmp = "";
-                               for ($i=0;$i<strlen($txt);$i++)
-                               {
-                               if ($ctr==strlen($encrypt_key)) $ctr=0;
-                               $tmp.= substr($encrypt_key,$ctr,1) .
-                               (substr($txt,$i,1) ^ substr($encrypt_key,$ctr,1));
-                               $ctr++;
-                               }
-                               return base64_encode($this->keyED($tmp,$key));
-               }
-
-               function Decrypt($txt,$key)
-               {
-                               $txt = $this->keyED(base64_decode($txt),$key);
-                               $tmp = "";
-                               for ($i=0;$i<strlen($txt);$i++){
-                                               $md5 = substr($txt,$i,1);
-                                               $i++;
-                                               $tmp.= (substr($txt,$i,1) ^ $md5);
-                               }
-                               return $tmp;
-               }
-
-               function RandPass()
-               {
-                               $randomPassword = "";
-                               srand((double)microtime()*1000000);
-                               for($i=0;$i<8;$i++)
-                               {
-                                               $randnumber = rand(48,120);
-
-                                               while (($randnumber >= 58 && $randnumber <= 64) || ($randnumber >= 91 && $randnumber <= 96))
-                                               {
-                                                               $randnumber = rand(48,120);
-                                               }
-
-                                               $randomPassword .= chr($randnumber);
-                               }
-                               return $randomPassword;
-               }
-
-}
-?>
\ No newline at end of file
diff --git a/lib/adodb/docs-adodb.htm b/lib/adodb/docs-adodb.htm
deleted file mode 100644 (file)
index b2f2d69..0000000
+++ /dev/null
@@ -1,3229 +0,0 @@
-<html>
-<head>
-<title>ADODB Manual</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<XSTYLE
-       body,td {font-family:Arial,Helvetica,sans-serif;font-size:11pt}
-       pre {font-size:9pt}
-       .toplink {font-size:8pt}
-       />
-</head>        
-<body bgcolor="#FFFFFF">
-
-<h2>ADOdb Library for PHP</h2>
-<p>V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim#natsoft.com)</p>
-<p><font size="1">This software is dual licensed using BSD-Style and LGPL. This 
-  means you can use it in compiled proprietary and commercial products.</font></p>
-       <p>Useful ADOdb links:  <a href=http://php.weblogs.com/adodb>Download</a> &nbsp; <a href=http://php.weblogs.com/adodb_manual>Other Docs</a>
-
-<p><a href="#intro"><b>Introduction</b></a><b><br>
-       <a href="#features">Unique Features</a><br>
-       <a href="#users">How People are using ADOdb</a><br>
-       <a href="#bugs">Feature Requests and Bug Reports</a><br>
-       </b><b><a href="#install">Installation</a><br>
-       <a href="#mininstall">Minimum Install</a><br>
-       <a href="#coding">Initializing Code and Connection Examples</a><br>
-       <font size="2"><a href=#adonewconnection>ADONewConnection</a></font> 
-       <font size="2"><a href=#adonewconnection>NewADOConnection</a></font><br>
-       <a href="#speed">High Speed ADOdb - tuning tips</a></b><br>
-       <b><a href="#hack">Hacking and Modifying ADOdb Safely</a><br>
-       <a href="#php5">PHP5 Features</a></b><br>
-       <font size="2"><a href=#php5iterators>foreach iterators</a> <a href=#php5exceptions>exceptions</a></font><br>
-       <b> <a href="#drivers">Supported Databases</a></b><br>
-       <b> <a href="#quickstart">Tutorials</a></b><br>
-       <a href="#ex1">Example 1: Select</a><br>
-       <a href="#ex2">Example 2: Advanced Select</a><br>
-       <a href="#ex3">Example 3: Insert</a><br>
-       <a href="#ex4">Example 4: Debugging</a> &nbsp;<a href="#exrs2html">rs2html 
-       example</a><br>
-       <a href="#ex5">Example 5: MySQL and Menus</a><br>
-       <a href="#ex6">Example 6: Connecting to Multiple Databases at once</a> <br>
-       <a href="#ex7">Example 7: Generating Update and Insert SQL</a> <br>
-       <a href="#ex8">Example 8: Implementing Scrolling with Next and Previous</a><br>
-       <a href="#ex9">Example 9: Exporting in CSV or Tab-Delimited Format</a> <br>
-       <a href="#ex10">Example 10: Custom filters</a><br>
-       <a href="#ex11">Example 11: Smart Transactions</a><br>
-       <br>
-       <b> <a href="#errorhandling">Using Custom Error Handlers and PEAR_Error</a><br>
-       <a href="#DSN">Data Source Names</a><br>
-       <a href="#caching">Caching</a><br>
-       <a href="#pivot">Pivot Tables</a></b> 
-<p><a href="#ref"><b>REFERENCE</b></a>
-<p> <font size="2">Variables: <a href="#adodb_countrecs">$ADODB_COUNTRECS</a> <a href=#adodb_ansi_padding_off>$ADODB_ANSI_PADDING_OFF</a>
-  <a href="#adodb_cache_dir">$ADODB_CACHE_DIR</a> </font><font size="2"><a href=#adodb_fetch_mode>$ADODB_FETCH_MODE</a> 
-  <a href=#adodb_lang>$ADODB_LANG</a><br>
-  Constants: </font><font size="2"><a href=#adodb_assoc_case>ADODB_ASSOC_CASE</a> 
-  </font><br>
-  <a href="#ADOConnection"><b> ADOConnection</b></a><br>
-  <font size="2">Connections: <a href="#connect">Connect</a> <a href="#pconnect">PConnect</a> 
-  <a href="#nconnect">NConnect</a> <br>
-  Executing SQL: <a href="#execute">Execute</a> <a href="#cacheexecute"><i>CacheExecute</i></a> 
-  <a href="#SelectLimit">SelectLimit</a> <a href="#cacheSelectLimit"><i>CacheSelectLimit</i></a> 
-  <a href="#param">Param</a> <a href="#prepare">Prepare</a> <a href=#preparesp>PrepareSP</a> 
-  <a href="#inparameter">InParameter</a> <a href="#outparameter">OutParameter</a>
-  <br>
-  &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#getone">GetOne</a> 
-  <a href="#cachegetone"><i>CacheGetOne</i></a> <a href="#getrow">GetRow</a> <a href="#cachegetrow"><i>CacheGetRow</i></a> 
-  <a href="#getall">GetAll</a> <a href="#cachegetall"><i>CacheGetAll</i></a> <a href="#getcol">GetCol</a> 
-  <a href="#cachegetcol"><i>CacheGetCol</i></a> <a href="#getassoc1">GetAssoc</a> <a href="#cachegetassoc"><i>CacheGetAssoc</i></a> <a href="#replace">Replace</a> 
-  <br>
-  &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#executecursor">ExecuteCursor</a> 
-  (oci8 only)<br>
-  Generates SQL strings: <a href="#getupdatesql">GetUpdateSQL</a> <a href="#getinsertsql">GetInsertSQL</a> 
-  <a href="#concat">Concat</a> <a href="#ifnull">IfNull</a> <a href="#length">length</a> <a href="#random">random</a> <a href="#substr">substr</a> 
-  <a href="#qstr">qstr</a> <a href="#param">Param</a> 
-  <a href="#prepare"></a><a href="#OffsetDate">OffsetDate</a> <a href="#SQLDate">SQLDate</a> 
-  <a href="#dbdate">DBDate</a> <a href="#dbtimestamp"></a> <a href="#dbtimestamp">DBTimeStamp</a>
-  <br>
-  Blobs: <a href="#updateblob">UpdateBlob</a> <a href="#updateclob">UpdateClob</a> 
-  <a href="#updateblobfile">UpdateBlobFile</a> <a href="#blobencode">BlobEncode</a> 
-  <a href="#blobdecode">BlobDecode</a><br>
-  Paging/Scrolling: <a href="#pageexecute">PageExecute</a> <a href="#cachepageexecute">CachePageExecute</a><br>
-  Cleanup: <a href="#cacheflush">CacheFlush</a> <a href="#Close">Close</a><br>
-  Transactions: <a href="#starttrans">StartTrans</a> <a href="#completetrans">CompleteTrans</a> 
-  <a href="#failtrans">FailTrans</a> <a href="#hasfailedtrans">HasFailedTrans</a> 
-  <a href="#begintrans">BeginTrans</a> <a href="#committrans">CommitTrans</a> 
-  <a href="#rollbacktrans">RollbackTrans</a> <br>
-  Fetching Data: </font> <font size="2"><a href="#setfetchmode">SetFetchMode</a><br>
-  Strings: <a href="#concat">concat</a> <a href="#length">length</a>  <a href="#qstr">qstr</a> <a href="#quote">quote</a> <a href="#substr">substr</a><br>
-  Dates: <a href="#dbdate">DBDate</a> <a href="#dbtimestamp">DBTimeStamp</a> <a href="#unixdate">UnixDate</a> 
-  <a href="#unixtimestamp">UnixTimeStamp</a> <a href="#OffsetDate">OffsetDate</a> 
-  <a href="#SQLDate">SQLDate</a> <br>
-  Row Management: <a href="#affected_rows">Affected_Rows</a> <a href="#inserted_id">Insert_ID</a>  <a href=#rowlock>RowLock</a>
-  <a href="#genid">GenID</a> <a href=#createseq>CreateSequence</a> <a href=#dropseq>DropSequence</a> 
-  <br>
-  Error Handling: <a href="#errormsg">ErrorMsg</a> <a href="#errorno">ErrorNo</a> 
-  <a href="#metaerror">MetaError</a> <a href="#metaerrormsg">MetaErrorMsg</a><br>
-  Data Dictionary (metadata): <a href="#metadatabases">MetaDatabases</a> <a href="#metatables">MetaTables</a> 
-  <a href="#metacolumns">MetaColumns</a> <a href="#metacolumnames">MetaColumnNames</a> 
-  <a href="#metaprimarykeys">MetaPrimaryKeys</a> <a href="#metaforeignkeys">MetaForeignKeys</a> 
-  <a href="#serverinfo">ServerInfo</a> <br>
-  Statistics and Query-Rewriting: <a href="#logsql">LogSQL</a> <a href="#fnexecute">fnExecute 
-  and fnCacheExecute</a><br>
-  </font><font size="2">Deprecated: <a href="#bind">Bind</a> <a href="#blankrecordset">BlankRecordSet</a>
-  <a href="#parameter">Parameter</a></font>
-  <a href="#adorecordSet"><b><br>
-  ADORecordSet</b></a><br>
-  <font size="2">
-  Returns one field: <a href="#fields">Fields</a><br>
- Returns one row:<a href="#fetchrow">FetchRow</a> <a href="#fetchinto">FetchInto</a> 
-  <a href="#fetchobject">FetchObject</a> <a href="#fetchnextobject">FetchNextObject</a> 
-  <a href="#fetchobj">FetchObj</a> <a href="#fetchnextobj">FetchNextObj</a>
- <a href="#getrowassoc">GetRowAssoc</a> <br>
-  Returns all rows:<a href="#getarray">GetArray</a> <a href="#getrows">GetRows</a> 
-  <a href="#getassoc">GetAssoc</a><br>
-  Scrolling:<a href="#move">Move</a> <a href="#movenext">MoveNext</a> <a href="#movefirst">MoveFirst</a> 
-  <a href="#movelast">MoveLast</a> <a href="#abspos">AbsolutePosition</a> <a href="#currentrow">CurrentRow</a> 
-  <a href="#atfirstpage">AtFirstPage</a> <a href="#atlastpage">AtLastPage</a> 
-  <a href="#absolutepage">AbsolutePage</a> </font> <font size="2"><br>
-  Menu generation:<a href="#getmenu">GetMenu</a> <a href="#getmenu2">GetMenu2</a><br>
-  Dates:<a href="#userdate">UserDate</a> <a href="#usertimestamp">UserTimeStamp</a> 
-  <a href="#unixdate">UnixDate</a> <a href="#unixtimestamp">UnixTimeStamp<br>
-  </a>Recordset Info:<a href="#recordcount">RecordCount</a> <a href="#po_recordcount">PO_RecordSet</a> 
-  <a href="#nextrecordset">NextRecordSet</a><br>
-  Field Info:<a href="#fieldcount">FieldCount</a> <a href="#fetchfield">FetchField</a> 
-  <a href="#metatype">MetaType</a><br>
-  Cleanup: <a href="#rsclose">Close</a></font> <font size="2"></font> 
-<p><font size="2"><a href="#rs2html"><b>rs2html</b></a>&nbsp; <a href="#exrs2html">example</a></font><br>
-  <a href="#adodiff">Differences between ADOdb and ADO</a><br>
-  <a href="#driverguide"><b>Database Driver Guide<br>
-  </b></a><b><a href="#changes">Change Log</a></b><br>
-</p>
-<h2>Introduction<a name="intro"></a></h2>
-<p>PHP's database access functions are not standardised. This creates a need for 
-  a database class library to hide the differences between the different database 
-  API's (encapsulate the differences) so we can easily switch databases. PHP 4.0.5 or later
-  is now required (because we use array-based str_replace).</p>
-<p>We currently support MySQL, Oracle, Microsoft SQL Server, Sybase, Sybase SQL Anywhere, Informix, 
-  PostgreSQL, FrontBase,  SQLite, Interbase (Firebird and Borland variants), Foxpro, Access, ADO, DB2, SAP DB and ODBC. 
-  We have had successful reports of connecting to Progress and CacheLite via ODBC. We hope more people 
-  will contribute drivers to support other databases.</p>
-<p>PHP4 supports session variables. You can store your session information using 
-  ADOdb for true portability and scalability. See adodb-session.php for more information.</p>
-<p>Also read <a href="http://php.weblogs.com/portable_sql">http://php.weblogs.com/portable_sql</a> 
-  (also available as tips_portable_sql.htm in the release) for tips on writing 
-  portable SQL.</p>
-<h2>Unique Features of ADOdb<a name="features"></a></h2>
-<ul>
-  <li><b>Easy for Windows programmers</b> to adapt to because many of the conventions 
-       are similar to Microsoft's ADO.</li>
-  <li>Unlike other PHP database classes which focus only on select statements, 
-       <b>we provide support code to handle inserts and updates which can be adapted 
-       to multiple databases quickly.</b> Methods are provided for date handling, 
-       string concatenation and string quoting characters for differing databases.</li>
-  <li>A<b> metatype system </b>is built in so that we can figure out that types 
-       such as CHAR, TEXT and STRING are equivalent in different databases.</li>
-  <li><b>Easy to port</b> because all the database dependant code are stored in 
-       stub functions. You do not need to port the core logic of the classes.</li>
-  <li><b>Portable table and index creation</b> with the <a href=docs-datadict.htm>datadict</a> classes.
-  <li><b>Database performance monitoring and SQL tuning</b> with the <a href=docs-perf.htm>performance monitoring</a> classes.
-  <li><b>Database-backed sessions</b> with the <a href=docs-session.htm>session management</a> classes. Supports session expiry notification.
-</ul>
-<h2>How People are using ADOdb<a name="users"></a></h2>
-Here are some examples of how people are using ADOdb (for a much longer list, 
-visit <a href="http://php.weblogs.com/adodb-cool-applications">http://php.weblogs.com/adodb-cool-applications</a>): 
-<ul>
-<li><a href="http://phplens.com/">PhpLens</a> is a commercial data grid component that allows both cool Web designers and serious unshaved programmers to develop and maintain databases on the Web easily. Developed by the author of ADOdb.<p>
-
-<li><a href="http://www.interakt.ro/phakt/">PHAkt: PHP Extension for DreamWeaver Ultradev</a> allows you to script PHP in the popular Web page editor. Database handling provided by ADOdb.<p>
-
-<li><a href="http://www.andrew.cmu.edu/~rdanyliw/snort/snortacid.html">Analysis Console for Intrusion Databases</a> (ACID): PHP-based analysis engine to search and process a database of security incidents generated by security-related software such as IDSes and firewalls (e.g. Snort, ipchains). By Roman Danyliw.<p>
-
-<li><a href="http://www.postnuke.com/">PostNuke</a> is a very popular free content management
- system and weblog system. It offers full CSS support, HTML 4.01 transitional compliance throughout, an advanced blocks system, and is fully multi-lingual enabled. <p>
-
-<li><a href=http://www.auto-net.no/easypublish.php?page=index&lang_id=2>EasyPublish CMS</a>  is another free content management system for managing information and integrated modules on your internet, intranet- and extranet-sites. From Norway.<p>
-
-<li><a href="http://nola.noguska.com/">NOLA</a> is a full featured accounting, inventory, and job tracking application. It is licensed under the GPL, and developed by Noguska.
-</ul><p>
-
-<h2>Feature Requests and Bug Reports<a name="bugs"></a></h2>
-<p>Feature requests and bug reports can be emailed to <a href="mailto:jlim#natsoft.com.my">jlim#natsoft.com.my</a> 
-  or posted to the ADOdb Help forums at <a href="http://phplens.com/lens/lensforum/topics.php?id=4">http://phplens.com/lens/lensforum/topics.php?id=4</a>.</p>
-<h2>Installation Guide<a name="install"></a></h2>
-<p>Make sure you are running PHP 4.0.4 or later. 
-  Unpack all the files into a directory accessible by your webserver.</p>
-<p>To test, try modifying some of the tutorial examples. Make sure you customize 
-  the connection settings correctly. You can debug using <i>$db->debug = true</i> as shown below:</p>
-<pre>&lt;?php
-       include('adodb/adodb.inc.php');
-       $db = <a href="#adonewconnection">ADONewConnection</a>($dbdriver); # eg 'mysql' or 'postgres'
-       $db->debug = true;
-       $db-><a href="#connect">Connect</a>($server, $user, $password, $database);
-       $rs = $db-><a href="#execute">Execute</a>('select * from some_small_table');
-       print &quot;&lt;pre&gt;&quot;;
-       print_r($rs-><a href="#getrows">GetRows</a>());
-       print &quot;&lt;/pre&gt;&quot;;
-?&gt;</pre>
-
- <h3>Minimum Install<a name=mininstall></a></h3>
-<p>For developers who want to release a minimal install of ADOdb, you will need:
-<ul>
-<li>adodb.inc.php
-<li>adodb-lib.inc.php
-<li>adodb-time.inc.php
-<li>adodb-csvlib.inc.php (if you use cached recordsets - CacheExecute(), etc)
-<li>adodb-error.inc.php and lang/adodb-$lang.inc.php (if you use MetaError())
-<li>drivers/adodb-$database.inc.php
-<li>license.txt (for legal reasons)
-</ul>
-
-<h3>Code Initialization Examples<a name="coding"></a></h3>
-<p>When running ADOdb, at least two files are loaded. First is adodb/adodb.inc.php, 
- which contains all functions used by all database classes. The code specific 
- to a particular database is in the adodb/driver/adodb-????.inc.php file.</p>
- <a name="adonewconnection">
-<p>For example, to connect to a mysql database:</p>
-<pre>
-include('/path/to/set/here/adodb.inc.php');
-$conn = &amp;ADONewConnection('mysql');
-</pre>
-<p>Whenever you need to connect to a database, you create a Connection object 
-  using the <b>ADONewConnection</b></a>($driver) function. 
-  <b>NewADOConnection</b>($driver) is an alternative name for the same function.</p>
-
-<p>At this point, you are not connected to the database. You will first need to decide
-whether to use <i>persistent</i> or <i>non-persistent</i> connections. The advantage of <i>persistent</i>
-connections is that they are faster, as the database connection is never closed (even 
-when you call Close()). <i>Non-persistent </i>connections take up much fewer resources though,
-reducing the risk of your database and your web-server becoming overloaded. 
-<p>For persistent connections,
-use $conn-&gt;<a href="reference.functions.pconnect.html">PConnect()</a>,
- or $conn-&gt;<a href="reference.functions.connect.html">Connect()</a> for non-persistent connections.
-Some database drivers also support <a href="reference.functions.nconnect.html">NConnect()</a>, which forces 
-the creation of a new connection. 
-<a name=connection_gotcha></a>
-<p><i>Connection Gotcha</i>:  If you create two connections, but both use the same userid and password,
-PHP will share the same connection. This can cause problems if the connections are meant to 
-different databases. The solution is to always use different userid's for different databases,
- or use NConnect().
-
-<h3>Examples of Connecting to Databases</h3>
-<h4>MySQL and Most Other Database Drivers</h4>
-<p>MySQL connections are very straightforward, and the parameters are identical 
-  to mysql_connect:</p>
-<pre>
-       $conn = &amp;ADONewConnection('mysql'); 
-       $conn-&gt;PConnect('localhost','userid','password','database');
- </pre>
-<p> Most other database drivers use a similar convention: Connect($server, $user, $password, $database). Exceptions are listed below.
-<h4>PostgreSQL</h4>
-<p>PostgreSQL accepts connections using: </p>
-<p>a. the standard connection string:</p>
-<pre>
-       $conn = &amp;ADONewConnection('postgres7'); 
-       $conn-&gt;PConnect('host=localhost port=5432 dbname=mary');</pre>
-<p> b. the classical 4 parameters:</p>
- <pre>
-       $conn-&gt;PConnect('localhost','userid','password','database');
- </pre>
-<h4>Interbase/Firebird</h4>
-You define the database in the $host parameter:
-<pre>
-       $conn = &ADONewConnection('ibase'); 
-       $conn->PConnect('localhost:c:\ibase\employee.gdb','sysdba','masterkey');
-</pre>
-<h4>SQLite</h4>
-Sqlite will create database if it does not exist.
-<pre>
-       $conn = &ADONewConnection('sqlite'); 
-       $conn->PConnect('c:\path\to\sqlite.db'); # sqlite will create if does not exist
-</pre>
-<h4>Oracle</h4>
-<p>With Oracle, you can connect in multiple ways.</p>
-<p>a. PHP and Oracle reside on the same machine, use default SID.</p>
-<pre>  $conn-&gt;Connect(false, 'scott', 'tiger');</pre>
-<p>b. TNS Name defined, eg. 'myTNS'</p>
-<pre>  $conn-&gt;PConnect(false, 'scott', 'tiger', 'myTNS');
-</pre>
-<p>or</p>
-<pre>  $conn-&gt;PConnect('myTNS', 'scott', 'tiger');</pre>
-<p>c. Host Address and SID</p>
-<pre>  $conn-&gt;Connect('192.168.0.1', 'scott', 'tiger', 'SID');</pre>
-<p>d. Host Address and Service Name</p>
-<pre>  $conn-&gt;Connect('192.168.0.1', 'scott', 'tiger', 'servicename');</pre>
-<a name=dsnless></a>
-<h4>DSN-less ODBC (access and mssql examples)</h4>
-<p>ODBC DSN's can be created in the ODBC control panel, or you can use a DSN-less 
-  connection.To use DSN-less connections with ODBC you need PHP 4.3 or later. 
-</p>
-<p>For Microsoft Access:</a></p>
-<pre>
-       $db =& ADONewConnection('access');
-       $dsn = <strong>"Driver=&#123;Microsoft Access Driver (*.mdb)&#125;;Dbq=d:\\northwind.mdb;Uid=Admin;Pwd=;";</strong>
-       $db->Connect($dsn);
-</pre>
-For Microsoft SQL Server: 
-<pre>
-       $db =& ADONewConnection('odbc_mssql');
-       $dsn = <strong>"Driver=&#123;SQL Server&#125;;Server=localhost;Database=northwind;"</strong>;
-       $db->Connect($dsn,'userid','password');
-</pre>
-<b>DSN-less Connections with ADO</b><br>
-If you are using versions of PHP earlier than PHP 4.3.0, DSN-less connections 
-only work with Microsoft's ADO, which is Microsoft's COM based API. An example 
-using the ADOdb library and Microsoft's ADO: 
-<pre>
-&lt;?php
-       include('adodb.inc.php'); 
-       $db = &ADONewConnection("ado_mssql");
-       print "&lt;h1>Connecting DSN-less $db->databaseType...&lt;/h1>";
-               
-       <b>$myDSN="PROVIDER=MSDASQL;DRIVER=&#123;SQL Server&#125;;"
-               . "SERVER=flipper;DATABASE=ai;UID=sa;PWD=;"  ;</b>
-       $db->Connect($myDSN);
-       
-       $rs = $db->Execute("select * from table");
-       $arr = $rs->GetArray();
-       print_r($arr);
-?>
-</pre><a name=speed></a>
-<h2>High Speed ADOdb - tuning tips</h2>
-<p>ADOdb is a big class library, yet it <a href=http://phplens.com/lens/adodb/>consistently beats</a> all other PHP class 
-  libraries in performance. This is because it is designed in a layered fashion, 
-  like an onion, with the fastest functions in the innermost layer. Stick to the 
-  following functions for best performance:</p>
-<table width="40%" border="1" align="center">
-  <tr>
-    <td><div align="center"><b>Innermost Layer</b></div></td>
-  </tr>
-  <tr> 
-    <td><p align="center">Connect, PConnect, NConnect<br>
-        Execute, CacheExecute<br>
-        SelectLimit, SelectLimit<br>
-        MoveNext, Close <br>
-               qstr, Affected_Rows, Insert_ID</p></td>
-  </tr>
-</table>
-<p>The fastest way to access the fields is by accessing the array $recordset->fields 
-  directly. Also set the global variables <a href="#adodb_fetch_mode">$ADODB_FETCH_MODE</a> 
-  = ADODB_FETCH_NUM, and (for oci8, ibase/firebird and odbc) <a href="#adodb_countrecs">$ADODB_COUNTRECS</a> = false 
-  before you connect to your database. At the time of writing (Dec 2003).</p>
-<p>Consider using bind parameters if your database supports it, as it improves 
-  query plan reuse. Use ADOdb's performance tuning system to identify bottlenecks 
-  quickly. At the time of writing (Dec 2003), this means oci8 and odbc drivers.</p>
-<p>Lastly make sure you have a PHP accelerator cache installed such as APC, Turck 
-  MMCache, Zend Accelerator or ionCube.</p>
- <p>Informix tips: Disable scrollable cursors with $db->cursorType = 0.
-<p><a name=hack></a> </p>
-<h2>Hacking ADOdb Safely</h2>
-<p>You might want to modify ADOdb for your own purposes. Luckily you can
-still maintain backward compatibility by sub-classing ADOdb and using the $ADODB_NEWCONNECTION
-variable. $ADODB_NEWCONNECTION allows you to override the behaviour of ADONewConnection().
-ADOConnection() checks for this variable and will call
-the function-name stored in this variable if it is defined.
-<p>In the following example, new functionality for the connection object 
-is placed in the <i>hack_mysql</i> and <i>hack_postgres7</i> classes. The recordset class naming convention
-can be controlled using $rsPrefix. Here we set it to 'hack_rs_', which will make ADOdb use
-<i>hack_rs_mysql</i> and <i>hack_rs_postgres7</i> as the recordset classes.
-If you want to use the default ADOdb drivers return false.
-
-<pre>
-class hack_mysql extends adodb_mysql {
-var $rsPrefix = 'hack_rs_';
-  /* Your mods here */
-}
-
-class hack_rs_mysql extends ADORecordSet_mysql {
- /* Your mods here */
-}
-
-class hack_postgres7 extends adodb_postgres7 {
-var $rsPrefix = 'hack_rs_';
-  /* Your mods here */
-}
-
-class hack_rs_postgres7 extends ADORecordSet_postgres7 {
- /* Your mods here */
-}
-
-$ADODB_NEWCONNECTION = 'hack_factory';
-
-function& hack_factory($driver)
-{
-       if ($driver !== 'mysql' && $driver !== 'postgres7') return false;
-       
-       $driver = 'hack_'.$driver;
-       $obj = new $driver();
-       return $obj;
-}
-
-include_once('adodb.inc.php');
-
-</pre>
-<p>Don't forget to call the constructor of the parent class.
-<a name="php5">
-<h2>PHP5 Features</h2>
- ADOdb 4.02 or later will transparently determine which version of PHP you are using.
-If PHP5 is detected, the following features become available:
-<ul>
-<a name="php5iterators">
-<li><b>Foreach iterators</b>: This is a very natural way of going through a recordset:
-<pre>
-       $ADODB_FETCH_MODE = ADODB_FETCH_NUM;
-       $rs = $db->Execute($sql);
-       foreach($rs as $k => $row) {
-               echo "r1=".$row[0]." r2=".$row[1]."&lt;br>";
-       }
-</pre>
-<p>
-<a name="php5exceptions">
-<li><b>Exceptions</b>: Just include <i>adodb-exceptions.inc.php</i> and you can now 
-catch exceptions on errors as they occur.
-<pre>
-       <b>include("../adodb-exceptions.inc.php");</b> 
-       include("../adodb.inc.php");     
-       try { 
-               $db = NewADOConnection("oci8"); 
-               $db->Connect('','scott','bad-password'); 
-       } catch (exception $e) { 
-               var_dump($e); 
-       } 
-</pre>
-</ul> 
-<h3><a name="drivers"></a>Databases Supported</h3>
-<table width="100%" border="1">
-  <tr valign="top"> 
-    <td><b>Name</b></td>
-    <td><b>Tested</b></td>
-    <td><b>Database</b></td>
-    <td><b><font size="2">RecordCount() usable</font></b></td>
-    <td><b>Prerequisites</b></td>
-    <td><b>Operating Systems</b></td>
-  </tr>
-  <tr valign="top"> 
-    <td><b><font size="2">access</font></b></td>
-    <td><font size="2">B</font></td>
-    <td><font size="2">Microsoft Access/Jet. You need to create an ODBC DSN.</font></td>
-    <td><font size="2">Y/N</font></td>
-    <td><font size="2">ODBC </font></td>
-    <td><font size="2">Windows only</font></td>
-  </tr>
-  <tr valign="top"> 
-    <td><b><font size="2">ado</font></b></td>
-    <td><font size="2">B</font></td>
-    <td><p><font size="2">Generic ADO, not tuned for specific databases. Allows 
-        DSN-less connections. For best performance, use an OLEDB provider. This 
-        is the base class for all ado drivers.</font></p>
-      <p><font size="2">You can set $db-&gt;codePage before connecting.</font></p></td>
-    <td><font size="2">? depends on database</font></td>
-    <td><font size="2">ADO or OLEDB provider</font></td>
-    <td><font size="2">Windows only</font></td>
-  </tr>
-  <tr valign="top"> 
-    <td><b><font size="2">ado_access</font></b></td>
-    <td><font size="2">B</font></td>
-    <td><font size="2">Microsoft Access/Jet using ADO. Allows DSN-less connections. 
-      For best performance, use an OLEDB provider.</font></td>
-    <td><font size="2">Y/N</font></td>
-    <td><font size="2">ADO or OLEDB provider</font></td>
-    <td><font size="2">Windows only</font></td>
-  </tr>
-  <tr valign="top"> 
-    <td><b><font size="2">ado_mssql</font></b></td>
-    <td><font size="2">B</font></td>
-    <td><font size="2">Microsoft SQL Server using ADO. Allows DSN-less connections. 
-      For best performance, use an OLEDB provider.</font></td>
-    <td><font size="2">Y/N</font></td>
-    <td><font size="2">ADO or OLEDB provider</font></td>
-    <td><font size="2">Windows only</font></td>
-  </tr>
-  <tr valign="top"> 
-    <td height="54"><b><font size="2">db2</font></b></td>
-    <td height="54"><font size="2">A</font></td>
-    <td height="54"><font size="2">DB2. Should work reliably as based on ODBC 
-      driver.</font></td>
-    <td height="54"><font size="2">Y/N</font></td>
-    <td height="54"><font size="2">DB2 CLI/ODBC interface</font></td>
-    <td height="54"> <p><font size="2">Unix and Windows. <a href="http://www.faqts.com/knowledge_base/view.phtml/aid/6283/fid/14">Unix 
-        install hints</a>. I have had reports that the $host and $database params have to be reversed in Connect() when using the CLI interface.</font></p></td>
-  </tr>
-  <tr valign="top"> 
-    <td><b><font size="2">vfp</font></b></td>
-    <td><font size="2">A</font></td>
-    <td><font size="2">Microsoft Visual FoxPro. You need to create an ODBC DSN.</font></td>
-    <td><font size="2">Y/N</font></td>
-    <td><font size="2">ODBC</font></td>
-    <td><font size="2">Windows only</font></td>
-  </tr>
-  <tr valign="top"> 
-    <td><b><font size="2">fbsql</font></b></td>
-    <td><font size="2">C</font></td>
-    <td><font size="2">FrontBase. </font></td>
-    <td><font size="2">Y</font></td>
-    <td><font size="2">?</font></td>
-    <td> <p><font size="2">Unix and Windows</font></p></td>
-  </tr>
-  <tr valign="top"> 
-    <td><b><font size="2">ibase</font></b></td>
-    <td><font size="2">B</font></td>
-    <td><font size="2">Interbase 6 or earlier. Some users report you might need 
-      to use this<br>
-      $db->PConnect('localhost:c:/ibase/employee.gdb', "sysdba", "masterkey") 
-      to connect. Lacks Affected_Rows currently.<br>
-      <br>
-      You can set $db->dialect, $db-&gt;buffers and $db->charSet before connecting.</font></td>
-    <td><font size="2">Y/N</font></td>
-    <td><font size="2">Interbase client</font></td>
-    <td><font size="2">Unix and Windows</font></td>
-  </tr>
-  <tr valign="top"> 
-    <td><b><i><font size="2">firebird</font></i></b></td>
-    <td><font size="2">C</font></td>
-    <td><font size="2">Firebird version of interbase.</font></td>
-    <td><font size="2">Y/N</font></td>
-    <td><font size="2">Interbase client</font></td>
-    <td><font size="2">Unix and Windows</font></td>
-  </tr>
-  <tr valign="top"> 
-    <td><b><i><font size="2">borland_ibase</font></i></b></td>
-    <td><font size="2">C</font></td>
-    <td><font size="2">Borland version of Interbase 6.5 or later. Very sad that 
-      the forks differ.</font></td>
-    <td><font size="2">Y/N</font></td>
-    <td><font size="2">Interbase client</font></td>
-    <td><font size="2">Unix and Windows</font></td>
-  </tr>
-  <tr valign="top"> 
-    <td><b><font size="2">informix72</font></b></td>
-    <td><font size="2">C</font></td>
-    <td><font size="2"> Informix databases before Informix 7.3 that do no support 
-      SELECT FIRST.</font></td>
-    <td><font size="2">Y/N</font></td>
-    <td><font size="2">Informix client</font></td>
-    <td><font size="2">Unix and Windows</font></td>
-  </tr>
-  <tr valign="top"> 
-    <td><b><font size="2">informix</font></b></td>
-    <td><font size="2">C</font></td>
-    <td><font size="2">Generic informix driver.</font></td>
-    <td><font size="2">Y/N</font></td>
-    <td><font size="2">Informix client</font></td>
-    <td><font size="2">Unix and Windows</font></td>
-  </tr>
-  <tr valign="top"> 
-    <td height="73"><b><font size="2">mssql</font></b></td>
-    <td height="73"><font size="2">A</font></td>
-    <td height="73"> <p><font size="2">Microsoft SQL Server 7 and later. Works 
-        with Microsoft SQL Server 2000 also. Note that date formating is problematic 
-        with this driver. For example, the PHP mssql extension does not return 
-        the seconds for datetime!</font></p></td>
-    <td height="73"><font size="2">Y/N</font></td>
-    <td height="73"><font size="2">Mssql client</font></td>
-    <td height="73"> <p><font size="2">Unix and Windows. <br>
-        <a href="http://phpbuilder.com/columns/alberto20000919.php3">Unix install 
-        howto</a> and <a href=http://linuxjournal.com/article.php?sid=6636&mode=thread&order=0>another 
-        one</a>. </font></p></td>
-  </tr>
-  <tr valign="top"> 
-    <td height="73"><b><font size="2">mssqlpo</font></b></td>
-    <td height="73"><font size="2">A</font></td>
-    <td height="73"> <p><font size="2">Portable mssql driver. Identical to above 
-        mssql driver, except that '||', the concatenation operator, is converted 
-        to '+'. Useful for porting scripts from most other sql variants that use 
-        ||.</font></p></td>
-    <td height="73"><font size="2">Y/N</font></td>
-    <td height="73"><font size="2">Mssql client</font></td>
-    <td height="73"> <p><font size="2">Unix and Windows. <a href="http://phpbuilder.com/columns/alberto20000919.php3"><br>
-        Unix install howto</a>.</font></p></td>
-  </tr>
-  <tr valign="top"> 
-    <td><b><font size="2">mysql</font></b></td>
-    <td><font size="2">A</font></td>
-    <td><font size="2">MySQL without transaction support. You can also set $db-&gt;clientFlags 
-      before connecting.</font></td>
-    <td><font size="2">Y/N</font></td>
-    <td><font size="2">MySQL client</font></td>
-    <td><font size="2">Unix and Windows</font></td>
-  </tr>
-  <tr valign="top"> 
-    <td><font size="2"><b>mysqlt</b> or <b>maxsql</b></font></td>
-    <td><font size="2">A</font></td>
-    <td> <p><font size="2">MySQL with transaction support. We recommend using 
-        || as the concat operator for best portability. This can be done by running 
-        MySQL using: <br>
-        <i>mysqld --ansi</i> or <i>mysqld --sql-mode=PIPES_AS_CONCAT</i></font></p></td>
-    <td><font size="2">Y/N</font></td>
-    <td><font size="2">MySQL client</font></td>
-    <td><font size="2">Unix and Windows</font></td>
-  </tr>
-  <tr valign="top"> 
-    <td><b><font size="2">oci8</font></b></td>
-    <td><font size="2">A</font></td>
-    <td><font size="2">Oracle 8/9. Has more functionality than <i>oracle</i> driver 
-      (eg. Affected_Rows). You might have to putenv('ORACLE_HOME=...') before 
-      Connect/PConnect. </font> <p><font size="2"> There are 2 ways of connecting 
-        - with server IP and service name: <br>
-        <i>PConnect('serverip:1521','scott','tiger','service'</i>)<br>
-        or using an entry in TNSNAMES.ORA or ONAMES or HOSTNAMES: <br>
-        <i>PConnect(false, 'scott', 'tiger', $oraname)</i>. </font> 
-      <p><font size="2">Since 2.31, we support Oracle REF cursor variables directly 
-        (see <a href="#executecursor">ExecuteCursor</a>).</font> </td>
-    <td><font size="2">Y/N</font></td>
-    <td><font size="2">Oracle client</font></td>
-    <td><font size="2">Unix and Windows</font></td>
-  </tr>
-  <tr valign="top"> 
-    <td><b><font size="2">oci805</font></b></td>
-    <td><font size="2">C</font></td>
-    <td><font size="2">Supports reduced Oracle functionality for Oracle 8.0.5. 
-      SelectLimit is not as efficient as in the oci8 or oci8po drivers.</font></td>
-    <td><font size="2">Y/N</font></td>
-    <td><font size="2">Oracle client</font></td>
-    <td><font size="2">Unix and Windows</font></td>
-  </tr>
-  <tr valign="top"> 
-    <td><b><font size="2">oci8po</font></b></td>
-    <td><font size="2">A</font></td>
-    <td><font size="2">Oracle 8/9 portable driver. This is nearly identical with 
-      the oci8 driver except (a) bind variables in Prepare() use the ? convention, 
-      instead of :bindvar, (b) field names use the more common PHP convention 
-      of lowercase names. </font> <p><font size="2">Use this driver if porting 
-        from other databases is important. Otherwise the oci8 driver offers better 
-        performance. </font> </td>
-    <td><font size="2">Y/N</font></td>
-    <td><font size="2">Oracle client</font></td>
-    <td><font size="2">Unix and Windows</font></td>
-  </tr>
-  <tr valign="top"> 
-    <td><b><font size="2">odbc</font></b></td>
-    <td><font size="2">A</font></td>
-    <td><font size="2">Generic ODBC, not tuned for specific databases. To connect, 
-      use <br>
-      PConnect('DSN','user','pwd'). This is the base class for all odbc derived 
-      drivers.</font></td>
-    <td><font size="2">? depends on database</font></td>
-    <td><font size="2">ODBC</font></td>
-    <td><font size="2">Unix and Windows. <a href="http://phpbuilder.com/columns/alberto20000919.php3?page=4">Unix 
-      hints.</a></font></td>
-  </tr>
-  <tr valign="top"> 
-    <td><b><font size="2">odbc_mssql</font></b></td>
-    <td><font size="2">C</font></td>
-    <td><font size="2">Uses ODBC to connect to MSSQL</font></td>
-    <td><font size="2">Y/N</font></td>
-    <td><font size="2">ODBC</font></td>
-    <td><font size="2">Unix and Windows. </font></td>
-  </tr>
-  <tr valign="top"> 
-    <td><b><font size="2">odbc_oracle</font></b></td>
-    <td><font size="2">C</font></td>
-    <td><font size="2">Uses ODBC to connect to Oracle</font></td>
-    <td><font size="2">Y/N</font></td>
-    <td><font size="2">ODBC</font></td>
-    <td><font size="2">Unix and Windows. </font></td>
-  </tr>
-  <tr valign="top"> 
-    <td height="34"><b><font size="2">oracle</font></b></td>
-    <td height="34"><font size="2">C</font></td>
-    <td height="34"><font size="2">Implements old Oracle 7 client API. Use oci8 
-      driver if possible for better performance.</font></td>
-    <td height="34"><font size="2">Y/N</font></td>
-    <td height="34"><font size="2">Oracle client</font></td>
-    <td height="34"><font size="2">Unix and Windows</font></td>
-  </tr>
-  <tr valign="top"> 
-    <td><b><font size="2">postgres</font></b></td>
-    <td><font size="2">A</font></td>
-    <td><font size="2">Generic PostgreSQL driver. Currently identical to postgres7 
-      driver. </font></td>
-    <td><font size="2">Y</font></td>
-    <td><font size="2">PostgreSQL client</font></td>
-    <td><font size="2">Unix and Windows. </font></td>
-  </tr>
-  <tr valign="top"> 
-    <td><b><font size="2">postgres64</font></b></td>
-    <td><font size="2">A</font></td>
-    <td><font size="2">For PostgreSQL 6.4 and earlier which does not support LIMIT 
-      internally.</font></td>
-    <td><font size="2">Y</font></td>
-    <td><font size="2">PostgreSQL client</font></td>
-    <td><font size="2">Unix and Windows. </font></td>
-  </tr>
-  <tr valign="top"> 
-    <td><b><font size="2">postgres7</font></b></td>
-    <td><font size="2">A</font></td>
-    <td><font size="2">PostgreSQL which supports LIMIT and other version 7 functionality.</font></td>
-    <td><font size="2">Y</font></td>
-    <td><font size="2">PostgreSQL client</font></td>
-    <td><font size="2">Unix and Windows. </font></td>
-  </tr>
-  <tr valign="top"> 
-    <td><b><font size="2">sapdb</font></b></td>
-    <td><font size="2">C</font></td>
-    <td><font size="2">SAP DB. Should work reliably as based on ODBC driver.</font></td>
-    <td><font size="2">Y/N</font></td>
-    <td><font size="2">SAP ODBC client</font></td>
-    <td> <p><font size="2">?</font></p></td>
-  </tr>
-  <tr valign="top"> 
-    <td><b><font size="2">sqlanywhere</font></b></td>
-    <td><font size="2">C</font></td>
-    <td><font size="2">Sybase SQL Anywhere. Should work reliably as based on ODBC 
-      driver.</font></td>
-    <td><font size="2">Y/N</font></td>
-    <td><font size="2">SQL Anywhere ODBC client</font></td>
-    <td> <p><font size="2">?</font></p></td>
-  </tr>
-  <tr valign="top"> 
-    <td height="54"><b><font size="2">sqlite</font></b></td>
-    <td height="54"><font size="2">B</font></td>
-    <td height="54"><font size="2">SQLite. Only tested on PHP5.</font></td>
-    <td height="54"><font size="2">Y</font></td>
-    <td height="54"><font size="2">-</font></td>
-    <td height="54"> <p><font size="2">Unix and Windows.</font></p></td>
-  </tr>
-  <tr valign="top"> 
-    <td><b><font size="2">sybase</font></b></td>
-    <td><font size="2">C</font></td>
-    <td><font size="2">Sybase. </font></td>
-    <td><font size="2">Y/N</font></td>
-    <td><font size="2">Sybase client</font></td>
-    <td> <p><font size="2">Unix and Windows.</font></p></td>
-  </tr>
-  <p> 
-</table>
-
-<p>The &quot;Tested&quot; column indicates how extensively the code has been tested 
-  and used. <br>
-  A = well tested and used by many people<br>
-  B = tested and usable, but some features might not be implemented<br>
-  C = user contributed or experimental driver. Might not fully support all of 
-  the latest features of ADOdb. </p>
-<p>The column &quot;RecordCount() usable&quot; indicates whether RecordCount() 
-  return the number of rows, or returns -1 when a SELECT statement is executed. 
-  If this column displays Y/N then the RecordCount() is emulated when the global 
-  variable $ADODB_COUNTRECS=true (this is the default). Note that for large recordsets, 
-  it might be better to disable RecordCount() emulation because substantial amounts 
-  of memory are required to cache the recordset for counting. Also there is a 
-  speed penalty of 40-50% if emulation is required. This is emulated in most databases 
-  except for PostgreSQL and MySQL. This variable is checked every time a query 
-  is executed, so you can selectively choose which recordsets to count.</p>
-<p> 
-<hr>
-<h1>Tutorials<a name="quickstart"></a></h1>
-<h3>Example 1: Select Statement<a name="ex1"></a></h3>
-<p>Task: Connect to the Access Northwind DSN, display the first 2 columns of each 
-  row.</p>
-<p>In this example, we create a ADOConnection object, which represents the connection 
-  to the database. The connection is initiated with <a href="#pconnect"><font face="Courier New, Courier, mono">PConnect</font></a>, 
-  which is a persistent connection. Whenever we want to query the database, we 
-  call the <font face="Courier New, Courier, mono">ADOConnection.<a href="#execute">Execute</a>()</font> 
-  function. This returns an ADORecordSet object which is actually a cursor that 
-  holds the current row in the array <font face="Courier New, Courier, mono">fields[]</font>. 
-  We use <font face="Courier New, Courier, mono"><a href="#movenext">MoveNext</a>()</font> 
-  to move from row to row.</p>
-<p>NB: A useful function that is not used in this example is <font face="Courier New, Courier, mono"><a href="#selectlimit">SelectLimit</a></font>, 
-  which allows us to limit the number of rows shown. 
-<pre>
-&lt;?
-<font face="Courier New, Courier, mono"><b>include</b>('adodb.inc.php');          # load code common to ADOdb
-$<font color="#660000">conn</font> = &amp;ADONewConnection('access');  # create a connection
-$<font color="#660000">conn</font>->PConnect('northwind');   # connect to MS-Access, northwind DSN
-$<font color="#660000">recordSet</font> = &amp;$<font color="#660000">conn</font>->Execute('select * from products');
-if (!$<font color="#660000">recordSet</font>) 
-       print $<font color="#660000">conn</font>-&gt;ErrorMsg();
-else
-<b>while</b> (!$<font color="#660000">recordSet</font>-&gt;EOF) &#123;
-       <b>print</b> $<font color="#660000">recordSet</font>->fields[0].' '.$<font color="#660000">recordSet</font>->fields[1].'&lt;BR&gt;';
-       $<font color="#660000">recordSet</font>-&gt;MoveNext();
-&#125;</font><font face="Courier New, Courier, mono">
-
-$<font color="#660000">recordSet</font>->Close(); # optional
-$<font color="#660000">conn</font>->Close(); # optional
-</font>
-?>
-</pre>
-<p>The $<font face="Courier New, Courier, mono">recordSet</font> returned stores 
-  the current row in the <font face="Courier New, Courier, mono">$recordSet-&gt;fields</font> 
-  array, indexed by column number (starting from zero). We use the <font face="Courier New, Courier, mono"><a href="#movenext">MoveNext</a>()</font> 
-  function to move to the next row. The <font face="Courier New, Courier, mono">EOF</font> 
-  property is set to true when end-of-file is reached. If an error occurs in Execute(), 
-  we return false instead of a recordset.</p>
-<p>The <code>$recordSet-&gt;fields[]</code> array is generated by the PHP database 
-  extension. Some database extensions only index by number and do not index the 
-  array by field name. To force indexing by name - that is associative arrays 
-  - use the SetFetchMode function. Each recordset saves and uses whatever fetch 
-  mode was set when the recordset was created in Execute() or SelectLimit(). 
-<pre>
-       $db->SetFetchMode(ADODB_FETCH_NUM);
-       $rs1 = $db->Execute('select * from table');
-       $db->SetFetchMode(ADODB_FETCH_ASSOC);
-       $rs2 = $db->Execute('select * from table');
-       print_r($rs1->fields); # shows <i>array([0]=>'v0',[1] =>'v1')</i>
-       print_r($rs2->fields); # shows <i>array(['col1']=>'v0',['col2'] =>'v1')</i>
-</pre>
-<p> </p>
-<p>To get the number of rows in the select statement, you can use <font face="Courier New, Courier, mono">$recordSet-&gt;<a href="#recordcount">RecordCount</a>()</font>. 
-  Note that it can return -1 if the number of rows returned cannot be determined.</p>
-<h3>Example 2: Advanced Select with Field Objects<a name="ex2"></a></h3>
-<p>Select a table, display the first two columns. If the second column is a date 
-  or timestamp, reformat the date to US format.</p>
-<pre>
-&lt;?
-<font face="Courier New, Courier, mono"><b>include</b>('adodb.inc.php');          # load code common to ADOdb
-$<font color="#660000">conn</font> = &amp;ADONewConnection('access');  # create a connection
-$<font color="#660000">conn</font>->PConnect('northwind');   # connect to MS-Access, northwind dsn
-$<font color="#660000">recordSet</font> = &amp;$<font color="#660000">conn</font>->Execute('select CustomerID,OrderDate from Orders');
-if (!$<font color="#660000">recordSet</font>) 
-       print $<font color="#660000">conn</font>-&gt;ErrorMsg();
-else
-<b>while</b> (!$<font color="#660000">recordSet</font>-&gt;EOF) &#123;
-       $<font color="#660000">fld</font> = <font color="#336600"><b>$</b><font color="#660000">recordSet</font><b>-&gt;FetchField</b></font><font color="#006600">(</font>1<font color="#006600">);</font>
-       $<font color="#660000">type</font> = <font color="#336600"><b>$</b><font color="#660000">recordSet</font><b>-&gt;MetaType</b></font>($fld-&gt;type);
-
-       <b>if</b> ( $<font color="#660000">type</font> == 'D' || $<font color="#660000">type</font> == 'T') 
-               <b>print</b> $<font color="#660000">recordSet</font>-&gt;fields[0].' '.
-                       <b><font color="#336600">$</font></b><font color="#660000">recordSet</font><b><font color="#336600">-&gt;UserDate</font></b>($<font color="#660000">recordSet</font>-&gt;fields[1],'<b>m/d/Y</b>').'&lt;BR&gt;';
-       <b>else </b>
-               <b>print</b> $<font color="#660000">recordSet</font>->fields[0].' '.$<font color="#660000">recordSet</font>->fields[1].'&lt;BR&gt;';
-
-       $<font color="#660000">recordSet</font>-&gt;MoveNext();
-&#125;</font><font face="Courier New, Courier, mono">
-$<font color="#660000">recordSet</font>->Close(); # optional
-$<font color="#660000">conn</font>->Close(); # optional
-</font>
-?>
-</pre>
-<p>In this example, we check the field type of the second column using <font face="Courier New, Courier, mono"><a href="#fetchfield">FetchField</a>().</font> 
-  This returns an object with at least 3 fields.</p>
-<ul>
-  <li><b>name</b>: name of column</li>
-  <li> <b>type</b>: native field type of column</li>
-  <li> <b>max_length</b>: maximum length of field. Some databases such as MySQL 
-    do not return the maximum length of the field correctly. In these cases max_length 
-    will be set to -1.</li>
-</ul>
-<p>We then use <font face="Courier New, Courier, mono"><a href="#metatype">MetaType</a>()</font> 
-  to translate the native type to a <i>generic</i> type. Currently the following 
-  <i>generic</i> types are defined:</p>
-<ul>
-  <li><b>C</b>: character fields that should be shown in a &lt;input type=&quot;text&quot;&gt; 
-    tag.</li>
-  <li><b>X</b>: TeXt, large text fields that should be shown in a &lt;textarea&gt;</li>
-  <li><b>B</b>: Blobs, or Binary Large Objects. Typically images. 
-  <li><b>D</b>: Date field</li>
-  <li><b>T</b>: Timestamp field</li>
-  <li><b>L</b>: Logical field (boolean or bit-field)</li>
-  <li><b>I</b>:&nbsp; Integer field</li>
-  <li><b>N</b>: Numeric field. Includes autoincrement, numeric, floating point, 
-    real and integer. </li>
-  <li><b>R</b>: Serial field. Includes serial, autoincrement integers. This works 
-    for selected databases. </li>
-</ul>
-<p>If the metatype is of type date or timestamp, then we print it using the user 
-  defined date format with <font face="Courier New, Courier, mono"><a href="#userdate">UserDate</a>(),</font> 
-  which converts the PHP SQL date string format to a user defined one. Another 
-  use for <font face="Courier New, Courier, mono"><a href="#metatype">MetaType</a>()</font> 
-  is data validation before doing an SQL insert or update.</p>
-<h3>Example 3: Inserting<a name="ex3"></a></h3>
-<p>Insert a row to the Orders table containing dates and strings that need to 
-  be quoted before they can be accepted by the database, eg: the single-quote 
-  in the word <i>John's</i>.</p>
-<pre>
-&lt;?
-<b>include</b>('adodb.inc.php');          # load code common to ADOdb
-$<font color="#660000">conn</font> = &amp;ADONewConnection('access');  # create a connection
-
-$<font color="#660000">conn</font>->PConnect('northwind');   # connect to MS-Access, northwind dsn
-$<font color="#660000">shipto</font> = <font color="#006600"><b>$conn-&gt;qstr</b></font>(&quot;<i>John's Old Shoppe</i>&quot;);
-
-$<font color="#660000">sql</font> = &quot;insert into orders (customerID,EmployeeID,OrderDate,ShipName) &quot;;
-$<font color="#660000">sql</font> .= &quot;values ('ANATR',2,&quot;.<b><font color="#006600">$conn-&gt;DBDate(</font>time()<font color="#006600">)</font></b><font color="#006600">.</font>&quot;,$<font color="#660000">shipto</font>)&quot;;
-
-<b>if</b> ($<font color="#660000">conn</font>->Execute($<font color="#660000">sql</font>) <font color="#336600"><b>=== false</b></font>) &#123;
-       <b>print</b> 'error inserting: '.<font color="#336600"><b>$conn-&gt;ErrorMsg()</b></font>.'&lt;BR&gt;';
-&#125;
-?>
-</pre>
-<p>In this example, we see the advanced date and quote handling facilities of 
-  ADOdb. The unix timestamp (which is a long integer) is appropriately formated 
-  for Access with <font face="Courier New, Courier, mono"><a href="#dbdate">DBDate</a>()</font>, 
-  and the right escape character is used for quoting the <i>John's Old Shoppe</i>, 
-  which is<b> </b><i>John'<b>'</b>s Old Shoppe</i> and not PHP's default <i>John<b>'</b>s 
-  Old Shoppe</i> with <font face="Courier New, Courier, mono"><a href="#qstr">qstr</a>()</font>. 
-</p>
-<p>Observe the error-handling of the Execute statement. False is returned by<font face="Courier New, Courier, mono"> 
-  <a href="#execute">Execute</a>() </font>if an error occured. The error message 
-  for the last error that occurred is displayed in <font face="Courier New, Courier, mono"><a href="#errormsg">ErrorMsg</a>()</font>. 
-  Note: <i>php_track_errors</i> might have to be enabled for error messages to 
-  be saved.</p>
-<h3> Example 4: Debugging<a name="ex4"></a></h3>
-<pre>&lt;?
-<b>include</b>('adodb.inc.php');          # load code common to ADOdb
-$<font color="#663300">conn</font> = &amp;ADONewConnection('access');  # create a connection
-$<font color="#663300">conn</font>->PConnect('northwind');   # connect to MS-Access, northwind dsn
-<font color="#000000">$<font color="#663300">shipto</font> = <b>$conn-&gt;qstr</b>(&quot;John's Old Shoppe&quot;);
-$<font color="#663300">sql</font> = &quot;insert into orders (customerID,EmployeeID,OrderDate,ShipName) &quot;;
-$<font color="#663300">sql</font> .= &quot;values ('ANATR',2,&quot;.$<font color="#663300">conn</font>-&gt;FormatDate(time()).&quot;,$shipto)&quot;;
-<b><font color="#336600">$<font color="#663300">conn</font>-&gt;debug = true;</font></b>
-<b>if</b> ($<font color="#663300">conn</font>->Execute($sql) <b>=== false</b>) <b>print</b> 'error inserting';</font>
-?&gt;
-</pre>
-<p>In the above example, we have turned on debugging by setting <b>debug = true</b>. 
-  This will display the SQL statement before execution, and also show any error 
-  messages. There is no need to call <font face="Courier New, Courier, mono"><a href="#errormsg">ErrorMsg</a>()</font> 
-  in this case. For displaying the recordset, see the <font face="Courier New, Courier, mono"><a href="#exrs2html">rs2html</a>() 
-  </font>example.</p>
-<p>Also see the section on <a href=#errorhandling>Custom Error Handlers</a>.</p>
-<h3>Example 5: MySQL and Menus<a name="ex5"></a></h3>
-<p>Connect to MySQL database <i>agora</i>, and generate a &lt;select&gt; menu 
-  from an SQL statement where the &lt;option&gt; captions are in the 1st column, 
-  and the value to send back to the server is in the 2nd column.</p>
-<pre>&lt;?
-<b>include</b>('adodb.inc.php'); # load code common to ADOdb
-$<font color="#663300">conn</font> = &amp;ADONewConnection('mysql');  # create a connection
-$<font color="#663300">conn</font>->PConnect('localhost','userid','','agora');# connect to MySQL, agora db
-<font color="#000000">$<font color="#663300">sql</font> = 'select CustomerName, CustomerID from customers';
-$<font color="#663300">rs</font> = $<font color="#663300">conn</font>->Execute($sql);
-<b>print</b> <b><font color="#336600">$<font color="#663300">rs</font>-&gt;GetMenu('GetCust','Mary Rosli');
-?&gt;</font></b></font></pre>
-<p>Here we define a menu named GetCust, with the menu option 'Mary Rosli' selected. 
-  See <a href="#getmenu"><font face="Courier New, Courier, mono">GetMenu</font></a><font face="Courier New, Courier, mono">()</font>. 
-  We also have functions that return the recordset as an array: <font face="Courier New, Courier, mono"><a href="#getarray">GetArray</a>()</font>, 
-  and as an associative array with the key being the first column: <a href="#getassoc1">GetAssoc</a>().</p>
-<h3>Example 6: Connecting to 2 Databases At Once<a name="ex6"></a></h3>
-<pre>&lt;?
-<b>include</b>('adodb.inc.php');        # load code common to ADOdb
-$<font color="#663300">conn1</font> = &amp;ADONewConnection('mysql');  # create a mysql connection
-$<font color="#663300">conn2</font> = &amp;ADONewConnection('oracle');  # create a oracle connection
-
-$conn1-&gt;PConnect($server, $userid, $password, $database);
-$conn2-&gt;PConnect(false, $ora_userid, $ora_pwd, $oraname);
-
-$conn1-&gt;Execute('insert ...');
-$conn2-&gt;Execute('update ...');
-?&gt;</pre>
-<p> 
-<h3>Example 7: Generating Update and Insert SQL<a name="ex7"></a></h3>
-ADOdb 1.31 and later supports two new recordset functions: GetUpdateSQL( ) and 
-GetInsertSQL( ). This allow you to perform a "SELECT * FROM table query WHERE...", 
-make a copy of the $rs->fields, modify the fields, and then generate the SQL to 
-update or insert into the table automatically. 
-<p> We show how the functions can be used when accessing a table with the following 
-  fields: (ID, FirstName, LastName, Created). 
-<p> Before these functions can be called, you need to initialize the recordset 
-  by performing a select on the table. Idea and code by Jonathan Younger jyounger#unilab.com. 
-<p> 
-<pre>&lt;?
-#==============================================
-# SAMPLE GetUpdateSQL() and GetInsertSQL() code
-#==============================================
-include('adodb.inc.php');
-include('tohtml.inc.php');
-
-#==========================
-# This code tests an insert
-
-$sql = "SELECT * FROM ADOXYZ WHERE id = -1"; 
-# Select an empty record from the database
-
-$conn = &ADONewConnection("mysql");  # create a connection
-$conn->debug=1;
-$conn->PConnect("localhost", "admin", "", "test"); # connect to MySQL, testdb
-$rs = $conn->Execute($sql); # Execute the query and get the empty recordset
-
-$record = array(); # Initialize an array to hold the record data to insert
-
-# Set the values for the fields in the record
-# Note that field names are case-insensitive
-$record["firstname"] = "Bob";
-$record["lastNamE"] = "Smith";
-$record["creaTed"] = time();
-
-# Pass the empty recordset and the array containing the data to insert
-# into the GetInsertSQL function. The function will process the data and return
-# a fully formatted insert sql statement.
-$insertSQL = $conn->GetInsertSQL($rs, $record);
-
-$conn->Execute($insertSQL); # Insert the record into the database
-
-#==========================
-# This code tests an update
-
-$sql = "SELECT * FROM ADOXYZ WHERE id = 1"; 
-# Select a record to update
-
-$rs = $conn->Execute($sql); # Execute the query and get the existing record to update
-
-$record = array(); # Initialize an array to hold the record data to update
-
-# Set the values for the fields in the record
-# Note that field names are case-insensitive
-$record["firstname"] = "Caroline";
-$record["LasTnAme"] = "Smith"; # Update Caroline's lastname from Miranda to Smith
-
-# Pass the single record recordset and the array containing the data to update
-# into the GetUpdateSQL function. The function will process the data and return
-# a fully formatted update sql statement with the correct WHERE clause.
-# If the data has not changed, no recordset is returned
-$updateSQL = $conn->GetUpdateSQL($rs, $record);
-
-$conn->Execute($updateSQL); # Update the record in the database
-$conn->Close();
-?>
-</pre>
-<h3>Example 8: Implementing Scrolling with Next and Previous<a name="ex8"></a></h3>
-<p> The following code creates a very simple recordset pager, where you can scroll 
-  from page to page of a recordset.</p>
-<pre>
-include_once('../adodb.inc.php');
-include_once('../adodb-pager.inc.php');
-session_start();
-
-$db = NewADOConnection('mysql');
-
-$db->Connect('localhost','root','','xphplens');
-
-$sql = "select * from adoxyz ";
-
-$pager = new ADODB_Pager($db,$sql);
-$pager->Render($rows_per_page=5);</pre>
-<p>This will create a basic record pager that looks like this: <a name="scr"></a> 
-<p> 
-<table border=1 bgcolor=beige>
-  <tr> 
-    <td> <a href="#scr"><code>|&lt;</code></a> &nbsp; <a href="#scr"><code>&lt;&lt;</code></a> 
-      &nbsp; <a href="#scr"><code>>></code></a> &nbsp; <a href="#scr"><code>>|</code></a> 
-      &nbsp; </td>
-  </tr>
-  <tr>
-    <td><TABLE COLS=4 width=100% border=1 bgcolor=white>
-        <TH>ID</TH>
-        <TH>First Name</TH>
-        <TH>Last Name</TH>
-        <TH>Date Created</TH>
-        <TR> 
-          <TD align=right>36&nbsp;</TD>
-          <TD>Alan&nbsp;</TD>
-          <TD>Turing&nbsp;</TD>
-          <TD>Sat 06, Oct 2001&nbsp;</TD>
-        </TR>
-        <TR> 
-          <TD align=right>37&nbsp;</TD>
-          <TD>Serena&nbsp;</TD>
-          <TD>Williams&nbsp;</TD>
-          <TD>Sat 06, Oct 2001&nbsp;</TD>
-        </TR>
-        <TR> 
-          <TD align=right>38&nbsp;</TD>
-          <TD>Yat Sun&nbsp;</TD>
-          <TD>Sun&nbsp;</TD>
-          <TD>Sat 06, Oct 2001&nbsp;</TD>
-        </TR>
-        <TR> 
-          <TD align=right>39&nbsp;</TD>
-          <TD>Wai Hun&nbsp;</TD>
-          <TD>See&nbsp;</TD>
-          <TD>Sat 06, Oct 2001&nbsp;</TD>
-        </TR>
-        <TR> 
-          <TD align=right>40&nbsp;</TD>
-          <TD>Steven&nbsp;</TD>
-          <TD>Oey&nbsp;</TD>
-          <TD>Sat 06, Oct 2001&nbsp;</TD>
-        </TR>
-      </TABLE></td>
-  </tr>
-  <tr>
-    <td><font size=-1>Page 8/10</font></td>
-  </tr>
-</table>
-<p>The number of rows to display at one time is controled by the Render($rows) 
-  method. If you do not pass any value to Render(), ADODB_Pager will default to 
-  10 records per page. 
-<p>You can control the column titles by modifying your SQL (supported by most 
-  databases): 
-<pre>$sql = 'select id as &quot;ID&quot;, firstname as &quot;First Name&quot;, 
-                 lastname as &quot;Last Name&quot;, created as &quot;Date Created&quot; <br>           from adoxyz';</pre>
-<p>The above code can be found in the <i>adodb/tests/testpaging.php</i> example 
-  included with this release, and the class ADODB_Pager in <i>adodb/adodb-pager.inc.php</i>. 
-  The ADODB_Pager code can be adapted by a programmer so that the text links can 
-  be replaced by images, and the dull white background be replaced with more interesting 
-  colors. 
-<p>You can also allow display of html by setting $pager->htmlSpecialChars = false. 
-<p>Some of the code used here was contributed by Iv&aacute;n Oliva and Cornel 
-  G. </p>
-<h3><a name="ex9"></a>Example 9: Exporting in CSV or Tab-Delimited Format</h3>
-<p>We provide some helper functions to export in comma-separated-value (CSV) and 
-  tab-delimited formats:</p>
-<pre><b>include_once('/path/to/adodb/toexport.inc.php');</b><br>include_once('/path/to/adodb/adodb.inc.php');<br>
-$db = &amp;NewADOConnection('mysql');<br>$db-&gt;Connect($server, $userid, $password, $database);<br><br>$rs = $db-&gt;Execute('select fname as &quot;First Name&quot;, surname as &quot;Surname&quot; from table');
-
-print &quot;&lt;pre&gt;&quot;;<br>print <b>rs2csv</b>($rs); # return a string, CSV format<p>print '&lt;hr&gt;';
-<br>$rs-&gt;MoveFirst(); # note, some databases do not support MoveFirst<br>print <b>rs2tab</b>($rs,<i>false</i>); # return a string, tab-delimited
-                                                # false == suppress field names in first line</p>print '&lt;hr&gt;';<br>$rs-&gt;MoveFirst();<br><b>rs2tabout</b>($rs); # send to stdout directly (there is also an rs2csvout function)
-print &quot;&lt;/pre&gt;&quot;;
-
-$rs-&gt;MoveFirst();<br><b></b>$fp = fopen($path, &quot;w&quot;);
-if ($fp) {<br>  <b>rs2csvfile</b>($rs, $fp); # write to file (there is also an rs2tabfile function)
-  fclose($fp);<br>}
-</pre>
-<p> Carriage-returns or newlines are converted to spaces. Field names are returned 
-  in the first line of text. Strings containing the delimiter character are quoted 
-  with double-quotes. Double-quotes are double-quoted again. This conforms to 
-  Excel import and export guide-lines. 
-<p>All the above functions take as an optional last parameter, $addtitles which 
-  defaults to <i>true</i>. When set to <i>false</i> field names in the first line 
-  are suppressed. <br>
-<h3>Example 10: Recordset Filters<a name="ex10"></a></h3>
-<p>Sometimes we want to pre-process all rows in a recordset before we use it. 
-  For example, we want to ucwords all text in recordset. 
-<pre>
-include_once('adodb/rsfilter.inc.php');
-include_once('adodb/adodb.inc.php');
-
-// ucwords() every element in the recordset
-function do_ucwords(&$arr,$rs)
-&#123;
-       foreach($arr as $k => $v) &#123;
-               $arr[$k] = ucwords($v);
-       &#125;
-&#125;
-
-$db = NewADOConnection('mysql');
-$db->PConnect('server','user','pwd','db');
-
-$rs = $db->Execute('select ... from table');
-$rs = <b>RSFilter</b>($rs,'do_ucwords');
-</pre>
-<p>The <i>RSFilter</i> function takes 2 parameters, the recordset, and the name 
-  of the <i>filter</i> function. It returns the processed recordset scrolled to 
-  the first record. The <i>filter</i> function takes two parameters, the current 
-  row as an array, and the recordset object. For future compatibility, you should 
-  not use the original recordset object. </p>
-<h3>Example 11:<a name="ex11"></a> Smart Transactions</h3>
-The old way of doing transactions required you to use 
-<pre>
-$conn-><b>BeginTrans</b>();
-$ok = $conn->Execute($sql);
-if ($ok) $ok = $conn->Execute($sql2);
-if (!$ok) $conn-><b>RollbackTrans</b>();
-else $conn-><b>CommitTrans</b>();
-</pre>
-This is very complicated for large projects because you have to track the error 
-status. Smart Transactions is much simpler. You start a smart transaction by calling 
-StartTrans(): 
-<pre>
-$conn-><b>StartTrans</b>();
-$conn->Execute($sql);
-$conn->Execute($Sql2);
-$conn-><b>CompleteTrans</b>();
-</pre>
-CompleteTrans() detects when an SQL error occurs, and will Rollback/Commit as 
-appropriate. To specificly force a rollback even if no error occured, use FailTrans(). 
-Note that the rollback is done in CompleteTrans(), and not in FailTrans(). 
-<pre>
-$conn-><b>StartTrans</b>();
-$conn->Execute($sql);
-if (!CheckRecords()) $conn-><strong>FailTrans</strong>();
-$conn->Execute($Sql2);
-$conn-><b>CompleteTrans</b>();
-</pre>
-<p>You can also check if a transaction has failed, using HasFailedTrans(), which 
-  returns true if FailTrans() was called, or there was an error in the SQL execution. 
-  Make sure you call HasFailedTrans() before you call CompleteTrans(), as it is 
-  only works between StartTrans/CompleteTrans.
-<p>Lastly, StartTrans/CompleteTrans is nestable, and only the outermost block 
-  is executed. In contrast, BeginTrans/CommitTrans/RollbackTrans is NOT nestable. 
-<pre>
-$conn-><strong>StartTrans</strong>();
-$conn->Execute($sql);
-  $conn-><strong>StartTrans</strong>();    <font color="#006600"># ignored</font>
-  if (!CheckRecords()) $conn->FailTrans();
-  $conn-><strong>CompleteTrans</strong>(); <font color="#006600"># ignored</font>
-$conn->Execute($Sql2);
-$conn-><strong>CompleteTrans</strong>();
-</pre>
-<p>Note: Savepoints are currently not supported. 
-<h2><a name="errorhandling"></a>Using Custom Error Handlers and PEAR_Error</h2>
-Apart from the old $con->debug = true; way of debugging, ADOdb 1.50 onwards provides 
-another way of handling errors using ADOdb's custom error handlers. 
-<p> ADOdb provides two custom handlers which you can modify for your needs. The 
-  first one is in the <b>adodb-errorhandler.inc.php</b> file. This makes use of 
-  the standard PHP functions <a href=http://php.net/error_reporting>error_reporting</a> 
-  to control what error messages types to display, and <a href=http://php.net/trigger_error>trigger_error</a> 
-  which invokes the default PHP error handler. 
-<p> Including the above file will cause <i>trigger_error($errorstring,E_USER_ERROR)</i> 
-  to be called when<br>
-  (a) Connect() or PConnect() fails, or <br>
-  (b) a function that executes SQL statements such as Execute() or SelectLimit() 
-  has an error.<br>
-  (c) GenID() appears to go into an infinite loop. 
-<p> The $errorstring is generated by ADOdb and will contain useful debugging information 
-  similar to the error.log data generated below. This file adodb-errorhandler.inc.php 
-  should be included before you create any ADOConnection objects. 
-<p> If you define error_reporting(0), no errors will be passed to the error handler. 
-  If you set error_reporting(E_ALL), all errors will be passed to the error handler. 
-  You still need to use <b>ini_set("display_errors", "0" or "1")</b> to control 
-  the display of errors. 
-<pre>
-&lt;?php
-<b>error_reporting(E_ALL); # pass any error messages triggered to error handler
-include('adodb-errorhandler.inc.php');</b>
-include('adodb.inc.php');
-include('tohtml.inc.php');
-$c = NewADOConnection('mysql');
-$c->PConnect('localhost','root','','northwind');
-$rs=$c->Execute('select * from productsz'); #invalid table productsz');
-if ($rs) rs2html($rs);
-?>
-</pre>
-<p> If you want to log the error message, you can do so by defining the following 
-  optional constants ADODB_ERROR_LOG_TYPE and ADODB_ERROR_LOG_DEST. ADODB_ERROR_LOG_TYPE 
-  is the error log message type (see <a href=http://php.net/error_log>error_log</a> 
-  in the PHP manual). In this case we set it to 3, which means log to the file 
-  defined by the constant ADODB_ERROR_LOG_DEST. 
-<pre>
-&lt;?php
-<b>error_reporting(E_ALL); # report all errors
-ini_set("display_errors", "0"); # but do not echo the errors
-define('ADODB_ERROR_LOG_TYPE',3);
-define('ADODB_ERROR_LOG_DEST','C:/errors.log');
-include('adodb-errorhandler.inc.php');</b>
-include('adodb.inc.php');
-include('tohtml.inc.php');
-
-$c = NewADOConnection('mysql');
-$c->PConnect('localhost','root','','northwind');
-$rs=$c->Execute('select * from productsz'); ## invalid table productsz
-if ($rs) rs2html($rs);
-?>
-</pre>
-The following message will be logged in the error.log file: 
-<pre>
-(2001-10-28 14:20:38) mysql error: [1146: Table 'northwind.productsz' doesn't exist] in
- EXECUTE("select * from productsz")
-</pre>
-The second error handler is <b>adodb-errorpear.inc.php</b>. This will create a 
-PEAR_Error derived object whenever an error occurs. The last PEAR_Error object 
-created can be retrieved using ADODB_Pear_Error(). 
-<pre>
-&lt;?php
-<b>include('adodb-errorpear.inc.php');</b>
-include('adodb.inc.php');
-include('tohtml.inc.php');
-$c = NewADOConnection('mysql');
-$c->PConnect('localhost','root','','northwind');
-$rs=$c->Execute('select * from productsz'); #invalid table productsz');
-if ($rs) rs2html($rs);
-else &#123;
-       <b>$e = ADODB_Pear_Error();
-       echo '&lt;p>',$e->message,'&lt;/p>';</b>
-&#125;
-?>
-</pre>
-<p> You can use a PEAR_Error derived class by defining the constant ADODB_PEAR_ERROR_CLASS 
-  before the adodb-errorpear.inc.php file is included. For easy debugging, you 
-  can set the default error handler in the beginning of the PHP script to PEAR_ERROR_DIE, 
-  which will cause an error message to be printed, then halt script execution: 
-<pre>
-include('PEAR.php');
-PEAR::setErrorHandling('PEAR_ERROR_DIE');
-</pre>
-<p> Note that we do not explicitly return a PEAR_Error object to you when an error 
-  occurs. We return false instead. You have to call ADODB_Pear_Error() to get 
-  the last error or use the PEAR_ERROR_DIE technique. 
-<h4>Error Messages</h4>
-<p>Error messages are outputted using the static method ADOConnnection::outp($msg,$newline=true). 
-  By default, it sends the messages to the client. You can override this to perform 
-  error-logging. 
-<h2><a name="dsn"></a> Data Source Names</h2>
-<p>We now support connecting using PEAR style DSN's. A DSN is a connection string 
-  of the form:</p>
-<p>$dsn = <i>&quot;$driver://$username:$password@$hostname/$databasename&quot;</i>;</p>
-<p>You pass the DSN to the static class function DB::Connect. An example:</p>
-<pre>   include_once('../adodb/adodb-pear.inc.php');
-   $username = 'root';
-   $password = '';
-   $hostname = 'localhost';
-   $databasename = 'xphplens';
-   $driver = 'mysql';
-   $dsn = &quot;$driver://$username:$password@$hostname/$databasename&quot;;</pre>
-<pre>   $db = DB::Connect($dsn);<br>   $rs = $db-&gt;Execute('select firstname,lastname from adoxyz');
-   $cnt = 0;
-   while ($arr = $rs-&gt;FetchRow()) {
-               print_r($arr); print &quot;&lt;br&gt;&quot;;
-   }</pre>
-<p>This requires PEAR to be installed and in the default include path in php.ini.</p>
-<h2><a name="caching"></a>Caching of Recordsets</h2>
-<p>ADOdb now supports caching of recordsets using the CacheExecute( ), CachePageExecute( 
-  ) and CacheSelectLimit( ) functions. There are similar to the non-cache functions, 
-  except that they take a new first parameter, $secs2cache. 
-<p> An example: 
-<pre>
-<b>include</b>('adodb.inc.php'); # load code common to ADOdb
-$ADODB_CACHE_DIR = '/usr/ADODB_cache';
-$<font color="#663300">conn</font> = &amp;ADONewConnection('mysql');  # create a connection
-$<font color="#663300">conn</font>->PConnect('localhost','userid','','agora');# connect to MySQL, agora db
-<font color="#000000">$<font color="#663300">sql</font> = 'select CustomerName, CustomerID from customers';
-$<font color="#663300">rs</font> = $<font color="#663300">conn</font>->CacheExecute(15,$sql);</font></pre>
-<p><font color="#000000"> The first parameter is the number of seconds to cache 
-  the query. Subsequent calls to that query will used the cached version stored 
-  in $ADODB_CACHE_DIR. To force a query to execute and flush the cache, call CacheExecute() 
-  with the first parameter set to zero. Alternatively, use the CacheFlush($sql) 
-  call. </font></p>
-<p><font color="#000000">For the sake of security, we recommend you set <i>register_globals=off</i> 
-  in php.ini if you are using $ADODB_CACHE_DIR.</font></p>
-<p>In ADOdb 1.80 onwards, the secs2cache parameter is optional in CacheSelectLimit() 
-  and CacheExecute(). If you leave it out, it will use the $connection->cacheSecs 
-  parameter, which defaults to 60 minutes. 
-<pre>
-       $conn->Connect(...);
-       $conn->cacheSecs = 3600*24; # cache 24 hours
-       $rs = $conn->CacheExecute('select * from table');
-</pre>
-<p>Please note that magic_quotes_runtime should be turned off. <a href=http://phplens.com/lens/lensforum/msgs.php?LeNs#LensBM_forummsg>More 
-  info</a>. <font color="#000000"> 
-<h2><a name="pivot"></a>Pivot Tables</h2>
-</font> <p><font color="#000000">Since ADOdb 2.30, we support the generation of 
-SQL to create pivot tables, also known as cross-tabulations. For further explanation 
-read this DevShed <a href=http://www.devshed.com/Server_Side/MySQL/MySQLWiz/>Cross-Tabulation 
-tutorial. We assume that your database supports the SQL case-when expression. </font></p> 
-<font color="#000000"> 
-<p>In this example, we will use the Northwind database from Microsoft. In the 
-  database, we have a products table, and we want to analyze this table by <i>suppliers 
-  versus product categories</i>. We will place the suppliers on each row, and 
-  pivot on categories. So from the table on the left, we generate the pivot-table 
-  on the right:</p>
-</font> 
-<table border="0" cellspacing="2" cellpadding="2" align="center">
-  <tr>
-       <td>
-         <table border="1" cellspacing="2" cellpadding="2" align="center" width="142">
-               <tr> 
-                 <td><i>Supplier</i></td>
-                 <td><i>Category</i></td>
-               </tr>
-               <tr> 
-                 <td>supplier1</td>
-                 <td>category1</td>
-               </tr>
-               <tr> 
-                 <td>supplier2</td>
-                                       <td>category1</td>
-               </tr>
-               <tr> 
-                                       <td>supplier2</td>
-                 <td>category2</td>
-               </tr>
-         </table>
-       </td>
-       <td> <font face="Courier New, Courier, mono">--&gt;</font></td>
-       <td>
-         <table border="1" cellspacing="2" cellpadding="2" align="center">
-               <tr> 
-                 <td>&nbsp;</td>
-                 <td><i>category1</i></td>
-                 <td><i>category2</i></td>
-                 <td><i>total</i></td>
-               </tr>
-               <tr> 
-                 <td><i>supplier1</i></td>
-                 <td align="right">1</td>
-                 <td align="right">0</td>
-                 <td align="right">1</td>
-               </tr>
-               <tr> 
-                 <td><i>supplier2</i></td>
-                 <td align="right">1</td>
-                 <td align="right">1</td>
-                 <td align="right">2</td>
-               </tr>
-         </table>
-       </td>
-  </tr>
-</table>
-<font color="#000000"> 
-<p>The following code will generate the SQL for a cross-tabulation: 
-<pre>
-# Query the main "product" table
-# Set the rows to CompanyName
-# and the columns to the values of Categories
-# and define the joins to link to lookup tables 
-# "categories" and "suppliers"
-#
- include &quot;adodb/pivottable.php&quot;;
- $sql = PivotTableSQL(
-       $gDB,                                      # adodb connection
-       'products p ,categories c ,suppliers s',   # tables
-       'CompanyName',                             # rows (multiple fields allowed)
-       'CategoryName',                            # column to pivot on 
-       'p.CategoryID = c.CategoryID and s.SupplierID= p.SupplierID' # joins/where
-);
-</pre>
-</font> 
-<p><font color="#000000"> This will generate the following SQL:</font></p>
-<p><code><font size="2">SELECT CompanyName, <br>
-  SUM(CASE WHEN CategoryName='Beverages' THEN 1 ELSE 0 END) AS &quot;Beverages&quot;, 
-  <br>
-  SUM(CASE WHEN CategoryName='Condiments' THEN 1 ELSE 0 END) AS &quot;Condiments&quot;, 
-  <br>
-  SUM(CASE WHEN CategoryName='Confections' THEN 1 ELSE 0 END) AS &quot;Confections&quot;, 
-  <br>
-  SUM(CASE WHEN CategoryName='Dairy Products' THEN 1 ELSE 0 END) AS &quot;Dairy 
-  Products&quot;, <br>
-  SUM(CASE WHEN CategoryName='Grains/Cereals' THEN 1 ELSE 0 END) AS &quot;Grains/Cereals&quot;, 
-  <br>
-  SUM(CASE WHEN CategoryName='Meat/Poultry' THEN 1 ELSE 0 END) AS &quot;Meat/Poultry&quot;, 
-  <br>
-  SUM(CASE WHEN CategoryName='Produce' THEN 1 ELSE 0 END) AS &quot;Produce&quot;, 
-  <br>
-  SUM(CASE WHEN CategoryName='Seafood' THEN 1 ELSE 0 END) AS &quot;Seafood&quot;, 
-  <br>
-  SUM(1) as Total <br>
-  FROM products p ,categories c ,suppliers s WHERE p.CategoryID = c.CategoryID 
-  and s.SupplierID= p.SupplierID <br>
-  GROUP BY CompanyName</font></code></p>
-<p> You can also pivot on <i>numerical columns</i> and <i>generate totals</i> 
-       by using ranges. <font color="#000000">This code was revised in ADODB 2.41 
-       and is not backward compatible.</font> The second example shows this:</p>
-<pre>
- $sql = PivotTableSQL(
-       $gDB,                                       # adodb connection
-       'products p ,categories c ,suppliers s',    # tables
-       'CompanyName',                              #<font color="#000000"> rows (multiple fields allowed)</font>
-   array(                                       # column ranges
-       ' 0 '      => 'UnitsInStock <= 0',
-       "1 to 5"   => '0 < UnitsInStock and UnitsInStock <= 5',
-       "6 to 10"  => '5 < UnitsInStock and UnitsInStock <= 10',
-       "11 to 15" => '10 < UnitsInStock and UnitsInStock <= 15',
-       "16+"      => '15 < UnitsInStock'
-       ),
-       ' p.CategoryID = c.CategoryID and s.SupplierID= p.SupplierID', # joins/where
-       'UnitsInStock',                             # sum this field
-       'Sum '                                      # sum label prefix
-);
-</pre> 
-<p>Which generates: </p>
-<p> <code> <font size="2">SELECT CompanyName, <br>
-       SUM(CASE WHEN UnitsInStock &lt;= 0 THEN UnitsInStock ELSE 0 END) AS &quot;Sum 
-       0 &quot;, <br>
-       SUM(CASE WHEN 0 &lt; UnitsInStock and UnitsInStock &lt;= 5 THEN UnitsInStock 
-       ELSE 0 END) AS &quot;Sum 1 to 5&quot;,<br>
-       SUM(CASE WHEN 5 &lt; UnitsInStock and UnitsInStock &lt;= 10 THEN UnitsInStock 
-       ELSE 0 END) AS &quot;Sum 6 to 10&quot;,<br>
-       SUM(CASE WHEN 10 &lt; UnitsInStock and UnitsInStock &lt;= 15 THEN UnitsInStock 
-       ELSE 0 END) AS &quot;Sum 11 to 15&quot;, <br>
-       SUM(CASE WHEN 15 &lt; UnitsInStock THEN UnitsInStock ELSE 0 END) AS &quot;Sum 
-       16+&quot;, <br>
-       SUM(UnitsInStock) AS "Sum UnitsInStock", <br>
-       SUM(1) as Total,<br>
-       FROM products p ,categories c ,suppliers s WHERE p.CategoryID = c.CategoryID 
-       and s.SupplierID= p.SupplierID <br>
-       GROUP BY CompanyName</font></code><font size="2"><br>
-       </font> </p>
-<font color="#000000"><hr>
-<h1>Class Reference<a name="ref"></a></h1>
-<p>Function parameters with [ ] around them are optional.</p>
-</font> 
-<h2>Global Variables</h2>
-<h3><font color="#000000"><a name="adodb_countrecs"></a></font>$ADODB_COUNTRECS</h3>
-<p>If the database driver API does not support counting the number of records 
-       returned in a SELECT statement, the function RecordCount() is emulated when 
-       the global variable $ADODB_COUNTRECS is set to true, which is the default. 
-       We emulate this by buffering the records, which can take up large amounts 
-       of memory for big recordsets. Set this variable to false for the best performance. 
-       This variable is checked every time a query is executed, so you can selectively 
-       choose which recordsets to count.</p>
-<h3><font color="#000000"><a name="adodb_cache_dir"></a>$ADODB_CACHE_DIR</font></h3>
-<font color="#000000"> 
-<p>If you are using recordset caching, this is the directory to save your recordsets 
-  in. Define this before you call any caching functions such as CacheExecute( 
-  ). We recommend setting <i>register_globals=off</i> in php.ini if you use this 
-  feature for security reasons.</p>
-<p>If you are using Unix and apache, you might need to set your cache directory 
-  permissions to something similar to the following:</p>
-</font> 
-<p>chown -R apache /path/to/adodb/cache<br>
-  chgrp -R apache /path/to/adodb/cache </p>
-<font color="#000000">
-<h3><a name="adodb_ansi_padding_off"></a>$ADODB_ANSI_PADDING_OFF</h3>
-<p>Determines whether to right trim CHAR fields (and also VARCHAR for ibase/firebird).
-Set to true to trim. Default is false. Currently works for oci8po, ibase and firebird 
-drivers. Added in ADOdb 4.01.
-<h3><font color="#000000"><a name="adodb_lang"></a></font>$ADODB_LANG</h3>
-<p>Determines the language used in MetaErrorMsg(). The default is 'en', for English. 
-To find out what languages are supported, see the files 
-in adodb/lang/adodb-$lang.inc.php, where $lang is the supported langauge.
-<h3><a name="adodb_fetch_mode"></a>$ADODB_FETCH_MODE</h3>
-<p>This is a global variable that determines how arrays are retrieved by recordsets. 
-  The recordset saves this value on creation (eg. in Execute( ) or SelectLimit( 
-  )), and any subsequent changes to $ADODB_FETCH_MODE have no affect on existing 
-  recordsets, only on recordsets created in the future.</p>
-<p>The following constants are defined:</p>
-</font> 
-<p><font color="#000000">define('ADODB_FETCH_DEFAULT',0);<br>
-  define('ADODB_FETCH_NUM',1);<br>
-  define('ADODB_FETCH_ASSOC',2);<br>
-  define('ADODB_FETCH_BOTH',3); </font></p>
-<font color="#000000"> 
-<p> An example: 
-<pre>
-       $ADODB_<b>FETCH_MODE</b> = ADODB_FETCH_NUM;
-       $rs1 = $db->Execute('select * from table');
-       $ADODB_<b>FETCH_MODE</b> = ADODB_FETCH_ASSOC;
-       $rs2 = $db->Execute('select * from table');
-       print_r($rs1->fields); # shows <i>array([0]=>'v0',[1] =>'v1')</i>
-       print_r($rs2->fields); # shows <i>array(['col1']=>'v0',['col2'] =>'v1')</i>
-</pre>
-<p> As you can see in the above example, both recordsets store and use different 
-       fetch modes based on the $ADODB_FETCH_MODE setting when the recordset was 
-       created by Execute().</p>
-<p>If no fetch mode is predefined, the fetch mode defaults to ADODB_FETCH_DEFAULT. 
-       The behaviour of this default mode varies from driver to driver, so do not 
-       rely on ADODB_FETCH_DEFAULT. For portability, we recommend sticking to ADODB_FETCH_NUM 
-       or ADODB_FETCH_ASSOC. Many drivers do not support ADODB_FETCH_BOTH.</p>
-<p><strong>SetFetchMode Function</strong></p>
-<p>Some programmers prefer to use a more object-oriented solution, where the fetch 
-       mode is set by a object function, <a href="#setfetchmode">SetFetchMode</a>. 
-       Once this function is called for a connection object, that connection object 
-       will ignore the global variable $ADODB_FETCH_MODE and will use the internal 
-       fetchMode property exclusively.</p>
-<pre>
-       $db->SetFetchMode(ADODB_FETCH_NUM);
-       $rs1 = $db->Execute('select * from table');
-       $db->SetFetchMode(ADODB_FETCH_ASSOC);
-       $rs2 = $db->Execute('select * from table');
-       print_r($rs1->fields); # shows <i>array([0]=>'v0',[1] =>'v1')</i>
-       print_r($rs2->fields); # shows <i>array(['col1']=>'v0',['col2'] =>'v1')</i></pre>
-<p>To retrieve the previous fetch mode, you can use check the $db-&gt;fetchMode 
-       property, or use the return value of SetFetchMode( ). 
-<p><strong><a name="adodb_assoc_case"></a>ADODB_ASSOC_CASE</strong></p>
-<p>You can control the associative fetch case for certain drivers which behave 
-       differently. For the sybase, oci8po, mssql, odbc and ibase drivers and all 
-       drivers derived from them, ADODB_ASSOC_CASE will by default generate recordsets 
-       where the field name keys are lower-cased. Use the constant ADODB_ASSOC_CASE 
-       to change the case of the keys. There are 3 possible values:</p>
-<p>0 = assoc lowercase field names. $rs-&gt;fields['orderid']<br>
-       1 = assoc uppercase field names. $rs-&gt;fields['ORDERID']<br>
-       2 = use native-case field names. $rs-&gt;fields['OrderID'] -- this is the 
-       default since ADOdb 2.90</p>
-<p>To use it, declare it before you incldue adodb.inc.php.</p>
-<p>define('ADODB_ASSOC_CASE', 2); # use native-case for ADODB_FETCH_ASSOC<br>
-       include('adodb.inc.php'); </p>
-<hr>
-<h2>ADOConnection<a name="adoconnection"></a></h2>
-<p>Object that performs the connection to the database, executes SQL statements 
-       and has a set of utility functions for standardising the format of SQL statements 
-       for issues such as concatenation and date formats.</p>
-<h3>ADOConnection Fields</h3>
-<p><b>databaseType</b>: Name of the database system we are connecting to. Eg. 
-       <b>odbc</b> or <b>mssql</b> or <b>mysql</b>.</p>
-<p><b>dataProvider</b>: The underlying mechanism used to connect to the database. 
-       Normally set to <b>native</b>, unless using <b>odbc</b> or <b>ado</b>.</p>
-<p><b>host: </b>Name of server or data source name (DSN) to connect to.</p>
-<p><b>database</b>: Name of the database or to connect to. If ado is used, it 
-       will hold the ado data provider.</p>
-<p><b>user</b>: Login id to connect to database. Password is not saved for security 
-       reasons.</p>
-<p><b>raiseErrorFn</b>: Allows you to define an error handling function. See adodb-errorhandler.inc.php 
-       for an example.</p>
-<p><b>debug</b>: Set to <i>true</i> to make debug statements to appear.</p>
-<p><b>concat_operator</b>: Set to '+' or '||' normally. The operator used to concatenate 
-       strings in SQL. Used by the <b><a href="#concat">Concat</a></b> function.</p>
-<p><b>fmtDate</b>: The format used by the <b><a href="#dbdate">DBDate</a></b> 
-       function to send dates to the database. is '#Y-m-d#' for Microsoft Access, 
-       and ''Y-m-d'' for MySQL.</p>
-<p><b>fmtTimeStamp: </b>The format used by the <b><a href="#dbtimestamp">DBTimeStamp</a></b> 
-       function to send timestamps to the database. </p>
-<p><b>true</b>: The value used to represent true.Eg. '.T.'. for Foxpro, '1' for 
-       Microsoft SQL.</p>
-<p><b>false: </b> The value used to represent false. Eg. '.F.'. for Foxpro, '0' 
-       for Microsoft SQL.</p>
-<p><b>replaceQuote</b>: The string used to escape quotes. Eg. double single-quotes 
-       for Microsoft SQL, and backslash-quote for MySQL. Used by <a href="#qstr">qstr</a>.</p>
-<p><b>autoCommit</b>: indicates whether automatic commit is enabled. Default is 
-       true.</p>
-<p><b>charSet</b>: set the default charset to use. Currently only interbase supports 
-       this.</p>
-<p><b>dialect</b>: set the default sql dialect to use. Currently only interbase 
-       supports this.</p>
-<p><b>metaTablesSQL</b>: SQL statement to return a list of available tables. Eg. 
-       <i>SHOW TABLES</i> in MySQL.</p>
-<p><b>genID</b>: The latest id generated by GenID() if supported by the database.</p>
-<p><b>cacheSecs</b>: The number of seconds to cache recordsets if CacheExecute() 
-       or CacheSelectLimit() omit the $secs2cache parameter. Defaults to 60 minutes.</p>
-<p><b>sysDate</b>: String that holds the name of the database function to call 
-       to get the current date. Useful for inserts and updates.</p>
-<p><b>sysTimeStamp</b>: String that holds the name of the database function to 
-       call to get the current timestamp/datetime value.</p>
-<p><b>leftOuter</b>: String that holds operator for left outer join, if known. 
-       Otherwise set to false.</p>
-<p><b>rightOuter</b>: String that holds operator for left outer join, if known. 
-       Otherwise set to false.</p>
-<p><b>ansiOuter</b>: Boolean that if true indicates that ANSI style outer joins 
-       are permitted. Eg. <i>select * from table1 left join table2 on p1=p2.</i></p>
-<p><b>connectSID</b>: Boolean that indicates whether to treat the $database parameter 
-       in connects as the SID for the oci8 driver. Defaults to false. Useful for 
-       Oracle 8.0.5 and earlier.</p>
-<p><b>autoRollback</b>: Persistent connections are auto-rollbacked in PConnect( 
-       ) if this is set to true. Default is false.</p>
-<hr>
-<h3>ADOConnection Main Functions</h3>
-<p><b>ADOConnection( )</b></p>
-<p>Constructor function. Do not call this directly. Use ADONewConnection( ) instead.</p>
-<p><b>Connect<a name="connect"></a>($host,[$user],[$password],[$database])</b></p>
-<p>Non-persistent connect to data source or server $<b>host</b>, using userid 
-       $<b>user </b>and password $<b>password</b>. If the server supports multiple 
-       databases, connect to database $<b>database</b>. </p>
-<p>Returns true/false depending on connection.</p>
-<p>ADO Note: If you are using a Microsoft ADO and not OLEDB, you can set the $database 
-       parameter to the OLEDB data provider you are using.</p>
-<p>PostgreSQL: An alternative way of connecting to the database is to pass the 
-       standard PostgreSQL connection string in the first parameter $host, and the 
-       other parameters will be ignored.</p>
-<p>For Oracle and Oci8, there are two ways to connect. First is to use the TNS 
-       name defined in your local tnsnames.ora (or ONAMES or HOSTNAMES). Place the 
-       name in the $database field, and set the $host field to false. Alternatively, 
-       set $host to the server, and $database to the database SID, this bypassed 
-       tnsnames.ora. 
-<p>Examples: 
-<pre> # $oraname in tnsnames.ora/ONAMES/HOSTNAMES
- $conn->Connect(false, 'scott', 'tiger', $oraname); 
- $conn->Connect('server:1521', 'scott', 'tiger', 'ServiceName'); # bypass tnsnames.ora</pre>
-<p>There are many examples of connecting to a database at <a href="http://php.weblogs.com/adodb">php.weblogs.com/ADOdb</a>, 
-       and in the testdatabases.inc.php file included in the release.</p>
-<p><b>PConnect<a name="pconnect"></a>($host,[$user],[$password],[$database])</b></p>
-<p>Persistent connect to data source or server $<b>host</b>, using userid $<b>user</b> 
-       and password $<b>password</b>. If the server supports multiple databases, 
-       connect to database $<b>database</b>.</p>
-<p>We now perform a rollback on persistent connection for selected databases since 
-       2.21, as advised in the PHP manual. See change log or source code for which 
-       databases are affected. 
-<p>Returns true/false depending on connection. See Connect( ) above for more info.</p>
-<p>Since ADOdb 2.21, we also support autoRollback. If you set:</p>
-</font> 
-<pre> $conn = &amp;NewADOConnection('mysql');
- $conn-&gt;autoRollback = true; # default is false
- $conn-&gt;PConnect(...); # rollback here</pre>
-<p> Then when doing a persistent connection with PConnect( ), ADOdb will 
-  perform a rollback first. This is because it is documented that PHP is 
-  not guaranteed to rollback existing failed transactions when 
-  persistent connections are used. This is implemented in Oracle, 
-  MySQL, PgSQL, MSSQL, ODBC currently. 
-<p>Since ADOdb 3.11, you can force non-persistent 
-connections even if PConnect is called by defining the constant 
-ADODB_NEVER_PERSIST  before you call PConnect.
-<p><b>NConnect<a name="nconnect"></a>($host,[$user],[$password],[$database])</b></p>
-<p>Always force a new connection. In contrast, PHP sometimes reuses connections 
-       when you use Connect() or PConnect(). Currently works only on mysql (PHP 4.3.0 
-       or later), postgresql and oci8-derived drivers. For other drivers, NConnect() works like 
-       Connect(). 
-<font color="#000000"> 
-<p><b>Execute<a name="execute"></a>($sql,$inputarr=false)</b></p>
-<p>Execute SQL statement $<b>sql</b> and return derived class of ADORecordSet 
-       if successful. Note that a record set is always returned on success, even 
-       if we are executing an insert or update statement. You can also pass in $sql a statement prepared 
-       in <a href=#prepare>Prepare()</a>.</p>
-<p>Returns derived class of ADORecordSet. Eg. if connecting via mysql, then ADORecordSet_mysql 
-       would be returned. False is returned if there was an error in executing the 
-       sql.</p>
-<p>The $inputarr parameter can be used for binding variables to parameters. Below 
-       is an Oracle example:</p>
-<pre>
- $conn->Execute("SELECT * FROM TABLE WHERE COND=:val", array('val'=> $val));
- </pre>
-<p>Another example, using ODBC,which uses the ? convention:</p>
-<pre>
-  $conn->Execute("SELECT * FROM TABLE WHERE COND=?", array($val));
-</pre>
-<a name="binding"></a>
-<i>Binding variables</i><p>
-Variable binding speeds the compilation and caching of SQL statements, leading 
-to higher performance. Currently Oracle, Interbase and ODBC supports variable binding. 
-Interbase/ODBC style ? binding is emulated in databases that do not support binding. 
-Note that you do not have to quote strings if you use binding.
-<p> Variable binding in the odbc, interbase and oci8po drivers. 
-<pre>
-$rs = $db->Execute('select * from table where val=?', array('10'));
-</pre>
-Variable binding in the oci8 driver: 
-<pre>
-$rs = $db->Execute('select name from table where val=:key', 
-  array('key' => 10));
-</pre>
-<a name="bulkbind"></a>
-<i>Bulk binding</i>
-<p>Since ADOdb 3.80, we support bulk binding in Execute(), in which you pass in a 2-dimensional array to
-be bound to an INSERT/UPDATE or DELETE statement.
-<pre>
-$arr = array(
-       array('Ahmad',32),
-       array('Zulkifli', 24),
-       array('Rosnah', 21)
-       );
-$ok = $db->Execute('insert into table (name,age) values (?,?)',$arr);
-</pre>
-<p>This provides very high performance as the SQL statement is prepared first. 
-The prepared statement is executed repeatedly for each array row until all rows are completed, 
-or until the first error. Very useful for importing data.
-
-<p><b>CacheExecute<a name="cacheexecute"></a>([$secs2cache,]$sql,$inputarr=false)</b></p>
-<p>Similar to Execute, except that the recordset is cached for $secs2cache seconds 
-       in the $ADODB_CACHE_DIR directory, and $inputarr only accepts 1-dimensional arrays. 
-       If CacheExecute() is called again with the same $sql, $inputarr, 
-       and also the same database, same userid, and the cached recordset 
-       has not expired, the cached recordset is returned. 
-<pre>
-  include('adodb.inc.php'); 
-  include('tohtml.inc.php');
-  $ADODB_<b>CACHE_DIR</b> = '/usr/local/ADOdbcache';
-  $conn = &ADONewConnection('mysql'); 
-  $conn->PConnect('localhost','userid','password','database');
-  $rs = $conn-><b>CacheExecute</b>(15, 'select * from table'); # cache 15 secs
-  rs2html($rs); /* recordset to html table */  
-</pre>
-<p> Alternatively, since ADOdb 1.80, the $secs2cache parameter is optional:</p>
-<pre>  $conn-&gt;Connect(...);
-       $conn-&gt;cacheSecs = 3600*24; // cache 24 hours
-       $rs = $conn-&gt;CacheExecute('select * from table');
-</pre>
-If $secs2cache is omitted, we use the value 
-in $connection-&gt;cacheSecs (default is 3600 seconds, or 1 hour). Use CacheExecute() 
-only with SELECT statements. 
-<p>Performance note: I have done some benchmarks and found that they vary so greatly 
-       that it's better to talk about when caching is of benefit. When your database 
-       server is <i>much slower </i>than your Web server or the database is <i>very 
-       overloaded </i>then ADOdb's caching is good because it reduces the load on 
-       your database server. If your database server is lightly loaded or much faster 
-       than your Web server, then caching could actually reduce performance. </p>
-<p><b>ExecuteCursor<a name="executecursor"></a>($sql,$cursorName='rs',$parameters=false)</b></p>
-<p>Execute an Oracle stored procedure, and returns an Oracle REF cursor variable as 
-       a regular ADOdb recordset. Does not work with any other database except oci8. 
-       Thanks to Robert Tuttle for the design.
-<pre>
-    $db = ADONewConnection("oci8"); 
-    $db->Connect("foo.com:1521", "uid", "pwd", "FOO"); 
-    $rs = $db->ExecuteCursor("begin :cursorvar := getdata(:param1); end;", 
-                                       'cursorvar',
-                                       array('param1'=>10)); 
-    # $rs is now just like any other ADOdb recordset object<br>    rs2html($rs);</pre>
-<p>ExecuteCursor() is a helper function that does the following internally: 
-<pre>
-       $stmt = $db->Prepare("BEGIN :RS := SP_FOO(); END;", true); 
-       $db->Parameter($stmt, $cur, 'RS', false, -1, OCI_B_CURSOR);
-       $rs = $db->Execute($stmt);</pre>
-<p><b>SelectLimit<a name="selectlimit"></a>($sql,$numrows=-1,$offset=-1,$inputarr=false)</b></p>
-<p>Returns a recordset if successful. Returns false otherwise. Performs a select 
-       statement, simulating PostgreSQL's SELECT statement, LIMIT $numrows OFFSET 
-       $offset clause.</p>
-<p>In PostgreSQL, SELECT * FROM TABLE LIMIT 3 will return the first 3 records 
-       only. The equivalent is <code>$connection->SelectLimit('SELECT * FROM TABLE',3)</code>. 
-       This functionality is simulated for databases that do not possess this feature.</p>
-<p>And SELECT * FROM TABLE LIMIT 3 OFFSET 2 will return records 3, 4 and 5 (eg. 
-       after record 2, return 3 rows). The equivalent in ADOdb is <code>$connection->SelectLimit('SELECT 
-       * FROM TABLE',3,2)</code>.</p>
-<p>Note that this is the <i>opposite</i> of MySQL's LIMIT clause. You can also 
-       set <code>$connection->SelectLimit('SELECT * FROM TABLE',-1,10)</code> to 
-       get rows 11 to the last row.</p>
-<p>The last parameter $inputarr is for databases that support variable binding 
-       such as Oracle oci8. This substantially reduces SQL compilation overhead. 
-       Below is an Oracle example:</p>
-<pre>
- $conn->SelectLimit("SELECT * FROM TABLE WHERE COND=:val", 100,-1,array('val'=> $val));
- </pre>
-<p>The oci8po driver (oracle portable driver) uses the more standard bind variable 
-       of ?: 
-<pre>
- $conn->SelectLimit("SELECT * FROM TABLE WHERE COND=?", 100,-1,array('val'=> $val));
-</pre>
-<p> 
-<p>Ron Wilson reports that SelectLimit does not work with UNIONs. 
-<p><b>CacheSelectLimit<a name="cacheselectlimit"></a>([$secs2cache,] $sql, $numrows=-1,$offset=-1,$inputarr=false)</b></p>
-<p>Similar to SelectLimit, except that the recordset returned is cached for $secs2cache 
-       seconds in the $ADODB_CACHE_DIR directory. </p>
-<p>Since 1.80, $secs2cache has been optional, and you can define the caching time 
-       in $connection-&gt;cacheSecs.</p>
-</font> 
-<pre><font color="#000000">    $conn-&gt;Connect(...);
-   $conn-&gt;cacheSecs = 3600*24; // cache 24 hours
-       $rs = $conn-&gt;CacheSelectLimit('select * from table',10);</font></pre>
-<font color="#000000"> 
-<p><b>CacheFlush<a name="cacheflush"></a>($sql=false,$inputarr=false)</b></p>
-<p>Flush (delete) any cached recordsets for the SQL statement $sql in $ADODB_CACHE_DIR. 
-<p>If no parameter is passed in, then all adodb_*.cache files are deleted. 
-<p> If you want to flush all cached recordsets manually, execute the following 
-       PHP code (works only under Unix): <br>
-       <code> &nbsp; system(&quot;rm -f `find &quot;.$ADODB_CACHE_DIR.&quot; -name 
-       adodb_*.cache`&quot;);</code></p>
-<p>For general cleanup of all expired files, you should use <a href="http://www.superscripts.com/tutorial/crontab.html">crontab</a> 
-       on Unix, or at.exe on Windows, and a shell script similar to the following:<font face="Courier New, Courier, mono"><br>
-       #------------------------------------------------------ <br>
-       # This particular example deletes files in the TMPPATH <br>
-       # directory with the string &quot;.cache&quot; in their name that <br>
-       # are more than 7 days old. <br>
-       #------------------------------------------------------ <br>
-       AGED=7 <br>
-       find ${TMPPATH} -mtime +$AGED | grep &quot;\.cache&quot; | xargs rm -f <br>
-       </font> </p>
-<p><b>MetaError<a name="metaerror"></a>($errno=false)</b></p>
-<p>Returns a virtualized error number, based on PEAR DB's error number system. You might
-need to include adodb-error.inc.php before you call this function. The parameter $errno
-is the native error number you want to convert. If you do not pass any parameter, MetaError
-will call ErrorNo() for you and convert it. If the error number cannot be virtualized, MetaError 
-will return -1 (DB_ERROR).</p>
-
-<p><b>MetaErrorMsg<a name="metaerrormsg"></a>($errno)</b></p>
-<p>Pass the error number returned by MetaError() for the equivalent textual error message.</p>
-<p><b>ErrorMsg<a name="errormsg"></a>()</b></p>
-<p>Returns the last status or error message. The error message is reset after every 
-call to Execute(). 
-<p>
-This can return a string even if 
-       no error occurs. In general you do not need to call this function unless an 
-       ADOdb function returns false on an error. </p>
-<p>Note: If <b>debug</b> is enabled, the SQL error message is always displayed 
-       when the <b>Execute</b> function is called.</p>
-<p><b>ErrorNo<a name="errorno"></a>()</b></p>
-<p>Returns the last error number. The error number is reset after every call to Execute(). 
-If 0 is returned, no error occurred.
-<p>
-Note that old versions of PHP (pre 4.0.6) do 
-       not support error number for ODBC. In general you do not need to call this 
-       function unless an ADOdb function returns false on an error.</p>
-</font>
-<p><font color="#000000"><b>SetFetchMode<a name="setfetchmode"></a>($mode)</b></font></p>
-<p><font color="#000000">Sets the current fetch mode for the connection and stores 
-       it in $db-&gt;fetchMode. Legal modes are ADODB_FETCH_ASSOC and ADODB_FETCH_NUM. 
-       For more info, see <a href="#adodb_fetch_mode">$ADODB_FETCH_MODE</a>.</font></p>
-<p><font color="#000000">Returns the previous fetch mode, which could be false 
-       if SetFetchMode( ) has not been called before.</font></p>
-<font color="#000000"> 
-<p><b>CreateSequence<a name="createseq"></a>($seqName = 'adodbseq',$startID=1)</b></p>
-<p>Create a sequence. The next time GenID( ) is called, the value returned will 
-       be $startID. Added in 2.60. 
-<p><b>DropSequenceD<a name="dropseq"></a>($seqName = 'adodbseq')</b></p>
-<p>Delete a sequence. Added in 2.60. 
-<p><b>GenID<a name="genid"></a>($seqName = 'adodbseq',$startID=1)</b></p>
-<p>Generate a sequence number . Works for interbase, 
-       mysql, postgresql, oci8, oci8po, mssql, ODBC based (access,vfp,db2,etc) drivers 
-       currently. Uses $seqName as the name of the sequence. GenID() will automatically 
-       create the sequence for you if it does not exist (provided the userid has 
-       permission to do so). Otherwise you will have to create the sequence yourself. 
-<p> If your database driver emulates sequences, the name of the table is the sequence 
-       name. The table has one column, "id" which should be of type integer, or if 
-       you need something larger - numeric(16). 
-<p> For ODBC and databases that do not support sequences natively (eg mssql, mysql), 
-       we create a table for each sequence. If the sequence has not been defined 
-       earlier, it is created with the starting value set in $startID.</p>
-<p>Note that the mssql driver's GenID() before 1.90 used to generate 16 byte GUID's.</p>
-<p><b>UpdateBlob<a name="updateblob"></a>($table,$column,$val,$where)</b></p>
-Allows you to store a blob (in $val) into $table into $column in a row at $where. 
-<p> Usage: 
-<p> 
-<pre>
-       # for oracle
-       $conn->Execute('INSERT INTO blobtable (id, blobcol) VALUES (1, empty_blob())');
-       $conn->UpdateBlob('blobtable','blobcol',$blobvalue,'id=1');
-       
-       # non oracle databases
-       $conn->Execute('INSERT INTO blobtable (id, blobcol) VALUES (1, null)');
-       $conn->UpdateBlob('blobtable','blobcol',$blobvalue,'id=1');
-</pre>
-<p> Returns true if succesful, false otherwise. Supported by MySQL, PostgreSQL, 
-       Oci8, Oci8po and Interbase drivers. Other drivers might work, depending on 
-       the state of development.</p>
-<p>Note that when an Interbase blob is retrieved using SELECT, it still needs 
-       to be decoded using $connection->DecodeBlob($blob); to derive the original 
-       value in versions of PHP before 4.1.0. 
-<p>For PostgreSQL, you can store your blob using blob oid's or as a bytea field. 
-       You can use bytea fields but not blob oid's currently with UpdateBlob( ). 
-       Conversely UpdateBlobFile( ) supports oid's, but not bytea data.<br>
-       <br>
-       If you do not pass in an oid, then UpdateBlob() assumes that you are storing 
-       in bytea fields.
-<p><b>UpdateClob<a name="updateclob"></a>($table,$column,$val,$where)</b></p>
-Allows you to store a clob (in $val) into $table into $column in a row at $where. 
-Similar to UpdateBlob (see above), but for Character Large OBjects. 
-<p> Usage:
-<pre>
-       # for oracle
-       $conn->Execute('INSERT INTO clobtable (id, clobcol) VALUES (1, empty_clob())');
-       $conn->UpdateBlob('clobtable','clobcol',$clobvalue,'id=1');
-       
-       # non oracle databases
-       $conn->Execute('INSERT INTO clobtable (id, clobcol) VALUES (1, null)');
-       $conn->UpdateBlob('clobtable','clobcol',$clobvalue,'id=1');
-</pre>
-<p><b>UpdateBlobFile<a name="updateblobfile"></a>($table,$column,$path,$where,$blobtype='BLOB')</b></p>
-<p>Similar to UpdateBlob, except that we pass in a file path to where the blob 
-       resides.
-<p>For PostgreSQL, if you are using blob oid's, use this interface. This interface 
-       does not support bytea fields.
-<p>Returns true if successful, false otherwise. 
-<p><b>BlobEncode<a name="blobencode" id="blobencode"></a>($blob)</b> 
-<p>Some databases require blob's to be encoded manually before upload. Note if 
-       you use UpdateBlob( ) or UpdateBlobFile( ) the conversion is done automatically 
-       for you and you do not have to call this function. For PostgreSQL, currently, 
-       BlobEncode() can only be used for bytea fields.
-<p>Returns the encoded blob value.
-<p>Note that there is a connection property called <em>blobEncodeType</em> which 
-       has 3 legal values: 
-<p>false - no need to perform encoding or decoding.<br>
-       'I' - blob encoding required, and returned encoded blob is a numeric value 
-       (no need to quote).<br>
-       'C' - blob encoding required, and returned encoded blob is a character value 
-       (requires quoting).
-<p>This is purely for documentation purposes, so that programs that accept multiple 
-       database drivers know what is the right thing to do when processing blobs.
-<p><strong>BlobDecode<a name="blobdecode"></a>($blob)</strong> 
-</font><p><font color="#000000">Some databases require blob's to be decoded manually after doing a select statement. 
-       If the database does not require decoding, then this function will return 
-       the blob unchanged. Currently BlobDecode is only required for one database, 
-       PostgreSQL, and only if you are using blob oid's (if you are using bytea fields, 
-       we auto-decode for you).</font><font color="#000000">
-<pre>$rs = $db-&gt;Execute(&quot;select bloboid from postgres_table where id=$key&quot;);
-$blob = $db-&gt;BlobDecode( reset($rs-&gt;fields) );</pre>
-<p><b>Replace<a name="replace"></a>($table, $arrFields, $keyCols,$autoQuote=false)</b></p>
-<p>Try to update a record, and if the record is not found, an insert statement 
-       is generated and executed. Returns 0 on failure, 1 if update statement worked, 
-       2 if no record was found and the insert was executed successfully. This differs 
-       from MySQL's replace which deletes the record and inserts a new record. This 
-       also means you cannot update the primary key. The only exception to this is 
-       Interbase and its derivitives, which uses delete and insert because of some 
-       Interbase API limitations. 
-<p>The parameters are $table which is the table name, the $keyCols which is an 
-       associative array where the keys are the field names, and keyCols is the name 
-       of the primary key, or an array of field names if it is a compound key. If 
-       $autoQuote is set to true, then Replace() will quote all values that are non-numeric; 
-       auto-quoting will not quote nulls. Note that auto-quoting will not work if 
-       you use SQL functions or operators. 
-<p>Examples: 
-<pre>
-# single field primary key
-$ret = $db->Replace('atable', 
-       array('id'=>1000,'firstname'=>'Harun','lastname'=>'Al-Rashid'),
-       'id',$autoquote = true);        
-# generates UPDATE atable SET firstname='Harun',lastname='Al-Rashid' WHERE id=1000
-# or INSERT INTO atable (id,firstname,lastname) VALUES (1000,'Harun','Al-Rashid')
-
-# compound key
-$ret = $db->Replace('atable2', 
-       array('firstname'=>'Harun','lastname'=>'Al-Rashid', 'age' => 33, 'birthday' => 'null'),
-       array('lastname','firstname'),
-       $autoquote = true);
-
-# no auto-quoting
-$ret = $db->Replace('atable2', 
-       array('firstname'=>"'Harun'",'lastname'=>"'Al-Rashid'", 'age' => 'null'),
-       array('lastname','firstname')); 
-</pre>
-<p><b>GetUpdateSQL<a name="getupdatesql"></a>(&$rs, $arrFields, $forceUpdate=false,$magicq=false)</b></p>
-<p>Generate SQL to update a table given a recordset $rs, and the modified fields 
-       of the array $arrFields (which must be an associative array holding the column 
-       names and the new values) are compared with the current recordset. If $forceUpdate 
-       is true, then we also generate the SQL even if $arrFields is identical to 
-       $rs-&gt;fields. Requires the recordset to be associative. $magicq is used 
-       to indicate whether magic quotes are enabled (see qstr()). The field names in the array 
-       are case-insensitive.</p>
-       <p>Since 3.61, define('ADODB_FORCE_NULLS',1) and all PHP nulls will be auto-converted to SQL nulls.
-<p><b>GetInsertSQL<a name="getinsertsql"></a>(&$rs, $arrFields,$magicq=false)</b></p>
-<p>Generate SQL to insert into a table given a recordset $rs. Requires the query 
-       to be associative. $magicq is used to indicate whether magic quotes are enabled 
-       (for qstr()). The field names in the array are case-insensitive.</p>
-       
-<p>Since 3.61, define('ADODB_FORCE_NULLS',1) and all PHP nulls will be auto-converted 
-  to SQL nulls. 
-<p><b>PageExecute<a name="pageexecute"></a>($sql, $nrows, $page, $inputarr=false)</b> 
-<p>Used for pagination of recordset. $page is 1-based. See <a href="#ex8">Example 
-  8</a>.</p>
-</font> 
-<p><font color="#000000"><b>CachePageExecute<a name="cachepageexecute"></a>($secs2cache, 
-  $sql, $nrows, $page, $inputarr=false)</b> </font></p>
-<p><font color="#000000">Used for pagination of recordset. $page is 1-based. See 
-  <a href="#ex8">Example 8</a>. Caching version of PageExecute.</font></p>
-<font color="#000000"> 
-<p></p>
-<p><b>Close<a name="close"></a>( )</b></p>
-<p>Close the database connection. PHP4 proudly states that we no longer have to 
-  clean up at the end of the connection because the reference counting mechanism 
-  of PHP4 will automatically clean up for us.</p>
-  <p><b>StartTrans<a name="starttrans"></a>( )</b></p>
-  <p>Start a monitored transaction. As SQL statements are executed, ADOdb will monitor
-  for SQL errors, and if any are detected, when CompleteTrans() is called, we auto-rollback.
-  <p>
-  <p> To understand why StartTrans() is superior to BeginTrans(), 
-  let us examine a few ways of using BeginTrans().
-  The following is the wrong way to use transactions: 
-<pre>
-$DB->BeginTrans();
-$DB->Execute("update table1 set val=$val1 where id=$id");
-$DB->Execute("update table2 set val=$val2 where id=$id");
-$DB->CommitTrans();
-</pre>
-<p>because you perform no error checking. It is possible to update table1 and 
-  for the update on table2 to fail. Here is a better way: 
-<pre>
-$DB->BeginTrans();
-$ok = $DB->Execute("update table1 set val=$val1 where id=$id");
-if ($ok) $ok = $DB->Execute("update table2 set val=$val2 where id=$id");
-if ($ok) $DB->CommitTrans();
-else $DB->RollbackTrans();
-</pre>
-<p>Another way is (since ADOdb 2.0): 
-<pre>
-$DB->BeginTrans();
-$ok = $DB->Execute("update table1 set val=$val1 where id=$id");
-if ($ok) $ok = $DB->Execute("update table2 set val=$val2 where id=$id");
-$DB->CommitTrans($ok);
-</pre>
-<p> Now it is a headache monitoring $ok all over the place. StartTrans() is an
-improvement because it monitors all SQL errors for you. This is particularly
-useful if you are calling black-box functions in which SQL queries might be executed.
- Also all BeginTrans, CommitTrans and RollbackTrans calls inside a StartTrans block 
-  will be disabled, so even if the black box function does a commit, it will be ignored.
-<pre>
-$DB->StartTrans();
-CallBlackBox();
-$DB->Execute("update table1 set val=$val1 where id=$id");
-$DB->Execute("update table2 set val=$val2 where id=$id");
-$DB->CompleteTrans($ok);
-</pre>
-<p>Note that a StartTrans blocks are nestable, the inner blocks are ignored.
- <p><b>CompleteTrans<a name="completetrans"></a>($autoComplete=true)</b></p>
-  <p>Complete a transaction called with StartTrans(). This function monitors
-  for SQL errors, and will commit if no errors have occured, otherwise it will rollback. 
-  Returns true on commit, false on rollback. If the parameter $autoComplete is true
-  monitor sql errors and commit and rollback as appropriate. Set $autoComplete to false 
-  to force rollback even if no SQL error detected.
-  <p><b>FailTrans<a name="failtrans"></a>( )</b></p>
-  <p>Fail a transaction started with StartTrans(). The rollback will only occur when
-  CompleteTrans() is called.
-    <p><b>HasFailedTrans<a name="hasfailedtrans"></a>( )</b></p>
-       <p>Check whether smart transaction has failed, 
-       eg. returns true if there was an error in SQL execution or FailTrans() was called.
-       If not within smart transaction, returns false.
-<p><b>BeginTrans<a name="begintrans"></a>( )</b></p>
-<p>Begin a transaction. Turns off autoCommit. Returns true if successful. Some 
-  databases will always return false if transaction support is not available. 
-   Any open transactions will be rolled back when the connection is closed. Among the
-   databases that support transactions are Oracle, PostgreSQL, Interbase, MSSQL, certain
-    versions of MySQL, DB2, Informix, Sybase, etc.</p>
- <p>Note that <a href=#starttrans>StartTrans()</a> and CompleteTrans() is a superior method of 
- handling transactions, available since ADOdb 3.40. For a explanation, see the <a href=#starttrans>StartTrans()</a> documentation.
-
-<p>You can also use the ADOdb <a href=#errorhandling>error handler</a> to die 
-  and rollback your transactions for you transparently. Some buggy database extensions 
-  are known to commit all outstanding tranasactions, so you might want to explicitly 
-  do a $DB->RollbackTrans() in your error handler for safety. 
- <h4>Detecting Transactions</h4>
- <p>Since ADOdb 2.50, you are able to detect when you are inside a transaction. Check
- that $connection->transCnt > 0. This variable is incremented whenever BeginTrans() is called,
- and decremented whenever RollbackTrans() or CommitTrans() is called.
-<p><b>CommitTrans<a name="committrans"></a>($ok=true)</b></p>
-<p>End a transaction successfully. Returns true if successful. If the database 
-  does not support transactions, will return true also as data is always committed. 
-</p>
-<p>If you pass the parameter $ok=false, the data is rolled back. See example in 
-  BeginTrans().</p>
-<p><b>RollbackTrans<a name="rollbacktrans"></a>( )</b></p>
-<p>End a transaction, rollback all changes. Returns true if successful. If the 
-  database does not support transactions, will return false as data is never rollbacked. 
-</p>
-</font><font color="#000000"> 
-<p><b>GetAssoc<a name=getassoc1></a>($sql,$inputarr=false,$force_array=false,$first2cols=false)</b></p>
-<p>Returns an associative array for the given query $sql with optional bind parameters 
-  in $inputarr. If the number of columns returned is greater to two, a 2-dimensional 
-  array is returned, with the first column of the recordset becomes the keys 
-  to the rest of the rows. If the columns is equal to two, a 1-dimensional array 
-  is created, where the the keys directly map to the values (unless $force_array 
-  is set to true, when an array is created for each value).
-<p> <font color="#000000">Examples:<a name=getassocex></a></font></p>
-</font>
-<p><font color="#000000">We have the following data in a recordset:</font></p>
-<p><font color="#000000">row1: Apple, Fruit, Edible<br>
-  row2: Cactus, Plant, Inedible<br>
-  row3: Rose, Flower, Edible</font></p>
-<p><font color="#000000">GetAssoc will generate the following 2-dimensional associative 
-  array:</font></p>
-<p><font color="#000000">Apple =&gt; array[Fruit, Edible]<br>
-  Cactus =&gt; array[Plant, Inedible]<br>
-  Rose =&gt; array[Flower,Edible]</font></p>
-<p><font color="#000000">If the dataset is:</font></p>
-<p><font color="#000000"><font color="#000000"><font color="#000000">row1: Apple, 
-  Fruit<br>
-  row2: Cactus, Plant<br>
-  row3: Rose, Flower</font> </font></font></p>
-<p><font color="#000000"><font color="#000000">GetAssoc will generate the following 
-  1-dimensional associative array (with $force_array==false):</font></font></p>
-<p><font color="#000000">Apple =&gt; Fruit</font><br>
-  Cactus=&gt;Plant<br>
-  Rose=&gt;Flower <font color="#000000"><font color="#000000"> </font></font><font color="#000000"><font color="#000000"></font></font></p>
-<p><font color="#000000">The function returns:</font></p>
-<p><font color="#000000">The associative array, or false if an error occurs.</font></p>
-<font color="#000000">
-<p><b>CacheGetAssoc<a name="cachegetassoc"></a>([$secs2cache,] $sql,$inputarr=false,$force_array=false,$first2cols=false)</b></p>
-</font><font color="#000000"> 
-<p>Caching version of <a href=#getassoc1>GetAssoc</a> function above.
-<p><b>GetOne<a name="getone"></a>($sql,$inputarr=false)</b></p>
-<p>Executes the SQL and returns the first field of the first row. The recordset 
-  and remaining rows are discarded for you automatically. If an error occur, false 
-  is returned.</p>
-<p><b>GetRow<a name="getrow"></a>($sql,$inputarr=false)</b></p>
-<p>Executes the SQL and returns the first row as an array. The recordset and remaining 
-  rows are discarded for you automatically. If an error occurs, false is returned.</p>
-<p><b>GetAll<a name="getall"></a>($sql)</b></p>
-</font>
-<p><font color="#000000">Executes the SQL and returns the all the rows as a 2-dimensional 
-  array. The recordset is discarded for you automatically. If an error occurs, 
-  false is returned.</font></p>
- <p><b>GetCol<a name="getcol"></a>($sql,$inputarr=false,$trim=false)</b></p>
-
-<p><font color="#000000">Executes the SQL and returns all elements of the first column as a 
-1-dimensional array. The recordset is discarded for you automatically. If an error occurs, 
-  false is returned.</font></p>
-<p><font color="#000000"><b>CacheGetOne<a name="cachegetone"></a>([$secs2cache,] 
-  $sql,$inputarr=false), CacheGetRow<a name="cachegetrow"></a>([$secs2cache,] $sql,$inputarr=false), CacheGetAll<a name="cachegetall"></a>([$secs2cache,] 
-  $sql,$inputarr=false), CacheGetCol<a name="cachegetcol"></a>([$secs2cache,] 
-  $sql,$inputarr=false,$trim=false)</b></font></p>
-<font color="#000000"> 
-<p>Similar to above Get* functions, except that the recordset is serialized and 
-  cached in the $ADODB_CACHE_DIR directory for $secs2cache seconds. Good for speeding 
-  up queries on rarely changing data. Note that the $secs2cache parameter is optional. 
-  If omitted, we use the value in $connection-&gt;cacheSecs (default is 3600 seconds, 
-  or 1 hour).</p>
-<p><b>Prepare<a name="prepare"></a>($sql )</b></p>
-</font> 
-<p><font color="#000000">Prepares (compiles) an SQL query for repeated execution. Bind parameters
-are denoted by ?, except for the oci8 driver, which uses the traditional Oracle :varname
-convention. 
-  </font></p>
-<p><font color="#000000">Returns an array containing the original sql statement 
-  in the first array element; the remaining elements of the array are driver dependent. 
-  If there is an error, or we are emulating Prepare( ), we return the original 
-  $sql string. This is because all error-handling has been centralized in Execute( 
-  ).</font></p>
-<p><font color="#000000">Prepare( ) cannot be used with functions that use SQL 
-  query rewriting techniques, e.g. PageExecute( ) and SelectLimit( ).</font></p>
-<p>Example:</p>
-<pre><font color="#000000">$stmt = $DB-&gt;Prepare('insert into table (col1,col2) values (?,?)');
-for ($i=0; $i &lt; $max; $i++)<br></font>      $DB-&gt;<font color="#000000">Execute($stmt,array((string) rand(), $i));
-</font></pre>
-<font color="#000000"> 
-<p>Also see InParameter(), OutParameter() and PrepareSP() below. Only supported internally by interbase, 
-  oci8 and selected ODBC-based drivers, otherwise it is emulated. There is no 
-  performance advantage to using Prepare() with emulation. 
-<p> Important: Due to limitations or bugs in PHP, if you are getting errors when 
-  you using prepared queries, try setting $ADODB_COUNTRECS = false before preparing. 
-  This behaviour has been observed with ODBC. 
-<p><b>IfNull<a name="ifnull"></a>($field, $nullReplacementValue)</b></p>
-<p>Portable IFNULL function (NVL in Oracle). Returns a string that represents 
-  the function that checks whether a $field is null for the given database, and 
-  if null, change the value returned to $nullReplacementValue. Eg.</p>
-<pre>$sql = <font color="#993300">'SELECT '</font>.$db-&gt;IfNull('name', <font color="#993300">&quot;'- unknown -'&quot;</font>).<font color="#993300"> ' FROM table'</font>;</pre>
-
-<p><b>length<a name="length"></a></b></p>
-<p>This is not a function, but a property. Some databases have "length" and others "len"
-as the function to measure the length of a string. To use this property:
-<pre>
-  $sql = <font color="#993300">"SELECT "</font>.$db->length.<font color="#993300">"(field) from table"</font>;
-  $rs = $db->Execute($sql);
-</pre>
-
-<p><b>random<a name="random"></a></b></p>
-<p>This is not a function, but a property. This is a string that holds the sql to
-generate a random number between 0.0 and 1.0 inclusive.
-
-<p><b>substr<a name="substr"></a></b></p>
-<p>This is not a function, but a property. Some databases have "substr" and others "substring"
-as the function to retrieve a sub-string. To use this property:
-<pre>
-  $sql = <font color="#993300">"SELECT "</font>.$db->substr.<font color="#993300">"(field, $offset, $length) from table"</font>;
-  $rs = $db->Execute($sql);
-</pre>
-<p>For all databases, the 1st parameter of <i>substr</i> is the field, the 2nd is the
-offset (1-based) to the beginning of the sub-string, and the 3rd is the length of the sub-string.
-
-
-<p><b>Param<a name="param"></a>($name )</b></p>
-<p>Generates a bind placeholder portably. For most databases, the bind placeholder 
-  is "?". However some databases use named bind parameters such as Oracle, eg 
-  ":somevar". This allows us to portably define an SQL statement with bind parameters: 
-<pre><font color="#000000">$sql = <font color="#993300">'insert into table (col1,col2) values ('</font>.$DB-&gt;Param('a').<font color="#993300">','</font>.$DB-&gt;Param('b').<font color="#993300">')'</font>;
-<font color="#006600"># generates 'insert into table (col1,col2) values (?,?)'
-# or        'insert into table (col1,col2) values (:a,:b)</font>'
-$stmt = $DB-&gt;Prepare($sql);
-$stmt = $DB-&gt;Execute($stmt,array('one','two'));
-</font></pre>
-<font color="#000000"> 
-<p></p>
-<p><b>PrepareSP</b><b><a name="preparesp"></a></b><b>($sql)</b></p>
-<p>When calling stored procedures in mssql and oci8 (oracle), and you might want 
-  to directly bind to parameters that return values, or for special LOB handling. 
-  PrepareSP() allows you to do so. 
-<p>Returns the same array or $sql string as Prepare( ) above. If you do not need 
-  to bind to return values, you should use Prepare( ) instead.</p>
-<p>For examples of usage of PrepareSP( ), see InParameter( ) below. 
-<p>Note: in the mssql driver, preparing stored procedures requires a special function 
-  call, mssql_init( ), which is called by this function. PrepareSP( ) is available 
-  in all other drivers, and is emulated by calling Prepare( ). </p>
-<p><b> InParameter<a name="inparameter"></a>($stmt, $var, $name,
-  $maxLen = 4000, $type = false )</b></p>
-Binds a PHP variable as input to a stored procedure variable. The parameter <i>$stmt</i>
- is the value returned by PrepareSP(), <i>$var</i> is the PHP variable you want to bind, $name
- is the name of the stored procedure variable. Optional is <i>$maxLen</i>, the maximum length of the
- data to bind, and $type which is database dependant. 
- Consult <a href=http://php.net/mssql_bind>mssql_bind</a> and <a href=http://php.net/ocibindbyname>ocibindbyname</a> docs
-  at php.net for more info on legal values for $type. 
- <p>
-InParameter() is a wrapper function that calls Parameter() with $isOutput=false. 
-The advantage of this function is that it is self-documenting, because
-the $isOutput parameter is no longer needed.  Only for mssql 
-  and oci8 currently.
-  <p>Here is an example using oci8:
-  <pre><font color="green"># For oracle, Prepare and PrepareSP are identical</font>
-$stmt = $db-&gt;PrepareSP(
-       <font color="#993300">&quot;declare RETVAL integer; 
-       begin
-       :RETVAL := </font><font color="#993300">SP_RUNSOMETHING</font><font color="#993300">(:myid,:group);
-       end;&quot;</font>);
-$db-&gt;InParameter($stmt,$id,'myid');
-$db-&gt;InParameter($stmt,$group,'group',64);
-$db-&gt;OutParameter($stmt,$ret,'RETVAL');<br>$db-&gt;Execute($stmt);
-</pre>
-<p> The same example using mssql:</p>
-</font> 
-<pre><font color="#000000"><font color="green"># @RETVAL = SP_RUNSOMETHING @myid,@group</font>
-$stmt = $db-&gt;PrepareSP(<font color="#993333">'<font color="#993300">SP_RUNSOMETHING</font>'</font>); <br><font color="green"># note that the parameter name does not have @ in front!</font>
-$db-&gt;InParameter($stmt,$id,'myid');
-$db-&gt;InParameter($stmt,$group,'group',64);
-<font color="green"># return value in mssql - RETVAL is hard-coded name</font> 
-$db-&gt;OutParameter($stmt,$ret,'RETVAL');
-$db-&gt;Execute($stmt); </font></pre>
-
-<p>Note that the only difference between the oci8 and mssql implementations is $sql.</p>
-  <p>
- If $type parameter is set to false, in mssql, $type will be dynamicly determined 
-based on the type of the PHP variable passed <font face="Courier New, Courier, mono">(string 
-=&gt; SQLCHAR, boolean =&gt;SQLINT1, integer =&gt;SQLINT4 or float/double=&gt;SQLFLT8)</font>.
-<p> 
-In oci8, $type can be set to OCI_B_FILE (Binary-File), OCI_B_CFILE (Character-File), 
-OCI_B_CLOB (Character-LOB), OCI_B_BLOB (Binary-LOB) and OCI_B_ROWID (ROWID). To 
-pass in a null, use<font face="Courier New, Courier, mono"> $db-&gt;Parameter($stmt, 
-$null=null, 'param')</font>. 
-  <p><b> OutParameter<a name="outparameter"></a>($stmt, $var, $name, 
-  $maxLen = 4000, $type = false )</b></p>
-  Binds a PHP variable as output from a stored procedure variable. The parameter <i>$stmt</i>
- is the value returned by PrepareSP(), <i>$var</i> is the PHP variable you want to bind, <i>$name</i>
- is the name of the stored procedure variable. Optional is <i>$maxLen</i>, the maximum length of the
- data to bind, and <i>$type</i> which is database dependant. 
-  <p>
-  OutParameter() is a wrapper function that calls Parameter() with $isOutput=true. 
-  The advantage of this function is that it is self-documenting, because
-the $isOutput parameter is no longer needed.  Only for mssql 
-  and oci8 currently.
-<p>
-For an example, see <a href=#inparameter>InParameter</a>.
-
-<p><b> Parameter<a name="parameter"></a>($stmt, $var, $name, $isOutput=false, 
-  $maxLen = 4000, $type = false )</b></p>
-<p>Note: This function is deprecated, because of the new InParameter() and OutParameter() functions.
-These are superior because they are self-documenting, unlike Parameter().
-<p>Adds a bind parameter suitable for return values or special data handling (eg. 
-  LOBs) after a statement has been prepared using PrepareSP(). Only for mssql 
-  and oci8 currently. The parameters are:<br>
-  <br>
-  $<i><b>stmt</b></i> Statement returned by Prepare() or PrepareSP().<br>
-  $<i><b>var</b></i> PHP variable to bind to. Make sure you pre-initialize it!<br>
-  $<i><b>name</b></i> Name of stored procedure variable name to bind to.<br>
-  [$<i><b>isOutput</b></i>] Indicates direction of parameter 0/false=IN 1=OUT 
-  2= IN/OUT. This is ignored in oci8 as this driver auto-detects the direction.<br>
-  [$<b>maxLen</b>] Maximum length of the parameter variable.<br>
-  [$<b>type</b>] Consult <a href="http://php.net/mssql_bind">mssql_bind</a> and 
-  <a href="http://php.net/ocibindbyname">ocibindbyname</a> docs at php.net for 
-  more info on legal values for type.</p>
-<p>Lastly, in oci8, bind parameters can be reused without calling PrepareSP( ) 
-  or Parameters again. This is not possible with mssql. An oci8 example:</p>
-<pre>$id = 0; $i = 0;
-$stmt = $db-&gt;PrepareSP( <font color="#993300">&quot;update table set val=:i where id=:id&quot;</font>);
-$db-&gt;Parameter($stmt,$id,'id');
-$db-&gt;Parameter($stmt,$i, 'i');
-for ($cnt=0; $cnt &lt; 1000; $cnt++) {
-       $id = $cnt; <br>        $i = $cnt * $cnt; <font color="green"># works with oci8!</font>
-       $db-&gt;Execute($stmt); <br>}</pre>
-<p><b>Bind<a name="bind"></a>($stmt, $var, $size=4001, $type=false, $name=false)</b></p>
-</font> 
-<p><font color="#000000">This is a low-level function supported only by the oci8 
-  driver. <b>Avoid using</b> unless you only want to support Oracle. The Parameter( 
-  ) function is the recommended way to go with bind variables.</font></p>
-<p><font color="#000000">Bind( ) allows you to use bind variables in your sql 
-  statement. This binds a PHP variable to a name defined in an Oracle sql statement 
-  that was previously prepared using Prepare(). Oracle named variables begin with 
-  a colon, and ADOdb requires the named variables be called :0, :1, :2, :3, etc. 
-  The first invocation of Bind() will match :0, the second invocation will match 
-  :1, etc. Binding can provide 100% speedups for insert, select and update statements. 
-  </font></p>
-<p>The other variables, $size sets the buffer size for data storage, $type is 
-  the optional descriptor type OCI_B_FILE (Binary-File), OCI_B_CFILE (Character-File), 
-  OCI_B_CLOB (Character-LOB), OCI_B_BLOB (Binary-LOB) and OCI_B_ROWID (ROWID). 
-  Lastly, instead of using the default :0, :1, etc names, you can define your 
-  own bind-name using $name. 
-<p><font color="#000000">The following example shows 3 bind variables being used: 
-  p1, p2 and p3. These variables are bound to :0, :1 and :2.</font></p>
-<pre>$stmt = $DB-&gt;Prepare(&quot;insert into table (col0, col1, col2) values (:0, :1, :2)&quot;);
-$DB-&gt;Bind($stmt, $p1);
-$DB-&gt;Bind($stmt, $p2);
-$DB-&gt;Bind($stmt, $p3);
-for ($i = 0; $i &lt; $max; $i++) { 
-   $p1 = ?; $p2 = ?; $p3 = ?;
-   $DB-&gt;Execute($stmt);
-}</pre>
-<p>You can also use named variables:</p>
-<pre>
-$stmt = $DB-&gt;Prepare(&quot;insert into table (col0, col1, col2) values (:name0, :name1, :name2)&quot;);
-$DB-&gt;Bind($stmt, $p1, &quot;name0&quot;);
-$DB-&gt;Bind($stmt, $p2, &quot;name1&quot;);
-$DB-&gt;Bind($stmt, $p3, &quot;name2&quot;);
-for ($i = 0; $i &lt; $max; $i++) { 
-   $p1 = ?; $p2 = ?; $p3 = ?;
-   $DB-&gt;Execute($stmt);
-}</pre>
-<p><b>LogSQL($enable=true)<a name=logsql></a></b></p>
-Call this method to install a SQL logging and timing function (using fnExecute). 
-Then all SQL statements are logged into an adodb_logsql table in a database. If 
-the adodb_logsql table does not exist, ADOdb will create the table if you have 
-the appropriate permissions. Returns the previous logging value (true for enabled, 
-false for disabled). Here are samples of the DDL for selected databases: 
-<p> 
-<pre>
-               <b>mysql:</b>
-               CREATE TABLE adodb_logsql (
-                 created datetime NOT NULL,
-                 sql0 varchar(250) NOT NULL,
-                 sql1 text NOT NULL,
-                 params text NOT NULL,
-                 tracer text NOT NULL,
-                 timer decimal(16,6) NOT NULL
-               )
-               
-               <b>postgres:</b>
-               CREATE TABLE adodb_logsql (
-                 created timestamp NOT NULL,
-                 sql0 varchar(250) NOT NULL,
-                 sql1 text NOT NULL,
-                 params text NOT NULL,
-                 tracer text NOT NULL,
-                 timer decimal(16,6) NOT NULL
-               )
-               
-               <b>mssql:</b>
-               CREATE TABLE adodb_logsql (
-                 created datetime NOT NULL,
-                 sql0 varchar(250) NOT NULL,
-                 sql1 varchar(4000) NOT NULL,
-                 params varchar(3000) NOT NULL,
-                 tracer varchar(500) NOT NULL,
-                 timer decimal(16,6) NOT NULL
-               )
-               
-               <b>oci8:</b>
-               CREATE TABLE adodb_logsql (
-                 created date NOT NULL,
-                 sql0 varchar(250) NOT NULL,
-                 sql1 varchar(4000) NOT NULL,
-                 params varchar(4000),
-                 tracer varchar(4000),
-                 timer decimal(16,6) NOT NULL
-               )
-</pre>
-Usage: 
-<pre>
-       $conn->LogSQL(); // turn on logging
-         :
-       $conn->Execute(...);
-         :
-       $conn->LogSQL(false); // turn off logging
-       
-       # output summary of SQL logging results
-       $perf = NewPerfMonitor($conn);
-       echo $perf->SuspiciousSQL();
-       echo $perf->ExpensiveSQL();
-</pre>
-<p>One limitation of logging is that rollback also prevents SQL from being logged.
-<p>
-If you prefer to use another name for the table used to store the SQL, you can override it by calling 
-adodb_perf::table($tablename), where $tablename is the new table name (you will still need to manually
-create the table yourself). An example:
-<pre>
-       include('adodb.inc.php');
-       include('adodb-perf.inc.php');
-       adodb_perf::table('my_logsql_table');
-</pre>
-Also see <a href=docs-perf.htm>Performance Monitor</a>. 
-<p><font color="#000000"><b>fnExecute and fnCacheExecute properties<a name="fnexecute" id="fnexecute"></a></b></font></p>
-<p>These two properties allow you to define bottleneck functions for all sql statements 
-  processed by ADOdb. This allows you to perform statistical analysis and query-rewriting 
-  of your sql. 
-<p><b>Examples of fnExecute</b></p>
-<p>Here is an example of using fnExecute, to count all cached queries and non-cached 
-  queries, you can do this:</p>
-<pre><font color="#006600"># $db is the connection object</font>
-function CountExecs($db, $sql, $inputarray)
-{
-global $EXECS;
-
-if (!is_array(inputarray)) $EXECS++;
-<font color="#006600"># handle 2-dimensional input arrays</font>
-else if (is_array(reset($inputarray))) $EXECS += sizeof($inputarray);
-else $EXECS++;
-}
-
-<font color="#006600"># $db is the connection object</font>
-function CountCachedExecs($db, $secs2cache, $sql, $inputarray)
-{<br>global $CACHED; $CACHED++;
-}
-<br>$db = NewADOConnection('mysql');
-$db-&gt;Connect(...);
-$db-&gt;<strong>fnExecute</strong> = 'CountExecs';
-$db-&gt;<strong>fnCacheExecute</strong> = 'CountCachedExecs';
- :
- :<br><font color="#006600"># After many sql statements:</font>`
-printf(&quot;&lt;p&gt;Total queries=%d; total cached=%d&lt;/p&gt;&quot;,$EXECS+$CACHED, $CACHED);
-</pre>
-<p>The fnExecute function is called before the sql is parsed and executed, so 
-  you can perform a query rewrite. If you are passing in a prepared statement, 
-  then $sql is an array (see <a href="#prepare">Prepare</a>). The fnCacheExecute 
-  function is only called if the recordset returned was cached.<font color="#000000"> 
-  The function parameters match the Execute and CacheExecute functions respectively, 
-  except that $this (the connection object) is passed as the first parameter.</font></p>
-<p>Since ADOdb 3.91, the behaviour of fnExecute varies depending on whether the 
-  defined function returns a value. If it does not return a value, then the $sql 
-  is executed as before. This is useful for query rewriting or counting sql queries. 
-<p> On the other hand, you might want to replace the Execute function with one 
-  of your own design. If this is the case, then have your function return a value. 
-  If a value is returned, that value is returned immediately, without any further 
-  processing. This is used internally by ADOdb to implement LogSQL() functionality. 
-<p> <font color="#000000"> 
-<hr>
-<h3>ADOConnection Utility Functions</h3>
-<p><b>BlankRecordSet<a name="blankrecordset"></a>([$queryid])</b></p>
-<p>No longer available - removed since 1.99.</p>
-<p><b>Concat<a name="concat"></a>($s1,$s2,....)</b></p>
-<p>Generates the sql string used to concatenate $s1, $s2, etc together. Uses the 
-  string in the concat_operator field to generate the concatenation. Override 
-  this function if a concatenation operator is not used, eg. MySQL.</p>
-<p>Returns the concatenated string.</p>
-<p><b>DBDate<a name="dbdate"></a>($date)</b></p>
-<p>Format the $<b>date</b> in the format the database accepts. This is used in 
-  INSERT/UPDATE statements; for SELECT statements, use <a href="#sqldate">SQLDate</a>. 
-  The $<b>date</b> parameter can be a Unix integer timestamp or an ISO format 
-  Y-m-d. Uses the fmtDate field, which holds the format to use. If null or false 
-  or '' is passed in, it will be converted to an SQL null.</p>
-<p>Returns the date as a quoted string.</p>
-<p><b>DBTimeStamp<a name="dbtimestamp"></a>($ts)</b></p>
-<p>Format the timestamp $<b>ts</b> in the format the database accepts; this can 
-  be a Unix integer timestamp or an ISO format Y-m-d H:i:s. Uses the fmtTimeStamp 
-  field, which holds the format to use. If null or false or '' is passed in, it 
-  will be converted to an SQL null.</p>
-<p>Returns the timestamp as a quoted string.</p>
-<p><b>qstr<a name="qstr"></a>($s,[$magic_quotes_enabled</b>=false]<b>)</b></p>
-<p>Quotes a string to be sent to the database. The $<b>magic_quotes_enabled</b> 
-  parameter may look funny, but the idea is if you are quoting a string extracted 
-  from a POST/GET variable, then pass get_magic_quotes_gpc() as the second parameter. 
-  This will ensure that the variable is not quoted twice, once by <i>qstr</i> 
-  and once by the <i>magic_quotes_gpc</i>.</p>
-<p>Eg.<font face="Courier New, Courier, mono"> $s = $db-&gt;qstr(HTTP_GET_VARS['name'],get_magic_quotes_gpc());</font></p>
-<p>Returns the quoted string.</p>
-<p><b>Quote<a name="quote"></a>($s)</b></p>
-<p>Quotes the string $s, escaping the database specific quote character as appropriate. 
-  Formerly checked magic quotes setting, but this was disabled since 3.31 for 
-  compatibility with PEAR DB. 
-<p><b>Affected_Rows<a name="affected_rows"></a>( )</b></p>
-<p>Returns the number of rows affected by a update or delete statement. Returns 
-  false if function not supported.</p>
-<p>Not supported by interbase/firebird currently. </p>
-<p><b>Insert_ID<a name="inserted_id"></a>( )</b></p>
-<p>Returns the last autonumbering ID inserted. Returns false if function not supported. 
-</p>
-<p>Only supported by databases that support auto-increment or object id's, such 
-  as PostgreSQL, MySQL and MS SQL Server currently. PostgreSQL returns the OID, which 
-  can change on a database reload.</p>
-<p><b>RowLock<a name="rowlock"></a>($table,$where)</b></p>
-<p>Lock a table row for the duration of a transaction. For example to lock record $id in table1:
-<pre>
-       $DB->StartTrans();
-       $DB->RowLock("table1","rowid=$id");
-       $DB->Execute($sql1);
-       $DB->Execute($sql2);
-       $DB->CompleteTrans();
-</pre>
-<p>Supported in db2, interbase, informix, mssql, oci8, postgres, sybase.
-<p><b>MetaDatabases<a name="metadatabases"></a>()</b></p>
-<p>Returns a list of databases available on the server as an array. You have to 
-  connect to the server first. Only available for ODBC, MySQL and ADO.</p>
-<p><b>MetaTables<a name="metatables"></a>($ttype = false, $showSchema = false, 
-  $mask=false)</b></p>
-<p>Returns an array of tables and views for the current database as an array. 
-  The array should exclude system catalog tables if possible. To only show tables, 
-  use $db->MetaTables('TABLES'). To show only views, use $db->MetaTables('VIEWS'). 
-  The $showSchema parameter currently works only for DB2, and when set to true, 
-  will add the schema name to the table, eg. "SCHEMA.TABLE". </p>
-<p>You can define a mask for matching. For example, setting $mask = 'TMP%' will 
-  match all tables that begin with 'TMP'. Currently only mssql, oci8, odbc_mssql 
-  and postgres* support $mask. 
-<p><b>MetaColumns<a name="metacolumns"></a>($table,$toupper=true)</b></p>
-<p>Returns an array of ADOFieldObject's, one field object for every column of 
-  $table. A field object is a class instance with (name, type, max_length) defined.
-  Currently Sybase does not recognise date types, and ADO cannot identify 
-  the correct data type (so we default to varchar).   
- <p> The $toupper parameter determines whether we uppercase the table name 
- (required for some databases).
- <p>For schema support, pass in the $table parameter, "$schema.$tablename". This is only
- supported for selected databases.
-<p><b>MetaColumnNames<a name="metacolumnames"></a>($table)</b></p>
-<p>Returns an array of column names for $table. 
-<p><font color="#000000"><b>MetaPrimaryKeys<a name="metaprimarykeys"></a>($table, 
-  $owner=false)</b></font></font> 
-<p><font color="#000000">Returns an array containing column names that are the 
-  primary keys of $table. Supported by mysql, odbc (including db2, odbc_mssql, 
-  etc), mssql, postgres, interbase/firebird, oci8 currently. </font><font color="#000000"> 
-<p>Views (and some tables) have primary keys, but sometimes this information is not available from the
-database. You can define a function  ADODB_View_PrimaryKeys($databaseType, $database, $view, $owner) that
-should return an array containing the fields that make up the primary key. If that function exists,
-it will be called when MetaPrimaryKeys() cannot find a primary key for a table or view.
-<pre>
-// In this example: dbtype = 'oci8', $db = 'mydb', $view = 'dataView', $owner = false 
-function ADODB_View_PrimaryKeys($dbtype,$db,$view,$owner)
-{
-       switch(strtoupper($view)) {
-       case 'DATAVIEW': return array('DATAID');
-       default: return false;
-       }
-}
-
-$db = NewADOConnection('oci8');
-$db->Connect('localhost','root','','mydb'); 
-$db->MetaPrimaryKeys('dataView');
-</pre>
-<p><font color="#000000"><b>ServerInfo<a name="serverinfo" id="serverinfo"></a>($table)</b></font></font> 
-<p><font color="#000000">Returns an array of containing two elements 'description' 
-  and 'version'. The 'description' element contains the string description of 
-  the database. The 'version' naturally holds the version number (which is also 
-  a string).</font><font color="#000000"> 
-<p><b>MetaForeignKeys<a name="metaforeignkeys"></a>($table, $owner=false, $upper=false)</b> 
-<p>Returns an associate array of foreign keys, or false if not supported. For 
-  example, if table employee has a foreign key where employee.deptkey points to 
-  dept_table.deptid, and employee.posn=posn_table.postionid and employee.poscategory=posn_table.category, 
-  then $conn->MetaForeignKeys('employee') will return 
-<pre>
-       array(
-               'dept_table' => array('deptkey=deptid'),
-               'posn_table' => array('posn=positionid','poscategory=category')
-       )
-</pre>
-<p>The optional schema or owner can be defined in $owner. If $upper is true, then 
-  the table names (array keys) are upper-cased. 
-<hr>
-<h2>ADORecordSet<a name="adorecordset"></a></h2>
-<p>When an SQL statement successfully is executed by <font face="Courier New, Courier, mono">ADOConnection-&gt;Execute($sql),</font>an 
-  ADORecordSet object is returned. This object contains a virtual cursor so we 
-  can move from row to row, functions to obtain information about the columns 
-  and column types, and helper functions to deal with formating the results to 
-  show to the user.</p>
-<h3>ADORecordSet Fields</h3>
-<p><b>fields: </b>Array containing the current row. This is not associative, but 
-  is an indexed array from 0 to columns-1. See also the function <b><a href="#fields">Fields</a></b>, 
-  which behaves like an associative array.</p>
-<p><b>dataProvider</b>: The underlying mechanism used to connect to the database. 
-  Normally set to <b>native</b>, unless using <b>odbc</b> or <b>ado</b>.</p>
-<p><b>blobSize</b>: Maximum size of a char, string or varchar object before it 
-  is treated as a Blob (Blob's should be shown with textarea's). See the <a href="#metatype">MetaType</a> 
-  function.</p>
-<p><b>sql</b>: Holds the sql statement used to generate this record set.</p>
-<p><b>canSeek</b>: Set to true if Move( ) function works.</p>
-<p><b>EOF</b>: True if we have scrolled the cursor past the last record.</p>
-<h3>ADORecordSet Functions</h3>
-<p><b>ADORecordSet( )</b></p>
-<p>Constructer. Normally you never call this function yourself.</p>
-<p><b>GetAssoc<a name="getassoc"></a>([$force_array])</b></p>
-<p>Generates an associative array from the recordset. Note that is this function 
-  is also <a href="#getassoc1">available</a> in the connection object. More details 
-  can be found there.</p>
-</font></font><font color="#000000"><font color="#000000"> </font></font><font color="#000000"><font color="#000000">
-<p><b>GetArray<a name="getarray"></a>([$number_of_rows])</b></p>
-<p>Generate a 2-dimensional array of records from the current cursor position, 
-  indexed from 0 to $number_of_rows - 1. If $number_of_rows is undefined, till 
-  EOF.</p>
-<p><b>GetRows<a name="getrows"></a>([$number_of_rows])</b></p>
-Generate a 2-dimensional array of records from the current cursor position. Synonym 
-for GetArray() for compatibility with Microsoft ADO. 
-<p> <b>GetMenu<a name="getmenu"></a>($name, [$default_str=''], [$blank1stItem=true], 
-  [$multiple_select=false], [$size=0], [$moreAttr=''])</b></p>
-<p>Generate a HTML menu (&lt;select&gt;&lt;option&gt;&lt;option&gt;&lt;/select&gt;). 
-  The first column of the recordset (fields[0]) will hold the string to display 
-  in the option tags. If the recordset has more than 1 column, the second column 
-  (fields[1]) is the value to send back to the web server.. The menu will be given 
-  the name $<i>name</i>. 
-<p> If $<i>default_str</i> is defined, then if $<i>default_str</i> == fields[0], 
-  that field is selected. If $<i>blank1stItem</i> is true, the first option is 
-  empty. You can also set the first option strings by setting $blank1stItem = 
-  "$value:$text".</p>
-<p>$<i>Default_str</i> can be array for a multiple select listbox.</p>
-<p>To get a listbox, set the $<i>size</i> to a non-zero value (or pass $default_str 
-  as an array). If $<i>multiple_select</i> is true then a listbox will be generated 
-  with $<i>size</i> items (or if $size==0, then 5 items) visible, and we will 
-  return an array to a server. Lastly use $<i>moreAttr </i> to add additional 
-  attributes such as javascript or styles. </p>
-<p>Menu Example 1: <code>GetMenu('menu1','A',true)</code> will generate a menu: 
-  <select name='menu1'>
-    <option> 
-    <option value=1 selected>A 
-    <option value=2>B 
-    <option value=3>C 
-  </select>
-  for the data (A,1), (B,2), (C,3). Also see <a href="#ex5">example 5</a>.</p>
-<p>Menu Example 2: For the same data, <code>GetMenu('menu1',array('A','B'),false)</code> 
-  will generate a menu with both A and B selected: <br>
-  <select name='menu1' multiple size=3>
-    <option value=1 selected>A 
-    <option value=2 selected>B 
-    <option value=3>C 
-  </select>
-<p> <b>GetMenu2<a name="getmenu2"></a>($name, [$default_str=''], [$blank1stItem=true], 
-  [$multiple_select=false], [$size=0], [$moreAttr=''])</b></p>
-<p>This is nearly identical to GetMenu, except that the $<i>default_str</i> is 
-  matched to fields[1] (the option values).</p>
-<p>Menu Example 3: Given the data in menu example 2, <code>GetMenu2('menu1',array('1','2'),false)</code> 
-  will generate a menu with both A and B selected in menu example 2, but this 
-  time the selection is based on the 2nd column, which holds the values to return 
-  to the Web server. 
-<p><b>UserDate<a name="userdate"></a>($str, [$fmt])</b></p>
-<p>Converts the date string $<i>str</i> to another format. The date format is Y-m-d,
-or Unix timestamp format. The default $<i>fmt</i> is Y-m-d.</p>
-<p><b>UserTimeStamp<a name="usertimestamp"></a>($str, [$fmt])</b></p>
-<p>Converts the timestamp string $<b>str</b> to another format. The timestamp 
-  format is Y-m-d H:i:s, as in '2002-02-28 23:00:12', or Unix timestamp format.
-   UserTimeStamp calls UnixTimeStamp to parse $<i>str</i>, and $<i>fmt</i> defaults to Y-m-d H:i:s if not defined. 
-</p>
-<p><b>UnixDate<a name="unixdate"></a>($str)</b></p>
-<p>Parses the date string $<b>str</b> and returns it in unix mktime format (eg. 
-  a number indicating the seconds after January 1st, 1970). Expects the date to 
-  be in Y-m-d H:i:s format, except for Sybase and Microsoft SQL Server, where 
-  M d Y is also accepted (the 3 letter month strings are controlled by a global 
-  array, which might need localisation).</p>
-<p>This function is available in both ADORecordSet and ADOConnection since 1.91.</p>
-<p><b>UnixTimeStamp<a name="unixtimestamp"></a>($str)</b></p>
-<p>Parses the timestamp string $<b>str</b> and returns it in unix mktime format 
-  (eg. a number indicating the seconds after January 1st, 1970). Expects the date 
-  to be in "Y-m-d, H:i:s" (1970-12-24, 00:00:00) or "Y-m-d H:i:s" (1970-12-24 00:00:00) or "YmdHis" (19701225000000) format, except for Sybase and Microsoft SQL Server, where 
-  "M d Y h:i:sA" (Dec 25 1970 00:00:00AM) is also accepted (the 3 letter month strings are controlled by 
-  a global array, which might need localisation).</p>
-</font> 
-<p><font color="#000000">This function is available in both ADORecordSet and ADOConnection 
-  since 1.91. </font></p>
-<p><font color="#000000"><b>OffsetDate<a name="offsetdate"></a>($dayFraction, 
-  $basedate=false)</b></font></p>
-<p><font color="#000000"><font color="#000000">Returns a string </font>with the 
-  native SQL functions to calculate future and past dates based on $basedate in 
-  a portable fashion. If $basedate is not defined, then the current date (at 12 
-  midnight) is used. Returns the SQL string that performs the calculation when 
-  passed to Execute(). </font></p>
-<p><font color="#000000">For example, in Oracle, to find the date and time that 
-  is 2.5 days from today, you can use:</font></p>
-<pre><font color="#000000"># get date one week from now
-$fld = $conn-&gt;OffsetDate(7); // returns &quot;(trunc(sysdate)+7&quot;)</font></pre>
-<pre><font color="#000000"># get date and time that is 60 hours from current date and time
-$fld = $conn-&gt;OffsetDate(2.5, $conn-&gt;sysTimeStamp);      // returns &quot;(sysdate+2.5)&quot;</font>
-
-$conn-&gt;Execute(&quot;UPDATE TABLE SET dodate=$fld WHERE ID=$id&quot;);</pre>
-<p> This function is available for mysql, mssql, oracle, oci8 and postgresql drivers 
-  since 2.13. It might work with other drivers<font color="#000000"> provided 
-  they allow performing numeric day arithmetic on dates.</font></p>
-<font color="#000000"> 
-<p><font color="#000000"><b>SQLDate<a name="sqldate"></a>($dateFormat, $basedate=false)</b></font></p>
-Returns a string which contains the native SQL functions to format a date or date 
-column $basedate. This is used in SELECT statements. For INSERT/UPDATE statements, 
-use <a href="#dbdate">DBDate</a>. It uses a case-sensitive $dateFormat, which 
-supports: 
-<pre>
- Y: 4-digit Year
- Q: Quarter (1-4)
- m: Month (01-12)
- d: Day (01-31)
- H: Hour (00-23)
- h: Hour (1-12)
- i: Minute (00-59)
- s: Second (00-60)
- A: AM/PM indicator</pre>
-<p>All other characters are treated as strings. You can also use \ to escape characters. 
-  Available on selected databases, including mysql, postgresql, mssql, oci8 and 
-  DB2. 
-<p>This is useful in writing portable sql statements that GROUP BY on dates. For 
-  example to display total cost of goods sold broken by quarter (dates are stored 
-  in a field called postdate): 
-<pre>
- $sqlfn = $db->SQLDate('Y-\QQ','postdate'); # get sql that formats postdate to output 2002-Q1
- $sql = "SELECT $sqlfn,SUM(cogs) FROM table GROUP BY $sqlfn ORDER BY 1 desc";
- </pre>
-<p><b>MoveNext<a name="movenext"></a>( )</b></p>
-<p>Move the internal cursor to the next row. The <i>$this->fields</i> array is 
-  automatically updated. Returns false if unable to do so (normally because EOF 
-  has been reached), otherwise true. 
-<p> If EOF is reached, then the $this->fields array is set to false (this was 
-  only implemented consistently in ADOdb 3.30). For the pre-3.30 behaviour of 
-  $this->fields (at EOF), set the global variable $ADODB_COMPAT_FETCH = true.</p>
-<p>Example:</p>
-<pre>$rs = $db-&gt;Execute($sql);
-if ($rs) 
-       while (!$rs-&gt;EOF) {
-               ProcessArray($rs->fields);      
-               $rs->MoveNext();
-       } </pre>
-<p><b>Move<a name="move"></a>($to)</b></p>
-<p>Moves the internal cursor to a specific row $<b>to</b>. Rows are zero-based 
-  eg. 0 is the first row. The <b>fields</b> array is automatically updated. For 
-  databases that do not support scrolling internally, ADOdb will simulate forward 
-  scrolling. Some databases do not support backward scrolling. If the $<b>to</b> 
-  position is after the EOF, $<b>to</b> will move to the end of the RecordSet 
-  for most databases. Some obscure databases using odbc might not behave this 
-  way.</p>
-<p>Note: This function uses <i>absolute positioning</i>, unlike Microsoft's ADO.</p>
-<p>Returns true or false. If false, the internal cursor is not moved in most implementations, 
-  so AbsolutePosition( ) will return the last cursor position before the Move( 
-  ). </p>
-<p><b>MoveFirst<a name="movefirst"></a>()</b></p>
-<p>Internally calls Move(0). Note that some databases do not support this function.</p>
-<p><b>MoveLast<a name="movelast"></a>()</b></p>
-<p>Internally calls Move(RecordCount()-1). Note that some databases do not support 
-  this function.</p>
-<p><b>GetRowAssoc</b><a name="getrowassoc"></a>($toUpper=true)</p>
-<p>Returns an associative array containing the current row. The keys to the array 
-  are the column names. The column names are upper-cased for easy access. To get 
-  the next row, you will still need to call MoveNext(). </p>
-<p>For example:<br>
-  Array ( [ID] => 1 [FIRSTNAME] => Caroline [LASTNAME] => Miranda [CREATED] => 
-  2001-07-05 ) </p>
-<p>Note: do not use GetRowAssoc() with $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC. 
-  Because they have the same functionality, they will interfere with each other.</p>
-</font> 
-<p><font color="#000000"><b>AbsolutePage<a name="absolutepage"></a>($page=-1) 
-  </b></font></p>
-<p>Returns the current page. Requires PageExecute()/CachePageExecute() to be called. 
-  See <a href=#ex8>Example 8</a>.</p>
-<font color="#000000"> 
-<p><b>AtFirstPage<a name="atfirstpage">($status='')</a></b></p>
-<p>Returns true if at first page (1-based). Requires PageExecute()/CachePageExecute() 
-  to be called. See <a href=#ex8>Example 8</a>.</p>
-<p><b>AtLastPage<a name="atlastpage">($status='')</a></b></p>
-<p>Returns true if at last page (1-based). Requires PageExecute()/CachePageExecute() 
-  to be called. See <a href=#ex8>Example 8</a>.</p>
-<p><b>Fields</b><a name="fields"></a>(<b>$colname</b>)</p>
-<p>Returns the value of the 
-  associated column $<b>colname</b> for the current row. The column name is case-insensitive.</p>
-<p>This is a convenience function. For higher performance, use <a href="#adodb_fetch_mode">$ADODB_FETCH_MODE</a>. </p>
-<p><b>FetchRow</b><a name="fetchrow"></a>()</p>
-</font> 
-<p><font color="#000000">Returns array containing current row, or false if EOF. 
-  FetchRow( ) internally moves to the next record after returning the current 
-  row. </font></p>
-<p><font color="#000000">Warning: Do not mix using FetchRow() with MoveNext().</font></p>
-<p><font color="#000000">Usage:</font></p>
-<pre><font color="#000000">$rs = $db-&gt;Execute($sql);
-if ($rs)
-       while ($arr = $rs-&gt;FetchRow()) &#123;
-          &nbsp;&nbsp;# process $arr   
-</font><font color="#000000">  &#125;</font></pre>
-<p><font color="#000000"><b>FetchInto</b><a name="fetchinto"></a>(<b>&amp;$array</b>)</font></p>
-<p><font color="#000000"> Sets $array to the current row. Returns PEAR_Error object 
-  if EOF, 1 if ok (DB_OK constant). If PEAR is undefined, false is returned when 
-  EOF. </font><font color="#000000">FetchInto( ) internally moves to the next 
-  record after returning the current row. </font></p>
-<p><font color="#000000"> FetchRow() is easier to use. See above.</font></p>
-<font color="#000000"> 
-<p><b>FetchField<a name="fetchfield"></a>($column_number)</b></p>
-<p>Returns an object containing the <b>name</b>, <b>type</b> and <b>max_length</b> 
-  of the associated field. If the max_length cannot be determined reliably, it 
-  will be set to -1. The column numbers are zero-based. See <a href="#ex2">example 
-  2.</a></p>
-<p><b>FieldCount<a name="fieldcount"></a>( )</b></p>
-<p>Returns the number of fields (columns) in the record set.</p>
-<p><b>RecordCount<a name="recordcount"></a>( )</b></p>
-<p>Returns the number of rows in the record set. If the number of records returned 
-  cannot be determined from the database driver API, we will buffer all rows and 
-  return a count of the rows after all the records have been retrieved. This buffering 
-  can be disabled (for performance reasons) by setting the global variable $ADODB_COUNTRECS 
-  = false. When disabled, RecordCount( ) will return -1 for certain databases. 
-  See the supported databases list above for more details. </p>
-<p> RowCount is a synonym for RecordCount.</p>
-<p><b>PO_RecordCount<a name="po_recordcount"></a>($table, $where)</b></p>
-<p>Returns the number of rows in the record set. If the database does not support 
-  this, it will perform a SELECT COUNT(*) on the table $table, with the given 
-  $where condition to return an estimate of the recordset size.</p>
-<p>$numrows = $rs-&gt;PO_RecordCount(&quot;articles_table&quot;, &quot;group=$group&quot;);</p>
-<b> NextRecordSet<a name="nextrecordset" id="nextrecordset"></a>()</b> 
-<p>For databases that allow multiple recordsets to be returned in one query, this 
-  function allows you to switch to the next recordset. Currently only supported 
-  by mssql driver.</p>
-<pre>
-$rs = $db-&gt;Execute('execute return_multiple_rs');
-$arr1 = $rs-&gt;GetArray();
-$rs-&gt;NextRecordSet();
-$arr2 = $rs-&gt;GetArray();</pre>
-<p><b>FetchObject<a name="fetchobject"></a>($toupper=true)</b></p>
-<p>Returns the current row as an object. If you set $toupper to true, then the 
-  object fields are set to upper-case. Note: The newer FetchNextObject() is the 
-  recommended way of accessing rows as objects. See below.</p>
-<p><b>FetchNextObject<a name="fetchnextobject"></a>($toupper=true)</b></p>
-<p>Gets the current row as an object and moves to the next row automatically. 
-  Returns false if at end-of-file. If you set $toupper to true, then the object 
-  fields are set to upper-case.</p>
-<pre>
-$rs = $db->Execute('select firstname,lastname from table');
-if ($rs) &#123;
-       while ($o = $rs->FetchNextObject()) &#123;
-               print "$o->FIRSTNAME, $o->LASTNAME&lt;BR>";
-       &#125;
-&#125;
-</pre>
-<p>There is some trade-off in speed in using FetchNextObject(). If performance 
-  is important, you should access rows with the <code>fields[]</code> array. <b>FetchObj<a name="fetchobj" id="fetchobj"></a>()</b> 
-<p>Returns the current record as an object. Fields are not upper-cased, unlike 
-  FetchObject. </font> 
-<p><font color="#000000"><b>FetchNextObj<a name="fetchnextobj" id="fetchnextobj"></a>()</b> 
-  </font></p>
-<p><font color="#000000">Returns the current record as an object and moves to 
-  the next record. If EOF, false is returned. Fields are not upper-cased, unlike 
-  FetctNextObject. </font></p>
-<font color="#000000"> 
-<p><b>CurrentRow<a name="currentrow"></a>( )</b></p>
-<p>Returns the current row of the record set. 0 is the first row.</p>
-<p><b>AbsolutePosition<a name="abspos"></a>( )</b></p>
-<p>Synonym for <b>CurrentRow</b> for compatibility with ADO. Returns the current 
-  row of the record set. 0 is the first row.</p>
-<p><b>MetaType<a name="metatype"></a>($nativeDBType[,$field_max_length],[$fieldobj])</b></p>
-<p>Determine what <i>generic</i> meta type a database field type is given its 
-  native type $<b>nativeDBType</b> as a string and the length of the field $<b>field_max_length</b>. 
-  Note that field_max_length can be -1 if it is not known. The field object returned 
-  by FetchField() can be passed in $<b>fieldobj</b> or as the 1st parameter <b>$nativeDBType</b>. 
-  This is useful for databases such as <i>mysql</i> which has additional properties 
-  in the field object such as <i>primary_key</i>. </p>
-<p>Uses the field <b>blobSize</b> and compares it with $<b>field_max_length</b> 
-  to determine whether the character field is actually a blob.</p>
-For example, $db-&gt;MetaType('char') will return 'C'. 
-<p>Returns:</p>
-<ul>
-  <li><b>C</b>: Character fields that should be shown in a &lt;input type=&quot;text&quot;&gt; 
-    tag. </li>
-  <li><b>X</b>: Clob (character large objects), or large text fields that should 
-    be shown in a &lt;textarea&gt;</li>
-  <li><b>D</b>: Date field</li>
-  <li><b>T</b>: Timestamp field</li>
-  <li><b>L</b>: Logical field (boolean or bit-field)</li>
-  <li><b>N</b>: Numeric field. Includes decimal, numeric, floating point, and 
-    real. </li>
-  <li><b>I</b>:&nbsp; Integer field. </li>
-  <li><b>R</b>: Counter or Autoincrement field. Must be numeric.</li>
-  <li><b>B</b>: Blob, or binary large objects.<font color="#000000"> </font></li>
-</ul>
-</font> 
-<p><font color="#000000"> Since ADOdb 3.0, MetaType accepts $fieldobj as the first 
-  parameter, instead of $nativeDBType. </font></p>
-<font color="#000000"> 
-<p><b>Close( )<a name="rsclose"></a></b></p>
-<p>Closes the recordset, cleaning all memory and resources associated with the recordset. 
-<p>
-If memory management is not an issue, you do not need to call this function as recordsets
-are closed for you by PHP at the end of the script. 
-SQL statements such as INSERT/UPDATE/DELETE do not really return a recordset, so you do not have to call Close()
-for such SQL statements.</p>
-<hr>
-<h3>function rs2html<a name="rs2html"></a>($adorecordset,[$tableheader_attributes], 
-  [$col_titles])</h3>
-<p>This is a standalone function (rs2html = recordset to html) that is similar 
-  to PHP's <i>odbc_result_all</i> function, it prints a ADORecordSet, $<b>adorecordset</b> 
-  as a HTML table. $<b>tableheader_attributes</b> allow you to control the table 
-  <i>cellpadding</i>, <i>cellspacing</i> and <i>border</i> attributes. Lastly 
-  you can replace the database column names with your own column titles with the 
-  array $<b>col_titles</b>. This is designed more as a quick debugging mechanism, 
-  not a production table recordset viewer.</p>
-<p>You will need to include the file <i>tohtml.inc.php</i>.</p>
-<p>Example of rs2html:<b><font color="#336600"><a name="exrs2html"></a></font></b></p>
-<pre><b><font color="#336600">&lt;?
-include('tohtml.inc.php')</font></b>; # load code common to ADOdb 
-<b>include</b>('adodb.inc.php'); # load code common to ADOdb 
-$<font color="#663300">conn</font> = &amp;ADONewConnection('mysql');   # create a connection 
-$<font color="#663300">conn</font>->PConnect('localhost','userid','','agora');# connect to MySQL, agora db
-$<font color="#663300">sql</font> = 'select CustomerName, CustomerID from customers'; 
-$<font color="#663300">rs</font>   = $<font color="#663300">conn</font>->Execute($sql); 
-<font color="#336600"><b>rs2html</b></font><b>($<font color="#663300">rs</font>,'<i>border=2 cellpadding=3</i>',array('<i>Customer Name','Customer ID</i>'));
-?&gt;</b></pre>
-<hr>
-<h3>Differences between this ADOdb library and Microsoft ADO<a name="adodiff"></a></h3>
-<ol>
-  <li>ADOdb only supports recordsets created by a connection object. Recordsets 
-    cannot be created independently.</li>
-  <li>ADO properties are implemented as functions in ADOdb. This makes it easier 
-    to implement any enhanced ADO functionality in the future.</li>
-  <li>ADOdb's <font face="Courier New, Courier, mono">ADORecordSet-&gt;Move()</font> 
-    uses absolute positioning, not relative. Bookmarks are not supported.</li>
-  <li><font face="Courier New, Courier, mono">ADORecordSet-&gt;AbsolutePosition() 
-    </font>cannot be used to move the record cursor.</li>
-  <li>ADO Parameter objects are not supported. Instead we have the ADOConnection::<a href="#parameter">Parameter</a>( 
-    ) function, which provides a simpler interface for calling preparing parameters 
-    and calling stored procedures.</li>
-  <li>Recordset properties for paging records are available, but implemented as 
-    in <a href=#ex8>Example 8</a>.</li>
-</ol>
-<hr>
-<h1>Database Driver Guide<a name="driverguide"></a></h1>
-<p>This describes how to create a class to connect to a new database. To ensure 
-  there is no duplication of work, kindly email me at jlim#natsoft.com.my if you 
-  decide to create such a class.</p>
-<p>First decide on a name in lower case to call the database type. Let's say we 
-  call it xbase. </p>
-<p>Then we need to create two classes ADODB_xbase and ADORecordSet_xbase in the 
-  file adodb-xbase.inc.php.</p>
-<p>The simplest form of database driver is an adaptation of an existing ODBC driver. 
-  Then we just need to create the class <i>ADODB_xbase extends ADODB_odbc</i> 
-  to support the new <b>date</b> and <b>timestamp</b> formats, the <b>concatenation</b> 
-  operator used, <b>true</b> and <b>false</b>. For the<i> ADORecordSet_xbase extends 
-  ADORecordSet_odbc </i>we need to change the <b>MetaType</b> function. See<b> 
-  adodb-vfp.inc.php</b> as an example.</p>
-<p>More complicated is a totally new database driver that connects to a new PHP 
-  extension. Then you will need to implement several functions. Fortunately, you 
-  do not have to modify most of the complex code. You only need to override a 
-  few stub functions. See <b>adodb-mysql.inc.php</b> for example.</p>
-<p>The default date format of ADOdb internally is YYYY-MM-DD (Ansi-92). All dates 
-  should be converted to that format when passing to an ADOdb date function. See 
-  Oracle for an example how we use ALTER SESSION to change the default date format 
-  in _pconnect _connect.</p>
-<p><b>ADOConnection Functions to Override</b></p>
-<p>Defining a constructor for your ADOConnection derived function is optional. 
-  There is no need to call the base class constructor.</p>
-<p>_<b>connect</b>: Low level implementation of Connect. Returns true or false. 
-  Should set the _<b>connectionID</b>.</p>
-<p>_<b>pconnect:</b> Low level implemention of PConnect. Returns true or false. 
-  Should set the _<b>connectionID</b>.</p>
-<p>_<b>query</b>: Execute a query. Returns the queryID, or false.</p>
-<p>_<b>close: </b>Close the connection -- PHP should clean up all recordsets. 
-</p>
-<p><b>ErrorMsg</b>: Stores the error message in the private variable _errorMsg. 
-</p>
-<p><b>ADOConnection Fields to Set</b></p>
-<p>_<b>bindInputArray</b>: Set to true if binding of parameters for SQL inserts 
-  and updates is allowed using ?, eg. as with ODBC.</p>
-<p><b>fmtDate</b></p>
-<p><b>fmtTimeStamp</b></p>
-<p><b>true</b></p>
-<p><b>false</b></p>
-<p><b>concat_operator</b></p>
-<p><b>replaceQuote</b></p>
-<p><b>hasLimit</b> support SELECT * FROM TABLE LIMIT 10 of MySQL.</p>
-<p><b>hasTop</b> support Microsoft style SELECT TOP 10 * FROM TABLE.</p>
-<p><b>ADORecordSet Functions to Override</b></p>
-<p>You will need to define a constructor for your ADORecordSet derived class that 
-  calls the parent class constructor.</p>
-<p><b>FetchField: </b> as documented above in ADORecordSet</p>
-<p>_<b>initrs</b>: low level initialization of the recordset: setup the _<b>numOfRows</b> 
-  and _<b>numOfFields</b> fields -- called by the constructor.</p>
-<p>_<b>seek</b>: seek to a particular row. Do not load the data into the fields 
-  array. This is done by _fetch. Returns true or false. Note that some implementations 
-  such as Interbase do not support seek. Set canSeek to false.</p>
-<p>_<b>fetch</b>: fetch a row using the database extension function and then move 
-  to the next row. Sets the <b>fields</b> array. If the parameter $ignore_fields 
-  is true then there is no need to populate the <b>fields</b> array, just move 
-  to the next row. then Returns true or false.</p>
-<p>_<b>close</b>: close the recordset</p>
-<p><b>Fields</b>: If the array row returned by the PHP extension is not an associative 
-  one, you will have to override this. See adodb-odbc.inc.php for an example. 
-  For databases such as MySQL and MSSQL where an associative array is returned, 
-  there is no need to override this function.</p>
-<p><b>ADOConnection Fields to Set</b></p>
-<p>canSeek: Set to true if the _seek function works.</p>
-<h2>ToDo:</h2>
-<p>See the <a href=http://php.weblogs.com/adodb-todo-roadmap>RoadMap</a> article.</p>
-<p>Also see the ADOdb <a href=http://php.weblogs.com/adodb_csv>proxy</a> article 
-  for bridging Windows and Unix databases using http remote procedure calls. For 
-  your education, visit <a href=http://palslib.com/>palslib.com</a> for database info, 
-  and read this article on <a href=http://phplens.com/lens/php-book/optimizing-debugging-php.php>Optimizing 
-  PHP</a>. </p>
-</font>
-<h2>Change Log<a name="Changes"></a><a name="changes"></a><a name="changelog"></a></h2>
-<p><b>4.20 27 Feb 2004</b>
-<p>Updated to AXMLS 1.01.
-<p>MetaForeignKeys for postgres7 modified by Edward Jaramilla, works on pg 7.4.
-<p>Now numbers accepts function calls or sequences for GetInsertSQL/GetUpdateSQL numeric fields.
-<p>Changed quotes of 'delete from $perf_table' to "". Thx Kehui (webmaster#kehui.net)
-<p>Added ServerInfo() for ifx, and putenv trim fix. Thx Fernando Ortiz.
-<p>Added addq(), which is analogous to addslashes().
-<p>Tested with php5b4. Fix some php5 compat problems with exceptions and sybase.
-<P>Carl-Christian Salvesen added patch to mssql _query to support binds greater than 4000 chars.
-<p>Mike suggested patch to PHP5 exception handler. $errno must be numeric.
-<p>Added double quotes (") to ADODB_TABLE_REGEX.
-<p>For oci8, Prepare(...,$cursor), $cursor's meaning was accidentally inverted in 4.11. This causes problems with ExecuteCursor() too, which calls Prepare() internally. Thx to William Lovaton.
-<p>Now dateHasTime property in connection object renamed to datetime for consistency. This could break bc.
-<p>Csongor Halmai reports that db2 SelectLimit with input array is not working. Fixed..
-<p><b>4.11 27 Jan 2004</b>
-<p>Csongor Halmai reports db2 binding not working. Reverted back to emulated binding.
-<p>Dan Cech modifies datadict code. Adds support for DropIndex. Minor cleanups.
-<p>Table misspelt in perf-oci8.inc.php. Changed v$conn_cache_advice to v$db_cache_advice. Reported by Steve W.
-<p>UserTimeStamp and DBTimeStamp did not handle YYYYMMDDHHMMSS format properly. Reported by Mike Muir. Fixed.
-<p>Changed oci8 Prepare(). Does not auto-allocate OCINewCursor automatically, unless 2nd param is set to true.
-This will break backward compat, if Prepare/Execute is used instead of ExecuteCursor. Reported by Chris Jones.
-<p>Added InParameter() and OutParameter(). Wrapper functions to Parameter(), but nicer because they
-are self-documenting.
-<p>Added 'R' handling in ActualType() to datadict-mysql.inc.php
-<p>Added ADOConnection::SerializableRS($rs). Returns a recordset that can be serialized in a session.
-<p>Added "Run SQL" to performance UI().
-<p>Misc spelling corrections in adodb-mysqli.inc.php, adodb-oci8.inc.php and datadict-oci8.inc.php, from Heinz Hombergs.
-<p>MetaIndexes() for ibase contributed by Heinz Hombergs.
-<p><b>4.10 12 Jan 2004</b>
-<p>Dan Cech contributed extensive changes to data dictionary to support name quoting (with `), and drop table/index.
-<p>Informix added cursorType property. Default remains IFX_SCROLL, but you can change to 0 (non-scrollable cursor) for performance.
-<p>Added ADODB_View_PrimaryKeys() for returning view primary keys to MetaPrimaryKeys().
-<p>Simplified chinese file, adodb-cn.inc.php from cysoft.
-<p>Added check for ctype_alnum in adodb-datadict.inc.php. Thx to Jason Judge.
-<p>Added connection parameter to ibase Prepare(). Fix by Daniel Hassan.
-<p>Added nameQuote for quoting identifiers and names to connection obj. Requested by Jason Judge. Also the
-data dictionary parser now detects `field name` and generates column names with spaces correctly.
-<p>BOOL type not recognised correctly as L. Fixed.
-<p>Fixed paths in ADODB_DIR for session files, and back-ported it to 4.05 (15 Dec 2003)
-<p>Added Schema to postgresql MetaTables. Thx to col#gear.hu
-<p>Empty postgresql recordsets that had blob fields did not set EOF properly. Fixed.
-<p>CacheSelectLimit internal parameters to SelectLimit were wrong. Thx to Nio.
-<p>Modified adodb_pr() and adodb_backtrace() to support command-line usage (eg. no html).
-<p>Fixed some fr and it lang errors. Thx to Gaetano G.
-<p>Added contrib directory, with adodb rs to xmlrpc convertor by Gaetano G.
-<p>Fixed array recordset bugs when _skiprow1 is true. Thx to Gaetano G.
-<p>Fixed pivot table code when count is false.
-<p>
-
-<p><b>4.05 13 Dec 2003 </b>
-<p>Added MetaIndexes - thx to Dan Cech.
-<p>Rewritten session code by Ross Smith. Moved code to adodb/session directory.
-<p>Added function exists check on connecting to most drivers, so we don't crash with the unknown function error.
-<p>Smart Transactions failed with GenID() when it no seq table has been created because the sql
-       statement fails. Fix by Mark Newnham.
-<p>Added $db->length, which holds name of function that returns strlen.
-<p>Fixed error handling for bad driver in ADONewConnection - passed too few params to error-handler.
-<p>Datadict did not handle types like 16.0 properly in _GetSize. Fixed.
-<p>Oci8 driver SelectLimit() bug &= instead of =& used. Thx to Swen Thümmler.
-<p>Jesse Mullan suggested not flushing outp when output buffering enabled. Due to Apache 2.0 bug. Added.
-<p>MetaTables/MetaColumns return ref bug with PHP5 fixed in adodb-datadict.inc.php.
-<p>New mysqli driver contributed by Arjen de Rijke. Based on adodb 3.40 driver.
-Then jlim added BeginTrans, CommitTrans, RollbackTrans, IfNull, SQLDate. Also fixed return ref bug.
-<p>$ADODB_FLUSH added, if true then force flush in debugging outp. Default is false.  In earlier
-versions, outp defaulted to flush, which is not compat with apache 2.0.
-<p>Mysql driver's GenID() function did not work when when sql logging is on. Fixed.
-<p>$ADODB_SESSION_TBL not declared as global var. Not available if adodb-session.inc.php included in function. Fixed.
-<p>The input array not passed to Execute() in _adodb_getcount(). Fixed.
-<p><b>4.04 13 Nov 2003 </b>
-<p>Switched back to foreach - faster than list-each.
-<p>Fixed bug in ado driver - wiping out $this->fields with date fields.
-<p>Performance Monitor, View SQL, Explain Plan did not work if strlen($SQL)>max($_GET length). Fixed.
-<p>Performance monitor, oci8 driver added memory sort ratio.
-<p>Added random property, returns SQL to generate a floating point number between 0 and 1;
-<p><b>4.03 6 Nov 2003 </b>
-<p>The path to adodb-php4.inc.php and adodb-iterators.inc.php was not setup properly.
-<p>Patched SQLDate in interbase to support hours/mins/secs. Thx to ari kuorikoski.
-<p>Force autorollback for pgsql persistent connections - 
-apparently pgsql did not autorollback properly before 4.3.4. See http://bugs.php.net/bug.php?id=25404
-<p><b>4.02 5 Nov 2003 </b>
-<p>Some errors in adodb_error_pg() fixed. Thx to Styve.
-<p>Spurious Insert_ID() error was generated by LogSQL(). Fixed.
-<p>Insert_ID was interfering with Affected_Rows() and Replace()  when LogSQL() enabled. Fixed.
-<p>More foreach loops optimized with list/each.
-<p>Null dates not handled properly in ADO driver (it becomes 31 Dec 1969!).
-<p>Heinz Hombergs contributed patches for mysql MetaColumns - adding scale, made
-interbase MetaColumns work with firebird/interbase, and added lang/adodb-de.inc.php.
-<p>Added INFORMIXSERVER environment variable.
-<p>Added $ADODB_ANSI_PADDING_OFF for interbase/firebird.
-<p>PHP 5 beta 2 compat check. Foreach (Iterator) support. Exceptions support.
-<p><b>4.01 23 Oct 2003 </b>
-<p>Fixed bug in rs2html(), tohtml.inc.php, that generated blank table cells.
-<p>Fixed insert_id() incorrectly generated when logsql() enabled.
-<p>Modified PostgreSQL _fixblobs to use list/each instead of foreach.
-<p>Informix ErrorNo() implemented correctly.
-<p>Modified several places to use list/each, including GetRowAssoc().
-<p>Added UserTimeStamp() to connection class.
-<p>Added $ADODB_ANSI_PADDING_OFF for oci8po.
-<p><b>4.00 20 Oct 2003 </b>
-<p>Upgraded adodb-xmlschema to 1 Oct 2003 snapshot.
-<p>Fix to rs2html warning message. Thx to Filo.
-<p>Fix for odbc_mssql/mssql SQLDate(), hours was wrong.
-<p>Added MetaColumns and MetaPrimaryKeys for sybase. Thx to Chris Phillipson.
-<p>Added autoquoting to datadict for MySQL and PostgreSQL. Suggestion by Karsten Dambekalns  
-<p><b>3.94 11 Oct 2003 </b>
-<p>Create trigger in datadict-oci8.inc.php did not work, because all cr/lf's must be removed. 
-<p>ErrorMsg()/ErrorNo() did not work for many databases when logging enabled. Fixed.
-<p>Removed global variable $ADODB_LOGSQL as it does not work properly with multiple connections.
-<p>Added SQLDate support for sybase. Thx to Chris Phillipson
-<p>Postgresql checking of pgsql resultset resource was incorrect. Fix by Bharat Mediratta bharat#menalto.com.
-Same patch applied to  _insertid and _affectedrows for adodb-postgres64.inc.php.
-<p>Added support for NConnect for postgresql.
-<p>Added Sybase data dict support. Thx to Chris Phillipson  
-<p>Extensive improvements in $perf->UI(), eg. Explain now opens in new window, we show scripts
-which call sql, etc.
-<p>Perf Monitor UI works with magic quotes enabled.
-<p>rsPrefix was declared twice. Removed.
-<p>Oci8 stored procedure support, eg. "begin func(); end;" was incorrect in _query. Fixed.
-<p>Tiraboschi Massimiliano contributed italian language file.
-<p>Fernando Ortiz, fortiz#lacorona.com.mx, contributed informix performance monitor.
-<p>Added _varchar (varchar arrays) support for postgresql. Reported by PREVOT Stéphane.
-<p><b>3.92 22 Sept 2003</b> 
-<p>Added GetAssoc and CacheGetAssoc to connection object.
-<p>Removed TextMax and CharMax functions from adodb.inc.php. 
-<p>HasFailedTrans() returned false when trans failed. Fixed. 
-<p>Moved perf driver classes into adodb/perf/*.php. 
-<p>Misc improvements to performance monitoring, including UI(). 
-<p>RETVAL in mssql Parameter(), we do not append @ now. 
-<p>Added Param($name) to connection class, returns '?' or ":$name", for defining 
-  bind parameters portably. 
-<p>LogSQL traps affected_rows() and saves its value properly now. Also fixed oci8 
-  _stmt and _affectedrows() bugs. 
-<p>Session code timestamp check for oci8 works now. Formerly default NLS_DATE_FORMAT 
-  stripped off time portion. Thx to Tony Blair (tonanbarbarian#hotmail.com). Also 
-  added new $conn->datetime field to oci8, controls whether MetaType() returns 
-  'D' ($this->datetime==false) or 'T' ($this->datetime == true) for DATE type. 
-<p>Fixed bugs in adodb-cryptsession.inc.php and adodb-session-clob.inc.php. 
-<p>Fixed misc bugs in adodb_key_exists, GetInsertSQL() and GetUpdateSQL(). 
-<p>Tuned include_once handling to reduce file-system checking overhead. 
-<p><b>3.91 9 Sept 2003</b> 
-<p>Only released to InterAkt 
-<p>Added LogSQL() for sql logging and $ADODB_NEWCONNECTION to override factory 
-  for driver instantiation. 
-<p>Added IfNull($field,$ifNull) function, thx to johnwilk#juno.com 
-<p>Added portable substr support. 
-<p>Now rs2html() has new parameter, $echo. Set to false to return $html instead 
-  of echoing it. 
-<p><b>3.90 5 Sept 2003</b> 
-<p>First beta of performance monitoring released. 
-<p>MySQL supports MetaTable() masking. 
-<p>Fixed key_exists() bug in adodb-lib.inc.php 
-<p>Added sp_executesql Prepare() support to mssql. 
-<p>Added bind support to db2. 
-<p>Added swedish language file - Christian Tiberg" christian#commsoft.nu 
-<p>Bug in drop index for mssql data dict fixed. Thx to Gert-Rainer Bitterlich. 
-<p>Left join setting for oci8 was wrong. Thx to johnwilk#juno.com 
-<p><b>3.80 27 Aug 2003</b> 
-<p>Patch for PHP 4.3.3 cached recordset csv2rs() fread loop incompatibility. 
-<p>Added matching mask for MetaTables. Only for oci8, mssql and postgres currently. 
-<p>Rewrite of "oracle" driver connection code, merging with "oci8", by Gaetano. 
-<p>Added better debugging for Smart Transactions. 
-<p>Postgres DBTimeStamp() was wrongly using TO_DATE. Changed to TO_TIMESTAMP. 
-<p>ADODB_FETCH_CASE check pushed to ADONewConnection to allow people to define 
-  it after including adodb.inc.php. 
-<p>Added portugese (brazilian) to languages. Thx to "Levi Fukumori". 
-<p>Removed arg3 parameter from Execute/SelectLimit/Cache* functions. 
-<p>Execute() now accepts 2-d array as $inputarray. Also changed docs of fnExecute() 
-  to note change in sql query counting with 2-d arrays. 
-<p>Added MONEY to MetaType in PostgreSQL. 
-<p>Added more debugging output to CacheFlush(). 
-<p><b>3.72 9 Aug 2003</b> 
-<p>Added qmagic($str), which is a qstr($str) that auto-checks for magic quotes 
-  and does the right thing... 
-<p>Fixed CacheFlush() bug - Thx to martin#gmx.de 
-<p>Walt Boring contributed MetaForeignKeys for postgres7. 
-<p>_fetch() called _BlobDecode() wrongly in interbase. Fixed. 
-<p>adodb_time bug fixed with dates after 2038 fixed by Jason Pell. http://phplens.com/lens/lensforum/msgs.php?id=6980 
-<p><b>3.71 4 Aug 2003</b> 
-<p>The oci8 driver, MetaPrimaryKeys() did not check the owner correctly when $owner 
-  == false. 
-<p>Russian language file contributed by "Cyrill Malevanov" cyrill#malevanov.spb.ru. 
-<p>Spanish language file contributed by "Horacio Degiorgi" horaciod#codigophp.com. 
-<p>Error handling in oci8 bugfix - if there was an error in Execute(), then when 
-  calling ErrorNo() and/or ErrorMsg(), the 1st call would return the error, but 
-  the 2nd call would return no error. 
-<p>Error handling in odbc bugfix. ODBC would always return the last error, even 
-  if it happened 5 queries ago. Now we reset the errormsg to '' and errorno to 
-  0 everytime before CacheExecute() and Execute(). 
-<p><b>3.70 29 July 2003</b> 
-<p>Added new SQLite driver. Tested on PHP 4.3 and PHP 5. 
-<p>Added limited "sapdb" driver support - mainly date support. 
-<p>The oci8 driver did not identify NUMBER with no defined precision correctly. 
-<p>Added ADODB_FORCE_NULLS, if set, then PHP nulls are converted to SQL nulls 
-  in GetInsertSQL/GetUpdateSQL. 
-<p>DBDate() and DBTimeStamp() format for postgresql had problems. Fixed. 
-<p>Added tableoptions to ChangeTableSQL(). Thx to Mike Benoit. 
-<p>Added charset support to postgresql. Thx to Julian Tarkhanov. 
-<p>Changed OS check for MS-Windows to prevent confusion with darWIN (MacOS) 
-<p>Timestamp format for db2 was wrong. Changed to yyyy-mm-dd-hh.mm.ss.nnnnnn. 
-<p>adodb-cryptsession.php includes wrong. Fixed. 
-<p>Added MetaForeignKeys(). Supported by mssql, odbc_mssql and oci8. 
-<p>Fixed some oci8 MetaColumns/MetaPrimaryKeys bugs. Thx to Walt Boring. 
-<p>adodb_getcount() did not init qryRecs to 0. Missing "WHERE" clause checking 
-  in GetUpdateSQL fixed. Thx to Sebastiaan van Stijn. 
-<p>Added support for only 'VIEWS' and "TABLES" in MetaTables. From Walt Boring. 
-<p>Upgraded to adodb-xmlschema.inc.php 0.0.2. 
-<p>NConnect for mysql now returns value. Thx to Dennis Verspuij. 
-<p>ADODB_FETCH_BOTH support added to interbase/firebird. 
-<p>Czech language file contributed by Kamil Jakubovic jake#host.sk. 
-<p>PostgreSQL BlobDecode did not use _connectionID properly. Thx to Juraj Chlebec. 
-<p>Added some new initialization stuff for Informix. Thx to "Andrea Pinnisi" pinnisi#sysnet.it 
-<p>ADODB_ASSOC_CASE constant wrong in sybase _fetch(). Fixed. 
-<p><b>3.60 16 June 2003</b> 
-<p>We now SET CONCAT_NULL_YIELDS_NULL OFF for odbc_mssql driver to be compat with 
-  mssql driver. 
-<p>The property $emptyDate missing from connection class. Also changed 1903 to 
-  constant (TIMESTAMP_FIRST_YEAR=100). Thx to Sebastiaan van Stijn. 
-<p>ADOdb speedup optimization - we now return all arrays by reference. 
-<p>Now DBDate() and DBTimeStamp() now accepts the string 'null' as a parameter. 
-  Suggested by vincent. 
-<p>Added GetArray() to connection class. 
-<p>Added not_null check in informix metacolumns(). 
-<p>Connection parameters for postgresql did not work correctly when port was defined. 
-<p>DB2 is now a tested driver, making adodb 100% compatible. Extensive changes 
-  to odbc driver for DB2, including implementing serverinfo() and SQLDate(), switching 
-  to SQL_CUR_USE_ODBC as the cursor mode, and lastAffectedRows and SelectLimit() 
-  fixes. 
-<p>The odbc driver's FetchField() field names did not obey ADODB_ASSOC_CASE. Fixed. 
-<p>Some bugs in adodb_backtrace() fixed. 
-<p>Added "INT IDENTITY" type to adorecordset::MetaType() to support odbc_mssql 
-  properly. 
-<p>MetaColumns() for oci8, mssql, odbc revised to support scale. Also minor revisions 
-  to odbc MetaColumns() for vfp and db2 compat. 
-<p>Added unsigned support to mysql datadict class. Thx to iamsure. 
-<p>Infinite loop in mssql MoveNext() fixed when ADODB_FETCH_ASSOC used. Thx to 
-  Josh R, Night_Wulfe#hotmail.com. 
-<p>ChangeTableSQL contributed by Florian Buzin. 
-<p>The odbc_mssql driver now sets CONCAT_NULL_YIELDS_NULL OFF for compat with 
-  mssql driver. 
-<hr>
-<p><strong>0.10 Sept 9 2000</strong> First release 
-<h3><strong>Old changelog history moved to <a href=old-changelog.htm>old-changelog.htm</a>. 
-  </strong></h3>
-<p>&nbsp;</p>
-<p> </font> 
-</body>
-</html>
diff --git a/lib/adodb/docs-datadict.htm b/lib/adodb/docs-datadict.htm
deleted file mode 100644 (file)
index aa795c0..0000000
+++ /dev/null
@@ -1,551 +0,0 @@
-<html>
-  <head>
-    <title>ADODB Data Dictionary Manual</title>
-    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-    <style type="text/css">
-      body, td {
-        /*font-family: Arial, Helvetica, sans-serif;*/
-        font-size: 11pt;
-      }
-      pre {
-        font-size: 9pt;
-      }
-      .toplink {
-        font-size: 8pt;
-      }
-    </style>
-  </head>      
-  <body bgcolor="#FFFFFF">
-
-<h2>ADOdb Data Dictionary Library for PHP</h2>
-<p>V4.20 22 Feb 2004 (c) 2000-2004 John Lim (<a href="mailto:jlim#natsoft.com.my">jlim#natsoft.com.my</a>).<br> AXMLS (c) 2004 ars Cognita, Inc</p>
-<p><font size="1">This software is dual licensed using BSD-Style and LGPL. This means you can use it in compiled proprietary and commercial products.</font></p>
-<p>Useful ADOdb links:  <a href=http://php.weblogs.com/adodb?dd=1>Download</a> &nbsp; <a href=http://php.weblogs.com/adodb_manual?dd=1>Other Docs</a></p>
-
-<p>This documentation describes a PHP class library to automate the creation of tables, 
-  indexes and foreign key constraints portably for multiple databases. Richard Tango-Lowy and Dan Cech
-  have been kind enough to contribute <a href=#xmlschema>AXMLS</a>, an XML schema system for defining databases.</p>
-
-<p>Currently the following databases are supported:</p>
-<p>
-  <b>Well-tested:</b> PostgreSQL, MySQL, Oracle, MSSQL.<br />
-  <b>Beta-quality:</b> DB2, Informix, Sybase, Interbase, Firebird.<br />
-  <b>Alpha-quality:</b> MS Access (does not support DEFAULT values) and generic ODBC.
-</p>
-
-<h3>Example Usage</h3>
-<pre>
-  include_once('adodb.inc.php');
-  <font color="#006600"># First create a normal connection</font>
-  $db->NewADOConnection('mysql');
-  $db->Connect(...);
-
-  <font color="#006600"># Then create a data dictionary object, using this connection</font>
-  $dict = <strong>NewDataDictionary</strong>($db);
-
-  <font color="#006600"># We have a portable declarative data dictionary format in ADOdb, similar to SQL.
-  # Field types use 1 character codes, and fields are separated by commas.
-  # The following example creates three fields: "col1", "col2" and "col3":</font>
-  $flds = " 
-  <font color="#663300"><strong> col1 C(32) NOTNULL DEFAULT 'abc',
-   col2 I  DEFAULT 0,
-   col3 N(12.2)</strong></font>
-  ";
-
-  <font color="#006600"># We demonstrate creating tables and indexes</font>
-  $sqlarray = $dict-><strong>CreateTableSQL</strong>($tabname, $flds, $taboptarray);
-  $dict-><strong>ExecuteSQLArray</strong>($sqlarray);<br>
-  $idxflds = 'co11, col2';
-  $sqlarray = $dict-><strong>CreateIndexSQL</strong>($idxname, $tabname, $idxflds);
-  $dict-><strong>ExecuteSQLArray</strong>($sqlarray);
-</pre>
-
-<h3>Functions</h3>
-
-<h4>function CreateDatabase($dbname, $optionsarray=false)</h4>
-<p>Create a database with the name $dbname;</p>
-
-<h4>function CreateTableSQL($tabname, $fldarray, $taboptarray=false)</h4>
-<pre>
-  RETURNS:      an array of strings, the sql to be executed, or false
-  $tabname:     name of table
-  $fldarray:    string (or array) containing field info
-  $taboptarray: array containing table options
-</pre>
-<p>The new format of $fldarray uses a free text format, where each field is comma-delimited.
-The first token for each field is the field name, followed by the type and optional
-field size. Then optional keywords in $otheroptions:</p>
-<pre>  "$fieldname $type $colsize $otheroptions"</pre>
-<p>The older (and still supported) format of $fldarray is a 2-dimensional array, where each row in the 1st dimension represents one field. Each row has this format:</p>
-<pre>  array($fieldname, $type, [,$colsize] [,$otheroptions]*)</pre>
-
-<p>The first 2 fields must be the field name and the field type. The field type can be a portable type codes or the actual type for that database.</p>
-<p>Legal portable type codes include:</p>
-<pre>
-  C:  varchar
-  X:  Largest varchar size 
-  XL: For Oracle, returns CLOB, otherwise same as 'X' above
-
-  C2: Multibyte varchar
-  X2: Multibyte varchar (largest size)
-
-  B:  BLOB (binary large object)
-
-  D:  Date (some databases do not support this, and we return a datetime type)
-  T:  Datetime or Timestamp
-  L:  Integer field suitable for storing booleans (0 or 1)
-  I:  Integer (mapped to I4)
-  I1: 1-byte integer
-  I2: 2-byte integer
-  I4: 4-byte integer
-  I8: 8-byte integer
-  F:  Floating point number
-  N:  Numeric or decimal number
-</pre>
-<p>The $colsize field represents the size of the field. If a decimal number is used, then it is assumed that the number following the dot is the precision, so 6.2 means a number of size 6 digits and 2 decimal places. It is recommended that the default for number types be represented as a string to avoid any rounding errors.</p>
-<p>The $otheroptions include the following keywords (case-insensitive):</p>
-<pre>
-  AUTO            For autoincrement number. Emulated with triggers if not available.
-                  Sets NOTNULL also.
-  AUTOINCREMENT   Same as auto.
-  KEY             Primary key field. Sets NOTNULL also. Compound keys are supported.
-  PRIMARY         Same as KEY.
-  DEF             Synonym for DEFAULT for lazy typists.
-  DEFAULT         The default value. Character strings are auto-quoted unless
-                  the string begins and ends with spaces, eg ' SYSDATE '.
-  NOTNULL         If field is not null.
-  DEFDATE         Set default value to call function to get today's date.
-  DEFTIMESTAMP    Set default to call function to get today's datetime.
-  NOQUOTE         Prevents autoquoting of default string values.
-  CONSTRAINTS     Additional constraints defined at the end of the field
-                  definition.
-</pre>
-<p>The Data Dictonary accepts two formats, the older array specification:</p>
-<pre>
-  $flds = array(
-    array('COLNAME',   'DECIMAL', '8.4', 'DEFAULT' => 0, 'NOTNULL'),
-    array('id',        'I'      , 'AUTO'),
-    array('`MY DATE`', 'D'      , 'DEFDATE'),
-    array('NAME',      'C'      , '32', 'CONSTRAINTS' => 'FOREIGN KEY REFERENCES reftable')
-  );
-</pre>
-<p>Or the simpler declarative format:</p>
-<pre>
-  $flds = "<font color="#660000"><strong>
-    COLNAME DECIMAL(8.4) DEFAULT 0 NOTNULL,
-    id I AUTO,
-    `MY DATE` D DEFDATE,
-    NAME C(32) CONSTRAINTS 'FOREIGN KEY REFERENCES reftable'</strong></font>
-  ";
-</pre>
-<p>Note that if you have special characters in the field name (e.g. My Date), you should enclose it in back-quotes. Normally field names are not case-sensitive, but if you enclose it in back-quotes, some databases treat the names as case-sensitive, and some don't. So be careful.</p>
-
-<p>The $taboptarray is the 3rd parameter of the CreateTableSQL function. This contains table specific settings. Legal keywords include:</p>
-<ul>
-  <li><b>REPLACE</b><br />
-    Indicates that the previous table definition should be removed (dropped)together with ALL data. See first example below.
-  </li>
-  <li><b>DROP</b><br />
-    Drop table. Useful for removing unused tables.
-  </li>
-  <li><b>CONSTRAINTS</b><br />
-    Define this as the key, with the constraint as the value. See the postgresql example below.
-    Additional constraints defined for the whole table. You will probably need to prefix this with a comma.
-  </li>
-</ul>
-
-<p>Database specific table options can be defined also using the name of the database type as the array key. In the following example, <em>create the table as ISAM with MySQL, and store the table in the &quot;users&quot; tablespace if using Oracle</em>. And because we specified REPLACE, drop the table first.</p>
-<pre>  $taboptarray = array('mysql' => 'TYPE=ISAM', 'oci8' => 'tablespace users', 'REPLACE');</pre>
-
-<p>You can also define foreignkey constraints. The following is syntax for postgresql:
-<pre>  $taboptarray = array('constraints' => ', FOREIGN KEY (col1) REFERENCES reftable (refcol)');</pre>
-
-<h4>function DropTableSQL($tabname)</h4>
-<p>Returns the SQL to drop the specified table.</p>
-
-<h4>function ChangeTableSQL($tabname, $flds)</h4>
-<p>Checks to see if table exists, if table does not exist, behaves like CreateTableSQL. 
-  If table exists, generates appropriate ALTER TABLE MODIFY COLUMN commands if 
-  field already exists, or ALTER TABLE ADD $column if field does not exist.</p>
-<p>The class must be connected to the database for ChangeTableSQL to detect the 
-  existence of the table. Idea and code contributed by Florian Buzin.</p>
-
-<h4>function CreateIndexSQL($idxname, $tabname, $flds, $idxoptarray=false)</h4>
-<pre>
-  RETURNS:      an array of strings, the sql to be executed, or false
-  $idxname:     name of index
-  $tabname:     name of table
-  $flds:        list of fields as a comma delimited string or an array of strings
-  $idxoptarray: array of index creation options
-</pre>
-<p>$idxoptarray is similar to $taboptarray in that index specific information can be embedded in the array. Other options include:</p>
-<pre>
-  CLUSTERED     Create clustered index (only mssql)
-  BITMAP        Create bitmap index (only oci8)
-  UNIQUE        Make unique index
-  FULLTEXT      Make fulltext index (only mysql)
-  HASH          Create hash index (only postgres)
-  DROP          Drop legacy index
-</pre>
-
-<h4>function DropIndexSQL ($idxname, $tabname = NULL)</h4>
-<p>Returns the SQL to drop the specified index.</p>
-
-<h4>function AddColumnSQL($tabname, $flds)</h4>
-<p>Add one or more columns. Not guaranteed to work under all situations.</p>
-
-<h4>function AlterColumnSQL($tabname, $flds)</h4>
-<p>Warning, not all databases support this feature.</p>
-
-<h4>function DropColumnSQL($tabname, $flds)</h4>
-<p>Drop 1 or more columns.</p>
-
-<h4>function SetSchema($schema)</h4>
-<p>Set the schema.</p>
-
-<h4>function &amp;MetaTables()</h4>
-<h4>function &amp;MetaColumns($tab, $upper=true, $schema=false)</h4>
-<h4>function &amp;MetaPrimaryKeys($tab,$owner=false,$intkey=false)</h4>
-<h4>function &amp;MetaIndexes($table, $primary = false, $owner = false)</h4>
-<p>These functions are wrappers for the corresponding functions in the connection object.  However, the table names will be autoquoted by the TableName function (see below) before being passed to the connection object.</p>
-
-<h4>function NameQuote($name = NULL)</h4>
-<p>If the provided name is quoted with backquotes (`) or contains special characters, returns the name quoted with the appropriate quote character, otherwise the name is returned unchanged.</p>
-
-<h4>function TableName($name)</h4>
-<p>The same as NameQuote, but will prepend the current schema if specified</p>
-
-<h4>function MetaType($t,$len=-1,$fieldobj=false)</h4>
-<h4>function ActualType($meta)</h4>
-<p>Convert between database-independent 'Meta' and database-specific 'Actual' type codes.</p>
-
-<h4>function ExecuteSQLArray($sqlarray, $contOnError = true)</h4>
-<pre>
-  RETURNS:      0 if failed, 1 if executed all but with errors, 2 if executed successfully
-  $sqlarray:    an array of strings with sql code (no semicolon at the end of string)
-  $contOnError: if true, then continue executing even if error occurs
-</pre>
-<p>Executes an array of SQL strings returned by CreateTableSQL or CreateIndexSQL.</p>
-
-<hr />
-
-<a name=xmlschema></a>
-<h2>ADOdb XML Schema (AXMLS)</h2>
-<p>This is a class contributed by Richard Tango-Lowy and Dan Cech that allows the user to quickly
-and easily build a database using the excellent ADODB database library and a simple XML formatted file.
-You can <a href=http://sourceforge.net/projects/adodb-xmlschema/>download the latest version of AXMLS here</a>.</p>
-
-<h3>Quick Start</h3>
-<p>First, create an XML database schema. Let's call it "schema.xml:"</p>
-<pre>
-  &lt;?xml version="1.0"?&gt;
-  &lt;schema version=&quot;0.2&quot;&gt;
-    &lt;table name="mytable"&gt;
-      &lt;field name="row1" type="I"&gt;
-        &lt;descr&gt;An integer row that's a primary key and autoincrements&lt;/descr&gt;
-        &lt;KEY/&gt;
-        &lt;AUTOINCREMENT/&gt;
-      &lt;/field&gt;
-      &lt;field name="row2" type="C" size="16"&gt;
-        &lt;descr&gt;A 16 character varchar row that can't be null&lt;/descr&gt;
-        &lt;NOTNULL/&gt;
-      &lt;/field&gt;
-      &lt;index name=&quot;myindex&quot;&gt;
-        &lt;col&gt;row1&lt;/col&gt;
-        &lt;col&gt;row2&lt;/col&gt;
-      &lt;/index&gt;
-    &lt;/table&gt;
-    &lt;sql&gt;
-      &lt;descr&gt;SQL to be executed only on specific platforms&lt;/descr&gt;
-      &lt;query platform="postgres|postgres7"&gt;
-        insert into mytable ( row1, row2 ) values ( 12, 'stuff' )
-      &lt;/query&gt;
-      &lt;query platform="mysql"&gt;
-        insert into mytable ( row1, row2 ) values ( 12, 'different stuff' )
-      &lt;/query&gt;
-    &lt;/sql&gt;
-  &lt;/schema&gt;
-</pre>
-
-<p>Create a new database using the appropriate tool for your platform.<br />
-Executing the following PHP code will create the a <i>mytable</i> and <i>myindex</i>
-in the database and insert one row into <i>mytable</i> if the platform is postgres or mysql.</p>
-
-<pre>
-  include_once('/path/to/adodb.inc.php');
-  include_once('/path/to/adodb-xmlschema.inc.php');
-
-  <font color="#006600">// To build the schema, start by creating a normal ADOdb connection:</font>
-  $db->NewADOConnection( 'mysql' );
-  $db->Connect( ... );
-
-  <font color="#006600">// Create the schema object and build the query array.</font>
-  $schema = new <b>adoSchema</b>( $db );
-
-  <font color="#006600">// Optionally, set a prefix for newly-created tables. In this example
-  // the prefix "myprefix_" will result in a table named "myprefix_tablename".</font>
-  $schema-><b>SetPrefix</b>( 'myprefix_' );
-
-  <font color="#006600">// Build the SQL array</font>
-  $schema-><b>ParseSchema</b>( 'schema.xml' );
-
-  <font color="#006600">// Execute the SQL on the database</font>
-  $result = $schema-><b>ExecuteSchema</b>();
-
-  <font color="#006600">// Finally, clean up after the XML parser
-  // (PHP won't do this for you!)</font>
-  $schema-><b>Destroy</b>();
-</pre>
-
-
-<h3>Using AXMLS in Your 
-                       Application</h3>
-       
-       <p>
-There are two steps involved in using 
-                               AXMLS in your application: first, 
-                               you must create a schema, or XML representation of your 
-                               database, and second, you must create the PHP code that will 
-                               parse and execute the schema.</p>
-               <p>Let's begin with a schema that describes a typical, if simplistic 
-                       user management table for an application.</p>
-               <pre class="listing"><pre>
-&lt;?xml version=&quot;1.0&quot;?&gt;
-&lt;schema version=&quot;0.2&quot;&gt;
-
-  &lt;table name=&quot;users&quot;&gt;
-    &lt;desc&gt;A typical users table for our application.&lt;/desc&gt;
-    &lt;field name=&quot;userId&quot; type=&quot;I&quot;&gt;
-      &lt;descr&gt;A unique ID assigned to each user.&lt;/descr&gt;
-      &lt;KEY/&gt;
-      &lt;AUTOINCREMENT/&gt;
-    &lt;/field&gt;
-    
-    &lt;field name=&quot;userName&quot; type=&quot;C&quot; size=&quot;16&quot;&gt;&lt;NOTNULL/&gt;&lt;/field&gt;
-    
-    &lt;index name=&quot;userName&quot;&gt;
-      &lt;descr&gt;Put a unique index on the user name&lt;/descr&gt;
-      &lt;col&gt;userName&lt;/col&gt;
-      &lt;UNIQUE/&gt;
-    &lt;/index&gt;
-  &lt;/table&gt;
-  
-  &lt;sql&gt;
-    &lt;descr&gt;Insert some data into the users table.&lt;/descr&gt;
-    &lt;query&gt;insert into users (userName) values ( 'admin' )&lt;/query&gt;
-    &lt;query&gt;insert into users (userName) values ( 'Joe' )&lt;/query&gt;
-  &lt;/sql&gt;
-&lt;/schema&gt;                        
-</pre></pre>
-               <p>Let's take a detailed look at this schema.</p>
-               <p>The opening &lt;?xml version=&quot;1.0&quot;?&gt; tag is 
-                                       required by XML. The &lt;schema&gt; tag 
-                                       tells the parser that the enclosed markup defines an XML 
-                                       schema. The version=&quot;0.2&quot; attribute sets 
-                                       <em>the version of the AXMLS DTD used by the XML 
-                                       schema.</em> <p>All versions of AXMLS prior 
-                                       to version 1.0 have a schema version of &quot;0.1&quot;. The current 
-                                       schema version is &quot;0.2&quot;.</p></p>
-                               <pre class="listing"><pre>
-&lt;?xml version=&quot;1.0&quot;?&gt;
-&lt;schema version=&quot;0.2&quot;&gt;
-  ...
-&lt;/schema&gt;
-</pre></pre>
-                       <p>Next we define one or more tables. A table consists of a 
-                                       fields (and other objects) enclosed by 
-                                       &lt;table&gt; tags. The 
-                                       name=&quot;&quot; attribute specifies the name of 
-                                       the table that will be created in the database.</p>
-                               <pre class="listing"><pre>
-&lt;table name=&quot;users&quot;&gt;
-
-    &lt;desc&gt;A typical users table for our application.&lt;/desc&gt;
-    &lt;field name=&quot;userId&quot; type=&quot;I&quot;&gt;
-      &lt;descr&gt;A unique ID assigned to each user.&lt;/descr&gt;
-      &lt;KEY/&gt;
-      &lt;AUTOINCREMENT/&gt;
-    &lt;/field&gt;
-    
-    &lt;field name=&quot;userName&quot; type=&quot;C&quot; size=&quot;16&quot;&gt;&lt;NOTNULL/&gt;&lt;/field&gt;
-    
-&lt;/table&gt;
-</pre></pre>
-                               <p>This table is called &quot;users&quot; and has a description and 
-                                       two fields. The description is optional, and is currently 
-                                       only for your own information; it is not applied to the 
-                                       database.</p>
-                               <p>The first &lt;field&gt; tag will create 
-                                       a field named &quot;userId&quot; of type &quot;I&quot;, or integer. (See the 
-                                       ADOdb Data Dictionary 
-                                       documentation for a list of valid types.) This 
-                                       &lt;field&gt; tag encloses two special 
-                                       field options: &lt;KEY/&gt;, which 
-                                       specifies this field as a primary key, and 
-                                       &lt;AUTOINCREMENT/&gt;, which specifies 
-                                       that the database engine should automatically fill this 
-                                       field with the next available value when a new row is 
-                                       inserted.</p>
-                               <p>The second &lt;field&gt; tag will create 
-                                       a field named &quot;userName&quot; of type &quot;C&quot;, or character, and of 
-                                       length 16 characters. The &lt;NOTNULL/&gt; 
-                                       option specifies that this field does not allow 
-                                       NULLs.</p>
-                       <p>There are two ways to add indexes to a table. The 
-                                       simplest is to mark a field with the 
-                                       &lt;KEY/&gt; option as described above; a 
-                                       primary key is a unique index. The second and more powerful 
-                                       method uses the &lt;index&gt; tags.</p>
-                               <pre class="listing"><pre>
-&lt;table name=&quot;users&quot;&gt;
-  ...
-    
-  &lt;index name=&quot;userName&quot;&gt;
-    &lt;descr&gt;Put a unique index on the user name&lt;/descr&gt;
-    &lt;col&gt;userName&lt;/col&gt;
-    &lt;UNIQUE/&gt;
-  &lt;/index&gt;
-    
-&lt;/table&gt;
-</pre></pre>
-                               <p>The &lt;index&gt; tag specifies that an 
-                                       index should be created on the enclosing table. The 
-                                       name=&quot;&quot; attribute provides the name of the 
-                                       index that will be created in the database. The 
-                                       description, as above, is for your information only. The 
-                                       &lt;col&gt; tags list each column that 
-                                       will be included in the index. Finally, the 
-                                       &lt;UNIQUE/&gt; tag specifies that this 
-                                       will be created as a unique index.</p>
-                       <p>Finally, AXMLS allows you to include arbitrary SQL that 
-                                       will be applied to the database when the schema is 
-                                       executed.</p>
-                               <pre class="listing"><pre>
-&lt;sql&gt;
-  &lt;descr&gt;Insert some data into the users table.&lt;/descr&gt;
-  &lt;query&gt;insert into users (userName) values ( 'admin' )&lt;/query&gt;
-  &lt;query&gt;insert into users (userName) values ( 'Joe' )&lt;/query&gt;
-&lt;/sql&gt;
-</pre></pre>
-                               <p>The &lt;sql&gt; tag encloses any number 
-                                       of SQL queries that you define for your own use.</p>
-               <p>Now that we've defined an XML schema, you need to know how to 
-                       apply it to your database. Here's a simple PHP script that shows 
-                       how to load the schema.</p>
-               <p><pre class="listing"><pre>
-&lt;?PHP
-/* You must tell the script where to find the ADOdb and
- * the AXMLS libraries.
- */
-require( &quot;path_to_adodb/adodb.inc.php&quot;);
-require( &quot;path_to_adodb/adodb-xmlschema.inc.php&quot; );
-
-/* Configuration information. Define the schema filename,
- * RDBMS platform (see the ADODB documentation for valid
- * platform names), and database connection information here.
- */
-$schemaFile = 'example.xml';
-$platform = 'mysql';
-$dbHost = 'localhost';
-$dbName = 'database';
-$dbUser = 'username';
-$dbPassword = 'password';
-
-/* Start by creating a normal ADODB connection.
- */
-$db = ADONewConnection( $platform );
-$db-&gt;Connect( $dbHost, $dbUser, $dbPassword, $dbName );
-
-/* Use the database connection to create a new adoSchema object.
- */
-$schema = new adoSchema( $db );
-
-/* Call ParseSchema() to build SQL from the XML schema file.
- * Then call ExecuteSchema() to apply the resulting SQL to 
- * the database.
- */
-$sql = $schema-&gt;ParseSchema( $schemaFile );
-$result = $schema-&gt;ExecuteSchema();
-?&gt;
-</pre></pre></p>
-               <p>Let's look at each part of the example in turn. After you 
-                       manually create the database, there are three steps required to 
-                       load (or upgrade) your schema.</p>
-               <p>First, create a normal ADOdb connection. The variables 
-                                       and values here should be those required to connect to your 
-                                       database.</p>
-                               <pre class="listing"><pre>
-$db = ADONewConnection( 'mysql' );
-$db-&gt;Connect( 'host', 'user', 'password', 'database' );
-</pre></pre>
-                       <p>Second, create the adoSchema object that load and 
-                                       manipulate your schema. You must pass an ADOdb database 
-                                       connection object in order to create the adoSchema 
-                                       object.</p>
-                               <pre class="listing"><pre>
-$schema = new adoSchema( $db );
-</pre></pre>
-                       <p>Third, call ParseSchema() to parse the 
-                                       schema and then ExecuteSchema() to apply 
-                                       it to the database. You must pass 
-                                       ParseSchema() the path and filename of 
-                                       your schema file.</p>
-                               <pre class="listing"><pre>
-$schema-&gt;ParseSchema( $schemaFile ); 
-$schema-&gt;ExecuteSchema(); 
-</pre></pre>
-               <p>Execute the above code and then log into your database. If you've 
-                       done all this right, you should see your tables, indexes, and 
-                       SQL.</p>
-               <p>You can find the source files for this tutorial in the 
-                       examples directory as 
-                       tutorial_shema.xml and 
-                       tutorial.php. See the class documentation for 
-                       a more detailed description of the adoSchema methods, including 
-                       methods and schema elements that are not described in this 
-                       tutorial.</p>
-
-<H3>XML Schema Format:</H3>
-<P>(See <a href="xmlschema.dtd">xmlschema.dtd</a> for the full specification)</P>
-<PRE>
-  &lt;?xml version="1.0"?&gt;
-  &lt;schema version=&quot;0.2&quot;&gt;
-    &lt;table name="tablename" platform="platform1|platform2|..."&gt;
-      &lt;descr&gt;Optional description&lt;/descr&gt;
-      &lt;field name="fieldname" type="datadict_type" size="size"&gt;
-        &lt;KEY/&gt;
-        &lt;NOTNULL/&gt;
-        &lt;AUTOINCREMENT/&gt;
-        &lt;DEFAULT value="value"/&gt;
-      &lt;/field&gt;
-      <i> ... more fields</i>
-      &lt;index name="indexname" platform="platform1|platform2|..."&gt;
-        &lt;descr&gt;Optional description&lt;/descr&gt;
-        &lt;col&gt;fieldname&lt;/col&gt;
-        <i> ... more columns</i>
-      &lt;/index&gt;
-      <i> ... more indexes</i>
-    &lt;/table&gt;
-    <i> ... more tables</i>
-
-    &lt;sql platform="platform1|platform2|..."&gt;
-      &lt;descr&gt;Optional description&lt;/descr&gt;
-      &lt;query platform="platform1|platform2|..."&gt;SQL query&lt;/query&gt;
-      <i> ... more queries</i>
-    &lt;/sql&gt;
-    <i> ... more SQL</i>
-  &lt;/schema&gt;
-</pre>
-
-<h3>Upgrading</h3>
-If your schema version is older, than XSLT is used to transform the schema to the newest version. 
-This means that if you are using an older XML schema format,  you need to have the XSLT extension installed.
-If you do not want to require your users to have the XSLT extension installed, make sure you 
-modify your XML schema to conform to the latest version.
-<hr />
-
-<address>If you have any questions or comments, please email them to Richard at richtl#arscognita.com.
-</address>
-
-</body>
-</html>
\ No newline at end of file
diff --git a/lib/adodb/docs-perf.htm b/lib/adodb/docs-perf.htm
deleted file mode 100644 (file)
index a7883cd..0000000
+++ /dev/null
@@ -1,386 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-
-<html>
-<head>
-       <title>ADOdb Performance Monitoring Library</title>
-</head>
-
-<body>
-<h3>The ADOdb Performance Monitoring Library</h3>
-<p>V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim#natsoft.com.my)</p>
-<p><font size="1">This software is dual licensed using BSD-Style and LGPL. This 
-  means you can use it in compiled proprietary and commercial products.</font></p>
-  <p>Useful ADOdb links:  <a href=http://php.weblogs.com/adodb?perf=1>Download</a> &nbsp; <a href=http://php.weblogs.com/adodb_manual?perf=1>Other Docs</a>
-<h3>Introduction</h3>
-<p>This module, part of the ADOdb package, provides both CLI and HTML interfaces 
-  for viewing key performance indicators of your database. This is very useful 
-  because web apps such as the popular phpMyAdmin currently do not provide effective 
-  database health monitoring tools. The module provides the following: 
-<ul>
-  <li>A quick health check of your database server using <code>$perf->HealthCheck()</code> 
-    or <code>$perf->HealthCheckCLI()</code>. 
-  <li>User interface for performance monitoring, <code>$perf-&gt;UI()</code>. 
-    This UI displays: 
-    <ul>
-      <li>the health check, </li>
-      <li>all SQL logged and their query plans, </li>
-      <li>a list of all tables in the current database</li>
-      <li>an interface to continiously poll the server for key performance indicators 
-        such as CPU, Hit Ratio, Disk I/O</li>
-               <li>a form where you can enter and run SQL interactively.</li>
-    </ul>
-  <li>Gives you an API to build database monitoring tools for a server farm, for 
-    example calling <code>$perf->DBParameter('data cache hit ratio')</code> returns 
-    this very important statistic in a database independant manner. 
-</ul>
-<p>ADOdb also has the ability to log all SQL executed, using <a href=docs-adodb.htm#logsql>LogSQL</a>. 
-  All SQL logged can be analyzed through the performance monitor <a href=#ui>UI</a>. 
-  In the <i>View SQL</i> mode, we categorize the SQL into 3 types:
-<ul>
-  <li><b>Suspicious SQL</b>: queries with high average execution times, and are potential 
-    candidates for rewriting</li>
-  <li><b>Expensive SQL</b>: queries with high total execution times (#executions * avg 
-    execution time). Optimizing these queries will reduce your database server 
-    load.</li>
-  <li><b>Invalid SQL</b>: queries that generate errors.</li>
-</ul>
-<p>Each query is hyperlinked to a description of the query plan, and every PHP 
-  script that executed that query is also shown.</p>
-<p>Please note that the information presented is a very basic database health 
-  check, and does not provide a complete overview of database performance. Although 
-  some attempt has been made to make it work across multiple databases in the 
-  same way, it is impossible to do so. For the health check, we do try to display 
-  the following key database parameters for all drivers:</p>
-<ul>
-  <li><b>data cache size</b> - The amount of memory allocated to the cache.</li>
-  <li><b>data cache hit ratio</b> - A measure of how effective the cache is, as a percentage. 
-  The higher, the better.</li>
-  <li><b>current connections</b> - The number of sessions currently connected to the 
-    database. </li>
-</ul>
-<p>You will need to connect to the database as an administrator to view most of 
-  the parameters. </p>
-<p>Code improvements as very welcome, particularly adding new database parameters 
-  and automated tuning hints.</p><a name=usage></a>
-<h3>Usage</h3>
-<p>Currently, the following drivers: <em>mysql</em>, <em>postgres</em>, <em>oci8</em>, 
-  <em>mssql</em>, <i>informix</i> and <em>db2</em> are supported. To create a 
-  new performance monitor, call NewPerfMonitor( ) as demonstrated below: </p>
-<pre>
-&lt;?php
-include_once('adodb.inc.php');
-session_start(); <font color="#006600"># session variables required for monitoring</font>
-$conn = ADONewConnection($driver);
-$conn-&gt;Connect($server,$user,$pwd,$db);
-$perf =&amp; NewPerfMonitor($conn);
-$perf-&gt;UI($pollsecs=5);<font color="#006600"></font>
-?>
-</pre>
-<p>It is also possible to retrieve a single database parameter:</p>
-<pre>$size = $perf->DBParameter('data cache size');
-</pre>
-<p>
-Thx to Fernando Ortiz for the informix module. 
-<h3>Methods</h3><a name=ui></a>
-<p><font face="Courier New, Courier, mono">function <b>UI($pollsecs=5)</b></font></p>
-<p>Creates a web-based user interface for performance monitoring. When you click on Poll, 
-server statistics will be displayed every $pollsecs seconds.  See <a href="#usage">Usage</a> 
-  above. 
-  <p>Since 4.11, we allow users to enter and run SQL interactively via the "Run SQL" link. To disable
-  this for security reasons, set this constant before calling $perf->UI().
-  <p>
-    <pre>define('ADODB_PERF_NO_RUN_SQL',1);</pre>
-  
- <p>Sample output follows below:</p>
-
-<table border=1 width=100% bgcolor=lightyellow><tr>
-    <td> <b><a href=http://php.weblogs.com/adodb?perf=1>ADOdb</a> Performance 
-      Monitor</b> for localhost, db=test<br>
-      <font size=-1>PostgreSQL 7.3.2 on i686-pc-cygwin, compiled by GCC gcc (GCC) 
-      3.2 20020927 (prerelease)</font></tr>
-         <tr><td>
-       <a href=#>Performance Stats</a> &nbsp; <a href=#>View SQL</a>
-        &nbsp; <a href=#>View Tables</a> &nbsp; <a href=#>Poll Stats</a></tr></table><table border=1 bgcolor=white><tr><td colspan=3><h3>postgres7</h3></td></tr><tr><td><b>Parameter</b></td><td><b>Value</b></td><td><b>Description</b></td></tr><tr bgcolor=#F0F0F0><td colspan=3><i>Ratios</i> &nbsp;</td></tr><tr><td>statistics collector</td><td>TRUE</td><td>Value must be TRUE to enable hit ratio statistics (<i>stats_start_collector</i>,<i>stats_row_level</i> and <i>stats_block_level</i> must be set to true in postgresql.conf)</td></tr>
-<tr><td>data cache hit ratio</td><td>99.7967555299239</td><td>&nbsp;</td></tr>
-<tr bgcolor=#F0F0F0><td colspan=3><i>IO</i> &nbsp;</td></tr><tr><td>data reads</td><td>125</td><td>&nbsp;  </td></tr>
-<tr><td>data writes</td><td>21.78125000000000000</td><td>Count of inserts/updates/deletes * coef</td></tr>
-<tr bgcolor=#F0F0F0><td colspan=3><i>Data Cache</i> &nbsp;</td></tr><tr><td>data cache buffers</td><td>640</td><td>Number of cache buffers. <a href=http://www.varlena.com/GeneralBits/Tidbits/perf.html#basic>Tuning</a></td></tr>
-<tr><td>cache blocksize</td><td>8192</td><td>(estimate)</td></tr>
-<tr><td>data cache size</td><td>5M</td><td>&nbsp;</td></tr>
-<tr><td>operating system cache size</td><td>80M</td><td>(effective cache size)</td></tr>
-<tr bgcolor=#F0F0F0><td colspan=3><i>Memory Usage</i> &nbsp;</td></tr><tr><td>sort buffer size</td><td>1M</td><td>Size of sort buffer (per query)</td></tr>
-<tr bgcolor=#F0F0F0><td colspan=3><i>Connections</i> &nbsp;</td></tr><tr><td>current connections</td><td>0</td><td>&nbsp;</td></tr>
-<tr><td>max connections</td><td>32</td><td>&nbsp;</td></tr>
-<tr bgcolor=#F0F0F0><td colspan=3><i>Parameters</i> &nbsp;</td></tr><tr><td>rollback buffers</td><td>8</td><td>WAL buffers</td></tr>
-<tr><td>random page cost</td><td>4</td><td>Cost of doing a seek (default=4). See <a href=http://www.varlena.com/GeneralBits/Tidbits/perf.html#less>random_page_cost</a></td></tr>
-</table>
-<p><font face="Courier New, Courier, mono">function <b>HealthCheck</b>()</font></p> 
-<p>Returns database health check parameters as a HTML table. You will need to 
-  echo or print the output of this function,</p>
-<p><font face="Courier New, Courier, mono">function <b>HealthCheckCLI</b>()</font></p>
-<p>Returns database health check parameters formatted for a command line interface. 
-  You will need to echo or print the output of this function. Sample output for 
-  mysql:</p>
-<pre>
--- Ratios -- 
-          MyISAM cache hit ratio => 56.5635738832 
-          InnoDB cache hit ratio => 0 
-             sql cache hit ratio => 0 
- -- IO -- 
-                      data reads => 2622 
-                     data writes => 2415.5 
- -- Data Cache -- 
-          MyISAM data cache size => 512K 
-             BDB data cache size => 8388600
-          InnoDB data cache size => 8M
- -- Memory Pools -- 
-                read buffer size => 131072 
-                sort buffer size => 65528 
-                     table cache => 4 
- -- Connections -- 
-             current connections => 3
-                 max connections => 100</pre>
-<p><font face="Courier New, Courier, mono">function <b>Poll</b>($pollSecs=5) 
-  </font> 
-<p> Run in infinite loop, displaying the following information every $pollSecs. 
-  This will not work properly if output buffering is enabled. 
-  In the example below, $pollSecs=3:
-<pre>
-Accumulating statistics...
- Time   WS-CPU%   Hit%   Sess        Reads/s          Writes/s
-11:08:30    0.7  56.56      1         0.0000            0.0000
-11:08:33    1.8  56.56      2         0.0000            0.0000
-11:08:36   11.1  56.55      3         2.5000            0.0000
-11:08:39    9.8  56.55      2         3.1121            0.0000
-11:08:42    2.8  56.55      1         0.0000            0.0000
-11:08:45    7.4  56.55      2         0.0000            1.5000
-</pre>
-<p><b>WS-CPU%</b> is the Web Server CPU load of the server that PHP is running 
-  from (eg. the database client), and not the database. The <b>Hit%</b> is the 
-  data cache hit ratio. <b>Sess</b> is the current number of sessions connected 
-  to the database. If you are using persistent connections, this should not change 
-  much. The <b>Reads/s</b> and <b>Writes/s</b> are synthetic values to give the 
-  viewer a rough guide to I/O, and are not to be taken literally. 
-<p><font face="Courier New, Courier, mono">function <b>SuspiciousSQL</b>($numsql=10)</font></p>
-<p>Returns SQL which have high average execution times as a HTML table. Each sql statement
-is hyperlinked to a new window which details the execution plan and the scripts that execute this SQL.
-<p> The number of statements returned is determined by $numsql. Data is taken from the adodb_logsql table, where the sql statements are logged when
-$connection->LogSQL(true) is enabled. The adodb_logsql table is populated using <a href=docs-adodb.htm#logsql>$conn->LogSQL</a>.
-<p>For Oracle, Ixora Suspicious SQL returns a list of SQL statements that are most cache intensive as a HTML table. 
-  These are data intensive SQL statements that could benefit most from tuning. 
-<p><font face="Courier New, Courier, mono">function <b>ExpensiveSQL</b>($numsql=10)</font></p>
-<p>Returns SQL whose total execution time (avg time * #executions) is high as a HTML table. Each sql statement
-is hyperlinked to a new window which details the execution plan and the scripts that execute this SQL.
-<p> The number of statements returned is determined by $numsql. Data is taken from the adodb_logsql table, where the sql statements are logged when
-$connection->LogSQL(true) is enabled. The adodb_logsql table is populated using <a href=docs-adodb.htm#logsql>$conn->LogSQL</a>.
-
-<p>For Oracle, Ixora Expensive SQL returns a list of SQL statements that are taking the most CPU load 
-when run.
-<p><font face="Courier New, Courier, mono">function <b>InvalidSQL</b>($numsql=10)</font></p>
-<p>Returns a list of invalid SQL as an HTML table.
-<p>Data is taken from the adodb_logsql table, where the sql statements are logged when
-$connection->LogSQL(true) is enabled.
-<p><font face="Courier New, Courier, mono">function <b>Tables</b>($orderby=1)</font></p>
-<p>Returns information on all tables in a database, with the first two fields 
-  containing the table name and table size, the remaining fields depend on the 
-  database driver. If $orderby is set to 1, it will sort by name. If $orderby 
-  is set to 2, then it will sort by table size. Some database drivers (mssql and 
-  mysql) will ignore the $orderby clause. For postgresql, the information is up-to-date 
-  since the last <i>vacuum</i>. Not supported currently for db2.</p>
-<h3>Raw Functions</h3>
-<p>Raw functions return values without any formatting.</p>
-<p><font face="Courier New, Courier, mono">function <b>DBParameter</b>($paramname)</font></p>
-<p>Returns the value of a database parameter, such as $this-&gt;DBParameter(&quot;data 
-  cache size&quot;).</p>
-<p><font face="Courier New, Courier, mono">function <b>CPULoad</b>()</font></p>
-<p>Returns the CPU load of the database client (NOT THE SERVER) as a percentage. 
-  Only works for Linux and Windows. For Windows, WMI must be available.</p>
-<h3>Format of $settings Property</h3>
-<p> To create new database parameters, you need to understand $settings. The $settings 
-  data structure is an associative array. Each element of the array defines a 
-  database parameter. The key is the name of the database parameter. If no key is defined,
-  then it is assumed to be a section break, and the value is the name of the section break.
-  If this is too confusing, looking at the source code will help a lot!</p>
-<p> Each database parameter is itself an array consisting of the following elements:</p>
-<ol start="0">
-  <li> Category code, used to group related db parameters. If the category code is 'HIDE', then
-the database parameter is not shown when HTML() is called. <br>
-  </li>
-  <li> either 
-    <ol type="a">
-      <li>sql string to retrieve value, eg. "select value from v\$parameter where 
-        name='db_block_size'", </li>
-      <li>array holding sql string and field to look for, e.g. array('show variables','table_cache'); 
-        optional 3rd parameter is the $rs-&gt;fields[$index] to use (otherwise 
-        $index=1), and optional 4th parameter is a constant to multiply the result 
-        with (typically 100 for percentage calculations),</li>
-      <li>a string prefixed by =, then a PHP method of the class is invoked, e.g. 
-        to invoke $this->GetIndexValue(), set this array element to '=GetIndexValue', 
-        <br>
-      </li>
-    </ol>
-  </li>
-  <li> Description of database parameter. If description begins with an =, then 
-    it is interpreted as a method call, just as in (1c) above, taking one parameter, 
-    the current value. E.g. '=GetIndexDescription' will invoke $this->GetIndexDescription($val). 
-    This is useful for generating tuning suggestions. For an example, see WarnCacheRatio().</li>
-</ol>
-<p>Example from MySQL, table_cache database parameter:</p>
-<pre>'table cache' =&gt; array('CACHE',            # category code
-   array(&quot;show variables&quot;, 'table_cache'), # array (type 1b)
-   'Number of tables to keep open'),       # description</pre>
-<h3>Example Health Check Output</h3>
-<p><a href="#db2">db2</a> <a href=#informix>informix</a> <a href="#mysql">mysql</a> <a href="#mssql">mssql</a> 
-  <a href="#oci8">oci8</a> <a href="#postgres">postgres</a></p>
-<p><a name=db2></a></p>
-<table border=1 bgcolor=white>
-  <tr> 
-    <td colspan=3> <h3>db2</h3></td>
-  </tr>
-  <tr> 
-    <td><b>Parameter</b></td>
-    <td><b>Value</b></td>
-    <td><b>Description</b></td>
-  </tr>
-  <tr bgcolor=#F0F0F0> 
-    <td colspan=3><i>Ratios</i> &nbsp;</td>
-  </tr>
-  <tr bgcolor=#FFFFFF> 
-    <td>data cache hit ratio</td>
-    <td>0 &nbsp; </td>
-    <td>&nbsp;</td>
-  </tr>
-  <tr bgcolor=#F0F0F0>
-    <td colspan=3><i>Data Cache</i></td>
-  </tr>
-  <tr bgcolor=#FFFFFF> 
-    <td>data cache buffers</td>
-    <td>250 &nbsp; </td>
-    <td>See <a href=http://www7b.boulder.ibm.com/dmdd/library/techarticle/anshum/0107anshum.html#bufferpoolsize>tuning 
-      reference</a>.</td>
-  </tr>
-  <tr bgcolor=#FFFFFF> 
-    <td>cache blocksize</td>
-    <td>4096 &nbsp; </td>
-    <td>&nbsp;</td>
-  </tr>
-  <tr bgcolor=#FFFFFF> 
-    <td>data cache size</td>
-    <td>1000K &nbsp; </td>
-    <td>&nbsp;</td>
-  </tr>
-  <tr bgcolor=#F0F0F0> 
-    <td colspan=3><i>Connections</i></td>
-  </tr>
-  <tr bgcolor=#FFFFFF> 
-    <td>current connections</td>
-    <td>2 &nbsp; </td>
-    <td>&nbsp;</td>
-  </tr>
-</table>
-<p>&nbsp;<p>
-<a name=informix></a>
-<table border=1 bgcolor=white><tr><td
-colspan=3><h3>informix</h3></td></tr><tr><td><b>Parameter</b></td><td><b>Val
-ue</b></td><td><b>Description</b></td></tr><tr bgcolor=#F0F0F0><td
-colspan=3><i>Ratios</i> &nbsp;</td></tr><tr><td>data cache hit
-ratio</td><td>95.89</td><td>&nbsp;</td></tr>
-<tr bgcolor=#F0F0F0><td colspan=3><i>IO</i> &nbsp;</td></tr><tr><td>data
-reads</td><td>1883884</td><td>Page reads</td></tr>
-<tr><td>data writes</td><td>1716724</td><td>Page writes</td></tr>
-<tr bgcolor=#F0F0F0><td colspan=3><i>Connections</i>
-&nbsp;</td></tr><tr><td>current connections</td><td>263.0</td><td>Number of
-sessions</td></tr>
-</table>
-
-
-<p>&nbsp;</p>
-<p><a name=mysql id="mysql"></a></p><table border=1 bgcolor=white><tr><td colspan=3><h3>mysql</h3></td></tr><tr><td><b>Parameter</b></td><td><b>Value</b></td><td><b>Description</b></td></tr><tr bgcolor=#F0F0F0><td colspan=3><i>Ratios</i> &nbsp;</td></tr><tr><td>MyISAM cache hit ratio</td><td>56.5658301822</td><td><font color=red><b>Cache ratio should be at least 90%</b></font></td></tr>
-<tr><td>InnoDB cache hit ratio</td><td>0</td><td><font color=red><b>Cache ratio should be at least 90%</b></font></td></tr>
-<tr><td>sql cache hit ratio</td><td>0</td><td>&nbsp;</td></tr>
-<tr bgcolor=#F0F0F0><td colspan=3><i>IO</i> &nbsp;</td></tr><tr><td>data reads</td><td>2622</td><td>Number of selects (Key_reads is not accurate)</td></tr>
-<tr><td>data writes</td><td>2415.5</td><td>Number of inserts/updates/deletes * coef (Key_writes is not accurate)</td></tr>
-<tr bgcolor=#F0F0F0><td colspan=3><i>Data Cache</i> &nbsp;</td></tr><tr><td>MyISAM data cache size</td><td>512K</td><td>&nbsp;</td></tr>
-<tr><td>BDB data cache size</td><td>8388600</td><td>&nbsp;</td></tr>
-<tr><td>InnoDB data cache size</td><td>8M</td><td>&nbsp;</td></tr>
-<tr bgcolor=#F0F0F0><td colspan=3><i>Memory Pools</i> &nbsp;</td></tr><tr><td>read buffer size</td><td>131072</td><td>(per session)</td></tr>
-<tr><td>sort buffer size</td><td>65528</td><td>Size of sort buffer (per session)</td></tr>
-<tr><td>table cache</td><td>4</td><td>Number of tables to keep open</td></tr>
-<tr bgcolor=#F0F0F0><td colspan=3><i>Connections</i> &nbsp;</td></tr><tr><td>current connections</td><td>3</td><td>&nbsp;</td></tr>
-<tr><td>max connections</td><td>100</td><td>&nbsp;</td></tr>
-</table>
-<p>&nbsp;</p>
-<p><a name=mssql id="mssql"></a></p>
-
-<table border=1 bgcolor=white><tr><td colspan=3><h3>mssql</h3></td></tr><tr><td><b>Parameter</b></td><td><b>Value</b></td><td><b>Description</b></td></tr><tr bgcolor=#F0F0F0><td colspan=3><i>Ratios</i> &nbsp;</td></tr><tr><td>data cache hit ratio</td><td>99.9999694824</td><td>&nbsp;</td></tr>
-<tr><td>prepared sql hit ratio</td><td>99.7738579828</td><td>&nbsp;</td></tr>
-<tr><td>adhoc sql hit ratio</td><td>98.4540169133</td><td>&nbsp;</td></tr>
-<tr bgcolor=#F0F0F0><td colspan=3><i>IO</i> &nbsp;</td></tr><tr><td>data reads</td><td>2858</td><td>&nbsp;  </td></tr>
-<tr><td>data writes</td><td>1438</td><td>&nbsp;  </td></tr>
-<tr bgcolor=#F0F0F0><td colspan=3><i>Data Cache</i> &nbsp;</td></tr><tr><td>data cache size</td><td>4362</td><td>in K</td></tr>
-<tr bgcolor=#F0F0F0><td colspan=3><i>Connections</i> &nbsp;</td></tr><tr><td>current connections</td><td>14</td><td>&nbsp;</td></tr>
-<tr><td>max connections</td><td>32767</td><td>&nbsp;</td></tr>
-</table>
-
-<p>&nbsp;</p>
-<p><a name=oci8 id="oci8"></a></p>
-<table border=1 bgcolor=white><tr><td colspan=3><h3>oci8</h3></td></tr><tr><td><b>Parameter</b></td><td><b>Value</b></td><td><b>Description</b></td></tr><tr bgcolor=#F0F0F0><td colspan=3><i>Ratios</i> &nbsp;</td></tr><tr><td>data cache hit ratio</td><td>96.98</td><td>&nbsp;</td></tr>
-<tr><td>sql cache hit ratio</td><td>99.96</td><td>&nbsp;</td></tr>
-<tr bgcolor=#F0F0F0><td colspan=3><i>IO</i> &nbsp;</td></tr><tr><td>data reads</td><td>842938</td><td>&nbsp;  </td></tr>
-<tr><td>data writes</td><td>16852</td><td>&nbsp;  </td></tr>
-<tr bgcolor=#F0F0F0><td colspan=3><i>Data Cache</i> &nbsp;</td></tr><tr><td>data cache buffers</td><td>3072</td><td>Number of cache buffers</td></tr>
-<tr><td>data cache blocksize</td><td>8192</td><td>&nbsp;</td></tr>
-<tr><td>data cache size</td><td>48M</td><td>shared_pool_size</td></tr>
-<tr bgcolor=#F0F0F0><td colspan=3><i>Memory Pools</i> &nbsp;</td></tr><tr><td>java pool size</td><td>0</td><td>java_pool_size</td></tr>
-<tr><td>sort buffer size</td><td>512K</td><td>sort_area_size (per query)</td></tr>
-<tr><td>user session buffer size</td><td>8M</td><td>large_pool_size</td></tr>
-<tr bgcolor=#F0F0F0><td colspan=3><i>Connections</i> &nbsp;</td></tr><tr><td>current connections</td><td>1</td><td>&nbsp;</td></tr>
-<tr><td>max connections</td><td>170</td><td>&nbsp;</td></tr>
-<tr><td>data cache utilization ratio</td><td>88.46</td><td>Percentage of data cache actually in use</td></tr>
-<tr><td>user cache utilization ratio</td><td>91.76</td><td>Percentage of user cache (large_pool) actually in use</td></tr>
-<tr><td>rollback segments</td><td>11</td><td>&nbsp;</td></tr>
-<tr bgcolor=#F0F0F0><td colspan=3><i>Transactions</i> &nbsp;</td></tr><tr><td>peak transactions</td><td>24</td><td>Taken from high-water-mark</td></tr>
-<tr><td>max transactions</td><td>187</td><td>max transactions / rollback segments < 3.5 (or transactions_per_rollback_segment)</td></tr>
-<tr bgcolor=#F0F0F0><td colspan=3><i>Parameters</i> &nbsp;</td></tr><tr><td>cursor sharing</td><td>EXACT</td><td>Cursor reuse strategy. Recommended is FORCE (8i+) or SIMILAR (9i+). See <a href=http://www.praetoriate.com/oracle_tips_cursor_sharing.htm>cursor_sharing</a>.</td></tr>
-<tr><td>index cache cost</td><td>0</td><td>% of indexed data blocks expected in the cache.
-                       Recommended is 20-80. Default is 0. See <a href=http://www.dba-oracle.com/oracle_tips_cbo_part1.htm>optimizer_index_caching</a>.</td></tr>
-<tr><td>random page cost</td><td>100</td><td>Recommended is 10-50 for TP, and 50 for data warehouses. Default is 100. See <a href=http://www.dba-oracle.com/oracle_tips_cost_adj.htm>optimizer_index_cost_adj</a>. </td></tr>
-</table>
-<h3>Suspicious SQL</h3>
-
-<table border=1 bgcolor=white><tr><td><b>LOAD</b></td><td><b>EXECUTES</b></td><td><b>SQL_TEXT</b></td></tr>
-<tr><td align=right>  .73%</td><td align=right>89</td><td>select u.name, o.name, t.spare1, t.pctfree$    from sys.obj$ o, sys.user$ u, sys.tab$ t    where  (bitand(t.trigflag, 1048576) = 1048576) and           o.obj#=t.obj# and o.owner# = u.user# select i.obj#, i.flags, u.name, o.name     from sys.obj$ o, sys.user$ u, sys.ind$ i    where  (bitand(i.flags, 256) = 256 or bitand(i.flags, 512) = 512) and           (not((i.type# = 9) and bitand(i.flags,8) = 8)) and           o.obj#=i.obj# and o.owner# = u.user# </td></tr>
-<tr><td align=right>  .84%</td><td align=right>3</td><td>select /*+ RULE */ distinct tabs.table_name, tabs.owner , partitioned, iot_type  , TEMPORARY, table_type, table_type_owner  from DBA_ALL_TABLES tabs  where tabs.owner = :own  </td></tr>
-<tr><td align=right> 3.95%</td><td align=right>6</td><td>SELECT round(count(1)*avg(buf.block_size)/1048576) FROM DBA_OBJECTS obj, V$BH bh, dba_segments seg, v$buffer_pool buf WHERE obj.object_id = bh.objd AND obj.owner != 'SYS' and obj.owner = seg.owner and obj.object_name = seg.segment_name and obj.object_type = seg.segment_type and seg.buffer_pool = buf.name and buf.name = 'DEFAULT'  </td></tr>
-<tr><td align=right> 4.50%</td><td align=right>6</td><td>SELECT round(count(1)*avg(tsp.block_size)/1048576) FROM DBA_OBJECTS obj, V$BH bh, dba_segments seg, dba_tablespaces tsp WHERE obj.object_id = bh.objd AND obj.owner != 'SYS' and obj.owner = seg.owner and obj.object_name = seg.segment_name and obj.object_type = seg.segment_type and seg.tablespace_name = tsp.tablespace_name  </td></tr>
-<tr><td align=right>57.34%</td><td align=right>9267</td><td>select t.schema, t.name, t.flags, q.name from system.aq$_queue_tables t, sys.aq$_queue_table_affinities aft,      system.aq$_queues q where aft.table_objno = t.objno and aft.owner_instance = :1 and        q.table_objno = t.objno and q.usage = 0 and       bitand(t.flags, 4+16+32+64+128+256) = 0 for update of t.name, aft.table_objno skip locked </td></tr></table>
-
-<h3>Expensive SQL</h3>
-
-<table border=1 bgcolor=white><tr><td><b>LOAD</b></td><td><b>EXECUTES</b></td><td><b>SQL_TEXT</b></td></tr>
-<tr><td align=right> 5.24%</td><td align=right>1</td><td>select round(sum(bytes)/1048576) from dba_segments  </td></tr>
-<tr><td align=right> 6.89%</td><td align=right>6</td><td>SELECT round(count(1)*avg(buf.block_size)/1048576) FROM DBA_OBJECTS obj, V$BH bh, dba_segments seg, v$buffer_pool buf WHERE obj.object_id = bh.objd AND obj.owner != 'SYS' and obj.owner = seg.owner and obj.object_name = seg.segment_name and obj.object_type = seg.segment_type and seg.buffer_pool = buf.name and buf.name = 'DEFAULT'  </td></tr>
-<tr><td align=right> 7.85%</td><td align=right>6</td><td>SELECT round(count(1)*avg(tsp.block_size)/1048576) FROM DBA_OBJECTS obj, V$BH bh, dba_segments seg, dba_tablespaces tsp WHERE obj.object_id = bh.objd AND obj.owner != 'SYS' and obj.owner = seg.owner and obj.object_name = seg.segment_name and obj.object_type = seg.segment_type and seg.tablespace_name = tsp.tablespace_name  </td></tr>
-<tr><td align=right>33.69%</td><td align=right>89</td><td>select u.name, o.name, t.spare1, t.pctfree$    from sys.obj$ o, sys.user$ u, sys.tab$ t    where  (bitand(t.trigflag, 1048576) = 1048576) and           o.obj#=t.obj# and o.owner# = u.user# </td></tr>
-<tr><td align=right>36.44%</td><td align=right>89</td><td>select i.obj#, i.flags, u.name, o.name     from sys.obj$ o, sys.user$ u, sys.ind$ i    where  (bitand(i.flags, 256) = 256 or bitand(i.flags, 512) = 512) and           (not((i.type# = 9) and bitand(i.flags,8) = 8)) and           o.obj#=i.obj# and o.owner# = u.user# </td></tr></table>
-
-<p><a name=postgres id="postgres"></a></p>
-
-<table border=1 bgcolor=white><tr><td colspan=3><h3>postgres7</h3></td></tr><tr><td><b>Parameter</b></td><td><b>Value</b></td><td><b>Description</b></td></tr><tr bgcolor=#F0F0F0><td colspan=3><i>Ratios</i> &nbsp;</td></tr><tr><td>statistics collector</td><td>FALSE</td><td>Must be set to TRUE to enable hit ratio statistics (<i>stats_start_collector</i>,<i>stats_row_level</i> and <i>stats_block_level</i> must be set to true in postgresql.conf)</td></tr>
-<tr><td>data cache hit ratio</td><td>99.9666031916603</td><td>&nbsp;</td></tr>
-<tr bgcolor=#F0F0F0><td colspan=3><i>IO</i> &nbsp;</td></tr><tr><td>data reads</td><td>15</td><td>&nbsp;  </td></tr>
-<tr><td>data writes</td><td>0.000000000000000000</td><td>Count of inserts/updates/deletes * coef</td></tr>
-<tr bgcolor=#F0F0F0><td colspan=3><i>Data Cache</i> &nbsp;</td></tr><tr><td>data cache buffers</td><td>1280</td><td>Number of cache buffers. <a href=http://www.varlena.com/GeneralBits/Tidbits/perf.html#basic>Tuning</a></td></tr>
-<tr><td>cache blocksize</td><td>8192</td><td>(estimate)</td></tr>
-<tr><td>data cache size</td><td>10M</td><td>&nbsp;</td></tr>
-<tr><td>operating system cache size</td><td>80000K</td><td>(effective cache size)</td></tr>
-<tr bgcolor=#F0F0F0><td colspan=3><i>Memory Pools</i> &nbsp;</td></tr><tr><td>sort buffer size</td><td>1M</td><td>Size of sort buffer (per query)</td></tr>
-<tr bgcolor=#F0F0F0><td colspan=3><i>Connections</i> &nbsp;</td></tr><tr><td>current connections</td><td>13</td><td>&nbsp;</td></tr>
-<tr><td>max connections</td><td>32</td><td>&nbsp;</td></tr>
-<tr bgcolor=#F0F0F0><td colspan=3><i>Parameters</i> &nbsp;</td></tr><tr><td>rollback buffers</td><td>8</td><td>WAL buffers</td></tr>
-<tr><td>random page cost</td><td>4</td><td>Cost of doing a seek (default=4). See <a href=http://www.varlena.com/GeneralBits/Tidbits/perf.html#less>random_page_cost</a></td></tr>
-</table>
-
-</body>
-</html>
diff --git a/lib/adodb/docs-session.htm b/lib/adodb/docs-session.htm
deleted file mode 100644 (file)
index 1ae6bbe..0000000
+++ /dev/null
@@ -1,213 +0,0 @@
-<html>
-<head>
-<title>ADODB Session Management Manual</title>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<XSTYLE
-    body,td {font-family:Arial,Helvetica,sans-serif;font-size:11pt}
-    pre {font-size:9pt}
-    .toplink {font-size:8pt}
-    />
-</head>    
-<body bgcolor="#FFFFFF">
-<h3>ADODB Session Management Manual</h3>
-<p>
-V4.20 22 Feb 2004 (c) 2000-2004 John Lim (jlim#natsoft.com.my)
-<p> <font size=1>This software is dual licensed using BSD-Style and LGPL. This 
-  means you can use it in compiled proprietary and commercial products. </font> 
-<p>Useful ADOdb links:  <a href=http://php.weblogs.com/adodb>Download</a> &nbsp; <a href=http://php.weblogs.com/adodb_manual>Other Docs</a>
-
-<h3>Introduction</h3>
-<p> 
-We store state information specific to a user or web client in session variables. These session variables 
- persist throughout a session, as the user moves from page to page. 
-<p>
-To use session variables, call session_start() at the beginning of your web page, 
-before your HTTP headers are sent. Then for every variable you want to keep alive 
-for the duration of the session, call session_register($variable_name). By default, 
-the session handler will keep track of the session by using a cookie. You can save objects
- or arrays in session variables also.
-<p>The default method of storing sessions is to store it in a file. However if 
-  you have special needs such as you:
-<ul>
-  <li>Have multiple web servers that need to share session info</li>
-  <li>Need to do special processing of each session</li>
-  <li>Require notification when a session expires</li>
-</ul>
-<p>Then the ADOdb session handler provides you with the above additional capabilities 
-  by storing the session information as records in a database table that can be 
-  shared across multiple servers. 
-<p><b>Important Upgrade Notice:</b> Since ADOdb 4.05, the session files have been moved to its own folder, adodb/session. This is a rewrite
-of the session code by Ross Smith. The old session code is in adodb/session/old. 
-<h4>ADOdb Session Handler Features</h4>
-<ul>
-<li>Ability to define a notification function that is called when a session expires. Typically
-used to detect session logout and release global resources.
-<li>Optimization of database writes. We crc32 the session data and only perform an update
-to the session data if there is a data change.
-<li>Support for large amounts of session data with CLOBs (see adodb-session-clob.php). Useful
-for Oracle.
-<li>Support for encrypted session data, see adodb-cryptsession.inc.php. Enabling encryption 
-is simply a matter of including adodb-cryptsession.inc.php instead of adodb-session.inc.php.
-</ul>
-<h3>Setup</h3>
-<p>There are 3 session management files that you can use:
-<pre>
-adodb-session.php        : The default
-adodb-session-clob.php   : Use this if you are storing DATA in clobs
-adodb-cryptsession.php   : Use this if you want to store encrypted session data in the database
-
-<strong>Examples</strong>
- <font color=#004040>
-    include('adodb/adodb.inc.php');
-    
-<b>    $ADODB_SESSION_DRIVER='mysql';
-    $ADODB_SESSION_CONNECT='localhost';
-    $ADODB_SESSION_USER ='scott';
-    $ADODB_SESSION_PWD ='tiger';
-    $ADODB_SESSION_DB ='sessiondb';</b>
-    
-    <b>include('adodb/session/adodb-session.php');</b>
-    session_start();
-    
-    #
-    # Test session vars, the following should increment on refresh
-    #
-    $_SESSION['AVAR'] += 1;
-    print "&lt;p>\$_SESSION['AVAR']={$_SESSION['AVAR']}&lt;/p>";
-</font>
-To force non-persistent connections, call adodb_session_open first before session_start():
- <font color=#004040>
-    include('adodb/adodb.inc.php');
-    
-<b>    $ADODB_SESSION_DRIVER='mysql';
-    $ADODB_SESSION_CONNECT='localhost';
-    $ADODB_SESSION_USER ='scott';
-    $ADODB_SESSION_PWD ='tiger';
-    $ADODB_SESSION_DB ='sessiondb';</b>
-    
-    <b>include('adodb/session/adodb-session.php');
-    adodb_sess_open(false,false,false);</b>
-    session_start();
- </font color=#004040>
-To use a encrypted sessions, simply replace the file:
- <font color=#004040>
-    include('adodb/adodb.inc.php');
-    
-<b>    $ADODB_SESSION_DRIVER='mysql';
-    $ADODB_SESSION_CONNECT='localhost';
-    $ADODB_SESSION_USER ='scott';
-    $ADODB_SESSION_PWD ='tiger';
-    $ADODB_SESSION_DB ='sessiondb';
-    
-    include('adodb/session/adodb-cryptsession.php');</b>
-    session_start();
-    </font>
-And the same technique for adodb-session-clob.php:
- <font color=#004040>
-    include('adodb/adodb.inc.php');
-    
-<b>    $ADODB_SESSION_DRIVER='mysql';
-    $ADODB_SESSION_CONNECT='localhost';
-    $ADODB_SESSION_USER ='scott';
-    $ADODB_SESSION_PWD ='tiger';
-    $ADODB_SESSION_DB ='sessiondb';
-    
-    include('adodb/session/adodb-session-clob.php');</b>
-    session_start();
-    </font>
- <h4>Installation</h4>
- 1. Create this table in your database (syntax might vary depending on your db):
- <a name=sessiontab></a> <font color=#004040>
-  create table sessions (
-       SESSKEY char(32) not null,
-       EXPIRY int(11) unsigned not null,
-       EXPIREREF varchar(64),
-       DATA text not null,
-      primary key (sesskey)
-  );</font>
-  
-  For the adodb-session-clob.php version, create this:
-   <font color=#004040>
-    create table sessions (
-       SESSKEY char(32) not null,
-       EXPIRY int(11) unsigned not null,
-       EXPIREREF varchar(64),
-       DATA CLOB,
-      primary key (sesskey)
-  );</font>
-
-  2. Then define the following parameters. You can either modify
-     this file, or define them before this file is included:
-      <font color=#004040>
-    $ADODB_SESSION_DRIVER='database driver, eg. mysql or ibase';
-    $ADODB_SESSION_CONNECT='server to connect to';
-    $ADODB_SESSION_USER ='user';
-    $ADODB_SESSION_PWD ='password';
-    $ADODB_SESSION_DB ='database';
-    $ADODB_SESSION_TBL = 'sessions'; # setting this is optional
-       </font>
-    When the session is created, $<b>ADODB_SESS_CONN</b> holds the connection object.
-    
-  3. Recommended is PHP 4.0.6 or later. There are documented session bugs 
-  in earlier versions of PHP.
-</pre>
-
-    <h3>Notifications</h3>
-<p>If you want to receive notification when a session expires, then
-     tag the session record with a <a href="#sessiontab">EXPIREREF</a> tag (see the 
-    definition of the sessions table above).  Before any session record is deleted,
-       ADOdb will call a notification function, passing in the EXPIREREF.
-<p>
-When a session is first created, we check a global variable $ADODB_SESSION_EXPIRE_NOTIFY.
-    This is an array with 2 elements, the first being the name of the session variable
-    you would like to store in the EXPIREREF field, and the 2nd is the 
-    notification function's name.
-       <p>
-        Suppose we want to be notified when a user's session 
-    has expired, based on the userid. The user id in the global session variable $USERID.
-       The function name is 'NotifyFn'. So we define:
-    <pre> <font color=#004040>
-        $ADODB_SESSION_EXPIRE_NOTIFY = array('USERID','NotifyFn');
-    </font></pre>
-    And when the NotifyFn is called (when the session expires), we pass the $USERID 
-    as the first parameter, eg. NotifyFn($userid, $sesskey). The session key (which is 
-       the primary key of the record in the sessions table) is the 2nd parameter.
-  <p>
-    Here is an example of a Notification function that deletes some records in the database
-       and temporary files:
-    <pre><font color=#004040>
-        function NotifyFn($expireref, $sesskey)
-        {
-        global $ADODB_SESS_CONN; # the session connection object
-
-          $user = $ADODB_SESS_CONN->qstr($expireref);
-          $ADODB_SESS_CONN->Execute("delete from shopping_cart where user=$user");
-          system("rm /work/tmpfiles/$expireref/*");
-        }</font>
-    </pre>
-       <p>
-    <p>
-    NOTE: If you want to change the EXPIREREF after the session record has been
-    created, you will need to modify any session variable to force a database
-    record update.
-<h4>Compression/Encryption Schemes</h4>
-Since ADOdb 4.05, thanks to Ross Smith,  multiple encryption and compression schemes are supported.
-  Currently, supported:
-<pre>
-  MD5Crypt (crypt.inc.php)
-  MCrypt
-  Secure (Horde's emulation of MCrypt, if MCrypt module is not available.)
-  GZip
-  BZip2
-</pre>
-These are stackable. E.g. 
-<pre>
-ADODB_Session::filter(new ADODB_Compress_Bzip2());
-ADODB_Session::filter(new ADODB_Encrypt_MD5());
-</pre>
-will compress and then encrypt the record in the database.
-<p>
-Also see the <a href=docs-adodb.htm>core ADOdb documentation</a>.
-</body>
-</html>
\ No newline at end of file
diff --git a/lib/adodb/pear/Auth/Container/ADOdb.php b/lib/adodb/pear/Auth/Container/ADOdb.php
deleted file mode 100644 (file)
index ee88fe3..0000000
+++ /dev/null
@@ -1,413 +0,0 @@
-<?php\r
-//\r
-// +----------------------------------------------------------------------+\r
-// | PHP Version 4                                                        |\r
-// +----------------------------------------------------------------------+\r
-// |                                                                      |\r
-// +----------------------------------------------------------------------+\r
-// | This source file is subject to version 2.02 of the PHP license,      |\r
-// | that is bundled with this package in the file LICENSE, and is        |\r
-// | available at through the world-wide-web at                           |\r
-// | http://www.php.net/license/2_02.txt.                                 |\r
-// | If you did not receive a copy of the PHP license and are unable to   |\r
-// | obtain it through the world-wide-web, please send a note to          |\r
-// | license@php.net so we can mail you a copy immediately.               |\r
-// +----------------------------------------------------------------------+\r
-// | Authors: Martin Jansen <mj@php.net>\r
-// |   Richard Tango-Lowy <richtl@arscognita.com>                                  |\r
-// +----------------------------------------------------------------------+\r
-//\r
-// $Id$\r
-//\r
-\r
-require_once 'Auth/Container.php';\r
-require_once 'adodb.inc.php';\r
-require_once 'adodb-pear.inc.php';\r
-require_once 'adodb-errorpear.inc.php';\r
-\r
-/**\r
- * Storage driver for fetching login data from a database using ADOdb-PHP.\r
- *\r
- * This storage driver can use all databases which are supported\r
- * by the ADBdb DB abstraction layer to fetch login data.\r
- * See http://php.weblogs.com/adodb for information on ADOdb.\r
- * NOTE: The ADOdb directory MUST be in your PHP include_path!\r
- *\r
- * @author   Richard Tango-Lowy <richtl@arscognita.com>\r
- * @package  Auth\r
- * @version  $Revision$\r
- */\r
-class Auth_Container_ADOdb extends Auth_Container\r
-{\r
-\r
-    /**\r
-     * Additional options for the storage container\r
-     * @var array\r
-     */\r
-    var $options = array();\r
-\r
-    /**\r
-     * DB object\r
-     * @var object\r
-     */\r
-    var $db = null;\r
-    var $dsn = '';\r
-       \r
-    /**\r
-     * User that is currently selected from the DB.\r
-     * @var string\r
-     */\r
-    var $activeUser = '';\r
-\r
-    // {{{ Constructor\r
-\r
-    /**\r
-     * Constructor of the container class\r
-     *\r
-     * Initate connection to the database via PEAR::ADOdb\r
-     *\r
-     * @param  string Connection data or DB object\r
-     * @return object Returns an error object if something went wrong\r
-     */\r
-    function Auth_Container_ADOdb($dsn)\r
-    {\r
-        $this->_setDefaults();\r
-               \r
-        if (is_array($dsn)) {\r
-            $this->_parseOptions($dsn);\r
-\r
-            if (empty($this->options['dsn'])) {\r
-                PEAR::raiseError('No connection parameters specified!');\r
-            }\r
-        } else {\r
-               // Extract db_type from dsn string.\r
-            $this->options['dsn'] = $dsn;\r
-        }\r
-    }\r
-\r
-    // }}}\r
-    // {{{ _connect()\r
-\r
-    /**\r
-     * Connect to database by using the given DSN string\r
-     *\r
-     * @access private\r
-     * @param  string DSN string\r
-     * @return mixed  Object on error, otherwise bool\r
-     */\r
-     function _connect($dsn)\r
-    {\r
-        if (is_string($dsn) || is_array($dsn)) {\r
-               if(!$this->db) {\r
-                       $this->db = &ADONewConnection($dsn);\r
-                       if( $err = ADODB_Pear_error() ) {\r
-                               return PEAR::raiseError($err);\r
-                       }\r
-               }\r
-               \r
-        } else {\r
-            return PEAR::raiseError('The given dsn was not valid in file ' . __FILE__ . ' at line ' . __LINE__,\r
-                                    41,\r
-                                    PEAR_ERROR_RETURN,\r
-                                    null,\r
-                                    null\r
-                                    );\r
-        }\r
-        \r
-        if(!$this->db) {\r
-               return PEAR::raiseError(ADODB_Pear_error());\r
-        } else {\r
-               return true;\r
-        }\r
-    }\r
-\r
-    // }}}\r
-    // {{{ _prepare()\r
-\r
-    /**\r
-     * Prepare database connection\r
-     *\r
-     * This function checks if we have already opened a connection to\r
-     * the database. If that's not the case, a new connection is opened.\r
-     *\r
-     * @access private\r
-     * @return mixed True or a DB error object.\r
-     */\r
-    function _prepare()\r
-    {\r
-       if(!$this->db) {\r
-               $res = $this->_connect($this->options['dsn']);                  \r
-       }\r
-        return true;\r
-    }\r
-\r
-    // }}}\r
-    // {{{ query()\r
-\r
-    /**\r
-     * Prepare query to the database\r
-     *\r
-     * This function checks if we have already opened a connection to\r
-     * the database. If that's not the case, a new connection is opened.\r
-     * After that the query is passed to the database.\r
-     *\r
-     * @access public\r
-     * @param  string Query string\r
-     * @return mixed  a DB_result object or DB_OK on success, a DB\r
-     *                or PEAR error on failure\r
-     */\r
-    function query($query)\r
-    {\r
-        $err = $this->_prepare();\r
-        if ($err !== true) {\r
-            return $err;\r
-        }\r
-        return $this->db->query($query);\r
-    }\r
-\r
-    // }}}\r
-    // {{{ _setDefaults()\r
-\r
-    /**\r
-     * Set some default options\r
-     *\r
-     * @access private\r
-     * @return void\r
-     */\r
-    function _setDefaults()\r
-    {\r
-       $this->options['db_type']       = 'mysql';\r
-        $this->options['table']       = 'auth';\r
-        $this->options['usernamecol'] = 'username';\r
-        $this->options['passwordcol'] = 'password';\r
-        $this->options['dsn']         = '';\r
-        $this->options['db_fields']   = '';\r
-        $this->options['cryptType']   = 'md5';\r
-    }\r
-\r
-    // }}}\r
-    // {{{ _parseOptions()\r
-\r
-    /**\r
-     * Parse options passed to the container class\r
-     *\r
-     * @access private\r
-     * @param  array\r
-     */\r
-    function _parseOptions($array)\r
-    {\r
-        foreach ($array as $key => $value) {\r
-            if (isset($this->options[$key])) {\r
-                $this->options[$key] = $value;\r
-            }\r
-        }\r
-\r
-        /* Include additional fields if they exist */\r
-        if(!empty($this->options['db_fields'])){\r
-            if(is_array($this->options['db_fields'])){\r
-                $this->options['db_fields'] = join($this->options['db_fields'], ', ');\r
-            }\r
-            $this->options['db_fields'] = ', '.$this->options['db_fields'];\r
-        }\r
-    }\r
-\r
-    // }}}\r
-    // {{{ fetchData()\r
-\r
-    /**\r
-     * Get user information from database\r
-     *\r
-     * This function uses the given username to fetch\r
-     * the corresponding login data from the database\r
-     * table. If an account that matches the passed username\r
-     * and password is found, the function returns true.\r
-     * Otherwise it returns false.\r
-     *\r
-     * @param   string Username\r
-     * @param   string Password\r
-     * @return  mixed  Error object or boolean\r
-     */\r
-    function fetchData($username, $password)\r
-    {\r
-        // Prepare for a database query\r
-        $err = $this->_prepare();\r
-        if ($err !== true) {\r
-            return PEAR::raiseError($err->getMessage(), $err->getCode());\r
-        }\r
-\r
-        // Find if db_fields contains a *, i so assume all col are selected\r
-        if(strstr($this->options['db_fields'], '*')){\r
-            $sql_from = "*";\r
-        }\r
-        else{\r
-            $sql_from = $this->options['usernamecol'] . ", ".$this->options['passwordcol'].$this->options['db_fields'];\r
-        }\r
-        \r
-        $query = "SELECT ".$sql_from.\r
-                " FROM ".$this->options['table'].\r
-                " WHERE ".$this->options['usernamecol']." = " . $this->db->Quote($username);\r
-        \r
-        $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;\r
-        $rset = $this->db->Execute( $query );\r
-        $res = $rset->fetchRow();\r
-\r
-        if (DB::isError($res)) {\r
-            return PEAR::raiseError($res->getMessage(), $res->getCode());\r
-        }\r
-        if (!is_array($res)) {\r
-            $this->activeUser = '';\r
-            return false;\r
-        }\r
-        if ($this->verifyPassword(trim($password, "\r\n"),\r
-                                  trim($res[$this->options['passwordcol']], "\r\n"),\r
-                                  $this->options['cryptType'])) {\r
-            // Store additional field values in the session\r
-            foreach ($res as $key => $value) {\r
-                if ($key == $this->options['passwordcol'] ||\r
-                    $key == $this->options['usernamecol']) {\r
-                    continue;\r
-                }\r
-                // Use reference to the auth object if exists\r
-                // This is because the auth session variable can change so a static call to setAuthData does not make sence\r
-                if(is_object($this->_auth_obj)){\r
-                    $this->_auth_obj->setAuthData($key, $value);\r
-                } else {\r
-                    Auth::setAuthData($key, $value);\r
-                }\r
-            }\r
-\r
-            return true;\r
-        }\r
-\r
-        $this->activeUser = $res[$this->options['usernamecol']];\r
-        return false;\r
-    }\r
-\r
-    // }}}\r
-    // {{{ listUsers()\r
-\r
-    function listUsers()\r
-    {\r
-        $err = $this->_prepare();\r
-        if ($err !== true) {\r
-            return PEAR::raiseError($err->getMessage(), $err->getCode());\r
-        }\r
-\r
-        $retVal = array();\r
-\r
-        // Find if db_fileds contains a *, i so assume all col are selected\r
-        if(strstr($this->options['db_fields'], '*')){\r
-            $sql_from = "*";\r
-        }\r
-        else{\r
-            $sql_from = $this->options['usernamecol'] . ", ".$this->options['passwordcol'].$this->options['db_fields'];\r
-        }\r
-\r
-        $query = sprintf("SELECT %s FROM %s",\r
-                         $sql_from,\r
-                         $this->options['table']\r
-                         );\r
-        $res = $this->db->getAll($query, null, DB_FETCHMODE_ASSOC);\r
-\r
-        if (DB::isError($res)) {\r
-            return PEAR::raiseError($res->getMessage(), $res->getCode());\r
-        } else {\r
-            foreach ($res as $user) {\r
-                $user['username'] = $user[$this->options['usernamecol']];\r
-                $retVal[] = $user;\r
-            }\r
-        }\r
-        return $retVal;\r
-    }\r
-\r
-    // }}}\r
-    // {{{ addUser()\r
-\r
-    /**\r
-     * Add user to the storage container\r
-     *\r
-     * @access public\r
-     * @param  string Username\r
-     * @param  string Password\r
-     * @param  mixed  Additional information that are stored in the DB\r
-     *\r
-     * @return mixed True on success, otherwise error object\r
-     */\r
-    function addUser($username, $password, $additional = "")\r
-    {\r
-        if (function_exists($this->options['cryptType'])) {\r
-            $cryptFunction = $this->options['cryptType'];\r
-        } else {\r
-            $cryptFunction = 'md5';\r
-        }\r
-\r
-        $additional_key   = '';\r
-        $additional_value = '';\r
-\r
-        if (is_array($additional)) {\r
-            foreach ($additional as $key => $value) {\r
-                $additional_key .= ', ' . $key;\r
-                $additional_value .= ", '" . $value . "'";\r
-            }\r
-        }\r
-\r
-        $query = sprintf("INSERT INTO %s (%s, %s%s) VALUES ('%s', '%s'%s)",\r
-                         $this->options['table'],\r
-                         $this->options['usernamecol'],\r
-                         $this->options['passwordcol'],\r
-                         $additional_key,\r
-                         $username,\r
-                         $cryptFunction($password),\r
-                         $additional_value\r
-                         );\r
-\r
-        $res = $this->query($query);\r
-\r
-        if (DB::isError($res)) {\r
-           return PEAR::raiseError($res->getMessage(), $res->getCode());\r
-        } else {\r
-          return true;\r
-        }\r
-    }\r
-\r
-    // }}}\r
-    // {{{ removeUser()\r
-\r
-    /**\r
-     * Remove user from the storage container\r
-     *\r
-     * @access public\r
-     * @param  string Username\r
-     *\r
-     * @return mixed True on success, otherwise error object\r
-     */\r
-    function removeUser($username)\r
-    {\r
-        $query = sprintf("DELETE FROM %s WHERE %s = '%s'",\r
-                         $this->options['table'],\r
-                         $this->options['usernamecol'],\r
-                         $username\r
-                         );\r
-\r
-        $res = $this->query($query);\r
-\r
-        if (DB::isError($res)) {\r
-           return PEAR::raiseError($res->getMessage(), $res->getCode());\r
-        } else {\r
-          return true;\r
-        }\r
-    }\r
-\r
-    // }}}\r
-}\r
-\r
-function showDbg( $string ) {\r
-       print "\r
--- $string</P>";\r
-}\r
-function dump( $var, $str, $vardump = false ) {\r
-       print "<H4>$str</H4><pre>";\r
-       ( !$vardump ) ? ( print_r( $var )) : ( var_dump( $var ));\r
-       print "</pre>";\r
-}\r
-?>\r
diff --git a/lib/adodb/pear/readme.Auth.txt b/lib/adodb/pear/readme.Auth.txt
deleted file mode 100644 (file)
index db28319..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-From: Rich Tango-Lowy (richtl#arscognita.com)\r
-Date: Sat, May 29, 2004 11:20 am\r
-\r
-OK, I hacked out an ADOdb container for PEAR-Auth. The error handling's \r
-a bit of a mess, but all the methods work.\r
-\r
-Copy ADOdb.php to your pear/Auth/Container/ directory.\r
-\r
-Use the ADOdb container exactly as you would the DB\r
-container, but specify 'ADOdb' instead of 'DB':\r
-\r
-$dsn = "mysql://myuser:mypass@localhost/authdb";\r
-$a = new Auth("ADOdb", $dsn, "loginFunction");\r
-\r
-\r
--------------------\r
-\r
-John Lim adds:\r
-\r
-See http://pear.php.net/manual/en/package.authentication.php\r
diff --git a/lib/adodb/readme.htm b/lib/adodb/readme.htm
deleted file mode 100644 (file)
index 15b158a..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-<html>\r
-<head>\r
-<title>ADODB Manual</title>\r
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">\r
-<XSTYLE\r
-       body,td {font-family:Arial,Helvetica,sans-serif;font-size:11pt}\r
-       pre {font-size:9pt}\r
-       .toplink {font-size:8pt}\r
-       />\r
-</head>        \r
-<body bgcolor="#FFFFFF">\r
-\r
-<h3>ADOdb Library for PHP</h3>\r
-<p>ADOdb is a suite of database libraries that allow you to connect to multiple \r
-       databases in a portable manner. Download from <a href=http://php.weblogs.com/adodb>http://php.weblogs.com/adodb</a>.\r
-<ul><li>The ADOdb documentation has moved to <a href=docs-adodb.htm>docs-adodb.htm</a> \r
-       This allows you to query, update and insert records using a portable API.\r
-<p><li>The ADOdb data dictionary docs are at <a href=docs-datadict.htm>docs-datadict.htm</a>. \r
-       This allows you to create database tables and indexes in a portable manner.\r
-<p><li>The ADOdb database performance monitoring docs are at <a href=docs-perf.htm>docs-perf.htm</a>. \r
-       This allows you to perform health checks, tune and monitor your database.\r
-<p><li>The ADOdb database-backed session docs are at <a href=docs-session.htm>docs-session.htm</a>. \r
-</ul>\r
-<p>\r
-<h3>Installation</h3>\r
-Make sure you are running PHP4.0.4 or later. Unpack all the files into a directory accessible by your webserver.\r
-<p>\r
-To test, try modifying some of the tutorial examples. Make sure you customize the connection settings correctly. You can debug using:\r
-<pre>\r
-&lt;?php\r
-include('adodb/adodb.inc.php');\r
-\r
-$db = <b>ADONewConnection</b>($driver); # eg. 'mysql' or 'oci8' \r
-$db->debug = true;\r
-$db-><b>Connect</b>($server, $user, $password, $database);\r
-$rs = $db-><b>Execute</b>('select * from some_small_table');\r
-print "&lt;pre>";\r
-print_r($rs-><b>GetRows</b>());\r
-print "&lt;/pre>";\r
-?>\r
-</pre>\r
-<h3>How are people using ADOdb</h3>\r
-Here are some examples of how people are using ADOdb (for a much longer list, \r
-visit <a href="http://php.weblogs.com/adodb-cool-applications">http://php.weblogs.com/adodb-cool-applications</a>): \r
-<ul>\r
-       <li> <strong>PhpLens</strong> is a commercial data grid component that allows \r
-               both cool Web designers and serious unshaved programmers to develop and \r
-               maintain databases on the Web easily. Developed by the author of ADOdb. \r
-       </li>\r
-       <li> <strong>PHAkt</strong>: PHP Extension for DreamWeaver Ultradev allows \r
-               you to script PHP in the popular Web page editor. Database handling provided \r
-               by ADOdb. </li>\r
-       <li> <strong>Analysis Console for Intrusion Databases (ACID)</strong>: PHP-based \r
-               analysis engine to search and process a database of security incidents \r
-               generated by security-related software such as IDSes and firewalls (e.g. \r
-               Snort, ipchains). By Roman Danyliw. </li>\r
-       <li> <strong>PostNuke</strong> is a very popular free content management system \r
-               and weblog system. It offers full CSS support, HTML 4.01 transitional \r
-               compliance throughout, an advanced blocks system, and is fully multi-lingual \r
-               enabled. </li>\r
-       <li><strong> EasyPublish CMS</strong> is another free content management system \r
-               for managing information and integrated modules on your internet, intranet- \r
-               and extranet-sites. From Norway. </li>\r
-       <li> <strong>NOLA</strong> is a full featured accounting, inventory, and job \r
-               tracking application. It is licensed under the GPL, and developed by Noguska. \r
-       </li>\r
-</ul>\r
-</body>\r
-</html>\r
diff --git a/lib/adodb/tips_portable_sql.htm b/lib/adodb/tips_portable_sql.htm
deleted file mode 100644 (file)
index fc438fb..0000000
+++ /dev/null
@@ -1,362 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">\r
-\r
-<html>\r
-<head>\r
-       <title>Tips on Writing Portable SQL for Multiple Databases for PHP</title>\r
-</head>\r
-\r
-<body bgcolor=white>\r
-<table width=100% border=0><tr><td><h2>Tips on Writing Portable SQL &nbsp;</h2></td><td>\r
- <div align=right><img src="cute_icons_for_site/adodb.gif"></div></td></tr></table>\r
-  <p>Updated 18 Sep 2003. Added Portable Native SQL section.\r
-<p>\r
-\r
- If you are writing an application that is used in multiple environments and \r
-  operating systems, you need to plan to support multiple databases. This article \r
-  is based on my experiences with multiple database systems, stretching from 4th \r
-  Dimension in my Mac days, to the databases I currently use, which are: Oracle, \r
-  FoxPro, Access, MS SQL Server and MySQL. Although most of the advice here applies \r
-  to using SQL with Perl, Python and other programming languages, I will focus on PHP and how \r
-  the <a href="http://php.weblogs.com/adodb">ADOdb</a> database abstraction library \r
-  offers some solutions.<p></p>\r
-<p>Most database vendors practice product lock-in. The best or fastest way to \r
-  do things is often implemented using proprietary extensions to SQL. This makes \r
-  it extremely hard to write portable SQL code that performs well under all conditions. \r
-  When the first ANSI committee got together in 1984 to standardize SQL, the database \r
-  vendors had such different implementations that they could only agree on the \r
-  core functionality of SQL. Many important application specific requirements \r
-  were not standardized, and after so many years since the ANSI effort began, \r
-  it looks as if much useful database functionality will never be standardized. \r
-  Even though ANSI-92 SQL has codified much more, we still have to implement portability \r
-  at the application level.</p>\r
-<h3><b>Selects</b></h3>\r
-<p>The SELECT statement has been standardized to a great degree. Nearly every \r
-  database supports the following:</p>\r
-<p>SELECT [cols] FROM [tables]<br>\r
-  &nbsp;&nbsp;[WHERE conditions]<br>\r
-  &nbsp; [GROUP BY cols]<br>\r
-  &nbsp; [HAVING conditions] <br>\r
-  &nbsp; [ORDER BY cols]</p>\r
-<p>But so many useful techniques can only be implemented by using proprietary \r
-  extensions. For example, when writing SQL to retrieve the first 10 rows for \r
-  paging, you could write...</p>\r
-<table width="80%" border="1" cellspacing="0" cellpadding="0" align="center">\r
-  <tr> \r
-       <td><b>Database</b></td>\r
-       <td><b>SQL Syntax</b></td>\r
-  </tr>\r
-  <tr> \r
-       <td>DB2</td>\r
-       <td>select * from table fetch first 10 rows only</td>\r
-  </tr>\r
-  <tr> \r
-       <td>Informix</td>\r
-       <td>select first 10 * from table</td>\r
-  </tr>\r
-  <tr> \r
-       <td>Microsoft SQL Server and Access</td>\r
-       <td>select top 10 * from table</td>\r
-  </tr>\r
-  <tr> \r
-       <td>MySQL and PostgreSQL</td>\r
-       <td>select * from table limit 10</td>\r
-  </tr>\r
-  <tr> \r
-       <td>Oracle 8i</td>\r
-       <td>select * from (select * from table) where rownum &lt;= 10</td>\r
-  </tr>\r
-</table>\r
-<p>This feature of getting a subset of data is so useful that in the PHP class \r
-  library ADOdb, we have a SelectLimit( ) function that allows you to hide the \r
-  implementation details within a function that will rewrite your SQL for you:</p>\r
-<pre>$connection-&gt;SelectLimit('select * from table', 10);\r
-</pre>\r
-<p><b>Selects: Fetch Modes</b></p>\r
-<p>PHP allows you to retrieve database records as arrays. You can choose to have \r
-  the arrays indexed by field name or number. However different low-level PHP \r
-  database drivers are inconsistent in their indexing efforts. ADOdb allows you \r
-  to determine your prefered mode. You set this by setting the variable $ADODB_FETCH_MODE \r
-  to either of the constants ADODB_FETCH_NUM (for numeric indexes) or ADODB_FETCH_ASSOC \r
-  (using field names as an associative index).</p>\r
-<p>The default behaviour of ADOdb varies depending on the database you are using. \r
-  For consistency, set the fetch mode to either ADODB_FETCH_NUM (for speed) or \r
-  ADODB_FETCH_ASSOC (for convenience) at the beginning of your code. </p>\r
-<p><b>Selects: Counting Records</b></p>\r
-<p>Another problem with SELECTs is that some databases do not return the number \r
-  of rows retrieved from a select statement. This is because the highest performance \r
-  databases will return records to you even before the last record has been found. \r
-</p>\r
-<p>In ADOdb, RecordCount( ) returns the number of rows returned, or will emulate \r
-  it by buffering the rows and returning the count after all rows have been returned. \r
-  This can be disabled for performance reasons when retrieving large recordsets \r
-  by setting the global variable $ADODB_COUNTRECS = false. This variable is checked \r
-  every time a query is executed, so you can selectively choose which recordsets \r
-  to count.</p>\r
-<p>If you prefer to set $ADODB_COUNTRECS = false, ADOdb still has the PO_RecordCount( \r
-  ) function. This will return the number of rows, or if it is not found, it will \r
-  return an estimate using SELECT COUNT(*):</p>\r
-<pre>$rs = $db-&gt;Execute(&quot;select * from table where state=$state&quot;);\r
-$numrows = $rs-&gt;PO_RecordCount('table', &quot;state=$state&quot;);</pre>\r
-<p><b>Selects: Locking</b> </p>\r
-<p>SELECT statements are commonly used to implement row-level locking of tables. \r
-  Other databases such as Oracle, Interbase, PostgreSQL and MySQL with InnoDB \r
-  do not require row-level locking because they use versioning to display data \r
-  consistent with a specific point in time.</p>\r
-<p>Currently, I recommend encapsulating the row-level locking in a separate function, \r
-  such as RowLock($table, $where):</p>\r
-<pre>$connection-&gt;BeginTrans( );\r
-$connection-&gt;RowLock($table, $where); </pre>\r
-<pre><font color=green># some operation</font></pre>\r
-<pre>if ($ok) $connection-&gt;CommitTrans( );\r
-else $connection-&gt;RollbackTrans( );\r
-</pre>\r
-<p><b>Selects: Outer Joins</b></p>\r
-<p>Not all databases support outer joins. Furthermore the syntax for outer joins \r
-  differs dramatically between database vendors. One portable (and possibly slower) \r
-  method of implementing outer joins is using UNION.</p>\r
-<p>For example, an ANSI-92 left outer join between two tables t1 and t2 could \r
-  look like:</p>\r
-<pre>SELECT t1.col1, t1.col2, t2.cola <br>  FROM t1 <i>LEFT JOIN</i> t2 ON t1.col = t2.col</pre>\r
-<p>This can be emulated using:</p>\r
-<pre>SELECT t1.col1, t1.col2, t2.cola FROM t1, t2 <br>    WHERE t1.col = t2.col \r
-   UNION ALL\r
-SELECT col1, col2, null FROM t1 <br>      WHERE t1.col not in (select distinct col from t2)\r
-</pre>\r
-<p>Since ADOdb 2.13, we provide some hints in the connection object as to legal \r
-  join variations. This is still incomplete and sometimes depends on the database \r
-  version you are using, but is useful as a general guideline:</p>\r
-<p><font face="Courier New, Courier, mono">$conn-&gt;leftOuter</font>: holds the \r
-  operator used for left outer joins (eg. '*='), or false if not known or not \r
-  available.<br>\r
-  <font face="Courier New, Courier, mono">$conn-&gt;rightOuter</font>: holds the \r
-  operator used for right outer joins (eg '=*'), or false if not known or not \r
-  available.<br>\r
-  <font face="Courier New, Courier, mono">$conn-&gt;ansiOuter</font>: boolean \r
-  that if true means that ANSI-92 style outer joins are supported, or false if \r
-  not known.</p>\r
-<h3><b>Inserts</b> </h3>\r
-<p>When you create records, you need to generate unique id's for each record. \r
-  There are two common techniques: (1) auto-incrementing columns and (2) sequences. \r
-</p>\r
-<p>Auto-incrementing columns are supported by MySQL, Sybase and Microsoft Access \r
-  and SQL Server. However most other databases do not support this feature. So \r
-  for portability, you have little choice but to use sequences. Sequences are \r
-  special functions that return a unique incrementing number every time you call \r
-  it, suitable to be used as database keys. In ADOdb, we use the GenID( ) function. \r
-  It has takes a parameter, the sequence name. Different tables can have different \r
-  sequences. </p>\r
-<pre>$id = $connection-&gt;GenID('sequence_name');<br>$connection-&gt;Execute(&quot;insert into table (id, firstname, lastname) <br>                      values ($id, $firstname, $lastname)&quot;);</pre>\r
-<p>For databases that do not support sequences natively, ADOdb emulates sequences \r
-  by creating a table for every sequence.</p>\r
-<h3><b>Binding</b></h3>\r
-<p>Binding variables in an SQL statement is another tricky feature. Binding is \r
-  useful because it allows pre-compilation of SQL. When inserting multiple records \r
-  into a database in a loop, binding can offer a 50% (or greater) speedup. However \r
-  many databases such as Access and MySQL do not support binding natively and \r
-  there is some overhead in emulating binding. Furthermore, different databases \r
-  (specificly Oracle!) implement binding differently. My recommendation is to \r
-  use binding if your database queries are too slow, but make sure you are using \r
-  a database that supports it like Oracle. </p>\r
-<p>ADOdb supports portable Prepare/Execute with:</p>\r
-<pre>$stmt = $db-&gt;Prepare('select * from customers where custid=? and state=?');\r
-$rs = $db-&gt;Execute($stmt, array($id,'New York'));</pre>\r
-<p>Oracle uses named bind placeholders, not "?", so to support portable binding, we have Param() that generates \r
-the correct placeholder (available since ADOdb 3.92):\r
-<pre><font color="#000000">$sql = <font color="#993300">'insert into table (col1,col2) values ('</font>.$DB-&gt;Param('a').<font color="#993300">','</font>.$DB-&gt;Param('b').<font color="#993300">')'</font>;\r
-<font color="#006600"># generates 'insert into table (col1,col2) values (?,?)'\r
-# or        'insert into table (col1,col2) values (:a,:b)</font>'\r
-$stmt = $DB-&gt;Prepare($sql);\r
-$stmt = $DB-&gt;Execute($stmt,array('one','two'));\r
-</font></pre>\r
-<a name="native"></a>\r
-<h2>Portable Native SQL</h2>\r
-<p>ADOdb provides the following functions for portably generating SQL functions \r
-  as strings to be merged into your SQL statements (some are only available since \r
-  ADOdb 3.92): </p>\r
-<table width="75%" border="1" align=center>\r
-  <tr> \r
-    <td width=30%><b>Function</b></td>\r
-    <td><b>Description</b></td>\r
-  </tr>\r
-  <tr> \r
-    <td>DBDate($date)</td>\r
-    <td>Pass in a UNIX timestamp or ISO date and it will convert it to a date \r
-      string formatted for INSERT/UPDATE</td>\r
-  </tr>\r
-  <tr> \r
-    <td>DBTimeStamp($date)</td>\r
-    <td>Pass in a UNIX timestamp or ISO date and it will convert it to a timestamp \r
-      string formatted for INSERT/UPDATE</td>\r
-  </tr>\r
-  <tr> \r
-    <td>SQLDate($date, $fmt)</td>\r
-    <td>Portably generate a date formatted using $fmt mask, for use in SELECT \r
-      statements.</td>\r
-  </tr>\r
-  <tr> \r
-    <td>OffsetDate($date, $ndays)</td>\r
-    <td>Portably generate a $date offset by $ndays.</td>\r
-  </tr>\r
-  <tr> \r
-    <td>Concat($s1, $s2, ...)</td>\r
-    <td>Portably concatenate strings. Alternatively, for mssql use mssqlpo driver, \r
-      which allows || operator.</td>\r
-  </tr>\r
-  <tr> \r
-    <td>IfNull($fld, $replaceNull)</td>\r
-    <td>Returns a string that is the equivalent of MySQL IFNULL or Oracle NVL.</td>\r
-  </tr>\r
-  <tr>\r
-    <td>Param($name)</td>\r
-    <td>Generates bind placeholders, using ? or named conventions as appropriate.</td>\r
-  </tr>\r
-  <tr><td>$db->sysDate</td><td>Property that holds the SQL function that returns today's date</td>\r
-</tr>\r
-<tr><td>$db->sysTimeStamp</td><td>Property that holds the SQL function that returns the current\r
-timestamp (date+time).\r
-</td>\r
-</tr>\r
-<tr>\r
-<td>$db->concat_operator</td><td>Property that holds the concatenation operator\r
-</td>\r
-</tr>\r
-<tr><td>$db->length</td><td>Property that holds the name of the SQL strlen function.\r
-</td></tr>\r
-\r
-<tr><td>$db->upperCase</td><td>Property that holds the name of the SQL strtoupper function.\r
-</td></tr>\r
-<tr><td>$db->random</td><td>Property that holds the SQL to generate a random number between 0.00 and 1.00.\r
-</td>\r
-</tr>\r
-<tr><td>$db->substr</td><td>Property that holds the name of the SQL substring function.\r
-</td></tr>\r
-</table>\r
-<p>&nbsp; </p>\r
-<h2>DDL and Tuning</h2>\r
-There are database design tools such as ERWin or Dezign that allow you to generate data definition language commands such as ALTER TABLE or CREATE INDEX from Entity-Relationship diagrams. \r
-<p>\r
-However if you prefer to use a PHP-based table creation scheme, adodb provides you with this feature. Here is the code to generate the SQL to create a table with: \r
-<ol>\r
-       <li> Auto-increment primary key 'ID', </li>\r
-       <li>The person's 'NAME' VARCHAR(32) NOT NULL and defaults to '', </li>\r
-       <li>The date and time of record creation 'CREATED', </li>\r
-       <li> The person's 'AGE', defaulting to 0, type NUMERIC(16). </li>\r
-</ol>\r
-<p>\r
-Also create a compound index consisting of 'NAME' and 'AGE': \r
-<pre>\r
-$datadict = <strong>NewDataDictionary</strong>($connection);\r
-$flds = " \r
-<font color="#660000">  ID I AUTOINCREMENT PRIMARY,\r
-  NAME C(32) DEFAULT '' NOTNULL,\r
-  CREATED T DEFTIMESTAMP,\r
-  AGE N(16) DEFAULT 0</font>\r
-";\r
-$sql1 = $datadict-><strong>CreateTableSQL</strong>('tabname', $flds);\r
-$sql2 = $datadict-><strong>CreateIndexSQL</strong>('idx_name_age', 'tabname', 'NAME,AGE');\r
-</pre>\r
-\r
-<h3>Data Types</h3>\r
-<p>Stick to a few data types that are available in most databases. Char, varchar \r
-  and numeric/number are supported by most databases. Most other data types (including \r
-  integer, boolean and float) cannot be relied on being available. I recommend \r
-  using char(1) or number(1) to hold booleans. </p>\r
-<p>Different databases have different ways of representing dates and timestamps/datetime. \r
-  ADOdb attempts to display all dates in ISO (YYYY-MM-DD) format. ADOdb also provides \r
-  DBDate( ) and DBTimeStamp( ) to convert dates to formats that are acceptable \r
-  to that database. Both functions accept Unix integer timestamps and date strings \r
-  in ISO format.</p>\r
-<pre>$date1 = $connection-&gt;DBDate(time( ));<br>$date2 = $connection-&gt;DBTimeStamp('2002-02-23 13:03:33');</pre>\r
-<p>We also provide functions to convert database dates to Unix timestamps:</p>\r
-<pre>$unixts = $recordset-&gt;UnixDate('#2002-02-30#'); <font color="green"># MS Access date =&gt; unix timestamp</font></pre>\r
-<p>The maximum length of a char/varchar field is also database specific. You can \r
-  only assume that field lengths of up to 250 characters are supported. This is \r
-  normally impractical for web based forum or content management systems. You \r
-  will need to be familiar with how databases handle large objects (LOBs). ADOdb \r
-  implements two functions, UpdateBlob( ) and UpdateClob( ) that allow you to \r
-  update fields holding Binary Large Objects (eg. pictures) and Character Large \r
-  Objects (eg. HTML articles):</p>\r
-<pre><font color=green># for oracle </font>\r
-$conn->Execute('INSERT INTO blobtable (id, blobcol) VALUES (1,empty_blob())'); \r
-$conn->UpdateBlob('blobtable','blobcol',$blobvalue,'id=1'); \r
-   \r
-<font color=green># non-oracle databases</font>\r
-$conn->Execute('INSERT INTO blobtable (id, blobcol) VALUES (1, null)'); \r
-$conn->UpdateBlob('blobtable','blobcol',$blobvalue,'id=1');\r
-</pre>\r
-<p>Null handling is another area where differences can occur. This is a mine-field, \r
-  because 3-value logic is tricky.\r
-<p>In general, I avoid using nulls except for dates and default all my numeric \r
-  and character fields to 0 or the empty string. This maintains consistency with \r
-  PHP, where empty strings and zero are treated as equivalent, and avoids SQL \r
-  ambiguities when you use the ANY and EXISTS operators. However if your database \r
-  has significant amounts of missing or unknown data, using nulls might be a good \r
-  idea. \r
-  <p>\r
-  ADOdb also supports a portable <a href=http://phplens.com/adodb/reference.functions.concat.html#ifnull>IfNull</a> function, so you can define what to display\r
-  if the field contains a null.\r
-<h3><b>Stored Procedures</b></h3>\r
-<p>Stored procedures are another problem area. Some databases allow recordsets \r
-  to be returned in a stored procedure (Microsoft SQL Server and Sybase), and \r
-  others only allow output parameters to be returned. Stored procedures sometimes \r
-  need to be wrapped in special syntax. For example, Oracle requires such code \r
-  to be wrapped in an anonymous block with BEGIN and END. Also internal sql operators \r
-  and functions such as +, ||, TRIM( ), SUBSTR( ) or INSTR( ) vary between vendors. \r
-</p>\r
-<p>An example of how to call a stored procedure with 2 parameters and 1 return \r
-  value follows:</p>\r
-<pre>  switch ($db->databaseType) {\r
-       case '<font color="#993300">mssql</font>':\r
-         $sql = <font color="#000000"><font color="#993333">'<font color="#993300">SP_RUNSOMETHING</font>'</font></font>; break;\r
-       case '<font color="#993300">oci8</font>':\r
-         $sql = \r
-<font color="#993300">   </font><font color="#000000"><font color="#993300">&quot;declare RETVAL integer;begin :RETVAL := </font><font color="#000000"><font color="#993333"><font color="#993300">SP_RUNSOMETHING</font></font></font><font color="#993300">(:myid,:group);end;&quot;;\r
-</font>          break;</font>\r
-       default:\r
-         die('<font color="#993300">Unsupported feature</font>');\r
-       }\r
-<font color="#000000"><font color="green">     # @RETVAL = SP_RUNSOMETHING @myid,@group</font>\r
-       $stmt = $db-&gt;PrepareSP($sql);        <br>    $db-&gt;Parameter($stmt,$id,'<font color="#993300">myid</font>'); \r
-       $db-&gt;Parameter($stmt,$group,'<font color="#993300">group</font>');\r
-       <font color="green"># true indicates output parameter<br>       </font>$db-&gt;Parameter($stmt,$ret,'<font color="#993300">RETVAL</font>',true); \r
-       $db-&gt;Execute($stmt); </font></pre>\r
-<p>As you can see, the ADOdb API is the same for both databases. But the stored \r
-  procedure SQL syntax is quite different between databases and is not portable, \r
-  so be forewarned! However sometimes you have little choice as some systems only \r
-  allow data to be accessed via stored procedures. This is when the ultimate portability \r
-  solution might be the only solution: <i>treating portable SQL as a localization \r
-  exercise...</i></p>\r
-<h3><b>SQL as a Localization Exercise</b></h3>\r
-<p> In general to provide real portability, you will have to treat SQL coding \r
-  as a localization exercise. In PHP, it has become common to define separate \r
-  language files for English, Russian, Korean, etc. Similarly, I would suggest \r
-  you have separate Sybase, Intebase, MySQL, etc files, and conditionally include \r
-  the SQL based on the database. For example, each MySQL SQL statement would be \r
-  stored in a separate variable, in a file called 'mysql-lang.inc.php'.</p>\r
-<pre>$sqlGetPassword = '<font color="#993300">select password from users where userid=%s</font>';\r
-$sqlSearchKeyword = &quot;<font color="#993300">SELECT * FROM articles WHERE match (title,body) against (%s</font>)&quot;;</pre>\r
-<p>In our main PHP file:</p>\r
-<pre><font color=green># define which database to load...</font>\r
-<b>$database = '<font color="#993300">mysql</font>';\r
-include_once(&quot;<font color="#993300">$database-lang.inc.php</font>&quot;);</b>\r
-\r
-$db = &amp;NewADOConnection($database);\r
-$db->PConnect(...) or die('<font color="#993300">Failed to connect to database</font>');\r
-\r
-<font color=green># search for a keyword $word</font>\r
-$rs = $db-&gt;Execute(sprintf($sqlSearchKeyWord,$db-&gt;qstr($word)));</pre>\r
-<p>Note that we quote the $word variable using the qstr( ) function. This is because \r
-  each database quotes strings using different conventions.</p>\r
-<p>\r
-<h3>Final Thoughts</h3>\r
-<p>The best way to ensure that you have portable SQL is to have your data tables designed using \r
-sound principles. Learn the theory of normalization and entity-relationship diagrams and model \r
-your data carefully. Understand how joins and indexes work and how they are used to tune performance.\r
-<p> Visit the following page for more references on database theory and vendors: \r
-  <a href="http://php.weblogs.com/sql_tutorial">http://php.weblogs.com/sql_tutorial</a>. \r
-  Also read this article on <a href=http://phplens.com/lens/php-book/optimizing-debugging-php.php>Optimizing PHP</a>.\r
-<p>\r
-<font size=1>(c) 2002-2003 John Lim.</font>\r
-\r
-</body>\r
-</html>\r
diff --git a/lib/adodb/tute.htm b/lib/adodb/tute.htm
deleted file mode 100644 (file)
index 3f2261e..0000000
+++ /dev/null
@@ -1,290 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-
-<html>
-<head>
-       <title>Tutorial: Moving from MySQL to ADODB</title>
-</head>
-
-<body bgcolor=white>
-<h1>Tutorial: Moving from MySQL to ADODB</h1>
-
-<pre>          You say eether and I say eyether, 
-               You say neether and I say nyther; 
-               Eether, eyether, neether, nyther - 
-               Let's call the whole thing off ! 
-<br>
-               You like potato and I like po-tah-to, 
-               You like tomato and I like to-mah-to; 
-               Potato, po-tah-to, tomato, to-mah-to - 
-               Let's call the whole thing off ! 
-</pre>
-<p>I love this song, especially the version with Louis Armstrong and Ella singing 
-  duet. It is all about how hard it is for two people in love to be compatible 
-  with each other. It's about compromise and finding a common ground, and that's 
-  what this article is all about. 
-<p>PHP is all about creating dynamic web-sites with the least fuss and the most 
-  fun. To create these websites we need to use databases to retrieve login information, 
-  to splash dynamic news onto the web page and store forum postings. So let's 
-  say we were using the popular MySQL database for this. Your company has done 
-  such a fantastic job that the Web site is more popular than your wildest dreams. 
-  You find that MySQL cannot scale to handle the workload; time to switch databases. 
-<p> Unfortunately in PHP every database is accessed slightly differently. To connect 
-  to MySQL, you would use <i>mysql_connect()</i>; when you decide to upgrade to 
-  Oracle or Microsoft SQL Server, you would use <i>ocilogon() </i>or <i>mssql_connect()</i> 
-  respectively. What is worse is that the parameters you use for the different 
-  connect functions are different also.. One database says po-tato, the other 
-  database says pota-to. Oh-oh. 
-<h3>Let's NOT call the whole thing off</h3>
-<p>A database wrapper library such as ADODB comes in handy when you need to ensure portability. It provides 
-  you with a common API to communicate with any supported database so you don't have to call things off. <p>
-
-<p>ADODB stands for Active Data Objects DataBase (sorry computer guys are sometimes 
-  not very original). ADODB currently supports MySQL, PostgreSQL, Oracle, Interbase, 
-  Microsoft SQL Server, Access, FoxPro, Sybase, ODBC and ADO. You can download 
-  ADODB from <a href=http://php.weblogs.com/adodb></a><a href="http://php.weblogs.com/adodb">http://php.weblogs.com/adodb</a>.
-<h3>MySQL Example</h3>
-<p>The most common database used with PHP is MySQL, so I guess you should be familiar 
-  with the following code. It connects to a MySQL server at <i>localhost</i>, 
-  database <i>mydb</i>, and executes an SQL select statement. The results are 
-  printed, one line per row. 
-<pre><font color="#666600">$db = <b>mysql_connect</b>(&quot;localhost&quot;, &quot;root&quot;, &quot;password&quot;);
-<b>mysql_select_db</b>(&quot;mydb&quot;,$db);</font>
-<font color="#660000">$result = <b>mysql_query</b>(&quot;SELECT * FROM employees&quot;,$db)</font><code><font color="#663300">;
-if ($result === false) die(&quot;failed&quot;);</font></code> 
-<font color="#006666"><b>while</b> ($fields =<b> mysql_fetch_row</b>($result)) &#123;
- <b>for</b> ($i=0, $max=sizeof($fields); $i &lt; $max; $i++) &#123;
-               <b>print</b> $fields[$i].' ';
- &#125;
- <b>print</b> &quot;&lt;br&gt;\n&quot;;
-&#125;</font> 
-</pre>
-<p>The above code has been color-coded by section. The first section is the connection 
-  phase. The second is the execution of the SQL, and the last section is displaying 
-  the fields. The <i>while</i> loop scans the rows of the result, while the <i>for</i> 
-  loop scans the fields in one row.</p>
-<p>Here is the equivalent code in ADODB</p>
-<pre><b><font color="#666600"> include(&quot;adodb.inc.php&quot;);</font></b><font color="#666600">
- $db = <b>NewADOConnection</b>('mysql');
- $db-&gt;<b>Connect</b>(&quot;localhost&quot;, &quot;root&quot;, &quot;password&quot;, &quot;mydb&quot;);</font>
- <font color="#663300">$result = $db-&gt;<b>Execute</b>(&quot;SELECT * FROM employees&quot;);
- </font><font color="#663300"></font><code><font color="#663300">if ($result === false) die(&quot;failed&quot;)</font></code><code><font color="#663300">;</font></code>  
- <font color="#006666"><b>while</b> (!$result-&gt;EOF) &#123;
-       <b>for</b> ($i=0, $max=$result-&gt;<b>FieldCount</b>(); $i &lt; $max; $i++)
-                  <b>print</b> $result-&gt;fields[$i].' ';
-       $result-&gt;<b>MoveNext</b>();
-       <b>print</b> &quot;&lt;br&gt;\n&quot;;
- &#125;</font> </pre>
-<p></p>
-<p>Now porting to Oracle is as simple as changing the second line to <code>NewADOConnection('oracle')</code>. 
-  Let's walk through the code...</p>
-<h3>Connecting to the Database</h3>
-<p></p>
-<pre><b><font color="#666600">include(&quot;adodb.inc.php&quot;);</font></b><font color="#666600">
-$db = <b>NewADOConnection</b>('mysql');
-$db-&gt;<b>Connect</b>(&quot;localhost&quot;, &quot;root&quot;, &quot;password&quot;, &quot;mydb&quot;);</font></pre>
-<p>The connection code is a bit more sophisticated than MySQL's because our needs 
-  are more sophisticated. In ADODB, we use an object-oriented approach to managing 
-  the complexity of handling multiple databases. We have different classes to 
-  handle different databases. If you aren't familiar with object-oriented programing, 
-  don't worry -- the complexity is all hidden away in the<code> NewADOConnection()</code> 
-  function.</p>
-<p>To conserve memory, we only load the PHP code specific to the database you 
-  are connecting to. We do this by calling <code>NewADOConnection(databasedriver)</code>. 
-  Legal database drivers include <i>mysql, mssql, oracle, oci8, postgres, sybase, 
-  vfp, access, ibase </i>and many others.</p>
-<p>Then we create a new instance of the connection class by calling <code>NewADOConnection()</code>. 
-  Finally we connect to the database using <code>$db-&gt;Connect(). </code></p>
-<h3>Executing the SQL</h3>
-<p><code><font color="#663300">$result = $db-&gt;<b>Execute</b>(&quot;SELECT * 
-  FROM employees&quot;);<br>
-  if ($result === false) die(&quot;failed&quot;)</font></code><code><font color="#663300">;</font></code> 
-  <br>
-</p>
-<p>Sending the SQL statement to the server is straight forward. Execute() will 
-  return a recordset object on successful execution. You should check $result 
-  as we do above.
-<p>An issue that confuses beginners is the fact that we have two types of objects 
-  in ADODB, the connection object and the recordset object. When do we use each?
-<p>The connection object ($db) is responsible for connecting to the database, 
-  formatting your SQL and querying the database server. The recordset object ($result) 
-  is responsible for retrieving the results and formatting the reply as text or 
-  as an array.
-<p>The only thing I need to add is that ADODB provides several helper functions 
-  for making INSERT and UPDATE statements easier, which we will cover in the Advanced 
-  section. 
-<h3>Retrieving the Data<br>
-</h3>
-<pre><font color="#006666"><b>while</b> (!$result-&gt;EOF) &#123;
-   <b>for</b> ($i=0, $max=$result-&gt;<b>FieldCount</b>(); $i &lt; $max; $i++)
-          <b>print</b> $result-&gt;fields[$i].' ';
-   $result-&gt;<b>MoveNext</b>();
-   <b>print</b> &quot;&lt;br&gt;\n&quot;;
-&#125;</font></pre>
-<p>The paradigm for getting the data is that it's like reading a file. For every 
-  line, we check first whether we have reached the end-of-file (EOF). While not 
-  end-of-file, loop through each field in the row. Then move to the next line 
-  (MoveNext) and repeat. 
-<p>The <code>$result-&gt;fields[]</code> array is generated by the PHP database 
-  extension. Some database extensions do not index the array by field name. 
-  To force indexing by name - that is associative arrays - 
-  use the $ADODB_FETCH_MODE global variable. 
-<pre>
-       $<b>ADODB_FETCH_MODE</b> = ADODB_FETCH_NUM;
-       $rs1 = $db->Execute('select * from table');
-       $<b>ADODB_FETCH_MODE</b> = ADODB_FETCH_ASSOC;
-       $rs2 = $db->Execute('select * from table');
-       print_r($rs1->fields); // shows <i>array([0]=>'v0',[1] =>'v1')</i>
-       print_r($rs2->fields); // shows <i>array(['col1']=>'v0',['col2'] =>'v1')</i>
-</pre>
-<p>
-As you can see in the above example, both recordsets store and use different fetch modes
-based on the $ADODB_FETCH_MODE setting when the recordset was created by Execute().</p>
-<h2>ADOConnection<a name="ADOConnection"></a></h2>
-<p>Object that performs the connection to the database, executes SQL statements 
-  and has a set of utility functions for standardising the format of SQL statements 
-  for issues such as concatenation and date formats.</p>
-  
-<h3>Other Useful Functions</h3>
-<p><code>$recordset-&gt;Move($pos)</code> scrolls to that particular row. ADODB supports forward 
-  scrolling for all databases. Some databases will not support backwards scrolling. 
-  This is normally not a problem as you can always cache records to simulate backwards 
-  scrolling. 
-<p><code>$recordset-&gt;RecordCount()</code> returns the number of records accessed by the 
-  SQL statement. Some databases will return -1 because it is not supported. 
-<p><code>$recordset-&gt;GetArray()</code> returns the result as an array. 
-<p><code>rs2html($recordset)</code> is a function that is generates a HTML table based on the 
-  $recordset passed to it. An example with the relevant lines in bold:
-<pre>   include('adodb.inc.php'); 
-   <b>include('tohtml.inc.php');</b> /* includes the rs2html function */
-   $conn = &amp;ADONewConnection('mysql'); 
-   $conn-&gt;PConnect('localhost','userid','password','database');
-   $rs = $conn-&gt;Execute('select * from table');
-  <b> rs2html($rs)</b>; /* recordset to html table */ </pre>
-<p>There are many other helper functions that are listed in the documentation available at <a href="http://php.weblogs.com/adodb_manual"></a><a href="http://php.weblogs.com/adodb_manual">http://php.weblogs.com/adodb_manual</a>. 
-<h2>Advanced Material</h2>
-<h3>Inserts and Updates </h3>
-<p>Let's say you want to insert the following data into a database. 
-<p><b>ID</b> = 3<br>
-  <b>TheDate</b>=mktime(0,0,0,8,31,2001) /* 31st August 2001 */<br>
-  <b>Note</b>= sugar why don't we call it off 
-<p>When you move to another database, your insert might no longer work.</p>
-<p>The first problem is that each database has a different default date format. 
-  MySQL expects YYYY-MM-DD format, while other databases have different defaults. 
-  ADODB has a function called DBDate() that addresses this issue by converting 
-  converting the date to the correct format.</p>
-<p>The next problem is that the <b>don't</b> in the Note needs to be quoted. In 
-  MySQL, we use <b>don\'t</b> but in some other databases (Sybase, Access, Microsoft 
-  SQL Server) we use <b>don''t. </b>The qstr() function addresses this issue.</p>
-<p>So how do we use the functions? Like this:</p>
-<pre>$sql = &quot;INSERT INTO table (id, thedate,note) values (&quot; 
-   . $<b>ID</b> . ','
-   . $db-&gt;DBDate($<b>TheDate</b>) .','
-   . $db-&gt;qstr($<b>Note</b>).&quot;)&quot;;
-$db-&gt;Execute($sql);</pre>
-<p>ADODB also supports <code>$connection-&gt;Affected_Rows()</code> (returns the 
-  number of rows affected by last update or delete) and <code>$recordset-&gt;Insert_ID()</code> 
-  (returns last autoincrement number generated by an insert statement). Be forewarned 
-  that not all databases support the two functions.<br>
-</p>
-<h3>MetaTypes</h3>
-<p>You can find out more information about each of the fields (I use the words 
-  fields and columns interchangebly) you are selecting by calling the recordset 
-  method <code>FetchField($fieldoffset)</code>. This will return an object with 
-  3 properties: name, type and max_length. 
-<pre>For example:</pre>
-<pre>$recordset = $conn-&gt;Execute(&quot;select adate from table&quot;);<br>$f0 = $recordset-&gt;FetchField(0);
-</pre>
-<p>Then <code>$f0-&gt;name</code> will hold <i>'adata'</i>, <code>$f0-&gt;type</code> 
-  will be set to '<i>date'</i>. If the max_length is unknown, it will be set to 
-  -1. 
-<p>One problem with handling different databases is that each database often calls 
-  the same type by a different name. For example a <i>timestamp</i> type is called 
-  <i>datetime</i> in one database and <i>time</i> in another. So ADODB has a special 
-  <code>MetaType($type, $max_length)</code> function that standardises the types 
-  to the following: 
-<p>C: character and varchar types<br>
-  X: text or long character (eg. more than 255 bytes wide).<br>
-  B: blob or binary image<br>
-  D: date<br>
-  T: timestamp<br>
-  L: logical (boolean)<br>
-  I: integer<br>
-  N: numeric (float, double, money) 
-<p>In the above date example, 
-<p><code>$recordset = $conn-&gt;Execute(&quot;select adate from table&quot;);<br>
-  $f0 = $recordset-&gt;FetchField(0);<br>
-  $type = $recordset-&gt;MetaType($f0-&gt;type, $f0-&gt;max_length);<br>
-  print $type; /* should print 'D'</code> */
-<p> 
-<p><b>Select Limit and Top Support</b> 
-<p>ADODB has a function called $connection->SelectLimit($sql,$nrows,$offset) that allows
-you to retrieve a subset of the recordset. This will take advantage of native
-SELECT TOP on Microsoft products and SELECT ... LIMIT with PostgreSQL and MySQL, and
-emulated if the database does not support it.
-<p><b>Caching Support</b> 
-<p>ADODB allows you to cache recordsets in your file system, and only requery the database
-server after a certain timeout period with $connection->CacheExecute($secs2cache,$sql) and 
-$connection->CacheSelectLimit($secs2cache,$sql,$nrows,$offset).
-<p><b>PHP4 Session Handler Support</b> 
-<p>ADODB also supports PHP4 session handlers. You can store your session variables 
-  in a database for true scalability using ADODB. For further information, visit 
-  <a href="http://php.weblogs.com/adodb-sessions"></a><a href="http://php.weblogs.com/adodb-sessions">http://php.weblogs.com/adodb-sessions</a>
-<h3>Commercial Use Encouraged</h3>
-<p>If you plan to write commercial PHP applications that you want to resell, you should consider ADODB. It has been released using the lesser GPL, which means you can legally include it in commercial applications, while keeping your code proprietary. Commercial use of ADODB is strongly encouraged! We are using it internally for this reason.<p>
-
-<h2>Conclusion</h2>
-<p>As a thank you for finishing this article, here are the complete lyrics for 
-  <i>let's call the whole thing off</i>.<br>
-  <br>
-<pre>
-   Refrain 
-<br>
-               You say eether and I say eyether, 
-               You say neether and I say nyther; 
-               Eether, eyether, neether, nyther - 
-               Let's call the whole thing off ! 
-<br>
-               You like potato and I like po-tah-to, 
-               You like tomato and I like to-mah-to; 
-               Potato, po-tah-to, tomato, to-mah-to - 
-               Let's call the whole thing off ! 
-<br>
-But oh, if we call the whole thing off, then we must part. 
-And oh, if we ever part, then that might break my heart. 
-<br>
-               So, if you like pajamas and I like pa-jah-mas, 
-               I'll wear pajamas and give up pa-jah-mas. 
-               For we know we 
-               Need each other, so we 
-               Better call the calling off off. 
-               Let's call the whole thing off ! 
-<br>
-   Second Refrain 
-<br>
-               You say laughter and I say lawfter, 
-               You say after and I say awfter; 
-               Laughter, lawfter, after, awfter - 
-               Let's call the whole thing off ! 
-<br>
-               You like vanilla and I like vanella, 
-               You, sa's'parilla and I sa's'parella; 
-               Vanilla, vanella, choc'late, strawb'ry - 
-               Let's call the whole thing off ! 
-<br>
-But oh, if we call the whole thing off, then we must part. 
-And oh, if we ever part, then that might break my heart. 
-<br>
-               So, if you go for oysters and I go for ersters, 
-               I'll order oysters and cancel the ersters. 
-               For we know we 
-               Need each other, so we 
-               Better call the calling off off. 
-               Let's call the whole thing off ! 
-  </pre>
-<p><font size=2>Song and lyrics by George and Ira Gershwin, introduced by Fred Astaire and Ginger Rogers
-in the film "Shall We Dance?"  </font><p>
-<p>
-(c)2001-2002 John Lim.
-
-</body>
-</html>
index e3a1acd687af200bea9b4b87ca39e4b889aec9cf..4c688448a8c907a7a7d81ee7630f161cc4db820b 100644 (file)
@@ -157,10 +157,11 @@ function search_users($courseid, $groupid, $searchtext, $sort='', $exceptions=''
     } else {
 
         if ($groupid) {
+//TODO:check. Remove group DB dependencies.
             return get_records_sql("SELECT u.id, u.firstname, u.lastname, u.email
                           FROM {$CFG->prefix}user u,
-                               {$CFG->prefix}groups_members g
-                          WHERE $select AND g.groupid = '$groupid' AND g.userid = u.id
+                               ".groups_members_from_sql()."
+                          WHERE $select AND ".groups_members_where_sql($groupid, 'u.id')."
                               AND ($fullname $LIKE '%$searchtext%' OR u.email $LIKE '%$searchtext%')
                               $except $order");
         } else {
@@ -375,7 +376,11 @@ function get_users_not_fully_set_up($cutofftime=2000000000) {
 }
 
 
-/**
+/** TODO: functions now in /group/lib/legacylib.php (3)
+get_groups
+get_group_users
+user_group
+
  * Returns an array of group objects that the user is a member of
  * in the given course.  If userid isn't specified, then return a
  * list of all groups in the course.
@@ -384,7 +389,7 @@ function get_users_not_fully_set_up($cutofftime=2000000000) {
  * @param int $courseid The id of the course in question.
  * @param int $userid The id of the user in question as found in the 'user' table 'id' field.
  * @return object
- */
+ *
 function get_groups($courseid, $userid=0) {
     global $CFG;
 
@@ -410,7 +415,7 @@ function get_groups($courseid, $userid=0) {
  * @param string $sort ?
  * @param string $exceptions ?
  * @return object
- */
+ *
 function get_group_users($groupid, $sort='u.lastaccess DESC', $exceptions='', $fields='u.*') {
     global $CFG;
     if (!empty($exceptions)) {
@@ -441,7 +446,7 @@ function get_group_users($groupid, $sort='u.lastaccess DESC', $exceptions='', $f
  * @param int $userid The id of the user as found in the 'user' table.
  * @param int $groupid The id of the group the user is in.
  * @return object
- */
+ *
 function user_group($courseid, $userid) {
     global $CFG;
 
@@ -453,7 +458,7 @@ function user_group($courseid, $userid) {
                                AND m.userid = '$userid'
                                ORDER BY name ASC");
 }
-
+*/
 
 
 
index d49122367bd448fec2824502d008e3e0247640ea..8b76616b21b6711f5631809507b878a959c60be7 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="lib/db" VERSION="20061122" COMMENT="XMLDB file for core Moodle tables"
+<XMLDB PATH="lib/db" VERSION="20061204" COMMENT="XMLDB file for core Moodle tables"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
 >
         <INDEX NAME="courseid" UNIQUE="false" FIELDS="courseid"/>
       </INDEXES>
     </TABLE>
-    <TABLE NAME="grade_preferences" COMMENT="Preferences of the gradebook for each course" PREVIOUS="grade_letter" NEXT="groups">
+    <TABLE NAME="grade_preferences" COMMENT="Preferences of the gradebook for each course" PREVIOUS="grade_letter" NEXT="log">
       <FIELDS>
         <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="courseid"/>
         <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="preference"/>
         <INDEX NAME="courseid-preference" UNIQUE="true" FIELDS="courseid, preference"/>
       </INDEXES>
     </TABLE>
-    <TABLE NAME="groups" COMMENT="Each record is a group in a course" PREVIOUS="grade_preferences" NEXT="groups_members">
-      <FIELDS>
-        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="courseid"/>
-        <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="name"/>
-        <FIELD NAME="name" TYPE="char" LENGTH="254" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="courseid" NEXT="description"/>
-        <FIELD NAME="description" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="name" NEXT="password"/>
-        <FIELD NAME="password" TYPE="char" LENGTH="50" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="description" NEXT="lang"/>
-        <FIELD NAME="lang" TYPE="char" LENGTH="10" NOTNULL="true" DEFAULT="en" SEQUENCE="false" ENUM="false" PREVIOUS="password" NEXT="theme"/>
-        <FIELD NAME="theme" TYPE="char" LENGTH="50" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="lang" NEXT="picture"/>
-        <FIELD NAME="picture" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="theme" NEXT="hidepicture"/>
-        <FIELD NAME="hidepicture" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="picture" NEXT="timecreated"/>
-        <FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="hidepicture" NEXT="timemodified"/>
-        <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="timecreated"/>
-      </FIELDS>
-      <KEYS>
-        <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for groups"/>
-      </KEYS>
-      <INDEXES>
-        <INDEX NAME="courseid" UNIQUE="false" FIELDS="courseid"/>
-      </INDEXES>
-    </TABLE>
-    <TABLE NAME="groups_members" COMMENT="Lists memberships of users to groups" PREVIOUS="groups" NEXT="log">
-      <FIELDS>
-        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="groupid"/>
-        <FIELD NAME="groupid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="userid"/>
-        <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="groupid" NEXT="timeadded"/>
-        <FIELD NAME="timeadded" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="userid"/>
-      </FIELDS>
-      <KEYS>
-        <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for groups_members"/>
-      </KEYS>
-      <INDEXES>
-        <INDEX NAME="groupid" UNIQUE="false" FIELDS="groupid" NEXT="userid"/>
-        <INDEX NAME="userid" UNIQUE="false" FIELDS="userid" PREVIOUS="groupid"/>
-      </INDEXES>
-    </TABLE>
-    <TABLE NAME="log" COMMENT="Every action is logged as far as possible" PREVIOUS="groups_members" NEXT="log_display">
+    <TABLE NAME="log" COMMENT="Every action is logged as far as possible" PREVIOUS="grade_preferences" NEXT="log_display">
       <FIELDS>
         <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="time"/>
         <FIELD NAME="time" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="userid"/>
diff --git a/lib/db/migrate2utf8.php b/lib/db/migrate2utf8.php
deleted file mode 100755 (executable)
index f6af8e4..0000000
+++ /dev/null
@@ -1,2308 +0,0 @@
-<?php // $Id$
-// This is a one-shot function that converts an entire table on row basis.
-
-function migrate2utf8_user($fields, $crash, $debug, $maxrecords, $done, $tablestoconvert) {
-
-    global $CFG, $db, $processedrecords, $globallang;
-
-    /* Previously to change the field to LONGBLOB, we are going to
-       use Meta info to fetch the NULL/NOT NULL status of the field.
-       Then, when converting back the field to its final UTF8 status
-       we'll apply such status (and default)
-       This has been added on 1.7 because we are in the process of
-       converting some fields to NULL and the assumption of all the 
-       CHAR/TEXT fields being always NOT NULL isn't valid anymore! 
-       Note that this code will leave remaining NOT NULL fiels
-       unmodified at all, folowing the old approach 
-    */
-        $cols = $db->MetaColumns($CFG->prefix.'user');
-        $cols = array_change_key_case($cols, CASE_LOWER); ///lowercase col names
-
-    // convert all columns to blobs
-    foreach ($fields as $field) {
-        $fieldname = isset($field['@']['name'])?$field['@']['name']:"";
-        $type = isset($field['@']['type'])?$field['@']['type']:"";
-        $length = isset($field['@']['length'])?$field['@']['length']:"";
-
-        $dropindex = isset($field['@']['dropindex'])?$field['@']['dropindex']:"";
-        isset($field['@']['addindex'])?$addindexarray[] = $field['@']['addindex']:"";
-        isset($field['@']['adduniqueindex'])?$adduniqueindexarray[] = $field['@']['adduniqueindex']:"";
-
-        /// Drop index here
-
-        /* Note: we aren't going to drop indexes from migration
-           functions anymore. The main script is responsible for
-           both dropping and recreating all the indexes present
-           in each table
-           
-        if ($dropindex) {
-            $SQL = 'ALTER TABLE '.$CFG->prefix.'user DROP INDEX '.$dropindex.';';
-            $SQL1 = 'ALTER TABLE '.$CFG->prefix.'user DROP INDEX '.$CFG->prefix.$dropindex.';'; // see bug 5205
-            if ($debug) {
-                $db->debug=999;
-            }
-            execute_sql($SQL, false); // see bug 5205
-            execute_sql($SQL1, false); // see bug 5205
-        } */
-
-        /// Change column encoding here
-
-        $SQL = 'ALTER TABLE '.$CFG->prefix.'user CHANGE '.$fieldname.' '.$fieldname.' LONGBLOB';
-
-        if ($debug) {
-            $db->debug=999;
-        }
-
-        if ($fieldname != 'dummy') {
-            execute_sql($SQL, $debug);
-        }
-    }
-
-    /// convert all records
-    
-    $totalrecords = count_records_sql("select count(*) from {$CFG->prefix}user");
-    $counter = 0;
-    $recordsetsize = 50;
-    
-    if ($crash) {    //if resuming from crash
-        //find the number of records with id smaller than the crash id
-        $indexSQL = 'SELECT COUNT(*) FROM '.$CFG->prefix.'user WHERE id < '.$crash->record;
-        $counter = count_records_sql($indexSQL);
-    }
-
-    while ($counter < $totalrecords) {    //while there is still something
-        $SQL = 'SELECT * FROM '.$CFG->prefix.'user ORDER BY id ASC';
-        if ($records = get_records_sql($SQL, $counter, $recordsetsize)) {
-            foreach ($records as $record) {
-
-            //if we are up this far, either no crash, or crash with same table, field name.
-                if ($crash){
-                    if ($crash->record != $record->id) {    //might set to < just in case record is deleted
-                        continue;
-                    } else {
-                        $crash = 0;
-                        print_heading('recovering from user'.'--'.$fieldname.'--'.$record->id);
-                    }
-                }
-                
-                // write to config table to keep track of current table
-                $migrationconfig = get_record('config','name','dbmigration');
-                $migrationconfig->name = 'dbmigration';
-                $migrationconfig->value = 'user'.'##'.'NAfield'.'##'.$record->id;
-                update_record('config',$migrationconfig);
-                
-                // this is the only encoding we need for this table
-                if ($globallang) {
-                               $fromenc = $globallang;
-                       } else {
-                       $fromenc = get_original_encoding($CFG->lang,'',$record->lang);
-                }
-
-                if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-                    foreach ($fields as $field) {
-
-                        if (isset($field['@']['name'])) {
-                            $fieldname = $field['@']['name'];
-                        }
-
-                        if (isset($field['@']['method'])) {
-                            $method = $field['@']['method'];
-                        }
-                        
-                        if ($method != 'NO_CONV' && !empty($record->{$fieldname})) { // only convert if empty
-                            if ($fieldname != 'lang') {
-                                $record->{$fieldname} = utfconvert($record->{$fieldname}, $fromenc);
-                            } else { // special lang treatment
-                                if (strstr($record->lang, 'utf8') === false) {    //user not using utf8 lang
-                                    $record->lang = $record->lang.'_utf8';
-                                }
-
-                                $langsused = get_record('config','name','langsused');
-                                $langs = explode(',',$langsused->value);
-                                if (!in_array($record->lang, $langs)) {
-                                    $langsused->value .= ','.$record->lang;
-                                    migrate2utf8_update_record('config',$langsused);
-                                }
-                            } // close special treatment for lang
-                        }
-                    }
-                }
-                
-                migrate2utf8_update_record('user', $record);
-
-                $counter++;
-                if ($maxrecords) {
-                    if ($processedrecords == $maxrecords) {
-                        notify($maxrecords.' records processed. Migration Process halted');
-                        print_continue('utfdbmigrate.php?confirm=1&amp;maxrecords='.$maxrecords.'&amp;sesskey='.sesskey());
-                        print_footer();
-                        die();
-                    }
-                }
-
-                $processedrecords++;
-                //print some output once in a while
-                
-                if (($processedrecords) % 1000 == 0) {
-                    print_progress($done, $tablestoconvert, 5, 1, 'Processing: user');
-                }
-            }
-        }
-    }
-
-    // done converting all records!
-
-    // convert all columns back
-    foreach ($fields as $field) {
-        $fieldname = isset($field['@']['name'])?$field['@']['name']:"";
-        $type = isset($field['@']['type'])?$field['@']['type']:"";
-        $length = isset($field['@']['length'])?$field['@']['length']:"";
-        $default = isset($field['@']['default'])?"'".$field['@']['default']."'":"''";
-
-        // Now based on the Metainfo retrieved before conversion, leave some fields
-        // nulable and without default.
-        $notnull = 'NOT NULL';  ///Old default
-        if ($col = $cols[strtolower($fieldname)]) {
-        /// If the column was null before UTF-8 migration, save it
-            if (!$col->not_null) {
-                $notnull = 'NULL';
-            /// And, if the column had an empty string as default, make it NULL now
-                if ($default == "''") {
-                    $default = 'NULL';
-                }
-            }
-        }
-
-        $SQL = 'ALTER TABLE '.$CFG->prefix.'user CHANGE '.$fieldname.' '.$fieldname.' '.$type;
-        if ($length > 0) {
-            $SQL.='('.$length.') ';
-        }
-
-        $SQL.=' CHARACTER SET utf8 ' . $notnull . ' DEFAULT '.$default.';';
-            if ($debug) {
-            $db->debug=999;
-        }
-        if ($fieldname != 'dummy') {
-            execute_sql($SQL, $debug);
-        }
-    }
-    
-    /// Add index back
-
-    /* Note: we aren't going to drop indexes from migration
-       functions anymore. The main script is responsible for
-       both dropping and recreating all the indexes present
-       in each table
-
-    $alter = 0;
-    $SQL = 'ALTER TABLE '.$CFG->prefix.'user';
-
-    if (!empty($addindexarray)) {
-        foreach ($addindexarray as $aidx){
-            $SQL .= ' ADD INDEX '.$aidx.',';
-            $alter++;
-        }
-    }
-
-    if (!empty($adduniqueindexarray)) {
-        foreach ($adduniqueindexarray as $auidx){
-            $SQL .= ' ADD UNIQUE INDEX '.$auidx.',';
-            $alter++;
-        }
-    }
-
-    $SQL = rtrim($SQL, ', ');
-    $SQL.=';';
-
-    if ($alter) {
-        if ($debug) {
-            $db->debug=999;
-        }
-
-        execute_sql($SQL, $debug);
-        if ($debug) {
-            $db->debug=0;
-        }
-    }
-    /// Done adding index back */
-
-}
-
-function migrate2utf8_user_info_category_name($recordid) {
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$uic = get_record('user_info_category', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = null;  //Non existing!
-               $userlang = null; // Non existing
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// Initialise $result
-    $result = $uic->name;
-
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($uic->name, $fromenc);
-
-        $newuic = new object;
-        $newuic->id = $recordid;
-        $newuic->name = $result;
-        migrate2utf8_update_record('user_info_category',$newuic);
-    }
-/// And finally, just return the converted field
-    return $result;  
-}
-
-function migrate2utf8_user_info_data_data($recordid) {
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$uid = get_record('user_info_data', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    
-    $user = get_record_sql("SELECT u.lang, u.lang 
-                            FROM {$CFG->prefix}user u,
-                                 {$CFG->prefix}user_info_data uid
-                            WHERE u.id = uid.userid
-                                  AND uid.id = $recordid");
-    
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = null;  //Non existing!
-               $userlang = $user->lang; // Non existing
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// Initialise $result
-    $result = $uid->data;
-
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($uic->data, $fromenc);
-
-        $newuid = new object;
-        $newuid->id = $recordid;
-        $newuid->data = $result;
-        migrate2utf8_update_record('user_info_data',$newuid);
-    }
-/// And finally, just return the converted field
-    return $result;  
-}
-
-function migrate2utf8_user_info_field_name($recordid) {
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$uif = get_record('user_info_field', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = null;  //Non existing!
-               $userlang = null; // Non existing
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// Initialise $result
-    $result = $uif->name;
-
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($uif->name, $fromenc);
-        $newuif = new object;
-        $newuif->id = $recordid;
-        $newuif->name = $result;
-        migrate2utf8_update_record('user_info_field',$newuif);
-    }
-/// And finally, just return the converted field
-    return $result;  
-}
-
-function migrate2utf8_user_info_field_defaultdata($recordid) {
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$uif = get_record('user_info_field', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = null;  //Non existing!
-               $userlang = null; // Non existing
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// Initialise $result
-    $result = $uif->name;
-
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($uif->defaultdata, $fromenc);
-        $newuif = new object;
-        $newuif->id = $recordid;
-        $newuif->defaultdata = $result;
-        migrate2utf8_update_record('user_info_field',$newuif);
-    }
-/// And finally, just return the converted field
-    return $result;  
-}
-
-function migrate2utf8_role_name($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$role = get_record('role', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = null;  //Non existing!
-               $userlang = null; // Non existing
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// Initialise $result
-    $result = $role->name;
-
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($role->name, $fromenc);
-
-        $newrole = new object;
-        $newrole->id = $recordid;
-        $newrole->name = $result;
-        migrate2utf8_update_record('role',$newrole);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_role_shortname($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$role = get_record('role', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = null;  //Non existing!
-               $userlang = null; // Non existing
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// Initialise $result
-    $result = $role->name;
-
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($role->shortname, $fromenc);
-
-        $newrole = new object;
-        $newrole->id = $recordid;
-        $newrole->shortname = $result;
-        migrate2utf8_update_record('role',$newrole);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_role_description($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$role = get_record('role', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = null;  //Non existing!
-               $userlang = null; // Non existing
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// Initialise $result
-    $result = $role->description;
-
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($role->description, $fromenc);
-
-        $newrole = new object;
-        $newrole->id = $recordid;
-        $newrole->description = $result;
-        migrate2utf8_update_record('role',$newrole);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-function migrate2utf8_role_names_text($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$rn = get_record('role_names', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = null;  //Non existing!
-               $userlang = null; // Non existing
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-/// We are going to use textlib facilities
-
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($rn->text, $fromenc);
-
-        $newrn = new object;
-        $newrn->id = $recordid;
-        $newrn->text = $result;
-        migrate2utf8_update_record('role_names',$newrn);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_post_subject($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$post = get_record('post', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = null;  //Non existing!
-        if ($post->userid) {
-            $userlang = get_user_lang($post->userid);
-        }
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-/// We are going to use textlib facilities
-
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($post->subject, $fromenc);
-
-        $newpost = new object;
-        $newpost->id = $recordid;
-        $newpost->subject = $result;
-        migrate2utf8_update_record('event',$newpost);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_post_summary($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$post = get_record('post', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = null;  //Non existing!
-        if ($post->userid) {
-            $userlang = get_user_lang($post->userid);
-        }
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-/// We are going to use textlib facilities
-
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($post->summary, $fromenc);
-
-        $newpost = new object;
-        $newpost->id = $recordid;
-        $newpost->summary = $result;
-        migrate2utf8_update_record('event',$newpost);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_post_content($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$post = get_record('post', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = null;  //Non existing!
-        if ($post->userid) {
-            $userlang = get_user_lang($post->userid);
-        }
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-/// We are going to use textlib facilities
-
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($post->content, $fromenc);
-
-        $newpost = new object;
-        $newpost->id = $recordid;
-        $newpost->content = $result;
-        migrate2utf8_update_record('event',$newpost);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_tags_text($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$tags = get_record('tags', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = null;  //Non existing!
-        if ($tags->userid) {
-            $userlang = get_user_lang($tags->userid);
-        }
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-/// We are going to use textlib facilities
-
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($tags->text, $fromenc);
-
-        $newtags = new object;
-        $newtags->id = $recordid;
-        $newtags->text = $result;
-        migrate2utf8_update_record('tags',$newtags);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_event_name($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$event = get_record('event', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($event->courseid);  //Non existing!
-        if ($event->userid) {
-            $userlang = get_user_lang($event->userid);
-        } else {
-            $userlang = get_main_teacher_lang($event->courseid);
-        }
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-/// We are going to use textlib facilities
-
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($event->name, $fromenc);
-
-        $newevent = new object;
-        $newevent->id = $recordid;
-        $newevent->name = $result;
-        migrate2utf8_update_record('event',$newevent);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_event_description($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$event = get_record('event', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($event->courseid);  //Non existing!
-        if ($event->userid) {
-            $userlang = get_user_lang($event->userid);
-        } else {
-            $userlang = get_main_teacher_lang($event->courseid);
-        }
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-/// We are going to use textlib facilities
-
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($event->description, $fromenc);
-
-        $newevent = new object;
-        $newevent->id = $recordid;
-        $newevent->description = $result;
-        migrate2utf8_update_record('event',$newevent);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_config_value($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$config = get_record('config', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = null;  //Non existing!
-        $userlang   = null; //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// Initialise $result
-    $result = $config->value;
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($config->value, $fromenc);
-
-        $newconfig = new object;
-        $newconfig->id = $recordid;
-        $newconfig->value = $result;
-        migrate2utf8_update_record('config',$newconfig);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_config_plugins_value($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$configplugins = get_record('config_plugins', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = null;  //Non existing!
-        $userlang   = null; //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($configplugins->value, $fromenc);
-
-        $newconfigplugins = new object;
-        $newconfigplugins->id = $recordid;
-        $newconfigplugins->value = $result;
-        migrate2utf8_update_record('config_plugins',$newconfigplugins);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_course_categories_name($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$coursecategories = get_record('course_categories', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = null;  //Non existing!
-        $userlang   = null; //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// Initialise $result
-    $result = $coursecategories->name;
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($coursecategories->name, $fromenc);
-
-        $newcoursecategories = new object;
-        $newcoursecategories->id = $recordid;
-        $newcoursecategories->name = $result;
-        migrate2utf8_update_record('course_categories',$newcoursecategories);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_course_categories_description($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$coursecategories = get_record('course_categories', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = null;  //Non existing!
-        $userlang   = null; //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($coursecategories->description, $fromenc);
-
-        $newcoursecategories = new object;
-        $newcoursecategories->id = $recordid;
-        $newcoursecategories->description = $result;
-        migrate2utf8_update_record('course_categories',$newcoursecategories);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_course_sections_summary($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    
-    if (!$coursesections = get_record('course_sections', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($coursesections->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($coursesections->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($coursesections->summary, $fromenc);
-
-        $newcoursesections = new object;
-        $newcoursesections->id = $recordid;
-        $newcoursesections->summary = $result;
-        migrate2utf8_update_record('course_sections',$newcoursesections);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_course_request_fullname($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$courserequest = get_record('course_request', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $user = get_record('user','id',$courserequest->requester);
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = null;  //Non existing!
-        $userlang   = $user->lang; //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($courserequest->fullname, $fromenc);
-
-        $newcourserequest = new object;
-        $newcourserequest->id = $recordid;
-        $newcourserequest->fullname = $result;
-        migrate2utf8_update_record('course_request',$newcourserequest);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_course_request_shortname($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$courserequest = get_record('course_request', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $user = get_record('user','id',$courserequest->requester);
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = null;  //Non existing!
-        $userlang   = $user->lang; //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($courserequest->shortname, $fromenc);
-
-        $newcourserequest = new object;
-        $newcourserequest->id = $recordid;
-        $newcourserequest->shortname = $result;
-        migrate2utf8_update_record('course_request',$newcourserequest);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_course_request_summary($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$courserequest = get_record('course_request', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $user = get_record('user','id',$courserequest->requester);
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = null;  //Non existing!
-        $userlang   = $user->lang; //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($courserequest->summary, $fromenc);
-
-        $newcourserequest = new object;
-        $newcourserequest->id = $recordid;
-        $newcourserequest->summary = $result;
-        migrate2utf8_update_record('course_request',$newcourserequest);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_course_request_reason($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$courserequest = get_record('course_request', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $user = get_record('user','id',$courserequest->requester);
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = null;  //Non existing!
-        $userlang   = $user->lang; //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($courserequest->reason, $fromenc);
-
-        $newcourserequest = new object;
-        $newcourserequest->id = $recordid;
-        $newcourserequest->reason = $result;
-        migrate2utf8_update_record('course_request',$newcourserequest);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_course_request_password($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$courserequest = get_record('course_request', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $user = get_record('user','id',$courserequest->requester);
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = null;  //Non existing!
-        $userlang   = $user->lang; //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($courserequest->password, $fromenc);
-
-        $newcourserequest = new object;
-        $newcourserequest->id = $recordid;
-        $newcourserequest->password = $result;
-        migrate2utf8_update_record('course_request',$newcourserequest);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_grade_category_name($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$gradecategory = get_record('grade_category', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($gradecategory->courseid);  //Non existing!
-        $userlang   = get_main_teacher_lang($gradecategory->courseid); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($gradecategory->name, $fromenc);
-
-        $newgradecategory = new object;
-        $newgradecategory->id = $recordid;
-        $newgradecategory->name = $result;
-        migrate2utf8_update_record('grade_category',$newgradecategory);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_grade_letter_letter($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$gradeletter = get_record('grade_letter', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($gradeletter->courseid);  //Non existing!
-        $userlang   = get_main_teacher_lang($gradeletter->courseid); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($gradeletter->letter, $fromenc);
-
-        $newgradeletter = new object;
-        $newgradeletter->id = $recordid;
-        $newgradeletter->letter = $result;
-        migrate2utf8_update_record('grade_letter',$newgradeletter);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_groups_name($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$group = get_record('groups', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($group->courseid);  //Non existing!
-        $userlang   = get_main_teacher_lang($group->courseid); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($group->name, $fromenc);
-
-        $newgroup = new object;
-        $newgroup->id = $recordid;
-        $newgroup->name = $result;
-        migrate2utf8_update_record('groups',$newgroup);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_groups_description($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$group = get_record('groups', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($group->courseid);  //Non existing!
-        $userlang   = get_main_teacher_lang($group->courseid); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($group->description, $fromenc);
-
-        $newgroup = new object;
-        $newgroup->id = $recordid;
-        $newgroup->description = $result;
-        migrate2utf8_update_record('groups',$newgroup);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_groups_lang($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$group = get_record('groups', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($group->courseid);  //Non existing!
-        $userlang   = get_main_teacher_lang($group->courseid); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($group->lang, $fromenc);
-
-        $newgroup = new object;
-        $newgroup->id = $recordid;
-        $newgroup->lang = $result;
-        migrate2utf8_update_record('groups',$newgroup);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_groups_password($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$group = get_record('groups', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($group->courseid);  //Non existing!
-        $userlang   = get_main_teacher_lang($group->courseid); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($group->password, $fromenc);
-
-        $newgroup = new object;
-        $newgroup->id = $recordid;
-        $newgroup->password = $result;
-        migrate2utf8_update_record('groups',$newgroup);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_message_message($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$message = get_record('message', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $user = get_record('user','id',$message->useridfrom);
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = null;  //Non existing!
-        $userlang   = $user->lang; //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($message->message, $fromenc);
-
-        $newmessage = new object;
-        $newmessage->id = $recordid;
-        $newmessage->message = $result;
-        migrate2utf8_update_record('message',$newmessage);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_message_read_message($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$messageread = get_record('message_read', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $user = get_record('user','id',$messageread->useridfrom);
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = null;  //Non existing!
-        $userlang   = $user->lang; //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($messageread->message, $fromenc);
-
-        $newmessageread = new object;
-        $newmessageread->id = $recordid;
-        $newmessageread->message = $result;
-        migrate2utf8_update_record('message_read',$newmessageread);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_modules_search($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$modules = get_record('modules', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = null;  //Non existing!
-        $userlang   = null; //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($modules->search, $fromenc);
-
-        $newmodules = new object;
-        $newmodules->id = $recordid;
-        $newmodules->search = $result;
-        migrate2utf8_update_record('modules',$newmodules);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_user_idnumber($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $user = get_record('user','id',$recordid);
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = null;  //Non existing!
-        $userlang   = $user->lang; //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($user->idnumber, $fromenc);
-
-        $newuser = new object;
-        $newuser->id = $recordid;
-        $newuser->idnumber = $result;
-        migrate2utf8_update_record('user',$newuser);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_user_firstname($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $user = get_record('user','id',$recordid);
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = null;  //Non existing!
-        $userlang   = $user->lang; //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($user->firstname, $fromenc);
-
-        $newuser = new object;
-        $newuser->id = $recordid;
-        $newuser->firstname = $result;
-        migrate2utf8_update_record('user',$newuser);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_user_lastname($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $user = get_record('user','id',$recordid);
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = null;  //Non existing!
-        $userlang   = $user->lang; //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($user->lastname, $fromenc);
-
-        $newuser = new object;
-        $newuser->id = $recordid;
-        $newuser->lastname = $result;
-        migrate2utf8_update_record('user',$newuser);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_user_institution($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $user = get_record('user','id',$recordid);
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = null;  //Non existing!
-        $userlang   = $user->lang; //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($user->institution , $fromenc);
-
-        $newuser = new object;
-        $newuser->id = $recordid;
-        $newuser->institution = $result;
-        migrate2utf8_update_record('user',$newuser);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_user_department($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $user = get_record('user','id',$recordid);
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = null;  //Non existing!
-        $userlang   = $user->lang; //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($user->department, $fromenc);
-
-        $newuser = new object;
-        $newuser->id = $recordid;
-        $newuser->department = $result;
-        migrate2utf8_update_record('user',$newuser);
-    /// And finally, just return the converted field
-    }
-    return $result;
-}
-
-function migrate2utf8_user_address($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $user = get_record('user','id',$recordid);
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = null;  //Non existing!
-        $userlang   = $user->lang; //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($user->address, $fromenc);
-
-        $newuser = new object;
-        $newuser->id = $recordid;
-        $newuser->address = $result;
-        migrate2utf8_update_record('user',$newuser);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_user_city($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $user = get_record('user','id',$recordid);
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = null;  //Non existing!
-        $userlang   = $user->lang; //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($user->city, $fromenc);
-
-        $newuser = new object;
-        $newuser->id = $recordid;
-        $newuser->city = $result;
-        migrate2utf8_update_record('user',$newuser);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_user_description($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $user = get_record('user','id',$recordid);
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = null;  //Non existing!
-        $userlang   = $user->lang; //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-/// We are going to use textlib facilities
-
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($user->description, $fromenc);
-
-        $newuser = new object;
-        $newuser->id = $recordid;
-        $newuser->description = $result;
-        migrate2utf8_update_record('user',$newuser);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_user_secret($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $user = get_record('user','id',$recordid);
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = null;  //Non existing!
-        $userlang   = $user->lang; //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($user->secret, $fromenc);
-
-        $newuser = new object;
-        $newuser->id = $recordid;
-        $newuser->secret = $result;
-        migrate2utf8_update_record('user',$newuser);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-//this chnages user->lang from xyz to xyz_utf8, if not already using utf8
-function migrate2utf8_user_lang($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $user = get_record('user','id',$recordid);
-
-    if (strstr($user->lang, 'utf8') === false) {    //user not using utf8 lang
-        $user->lang = $user->lang.'_utf8';
-    }
-
-    $newuser = new object;
-    $newuser->id = $user->id;
-    $newuser->lang = $user->lang;
-    $result = migrate2utf8_update_record('user',$newuser);
-    
-    $langsused = get_record('config','name','langsused');
-    $langs = explode(',',$langsused->value);
-    if (!in_array($user->lang, $langs)) {
-        $langsused->value .= ','.$user->lang;
-        migrate2utf8_update_record('config',$langsused);
-    }
-    
-
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_course_password($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$course = get_record('course', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($course->id);  //Non existing!
-        $userlang   = get_main_teacher_lang($course->id); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($course->password, $fromenc);
-
-        $newcourse = new object;
-        $newcourse->id = $recordid;
-        $newcourse->password = $result;
-        migrate2utf8_update_record('course',$newcourse);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_course_fullname($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$course = get_record('course', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($course->id);  //Non existing!
-        $userlang   = get_main_teacher_lang($course->id); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($course->fullname, $fromenc);
-
-        $newcourse = new object;
-        $newcourse->id = $recordid;
-        $newcourse->fullname = $result;
-        migrate2utf8_update_record('course',$newcourse);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_course_shortname($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$course = get_record('course', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($course->id);  //Non existing!
-        $userlang   = get_main_teacher_lang($course->id); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($course->shortname, $fromenc);
-        $newcourse = new object;
-        $newcourse->id = $recordid;
-        $newcourse->shortname = $result;
-        migrate2utf8_update_record('course',$newcourse);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_course_idnumber($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$course = get_record('course', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($course->id);  //Non existing!
-        $userlang   = get_main_teacher_lang($course->id); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($course->idnumber, $fromenc);
-
-        $newcourse = new object;
-        $newcourse->id = $recordid;
-        $newcourse->idnumber = $result;
-        migrate2utf8_update_record('course',$newcourse);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_course_summary($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$course = get_record('course', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($course->id);  //Non existing!
-        $userlang   = get_main_teacher_lang($course->id); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($course->summary, $fromenc);
-
-        $newcourse = new object;
-        $newcourse->id = $recordid;
-        $newcourse->summary = $result;
-        migrate2utf8_update_record('course',$newcourse);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_course_modinfo($recordid){
-    global $CFG, $globallang;
-    //print_object($mods);
-}
-
-function migrate2utf8_course_teacher($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$course = get_record('course', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($course->id);  //Non existing!
-        $userlang   = get_main_teacher_lang($course->id); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($course->teacher, $fromenc);
-
-        $newcourse = new object;
-        $newcourse->id = $recordid;
-        $newcourse->teacher = $result;
-        migrate2utf8_update_record('course',$newcourse);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_course_teachers($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$course = get_record('course', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($course->id);  //Non existing!
-        $userlang   = get_main_teacher_lang($course->id); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($course->teachers, $fromenc);
-
-        $newcourse = new object;
-        $newcourse->id = $recordid;
-        $newcourse->teachers = $result;
-        migrate2utf8_update_record('course',$newcourse);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_course_student($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$course = get_record('course', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($course->id);  //Non existing!
-        $userlang   = get_main_teacher_lang($course->id); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($course->student, $fromenc);
-
-        $newcourse = new object;
-        $newcourse->id = $recordid;
-        $newcourse->student = $result;
-        migrate2utf8_update_record('course',$newcourse);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_course_students($recordid){
-    global $CFG, $globallang;
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$course = get_record('course', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($course->id);  //Non existing!
-        $userlang   = get_main_teacher_lang($course->id); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($course->students, $fromenc);
-
-        $newcourse = new object;
-        $newcourse->id = $recordid;
-        $newcourse->students = $result;
-        migrate2utf8_update_record('course',$newcourse);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_course_cost($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$course = get_record('course', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($course->id);  //Non existing!
-        $userlang   = get_main_teacher_lang($course->id); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($course->cost, $fromenc);
-        $newcourse = new object;
-        $newcourse->id = $recordid;
-        $newcourse->cost = $result;
-        migrate2utf8_update_record('course',$newcourse);
-    /// And finally, just return the converted field
-    }
-    return $result;
-}
-
-function migrate2utf8_course_lang($recordid){
-    global $CFG, $globallang;
-
-    if (!$course = get_record('course', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (strstr($course->lang,'utf8')===false and !empty($course->lang)){
-        $course->lang = $course->lang.'_utf8';
-    }
-    $newcourse = new object;
-    $newcourse->id = $course->id;
-    $newcourse->lang = $course->lang;
-    migrate2utf8_update_record('course',$newcourse);
-    require_once($CFG->dirroot.'/course/lib.php');
-    if ($CFG->dbtype == 'postgres7') {
-        $backup_db = $GLOBALS['db'];
-        $GLOBALS['db'] = &get_postgres_db();
-    }
-    $result = rebuild_course_cache($recordid);    //takes care of serialized modinfo
-    if ($CFG->dbtype == 'postgres7') {
-        $GLOBALS['db'] = $backup_db;
-        unset($backup_db);
-    }
-/// And finally, just return the converted field
-
-
-    $langsused = get_record('config','name','langsused');
-    $langs = explode(',',$langsused->value);
-    if (!in_array($course->lang, $langs)) {
-        $langsused->value .= ','.$course->lang;
-        migrate2utf8_update_record('config',$langsused);
-    }
-
-    return $result;
-}
-?>
diff --git a/lib/db/migrate2utf8.xml b/lib/db/migrate2utf8.xml
deleted file mode 100755 (executable)
index d13069d..0000000
+++ /dev/null
@@ -1,563 +0,0 @@
-<DBMIGRATION type="lib" VERSION="2005120100">
-  <TABLES>
-    <TABLE name="adodb_logsql">
-      <FIELDS>
-        <FIELD name="sql0" method="NO_CONV" type="varchar" length="250" />
-        <FIELD name="sql1" method="NO_CONV" type="text" length="0" />
-        <FIELD name="params" method="NO_CONV" type="text" length="0" />
-        <FIELD name="tracer" method="NO_CONV" type="text" length="0" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="user_lastaccess" />
-    <TABLE name="user_info_category">
-         <FIELDS>
-           <FIELD name="name" method="PHP_FUNCTION" type="varchar" length="255">
-             <PHP_FUNCTION>
-               migrate2utf8_user_info_category_name(RECORDID)
-             </PHP_FUNCTION>        
-           </FIELD>    
-      </FIELDS>
-    </TABLE>    
-    <TABLE name="user_info_data">
-         <FIELDS>
-           <FIELD name="data" method="PHP_FUNCTION" type="longtext" length="0">
-             <PHP_FUNCTION>
-               migrate2utf8_user_info_data_data(RECORDID)
-             </PHP_FUNCTION>        
-           </FIELD>            
-      </FIELDS>
-    </TABLE>    
-    <TABLE name="user_info_field">
-         <FIELDS>
-           <FIELD name="name" method="PHP_FUNCTION" type="varchar" length="255">
-             <PHP_FUNCTION>
-               migrate2utf8_user_info_field_name(RECORDID)
-             </PHP_FUNCTION>        
-           </FIELD>
-           <FIELD name="datatype" method="NO_CONV" type="varchar" length="255" />    
-        <FIELD name="defaultdata" method="PHP_FUNCTION" type="longtext" length="0">
-             <PHP_FUNCTION>
-               migrate2utf8_user_info_field_defaultdata(RECORDID)
-             </PHP_FUNCTION>        
-           </FIELD>            
-      </FIELDS>
-    </TABLE>
-    <TABLE name="role">
-         <FIELDS>
-           <FIELD name="name" method="PHP_FUNCTION" type="varchar" length="255">
-             <PHP_FUNCTION>
-               migrate2utf8_role_name(RECORDID)
-             </PHP_FUNCTION>        
-           </FIELD>
-           <FIELD name="shortname" method="NO_CONV" type="varchar" length="100">
-             <PHP_FUNCTION>
-               migrate2utf8_role_shortname(RECORDID)
-             </PHP_FUNCTION>        
-           </FIELD>    
-           <FIELD name="description" method="PHP_FUNCTION" type="text" length="0">
-             <PHP_FUNCTION>
-               migrate2utf8_role_description(RECORDID)
-             </PHP_FUNCTION>        
-           </FIELD>            
-      </FIELDS>
-    </TABLE>
-    <TABLE name="context" />
-    <TABLE name="role_allow_assign" />
-    <TABLE name="role_allow_override" />
-    <TABLE name="role_assignments">
-         <FIELDS>
-           <FIELD name="enrol" method="NO_CONV" type="varchar" length="20" />  
-      </FIELDS>
-    </TABLE>    
-    <TABLE name="role_capabilities">
-         <FIELDS>
-           <FIELD name="capability" method="NO_CONV" type="varchar" length="255" dropindex="roleid-contextid-capability" adduniqueindex ="roleid-contextid-capability(roleid, contextid, capability(255))" />          
-      </FIELDS>
-    </TABLE>
-    
-       <TABLE name="capabilities">
-         <FIELDS>
-           <FIELD name="name" method="NO_CONV" type="varchar" length="255" dropindex="name" adduniqueindex ="name(name(255))" />
-               <FIELD name="captype" method="NO_CONV" type="varchar" length="50" />
-               <FIELD name="component" method="NO_CONV" type="varchar" length="100" />         
-      </FIELDS>
-    </TABLE> 
-    
-       <TABLE name="role_names">
-         <FIELDS>
-           <FIELD name="text" method="PHP_FUNCTION" type="text" length="0">
-             <PHP_FUNCTION>
-               migrate2utf8_role_names_text(RECORDID)
-             </PHP_FUNCTION>        
-           </FIELD>            
-      </FIELDS>
-    </TABLE>
-    
-    <TABLE name="blog_tag_instance" />
-    <TABLE name="post">
-      <FIELDS>
-        <FIELD name="module" method="NO_CONV" type="varchar" length="20" dropindex="post_module_idx" addindex="post_module_idx(module(20))"/>
-        <FIELD name="subject" method="PHP_FUNCTION" type="varchar" length="128" dropindex="post_subject_idx" addindex=" post_subject_idx(subject(128))">
-          <PHP_FUNCTION>
-            migrate2utf8_post_subject(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="summary" method="PHP_FUNCTION" type="longtext" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_post_summary(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="content" method="PHP_FUNCTION" type="longtext" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_post_content(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="uniquehash" method="NO_CONV" type="varchar" length="128" />
-        <FIELD name="publishstate" method="NO_CONV" type="enum('draft', 'site', 'public')" length="0" default="draft" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="tags">
-      <FIELDS>
-        <FIELD name="type" method="NO_CONV" type="varchar" length="20" dropindex="tags_typeuserid_idx" addindex="tags_typeuserid_idx(type(20), userid)" />
-        <FIELD name="text" method="PHP_FUNCTION" type="varchar" length="255" dropindex="tags_text_idx" addindex="tags_text_idx(text(255))">
-          <PHP_FUNCTION>
-            migrate2utf8_tags_text(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="config">
-      <FIELDS>
-        <FIELD name="name" method="NO_CONV" type="varchar" length="255" dropindex="name" adduniqueindex="name (name(255))"/>
-        <FIELD name="value" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_config_value(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="config_plugins">
-      <FIELDS>
-        <FIELD name="plugin" method="NO_CONV" type="varchar" length="100" dropindex="plugin_name" default="core"/>
-        <FIELD name="name" method="NO_CONV" type="varchar" length="100" adduniqueindex="plugin_name(plugin(100), name(100))"/>
-        <FIELD name="value" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_config_plugins_value(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="course_allowed_modules" />
-    <TABLE name="course_display" />
-    <TABLE name="course_meta" />
-    <TABLE name="course_modules" />
-    <TABLE name="course_categories">
-      <FIELDS>
-        <FIELD name="name" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-            migrate2utf8_course_categories_name(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="description" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_course_categories_description(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="path" method="NO_CONV" type="varchar" length="255" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="course_sections">
-      <FIELDS>
-        <FIELD name="summary" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_course_sections_summary(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="sequence" method="NO_CONV" type="text" length="0" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="course_request">
-      <FIELDS>
-        <FIELD name="fullname" method="PHP_FUNCTION" type="varchar" length="254">
-          <PHP_FUNCTION>
-            migrate2utf8_course_request_fullname(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="shortname" method="PHP_FUNCTION" type="varchar" length="15" dropindex="shortname" addindex="shortname(shortname(15))">
-          <PHP_FUNCTION>
-            migrate2utf8_course_request_shortname(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="summary" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_course_request_summary(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="reason" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_course_request_reason(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="password" method="PHP_FUNCTION" type="varchar" length="50">
-          <PHP_FUNCTION>
-            migrate2utf8_course_request_password(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="event">
-      <FIELDS>
-        <FIELD name="name" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-            migrate2utf8_event_name(RECORDID);
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="description" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_event_description(RECORDID);
-          </PHP_FUNCTION>
-        </FIELD>
-          <FIELD name="modulename" method="NO_CONV" type="varchar" length="20" />
-          <FIELD name="eventtype" method="NO_CONV" type="varchar" length="20" />
-          <FIELD name="uuid" method="NO_CONV" type="varchar" length="36" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="cache_filters">
-      <FIELDS>
-        <FIELD name="md5key" method="NO_CONV" type="varchar" length="32"  dropindex="filtermd5key"/>
-        <FIELD name="filter" method="NO_CONV" type="varchar" length="32"  addindex="filtermd5key(filter(32),md5key(32))"/>
-        <FIELD name="rawtext" method="NO_CONV" type="text" length="0" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="cache_text">
-      <FIELDS>
-        <FIELD name="md5key" method="NO_CONV" type="varchar" length="32" dropindex="md5key" addindex="md5key(md5key(32))"/>
-        <FIELD name="formattedtext" method="NO_CONV" type="longtext" length="0" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="grade_item" />
-    <TABLE name="grade_preferences" />
-    <TABLE name="grade_category">
-       <FIELDS>
-        <FIELD name="name" method="PHP_FUNCTION" type="varchar" length="64">
-          <PHP_FUNCTION>
-            migrate2utf8_grade_category_name(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-       </FIELDS>
-    </TABLE>
-    <TABLE name="grade_exceptions" />
-    <TABLE name="grade_letter">
-      <FIELDS>
-        <FIELD name="letter" method="PHP_FUNCTION" type="varchar" length="8" default="NA">
-          <PHP_FUNCTION>
-            migrate2utf8_grade_letter_letter(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="groups_members" />
-    <TABLE name="groups">
-      <FIELDS>
-        <FIELD name="name" method="PHP_FUNCTION" type="varchar" length="254">
-          <PHP_FUNCTION>
-            migrate2utf8_groups_name(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="description" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_groups_description(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="password" method="PHP_FUNCTION" type="varchar" length="50">
-          <PHP_FUNCTION>
-            migrate2utf8_groups_password(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="theme" method="NO_CONV" type="varchar" length="50" />
-        <FIELD name="lang" method="PHP_FUNCTION" type="varchar" length="10" default="en">
-          <PHP_FUNCTION>
-            migrate2utf8_groups_lang(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="log">
-      <FIELDS>
-        <FIELD name="ip" method="NO_CONV" type="varchar" length="15" dropindex="timecoursemoduleaction"/>
-        <FIELD name="module" method="NO_CONV" type="varchar" length="20" dropindex="coursemoduleaction"/>
-        <FIELD name="action" method="NO_CONV" type="varchar" length="15"  addindex="timecoursemoduleaction(time, course, module(20), action(15))" />
-        <FIELD name="url" method="NO_CONV" type="varchar" length="100" addindex="coursemoduleaction(course, module(20), action(15))" />
-        <FIELD name="info" method="NO_CONV" type="varchar" length="255" dropindex="info" addindex="info(info(255))" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="log_display">
-      <FIELDS>
-        <FIELD name="mtable" method="NO_CONV" type="varchar" length="30" dropindex="moduleaction"/>
-        <FIELD name="field" method="NO_CONV" type="varchar" length="50" />
-        <FIELD name="module" method="NO_CONV" type="varchar" length="30" />
-        <FIELD name="action" method="NO_CONV" type="varchar" length="40" addindex="moduleaction(module(30), action(40))"/>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="message_contacts" />
-    <TABLE name="message">
-      <FIELDS>
-        <FIELD name="message" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_message_message(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="messagetype" method="NO_CONV" type="varchar" length="50" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="message_read">
-      <FIELDS>
-        <FIELD name="message" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_message_read_message(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="messagetype" method="NO_CONV" type="varchar" length="50" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="modules">
-      <FIELDS>
-          <FIELD name="name" method="NO_CONV" type="varchar" length="20" dropindex="name" addindex="name(name(20))"/>
-          <FIELD name="search" method="PHP_FUNCTION" type="varchar" length="255">
-           <PHP_FUNCTION>
-             migrate2utf8_modules_search(RECORDID)
-           </PHP_FUNCTION>        
-          </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="scale">
-      <FIELDS>
-        <FIELD name="name" method="PLAIN_SQL_UPDATE" type="varchar" length="255">
-          <SQL_DETECT_USER>
-            SELECT s.userid
-            FROM {$CFG->prefix}scale s
-            WHERE s.id = RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-            SELECT s.courseid as course
-            FROM {$CFG->prefix}scale s
-            WHERE s.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-        <FIELD name="scale" method="PLAIN_SQL_UPDATE" type="text" length="0">
-          <SQL_DETECT_USER>
-            SELECT s.userid
-            FROM {$CFG->prefix}scale s
-            WHERE s.id = RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-            SELECT s.courseid as course
-            FROM {$CFG->prefix}scale s
-            WHERE s.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-        <FIELD name="description" method="PLAIN_SQL_UPDATE" type="text" length="0">
-          <SQL_DETECT_USER>
-            SELECT s.userid
-            FROM {$CFG->prefix}scale s
-            WHERE s.id = RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-            SELECT s.courseid as course
-            FROM {$CFG->prefix}scale s
-            WHERE s.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="sessions2">
-      <FIELDS>
-        <FIELD name="sesskey" method="NO_CONV" type="varchar" length="64" dropprimary="true" addprimary="(sesskey(64))"/>
-        <FIELD name="expireref" method="NO_CONV" type="varchar" length="250" />
-        <FIELD name="sessdata" method="NO_CONV" type="longtext" length="0" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="timezone">
-      <FIELDS>
-        <FIELD name="name" method="NO_CONV" type="varchar" length="100" />
-        <FIELD name="tzrule" method="NO_CONV" type="varchar" length="20" />
-        <FIELD name="dst_time" method="NO_CONV" type="varchar" length="5" />
-        <FIELD name="std_time" method="NO_CONV" type="varchar" length="5" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="stats_daily">
-      <FIELDS>
-        <FIELD name="stattype" method="NO_CONV" type="enum('enrolments', 'activity', 'logins')" default="activity" length="0" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="stats_weekly">
-      <FIELDS>
-        <FIELD name="stattype" method="NO_CONV" type="enum('enrolments', 'activity', 'logins')" default="activity" length="0" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="stats_monthly">
-      <FIELDS>
-        <FIELD name="stattype" method="NO_CONV" type="enum('enrolments', 'activity', 'logins')" default="activity" length="0" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="stats_user_daily">
-      <FIELDS>
-        <FIELD name="stattype" method="NO_CONV" type="varchar" length="30" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="stats_user_monthly">
-      <FIELDS>
-        <FIELD name="stattype" method="NO_CONV" type="varchar" length="30" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="stats_user_weekly">
-      <FIELDS>
-        <FIELD name="stattype" method="NO_CONV" type="varchar" length="30" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="user_preferences">
-      <FIELDS>
-        <FIELD name="name" method="NO_CONV" type="varchar" length="50"  dropindex="useridname" addindex="useridname(userid, name(50))"/>
-        <FIELD name="value" method="NO_CONV" type="varchar" length="255" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="course">
-      <FIELDS>
-        <FIELD name="currency" method="NO_CONV" type="char" length="3" />
-        <FIELD name="enrol" method="NO_CONV" type="varchar" length="20" />
-        <FIELD name="password" method="PHP_FUNCTION" type="varchar" length="50">
-          <PHP_FUNCTION>
-            migrate2utf8_course_password(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="fullname" method="PHP_FUNCTION" type="varchar" length="254">
-          <PHP_FUNCTION>
-            migrate2utf8_course_fullname(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="shortname" method="PHP_FUNCTION" type="varchar" length="100" dropindex="shortname" addindex="shortname(shortname(100))">
-          <PHP_FUNCTION>
-            migrate2utf8_course_shortname(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="idnumber" method="PHP_FUNCTION" type="varchar" length="100" dropindex="idnumber" addindex="idnumber(idnumber(100))">
-          <PHP_FUNCTION>
-            migrate2utf8_course_idnumber(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="summary" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_course_summary(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="format" method="NO_CONV" type="varchar" length="10" default="topics"/>
-        <FIELD name="modinfo" method="PHP_FUNCTION" type="longtext" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_course_modinfo(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="teacher" method="PHP_FUNCTION" type="varchar" length="100" default="Teacher">
-          <PHP_FUNCTION>
-            migrate2utf8_course_teacher(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="teachers" method="PHP_FUNCTION" type="varchar" length="100" default="Teachers">
-          <PHP_FUNCTION>
-            migrate2utf8_course_teachers(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="student" method="PHP_FUNCTION" type="varchar" length="100" default="Student">
-          <PHP_FUNCTION>
-            migrate2utf8_course_student(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="students" method="PHP_FUNCTION" type="varchar" length="100" default="Students">
-          <PHP_FUNCTION>
-            migrate2utf8_course_students(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="cost" method="PHP_FUNCTION" type="varchar" length="10">
-          <PHP_FUNCTION>
-            migrate2utf8_course_cost(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="theme" method="NO_CONV" type="varchar" length="50" />
-        <FIELD name="lang" method="PHP_FUNCTION" type="varchar" length="10" default="en_utf8">
-          <PHP_FUNCTION>
-            migrate2utf8_course_lang(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="user">
-      <FIELDS>
-        <FIELD name="auth" method="NO_CONV" type="varchar" length="20" dropindex="auth" addindex="auth(auth(20))" default="manual"/>
-        <FIELD name="username" method="NO_CONV" type="varchar" length="100" dropindex="username" adduniqueindex="username(username(100))"/>
-        <FIELD name="password" method="NO_CONV" type="varchar" length="32" />
-        <FIELD name="idnumber" method="PHP_FUNCTION" type="varchar" length="64" dropindex="idnumber" addindex="idnumber(idnumber(64))">
-          <PHP_FUNCTION>
-            migrate2utf8_user_idnumber(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="firstname" method="PHP_FUNCTION" type="varchar" length="100" dropindex="user_firstname" addindex="user_firstname(firstname(100))">
-          <PHP_FUNCTION>
-            migrate2utf8_user_firstname(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="lastname" method="PHP_FUNCTION" type="varchar" length="100" dropindex="user_lastname" addindex="user_lastname(lastname(100))">
-          <PHP_FUNCTION>
-            migrate2utf8_user_lastname(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="email" method="NO_CONV" type="varchar" length="100" dropindex="user_email" addindex="user_email(email(100))"/>
-        <FIELD name="icq" method="NO_CONV" type="varchar" length="15" />
-        <FIELD name="skype" method="NO_CONV" type="varchar" length="50" />
-        <FIELD name="yahoo" method="NO_CONV" type="varchar" length="50" />
-        <FIELD name="aim" method="NO_CONV" type="varchar" length="50" />
-        <FIELD name="msn" method="NO_CONV" type="varchar" length="50" />
-        <FIELD name="phone1" method="NO_CONV" type="varchar" length="20" />
-        <FIELD name="phone2" method="NO_CONV" type="varchar" length="20" />
-        <FIELD name="institution" method="PHP_FUNCTION" type="varchar" length="40">
-          <PHP_FUNCTION>
-            migrate2utf8_user_institution(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="department" method="PHP_FUNCTION" type="varchar" length="30">
-          <PHP_FUNCTION>
-            migrate2utf8_user_department(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="address" method="PHP_FUNCTION" type="varchar" length="70">
-          <PHP_FUNCTION>
-            migrate2utf8_user_address(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="city" method="PHP_FUNCTION" type="varchar" length="20" dropindex="user_city" addindex="user_city(city(20))">
-          <PHP_FUNCTION>
-            migrate2utf8_user_city(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="country" method="NO_CONV" type="char" length="2" dropindex="user_country" addindex="user_country(country(2))"/>
-        <FIELD name="theme" method="NO_CONV" type="varchar" length="50" />
-        <FIELD name="timezone" method="NO_CONV" type="varchar" length="100" />
-        <FIELD name="lastip" method="NO_CONV" type="varchar" length="15" />
-        <FIELD name="secret" method="PHP_FUNCTION" type="varchar" length="15">
-          <PHP_FUNCTION>
-            migrate2utf8_user_secret(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="url" method="NO_CONV" type="varchar" length="255" />
-        <FIELD name="description" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_user_description(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="lang" method="PHP_FUNCTION" type="varchar" length="10">
-          <PHP_FUNCTION>
-            migrate2utf8_user_lang(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-  </TABLES>
-</DBMIGRATION>
index b9f10efa6c0850aa4a9c7661a5cb9e6c525d24f5..0aa1e4f99d172caf98495a22adcb1768236b450d 100644 (file)
@@ -365,45 +365,6 @@ CREATE TABLE `prefix_grade_preferences` (
 
 # --------------------------------------------------------
 
-#
-# Table structure for table `group`
-#
-
-CREATE TABLE `prefix_groups` (
-  `id` int(10) unsigned NOT NULL auto_increment,
-  `courseid` int(10) unsigned NOT NULL default '0',
-  `name` varchar(254) NOT NULL default '',
-  `description` text NOT NULL default '',
-  `password` varchar(50) NOT NULL default '',
-  `lang` varchar(10) NOT NULL default 'en',
-  `theme` varchar(50) NOT NULL default '',
-  `picture` int(10) unsigned NOT NULL default '0',
-  `hidepicture` int(2) unsigned NOT NULL default '0',
-  `timecreated` int(10) unsigned NOT NULL default '0',
-  `timemodified` int(10) unsigned NOT NULL default '0',
-  PRIMARY KEY  (`id`),
-  UNIQUE KEY `id` (`id`),
-  KEY `courseid` (`courseid`)
-) TYPE=MyISAM COMMENT='Each record is a group in a course.';
-# --------------------------------------------------------
-
-#
-# Table structure for table `group_members`
-#
-
-CREATE TABLE `prefix_groups_members` (
-  `id` int(10) unsigned NOT NULL auto_increment,
-  `groupid` int(10) unsigned NOT NULL default '0',
-  `userid` int(10) unsigned NOT NULL default '0',
-  `timeadded` int(10) unsigned NOT NULL default '0',
-  PRIMARY KEY  (`id`),
-  UNIQUE KEY `id` (`id`),
-  KEY `groupid` (`groupid`),
-  KEY `userid` (`userid`)
-) TYPE=MyISAM COMMENT='Lists memberships of users to groups';
-# --------------------------------------------------------
-
-
 #
 # Table structure for table `log`
 #
index 98bf81c4bac65dda8d10ce883b461834033065a0..7a7cb74b5d5706e47145137d01b005d78cac0f8d 100644 (file)
@@ -226,32 +226,6 @@ CREATE TABLE prefix_grade_preferences (
 
 CREATE UNIQUE INDEX prefix_grade_prefs_courseidpref_uk ON prefix_grade_preferences (courseid,preference);
 
-CREATE TABLE prefix_groups (
-   id SERIAL PRIMARY KEY,
-   courseid integer NOT NULL default '0',
-   name varchar(255) NOT NULL default '',
-   description text,
-   password varchar(50) NOT NULL default '',
-   lang varchar(10) NOT NULL default '',
-   theme varchar(50) NOT NULL default '',
-   picture integer NOT NULL default '0',
-   hidepicture integer NOT NULL default '0',
-   timecreated integer NOT NULL default '0',
-   timemodified integer NOT NULL default '0'
-);
-
-CREATE INDEX prefix_groups_idx ON prefix_groups (courseid);
-
-CREATE TABLE prefix_groups_members (
-   id SERIAL PRIMARY KEY,
-   groupid integer NOT NULL default '0',
-   userid integer NOT NULL default '0',
-   timeadded integer NOT NULL default '0'
-);
-
-CREATE INDEX prefix_groups_members_idx ON prefix_groups_members (groupid);
-CREATE INDEX prefix_groups_members_userid_idx ON prefix_groups_members (userid);
-
 CREATE TABLE prefix_log (
    id SERIAL PRIMARY KEY,
    time integer NOT NULL default '0',
index 6860c0344c9cc4c1c0ded2fc331004db455b2b6f..5db5b4fb070ffdf4ed88047932e43e3736f20869 100644 (file)
@@ -749,9 +749,9 @@ function get_group_students($groupids, $sort='ul.timeaccess DESC') {
     if (is_array($groupids)){
         $groups = $groupids;
         // all groups must be from one course anyway...
-        $group = get_record('groups', 'id', array_shift($groups));
+        $group = groups_get_group(array_shift($groups));
     } else {
-        $group = get_record('groups', 'id', $groupids);
+        $group = groups_get_group($groupids);
     }
     if (!$group) {
         return NULL;
index deb3c7875a01cb16963eb409ed09fce0cf875cd7..f001c63723cb231ad2f6d9e54d28dfcfb64587f0 100644 (file)
@@ -1,7 +1,7 @@
 /**
- * $RCSfile$
- * $Revision$
- * $Date$
+ * $RCSfile: editor_plugin_src.js,v $
+ * $Revision: 1.1 $
+ * $Date: 2006/03/04 15:54:06 $
  *
  * @author Moxiecode
  * @copyright Copyright Â© 2004-2006, Moxiecode Systems AB, All rights reserved.
index ded727071b2dbfabc759c6984bf86ad6209aaf2a..ea11b49e037dcdd2d244b136f195a77c97c18940 100644 (file)
@@ -1,7 +1,7 @@
 /**
- * $RCSfile$
- * $Revision$
- * $Date$
+ * $RCSfile: editor_plugin_src.js,v $
+ * $Revision: 1.1 $
+ * $Date: 2006/03/04 15:55:13 $
  *
  * @author Moxiecode
  * @copyright Copyright Â© 2004-2006, Moxiecode Systems AB, All rights reserved.
index 39fe05d9c4ccc2a70764a9cf085b7755e7cac7f5..db7afdfed9694ed5e070f686ed766b50bf7dbc45 100644 (file)
@@ -1,7 +1,7 @@
 /**
- * $RCSfile$
- * $Revision$
- * $Date$
+ * $RCSfile: editor_template_src.js,v $
+ * $Revision: 1.1 $
+ * $Date: 2006/03/04 15:57:03 $
  *
  * @author Moxiecode
  * @copyright Copyright Â© 2004-2006, Moxiecode Systems AB, All rights reserved.
index 2979753e39151648096f2c6da4cf4d83ddbce284..31d2b882970fdc98e445ab7bf8061d38b903292b 100644 (file)
@@ -1,7 +1,7 @@
 /**
- * $RCSfile$
- * $Revision$
- * $Date$
+ * $RCSfile: editor_template_src.js,v $
+ * $Revision: 1.1 $
+ * $Date: 2006/03/04 15:57:31 $
  *
  * @author Moxiecode
  * @copyright Copyright Â© 2004-2006, Moxiecode Systems AB, All rights reserved.
index ce3fa787587d24e8b088fc0ac710b8ee3ac24a99..766a60e8db90af7032565ce2983c8bb48801e6a6 100644 (file)
@@ -1,8 +1,8 @@
-<?php // $Id$
+<?php // $Id: tiny_mce_gzip.php,v 1.1 2006/03/04 15:57:32 julmis Exp $
 /**
- * $RCSfile$
- * $Revision$
- * $Date$
+ * $RCSfile: tiny_mce_gzip.php,v $
+ * $Revision: 1.1 $
+ * $Date: 2006/03/04 15:57:32 $
  *
  * @version 1.07
  * @author Moxiecode
index ac5c6870c979b639c56b524c5f1bbae7e67e0b20..aba9f11807f1e2e2d4d107e5f1c86c3cb5c190d5 100644 (file)
@@ -1,7 +1,7 @@
 /**
- * $RCSfile$
- * $Revision$
- * $Date$
+ * $RCSfile: tiny_mce_popup.js,v $
+ * $Revision: 1.1 $
+ * $Date: 2006/03/04 15:57:32 $
  *
  * @author Moxiecode
  * @copyright Copyright Â© 2004-2006, Moxiecode Systems AB, All rights reserved.
index cc3621736f315b3bb49942dad24b3620f0adcbda..21989ca9fe3d896b16eb6153b5d0e788236161b9 100644 (file)
@@ -1,7 +1,7 @@
 /**
- * $RCSfile$
- * $Revision$
- * $Date$
+ * $RCSfile: form_utils.js,v $
+ * $Revision: 1.1 $
+ * $Date: 2006/03/04 15:57:32 $
  *
  * Various form utilitiy functions.
  *
index 09a949677aa5ee35d1893ba76a4ffe014887e96e..7e7a04923050a9be0427af6913294f6dffb098eb 100644 (file)
@@ -1,7 +1,7 @@
 /**
- * $RCSfile$
- * $Revision$
- * $Date$
+ * $RCSfile: mclayer.js,v $
+ * $Revision: 1.1 $
+ * $Date: 2006/03/04 15:57:32 $
  *
  * Moxiecode floating layer script.
  *
index 39292c4a06f017958459d818d2e8f8885ebacb1d..258e989134316558c8996b5eeb9f48048d345812 100644 (file)
@@ -1,7 +1,7 @@
 /**
- * $RCSfile$
- * $Revision$
- * $Date$
+ * $RCSfile: mctabs.js,v $
+ * $Revision: 1.1 $
+ * $Date: 2006/03/04 15:57:32 $
  *
  * Moxiecode DHTML Tabs script.
  *
index db1034ab5c14226cdb727a68dc0166d02e61bf89..ab0773feb84f0ad6f855c1b484030643fefd9d88 100644 (file)
@@ -1,7 +1,7 @@
 /**
- * $RCSfile$
- * $Revision$
- * $Date$
+ * $RCSfile: validate.js,v $
+ * $Revision: 1.1 $
+ * $Date: 2006/03/04 15:57:32 $
  *
  * Various form validation methods.
  *
index 85f54b08785021de167f72da2c341080db28b029..ad2bed4464a94734d0ad639452807d69c306f9e4 100644 (file)
@@ -260,7 +260,7 @@ function send_file($path, $filename, $lifetime=86400 , $filter=0, $pathisstring=
         $mimetype = 'application/x-forcedownload';
         $forcedownload = true;
     }
-    
+
     //IE compatibiltiy HACK!
     if (ini_get('zlib.output_compression')) {
         ini_set('zlib.output_compression', 'Off');
index 594e51c4443f42a7f3e28a2936c3de243811c451..a976114ca64d4167982324878ffb6db7d1222ff3 100644 (file)
@@ -28,7 +28,7 @@ require_once 'HTML/QuickForm/Rule.php';
  * 
  * @access public
  * @package HTML_QuickForm
- * @version $Revision$
+ * @version $Revision: 1.1 $
  */
 class HTML_QuickForm_Rule_Compare extends HTML_QuickForm_Rule
 {
index d7ad5d71425fd6e4add98f8bd8d073e64d3595d4..d5bafa25885f585fb957350759f50ca9f4cbc2b0 100644 (file)
@@ -83,7 +83,7 @@ class nusoap_base {
         * @var string
         * @access private
         */
-       var $revision = '$Revision$';
+       var $revision = '$Revision: 1.2 $';
     /**
      * Current error string (manipulated by getError/setError)
         *
diff --git a/mod/assignment/db/migrate2utf8.php b/mod/assignment/db/migrate2utf8.php
deleted file mode 100755 (executable)
index 1adb3ba..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-<?php // $Id$
-function migrate2utf8_assignment_name($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if (!$assignment = get_record('assignment', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($assignment->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($assignment->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($assignment->name, $fromenc);
-
-        $newassignment = new object;
-        $newassignment->id = $recordid;
-        $newassignment->name = $result;
-        migrate2utf8_update_record('assignment',$newassignment);
-    }
-/// And finally, just return the converted field
-
-    return $result;
-}
-
-function migrate2utf8_assignment_description($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if (!$assignment = get_record('assignment', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($assignment->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($assignment->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($assignment->description, $fromenc);
-
-        $newassignment = new object;
-        $newassignment->id = $recordid;
-        $newassignment->description = $result;
-        migrate2utf8_update_record('assignment',$newassignment);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-?>
diff --git a/mod/assignment/db/migrate2utf8.xml b/mod/assignment/db/migrate2utf8.xml
deleted file mode 100755 (executable)
index 4122cf3..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-<DBMIGRATION type="mod/assignment" VERSION = "2005120100">
-  <TABLES>
-    <TABLE name="assignment_submissions">
-      <FIELDS>
-        <FIELD name="data1" method="PLAIN_SQL_UPDATE" type="text" length="0">
-          <SQL_DETECT_USER>
-           SELECT ass.userid
-           FROM {$CFG->prefix}assignment_submissions ass
-           WHERE ass.id=RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT a.course
-           FROM {$CFG->prefix}assignment a,
-                {$CFG->prefix}assignment_submissions ass
-           WHERE a.id = ass.assignment
-                 AND ass.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-        <FIELD name="data2" method="PLAIN_SQL_UPDATE" type="text" length="0">
-          <SQL_DETECT_USER>
-           SELECT ass.userid
-           FROM {$CFG->prefix}assignment_submissions ass
-           WHERE ass.id=RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT a.course
-           FROM {$CFG->prefix}assignment a,
-                {$CFG->prefix}assignment_submissions ass
-           WHERE a.id = ass.assignment
-                 AND ass.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-        <FIELD name="submissioncomment" method="PLAIN_SQL_UPDATE" type="text" length="0">
-          <SQL_DETECT_USER>
-           SELECT ass.teacher as userid
-           FROM {$CFG->prefix}assignment_submissions ass
-           WHERE ass.id=RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT a.course
-           FROM {$CFG->prefix}assignment a,
-                {$CFG->prefix}assignment_submissions ass
-           WHERE a.id = ass.assignment
-                 AND ass.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="assignment">
-      <FIELDS>
-        <FIELD name="name" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-            migrate2utf_assignment_name(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="description" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf_assignment_description(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="assignmenttype" method="NO_CONV" type="varchar" length="50" />
-      </FIELDS>
-    </TABLE>
-  </TABLES>
-</DBMIGRATION>
index 660ad8b2fa9a58d5f35ae50d8c31a9a30e8a39e8..1c717c2d6f34c62eb5e9a36a54030ebbdbc857aa 100644 (file)
@@ -45,7 +45,7 @@
 
     $currentgroup = get_current_group($course->id);
     if ($currentgroup and has_capability('moodle/site:accessallgroups', get_context_instance(CONTEXT_COURSE, $id))) {
-        $group = get_record("groups", "id", $currentgroup);
+        $group = groups_get_group($currentgroup, false);
         $groupname = " ($group->name)";
     } else {
         $groupname = "";
diff --git a/mod/chat/db/migrate2utf8.php b/mod/chat/db/migrate2utf8.php
deleted file mode 100755 (executable)
index 947ca8f..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-<?php // $Id$
-function migrate2utf8_chat_name($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if (!$chat = get_record('chat', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($chat->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($chat->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($chat->name, $fromenc);
-
-        $newchat = new object;
-        $newchat->id = $recordid;
-        $newchat->name = $result;
-        migrate2utf8_update_record('chat',$newchat);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_chat_intro($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if (!$chat = get_record('chat', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($chat->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($chat->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($chat->intro, $fromenc);
-
-        $newchat = new object;
-        $newchat->id = $recordid;
-        $newchat->intro = $result;
-        migrate2utf8_update_record('chat',$newchat);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-?>
diff --git a/mod/chat/db/migrate2utf8.xml b/mod/chat/db/migrate2utf8.xml
deleted file mode 100755 (executable)
index 1bde55a..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-<DBMIGRATION type="mod/chat" VERSION="2005120100">
-  <TABLES>
-    <TABLE name="chat_users">
-      <FIELDS>
-        <FIELD name="version" method="NO_CONV" type="varchar" length="16" />
-        <FIELD name="ip" method="NO_CONV" type="varchar" length="15" />
-        <FIELD name="sid" method="NO_CONV" type="varchar" length="32" />
-        <FIELD name="lang" method="NO_CONV" type="varchar" length="10" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="chat_messages">
-      <FIELDS>
-        <FIELD name="message" method="PLAIN_SQL_UPDATE" type="text" length="0">
-          <SQL_DETECT_USER>
-           SELECT chm.userid
-           FROM {$CFG->prefix}chat_messages chm
-           WHERE chm.id=RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT ch.course
-           FROM {$CFG->prefix}chat ch,
-                {$CFG->prefix}chat_messages chm
-           WHERE ch.id = chm.chatid
-                 AND chm.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="chat">
-      <FIELDS>
-        <FIELD name="name" method="PHP_FUNCTION" type="varchar" length="255">
-          <SQL_DETECT_COURSE>
-            migrate2utf8_chat_name(RECORDID)
-          </SQL_DETECT_COURSE>
-        </FIELD>
-        <FIELD name="intro" method="PHP_FUNCTION" type="text" length="0">
-          <SQL_DETECT_COURSE>
-            migrate2utf8_chat_intro(RECORDID)
-          </SQL_DETECT_COURSE>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-  </TABLES>
-</DBMIGRATION>
index 49a136416b264f4e44c441171f713b188ac82134..712a7a4b25a8d3c5479b2537b40701c47bee60b7 100644 (file)
@@ -32,7 +32,7 @@
 /// Check to see if groups are being used here
      if ($groupmode = groupmode($course, $cm)) {   // Groups are being used
         if ($groupid = get_and_set_current_group($course, $groupmode, $groupid)) {
-            if (!$group = get_record('groups', 'id', $groupid)) {
+            if (! groups_group_exists($groupid)) {
                 error("That group (id $groupid) doesn't exist!");
             }
             $groupname = ': '.$group->name;
index 57b7bcd6a5921f33eaf2468c44a7afb9f8d5528c..220b37010c3c06e4c57e0c08e315049b1ae805d2 100644 (file)
@@ -32,7 +32,7 @@
 /// Check to see if groups are being used here
      if ($groupmode = groupmode($course, $cm)) {   // Groups are being used
         if ($groupid = get_and_set_current_group($course, $groupmode, $groupid)) {
-            if (!$group = get_record('groups', 'id', $groupid)) {
+            if (! groups_group_exists($groupid)) {
                 error("That group (id $groupid) doesn't exist!");
             }
             $groupname = ': '.$group->name;
diff --git a/mod/choice/db/migrate2utf8.php b/mod/choice/db/migrate2utf8.php
deleted file mode 100755 (executable)
index e2acaa3..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-<?php // $Id$
-function migrate2utf8_choice_options_text($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT ch.*
-           FROM {$CFG->prefix}choice ch,
-                {$CFG->prefix}choice_options cho
-           WHERE ch.id = cho.choiceid
-                 AND cho.id = $recordid";
-
-    if (!$choice = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    
-    if (!$choiceoption = get_record('choice_options','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($choice->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($choice->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($choiceoption->text, $fromenc);
-
-        $newchoiceoption = new object;
-        $newchoiceoption->id = $recordid;
-        $newchoiceoption->text = $result;
-        migrate2utf8_update_record('choice_options',$newchoiceoption);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_choice_name($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if (!$choice = get_record('choice', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($choice->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($choice->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($choice->name, $fromenc);
-
-        $newchoice = new object;
-        $newchoice->id = $recordid;
-        $newchoice->name = $result;
-        migrate2utf8_update_record('choice',$newchoice);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_choice_text($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if (!$choice = get_record('choice', 'id', $recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($choice->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($choice->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($choice->text, $fromenc);
-
-        $newchoice = new object;
-        $newchoice->id = $recordid;
-        $newchoice->text = $result;
-        migrate2utf8_update_record('choice',$newchoice);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-?>
diff --git a/mod/choice/db/migrate2utf8.xml b/mod/choice/db/migrate2utf8.xml
deleted file mode 100755 (executable)
index 6b4c58c..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<DBMIGRATION type="mod/choice" VERSION="2005120100">
-  <TABLES>
-    <TABLE name="choice_options">
-      <FIELDS>
-        <FIELD name="text" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_choice_options_text(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="choice">
-      <FIELDS>
-        <FIELD name="name" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-            migrate2utf_choice_name(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="text" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf_choice_text(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="choice_answers" />
-  </TABLES>
-</DBMIGRATION>
diff --git a/mod/data/db/migrate2utf8.php b/mod/data/db/migrate2utf8.php
deleted file mode 100755 (executable)
index 8e51dfb..0000000
+++ /dev/null
@@ -1,521 +0,0 @@
-<?php // $Id$
-function migrate2utf8_data_fields_name($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT d.course
-           FROM {$CFG->prefix}data_fields df,
-                {$CFG->prefix}data d
-           WHERE d.id = df.dataid
-                 AND df.id = $recordid";
-
-    if (!$data = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    
-    if (!$datafield = get_record('data_fields','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($data->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($data->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($datafield->name, $fromenc);
-
-        $newdatafield = new object;
-        $newdatafield->id = $recordid;
-        $newdatafield->name = $result;
-        migrate2utf8_update_record('data_fields',$newdatafield);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_data_fields_description($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT d.course
-           FROM {$CFG->prefix}data_fields df,
-                {$CFG->prefix}data d
-           WHERE d.id = df.dataid
-                 AND df.id = $recordid";
-
-    if (!$data = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$datafield = get_record('data_fields','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($data->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($data->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($datafield->description, $fromenc);
-
-        $newdatafield = new object;
-        $newdatafield->id = $recordid;
-        $newdatafield->description = $result;
-        migrate2utf8_update_record('data_fields',$newdatafield);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_data_name($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$data = get_record('data','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($data->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($data->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($data->name, $fromenc);
-
-        $newdata= new object;
-        $newdata->id = $recordid;
-        $newdata->name = $result;
-        migrate2utf8_update_record('data',$newdata);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_data_intro($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$data = get_record('data','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($data->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($data->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($data->intro, $fromenc);
-
-        $newdata= new object;
-        $newdata->id = $recordid;
-        $newdata->intro = $result;
-        migrate2utf8_update_record('data',$newdata);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_data_singletemplate($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$data = get_record('data','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($data->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($data->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($data->singletemplate, $fromenc);
-
-        $newdata= new object;
-        $newdata->id = $recordid;
-        $newdata->singletemplate = $result;
-        migrate2utf8_update_record('data',$newdata);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_data_listtemplate($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$data = get_record('data','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($data->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($data->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($data->listtemplate, $fromenc);
-
-        $newdata= new object;
-        $newdata->id = $recordid;
-        $newdata->listtemplate = $result;
-        migrate2utf8_update_record('data',$newdata);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_data_addtemplate($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$data = get_record('data','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($data->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($data->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($data->addtemplate, $fromenc);
-
-        $newdata= new object;
-        $newdata->id = $recordid;
-        $newdata->addtemplate = $result;
-        migrate2utf8_update_record('data',$newdata);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_data_rsstemplate($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$data = get_record('data','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($data->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($data->course); //N.E.!!
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($data->rsstemplate, $fromenc);
-
-        $newdata= new object;
-        $newdata->id = $recordid;
-        $newdata->rsstemplate = $result;
-        migrate2utf8_update_record('data',$newdata);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_data_rsstitletemplate($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$data = get_record('data','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($data->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($data->course); //N.E.!!
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($data->rsstitletemplate, $fromenc);
-
-        $newdata= new object;
-        $newdata->id = $recordid;
-        $newdata->rsstitletemplate = $result;
-        migrate2utf8_update_record('data',$newdata);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-
-function migrate2utf8_data_csstemplate($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$data = get_record('data','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($data->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($data->course); //N.E.!!
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($data->csstemplate, $fromenc);
-
-        $newdata= new object;
-        $newdata->id = $recordid;
-        $newdata->csstemplate = $result;
-        migrate2utf8_update_record('data',$newdata);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_data_jstemplate($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$data = get_record('data','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($data->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($data->course); //N.E.!!
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($data->jstemplate, $fromenc);
-
-        $newdata= new object;
-        $newdata->id = $recordid;
-        $newdata->jstemplate = $result;
-        migrate2utf8_update_record('data',$newdata);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_data_listtemplateheader($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$data = get_record('data','id',$recordid)){
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($data->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($data->course); //N.E.!!
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($data->listtemplateheader, $fromenc);
-
-        $newdata= new object;
-        $newdata->id = $recordid;
-        $newdata->listtemplateheader = $result;
-        migrate2utf8_update_record('data',$newdata);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_data_listtemplatefooter($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$data = get_record('data','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($data->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($data->course); //N.E.!!
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($data->listtemplatefooter, $fromenc);
-
-        $newdata= new object;
-        $newdata->id = $recordid;
-        $newdata->listtemplatefooter = $result;
-        migrate2utf8_update_record('data',$newdata);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-?>
diff --git a/mod/data/db/migrate2utf8.xml b/mod/data/db/migrate2utf8.xml
deleted file mode 100755 (executable)
index 991b649..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
-<DBMIGRATION type="mod/data" VERSION="2005120100">
-  <TABLES>
-    <TABLE name="data_ratings" />
-    <TABLE name="data_records" />
-    <TABLE name="data_comments">
-      <FIELDS>
-        <FIELD name="content" method="NO_CONV" type="text" length="0" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="data_content">
-      <FIELDS>
-        <FIELD name="content" method="PLAIN_SQL_UPDATE" type="longtext" length="0">
-          <SQL_DETECT_USER>
-           SELECT dr.userid
-           FROM {$CFG->prefix}data_records dr,
-                {$CFG->prefix}data_content dc
-           WHERE dr.id = dc.recordid
-                 AND dc.id = RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT d.course
-           FROM {$CFG->prefix}data_records dr,
-                {$CFG->prefix}data d,
-                {$CFG->prefix}data_content dc
-           WHERE d.id = dr.dataid
-                 AND dr.id = dc.recordid
-                 AND dc.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-        <FIELD name="content1" method="PLAIN_SQL_UPDATE" type="longtext" length="0">
-          <SQL_DETECT_USER>
-           SELECT dr.userid
-           FROM {$CFG->prefix}data_records dr,
-                {$CFG->prefix}data_content dc
-           WHERE dr.id = dc.recordid
-                 AND dc.id = RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT d.course
-           FROM {$CFG->prefix}data_records dr,
-                {$CFG->prefix}data d,
-                {$CFG->prefix}data_content dc
-           WHERE d.id = dr.dataid
-                 AND dr.id = dc.recordid
-                 AND dc.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-        <FIELD name="content2" method="PLAIN_SQL_UPDATE" type="longtext" length="0">
-          <SQL_DETECT_USER>
-           SELECT dr.userid
-           FROM {$CFG->prefix}data_records dr,
-                {$CFG->prefix}data_content dc
-           WHERE dr.id = dc.recordid
-                 AND dc.id = RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT d.course
-           FROM {$CFG->prefix}data_records dr,
-                {$CFG->prefix}data d,
-                {$CFG->prefix}data_content dc
-           WHERE d.id = dr.dataid
-                 AND dr.id = dc.recordid
-                 AND dc.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-        <FIELD name="content3" method="PLAIN_SQL_UPDATE" type="longtext" length="0">
-          <SQL_DETECT_USER>
-           SELECT dr.userid
-           FROM {$CFG->prefix}data_records dr,
-                {$CFG->prefix}data_content dc
-           WHERE dr.id = dc.recordid
-                 AND dc.id = RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT d.course
-           FROM {$CFG->prefix}data_records dr,
-                {$CFG->prefix}data d,
-                {$CFG->prefix}data_content dc
-           WHERE d.id = dr.dataid
-                 AND dr.id = dc.recordid
-                 AND dc.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-        <FIELD name="content4" method="PLAIN_SQL_UPDATE" type="longtext" length="0">
-          <SQL_DETECT_USER>
-           SELECT dr.userid
-           FROM {$CFG->prefix}data_records dr,
-                {$CFG->prefix}data_content dc
-           WHERE dr.id = dc.recordid
-                 AND dc.id = RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT d.course
-           FROM {$CFG->prefix}data_records dr,
-                {$CFG->prefix}data d,
-                {$CFG->prefix}data_content dc
-           WHERE d.id = dr.dataid
-                 AND dr.id = dc.recordid
-                 AND dc.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="data_fields">
-      <FIELDS>
-        <FIELD name="type" method="NO_CONV" type="varchar" length="255" />
-        <FIELD name="name" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-            migrate2utf_data_fields_name(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="description" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf_data_fields_description(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="param1" method="NO_CONV" type="text" length="0" />
-        <FIELD name="param2" method="NO_CONV" type="text" length="0" />
-        <FIELD name="param3" method="NO_CONV" type="text" length="0" />
-        <FIELD name="param4" method="NO_CONV" type="text" length="0" />
-        <FIELD name="param5" method="NO_CONV" type="text" length="0" />
-        <FIELD name="param6" method="NO_CONV" type="text" length="0" />
-        <FIELD name="param7" method="NO_CONV" type="text" length="0" />
-        <FIELD name="param8" method="NO_CONV" type="text" length="0" />
-        <FIELD name="param9" method="NO_CONV" type="text" length="0" />
-        <FIELD name="param10" method="NO_CONV" type="text" length="0" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="data">
-      <FIELDS>
-        <FIELD name="name" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-           migrate2utf_data_name(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="intro" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-           migrate2utf_data_intro(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="singletemplate" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-           migrate2utf_data_singletemplate(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="listtemplate" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-           migrate2utf_data_listtemplate(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="csstemplate" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-           migrate2utf_data_csstemplate(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="jstemplate" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-           migrate2utf_data_csstemplate(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="addtemplate" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-           migrate2utf_data_addtemplate(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="rsstemplate" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-           migrate2utf_data_rsstemplate(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="rsstitletemplate" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-           migrate2utf_data_rsstitletemplate(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="listtemplateheader" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-           migrate2utf_data_listtemplateheader(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="listtemplatefooter" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-           migrate2utf_data_listtemplatefooter(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-  </TABLES>
-</DBMIGRATION>
index 516b328fce2415b1ee75057d55b0269e0d6e4de6..0f026d4a7e6872a629ebe332e848f17fc54ff33e 100755 (executable)
@@ -77,7 +77,7 @@
 
     $currentgroup = get_current_group($course->id);
     if ($currentgroup and has_capability('mod/data:manageentries', $context)) {
-        $group = get_record("groups", "id", $currentgroup);
+        $group = groups_get_group($currentgroup, false);
         $groupname = " ($group->name)";
     } else {
         $groupname = "";
diff --git a/mod/exercise/db/migrate2utf8.php b/mod/exercise/db/migrate2utf8.php
deleted file mode 100755 (executable)
index 4281773..0000000
+++ /dev/null
@@ -1,193 +0,0 @@
-<?php // $Id$
-function migrate2utf8_exercise_elements_description($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT ex.course
-           FROM {$CFG->prefix}exercise ex,
-                {$CFG->prefix}exercise_elements exe
-           WHERE ex.id = exe.exerciseid
-                 AND exe.id = $recordid";
-
-    if (!$exercise = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    
-    if (!$exerciseelement = get_record('exercise_elements','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($exercise->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($exercise->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($exerciseelement->description, $fromenc);
-
-        $newexerciseelement = new object;
-        $newexerciseelement->id = $recordid;
-        $newexerciseelement->description = $result;
-        migrate2utf8_update_record('exercise_elements',$newexerciseelement);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_exercise_grades_feedback($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT ex.course
-           FROM {$CFG->prefix}exercise ex,
-                {$CFG->prefix}exercise_grades exg
-           WHERE ex.id = exg.exerciseid
-                 AND exg.id = $recordid";
-
-    if (!$exercise = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$exercisegrade = get_record('exercise_grades','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($exercise->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($exercise->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($exercisegrade->feedback, $fromenc);
-
-        $newexercisegrade = new object;
-        $newexercisegrade->id = $recordid;
-        $newexercisegrade->feedback = $result;
-        migrate2utf8_update_record('exercise_grades',$newexercisegrade);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_exercise_rubrics_description($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT ex.course
-           FROM {$CFG->prefix}exercise ex,
-                {$CFG->prefix}exercise_rubrics exr
-           WHERE ex.id = exr.exerciseid
-                 AND exr.id = $recordid";
-
-    if (!$exercise = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$exerciserubric = get_record('exercise_rubrics','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($exercise->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($exercise->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($exerciserubric->description, $fromenc);
-
-        $newexerciserubric = new object;
-        $newexerciserubric->id = $recordid;
-        $newexerciserubric->description = $result;
-        migrate2utf8_update_record('exercise_rubrics',$newexerciserubric);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_exercise_name($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$exercise = get_record('exercise','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($exercise->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($exercise->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($exercise->name, $fromenc);
-
-        $newexercise = new object;
-        $newexercise->id = $recordid;
-        $newexercise->name = $result;
-        migrate2utf8_update_record('exercise',$newexercise);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_exercise_password($recordid){
-    global $CFG, $globallang;
-
-    ///um
-}
-?>
diff --git a/mod/exercise/db/migrate2utf8.xml b/mod/exercise/db/migrate2utf8.xml
deleted file mode 100755 (executable)
index 8ac8eb6..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-<DBMIGRATION type="mod/exercise" VERSION="2005120100">
-  <TABLES>
-    <TABLE name="exercise_assessments">
-      <FIELDS>
-        <FIELD name="generalcomment" method="PLAIN_SQL_UPDATE" type="text" length="0">
-          <SQL_DETECT_USER>
-           SELECT exa.userid
-           FROM {$CFG->prefix}exercise_assessments exa
-           WHERE exa.id = RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT ex.course
-           FROM {$CFG->prefix}exercise ex,
-                {$CFG->prefix}exercise_assessments exa
-           WHERE ex.id = exa.exerciseid
-                 AND exa.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-        <FIELD name="teachercomment" method="PLAIN_SQL_UPDATE" type="text" length="0">
-          <SQL_DETECT_USER>
-           SELECT exa.userid
-           FROM {$CFG->prefix}exercise_assessments exa
-           WHERE exa.id = RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT ex.course
-           FROM {$CFG->prefix}exercise ex,
-                {$CFG->prefix}exercise_assessments exa
-           WHERE ex.id = exa.exerciseid
-                 AND exa.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="exercise_elements">
-      <FIELDS>
-        <FIELD name="description" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf_exercise_elements_description(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="exercise_grades">
-      <FIELDS>
-        <FIELD name="feedback" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf_exercise_grades_feedback(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="exercise_rubrics">
-      <FIELDS>
-        <FIELD name="description" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf_exercise_rubrics_description(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="exercise_submissions">
-      <FIELDS>
-        <FIELD name="title" method="PLAIN_SQL_UPDATE" type="varchar" length="100">
-          <SQL_DETECT_USER>
-           SELECT exs.userid
-           FROM {$CFG->prefix}exercise_submissions exs
-           WHERE exs.id = RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT ex.course
-           FROM {$CFG->prefix}exercise ex,
-                {$CFG->prefix}exercise_submissions exs
-           WHERE ex.id = exs.exerciseid
-                 AND exs.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="exercise">
-      <FIELDS>
-        <FIELD name="name" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-            migrate2utf_exercise_name(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="password" method="PHP_FUNCTION" type="varchar" length="32">
-          <PHP_FUNCTION>
-            migrate2utf_exercise_password(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-  </TABLES>
-</DBMIGRATION>
index b672409770e1ea08768aba9f9cef580a246e9595..414c46827cd57f6acb443a27d37e381932111cb5 100644 (file)
@@ -546,9 +546,9 @@ function exercise_get_student_submissions($exercise, $order = "time", $groupid =
             }
 
             return get_records_sql("SELECT s.*, AVG(a.grade) AS grade FROM 
-                    {$CFG->prefix}groups_members g, {$CFG->prefix}exercise_submissions s, 
+                    ".groups_members_from_sql().", {$CFG->prefix}exercise_submissions s, 
                     {$CFG->prefix}exercise_assessments a
-                    WHERE $select g.groupid = $groupid
+                    WHERE $select ". groups_members_where_sql($groupid)."
                     AND s.exerciseid = $exercise->id
                     AND a.submissionid = s.id
                     GROUP BY s.id
@@ -570,8 +570,8 @@ function exercise_get_student_submissions($exercise, $order = "time", $groupid =
     }
 
         return get_records_sql("SELECT s.* FROM  {$CFG->prefix}user n, 
-                {$CFG->prefix}groups_members g, {$CFG->prefix}exercise_submissions s
-                WHERE $select g.groupid = $groupid
+                ".groups_members_from_sql().", {$CFG->prefix}exercise_submissions s
+                WHERE $select ". groups_members_where_sql()."
                 AND s.exerciseid = $exercise->id
                 ORDER BY $order");
 
@@ -829,7 +829,7 @@ function exercise_list_submissions_for_admin($exercise) {
         }
         if (isset($table->data)) {
             if ($groupid) {
-                if (!$group = get_record("groups", "id", $groupid)) {
+                if (! groups_group_exists($groupid)) { //TODO:
                     error("List unassessed student submissions: group not found");
                 }
                 print_heading("$group->name ".get_string("studentassessments", "exercise", $course->student).
@@ -853,8 +853,8 @@ function exercise_list_submissions_for_admin($exercise) {
             if ($groupid) {
                 $stats = get_record_sql("SELECT COUNT(*) as count, AVG(gradinggrade) AS mean, 
                         STDDEV(gradinggrade) AS stddev, MIN(gradinggrade) AS min, MAX(gradinggrade) AS max 
-                        FROM {$CFG->prefix}groups_members g, {$CFG->prefix}exercise_assessments a 
-                        WHERE g.groupid = $groupid AND a.userid = g.userid AND a.timegraded > 0 
+                        FROM ".groups_members_from_sql().", {$CFG->prefix}exercise_assessments a 
+                        WHERE ".groups_members_where_sql($groupid, 'a.userid')." AND a.timegraded > 0 
                         AND a.exerciseid = $exercise->id");
             } else { // no group/all participants
                 $stats = get_record_sql("SELECT COUNT(*) as count, AVG(gradinggrade) AS mean, 
@@ -942,7 +942,7 @@ function exercise_list_submissions_for_admin($exercise) {
         }
         if (isset($table->data)) {
             if ($groupid) {
-                if (!$group = get_record("groups", "id", $groupid)) {
+                if (! groups_group_exists($groupid)) {
                     error("List unassessed student submissions: group not found");
                 }
                 print_heading("$group->name ".get_string("studentsubmissions", "exercise", $course->student).
@@ -970,9 +970,9 @@ function exercise_list_submissions_for_admin($exercise) {
             if ($groupid) {
                 $stats = get_record_sql("SELECT COUNT(*) as count, AVG(grade) AS mean, 
                         STDDEV(grade) AS stddev, MIN(grade) AS min, MAX(grade) AS max 
-                        FROM {$CFG->prefix}groups_members g, {$CFG->prefix}exercise_assessments a, 
+                        FROM ".groups_members_from_sql().", {$CFG->prefix}exercise_assessments a, 
                         {$CFG->prefix}exercise_submissions s
-                        WHERE g.groupid = $groupid AND s.userid = g.userid AND a.submissionid = s.id 
+                        WHERE ".groups_members_where_sql($groupid, 's.userid')." AND a.submissionid = s.id 
                         AND a.exerciseid = $exercise->id");
             } else { // no group/all participants
                 $stats = get_record_sql("SELECT COUNT(*) as count, AVG(grade) AS mean, 
@@ -1196,7 +1196,7 @@ function exercise_list_unassessed_student_submissions($exercise, $user) {
     // exercise_get_student_submissions is group aware
     $groupid = get_current_group($course->id);
     if ($groupid) {
-        if (!$group = get_record("groups", "id", $groupid)) {
+        if (! groups_group_exists($groupid)) {
             error("List unassessed student submissions: group not found");
         }
         print_heading(get_string("studentsubmissionsforassessment", "exercise", $group->name));
index e24c954b7a20aff1ef17618997723cab53799536..12dc33e96b117461a67a05b3220c56067facf719 100644 (file)
 
         /// Allow the teacher to change groups (for this session)
         if ($groupmode) {
-            if ($groups = get_records_menu("groups", "courseid", $course->id, "name ASC", "id,name")) {
+            if ($groups = groups_get_groups_names($course->id)) { //TODO:
                 print_group_menu($groups, $groupmode, $currentgroup, "view.php?id=$cm->id");
             }
         }
diff --git a/mod/forum/db/migrate2utf8.php b/mod/forum/db/migrate2utf8.php
deleted file mode 100755 (executable)
index d6f5451..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-<?php // $Id$
-function migrate2utf8_forum_name($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$forum = get_record('forum','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($forum->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($forum->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($forum->name, $fromenc);
-
-        $newforum = new object;
-        $newforum->id = $recordid;
-        $newforum->name = $result;
-        migrate2utf8_update_record('forum',$newforum);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_forum_intro($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$forum = get_record('forum','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($forum->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($forum->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($forum->intro, $fromenc);
-
-        $newforum = new object;
-        $newforum->id = $recordid;
-        $newforum->intro = $result;
-        migrate2utf8_update_record('forum',$newforum);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-?>
diff --git a/mod/forum/db/migrate2utf8.xml b/mod/forum/db/migrate2utf8.xml
deleted file mode 100755 (executable)
index e2d664b..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-<DBMIGRATION type="mod/forum" VERSION="2005120100">
-  <TABLES>
-    <TABLE name="forum_queue" />
-    <TABLE name="forum_ratings" />
-    <TABLE name="forum_read" />
-    <TABLE name="forum_subscriptions" />
-    <TABLE name="forum_track_prefs" />
-    <TABLE name="forum_discussions">
-      <FIELDS>
-        <FIELD name="name" method="PLAIN_SQL_UPDATE" type="varchar" length="255">
-          <SQL_DETECT_USER>
-           SELECT fd.userid
-           FROM {$CFG->prefix}forum_discussions fd
-           WHERE fd.id=RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT fd.course
-           FROM {$CFG->prefix}forum_discussions fd
-           WHERE fd.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="forum_posts">
-      <FIELDS>
-        <FIELD name="subject" method="PLAIN_SQL_UPDATE" type="varchar" length="255">
-          <SQL_DETECT_USER>
-           SELECT fp.userid
-           FROM {$CFG->prefix}forum_posts fp
-           WHERE fp.id = RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT fd.course
-           FROM {$CFG->prefix}forum_discussions fd,
-                {$CFG->prefix}forum_posts fp
-           WHERE fd.id = fp.discussion
-                 AND fp.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-        <FIELD name="message" method="PLAIN_SQL_UPDATE" type="text" length="0">
-          <SQL_DETECT_USER>
-           SELECT fp.userid
-           FROM {$CFG->prefix}forum_posts fp
-           WHERE fp.id = RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT fd.course
-           FROM {$CFG->prefix}forum_discussions fd,
-                {$CFG->prefix}forum_posts fp
-           WHERE fd.id = fp.discussion
-                 AND fp.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-        <FIELD name="attachment" method="NO_CONV" type="varchar" length="100" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="forum">
-      <FIELDS>
-        <FIELD name="name" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-            migrate2utf8_forum_name(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="intro" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_forum_intro(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="type" method="NO_CONV" type="enum('single', 'news', 'general', 'social', 'eachuser', 'teacher', 'qanda')" length="0" default="general"/>
-      </FIELDS>
-    </TABLE>
-  </TABLES>
-</DBMIGRATION>
index 72d137c32ea2baa5a10bdff84190b1d535eafc48..4d62fd8a264af71ac9669177006e00f14eb8fe2d 100644 (file)
     echo '<table width="100%"><tr><td width="33%">';
 
     if ($groupmode == VISIBLEGROUPS or ($groupmode and has_capability('moodle/site:accessallgroups', $modcontext))) {
-        if ($groups = get_records_menu('groups', 'courseid', $course->id, 'name ASC', 'id,name')) {
+        if ($groups = groups_get_groups_names($course->id)) { //TODO:
             print_group_menu($groups, $groupmode, $discussion->groupid, "view.php?id=$cm->id&amp;group=");
         }
     }
index b230929ebadcab8e2136b837a9a09052774acb2a..5e9afda30de3106e592ed5d5183bdd2fb55333cc 100644 (file)
             && has_capability('moodle/site:accessallgroups', $context))) {
         
         //the following query really needs to change
-        if ($groups = get_records_menu("groups", "courseid", $course->id, "name ASC", "id,name")) {
+        if ($groups = groups_get_groups_names($course->id)) { //TODO:
             echo '<td>';
             print_group_menu($groups, $groupmode, $currentgroup, "$CFG->wwwroot/mod/forum/view.php?id=$cm->id");
             echo '</td>';
diff --git a/mod/glossary/db/migrate2utf8.php b/mod/glossary/db/migrate2utf8.php
deleted file mode 100755 (executable)
index 8969ce2..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-<?php // $Id$
-function migrate2utf8_glossary_categories_name($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    $SQL = "SELECT g.course
-           FROM {$CFG->prefix}glossary g,
-                {$CFG->prefix}glossary_categories gc
-           WHERE g.id = gc.glossaryid
-                 AND gc.id = $recordid";
-
-    if (!$glossary = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$glossarycategory = get_record('glossary_categories','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($glossary->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($glossary->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($glossarycategory->name, $fromenc);
-
-        $newglossarycategory = new object;
-        $newglossarycategory->id = $recordid;
-        $newglossarycategory->name = $result;
-        migrate2utf8_update_record('glossary_categories',$newglossarycategory);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_glossary_name($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$glossary = get_record('glossary','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($glossary->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($glossary->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($glossary->name, $fromenc);
-
-        $newglossary = new object;
-        $newglossary->id = $recordid;
-        $newglossary->name = $result;
-        migrate2utf8_update_record('glossary',$newglossary);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_glossary_intro($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$glossary = get_record('glossary','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($glossary->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($glossary->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($glossary->intro, $fromenc);
-
-        $newglossary = new object;
-        $newglossary->id = $recordid;
-        $newglossary->intro = $result;
-        migrate2utf8_update_record('glossary',$newglossary);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-?>
diff --git a/mod/glossary/db/migrate2utf8.xml b/mod/glossary/db/migrate2utf8.xml
deleted file mode 100755 (executable)
index 807051c..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-<DBMIGRATION type="mod/glossary" VERSION="2005120100">
-  <TABLES>
-    <TABLE name="glossary_entries_categories" />
-    <TABLE name="glossary_ratings" />
-    <TABLE name="glossary_entries">
-      <FIELDS>
-        <FIELD name="concept" method="PLAIN_SQL_UPDATE" type="varchar" length="255" dropindex="concept" addindex="concept (concept(255))">
-          <SQL_DETECT_USER>
-           SELECT ge.userid
-           FROM {$CFG->prefix}glossary_entries ge
-           WHERE ge.id=RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT g.course
-           FROM {$CFG->prefix}glossary g,
-                {$CFG->prefix}glossary_entries ge
-           WHERE g.id = ge.glossaryid
-                 AND ge.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-        <FIELD name="definition" method="PLAIN_SQL_UPDATE" type="text" length="0">
-          <SQL_DETECT_USER>
-           SELECT ge.userid
-           FROM {$CFG->prefix}glossary_entries ge
-           WHERE ge.id=RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT g.course
-           FROM {$CFG->prefix}glossary g,
-                {$CFG->prefix}glossary_entries ge
-           WHERE g.id = ge.glossaryid
-                 AND ge.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-        <FIELD name="attachment" method="NO_CONV" type="varchar" length="100" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="glossary_categories">
-      <FIELDS>
-        <FIELD name="name" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-            migrate2utf8_glossary_categories(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="glossary_comments">
-      <FIELDS>
-        <FIELD name="entrycomment" method="PLAIN_SQL_UPDATE" type="text" length="0">
-          <SQL_DETECT_USER>
-           SELECT gco.userid
-           FROM {$CFG->prefix}glossary_comments gco
-           WHERE gco.id=RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT g.course
-           FROM {$CFG->prefix}glossary g,
-                {$CFG->prefix}glossary_entries ge,
-                {$CFG->prefix}glossary_comments gco
-           WHERE g.id = ge.glossaryid
-                 AND ge.id = gco.entryid
-                 AND gco.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="glossary_alias">
-      <FIELDS>
-        <FIELD name="alias" method="PLAIN_SQL_UPDATE" type="varchar" length="255">
-          <SQL_DETECT_USER>
-           SELECT ge.userid
-           FROM {$CFG->prefix}glossary_entries ge,
-                {$CFG->prefix}glossary_alias ga
-           WHERE ga.entryid = ge.id
-                 AND ga.id = RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT g.course
-           FROM {$CFG->prefix}glossary g,
-                {$CFG->prefix}glossary_entries ge,
-                {$CFG->prefix}glossary_alias ga
-           WHERE g.id = ge.glossaryid
-                 AND ge.id = ga.entryid
-                 AND ga.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="glossary_formats">
-      <FIELDS>
-        <FIELD name="name" method="NO_CONV" type="varchar" length="50" />
-        <FIELD name="popupformatname" method="NO_CONV" type="varchar" length="50" />
-        <FIELD name="defaultmode" method="NO_CONV" type="varchar" length="50" />
-        <FIELD name="defaulthook" method="NO_CONV" type="varchar" length="50" />
-        <FIELD name="sortkey" method="NO_CONV" type="varchar" length="50" />
-        <FIELD name="sortorder" method="NO_CONV" type="varchar" length="50" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="glossary">
-      <FIELDS>
-        <FIELD name="name" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-            migrate2utf8_glossary_name(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="intro" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_glossary_intro(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="displayformat" method="NO_CONV" type="varchar" length="50" default="dictionary" />
-      </FIELDS>
-    </TABLE>
-  </TABLES>
-</DBMIGRATION>
diff --git a/mod/hotpot/db/migrate2utf8.php b/mod/hotpot/db/migrate2utf8.php
deleted file mode 100755 (executable)
index 03279e8..0000000
+++ /dev/null
@@ -1,213 +0,0 @@
-<?php // $Id$
-
-function migrate2utf8_hotpot_strings_string($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$hotpotstrings = get_record('hotpot_strings','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = null;  //Non existing!
-        $userlang   = null; //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($hotpotstrings->string, $fromenc);
-
-        $newhotpotstrings = new object;
-        $newhotpotstrings->id = $recordid;
-        $newhotpotstrings->string = $result;
-        migrate2utf8_update_record('hotpot_strings',$newhotpotstrings);
-    } else {
-        $result = false;
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_hotpot_questions_name($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    $SQL = "SELECT h.course
-           FROM {$CFG->prefix}hotpot h,
-                {$CFG->prefix}hotpot_questions hq
-           WHERE h.id = hq.hotpot
-                 AND hq.id = $recordid";
-
-    if (!$hotpot = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    
-    if (!$hotpotquestion = get_record('hotpot_questions','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($hotpot->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($hotpot->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-    
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($hotpotquestion->name, $fromenc);
-
-        $newhotpotquestion = new object;
-        $newhotpotquestion->id = $recordid;
-        $newhotpotquestion->name = $result;
-        migrate2utf8_update_record('hotpot_questions',$newhotpotquestion);
-    } else {
-        $result = false;
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_hotpot_name($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$hotpot = get_record('hotpot','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($hotpot->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($hotpot->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($hotpot->name, $fromenc);
-
-        $newhotpot = new object;
-        $newhotpot->id = $recordid;
-        $newhotpot->name = $result;
-        migrate2utf8_update_record('hotpot',$newhotpot);
-    } else {
-        $result = false;
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_hotpot_summary($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$hotpot = get_record('hotpot','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($hotpot->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($hotpot->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($hotpot->summary, $fromenc);
-
-        $newhotpot = new object;
-        $newhotpot->id = $recordid;
-        $newhotpot->summary = $result;
-        migrate2utf8_update_record('hotpot',$newhotpot);
-    } else {
-        $result = false;
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_hotpot_password($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$hotpot = get_record('hotpot','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($hotpot->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($hotpot->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($hotpot->password, $fromenc);
-
-        $newhotpot = new object;
-        $newhotpot->id = $recordid;
-        $newhotpot->password = $result;
-        migrate2utf8_update_record('hotpot',$newhotpot);
-    } else {
-        $result = false;
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-?>
diff --git a/mod/hotpot/db/migrate2utf8.xml b/mod/hotpot/db/migrate2utf8.xml
deleted file mode 100755 (executable)
index cb5d0cd..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-<DBMIGRATION type="mod/hotpot" VERSION="2005120100">
-  <TABLES>
-    <TABLE name="hotpot_attempts" />
-    <TABLE name="hotpot_strings">
-      <FIELDS>
-          <FIELD name="string" method="PHP_FUNCTION" type="TEXT" length="0">
-            <PHP_FUNCTION>
-                migrate2utf8_hotpot_strings_string(RECORDID)
-            </PHP_FUNCTION>
-          </FIELD>
-          <FIELD name="md5key" method="NO_CONV" type="varchar" length="32" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="hotpot_responses">
-      <FIELDS>
-          <FIELD name="correct" method="NO_CONV" type="varchar" length="255" />
-          <FIELD name="wrong" method="NO_CONV" type="varchar" length="255" />
-          <FIELD name="ignored" method="NO_CONV" type="varchar" length="255" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="hotpot_details">
-      <FIELDS>
-        <FIELD name="details" method="PLAIN_SQL_UPDATE" type="text" length="0">
-          <SQL_DETECT_USER>
-           SELECT ha.userid
-           FROM {$CFG->prefix}hotpot_attempts ha,
-                {$CFG->prefix}hotpot_details hd
-           WHERE ha.id = hd.attempt
-                 AND hd.id = RECORDID
-           </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT h.course
-           FROM {$CFG->prefix}hotpot h,
-                {$CFG->prefix}hotpot_attempts ha,
-                {$CFG->prefix}hotpot_details hd
-           WHERE h.id = ha.hotpot
-                 AND ha.id = hd.attempt
-                 AND hd.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="hotpot_questions">
-      <FIELDS>
-        <FIELD name="name" method="PHP_FUNCTION" type="text" length="0" dropindex="hotpot_questions_name_idx" addindex=" hotpot_questions_name_idx (name(20))">
-          <PHP_FUNCTION>
-            migrate2utf8_hotpot_questions_name(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="md5key" method="NO_CONV" type="varchar" length="32" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="hotpot">
-      <FIELDS>
-        <FIELD name="name" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-            migrate2utf8_hotpot_name(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="reference" method="NO_CONV" type="varchar" length="255" />
-        <FIELD name="summary" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_hotpot_summary(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="password" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-            migrate2utf8_hotpot_password(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="subnet" method="NO_CONV" type="varchar" length="255" />
-        <FIELD name="studentfeedbackurl" method="NO_CONV" type="varchar" length="255" />
-      </FIELDS>
-    </TABLE>
-  </TABLES>
-</DBMIGRATION>
index d0a335a64acfb409799fcf47887a2ced29aadfca..39d59d352a77488be95e6ff2c905a79939c8b017 100644 (file)
 
         case 'group':
             // group members
-            if ($records = get_records_select('groups_members', "groupid=".$formdata['reportgroupid'], '', 'id,userid')) {
-                foreach ($records as $record) {
-                    $users[$record->userid] = 1; // "1" signifies currently recognized participant
+            if ($memberids = groups_get_members($formdata['reportgroupid'])) { //TODO:check.
+                foreach ($memberids as $memberid) {
+                    $users[$memberid] = 1; // "1" signifies currently recognized participant
                 }
             }
             break;
@@ -456,9 +456,9 @@ function hotpot_print_report_selector(&$course, &$hotpot, &$formdata) {
     );
 
     // groups
-    if ($groups = get_records_select('groups', "courseid='$course->id'", '', 'id,name')) {
-        foreach ($groups as $group) {
-            $menus['reportusers']["group$group->id"] = get_string('group').': '.$group->name;
+    if ($groups = groups_get_groups_names($course->id)) { //TODO:check.
+        foreach ($groups as $gid => $gname) {
+            $menus['reportusers']["group$gid"] = get_string('group').': '.$gname;
         }
     }
 
diff --git a/mod/journal/db/migrate2utf8.php b/mod/journal/db/migrate2utf8.php
deleted file mode 100755 (executable)
index 6db0b71..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-<?php // $Id$
-function migrate2utf8_journal_name($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$journal = get_record('journal','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($journal->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($journal->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($journal->name, $fromenc);
-
-        $newjournal = new object;
-        $newjournal->id = $recordid;
-        $newjournal->name = $result;
-        migrate2utf8_update_record('journal',$newjournal);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_journal_intro($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$journal = get_record('journal','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($journal->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($journal->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($journal->intro, $fromenc);
-
-        $newjournal = new object;
-        $newjournal->id = $recordid;
-        $newjournal->intro = $result;
-        migrate2utf8_update_record('journal',$newjournal);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-?>
diff --git a/mod/journal/db/migrate2utf8.xml b/mod/journal/db/migrate2utf8.xml
deleted file mode 100755 (executable)
index 5759a4e..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-<DBMIGRATION type="mod/journal" VERSION="2005120100">
-  <TABLES>
-    <TABLE name="journal_entries">
-      <FIELDS>
-        <FIELD name="text" method="PLAIN_SQL_UPDATE" type="text" length="0">
-          <SQL_DETECT_USER>
-           SELECT je.userid
-           FROM {$CFG->prefix}journal_entries je
-           WHERE je.id = RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT j.course
-           FROM {$CFG->prefix}journal j,
-                {$CFG->prefix}journal_entries je
-           WHERE j.id = je.journal
-                 AND je.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-        <FIELD name="entrycomment" method="PLAIN_SQL_UPDATE" type="text" length="0">
-          <SQL_DETECT_USER>
-           SELECT je.userid
-           FROM {$CFG->prefix}journal_entries je
-           WHERE je.id = RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT j.course
-           FROM {$CFG->prefix}journal j,
-                {$CFG->prefix}journal_entries je
-           WHERE j.id = je.journal
-                 AND je.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="journal">
-      <FIELDS>
-        <FIELD name="name" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-           migrate2utf8_journal_name(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="intro" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-           migrate2utf8_journal_intro(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-  </TABLES>
-</DBMIGRATION>
index f335bb7ad39ccd3057cb047236b604fadb7e0aec..d1af6ffb484e21adc68cac9ff21f9e41f518e43b 100644 (file)
@@ -340,10 +340,9 @@ function journal_count_entries($journal, $groupid=0) {
     if ($groupid) {     /// How many in a particular group?
         return count_records_sql("SELECT COUNT(*) 
                                      FROM {$CFG->prefix}journal_entries j,
-                                          {$CFG->prefix}groups_members g
+                                          ".groups_members_from_sql()."
                                     WHERE j.journal = $journal->id 
-                                      AND g.groupid = '$groupid' 
-                                      AND j.userid = g.userid");
+                                      AND ".groups_members_where_sql($groupid, 'j.userid'));
 
     } else { /// Count all the entries from the whole course
     
index d273c0407c799b3de8310e20890ded35a943fde7..69ae6712371c75ecf85f59b0017d72093e48890d 100644 (file)
@@ -35,7 +35,7 @@
     if (isteacher($course->id)) {
         $currentgroup = get_current_group($course->id);
         if ($currentgroup and isteacheredit($course->id)) {
-            $group = get_record("groups", "id", $currentgroup);
+            $group = groups_get_group($currentgroup); //TODO:
             $groupname = " ($group->name)";
         } else {
             $groupname = "";
diff --git a/mod/label/db/migrate2utf8.php b/mod/label/db/migrate2utf8.php
deleted file mode 100755 (executable)
index b093c67..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-<?php // $Id$
-function migrate2utf8_label_name($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$label = get_record('label','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($label->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($label->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($label->name, $fromenc);
-
-        $newlabel = new object;
-        $newlabel->id = $recordid;
-        $newlabel->name = $result;
-        migrate2utf8_update_record('label',$newlabel);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_label_content($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$label = get_record('label','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($label->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($label->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($label->content, $fromenc);
-
-        $newlabel = new object;
-        $newlabel->id = $recordid;
-        $newlabel->content = $result;
-        migrate2utf8_update_record('label',$newlabel);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-?>
diff --git a/mod/label/db/migrate2utf8.xml b/mod/label/db/migrate2utf8.xml
deleted file mode 100755 (executable)
index 66f87e8..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<DBMIGRATION type="mod/label" VERSION="2005120100">
-  <TABLES>
-    <TABLE name="label">
-      <FIELDS>
-        <FIELD name="name" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-            migrate2utf8_label_name(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="content" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_label_content(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-  </TABLES>
-</DBMIGRATION>
diff --git a/mod/lams/db/migrate2utf8.php b/mod/lams/db/migrate2utf8.php
deleted file mode 100755 (executable)
index 6d86848..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-<?php // $Id$
-function migrate2utf8_lams_name($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$lams = get_record('lams','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($lams->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($lams->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($lams->name, $fromenc);
-
-        $newlams = new object;
-        $newlams->id = $recordid;
-        $newlams->name = $result;
-        migrate2utf8_update_record('lams',$newlams);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_lams_introduction($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$lams = get_record('lams','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($lams->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($lams->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($lams->introduction, $fromenc);
-
-        $newlams = new object;
-        $newlams->id = $recordid;
-        $newlams->introduction = $result;
-        migrate2utf8_update_record('lams',$newlams);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-?>
diff --git a/mod/lams/db/migrate2utf8.xml b/mod/lams/db/migrate2utf8.xml
deleted file mode 100755 (executable)
index 21506d0..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<DBMIGRATION type="mod/lams" VERSION="2005120100">
-  <TABLES>
-    <TABLE name="lams">
-      <FIELDS>
-        <FIELD name="name" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-           migrate2utf8_lams_name(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="introduction" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-           migrate2utf8_lams_introduction(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-  </TABLES>
-</DBMIGRATION>
diff --git a/mod/lesson/db/migrate2utf8.php b/mod/lesson/db/migrate2utf8.php
deleted file mode 100755 (executable)
index 27980a3..0000000
+++ /dev/null
@@ -1,304 +0,0 @@
-<?php // $Id$
-
-// fix for MDL-6336
-// handling serialized object
-function migrate2utf8_lesson_attempts_useranswer($recordid) {
-    global $CFG, $globallang;
-  
-    /// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $user = get_record_sql("SELECT la.userid
-           FROM {$CFG->prefix}lesson_attempts la
-           WHERE la.id=$recordid");
-
-    $course = get_record_sql("SELECT l.course
-           FROM {$CFG->prefix}lesson l,
-                {$CFG->prefix}lesson_attempts la
-           WHERE l.id = la.lessonid
-                 AND la.id = $recordid");
-  
-    if (!$lessonattempts = get_record('lesson_attempts','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-  
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($course->course);
-        $userlang   = get_user_lang($user->userid);        
-        $fromencstudent = get_original_encoding($sitelang, $courselang, $userlang); // this is used for answer field
-        $userlang = get_main_teacher_lang($course->course);       
-        $fromencteacher = get_original_encoding($sitelang, $courselang, $userlang); // this is used for response field       
-    }
-    
-    $result = $lessonattempts->useranswer; // init to avoid warnings
-    // if unserialize success, meaning it is an object
-    if ($attempt = unserialize($lessonattempts->useranswer)) {
-        $attempt->answer = utfconvert($attempt->answer, $fromencstudent);
-        $attempt->response = utfconvert($attempt->response, $fromencteacher);
-        $newla = new object;
-        $newla->id = $recordid;
-        $newla->useranswer = serialize($attempt); // serialize it back    
-        migrate2utf8_update_record('lesson_attempts', $newla);
-      
-    } else { // just a string
-        $result = utfconvert($lessonattempts->useranswer, $fromencstudent);
-        $newla = new object;
-        $newla->id = $recordid;
-        $newla->useranswer =  $result;// serialize it back
-        migrate2utf8_update_record('lesson_attempts', $newla);
-    }
-    
-    return $result;
-}
-
-function migrate2utf8_lesson_answers_answer($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT l.course
-           FROM {$CFG->prefix}lesson l,
-                {$CFG->prefix}lesson_answers la
-           WHERE l.id = la.lessonid
-                 AND la.id = $recordid";
-
-    if (!$lesson = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$lessonanswers = get_record('lesson_answers','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($lesson->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($lesson->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($lessonanswers->answer, $fromenc);
-
-        $newlessonanswers = new object;
-        $newlessonanswers->id = $recordid;
-        $newlessonanswers->answer = $result;
-        migrate2utf8_update_record('lesson_answers',$newlessonanswers);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_lesson_answers_response($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT l.course
-           FROM {$CFG->prefix}lesson l,
-                {$CFG->prefix}lesson_answers la
-           WHERE l.id = la.lessonid
-                 AND la.id = $recordid";
-
-    if (!$lesson = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$lessonanswers = get_record('lesson_answers','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($lesson->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($lesson->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($lessonanswers->response, $fromenc);
-
-        $newlessonanswers = new object;
-        $newlessonanswers->id = $recordid;
-        $newlessonanswers->response = $result;
-        migrate2utf8_update_record('lesson_answers',$newlessonanswers);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_lesson_default_password($recordid){
-
-    ///um
-
-}
-
-
-function migrate2utf8_lesson_pages_contents($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT l.course
-           FROM {$CFG->prefix}lesson l,
-                {$CFG->prefix}lesson_pages lp
-           WHERE l.id = lp.lessonid
-                 AND lp.id = $recordid";
-
-    if (!$lesson = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$lessonpages = get_record('lesson_pages','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($lesson->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($lesson->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($lessonpages->contents, $fromenc);
-
-        $newlessonpages = new object;
-        $newlessonpages->id = $recordid;
-        $newlessonpages->contents = $result;
-        migrate2utf8_update_record('lesson_pages',$newlessonpages);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_lesson_pages_title($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT l.course
-           FROM {$CFG->prefix}lesson l,
-                {$CFG->prefix}lesson_pages lp
-           WHERE l.id = lp.lessonid
-                 AND lp.id = $recordid";
-
-    if (!$lesson = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if (!$lessonpages = get_record('lesson_pages','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($lesson->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($lesson->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($lessonpages->title, $fromenc);
-
-        $newlessonpages = new object;
-        $newlessonpages->id = $recordid;
-        $newlessonpages->title = $result;
-        migrate2utf8_update_record('lesson_pages',$newlessonpages);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_lesson_name($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$lesson = get_record('lesson','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($lesson->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($lesson->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($lesson->name, $fromenc);
-
-        $newlesson = new object;
-        $newlesson->id = $recordid;
-        $newlesson->name = $result;
-        migrate2utf8_update_record('lesson',$newlesson);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_lesson_password($recordid){
-///um
-}
-?>
diff --git a/mod/lesson/db/migrate2utf8.xml b/mod/lesson/db/migrate2utf8.xml
deleted file mode 100755 (executable)
index e06d6f7..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-<DBMIGRATION type="mod/lesson" VERSION="2005120100">
-  <TABLES>
-    <TABLE name="lesson_branch" />
-    <TABLE name="lesson_grades" />
-    <TABLE name="lesson_timer" />
-    <TABLE name="lesson_attempts">
-      <FIELDS>
-        <FIELD name="useranswer" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_lesson_attempts_useranswer(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="lesson_high_scores">
-      <FIELDS>
-        <FIELD name="nickname" method="NO_CONV" type="varchar" length="5" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="lesson_answers">
-      <FIELDS>
-        <FIELD name="answer" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_lesson_answers_answer(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="response" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_lesson_answers_response(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="lesson_default">
-      <FIELDS>
-        <FIELD name="password" method="PHP_FUNCTION" type="varchar" length="32">
-          <PHP_FUNCTION>
-           migrate2utf8_lesson_default_password(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="conditions" method="NO_CONV" type="text" length="0" />
-        <FIELD name="bgcolor" method="NO_CONV" type="varchar" length="7" default="#FFFFFF" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="lesson_pages">
-      <FIELDS>
-        <FIELD name="title" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-            migrate2utf8_lesson_pages_title(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="contents" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_lesson_pages_content(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="lesson">
-      <FIELDS>
-        <FIELD name="name" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-           migrate2utf8_lesson_name(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="password" method="PHP_FUNCTION" type="varchar" length="32">
-          <PHP_FUNCTION>
-           migrate2utf8_lesson_password(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="conditions" method="NO_CONV" type="text" length="0" />
-        <FIELD name="mediafile" method="NO_CONV" type="varchar" length="255" />
-        <FIELD name="bgcolor" method="NO_CONV" type="varchar" length="7" default="#FFFFFF" />
-      </FIELDS>
-    </TABLE>
-  </TABLES>
-</DBMIGRATION>
index cfc2fb71928a290cdd0a48003c6691bb231f5f48..20d5d64a77e941e1f7a266ffa13ccb0c4f79b405 100644 (file)
@@ -291,4 +291,4 @@ class mod_lesson_mod_form extends moodleform_mod {
         }
        }
 }
-?>
\ No newline at end of file
+?>
diff --git a/mod/quiz/db/migrate2utf8.php b/mod/quiz/db/migrate2utf8.php
deleted file mode 100755 (executable)
index 0bbfaca..0000000
+++ /dev/null
@@ -1,934 +0,0 @@
-<?php // $Id$
-
-function migrate2utf8_question_multichoice_correctfeedback($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT qc.course
-           FROM {$CFG->prefix}question_categories qc,
-                {$CFG->prefix}question qq,
-                {$CFG->prefix}question_multichoice qm
-           WHERE qc.id = qq.category
-                 AND qq.id = qm.question
-                 AND qm.id =  $recordid";
-
-    if (!$quiz = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$questionmultichoice = get_record('question_multichoice','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($quiz->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($quiz->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($questionmultichoice->correctfeedback, $fromenc);
-
-        $newquestionmultichoice = new object;
-        $newquestionmultichoice->id = $recordid;
-        $newquestionmultichoice->correctfeedback = $result;
-        update_record('question_multichoice',$newquestionmultichoice);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_question_multichoice_partiallycorrectfeedback($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT qc.course
-           FROM {$CFG->prefix}question_categories qc,
-                {$CFG->prefix}question qq,
-                {$CFG->prefix}question_multichoice qm
-           WHERE qc.id = qq.category
-                 AND qq.id = qm.question
-                 AND qm.id =  $recordid";
-
-    if (!$quiz = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$questionmultichoice = get_record('question_multichoice','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($quiz->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($quiz->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($questionmultichoice->partiallycorrectfeedback, $fromenc);
-
-        $newquestionmultichoice = new object;
-        $newquestionmultichoice->id = $recordid;
-        $newquestionmultichoice->partiallycorrectfeedback= $result;
-        update_record('question_multichoice',$newquestionmultichoice);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_question_multichoice_incorrectfeedback($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT qc.course
-           FROM {$CFG->prefix}question_categories qc,
-                {$CFG->prefix}question qq,
-                {$CFG->prefix}question_multichoice qm
-           WHERE qc.id = qq.category
-                 AND qq.id = qm.question
-                 AND qm.id =  $recordid";
-
-    if (!$quiz = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$questionmultichoice = get_record('question_multichoice','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($quiz->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($quiz->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($questionmultichoice->incorrectfeedback, $fromenc);
-
-        $newquestionmultichoice = new object;
-        $newquestionmultichoice->id = $recordid;
-        $newquestionmultichoice->incorrectfeedback= $result;
-        update_record('question_multichoice',$newquestionmultichoice);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_quiz_feedback_feedbacktext($recordid) {
-    global $CFG, $globallang; 
-    /// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-  
-    $SQL = "SELECT q.course
-           FROM {$CFG->prefix}quiz_feedback qf,
-                {$CFG->prefix}quiz q
-           WHERE qf.quizid = q.id
-           AND qf.id = $recordid";
-    if (!$quiz = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if (!$quizfeedback = get_record('quiz_feedback','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-     
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($quiz->course);
-        $userlang   = null; //N.E.!!
-        
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($quizfeedback->feedbacktext, $fromenc);
-
-        $newquizfeedback = new object;
-        $newquizfeedback->id = $recordid;
-        $newquizfeedback->feedbacktext = $result;
-        update_record('quiz_feedback',$newquizfeedback);
-    }
-/// And finally, just return the converted field
-    return $result;  
-}
-
-function migrate2utf8_question_name($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    
-    $SQL = "SELECT qc.course
-           FROM {$CFG->prefix}question_categories qc,
-                {$CFG->prefix}question qq
-           WHERE qc.id = qq.category
-                 AND qq.id = $recordid";
-
-    if (!$quiz = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$quizquestions = get_record('question','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($quiz->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($quiz->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($quizquestions->name, $fromenc);
-
-        $newquizquestion = new object;
-        $newquizquestion->id = $recordid;
-        $newquizquestion->name = $result;
-        update_record('question',$newquizquestion);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-
-function migrate2utf8_question_qtype($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT qc.course
-           FROM {$CFG->prefix}question_categories qc,
-                {$CFG->prefix}question qq
-           WHERE qc.id = qq.category
-                 AND qq.id = $recordid";
-
-    if (!$quiz = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$quizquestions = get_record('question','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($quiz->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($quiz->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($quizquestions->qtype, $fromenc);
-
-        $newquizquestion = new object;
-        $newquizquestion->id = $recordid;
-        $newquizquestion->qtype = $result;
-        update_record('question',$newquizquestion);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_question_questiontext($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT qc.course
-           FROM {$CFG->prefix}question_categories qc,
-                {$CFG->prefix}question qq
-           WHERE qc.id = qq.category
-                 AND qq.id = $recordid";
-
-    if (!$quiz = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$quizquestions = get_record('question','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($quiz->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($quiz->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($quizquestions->questiontext, $fromenc);
-
-        $newquizquestion = new object;
-        $newquizquestion->id = $recordid;
-        $newquizquestion->questiontext = $result;
-        update_record('question',$newquizquestion);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_question_generalfeedback($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT qc.course
-           FROM {$CFG->prefix}question_categories qc,
-                {$CFG->prefix}question qq
-           WHERE qc.id = qq.category
-                 AND qq.id = $recordid";
-
-    if (!$quiz = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$quizquestions = get_record('question','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($quiz->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($quiz->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($quizquestions->generalfeedback, $fromenc);
-
-        $newquizquestion = new object;
-        $newquizquestion->id = $recordid;
-        $newquizquestion->generalfeedback = $result;
-        update_record('question',$newquizquestion);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_question_numerical_units_unit($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT qc.course
-           FROM {$CFG->prefix}question_categories qc,
-                {$CFG->prefix}question qq,
-                {$CFG->prefix}question_numerical_units qnu
-           WHERE qc.id = qq.category
-                 AND qq.id = qnu.question
-                 AND qnu.id =  $recordid";
-
-    if (!$quiz = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$quiznumericalunits = get_record('question_numerical_units','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($quiz->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($quiz->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($quiznumericalunits->unit, $fromenc);
-
-        $newquiznumericalunits = new object;
-        $newquiznumericalunits->id = $recordid;
-        $newquiznumericalunits->unit = $result;
-        update_record('question_numerical_units',$newquiznumericalunits);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_question_match_sub_questiontext($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT qc.course
-           FROM {$CFG->prefix}question_categories qc,
-                {$CFG->prefix}question qq,
-                {$CFG->prefix}question_match_sub qms
-           WHERE qc.id = qq.category
-                 AND qq.id = qms.question
-                 AND qms.id = $recordid";
-
-    if (!$quiz = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$quizmatchsub = get_record('question_match_sub','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($quiz->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($quiz->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($quizmatchsub->questiontext, $fromenc);
-
-        $newquizmatchsub = new object;
-        $newquizmatchsub->id = $recordid;
-        $newquizmatchsub->questiontext = $result;
-        update_record('question_match_sub',$newquizmatchsub);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_question_match_sub_answertext($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT qc.course
-           FROM {$CFG->prefix}question_categories qc,
-                {$CFG->prefix}question qq,
-                {$CFG->prefix}question_match_sub qms
-           WHERE qc.id = qq.category
-                 AND qq.id = qms.question
-                 AND qms.id = $recordid";
-
-    if (!$quiz = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$quizmatchsub = get_record('question_match_sub','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($quiz->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($quiz->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($quizmatchsub->answertext, $fromenc);
-
-        $newquizmatchsub = new object;
-        $newquizmatchsub->id = $recordid;
-        $newquizmatchsub->answertext = $result;
-        update_record('question_match_sub',$newquizmatchsub);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_question_answers_answer($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT qc.course
-           FROM {$CFG->prefix}question_categories qc,
-                {$CFG->prefix}question qq,
-                {$CFG->prefix}question_answers qa
-           WHERE qc.id = qq.category
-                 AND qq.id = qa.question
-                 AND qa.id = $recordid";
-
-    if (!$quiz = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$quizanswer= get_record('question_answers','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($quiz->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($quiz->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($quizanswer->answer, $fromenc);
-
-        $newquizanswer = new object;
-        $newquizanswer->id = $recordid;
-        $newquizanswer->answer = $result;
-        update_record('question_answers',$newquizanswer);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_question_answers_feedback($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT qc.course
-           FROM {$CFG->prefix}question_categories qc,
-                {$CFG->prefix}question qq,
-                {$CFG->prefix}question_answers qa
-           WHERE qc.id = qq.category
-                 AND qq.id = qa.question
-                 AND qa.id = $recordid";
-
-    if (!$quiz = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$quizanswer= get_record('question_answers','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($quiz->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($quiz->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($quizanswer->feedback, $fromenc);
-
-        $newquizanswer = new object;
-        $newquizanswer->id = $recordid;
-        $newquizanswer->feedback = $result;
-        update_record('question_answers',$newquizanswer);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-
-
-
-
-function migrate2utf8_question_dataset_definitions_name($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT qc.course
-           FROM {$CFG->prefix}question_categories qc,
-                {$CFG->prefix}question_dataset_definitions qdd
-           WHERE qc.id = qdd.category
-                 AND qdd.id = $recordid";
-
-    if (!$quiz = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$quizdatasetdefinition = get_record('question_dataset_definitions','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($quiz->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($quiz->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($quizdatasetdefinition->name, $fromenc);
-
-        $newquizdatasetdefinition = new object;
-        $newquizdatasetdefinition->id = $recordid;
-        $newquizdatasetdefinition->name = $result;
-        update_record('question_dataset_definitions',$newquizdatasetdefinition);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_question_categories_name($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT qc.course
-           FROM {$CFG->prefix}question_categories qc
-           WHERE qc.id = $recordid";
-
-    if (!$quiz = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$quizcategory = get_record('question_categories','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($quiz->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($quiz->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($quizcategory->name, $fromenc);
-
-        $newquizcategory = new object;
-        $newquizcategory->id = $recordid;
-        $newquizcategory->name = $result;
-        update_record('question_categories',$newquizcategory);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_question_categories_info($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT qc.course
-           FROM {$CFG->prefix}question_categories qc
-           WHERE qc.id = $recordid";
-
-    if (!$quiz = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$quizcategory = get_record('question_categories','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($quiz->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($quiz->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($quizcategory->info, $fromenc);
-
-        $newquizcategory = new object;
-        $newquizcategory->id = $recordid;
-        $newquizcategory->info = $result;
-        update_record('question_categories',$newquizcategory);
-    }
-/// And finally, just return the converted field
-
-    return $result;
-}
-
-function migrate2utf8_quiz_name($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$quiz = get_record('quiz','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($quiz->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($quiz->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($quiz->name, $fromenc);
-
-        $newquiz = new object;
-        $newquiz->id = $recordid;
-        $newquiz->name = $result;
-        update_record('quiz',$newquiz);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-
-function migrate2utf8_quiz_intro($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$quiz = get_record('quiz','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($quiz->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($quiz->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($quiz->intro, $fromenc);
-
-        $newquiz = new object;
-        $newquiz->id = $recordid;
-        $newquiz->intro = $result;
-        update_record('quiz',$newquiz);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_quiz_password($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$quiz = get_record('quiz','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($quiz->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($quiz->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-/// Convert the text
-        $result = utfconvert($quiz->password, $fromenc);
-
-        $newquiz = new object;
-        $newquiz->id = $recordid;
-        $newquiz->password = $result;
-        update_record('quiz',$newquiz);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-?>
diff --git a/mod/quiz/db/migrate2utf8.xml b/mod/quiz/db/migrate2utf8.xml
deleted file mode 100755 (executable)
index 82e03b7..0000000
+++ /dev/null
@@ -1,255 +0,0 @@
-<DBMIGRATION type="mod/quiz" VERSION="2005120100">
-  <TABLES>
-    <TABLE name="quiz_feedback">
-      <FIELDS>
-        <FIELD name="feedbacktext" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_quiz_feedback_feedbacktext(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-      </FIELDS>
-    </TABLE>   
-    <TABLE name="quiz_grades" />
-    <TABLE name="question_datasets" />
-    <TABLE name="quiz_question_instances" />
-    <TABLE name="quiz_question_versions" />
-    <TABLE name="question_randomsamatch" />
-    <TABLE name="question_truefalse" />
-    <TABLE name="question_attempts">
-      <FIELDS>
-        <FIELD name="modulename" method="NO_CONV" type="varchar" length="20" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="question_rqp">
-      <FIELDS>
-        <FIELD name="format" method="NO_CONV" type="varchar" length="255" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="question_rqp_servers">
-      <FIELDS>
-        <FIELD name="url" method="NO_CONV" type="varchar" length="255" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="question_rqp_states">
-      <FIELDS>
-        <FIELD name="responses" method="NO_CONV" type="text" length="0" />
-        <FIELD name="persistent_data" method="NO_CONV" type="text" length="0" />
-        <FIELD name="template_vars" method="NO_CONV" type="text" length="0" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="question_rqp_types">
-      <FIELDS>
-        <FIELD name="name" method="NO_CONV" type="varchar" length="255" dropindex="name" adduniqueindex="name (name(255))"/>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="question_shortanswer">
-      <FIELDS>
-        <FIELD name="answers" method="NO_CONV" type="varchar" length="255" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="question_numerical">
-      <FIELDS>
-        <FIELD name="tolerance" method="NO_CONV" type="varchar" length="255" default="0.0" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="question_sessions">
-      <FIELDS>
-        <FIELD name="manualcomment" method="PLAIN_SQL_UPDATE" type="text" length="0">
-          <SQL_DETECT_USER>
-           SELECT qa.userid
-           FROM {$CFG->prefix}question_sessions qs,
-                {$CFG->prefix}quiz_attempts qa
-           WHERE qa.id = qs.attemptid
-                 AND qs.id = RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT q.course
-           FROM {$CFG->prefix}quiz q,
-                {$CFG->prefix}question_sessions qs,
-                {$CFG->prefix}quiz_attempts qa
-           WHERE q.id = qa.quiz
-                 AND qa.id = qs.attemptid
-                 AND qs.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="question_multichoice">
-      <FIELDS>
-        <FIELD name="answers" method="NO_CONV" type="varchar" length="255" />
-        <FIELD name="correctfeedback" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_question_multichoice_correctfeedback(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="partiallycorrectfeedback" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_question_multichoice_partiallycorrectfeedback(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="incorrectfeedback" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_question_multichoice_incorrectfeedback(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="question_multianswer">
-      <FIELDS>
-        <FIELD name="sequence" method="NO_CONV" type="varchar" length="255" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="question_match">
-      <FIELDS>
-        <FIELD name="subquestions" method="NO_CONV" type="varchar" length="255" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="question_dataset_items">
-      <FIELDS>
-        <FIELD name="value" method="NO_CONV" type="varchar" length="255" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="question_calculated">
-      <FIELDS>
-        <FIELD name="tolerance" method="NO_CONV" type="varchar" length="20" default="0.0" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="quiz_attempts">
-      <FIELDS>
-        <FIELD name="layout" method="NO_CONV" type="text" length="0" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="question_states">
-      <FIELDS>
-        <FIELD name="answer" method="PLAIN_SQL_UPDATE" type="text" length="0">
-          <SQL_DETECT_USER>
-           SELECT qa.userid
-           FROM {$CFG->prefix}question_states qs,
-                {$CFG->prefix}quiz_attempts qa
-           WHERE qa.id = qs.attempt
-                 AND qs.id=RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT q.course
-           FROM {$CFG->prefix}quiz q,
-                {$CFG->prefix}question_states qs,
-                {$CFG->prefix}quiz_attempts qa
-           WHERE q.id = qa.quiz
-                 AND qa.id = qs.attempt
-                 AND qs.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="question">
-      <FIELDS>
-        <FIELD name="name" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-            migrate2utf8_question_name(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="qtype" method="PHP_FUNCTION" type="varchar" length="20">
-          <PHP_FUNCTION>
-            migrate2utf8_question_qtype(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="version" method="NO_CONV" type="varchar" length="255" />
-        <FIELD name="questiontext" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_question_questiontext(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="image" method="NO_CONV" type="varchar" length="255" />
-        <FIELD name="generalfeedback" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_question_generalfeedback(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="stamp" method="NO_CONV" type="varchar" length="255" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="question_numerical_units">
-      <FIELDS>
-        <FIELD name="unit" method="PHP_FUNCTION" type="varchar" length="50">
-          <PHP_FUNCTION>
-            migrate2utf8_question_numerical_units_unit(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="question_match_sub">
-      <FIELDS>
-        <FIELD name="questiontext" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_question_match_sub_questionext(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="answertext" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-            migrate2utf8_question_match_sub_answertext(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="question_answers">
-      <FIELDS>
-        <FIELD name="answer" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_question_answers_answer(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="feedback" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_question_answers_feedback(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="question_dataset_definitions">
-      <FIELDS>
-        <FIELD name="name" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-            migrate2utf8_question_dataset_definitions_name(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="options" method="NO_CONV" type="varchar" length="255" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="question_categories">
-      <FIELDS>
-        <FIELD name="name" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-            migrate2utf8_question_categories_name(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="info" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_question_categories_info(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="stamp" method="NO_CONV" type="varchar" length="255" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="quiz">
-      <FIELDS>
-        <FIELD name="name" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-            migrate2utf8_quiz_name(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="intro" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_quiz_intro(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="questions" method="NO_CONV" type="text" length="0" />
-        <FIELD name="password" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-            migrate2utf8_quiz_password(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="subnet" method="NO_CONV" type="varchar" length="255" />
-      </FIELDS>
-    </TABLE>
-  </TABLES>
-</DBMIGRATION>
index 882fe0efcf0981c2077f1073df0fc47f9a6a4012..93fb267000d337e847d101b51fed1367c5d7b77a 100644 (file)
@@ -386,7 +386,7 @@ function quiz_get_recent_mod_activity(&$activities, &$index, $sincetime, $course
       return;
 
     foreach ($quizzes as $quiz) {
-        if (empty($groupid) || ismember($groupid, $quiz->userid)) {
+        if (empty($groupid) || groups_is_member($groupid, $quiz->userid)) {
 
           $tmpactivity = new Object;
 
@@ -708,4 +708,4 @@ function quiz_question_list_instances($questionid) {
     return array();
 }
 
-?>
+?>
\ No newline at end of file
index 66ea4c4f56f0af8e0c4eba22bfcdf42520083ccd..be0b52d77167a6e2a5b946ebfd8c5a701a14b620 100644 (file)
@@ -28,11 +28,7 @@ class quiz_report extends quiz_default_report {
             if (!$download) {
                 $currentgroup = setup_and_print_groups($course, $groupmode, "report.php?id=$cm->id&amp;mode=analysis");
             } else {
-                if (isset($_GET['group'])) {
-                    $changegroup = $_GET['group'];  /// 0 or higher
-                } else {
-                    $changegroup = -1;              /// This means no group change was specified
-                }
+                $changegroup = optional_param('group', -1, PARAM_INT);
 
                 $currentgroup = get_and_set_current_group($course, $groupmode, $changegroup);  
             }
@@ -85,7 +81,7 @@ class quiz_report extends quiz_default_report {
         $sql = 'SELECT  qa.* FROM '.$CFG->prefix.'user u '.
             'JOIN '.$CFG->prefix.'quiz_attempts qa ON u.id = qa.userid ';
             if (!empty($currentgroup)) {
-                $sql .= ' JOIN '.$CFG->prefix.'groups_members gm ON u.id = gm.userid AND gm.groupid = '.$currentgroup;
+                $sql .= groups_members_join_sql($currentgroup);
             }
             $sql .= ' WHERE qa.quiz = '.$quiz->id.  // ULPGC ecastro
                 ' AND ( qa.sumgrades >= '.$scorelimit.' ) ';
index 4a0de57e0394537b388e0546b07ef96b7d69c2b9..58e21fbcc38290c95a374dd15bed1ab4a7dc8d8b 100644 (file)
@@ -72,11 +72,7 @@ class quiz_report extends quiz_default_report {
             if (!$download) {
                 $currentgroup = setup_and_print_groups($course, $groupmode, "report.php?id=$cm->id&amp;mode=overview");
             } else {
-                if (isset($_GET['group'])) {
-                    $changegroup = $_GET['group']; // 0 or higher
-                } else {
-                    $changegroup = -1; // This means no group change was specified
-                }
+                $changegroup = optional_param('group', -1, PARAM_INT);
 
                 $currentgroup = get_and_set_current_group($course, $groupmode, $changegroup);
             }
@@ -301,15 +297,18 @@ class quiz_report extends quiz_default_report {
             if (!empty($currentgroup) && empty($noattempts)) {
                 // we want a particular group and we only want to see students WITH attempts.
                 // So join on groups_members and do an inner join on attempts.
-                $from  = 'FROM '.$CFG->prefix.'user u JOIN '.$CFG->prefix.'role_assignments ra ON ra.userid = u.id JOIN '.$CFG->prefix.'groups_members gm ON u.id = gm.userid '.
+                $from  = 'FROM '.$CFG->prefix.'user u JOIN '.$CFG->prefix.'role_assignments ra ON ra.userid = u.id '.
+                    groups_members_join_sql().
                     'JOIN '.$CFG->prefix.'quiz_attempts qa ON u.id = qa.userid AND qa.quiz = '.$quiz->id;
-                $where = ' WHERE ra.contextid ' . $contextlists . ' AND gm.groupid = '.$currentgroup.' AND qa.preview = 0';                
+                $where = ' WHERE ra.contextid ' . $contextlists . ' AND '. groups_members_where_sql($currentgroup) .' AND qa.preview = 0';
+                                
             } else if (!empty($currentgroup) && !empty($noattempts)) {
                 // We want a particular group and we want to do something funky with attempts
                 // So join on groups_members and left join on attempts... 
-                $from  = 'FROM '.$CFG->prefix.'user u JOIN '.$CFG->prefix.'role_assignments ra ON ra.userid = u.id JOIN '.$CFG->prefix.'groups_members gm ON u.id = gm.userid '.
+                $from  = 'FROM '.$CFG->prefix.'user u JOIN '.$CFG->prefix.'role_assignments ra ON ra.userid = u.id '.
+                    groups_members_join_sql().
                     'LEFT JOIN '.$CFG->prefix.'quiz_attempts qa ON u.id = qa.userid AND qa.quiz = '.$quiz->id;
-                $where = ' WHERE ra.contextid ' . $contextlists . ' AND gm.groupid = '.$currentgroup.' AND qa.preview = 0';
+                $where = ' WHERE ra.contextid ' .$contextlists . ' AND '.groups_members_where_sql($currentgroup).' AND qa.preview = 0';
                 if ($noattempts == 1) {
                     // noattempts = 1 means only no attempts, so make the left join ask for only records where the right is null (no attempts)
                     $where .= ' AND qa.userid IS NULL'; // show ONLY no attempts;
diff --git a/mod/resource/db/migrate2utf8.php b/mod/resource/db/migrate2utf8.php
deleted file mode 100755 (executable)
index efdb499..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-<?php // $Id$
-function migrate2utf8_resource_name($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$resource = get_record('resource','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($resource->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($resource->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-/// Convert the text
-        $result = utfconvert($resource->name, $fromenc);
-
-        $newresource = new object;
-        $newresource->id = $recordid;
-        $newresource->name = $result;
-        migrate2utf8_update_record('resource',$newresource);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_resource_reference($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$resource = get_record('resource','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($resource->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($resource->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($resource->reference, $fromenc);
-
-        $newresource = new object;
-        $newresource->id = $recordid;
-        $newresource->reference = $result;
-        migrate2utf8_update_record('resource',$newresource);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_resource_summary($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$resource = get_record('resource','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($resource->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($resource->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($resource->summary, $fromenc);
-        $newresource = new object;
-        $newresource->id = $recordid;
-        $newresource->summary = $result;
-        migrate2utf8_update_record('resource',$newresource);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_resource_alltext($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$resource = get_record('resource','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($resource->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($resource->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($resource->alltext, $fromenc);
-
-        $newresource = new object;
-        $newresource->id = $recordid;
-        $newresource->alltext = $result;
-        migrate2utf8_update_record('resource',$newresource);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-?>
diff --git a/mod/resource/db/migrate2utf8.xml b/mod/resource/db/migrate2utf8.xml
deleted file mode 100755 (executable)
index a8900c7..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-<DBMIGRATION type="mod/resource" VERSION="2005120100">
-  <TABLES>
-    <TABLE name="resource">
-      <FIELDS>
-        <FIELD name="name" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-            migrate2utf8_resource_name(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="type" method="NO_CONV" type="varchar" length="30" />
-        <FIELD name="reference" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-            migrate2utf8_resource_reference(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="summary" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_resource_summary(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="alltext" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_resource_alltext(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="popup" method="NO_CONV" type="text" length="0" />
-        <FIELD name="options" method="NO_CONV" type="varchar" length="255" />
-      </FIELDS>
-    </TABLE>
-  </TABLES>
-</DBMIGRATION>
diff --git a/mod/scorm/db/migrate2utf8.php b/mod/scorm/db/migrate2utf8.php
deleted file mode 100755 (executable)
index 96c12cf..0000000
+++ /dev/null
@@ -1,802 +0,0 @@
-<?php // $Id$
-function migrate2utf8_scorm_scoes_manifest($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT s.course
-           FROM {$CFG->prefix}scorm s,
-                {$CFG->prefix}scorm_scoes ss
-           WHERE s.id = ss.scorm
-                 AND ss.id = $recordid";
-
-    if (!$scorm = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    
-    if (!$scormscoes = get_record('scorm_scoes','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($scorm->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($scorm->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($scormscoes->manifest, $fromenc);
-
-        $newscormscoes = new object;
-        $newscormscoes->id = $recordid;
-        $newscormscoes->manifest = $result;
-        migrate2utf8_update_record('scorm_scoes',$newscormscoes);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_scorm_scoes_organization($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT s.course
-           FROM {$CFG->prefix}scorm s,
-                {$CFG->prefix}scorm_scoes ss
-           WHERE s.id = ss.scorm
-                 AND ss.id = $recordid";
-
-    if (!$scorm = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$scormscoes = get_record('scorm_scoes','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($scorm->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($scorm->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($scormscoes->organization, $fromenc);
-
-        $newscormscoes = new object;
-        $newscormscoes->id = $recordid;
-        $newscormscoes->organization = $result;
-        migrate2utf8_update_record('scorm_scoes',$newscormscoes);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_scorm_scoes_parent($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT s.course
-           FROM {$CFG->prefix}scorm s,
-                {$CFG->prefix}scorm_scoes ss
-           WHERE s.id = ss.scorm
-                 AND ss.id = $recordid";
-
-    if (!$scorm = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$scormscoes = get_record('scorm_scoes','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($scorm->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($scorm->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($scormscoes->parent, $fromenc);
-
-        $newscormscoes = new object;
-        $newscormscoes->id = $recordid;
-        $newscormscoes->parent = $result;
-        migrate2utf8_update_record('scorm_scoes',$newscormscoes);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-
-function migrate2utf8_scorm_scoes_identifier($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT s.course
-           FROM {$CFG->prefix}scorm s,
-                {$CFG->prefix}scorm_scoes ss
-           WHERE s.id = ss.scorm
-                 AND ss.id = $recordid";
-
-    if (!$scorm = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$scormscoes = get_record('scorm_scoes','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($scorm->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($scorm->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($scormscoes->identifier, $fromenc);
-
-        $newscormscoes = new object;
-        $newscormscoes->id = $recordid;
-        $newscormscoes->identifier = $result;
-        migrate2utf8_update_record('scorm_scoes',$newscormscoes);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_scorm_scoes_launch($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT s.course
-           FROM {$CFG->prefix}scorm s,
-                {$CFG->prefix}scorm_scoes ss
-           WHERE s.id = ss.scorm
-                 AND ss.id = $recordid";
-
-    if (!$scorm = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$scormscoes = get_record('scorm_scoes','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($scorm->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($scorm->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($scormscoes->launch, $fromenc);
-
-        $newscormscoes = new object;
-        $newscormscoes->id = $recordid;
-        $newscormscoes->launch = $result;
-        migrate2utf8_update_record('scorm_scoes',$newscormscoes);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_scorm_scoes_parameters($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT s.course
-           FROM {$CFG->prefix}scorm s,
-                {$CFG->prefix}scorm_scoes ss
-           WHERE s.id = ss.scorm
-                 AND ss.id = $recordid";
-
-    if (!$scorm = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$scormscoes = get_record('scorm_scoes','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($scorm->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($scorm->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($scormscoes->parameters, $fromenc);
-
-        $newscormscoes = new object;
-        $newscormscoes->id = $recordid;
-        $newscormscoes->parameters = $result;
-        migrate2utf8_update_record('scorm_scoes',$newscormscoes);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_scorm_scoes_scormtype($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT s.course
-           FROM {$CFG->prefix}scorm s,
-                {$CFG->prefix}scorm_scoes ss
-           WHERE s.id = ss.scorm
-                 AND ss.id = $recordid";
-
-    if (!$scorm = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$scormscoes = get_record('scorm_scoes','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($scorm->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($scorm->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($scormscoes->scormtype, $fromenc);
-
-        $newscormscoes = new object;
-        $newscormscoes->id = $recordid;
-        $newscormscoes->scormtype = $result;
-        migrate2utf8_update_record('scorm_scoes',$newscormscoes);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_scorm_scoes_title($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT s.course
-           FROM {$CFG->prefix}scorm s,
-                {$CFG->prefix}scorm_scoes ss
-           WHERE s.id = ss.scorm
-                 AND ss.id = $recordid";
-
-    if (!$scorm = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$scormscoes = get_record('scorm_scoes','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($scorm->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($scorm->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($scormscoes->title, $fromenc);
-
-        $newscormscoes = new object;
-        $newscormscoes->id = $recordid;
-        $newscormscoes->title = $result;
-        migrate2utf8_update_record('scorm_scoes',$newscormscoes);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_scorm_scoes_prerequisites($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT s.course
-           FROM {$CFG->prefix}scorm s,
-                {$CFG->prefix}scorm_scoes ss
-           WHERE s.id = ss.scorm
-                 AND ss.id = $recordid";
-
-    if (!$scorm = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$scormscoes = get_record('scorm_scoes','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($scorm->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($scorm->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($scormscoes->prerequisites, $fromenc);
-
-        $newscormscoes = new object;
-        $newscormscoes->id = $recordid;
-        $newscormscoes->prerequisites = $result;
-        migrate2utf8_update_record('scorm_scoes',$newscormscoes);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_scorm_scoes_maxtimeallowed($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT s.course
-           FROM {$CFG->prefix}scorm s,
-                {$CFG->prefix}scorm_scoes ss
-           WHERE s.id = ss.scorm
-                 AND ss.id = $recordid";
-
-    if (!$scorm = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$scormscoes = get_record('scorm_scoes','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($scorm->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($scorm->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($scormscoes->maxtimeallowed, $fromenc);
-
-        $newscormscoes = new object;
-        $newscormscoes->id = $recordid;
-        $newscormscoes->maxtimeallowed = $result;
-        migrate2utf8_update_record('scorm_scoes',$newscormscoes);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_scorm_scoes_timelimitaction($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT s.course
-           FROM {$CFG->prefix}scorm s,
-                {$CFG->prefix}scorm_scoes ss
-           WHERE s.id = ss.scorm
-                 AND ss.id = $recordid";
-
-    if (!$scorm = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$scormscoes = get_record('scorm_scoes','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($scorm->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($scorm->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($scormscoes->timelimitaction, $fromenc);
-
-        $newscormscoes = new object;
-        $newscormscoes->id = $recordid;
-        $newscormscoes->timelimitaction = $result;
-        migrate2utf8_update_record('scorm_scoes',$newscormscoes);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_scorm_scoes_datafromlms($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT s.course
-           FROM {$CFG->prefix}scorm s,
-                {$CFG->prefix}scorm_scoes ss
-           WHERE s.id = ss.scorm
-                 AND ss.id = $recordid";
-
-    if (!$scorm = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$scormscoes = get_record('scorm_scoes','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($scorm->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($scorm->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($scormscoes->datafromlms, $fromenc);
-
-        $newscormscoes = new object;
-        $newscormscoes->id = $recordid;
-        $newscormscoes->datafromlms = $result;
-        migrate2utf8_update_record('scorm_scoes',$newscormscoes);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_scorm_scoes_masteryscore($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT s.course
-           FROM {$CFG->prefix}scorm s,
-                {$CFG->prefix}scorm_scoes ss
-           WHERE s.id = ss.scorm
-                 AND ss.id = $recordid";
-
-    if (!$scorm = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$scormscoes = get_record('scorm_scoes','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($scorm->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($scorm->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($scormscoes->masteryscore, $fromenc);
-
-        $newscormscoes = new object;
-        $newscormscoes->id = $recordid;
-        $newscormscoes->masteryscore = $result;
-        migrate2utf8_update_record('scorm_scoes',$newscormscoes);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-
-function migrate2utf8_scorm_name($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$scorm = get_record('scorm','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($scorm->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($scorm->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($scorm->name, $fromenc);
-
-        $newscorm = new object;
-        $newscorm->id = $recordid;
-        $newscorm->name = $result;
-        migrate2utf8_update_record('scorm',$newscorm);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_scorm_reference($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$scorm = get_record('scorm','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($scorm->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($scorm->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($scorm->reference, $fromenc);
-
-        $newscorm = new object;
-        $newscorm->id = $recordid;
-        $newscorm->reference = $result;
-        migrate2utf8_update_record('scorm',$newscorm);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_scorm_summary($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$scorm = get_record('scorm','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($scorm->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($scorm->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($scorm->summary, $fromenc);
-
-        $newscorm = new object;
-        $newscorm->id = $recordid;
-        $newscorm->summary = $result;
-        migrate2utf8_update_record('scorm',$newscorm);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_scorm_options($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$scorm = get_record('scorm','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($scorm->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($scorm->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($scorm->options, $fromenc);
-
-        $newscorm = new object;
-        $newscorm->id = $recordid;
-        $newscorm->options = $result;
-        migrate2utf8_update_record('scorm',$newscorm);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-?>
diff --git a/mod/scorm/db/migrate2utf8.xml b/mod/scorm/db/migrate2utf8.xml
deleted file mode 100755 (executable)
index df5173a..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-<DBMIGRATION type="mod/scorm" VERSION="2005120100">
-  <TABLES>
-    <TABLE name="scorm_scoes_track">
-      <FIELDS>
-        <FIELD name="dummy" dropindex="element" />
-        <FIELD name="value" method="PLAIN_SQL_UPDATE" type="longtext" length="0">
-          <SQL_DETECT_USER>
-           SELECT sst.userid
-           FROM {$CFG->prefix}scorm_scoes_track sst
-           WHERE sst.id=RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT s.course
-           FROM {$CFG->prefix}scorm s,
-                {$CFG->prefix}scorm_scoes_track sst
-           WHERE s.id = sst.scormid
-                 AND sst.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-        <FIELD name="element" method="PLAIN_SQL_UPDATE" type="varchar" length="255" dropindex="track" addindex="track (userid, scormid, scoid, attempt, element(255))">
-          <SQL_DETECT_USER>
-           SELECT sst.userid
-           FROM {$CFG->prefix}scorm_scoes_track sst
-           WHERE sst.id=RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT s.course
-           FROM {$CFG->prefix}scorm s,
-                {$CFG->prefix}scorm_scoes_track sst
-           WHERE s.id = sst.scormid
-                 AND sst.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-        <FIELD name="dummy" addindex="element (element(255))" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="scorm_scoes">
-      <FIELDS>
-        <FIELD name="manifest" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-            migrate2utf8_scorm_scoes_manifest(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="organization" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-            migrate2utf8_scorm_scoes_organization(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="parent" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-            migrate2utf8_scorm_scoes_parent(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="identifier" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-            migrate2utf8_scorm_scoes_identifier(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="launch" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-            migrate2utf8_scorm_scoes_launch(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="parameters" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-            migrate2utf8_scorm_scoes_parameters(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="scormtype" method="PHP_FUNCTION" type="varchar" length="5">
-          <PHP_FUNCTION>
-            migrate2utf8_scorm_scoes_scormtype(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="title" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-            migrate2utf8_scorm_scoes_title(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="prerequisites" method="PHP_FUNCTION" type="varchar" length="200">
-          <PHP_FUNCTION>
-            migrate2utf8_scorm_scoes_prerequisites(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="maxtimeallowed" method="PHP_FUNCTION" type="varchar" length="19">
-          <PHP_FUNCTION>
-            migrate2utf8_scorm_scoes_maxtimeallowed(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="timelimitaction" method="PHP_FUNCTION" type="varchar" length="19">
-          <PHP_FUNCTION>
-            migrate2utf8_scorm_scoes_timelimitaction(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="datafromlms" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-            migrate2utf8_scorm_scoes_datafromlms(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="masteryscore" method="PHP_FUNCTION" type="varchar" length="200">
-          <PHP_FUNCTION>
-            migrate2utf8_scorm_scoes_masteryscore(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="scorm">
-      <FIELDS>
-        <FIELD name="name" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-            migrate2utf8_scorm_name(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="reference" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-            migrate2utf8_scorm_reference(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="version" method="NO_CONV" type="varchar" length="9" />
-        <FIELD name="summary" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_scorm_summary(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="options" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-            migrate2utf8_scorm_options(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-  </TABLES>
-</DBMIGRATION>
diff --git a/mod/survey/db/migrate2utf8.php b/mod/survey/db/migrate2utf8.php
deleted file mode 100755 (executable)
index 83d2e9e..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-<?php // $Id$
-
-function migrate2utf8_survey_name($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$survey = get_record('survey','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($survey->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($survey->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($survey->name, $fromenc);
-
-        $newsurvey = new object;
-        $newsurvey->id = $recordid;
-        $newsurvey->name = $result;
-        migrate2utf8_update_record('survey',$newsurvey);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_survey_intro($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$survey = get_record('survey','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($survey->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($survey->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($survey->intro, $fromenc);
-
-        $newsurvey = new object;
-        $newsurvey->id = $recordid;
-        $newsurvey->intro = $result;
-        migrate2utf8_update_record('survey',$newsurvey);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-?>
diff --git a/mod/survey/db/migrate2utf8.xml b/mod/survey/db/migrate2utf8.xml
deleted file mode 100755 (executable)
index eaf4824..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-<DBMIGRATION type="mod/survey" VERSION="2005120100">
-  <TABLES>
-    <TABLE name="survey_questions">
-        <FIELDS>
-            <FIELD name="text" method="NO_CONV" type="varchar" length="255" />
-            <FIELD name="shorttext" method="NO_CONV" type="varchar" length="30" />
-            <FIELD name="multi" method="NO_CONV" type="varchar" length="100" />
-            <FIELD name="intro" method="NO_CONV" type="varchar" length="50" />
-            <FIELD name="options" method="NO_CONV" type="text" length="0" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="survey_analysis">
-      <FIELDS>
-        <FIELD name="notes" method="PLAIN_SQL_UPDATE" type="text" length="0">
-          <SQL_DETECT_USER>
-           SELECT sa.userid
-           FROM {$CFG->prefix}survey_analysis sa
-           WHERE sa.id=RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT s.course
-           FROM {$CFG->prefix}survey s,
-                {$CFG->prefix}survey_analysis sa
-           WHERE s.id = sa.survey
-                 AND sa.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="survey_answers">
-      <FIELDS>
-        <FIELD name="answer1" method="PLAIN_SQL_UPDATE" type="text" length="0">
-          <SQL_DETECT_USER>
-           SELECT sa.userid
-           FROM {$CFG->prefix}survey_answers sa
-           WHERE sa.id=RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT s.course
-           FROM {$CFG->prefix}survey s,
-                {$CFG->prefix}survey_answers sa
-           WHERE s.id = sa.survey
-                 AND sa.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-        <FIELD name="answer2" method="PLAIN_SQL_UPDATE" type="text" length="0">
-          <SQL_DETECT_USER>
-           SELECT sa.userid
-           FROM {$CFG->prefix}survey_answers sa
-           WHERE sa.id=RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT s.course
-           FROM {$CFG->prefix}survey s,
-                {$CFG->prefix}survey_answers sa
-           WHERE s.id = sa.survey
-                 AND sa.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="survey">
-      <FIELDS>
-        <FIELD name="name" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-            migrate2utf8_survey_name(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="intro" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_survey_intro(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="questions" method="NO_CONV" type="varchar" length="255" />
-      </FIELDS>
-    </TABLE>
-  </TABLES>
-</DBMIGRATION>
index ca97800079ffd98bbfe29cbe01a9e217e834ea55..cf5fd689deb9dedf24120e77fc92cdf0b1d373e3 100644 (file)
@@ -217,8 +217,8 @@ function survey_get_responses($surveyid, $groupid) {
     global $CFG;
 
     if ($groupid) {
-        $groupsdb = ", {$CFG->prefix}groups_members gm";
-        $groupsql = "AND gm.groupid = $groupid AND u.id = gm.userid";
+        $groupsdb = ', '. groups_members_from_sql();
+        $groupsql = 'AND'.groups_members_where_sql($groupid, 'u.id');
     } else {
         $groupsdb = "";
         $groupsql = "";
diff --git a/mod/wiki/db/migrate2utf8.php b/mod/wiki/db/migrate2utf8.php
deleted file mode 100755 (executable)
index fbf143b..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-<?php // $Id$
-function migrate2utf8_wiki_name($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$wiki = get_record('wiki','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($wiki->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($wiki->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($wiki->name, $fromenc);
-
-        $newwiki = new object;
-        $newwiki->id = $recordid;
-        $newwiki->name = $result;
-        migrate2utf8_update_record('wiki',$newwiki);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_wiki_summary($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$wiki = get_record('wiki','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($wiki->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($wiki->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($wiki->summary, $fromenc);
-
-        $newwiki = new object;
-        $newwiki->id = $recordid;
-        $newwiki->summary = $result;
-        migrate2utf8_update_record('wiki',$newwiki);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_wiki_pagename($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$wiki = get_record('wiki','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($wiki->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($wiki->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($wiki->pagename, $fromenc);
-
-        $newwiki = new object;
-        $newwiki->id = $recordid;
-        $newwiki->pagename = $result;
-        migrate2utf8_update_record('wiki',$newwiki);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_wiki_initialcontent($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$wiki = get_record('wiki','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($wiki->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($wiki->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($wiki->initialcontent, $fromenc);
-
-        $newwiki = new object;
-        $newwiki->id = $recordid;
-        $newwiki->initialcontent = $result;
-        migrate2utf8_update_record('wiki',$newwiki);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-?>
diff --git a/mod/wiki/db/migrate2utf8.xml b/mod/wiki/db/migrate2utf8.xml
deleted file mode 100755 (executable)
index e9c5d5b..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-<DBMIGRATION type="mod/wiki" VERSION="2005120100">
-  <TABLES>
-    <TABLE name="wiki_entries">
-      <FIELDS>
-        <FIELD name="pagename" method="PLAIN_SQL_UPDATE" type="varchar" length="255" dropindex="pagename" addindex="pagename(pagename(255))">
-          <SQL_DETECT_USER>
-           SELECT we.userid
-           FROM {$CFG->prefix}wiki_entries we
-           WHERE we.id=RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT w.course
-           FROM {$CFG->prefix}wiki w,
-                {$CFG->prefix}wiki_entries we
-           WHERE w.id = we.wikiid
-                 AND we.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="wiki_pages">
-      <FIELDS>
-        <FIELD name="pagename" method="PLAIN_SQL_UPDATE" type="varchar" length="160" dropindex="wiki_pages_uk" addindex="wiki_pages_uk(pagename(160), version, wiki)">
-          <SQL_DETECT_USER>
-           SELECT wp.userid
-           FROM {$CFG->prefix}wiki_pages wp
-           WHERE wp.id=RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT w.course
-           FROM {$CFG->prefix}wiki w,
-                {$CFG->prefix}wiki_pages wp
-           WHERE w.id = wp.wiki
-                 AND wp.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-        <FIELD name="content" method="PLAIN_SQL_UPDATE" type="mediumtext" length="0">
-          <SQL_DETECT_USER>
-           SELECT wp.userid
-           FROM {$CFG->prefix}wiki_pages wp
-           WHERE wp.id=RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT w.course
-           FROM {$CFG->prefix}wiki w,
-                {$CFG->prefix}wiki_pages wp
-           WHERE w.id = wp.wiki
-                 AND wp.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-        <FIELD name="author" method="PLAIN_SQL_UPDATE" type="varchar" length="100" default="ewiki">
-          <SQL_DETECT_USER>
-           SELECT wp.userid
-           FROM {$CFG->prefix}wiki_pages wp
-           WHERE wp.id=RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT w.course
-           FROM {$CFG->prefix}wiki w,
-                {$CFG->prefix}wiki_pages wp
-           WHERE w.id = wp.wiki
-                 AND wp.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-        <FIELD name="refs" method="PLAIN_SQL_UPDATE" type="mediumtext" length="0">
-          <SQL_DETECT_USER>
-           SELECT wp.userid
-           FROM {$CFG->prefix}wiki_pages wp
-           WHERE wp.id=RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT w.course
-           FROM {$CFG->prefix}wiki w,
-                {$CFG->prefix}wiki_pages wp
-           WHERE w.id = wp.wiki
-                 AND wp.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-        <FIELD name="meta" method="NO_CONV" type="mediumtext" length="0" />
-      </FIELDS>
-    </TABLE>
-    <TABLE name="wiki">
-      <FIELDS>
-        <FIELD name="name" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-            migrate2utf8_wiki_name(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="summary" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_wiki_summary(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="pagename" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-            migrate2utf8_wiki_pagename(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="wtype" method="NO_CONV" type="enum('teacher', 'group', 'student')" length="0" default="group" />
-        <FIELD name="initialcontent" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-            migrate2utf8_wiki_initialcontent(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="wiki_locks">
-      <FIELDS>
-        <FIELD name="pagename" method="PLAIN_SQL_UPDATE" type="varchar" length="255">
-          <SQL_DETECT_USER>
-           SELECT wl.userid
-           FROM {$CFG->prefix}wiki_locks wl
-           WHERE wl.id=RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT w.course
-           FROM {$CFG->prefix}wiki w,
-                {$CFG->prefix}wiki_locks wl
-           WHERE w.id = wl.wikiid
-                 AND wl.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-      </FIELDS>
-    </TABLE>   
-  </TABLES>
-</DBMIGRATION>
index dcd0ec7ae319fae7f75c6637c3ce953a471da8f2..6f54b6562cc69fb9451409eb295816af4311b6c3 100644 (file)
@@ -417,7 +417,7 @@ function wiki_get_default_entry(&$wiki, &$course, $userid=0, $groupid=0) {
             $groupid=$mygroupids[0];
         } else {
             // Whatever groups are in the course, pick one
-            $coursegroups=get_records('groups','courseid',$course->id,'','id,name');
+            $coursegroups = get_groups($course->id);
             if(!$coursegroups || count($coursegroups)==0) {
                 error("Can't access wiki in group mode when no groups are configured for the course"); 
             } 
@@ -473,7 +473,7 @@ function wiki_get_entry(&$wiki, &$course, $userid=0, $groupid=0) {
                     $groupid=$mygroupids[0];
                 } else {
                     // Whatever groups are in the course, pick one
-                    $coursegroups=get_records('groups','courseid',$course->id,'','id,name');
+                    $coursegroups = get_groups($course->id);
                     if(!$coursegroups || count($coursegroups)==0) {
                         error("Can't access wiki in group mode when no groups are configured for the course"); 
                     } 
@@ -1072,8 +1072,7 @@ function wiki_get_owner(&$wiki_entry) {
         $owner = fullname($user);
     }
     else if ($wiki_entry->groupid > 0) {
-        $group = get_record('groups', 'id', $wiki_entry->groupid);
-        $owner = $group->name;
+        $owner = groups_get_group_name($wiki_entry->groupid); //TODO:check.
     }
     else if ($wiki_entry->course > 0) {
         $course = get_record('course', 'id', $wiki_entry->course);
diff --git a/mod/workshop/db/migrate2utf8.php b/mod/workshop/db/migrate2utf8.php
deleted file mode 100755 (executable)
index f99b56f..0000000
+++ /dev/null
@@ -1,315 +0,0 @@
-<?php // $Id$
-function migrate2utf8_workshop_stockcomments_comments($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT w.course
-           FROM {$CFG->prefix}workshop w,
-                {$CFG->prefix}workshop_stockcomments ws
-           WHERE w.id = ws.workshopid
-                 AND ws.id = $recordid";
-                 
-    if (!$workshop = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$workshopstockcomments = get_record('workshop_stockcomments','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($workshop->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($workshop->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($workshopstockcomments->comments, $fromenc);
-
-        $newworkshopstockcomments = new object;
-        $newworkshopstockcomments->id = $recordid;
-        $newworkshopstockcomments->comments = $result;
-        migrate2utf8_update_record('workshop_stockcomments',$newworkshopstockcomments);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_workshop_rubrics_description($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT w.course
-           FROM {$CFG->prefix}workshop w,
-                {$CFG->prefix}workshop_rubrics wr
-           WHERE w.id = wr.workshopid
-                 AND wr.id = $recordid";
-
-    if (!$workshop = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$workshoprubrics = get_record('workshop_rubrics','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($workshop->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($workshop->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($workshoprubrics->description, $fromenc);
-
-        $newworkshoprubrics = new object;
-        $newworkshoprubrics->id = $recordid;
-        $newworkshoprubrics->description = $result;
-        migrate2utf8_update_record('workshop_rubrics',$newworkshoprubrics);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_workshop_grades_feedback($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT w.course
-           FROM {$CFG->prefix}workshop w,
-                {$CFG->prefix}workshop_grades wg
-           WHERE w.id = wg.workshopid
-                 AND wg.id = $recordid";
-
-    if (!$workshop = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$workshopgrades = get_record('workshop_grades','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($workshop->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($workshop->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($workshopgrades->feedback, $fromenc);
-
-        $newworkshopgrades = new object;
-        $newworkshopgrades->id = $recordid;
-        $newworkshopgrades->feedback = $result;
-        migrate2utf8_update_record('workshop_grades',$newworkshopgrades);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_workshop_elements_description($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    $SQL = "SELECT w.course
-           FROM {$CFG->prefix}workshop w,
-                {$CFG->prefix}workshop_elements we
-           WHERE w.id = we.workshopid
-                 AND we.id = $recordid";
-
-    if (!$workshop = get_record_sql($SQL)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$workshopelements = get_record('workshop_elements','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($workshop->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($workshop->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($workshopelements->description, $fromenc);
-
-        $newworkshopelements = new object;
-        $newworkshopelements->id = $recordid;
-        $newworkshopelements->description = $result;
-        migrate2utf8_update_record('workshop_elements',$newworkshopelements);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_workshop_name($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$workshop = get_record('workshop','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($workshop->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($workshop->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($workshop->name, $fromenc);
-
-        $newworkshop = new object;
-        $newworkshop->id = $recordid;
-        $newworkshop->name = $result;
-        migrate2utf8_update_record('workshop',$newworkshop);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_workshop_description($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$workshop = get_record('workshop','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($workshop->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($workshop->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($workshop->description, $fromenc);
-
-        $newworkshop = new object;
-        $newworkshop->id = $recordid;
-        $newworkshop->description = $result;
-        migrate2utf8_update_record('workshop',$newworkshop);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-
-function migrate2utf8_workshop_password($recordid){
-    global $CFG, $globallang;
-
-/// Some trivial checks
-    if (empty($recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-
-    if (!$workshop = get_record('workshop','id',$recordid)) {
-        log_the_problem_somewhere();
-        return false;
-    }
-    if ($globallang) {
-        $fromenc = $globallang;
-    } else {
-        $sitelang   = $CFG->lang;
-        $courselang = get_course_lang($workshop->course);  //Non existing!
-        $userlang   = get_main_teacher_lang($workshop->course); //N.E.!!
-
-        $fromenc = get_original_encoding($sitelang, $courselang, $userlang);
-    }
-
-/// We are going to use textlib facilities
-    
-/// Convert the text
-    if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
-        $result = utfconvert($workshop->password, $fromenc);
-
-        $newworkshop = new object;
-        $newworkshop->id = $recordid;
-        $newworkshop->password = $result;
-        migrate2utf8_update_record('workshop',$newworkshop);
-    }
-/// And finally, just return the converted field
-    return $result;
-}
-?>
diff --git a/mod/workshop/db/migrate2utf8.xml b/mod/workshop/db/migrate2utf8.xml
deleted file mode 100755 (executable)
index aa91efe..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-<DBMIGRATION type="mod/workshop" VERSION="2005120100">
-  <TABLES>
-    <TABLE name="workshop_submissions">
-      <FIELDS>
-        <FIELD name="title" method="PLAIN_SQL_UPDATE" type="varchar" length="100">
-          <SQL_DETECT_USER>
-           SELECT ws.userid
-           FROM {$CFG->prefix}workshop_submissions ws
-           WHERE ws.id=RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT w.course
-           FROM {$CFG->prefix}workshop w,
-                {$CFG->prefix}workshop_submissions ws
-           WHERE w.id = ws.workshopid
-                 AND ws.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-        <FIELD name="description" method="PLAIN_SQL_UPDATE" type="text" length="0">
-          <SQL_DETECT_USER>
-           SELECT ws.userid
-           FROM {$CFG->prefix}workshop_submissions ws
-           WHERE ws.id=RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT w.course
-           FROM {$CFG->prefix}workshop w,
-                {$CFG->prefix}workshop_submissions ws
-           WHERE w.id = ws.workshopid
-                 AND ws.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="workshop_stockcomments">
-      <FIELDS>
-        <FIELD name="comments" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_workshop_stockcomments_comments(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="workshop_rubrics">
-      <FIELDS>
-        <FIELD name="description" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_workshop_rubrics_description(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="workshop_grades">
-      <FIELDS>
-        <FIELD name="feedback" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_workshop_grades_feedback(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="workshop_elements">
-      <FIELDS>
-        <FIELD name="description" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_workshop_elements_description(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="workshop_comments">
-      <FIELDS>
-        <FIELD name="comments" method="PLAIN_SQL_UPDATE" type="text" length="0">
-          <SQL_DETECT_USER>
-           SELECT wc.userid
-           FROM {$CFG->prefix}workshop_comments wc
-           WHERE wc.id=RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT w.course
-           FROM {$CFG->prefix}workshop w,
-                {$CFG->prefix}workshop_comments wc
-           WHERE w.id = wc.workshopid
-                 AND wc.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="workshop_assessments">
-      <FIELDS>
-        <FIELD name="generalcomment" method="PLAIN_SQL_UPDATE" type="text" length="0">
-          <SQL_DETECT_USER>
-           SELECT wa.userid
-           FROM {$CFG->prefix}workshop_assessments wa
-           WHERE wa.id=RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT w.course
-           FROM {$CFG->prefix}workshop w,
-                {$CFG->prefix}workshop_assessments wa
-           WHERE w.id = wa.workshopid
-                 AND wa.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-        <FIELD name="teachercomment" method="PLAIN_SQL_UPDATE" type="text" length="0">
-          <SQL_DETECT_USER>
-           SELECT wa.userid
-           FROM {$CFG->prefix}workshop_assessments wa
-           WHERE wa.id=RECORDID
-          </SQL_DETECT_USER>
-          <SQL_DETECT_COURSE>
-           SELECT w.course
-           FROM {$CFG->prefix}workshop w,
-                {$CFG->prefix}workshop_assessments wa
-           WHERE w.id = wa.workshopid
-                 AND wa.id = RECORDID
-          </SQL_DETECT_COURSE>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-    <TABLE name="workshop">
-      <FIELDS>
-        <FIELD name="name" method="PHP_FUNCTION" type="varchar" length="255">
-          <PHP_FUNCTION>
-            migrate2utf8_workshop_name(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="description" method="PHP_FUNCTION" type="text" length="0">
-          <PHP_FUNCTION>
-            migrate2utf8_workshop_description(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-        <FIELD name="password" method="PHP_FUNCTION" type="varchar" length="32">
-          <PHP_FUNCTION>
-            migrate2utf8_workshop_password(RECORDID)
-          </PHP_FUNCTION>
-        </FIELD>
-      </FIELDS>
-    </TABLE>
-  </TABLES>
-</DBMIGRATION>
index 325ed45440e8100553bcf84a65f162636db6086f..f37eccdf41e8d6b2d75977bdafe7cc828a720592 100644 (file)
     }
 
     if ($groupmode == VISIBLEGROUPS or ($groupmode and has_capability('moodle/site:accessallgroups', get_context_instance(CONTEXT_COURSE, $course->id)))) {
-        if ($groups = get_records_menu("groups", "courseid", $course->id, "name ASC", "id,name")) {
+        if ($groups_names = groups_get_groups_names($course->id)) { //TODO:
             echo '<td class="left">';
-            print_group_menu($groups, $groupmode, $currentgroup, $baseurl);
+            print_group_menu($groups_names, $groupmode, $currentgroup, $baseurl);
             echo '</td>';
         }
     }
     echo '</td></tr></table>';
 
     if ($currentgroup and (!$isseparategroups or has_capability('moodle/site:accessallgroups', get_context_instance(CONTEXT_COURSE, $course->id)))) {    /// Display info about the group
-        if ($group = get_record('groups', 'id', $currentgroup)) {
+        if ($group = groups_get_group($currentgroup)) { //TODO:
             if (!empty($group->description) or (!empty($group->picture) and empty($group->hidepicture))) {
                 echo '<table class="groupinfobox"><tr><td class="left side picture">';
                 print_group_picture($group, $course->id, true, false, false);
                 echo '</td><td class="content">';
                 echo '<h3>'.$group->name;
                 if (has_capability('moodle/course:managegroups', get_context_instance(CONTEXT_COURSE, $course->id))) {
-                    echo '&nbsp;<a title="'.get_string('editgroupprofile').'" href="../course/groups.php?id='.$course->id.'&amp;group='.$group->id.'">';
-                    echo '<img src="'.$CFG->pixpath.'/t/edit.gif" alt="'.get_string('editgroupprofile').'" border="0">';
+                    echo '&nbsp;<a title="'.get_string('editgroupprofile').'" href="'.groups_group_edit_url($course->id, $group->id).'">';
+                    echo '<img src="'.$CFG->pixpath.'/t/edit.gif" alt="'.get_string('editgroupprofile').'" />';
                     echo '</a>';
                 }
                 echo '</h3>';
index 5aef17547c71e0aad009617b6890835ce34e4432..3afac25fdc4df8ca8423b7e15310d36bade5e91d 100644 (file)
@@ -64,8 +64,8 @@
      **************************************/
     } else if ($filtertype == 'group' && $filterselect) {
 
-        $group = get_record('groups','id',$filterselect);
-        print_heading($group->name);
+        $group_name = groups_get_group_name($filterselect); //TODO:
+        print_heading($group_name);
 
         if ($CFG->bloglevel >= 2) {
 
index 8d962eb3c9d4cf3fac2067b9d96b651e6e1fd89c..3c490bce7eafd26ca329416650cea29ba2a753dd 100644 (file)
             require_login();
     
             ///this is changed because of mygroupid
-            $gtrue = false;
+            $gtrue = (bool)groups_get_groups_for_user($user->id, $course->id);
+            /*TODO: $gtrue = false;
             if ($mygroups = mygroupid($course->id)){
                 foreach ($mygroups as $group){
                     if (ismember($group, $user->id)){
                         $gtrue = true;
                     }
                 }
-            }
+            }*/
             if (!$gtrue) {
                 print_header("$strpersonalprofile: ", "$strpersonalprofile: ",
                              "<a href=\"../course/view.php?id=$course->id\">$course->shortname</a> ->