diff --git a/admin/auth.php b/admin/auth.php index 42a757323b2..9f5ab727c20 100644 --- a/admin/auth.php +++ b/admin/auth.php @@ -26,7 +26,7 @@ // extract and sanitize the auth key explicitly $modules = get_list_of_plugins("auth"); if (in_array($config['auth'], $modules)) { - $auth = $config['auth']; + $auth = $config['auth']; } else { notify("Error defining the authentication method"); } @@ -44,10 +44,10 @@ if (preg_match('/^pluginconfig_(.+?)$/', $name, $matches)) { $plugin = "auth/$auth"; $name = $matches[1]; - if (! set_config($name, $value, $plugin)) { + if (! set_config($name, $value, $plugin)) { notify("Problem saving config $name as $value for plugin $plugin"); } - } else { // normal handling for + } else { // normal handling for if (! set_config($name, $value)) { notify("Problem saving config $name as $value"); } @@ -128,7 +128,7 @@ echo "
diff --git a/admin/roles/override.php b/admin/roles/override.php index ec1227309d1..9f7e097a1fc 100755 --- a/admin/roles/override.php +++ b/admin/roles/override.php @@ -1,18 +1,18 @@ id) { error ('can not override base role capabilities'); @@ -34,34 +34,34 @@ $context = get_record('context', 'id', $contextid); $overridableroles = get_overridable_roles($context); - + /// Make sure this user can override that role if ($roleid) { if (!user_can_override($context, $roleid)) { error ('you can not override this role in this context'); - } + } } - + if ($userid) { $user = get_record('user', 'id', $userid); $fullname = fullname($user, has_capability('moodle/site:viewfullnames', $context)); } - + /// Print the header and tabs if ($context->aggregatelevel == CONTEXT_USER) { - + /// course header if ($course->id != SITEID) { print_header("$fullname", "$fullname", "id\">$course->shortname -> wwwroot."/user/index.php?id=$course->id\">$strparticipants -> wwwroot."/user/view.php?id=".$userid."&course=".$course->id."\">$fullname -> $straction", - "", "", true, " ", navmenu($course)); - - /// site header + "", "", true, " ", navmenu($course)); + + /// site header } else { print_header("$course->fullname: $fullname", "$course->fullname", - "wwwroot."/user/view.php?id=".$userid."&course=".$course->id."\">$fullname -> $straction", "", "", true, " ", navmenu($course)); + "wwwroot."/user/view.php?id=".$userid."&course=".$course->id."\">$fullname -> $straction", "", "", true, " ", navmenu($course)); } $showroles = 1; $currenttab = 'override'; @@ -76,18 +76,18 @@ /// Process incoming role override if ($data = data_submitted()) { - $localoverrides = get_records_select('role_capabilities', "roleid = $roleid AND contextid = $context->id", + $localoverrides = get_records_select('role_capabilities', "roleid = $roleid AND contextid = $context->id", '', 'capability, permission, id'); foreach ($data as $capname => $value) { if ($capname == 'contextid' || $capname == 'roleid') { // ignore contextid and roleid - continue; + continue; } - + if (isset($localoverrides[$capname])) { // Something exists, so update it - + if ($value == CAP_INHERIT) { // inherit = delete - delete_records('role_capabilities', 'roleid', $roleid, 'contextid', $contextid, + delete_records('role_capabilities', 'roleid', $roleid, 'contextid', $contextid, 'capability', $capname); } else { $localoverride = new object; @@ -95,14 +95,14 @@ $localoverride->permission = $value; $localoverride->timemodified = time(); $localoverride->modifierid = $USER->id; - + if (!update_record('role_capabilities', $localoverride)) { debugging('Could not update a capability!'); } } - + } else { // insert a record - + if ($value != CAP_INHERIT) { // Ignore inherits $override->capability = $capname; $override->contextid = $contextid; @@ -140,12 +140,12 @@ } else { $parentcontext = $context; // site level in override?? } - + $r_caps = role_context_capabilities($roleid, $parentcontext); - $localoverrides = get_records_select('role_capabilities', "roleid = $roleid AND contextid = $context->id", + $localoverrides = get_records_select('role_capabilities', "roleid = $roleid AND contextid = $context->id", '', 'capability, permission, id'); - + // Get the capabilities overrideable in this context if ($capabilities = fetch_context_capabilities($context)) { print_simple_box_start("center"); @@ -159,7 +159,7 @@ } else { // Print overview table $userparam = (!empty($userid)) ? '&userid='.$userid : ''; - + $table->tablealign = 'center'; $table->cellpadding = 5; $table->cellspacing = 0; @@ -167,16 +167,16 @@ $table->head = array(get_string('roles', 'role'), get_string('overrides', 'role')); $table->wrap = array('nowrap', 'nowrap'); $table->align = array('right', 'center'); - + foreach ($overridableroles as $roleid => $rolename) { $countusers = 0; $overridecount = count_records_select('role_capabilities', "roleid = $roleid AND contextid = $context->id"); $table->data[] = array(''.$rolename.'', $overridecount); } - + print_table($table); } - + print_footer($course); - + ?> diff --git a/admin/roles/tabs.php b/admin/roles/tabs.php index efb5432f72d..b74a598f001 100755 --- a/admin/roles/tabs.php +++ b/admin/roles/tabs.php @@ -71,7 +71,7 @@ if ($currenttab != 'update') { $blockname = print_context_name($context); $navigation = $blockname. ' -> '.$straction; - switch ($blockinstance->pagetype) { + switch ($blockinstance->pagetype) { case 'course-view': if ($course = get_record('course', 'id', $blockinstance->pageid)) { if ($course->id != SITEID) { @@ -111,45 +111,45 @@ if ($context->aggregatelevel != CONTEXT_SYSTEM) { // Print tabs for anything $toprow[] = new tabobject('update', $CFG->wwwroot.'/course/mod.php?update='. $context->instanceid.'&return=true&sesskey='.sesskey(), get_string('update')); - } + } $toprow[] = new tabobject('roles', $CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='. - $context->id, get_string('roles')); + $context->id, get_string('roles')); if (isset($tabsmode)) { if (!isset($assignableroles)) { - $assignableroles = get_assignable_roles($context); + $assignableroles = get_assignable_roles($context); } if (!isset($overridableroles)) { - $overridableroles = get_overridable_roles($context); + $overridableroles = get_overridable_roles($context); } $inactive[] = 'roles'; if (!empty($assignableroles)) { - $secondrow[] = new tabobject('assign', - $CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$context->id, - get_string('assignroles', 'role'), - get_string('showallroles', 'role'), - true); + $secondrow[] = new tabobject('assign', + $CFG->wwwroot.'/'.$CFG->admin.'/roles/assign.php?contextid='.$context->id, + get_string('assignroles', 'role'), + get_string('showallroles', 'role'), + true); } - if (!empty($overridableroles)) { - $secondrow[] = new tabobject('override', + if (!empty($overridableroles)) { + $secondrow[] = new tabobject('override', $CFG->wwwroot.'/'.$CFG->admin.'/roles/override.php?contextid='.$context->id, - get_string('overrideroles', 'role'), - get_string('showallroles', 'role'), - true); + get_string('overrideroles', 'role'), + get_string('showallroles', 'role'), + true); } if ($tabsmode == 'override') { - $currenttab = 'override'; + $currenttab = 'override'; } elseif ($tabsmode == 'assign') { - $currenttab = 'assign'; + $currenttab = 'assign'; } } else { - $inactive[] = ''; + $inactive[] = ''; } if (!empty($secondrow)) { diff --git a/admin/settings.php b/admin/settings.php index dd9e8909b83..9d9098c25c2 100644 --- a/admin/settings.php +++ b/admin/settings.php @@ -7,7 +7,7 @@ require_once($CFG->dirroot.'/'.$CFG->admin.'/pagelib.php'); if ($site = get_site()) { require_login(); -} +} page_map_class(PAGE_ADMIN, 'page_admin'); @@ -20,7 +20,7 @@ $PAGE->init_extra($section); // hack alert! $adminediting = optional_param('adminedit', -1, PARAM_BOOL); $return = optional_param('return','', PARAM_ALPHA); - + if (!isset($USER->adminediting)) { $USER->adminediting = false; } @@ -85,11 +85,11 @@ if ($data = data_submitted()) { if (!empty($SITE->fullname)) { $pageblocks = blocks_setup($PAGE); - $preferred_width_left = bounded_number(BLOCK_L_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), + $preferred_width_left = bounded_number(BLOCK_L_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), BLOCK_L_MAX_WIDTH); - $preferred_width_right = bounded_number(BLOCK_R_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), + $preferred_width_right = bounded_number(BLOCK_R_MIN_WIDTH, blocks_preferred_width($pageblocks[BLOCK_POS_RIGHT]), BLOCK_R_MAX_WIDTH); - + // print header stuff $PAGE->print_header(); diff --git a/admin/settings/appearance.php b/admin/settings/appearance.php index fd2a4fdf96d..d7af1530ff0 100644 --- a/admin/settings/appearance.php +++ b/admin/settings/appearance.php @@ -22,10 +22,10 @@ $temp->add(new admin_setting_sitesettext('shortname', get_string('shortsitename' $temp->add(new admin_setting_special_frontpagedesc()); $temp->add(new admin_setting_courselist_frontpage(false)); // non-loggedin version of the setting (that's what the parameter is for :) ) $temp->add(new admin_setting_courselist_frontpage(true)); // loggedin version of the setting -$temp->add(new admin_setting_sitesetcheckbox('numsections', get_string('sitesection'), +$temp->add(new admin_setting_sitesetcheckbox('numsections', get_string('sitesection'), get_string('sitesectionhelp','admin'), 1)); -$temp->add(new admin_setting_sitesetselect('newsitems', get_string('newsitemsnumber'), - '', 3, +$temp->add(new admin_setting_sitesetselect('newsitems', get_string('newsitemsnumber'), + '', 3, array('0' => '0', '1' => '1', '2' => '2', diff --git a/admin/settings/security.php b/admin/settings/security.php index b416a6bacc5..94cb38e2e84 100644 --- a/admin/settings/security.php +++ b/admin/settings/security.php @@ -12,14 +12,14 @@ $temp->add(new admin_setting_configtext('maxbytes', get_string('maxbytes', 'admi $temp->add(new admin_setting_configcheckbox('messaging', get_string('messaging', 'admin'), get_string('configmessaging','admin'), 1)); $temp->add(new admin_setting_configcheckbox('allowobjectembed', get_string('allowobjectembed', 'admin'), get_string('configallowobjectembed', 'admin'), 0)); $temp->add(new admin_setting_configcheckbox('enabletrusttext', get_string('enabletrusttext', 'admin'), get_string('configenabletrusttext', 'admin'), 0)); -$temp->add(new admin_setting_configselect('maxeditingtime', get_string('maxeditingtime','admin'), get_string('configmaxeditingtime','admin'), 1800, +$temp->add(new admin_setting_configselect('maxeditingtime', get_string('maxeditingtime','admin'), get_string('configmaxeditingtime','admin'), 1800, array(60 => get_string('numminutes', '', 1), 300 => get_string('numminutes', '', 5), 900 => get_string('numminutes', '', 15), 1800 => get_string('numminutes', '', 30), 2700 => get_string('numminutes', '', 45), 3600 => get_string('numminutes', '', 60)))); -$temp->add(new admin_setting_configselect('fullnamedisplay', get_string('fullnamedisplay', 'admin'), get_string('configfullnamedisplay', 'admin'), +$temp->add(new admin_setting_configselect('fullnamedisplay', get_string('fullnamedisplay', 'admin'), get_string('configfullnamedisplay', 'admin'), 'firstname lastname', array('language' => get_string('language'), 'firstname lastname' => get_string('firstname') . ' + ' . get_string('lastname'), 'lastname firstname' => get_string('lastname') . ' + ' . get_string('firstname'), @@ -50,7 +50,7 @@ $temp = new admin_settingpage('modulesecurity', get_string('modulesecurity', 'ad $temp->add(new admin_setting_configselect('restrictmodulesfor', get_string('restrictmodulesfor', 'admin'), get_string('configrestrictmodulesfor', 'admin'), 'none', array('none' => 'No courses', 'all' => 'All courses', 'requested' => 'Requested courses'))); -$temp->add(new admin_setting_configcheckbox('restrictbydefault', get_string('restrictbydefault', 'admin'), get_string('configrestrictbydefault', 'admin'), 0)); +$temp->add(new admin_setting_configcheckbox('restrictbydefault', get_string('restrictbydefault', 'admin'), get_string('configrestrictbydefault', 'admin'), 0)); if (!$options = get_records("modules")) { $options = array(); } diff --git a/admin/settings/server.php b/admin/settings/server.php index 2553cc6fa80..2ec29cd4ab9 100644 --- a/admin/settings/server.php +++ b/admin/settings/server.php @@ -4,8 +4,8 @@ // "systempaths" settingpage $temp = new admin_settingpage('systempaths', get_string('systempaths','admin')); -$temp->add(new admin_setting_configselect('gdversion', get_string('gdversion','admin'), get_string('configgdversion', 'admin'), check_gd_version(), array('0' => get_string('gdnot'), - '1' => get_string('gd1'), +$temp->add(new admin_setting_configselect('gdversion', get_string('gdversion','admin'), get_string('configgdversion', 'admin'), check_gd_version(), array('0' => get_string('gdnot'), + '1' => get_string('gd1'), '2' => get_string('gd2')))); $temp->add(new admin_setting_configtext('zip', get_string('pathtozip','admin'), get_string('configzip', 'admin'), '', PARAM_PATH)); $temp->add(new admin_setting_configtext('unzip', get_string('pathtounzip','admin'), get_string('configunzip', 'admin'), '', PARAM_PATH)); @@ -23,29 +23,29 @@ $temp->add(new admin_setting_configtext('smtppass', get_string('smtppass', 'admi $temp->add(new admin_setting_configtext('noreplyaddress', get_string('noreplyaddress', 'admin'), get_string('confignoreplyaddress', 'admin'), 'noreply@' . $_SERVER['HTTP_HOST'], PARAM_NOTAGS)); $temp->add(new admin_setting_configtext('allowemailaddresses', get_string('allowemailaddresses', 'admin'), get_string('configallowemailaddresses', 'admin'), '', PARAM_NOTAGS)); $temp->add(new admin_setting_configtext('denyemailaddresses', get_string('denyemailaddresses', 'admin'), get_string('configdenyemailaddresses', 'admin'), '', PARAM_NOTAGS)); -$temp->add(new admin_setting_configselect('digestmailtime', get_string('digestmailtime', 'admin'), get_string('configdigestmailtime', 'admin'), 17, array('00' => '00', - '01' => '01', - '02' => '02', - '03' => '03', - '04' => '04', - '05' => '05', - '06' => '06', - '07' => '07', - '08' => '08', - '09' => '09', - '10' => '10', - '11' => '11', - '12' => '12', - '13' => '13', - '14' => '14', - '15' => '15', - '16' => '16', - '17' => '17', - '18' => '18', - '19' => '19', - '20' => '20', - '21' => '21', - '22' => '22', +$temp->add(new admin_setting_configselect('digestmailtime', get_string('digestmailtime', 'admin'), get_string('configdigestmailtime', 'admin'), 17, array('00' => '00', + '01' => '01', + '02' => '02', + '03' => '03', + '04' => '04', + '05' => '05', + '06' => '06', + '07' => '07', + '08' => '08', + '09' => '09', + '10' => '10', + '11' => '11', + '12' => '12', + '13' => '13', + '14' => '14', + '15' => '15', + '16' => '16', + '17' => '17', + '18' => '18', + '19' => '19', + '20' => '20', + '21' => '21', + '22' => '22', '23' => '23'))); if (!empty($CFG->unicodedb)) { // These options are only available if running under unicodedb unset($options); @@ -88,7 +88,7 @@ $ADMIN->add('server', $temp); $temp = new admin_settingpage('debugging', get_string('debugging', 'admin')); $temp->add(new admin_setting_special_debug()); $temp->add(new admin_setting_special_perfdebug()); -$ADMIN->add('server', $temp); +$ADMIN->add('server', $temp); // "stats" settingpage @@ -116,7 +116,7 @@ $temp->add(new admin_setting_configselect('statsmaxruntime', get_string('statsma 60*60*8 => '8 '.get_string('hours') ))); $temp->add(new admin_setting_configtime('statsruntimestarthour', 'statsruntimestartminute', get_string('statsruntimestart', 'admin'), get_string('configstatsruntimestart', 'admin'), array('h' => 0, 'm' => 0))); $temp->add(new admin_setting_configtext('statsuserthreshold', get_string('statsuserthreshold', 'admin'), get_string('configstatsuserthreshold', 'admin'), 0, PARAM_INT)); -$ADMIN->add('server', $temp); +$ADMIN->add('server', $temp); // "http" settingpage @@ -125,7 +125,7 @@ $temp->add(new admin_setting_configtext('framename', get_string('framename', 'ad $temp->add(new admin_Setting_configcheckbox('slasharguments', get_string('slasharguments', 'admin'), get_string('configslasharguments', 'admin'), 1)); $temp->add(new admin_setting_configtext('proxyhost', get_string('proxyhost', 'admin'), get_string('configproxyhost', 'admin'), '', PARAM_HOST)); $temp->add(new admin_setting_configtext('proxyport', get_string('proxyport', 'admin'), get_string('configproxyport', 'admin'), '', PARAM_INT)); -$ADMIN->add('server', $temp); +$ADMIN->add('server', $temp); $ADMIN->add('server', new admin_externalpage('sitefiles', get_string('sitefiles'), $CFG->wwwroot . '/files/index.php?id=' . SITEID)); diff --git a/admin/settings/users.php b/admin/settings/users.php index 0c50cced7e6..9d26d09faeb 100644 --- a/admin/settings/users.php +++ b/admin/settings/users.php @@ -33,17 +33,17 @@ if ($studentroles = get_roles_with_capability('moodle/legacy:student', CAP_ALLOW } $assignableroles = get_assignable_roles($context); -$temp->add(new admin_setting_configselect('notloggedinroleid', get_string('notloggedinroleid', 'admin'), +$temp->add(new admin_setting_configselect('notloggedinroleid', get_string('notloggedinroleid', 'admin'), get_string('confignotloggedinroleid', 'admin'), $guestrole->id, $assignableroles )); -$temp->add(new admin_setting_configselect('defaultuserroleid', get_string('defaultuserroleid', 'admin'), +$temp->add(new admin_setting_configselect('defaultuserroleid', get_string('defaultuserroleid', 'admin'), get_string('configdefaultuserroleid', 'admin'), $guestrole->id, $assignableroles)); -$temp->add(new admin_setting_configselect('defaultcourseroleid', get_string('defaultcourseroleid', 'admin'), +$temp->add(new admin_setting_configselect('defaultcourseroleid', get_string('defaultcourseroleid', 'admin'), get_string('configdefaultcourseroleid', 'admin'), $studentrole->id, $assignableroles)); //$temp->add(new admin_setting_configcheckbox('autologinguests', get_string('autologinguests', 'admin'), get_string('configautologinguests', 'admin'), 0)); //$temp->add(new admin_setting_configcheckbox('allusersaresitestudents', get_string('allusersaresitestudents', 'admin'), get_string('configallusersaresitestudents','admin'), 1)); -$temp->add(new admin_setting_configmultiselect('hiddenuserfields', get_string('hiddenuserfields', 'admin'), - get_string('confighiddenuserfields', 'admin'), array(), +$temp->add(new admin_setting_configmultiselect('hiddenuserfields', get_string('hiddenuserfields', 'admin'), + get_string('confighiddenuserfields', 'admin'), array(), array('none' => get_string('none'), 'description' => get_string('description'), 'city' => get_string('city'), diff --git a/admin/upgradesettings.php b/admin/upgradesettings.php index 8a7e05d80ed..b561f20b74f 100644 --- a/admin/upgradesettings.php +++ b/admin/upgradesettings.php @@ -1,6 +1,6 @@ wwwroot . '/' . $CFG->admin . '/index.php'); + redirect($CFG->wwwroot . '/' . $CFG->admin . '/index.php'); die; } @@ -74,7 +74,7 @@ admin_externalpage_print_footer($adminroot); /** * Find settings that have not been initialized (e.g. during initial install or an upgrade). - * + * * Tests each setting's get_setting() method. If the result is NULL, we consider the setting * to be uninitialized. * @@ -90,9 +90,9 @@ function find_new_settings(&$node) { $return = array_merge($return, find_new_settings($node->children[$entry])); } return $return; - } + } - if (is_a($node, 'admin_settingpage')) { + if (is_a($node, 'admin_settingpage')) { $return = array(); foreach ($node->settings as $setting) { if ($setting->get_setting() === NULL) { @@ -117,9 +117,9 @@ function output_new_settings_by_page(&$node) { $return .= output_new_settings_by_page($node->children[$entry]); } return $return; - } + } - if (is_a($node, 'admin_settingpage')) { + if (is_a($node, 'admin_settingpage')) { $newsettings = array(); foreach ($node->settings as $setting) { if ($setting->get_setting() === NULL) { @@ -133,7 +133,7 @@ function output_new_settings_by_page(&$node) { $return = '' .implode(', ', $errors) . '
' . $tempfield->readableInfo(), @@ -309,8 +309,8 @@ class edit_field_save extends XMLDBAction { $next->setChanged(true); } } - - /// Set comment + + /// Set comment $field->setComment($comment); /// Set the rest of fields @@ -323,7 +323,7 @@ class edit_field_save extends XMLDBAction { $field->setEnum($enum); $field->setEnumValues($enumvalues); $field->setDefault($default); - + /// If the hash has changed from the old one, change the version /// and mark the structure as changed $field->calculateHash(true); @@ -338,7 +338,7 @@ class edit_field_save extends XMLDBAction { } /// Launch postaction if exists (leave this here!) - if ($this->getPostAction() && $result) { + if ($this->getPostAction() && $result) { return $this->launch($this->getPostAction()); } } diff --git a/admin/xmldb/actions/edit_index/edit_index.class.php b/admin/xmldb/actions/edit_index/edit_index.class.php index f73dd88426b..5e7a5e7f715 100644 --- a/admin/xmldb/actions/edit_index/edit_index.class.php +++ b/admin/xmldb/actions/edit_index/edit_index.class.php @@ -28,7 +28,7 @@ class edit_index extends XMLDBAction { - /** + /** * Init method, every subclass will have its own */ function init() { @@ -148,7 +148,7 @@ class edit_index extends XMLDBAction { $this->output = $o; /// Launch postaction if exists (leave this here!) - if ($this->getPostAction() && $result) { + if ($this->getPostAction() && $result) { return $this->launch($this->getPostAction()); } diff --git a/admin/xmldb/actions/edit_index_save/edit_index_save.class.php b/admin/xmldb/actions/edit_index_save/edit_index_save.class.php index 0ec2ebd11e4..8fd2e3b5dc3 100644 --- a/admin/xmldb/actions/edit_index_save/edit_index_save.class.php +++ b/admin/xmldb/actions/edit_index_save/edit_index_save.class.php @@ -28,7 +28,7 @@ class edit_index_save extends XMLDBAction { - /** + /** * Init method, every subclass will have its own */ function init() { @@ -164,8 +164,8 @@ class edit_index_save extends XMLDBAction { $tempindex->setFields($fieldsarr); /// Prepare the output $site = get_site(); - print_header("$site->shortname: XMLDB", - "$site->fullname", + print_header("$site->shortname: XMLDB", + "$site->fullname", "" . $this->str['administration'] . " -> XMLDB"); notice ('
' .implode(', ', $errors) . '
' . $tempindex->readableInfo(), @@ -190,14 +190,14 @@ class edit_index_save extends XMLDBAction { $next->setChanged(true); } } - - /// Set comment + + /// Set comment $index->setComment($comment); /// Set the rest of fields $index->setUnique($unique); $index->setFields($fieldsarr); - + /// If the hash has changed from the old one, change the version /// and mark the structure as changed $index->calculateHash(true); @@ -212,7 +212,7 @@ class edit_index_save extends XMLDBAction { } /// Launch postaction if exists (leave this here!) - if ($this->getPostAction() && $result) { + if ($this->getPostAction() && $result) { return $this->launch($this->getPostAction()); } } diff --git a/admin/xmldb/actions/edit_key/edit_key.class.php b/admin/xmldb/actions/edit_key/edit_key.class.php index 5e2df276ac8..68812de24da 100644 --- a/admin/xmldb/actions/edit_key/edit_key.class.php +++ b/admin/xmldb/actions/edit_key/edit_key.class.php @@ -28,7 +28,7 @@ class edit_key extends XMLDBAction { - /** + /** * Init method, every subclass will have its own */ function init() { @@ -160,7 +160,7 @@ class edit_key extends XMLDBAction { $this->output = $o; /// Launch postaction if exists (leave this here!) - if ($this->getPostAction() && $result) { + if ($this->getPostAction() && $result) { return $this->launch($this->getPostAction()); } diff --git a/admin/xmldb/actions/edit_key/edit_key.js b/admin/xmldb/actions/edit_key/edit_key.js index 8230e0f1434..eb3dd67377c 100644 --- a/admin/xmldb/actions/edit_key/edit_key.js +++ b/admin/xmldb/actions/edit_key/edit_key.js @@ -27,7 +27,7 @@ /// Register the needed events - onload=function() { + onload=function() { /// Adjust the form on load transformForm(); diff --git a/admin/xmldb/actions/edit_key_save/edit_key_save.class.php b/admin/xmldb/actions/edit_key_save/edit_key_save.class.php index 68297d4873b..ec663af8229 100644 --- a/admin/xmldb/actions/edit_key_save/edit_key_save.class.php +++ b/admin/xmldb/actions/edit_key_save/edit_key_save.class.php @@ -28,7 +28,7 @@ class edit_key_save extends XMLDBAction { - /** + /** * Init method, every subclass will have its own */ function init() { @@ -187,11 +187,11 @@ class edit_key_save extends XMLDBAction { /// Check reftable is not empty if (empty($reftable)) { $errors[] = $this->str['noreftablespecified']; - } else + } else /// Check reffields are not empty if (empty($reffieldsarr[0])) { $errors[] = $this->str['noreffieldsspecified']; - } else + } else /// Check the number of fields is correct if (count($fieldsarr) != count($reffieldsarr)) { $errors[] = $this->str['wrongnumberofreffields']; @@ -240,8 +240,8 @@ class edit_key_save extends XMLDBAction { } /// Prepare the output $site = get_site(); - print_header("$site->shortname: XMLDB", - "$site->fullname", + print_header("$site->shortname: XMLDB", + "$site->fullname", "" . $this->str['administration'] . " -> XMLDB"); notice ('
' .implode(', ', $errors) . '
' . $tempkey->readableInfo(), @@ -266,8 +266,8 @@ class edit_key_save extends XMLDBAction { $next->setChanged(true); } } - - /// Set comment + + /// Set comment $key->setComment($comment); /// Set the rest of fields @@ -278,7 +278,7 @@ class edit_key_save extends XMLDBAction { $key->setRefTable($reftable); $key->setRefFields($reffieldsarr); } - + /// If the hash has changed from the old one, change the version /// and mark the structure as changed $key->calculateHash(true); @@ -293,7 +293,7 @@ class edit_key_save extends XMLDBAction { } /// Launch postaction if exists (leave this here!) - if ($this->getPostAction() && $result) { + if ($this->getPostAction() && $result) { return $this->launch($this->getPostAction()); } } diff --git a/admin/xmldb/actions/edit_sentence/edit_sentence.class.php b/admin/xmldb/actions/edit_sentence/edit_sentence.class.php index 5e7ca302c8a..24bf5902722 100644 --- a/admin/xmldb/actions/edit_sentence/edit_sentence.class.php +++ b/admin/xmldb/actions/edit_sentence/edit_sentence.class.php @@ -28,7 +28,7 @@ class edit_sentence extends XMLDBAction { - /** + /** * Init method, every subclass will have its own */ function init() { @@ -137,12 +137,12 @@ class edit_sentence extends XMLDBAction { $b .= ' [' . $this->str['back'] . ']'; $b .= '
'; $o .= $b; - + $this->output = $o; } - + /// Launch postaction if exists (leave this here!) - if ($this->getPostAction() && $result) { + if ($this->getPostAction() && $result) { return $this->launch($this->getPostAction()); } diff --git a/admin/xmldb/actions/edit_sentence_save/edit_sentence_save.class.php b/admin/xmldb/actions/edit_sentence_save/edit_sentence_save.class.php index c9990ed9c11..426b6d72bc8 100644 --- a/admin/xmldb/actions/edit_sentence_save/edit_sentence_save.class.php +++ b/admin/xmldb/actions/edit_sentence_save/edit_sentence_save.class.php @@ -28,7 +28,7 @@ class edit_sentence_save extends XMLDBAction { - /** + /** * Init method, every subclass will have its own */ function init() { @@ -116,12 +116,12 @@ class edit_sentence_save extends XMLDBAction { if ($result && count($fields) != count($values)) { $errors[] = $this->str['wrongnumberoffieldsorvalues']; } - + if (!empty($errors)) { /// Prepare the output $site = get_site(); - print_header("$site->shortname: XMLDB", - "$site->fullname", + print_header("$site->shortname: XMLDB", + "$site->fullname", "" . $this->str['administration'] . " -> XMLDB"); notice ('' .implode(', ', $errors) . '
' . s($sentence), @@ -132,7 +132,7 @@ class edit_sentence_save extends XMLDBAction { /// Continue if we aren't under errors if (empty($errors)) { $sentences[$sentenceparam] = $sentence; - + /// If the sentence has changed from the old one, change the version /// and mark the statement and structure as changed if ($oldsentence != $sentence) { @@ -143,7 +143,7 @@ class edit_sentence_save extends XMLDBAction { } /// Launch postaction if exists (leave this here!) - if ($this->getPostAction() && $result) { + if ($this->getPostAction() && $result) { return $this->launch($this->getPostAction()); } } diff --git a/admin/xmldb/actions/edit_statement/edit_statement.class.php b/admin/xmldb/actions/edit_statement/edit_statement.class.php index c47d59e4fc0..f109b698834 100644 --- a/admin/xmldb/actions/edit_statement/edit_statement.class.php +++ b/admin/xmldb/actions/edit_statement/edit_statement.class.php @@ -28,7 +28,7 @@ class edit_statement extends XMLDBAction { - /** + /** * Init method, every subclass will have its own */ function init() { @@ -138,7 +138,7 @@ class edit_statement extends XMLDBAction { ///$statement->deleteSentence('changeme'); /// Add the fields list - $sentences =& $statement->getSentences(); + $sentences =& $statement->getSentences(); if (!empty($sentences)) { $o .= '
| ' . $p . $sentence . $b . ' |
| ' . $p . $sentence . $b . ' |
| '; /// The delete button (if we have more than one and it isn't used - if (count($fields) > 1 && + if (count($fields) > 1 && !$structure->getFieldUses($table->getName(), $field->getName())) { $b .= '[' . $this->str['delete'] . ']'; } else { @@ -210,13 +210,13 @@ class edit_table extends XMLDBAction { /// The readable info $r = ' | ' . $field->readableInfo() . ' | '; /// Print table row - $o .= '
| ' . $field->getName() . '' . $b . $r . ' |
| ' . $field->getName() . '' . $b . $r . ' |
| ' . $key->readableInfo() . ' | '; /// Print table row - $o .= '
| ' . $key->getName() . '' . $b . $r .' |
| ' . $key->getName() . '' . $b . $r .' |
| ' . $index->readableInfo() . ' | '; /// Print table row - $o .= '
| ' . $index->getName() . '' . $b . $r .' |
| ' . $index->getName() . '' . $b . $r .' |
| ' . $table->getName() . '' . $b . ' |
| ' . $table->getName() . '' . $b . ' |
| ' . $statement->getName() . '' . $b . ' |
| ' . $statement->getName() . '' . $b . ' |
| '; - + $count = 0; - + foreach($this->items as $key => $value) { if ($count % 15 == 0) { $return .= ' | ';
}
-
+
$return .= ($value == '' ? get_string($key,'editor') : ' '; } } - - $return .= ' |
' . get_string('sunday', 'calendar') . ' | ' .
+ '
' .
+ ' | ' .
+ ' | ' .
+ ' | ' .
+ ' | ' .
+ ' | ' .
+ ' | ' .
+ ' | |
' . get_string('sunday', 'calendar') . ' | ' .
+ '
' .
+ ' | ' .
+ ' | ' .
+ ' | ' .
+ ' | ' .
+ ' | ' .
+ ' | ' .
+ ' | |
';
@@ -2369,7 +2369,7 @@ function admin_get_root() {
}
}
}
-
+
return $ADMIN;
}
@@ -2386,9 +2386,9 @@ function apply_default_settings(&$node) {
apply_default_settings($node->children[$entry]);
}
return;
- }
+ }
- if (is_a($node, 'admin_settingpage')) {
+ if (is_a($node, 'admin_settingpage')) {
foreach ($node->settings as $setting) {
$CFG->{$setting->name} = $setting->defaultsetting;
$setting->write_setting($setting->defaultsetting);
diff --git a/lib/db/access.php b/lib/db/access.php
index c590a5dcb88..94e22bd52b9 100644
--- a/lib/db/access.php
+++ b/lib/db/access.php
@@ -32,56 +32,56 @@
$moodle_capabilities = array(
-
+
'moodle/site:doanything' => array(
'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS | RISK_CONFIG,
'captype' => 'admin',
'contextlevel' => CONTEXT_SYSTEM
),
-
+
'moodle/legacy:guest' => array(
'captype' => 'legacy',
'contextlevel' => CONTEXT_SYSTEM
),
-
-
+
+
'moodle/legacy:student' => array(
'riskbitmask' => RISK_SPAM,
'captype' => 'legacy',
'contextlevel' => CONTEXT_SYSTEM
),
-
-
+
+
'moodle/legacy:teacher' => array(
'riskbitmask' => RISK_SPAM | RISK_PERSONAL,
'captype' => 'legacy',
'contextlevel' => CONTEXT_SYSTEM
),
-
-
+
+
'moodle/legacy:editingteacher' => array(
'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
'captype' => 'legacy',
'contextlevel' => CONTEXT_SYSTEM
),
-
-
+
+
'moodle/legacy:coursecreator' => array(
'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
'captype' => 'legacy',
'contextlevel' => CONTEXT_SYSTEM
),
-
-
+
+
'moodle/legacy:admin' => array(
'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS | RISK_CONFIG,
'captype' => 'legacy',
'contextlevel' => CONTEXT_SYSTEM
),
-
-
+
+
'moodle/site:config' => array(
-
+
'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS | RISK_CONFIG,
'captype' => 'write',
@@ -95,9 +95,9 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/site:readallmessages' => array(
-
+
'captype' => 'read',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
@@ -109,9 +109,9 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/site:approvecourse' => array(
-
+
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
@@ -123,9 +123,9 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/site:import' => array(
-
+
'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
'captype' => 'write',
@@ -139,9 +139,9 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/site:backup' => array(
-
+
'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
'captype' => 'write',
@@ -155,9 +155,9 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/site:restore' => array(
-
+
'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS,
'captype' => 'write',
@@ -171,9 +171,9 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/site:manageblocks' => array(
-
+
'riskbitmask' => RISK_SPAM | RISK_XSS,
'captype' => 'write',
@@ -187,9 +187,9 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/site:accessallgroups' => array(
-
+
'captype' => 'read',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
@@ -201,9 +201,9 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/site:viewfullnames' => array(
-
+
'captype' => 'read',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
@@ -215,9 +215,9 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/site:viewparticipants' => array(
-
+
'captype' => 'read',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
@@ -229,9 +229,9 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/site:viewreports' => array(
-
+
'riskbitmask' => RISK_PERSONAL,
'captype' => 'read',
@@ -245,9 +245,9 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/site:trustcontent' => array(
-
+
'riskbitmask' => RISK_XSS,
'captype' => 'write',
@@ -261,9 +261,9 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/user:create' => array(
-
+
'riskbitmask' => RISK_SPAM | RISK_PERSONAL,
'captype' => 'write',
@@ -277,9 +277,9 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/user:delete' => array(
-
+
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
@@ -291,9 +291,9 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/user:update' => array(
-
+
'riskbitmask' => RISK_SPAM,
'captype' => 'write',
@@ -307,9 +307,9 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/user:viewdetails' => array(
-
+
'captype' => 'read',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
@@ -323,7 +323,7 @@ $moodle_capabilities = array(
),
'moodle/user:viewhiddendetails' => array(
-
+
'riskbitmask' => RISK_PERSONAL,
'captype' => 'read',
@@ -337,9 +337,9 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/role:assign' => array(
-
+
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
@@ -351,9 +351,9 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/role:override' => array(
-
+
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
@@ -365,9 +365,9 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/role:manage' => array(
-
+
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'legacy' => array(
@@ -405,9 +405,9 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/category:create' => array(
-
+
'captype' => 'write',
'contextlevel' => CONTEXT_COURSECAT,
'legacy' => array(
@@ -419,9 +419,9 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/category:delete' => array(
-
+
'captype' => 'write',
'contextlevel' => CONTEXT_COURSECAT,
'legacy' => array(
@@ -433,9 +433,9 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/category:update' => array(
-
+
'captype' => 'write',
'contextlevel' => CONTEXT_COURSECAT,
'legacy' => array(
@@ -447,9 +447,9 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/category:visibility' => array(
-
+
'captype' => 'write',
'contextlevel' => CONTEXT_COURSECAT,
'legacy' => array(
@@ -461,9 +461,9 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/course:create' => array(
-
+
'riskbitmask' => RISK_XSS,
'captype' => 'write',
@@ -477,9 +477,9 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/course:delete' => array(
-
+
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
'legacy' => array(
@@ -491,9 +491,9 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/course:update' => array(
-
+
'riskbitmask' => RISK_XSS,
'captype' => 'write',
@@ -507,9 +507,9 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/course:view' => array(
-
+
'captype' => 'read',
'contextlevel' => CONTEXT_COURSE,
'legacy' => array(
@@ -521,9 +521,9 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/course:viewhiddenuserfields' => array(
-
+
'riskbitmask' => RISK_PERSONAL,
'captype' => 'read',
@@ -537,9 +537,9 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/course:viewhiddencourses' => array(
-
+
'captype' => 'read',
'contextlevel' => CONTEXT_COURSE,
'legacy' => array(
@@ -551,9 +551,9 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/course:visibility' => array(
-
+
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
'legacy' => array(
@@ -565,9 +565,9 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/course:managefiles' => array(
-
+
'riskbitmask' => RISK_XSS,
'captype' => 'write',
@@ -581,9 +581,9 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/course:managequestions' => array(
-
+
'riskbitmask' => RISK_XSS,
'captype' => 'write',
@@ -597,9 +597,9 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/course:manageactivities' => array(
-
+
'riskbitmask' => RISK_XSS,
'captype' => 'write',
@@ -613,9 +613,9 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/course:managemetacourse' => array(
-
+
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
'legacy' => array(
@@ -627,9 +627,9 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/course:activityvisibility' => array(
-
+
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
'legacy' => array(
@@ -641,9 +641,9 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/course:viewhiddenactivities' => array(
-
+
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
'legacy' => array(
@@ -655,9 +655,9 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/course:viewparticipants' => array(
-
+
'captype' => 'read',
'contextlevel' => CONTEXT_COURSE,
'legacy' => array(
@@ -669,9 +669,9 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/course:viewscales' => array(
-
+
'captype' => 'read',
'contextlevel' => CONTEXT_COURSE,
'legacy' => array(
@@ -683,9 +683,9 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/course:managescales' => array(
-
+
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
'legacy' => array(
@@ -697,7 +697,7 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/course:managegroups' => array(
'captype' => 'write',
@@ -711,7 +711,7 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/course:reset' => array(
'captype' => 'write',
@@ -725,7 +725,7 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/blog:view' => array(
'captype' => 'read',
@@ -739,7 +739,7 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/blog:create' => array(
'riskbitmask' => RISK_SPAM,
@@ -755,7 +755,7 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/blog:manageofficialtags' => array(
'riskbitmask' => RISK_SPAM,
@@ -771,7 +771,7 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/blog:managepersonaltags' => array(
'riskbitmask' => RISK_SPAM,
@@ -787,7 +787,7 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/blog:manageentries' => array(
'riskbitmask' => RISK_SPAM,
@@ -803,7 +803,7 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/calendar:manageownentries' => array(
'riskbitmask' => RISK_SPAM,
@@ -819,7 +819,7 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/calendar:manageentries' => array(
'riskbitmask' => RISK_SPAM,
@@ -835,8 +835,8 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
- // The next 3 might make no sense for some roles, e.g teacher, etc.
+
+ // The next 3 might make no sense for some roles, e.g teacher, etc.
// since the next level up is site. These are more for the parent role
'moodle/user:readuserposts' => array(
'captype' => 'read',
@@ -850,7 +850,7 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/user:readuserblogs' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_USER,
@@ -863,7 +863,7 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/user:viewuseractivitiesreport' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_USER,
@@ -876,7 +876,7 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/user:editprofile' => array(
'riskbitmask' => RISK_SPAM,
@@ -892,7 +892,7 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/question:import' => array(
'riskbitmask' => RISK_XSS,
@@ -908,7 +908,7 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/question:export' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_COURSE,
@@ -921,7 +921,7 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/question:managecategory' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
@@ -934,7 +934,7 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/question:manage' => array(
'riskbitmask' => RISK_XSS,
@@ -963,7 +963,7 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/course:sectionvisibility' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
@@ -976,7 +976,7 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/course:useremail' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
@@ -989,7 +989,7 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/course:viewhiddensections' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
@@ -1002,7 +1002,7 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/course:setcurrentsection' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
@@ -1015,7 +1015,7 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/course:viewcoursegrades' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_COURSE,
@@ -1028,7 +1028,7 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/course:managegrades' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
@@ -1041,7 +1041,7 @@ $moodle_capabilities = array(
'admin' => CAP_ALLOW
)
),
-
+
'moodle/user:viewusergrades' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
diff --git a/lib/ddllib.php b/lib/ddllib.php
index 0ae3541e5e7..30b60c8714b 100644
--- a/lib/ddllib.php
+++ b/lib/ddllib.php
@@ -26,10 +26,10 @@
// This library includes all the required functions used to handle the DB
// structure (DDL) independently of the underlying RDBMS in use. All the functions
-// rely on the XMLDBDriver classes to be able to generate the correct SQL
+// rely on the XMLDBDriver classes to be able to generate the correct SQL
// syntax needed by each DB.
//
-// To define any structure to be created we'll use the schema defined
+// To define any structure to be created we'll use the schema defined
// by the XMLDB classes, for tables, fields, indexes, keys and other
// statements instead of direct handling of SQL sentences.
//
@@ -59,7 +59,7 @@
/// Add other libraries
require_once($CFG->libdir . '/xmlize.php');
-
+
/**
* Add a new field to a table, or modify an existing one (if oldfield is defined).
@@ -244,7 +244,7 @@ function table_column($table, $oldfield, $field, $type='integer', $size='10',
* SQL statements, specific for each RDBMS ($CFG->dbtype) and, finally, it
* will execute all those statements against the DB.
*
- * @uses $CFG, $db
+ * @uses $CFG, $db
* @param $file full path to the XML file to be used
* @return boolean (true on success, false on error)
*/
@@ -279,7 +279,7 @@ function install_from_xmldb_file($file) {
* This function will create the table passed as argument with all its
* fields/keys/indexes/sequences, everything based in the XMLDB object
*
- * @uses $CFG, $db
+ * @uses $CFG, $db
* @param XMLDBTable table object (full specs are required)
* @param boolean continue to specify if must continue on error (true) or stop (false)
* @param boolean feedback to specify to show status info (true) or not (false)
@@ -307,7 +307,7 @@ function create_table($table, $continue=true, $feedback=true) {
* and all the associated objects (keys, indexes, constaints, sequences, triggers)
* will be dropped too.
*
- * @uses $CFG, $db
+ * @uses $CFG, $db
* @param XMLDBTable table object (just the name is mandatory)
* @param boolean continue to specify if must continue on error (true) or stop (false)
* @param boolean feedback to specify to show status info (true) or not (false)
@@ -333,7 +333,7 @@ function drop_table($table, $continue=true, $feedback=true) {
/**
* This function will add the field to the table passed as arguments
*
- * @uses $CFG, $db
+ * @uses $CFG, $db
* @param XMLDBTable table object (just the name is mandatory)
* @param XMLDBField field object (full specs are required)
* @param boolean continue to specify if must continue on error (true) or stop (false)
@@ -363,7 +363,7 @@ function add_field($table, $field, $continue=true, $feedback=true) {
/**
* This function will drop the field from the table passed as arguments
*
- * @uses $CFG, $db
+ * @uses $CFG, $db
* @param XMLDBTable table object (just the name is mandatory)
* @param XMLDBField field object (just the name is mandatory)
* @param boolean continue to specify if must continue on error (true) or stop (false)
diff --git a/lib/dmllib.php b/lib/dmllib.php
index defb681c136..1e84bf062df 100644
--- a/lib/dmllib.php
+++ b/lib/dmllib.php
@@ -23,7 +23,7 @@
// //
///////////////////////////////////////////////////////////////////////////
-/// This library contains all the Data Manipulation Language (DML) functions
+/// This library contains all the Data Manipulation Language (DML) functions
/// used to interact with the DB. All the dunctions in this library must be
/// generic and work against the major number of RDBMS possible. This is the
/// list of currently supported and tested DBs: mysql, postresql, mssql, oracle
@@ -101,7 +101,7 @@ function begin_sql() {
return true;
}
/**
-* on DBs that support it, commit the transaction
+* on DBs that support it, commit the transaction
*/
function rollback_sql() {
/// Completely general function - it just runs some SQL and reports success.
@@ -132,7 +132,7 @@ function db_lowercase() {
}
/**
-* on DBs that support it, commit the transaction
+* on DBs that support it, commit the transaction
*/
function commit_sql() {
/// Completely general function - it just runs some SQL and reports success.
@@ -155,7 +155,7 @@ function commit_sql() {
*
* @uses $CFG
* @param string $sqlfile The path where a file with sql commands can be found on the server.
- * @param string $sqlstring If no path is supplied then a string with semicolon delimited sql
+ * @param string $sqlstring If no path is supplied then a string with semicolon delimited sql
* commands can be supplied in this argument.
* @return bool Returns true if databse was modified successfully.
*/
@@ -332,11 +332,11 @@ function count_records_select($table, $select='', $countitem='COUNT(*)') {
*/
function count_records_sql($sql) {
$rs = get_recordset_sql($sql);
-
+
if ($rs) {
return reset($rs->fields);
} else {
- return 0;
+ return 0;
}
}
@@ -370,12 +370,12 @@ function get_record($table, $field1, $value1, $field2='', $value2='', $field3=''
* The SQL statement should normally only return one record. In debug mode
* you will get a warning if more record is returned (unless you
* set $expectmultiple to true). In non-debug mode, it just returns
- * the first record.
+ * the first record.
*
* @uses $CFG
* @uses $db
* @param string $sql The SQL string you wish to be executed, should normally only return one record.
- * @param bool $expectmultiple If the SQL cannot be written to conviniently return just one record,
+ * @param bool $expectmultiple If the SQL cannot be written to conviniently return just one record,
* set this to true to hide the debug message.
* @param bool $nolimit sometimes appending ' LIMIT 1' to the SQL causes an error. Set this to true
* to stop your SQL being modified. This argument should probably be deprecated.
@@ -392,7 +392,7 @@ function get_record_sql($sql, $expectmultiple=false, $nolimit=false) {
/// Only a few uses of the 2nd and 3rd parameter have been found
/// I think that we should avoid to use them completely, one
/// record is one record, and everything else should return error.
-/// So the proposal is to change all the uses, (4-5 inside Moodle
+/// So the proposal is to change all the uses, (4-5 inside Moodle
/// Core), drop them from the definition and delete the next two
/// "if" sentences. (eloy, 2006-08-19)
@@ -404,20 +404,20 @@ function get_record_sql($sql, $expectmultiple=false, $nolimit=false) {
$limitnum = 1;
} else if (debugging()) {
// Debugging mode - don't use a limit of 1, but do change the SQL, because sometimes that
- // causes errors, and in non-debug mode you don't see the error message and it is
+ // causes errors, and in non-debug mode you don't see the error message and it is
// impossible to know what's wrong.
$limitfrom = 0;
$limitnum = 100;
}
if (!$rs = get_recordset_sql($sql, $limitfrom, $limitnum)) {
- return false;
+ return false;
}
-
+
$recordcount = $rs->RecordCount();
if ($recordcount == 0) { // Found no records
- return false;
+ return false;
} else if ($recordcount == 1) { // Found one record
/// DIRTY HACK to retrieve all the ' ' (1 space) fields converted back
@@ -467,23 +467,23 @@ function get_record_select($table, $select='', $fields='*') {
* Get a number of records as an ADODB RecordSet.
*
* Selects records from the table $table.
- *
+ *
* If specified, only records where the field $field has value $value are retured.
- *
+ *
* If specified, the results will be sorted as specified by $sort. This
* is added to the SQL as "ORDER BY $sort". Example values of $sort
* mightbe "time ASC" or "time DESC".
- *
+ *
* If $fields is specified, only those fields are returned.
*
- * This function is internal to datalib, and should NEVER should be called directly
+ * This function is internal to datalib, and should NEVER should be called directly
* from general Moodle scripts. Use get_record, get_records etc.
- *
+ *
* If you only want some of the records, specify $limitfrom and $limitnum.
* The query will skip the first $limitfrom records (according to the sort
* order) and then return the next $limitnum records. If either of $limitfrom
* or $limitnum is specified, both must be present.
- *
+ *
* The return value is an ADODB RecordSet object
* @link http://phplens.com/adodb/reference.functions.adorecordset.html
* if the query succeeds. If an error occurrs, false is returned.
@@ -504,7 +504,7 @@ function get_recordset($table, $field='', $value='', $sort='', $fields='*', $lim
} else {
$select = '';
}
-
+
return get_recordset_select($table, $select, $sort, $fields, $limitfrom, $limitnum);
}
@@ -513,8 +513,8 @@ function get_recordset($table, $field='', $value='', $sort='', $fields='*', $lim
*
* If given, $select is used as the SELECT parameter in the SQL query,
* otherwise all records from the table are returned.
- *
- * Other arguments and the return type as for @see function get_recordset.
+ *
+ * Other arguments and the return type as for @see function get_recordset.
*
* @uses $CFG
* @param string $table the table to query.
@@ -552,8 +552,8 @@ function get_recordset_select($table, $select='', $sort='', $fields='*', $limitf
* Only records where $field takes one of the values $values are returned.
* $values should be a comma-separated list of values, for example "4,5,6,10"
* or "'foo','bar','baz'".
- *
- * Other arguments and the return type as for @see function get_recordset.
+ *
+ * Other arguments and the return type as for @see function get_recordset.
*
* @param string $table the table to query.
* @param string $field a field to check (optional).
@@ -577,10 +577,10 @@ function get_recordset_list($table, $field='', $values='', $sort='', $fields='*'
/**
* Get a number of records as an ADODB RecordSet. $sql must be a complete SQL query.
- * This function is internal to datalib, and should NEVER should be called directly
+ * This function is internal to datalib, and should NEVER should be called directly
* from general Moodle scripts. Use get_record, get_records etc.
- *
- * The return type is as for @see function get_recordset.
+ *
+ * The return type is as for @see function get_recordset.
*
* @uses $CFG
* @uses $db
@@ -620,7 +620,7 @@ function get_recordset_sql($sql, $limitfrom=null, $limitnum=null) {
/**
* Utility function used by the following 4 methods.
- *
+ *
* @param object an ADODB RecordSet object.
* @return mixed mixed an array of objects, or false if an error occured or the RecordSet was empty.
*/
@@ -654,7 +654,7 @@ function recordset_to_array($rs) {
}
}
-/**
+/**
* This function is used to convert all the Oracle 1-space defaults to the empty string
* like a really DIRTY HACK to allow it to work better until all those NOT NULL DEFAULT ''
* fields will be out from Moodle.
@@ -671,7 +671,7 @@ function onespace2empty(&$item, $key) {
*
* If the query succeeds and returns at least one record, the
* return value is an array of objects, one object for each
- * record found. The array key is the value from the first
+ * record found. The array key is the value from the first
* column of the result set. The object associated with that key
* has a member variable for each column of the results.
*
@@ -728,7 +728,7 @@ function get_records_list($table, $field='', $values='', $sort='', $fields='*',
* Get a number of records as an array of objects.
*
* Return value as for @see function get_records.
- *
+ *
* @param string $sql the SQL select query to execute.
* @param int $limitfrom return a subset of records, starting at this point (optional, required if $limitnum is set).
* @param int $limitnum return a subset comprising this many records (optional, required if $limitfrom is set).
@@ -741,7 +741,7 @@ function get_records_sql($sql, $limitfrom='', $limitnum='') {
/**
* Utility function used by the following 3 methods.
- *
+ *
* @param object an ADODB RecordSet object with two columns.
* @return mixed an associative array, or false if an error occured or the RecordSet was empty.
*/
@@ -764,7 +764,7 @@ function recordset_to_menu($rs) {
* Get the first two columns from a number of records as an associative array.
*
* Arguments as for @see function get_recordset.
- *
+ *
* If no errors occur, and at least one records is found, the return value
* is an associative whose keys come from the first field of each record,
* and whose values are the corresponding second fields. If no records are found,
@@ -867,7 +867,7 @@ function get_field_sql($sql) {
}
/**
- * Get an array of data from one or more fields from a database
+ * Get an array of data from one or more fields from a database
* use to get a column, or a series of distinct values
*
* @uses $CFG
@@ -1027,16 +1027,16 @@ function insert_record($table, $dataobject, $returnid=true, $primarykey='id') {
/// Postgres doesn't have the concept of primary key built in
/// and will return the OID which isn't what we want.
-/// The efficient and transaction-safe strategy is to
+/// The efficient and transaction-safe strategy is to
/// move the sequence forward first, and make the insert
/// with an explicit id.
if ( $CFG->dbtype === 'postgres7' && $returnid == true ) {
if ($nextval = (int)get_field_sql("SELECT NEXTVAL('{$CFG->prefix}{$table}_{$primarykey}_seq')")) {
- $dataobject->{$primarykey} = $nextval;
- }
+ $dataobject->{$primarykey} = $nextval;
+ }
}
-/// First basic support of insert for Oracle. As it doesn't
+/// First basic support of insert for Oracle. As it doesn't
/// support autogenerated fields, we rely on the corresponding
/// sequence. It will work automatically, unless we need to
/// return the primary from the function, in this case we
@@ -1049,7 +1049,7 @@ function insert_record($table, $dataobject, $returnid=true, $primarykey='id') {
$generator->setPrefix($CFG->prefix);
$seqname = $generator->getNameForObject($table, $primarykey, 'seq');
if ($nextval = (int)get_field_sql("SELECT $seqname.NEXTVAL from dual")) {
- $dataobject->{$primarykey} = $nextval;
+ $dataobject->{$primarykey} = $nextval;
}
}
/// Also, for Oracle DB, empty strings are converted to NULLs in DB
@@ -1059,7 +1059,7 @@ function insert_record($table, $dataobject, $returnid=true, $primarykey='id') {
/// What we are going to do is to examine all the data being inserted and if it's
/// an empty string (NULL for Oracle) and the field is defined as NOT NULL, we'll modify
/// such data in the best form possible ("0" for booleans and numbers and " " for the
-/// rest of strings. It isn't optimal, but the only way to do so.
+/// rest of strings. It isn't optimal, but the only way to do so.
/// In the oppsite, when retrieving records from Oracle, we'll decode " " back to
/// empty strings to allow everything to work properly. DIRTY HACK.
if ( $CFG->dbtype === 'oci8po') {
@@ -1130,9 +1130,9 @@ function insert_record($table, $dataobject, $returnid=true, $primarykey='id') {
}
/// This only gets triggered with non-Postgres databases
-/// however we have some postgres fallback in case we failed
+/// however we have some postgres fallback in case we failed
/// to find the sequence.
- $id = $db->Insert_ID();
+ $id = $db->Insert_ID();
if ($CFG->dbtype === 'postgres7') {
// try to get the primary key based on id
@@ -1140,7 +1140,7 @@ function insert_record($table, $dataobject, $returnid=true, $primarykey='id') {
&& ($rs->RecordCount() == 1) ) {
trigger_error("Retrieved $primarykey from oid on table $table because we could not find the sequence.");
return (integer)reset($rs->fields);
- }
+ }
trigger_error('Failed to retrieve primary key after insert: SELECT '. $primarykey .
' FROM '. $CFG->prefix . $table .' WHERE oid = '. $id);
return false;
@@ -1257,7 +1257,7 @@ function sql_ilike() {
/**
* Returns the proper SQL (for the dbms in use) to concatenate $firstname and $lastname
- *
+ *
* @uses $CFG
* @param string $firstname User's first name
* @param string $lastname User's last name
@@ -1295,7 +1295,7 @@ function sql_isnull($fieldname) {
}
}
-/**
+/**
* Returns the proper AS keyword to be used to aliase columns
* SQL defines the keyword as optional and nobody but PG
* seems to require it. This function should be used inside all
@@ -1318,7 +1318,7 @@ function sql_as() {
/**
* Returns the SQL text to be used to order by one TEXT (clob) column, because
- * some RDBMS doesn't support direct ordering of such fields.
+ * some RDBMS doesn't support direct ordering of such fields.
* Note that the use or queries being ordered by TEXT columns must be minimised,
* because it's really slooooooow.
* @param string fieldname the name of the TEXT field we need to order by
@@ -1341,13 +1341,13 @@ function sql_order_by_text($fieldname, $numchars=32) {
}
}
-/**
+/**
* Prepare a SQL WHERE clause to select records where the given fields match the given values.
- *
+ *
* Prepares a where clause of the form
* WHERE field1 = value1 AND field2 = value2 AND field3 = value3
* except that you need only specify as many arguments (zero to three) as you need.
- *
+ *
* @param string $field1 the first field to check (optional).
* @param string $value1 the value field1 must have (requred if field1 is given, else optional).
* @param string $field2 the second field to check (optional).
diff --git a/lib/xmldb/classes/XMLDBConstants.php b/lib/xmldb/classes/XMLDBConstants.php
index f6d38e66d58..85ac444a7db 100644
--- a/lib/xmldb/classes/XMLDBConstants.php
+++ b/lib/xmldb/classes/XMLDBConstants.php
@@ -24,7 +24,7 @@
// //
///////////////////////////////////////////////////////////////////////////
-/// This file contains all the constants and variables used
+/// This file contains all the constants and variables used
/// by the XMLDB interface
/// First, some constants to be used by actions
@@ -35,9 +35,9 @@
/// Now the allowed DB Field Types
define ('XMLDB_TYPE_INCORRECT', 0); //Wrong DB Type
- define ('XMLDB_TYPE_INTEGER', 1); //Integer
- define ('XMLDB_TYPE_NUMBER', 2); //Decimal number
- define ('XMLDB_TYPE_FLOAT', 3); //Floating Point number
+ define ('XMLDB_TYPE_INTEGER', 1); //Integer
+ define ('XMLDB_TYPE_NUMBER', 2); //Decimal number
+ define ('XMLDB_TYPE_FLOAT', 3); //Floating Point number
define ('XMLDB_TYPE_CHAR', 4); //String
define ('XMLDB_TYPE_TEXT', 5); //Text
define ('XMLDB_TYPE_BINARY', 6); //Binary
@@ -46,9 +46,9 @@
/// Now the allowed DB Keys
define ('XMLDB_KEY_INCORRECT', 0); //Wrong DB Key
- define ('XMLDB_KEY_PRIMARY', 1); //Primary Keys
+ define ('XMLDB_KEY_PRIMARY', 1); //Primary Keys
define ('XMLDB_KEY_UNIQUE', 2); //Unique Keys
- define ('XMLDB_KEY_FOREIGN', 3); //Foreign Keys
+ define ('XMLDB_KEY_FOREIGN', 3); //Foreign Keys
define ('XMLDB_KEY_CHECK', 4); //Check Constraints - NOT USED!
define ('XMLDB_KEY_FOREIGN_UNIQUE',5); //Foreign Key + Unique Key
diff --git a/lib/xmldb/classes/XMLDBField.class.php b/lib/xmldb/classes/XMLDBField.class.php
index 5bf2c0aa9fc..798973f1b53 100644
--- a/lib/xmldb/classes/XMLDBField.class.php
+++ b/lib/xmldb/classes/XMLDBField.class.php
@@ -27,7 +27,7 @@
/// This class represent one XMLDB Field
class XMLDBField extends XMLDBObject {
-
+
var $type;
var $length;
var $unsigned;
@@ -395,7 +395,7 @@ class XMLDBField extends XMLDBObject {
if (isset($xmlarr['@']['DECIMALS'])) {
$decimals = trim($xmlarr['@']['DECIMALS']);
/// Check for integer values
- if ($this->type == XMLDB_TYPE_NUMBER ||
+ if ($this->type == XMLDB_TYPE_NUMBER ||
$this->type == XMLDB_TYPE_FLOAT) {
if (!(is_numeric($decimals)&&(intval($decimals)==floatval($decimals)))) {
$this->errormsg = 'Incorrect DECIMALS attribute for number field';
@@ -446,7 +446,7 @@ class XMLDBField extends XMLDBObject {
function getXMLDBFieldType($type) {
$result = XMLDB_TYPE_INCORRECT;
-
+
switch (strtolower($type)) {
case 'int':
$result = XMLDB_TYPE_INTEGER;
@@ -481,7 +481,7 @@ class XMLDBField extends XMLDBObject {
function getXMLDBTypeName($type) {
$result = "";
-
+
switch (strtolower($type)) {
case XMLDB_TYPE_INTEGER:
$result = 'int';
@@ -526,7 +526,7 @@ class XMLDBField extends XMLDBObject {
}
}
- /**
+ /**
*This function will output the XML text for one field
*/
function xmlOutput() {
@@ -642,7 +642,7 @@ class XMLDBField extends XMLDBObject {
$this->type = XMLDB_TYPE_TEXT;
}
/// Calculate the length of the field
- if ($adofield->max_length > 0 &&
+ if ($adofield->max_length > 0 &&
($this->type == XMLDB_TYPE_INTEGER ||
$this->type == XMLDB_TYPE_NUMBER ||
$this->type == XMLDB_TYPE_FLOAT ||
@@ -683,13 +683,13 @@ class XMLDBField extends XMLDBObject {
}
/// Calculate the decimals of the field
if ($adofield->max_length > 0 &&
- $adofield->scale &&
+ $adofield->scale &&
($this->type == XMLDB_TYPE_NUMBER ||
$this->type == XMLDB_TYPE_FLOAT)) {
$this->decimals = $adofield->scale;
}
/// Calculate the unsigned field
- if ($adofield->unsigned &&
+ if ($adofield->unsigned &&
($this->type == XMLDB_TYPE_INTEGER ||
$this->type == XMLDB_TYPE_NUMBER ||
$this->type == XMLDB_TYPE_FLOAT)) {
@@ -702,7 +702,7 @@ class XMLDBField extends XMLDBObject {
/// Calculate the default field
if ($adofield->has_default) {
$this->default = $adofield->default_value;
- }
+ }
/// Calculate the sequence field
if ($adofield->auto_increment) {
$this->sequence = true;
diff --git a/lib/xmldb/classes/XMLDBFile.class.php b/lib/xmldb/classes/XMLDBFile.class.php
index 24e40104700..571aa99ba27 100644
--- a/lib/xmldb/classes/XMLDBFile.class.php
+++ b/lib/xmldb/classes/XMLDBFile.class.php
@@ -94,7 +94,7 @@ class XMLDBFile extends XMLDBObject {
return $structure;
}
- /**
+ /**
* This function saves the whole XMLDBStructure to its file
*/
function saveXMLFile() {
diff --git a/lib/xmldb/classes/XMLDBIndex.class.php b/lib/xmldb/classes/XMLDBIndex.class.php
index 8333b42d5e9..c23e5f25b17 100644
--- a/lib/xmldb/classes/XMLDBIndex.class.php
+++ b/lib/xmldb/classes/XMLDBIndex.class.php
@@ -27,7 +27,7 @@
/// This class represent one XMLDB Index
class XMLDBIndex extends XMLDBObject {
-
+
var $unique;
var $fields;
@@ -72,7 +72,7 @@ class XMLDBIndex extends XMLDBObject {
$this->fields = $fields;
}
- /**
+ /**
* Get the index fields
*/
function &getFields() {
@@ -113,7 +113,7 @@ class XMLDBIndex extends XMLDBObject {
$this->errormsg = 'Undefined UNIQUE attribute';
$result = false;
}
-
+
if (isset($xmlarr['@']['FIELDS'])) {
$fields = strtolower(trim($xmlarr['@']['FIELDS']));
if ($fields) {
@@ -169,7 +169,7 @@ class XMLDBIndex extends XMLDBObject {
}
}
- /**
+ /**
*This function will output the XML text for one index
*/
function xmlOutput() {
@@ -236,7 +236,7 @@ class XMLDBIndex extends XMLDBObject {
return $result;
}
- /**
+ /**
* Shows info in a readable format
*/
function readableInfo() {
diff --git a/lib/xmldb/classes/XMLDBKey.class.php b/lib/xmldb/classes/XMLDBKey.class.php
index 76fab318fad..61555431ad8 100644
--- a/lib/xmldb/classes/XMLDBKey.class.php
+++ b/lib/xmldb/classes/XMLDBKey.class.php
@@ -27,7 +27,7 @@
/// This class represent one XMLDB Key
class XMLDBKey extends XMLDBObject {
-
+
var $type;
var $fields;
var $reftable;
@@ -94,7 +94,7 @@ class XMLDBKey extends XMLDBObject {
$this->reffields = $reffields;
}
- /**
+ /**
* Get the key fields
*/
function &getFields() {
@@ -127,7 +127,7 @@ class XMLDBKey extends XMLDBObject {
/// print_object ($GLOBALS['traverse_array']); //Debug
/// $GLOBALS['traverse_array']=""; //Debug
- /// Process key attributes (name, type, fields, reftable,
+ /// Process key attributes (name, type, fields, reftable,
/// reffields, comment, previous, next)
if (isset($xmlarr['@']['NAME'])) {
$this->name = trim($xmlarr['@']['NAME']);
@@ -175,8 +175,8 @@ class XMLDBKey extends XMLDBObject {
if (isset($xmlarr['@']['REFTABLE'])) {
/// Check we are in a FK
- if ($this->type == XMLDB_KEY_FOREIGN ||
- $this->type == XMLDB_KEY_FOREIGN_UNIQUE) {
+ if ($this->type == XMLDB_KEY_FOREIGN ||
+ $this->type == XMLDB_KEY_FOREIGN_UNIQUE) {
$reftable = strtolower(trim($xmlarr['@']['REFTABLE']));
if (!$reftable) {
$this->errormsg = 'Empty REFTABLE attribute';
@@ -258,7 +258,7 @@ class XMLDBKey extends XMLDBObject {
function getXMLDBKeyType($type) {
$result = XMLDB_KEY_INCORRECT;
-
+
switch (strtolower($type)) {
case 'primary':
$result = XMLDB_KEY_PRIMARY;
@@ -287,7 +287,7 @@ class XMLDBKey extends XMLDBObject {
function getXMLDBKeyName($type) {
$result = '';
-
+
switch (strtolower($type)) {
case XMLDB_KEY_PRIMARY:
$result = 'primary';
@@ -326,7 +326,7 @@ class XMLDBKey extends XMLDBObject {
}
}
- /**
+ /**
*This function will output the XML text for one key
*/
function xmlOutput() {
@@ -392,14 +392,14 @@ class XMLDBKey extends XMLDBObject {
case XMLDB_KEY_FOREIGN:
$result .= 'XMLDB_KEY_FOREIGN' . ', ';
break;
- }
+ }
/// The fields
$keyfields = $this->getFields();
if (!empty($keyfields)) {
$result .= 'array(' . "'". implode("', '", $keyfields) . "')";
} else {
$result .= 'null';
- }
+ }
/// The FKs attributes
if ($this->getType() == XMLDB_KEY_FOREIGN) {
/// The reftable
@@ -408,7 +408,7 @@ class XMLDBKey extends XMLDBObject {
$result .= ", '" . $reftable . "', ";
} else {
$result .= 'null, ';
- }
+ }
/// The reffields
$reffields = $this->getRefFields();
if (!empty($reffields)) {
@@ -421,9 +421,9 @@ class XMLDBKey extends XMLDBObject {
return $result;
}
- /**
+ /**
* Shows info in a readable format
- */
+ */
function readableInfo() {
$o = '';
/// type
diff --git a/lib/xmldb/classes/XMLDBObject.class.php b/lib/xmldb/classes/XMLDBObject.class.php
index efd6f1f6941..41c3cab5540 100644
--- a/lib/xmldb/classes/XMLDBObject.class.php
+++ b/lib/xmldb/classes/XMLDBObject.class.php
@@ -28,7 +28,7 @@
/// are defined
class XMLDBObject {
-
+
var $name;
var $comment;
var $previous;
@@ -66,14 +66,14 @@ class XMLDBObject {
return $this->changed;
}
- /**
+ /**
* This function returns the comment of one XMLDBObject
*/
function getComment() {
return $this->comment;
}
- /**
+ /**
* This function returns the hash of one XMLDBObject
*/
function getHash() {
@@ -189,7 +189,7 @@ class XMLDBObject {
return $result;
}
- /**
+ /**
* This function will check that all the elements in one array
* have a consistent info in their previous/next fields
*/
@@ -316,9 +316,9 @@ class XMLDBObject {
function &findObjectInArray($objectname, $arr) {
foreach ($arr as $i => $object) {
if ($objectname == $object->getName()) {
- return $i;
- }
- }
+ return $i;
+ }
+ }
$null = NULL;
return $null;
}
@@ -332,7 +332,7 @@ class XMLDBObject {
}
/**
- * Returns one array of elements from one comma separated string,
+ * Returns one array of elements from one comma separated string,
* supporting quoted strings containing commas and concat function calls
*/
function comma2array($string) {
diff --git a/lib/xmldb/classes/XMLDBStatement.class.php b/lib/xmldb/classes/XMLDBStatement.class.php
index 2844ea879c5..0fa063ed37c 100644
--- a/lib/xmldb/classes/XMLDBStatement.class.php
+++ b/lib/xmldb/classes/XMLDBStatement.class.php
@@ -29,7 +29,7 @@
/// (only INSERT is allowed for now)
class XMLDBStatement extends XMLDBObject {
-
+
var $table; // Table we are handling
var $type; // XMLDB_STATEMENT_TYPE
var $sentences; // Collection of sentences in the statement
@@ -136,7 +136,7 @@ class XMLDBStatement extends XMLDBObject {
}
}
}
-
+
/// Finally, set the array of sentences
$this->sentences = $sentencesarr;
@@ -200,7 +200,7 @@ class XMLDBStatement extends XMLDBObject {
function getXMLDBStatementType($type) {
$result = XMLDB_STATEMENT_INCORRECT;
-
+
switch (strtolower($type)) {
case 'insert':
$result = XMLDB_STATEMENT_INSERT;
@@ -218,7 +218,7 @@ class XMLDBStatement extends XMLDBObject {
/// Return the normalized XMLDB_STATEMENT
return $result;
}
-
+
/**
* This function returns the correct name value for the
* XMLDB_STATEMENT_XXX passed as argument
@@ -226,7 +226,7 @@ class XMLDBStatement extends XMLDBObject {
function getXMLDBStatementName($type) {
$result = '';
-
+
switch (strtolower($type)) {
case XMLDB_STATEMENT_INSERT:
$result = 'insert';
@@ -257,7 +257,7 @@ class XMLDBStatement extends XMLDBObject {
}
}
- /**
+ /**
* This function will output the XML text for one statement
*/
function xmlOutput() {
@@ -302,7 +302,7 @@ class XMLDBStatement extends XMLDBObject {
$this->changed = true;
}
- /**
+ /**
* Shows info in a readable format
*/
function readableInfo() {
@@ -323,7 +323,7 @@ class XMLDBStatement extends XMLDBObject {
* This function will return an array of fields from one INSERT sentence
*/
function getFieldsFromInsertSentence($sentence) {
-
+
$fields = array();
/// Get first part from the sentence (before VALUES)
@@ -344,7 +344,7 @@ class XMLDBStatement extends XMLDBObject {
* This function will return an array of values from one INSERT sentence
*/
function getValuesFromInsertSentence($sentence) {
-
+
$values = array();
/// Get second part from the sentence (after VALUES)
@@ -364,7 +364,7 @@ class XMLDBStatement extends XMLDBObject {
/**
* This function will return the code needed to execute a collection
* of sentences present inside one statement for the specified BD
- * and prefix.
+ * and prefix.
* For now it only supports INSERT statements
*/
function getExecuteStatementSQL ($dbtype, $prefix, $statement_end=true) {
diff --git a/lib/xmldb/classes/XMLDBStructure.class.php b/lib/xmldb/classes/XMLDBStructure.class.php
index d711f57f83e..4d64e27038d 100644
--- a/lib/xmldb/classes/XMLDBStructure.class.php
+++ b/lib/xmldb/classes/XMLDBStructure.class.php
@@ -27,7 +27,7 @@
/// This class represent one XMLDB structure
class XMLDBStructure extends XMLDBObject {
-
+
var $path;
var $version;
var $tables;
@@ -63,7 +63,7 @@ class XMLDBStructure extends XMLDBObject {
*/
function &getTable($tablename) {
$i = $this->findTableInArray($tablename);
- if ($i !== NULL) {
+ if ($i !== NULL) {
return $this->tables[$i];
}
$null = NULL;
@@ -134,7 +134,7 @@ class XMLDBStructure extends XMLDBObject {
*/
function &getStatement($statementname) {
$i = $this->findStatementInArray($statementname);
- if ($i !== NULL) {
+ if ($i !== NULL) {
return $this->statements[$i];
}
$null = NULL;
@@ -148,7 +148,7 @@ class XMLDBStructure extends XMLDBObject {
return $this->statements;
}
- /**
+ /**
* Set the structure version
*/
function setVersion($version) {
@@ -311,14 +311,14 @@ class XMLDBStructure extends XMLDBObject {
}
}
- /**
+ /**
* Set the tables
*/
function setTables(&$tables) {
$this->tables = $tables;
}
- /**
+ /**
* Set the statements
*/
function setStatements(&$statements) {
@@ -412,7 +412,7 @@ class XMLDBStructure extends XMLDBObject {
}
}
}
-
+
/// Perform some general checks over statements
if ($result && $this->statements) {
/// Check statements names are ok (lowercase, a-z _-)
@@ -470,7 +470,7 @@ class XMLDBStructure extends XMLDBObject {
}
}
- /**
+ /**
* This function will output the XML text for one structure
*/
function xmlOutput() {
@@ -508,7 +508,7 @@ class XMLDBStructure extends XMLDBObject {
/**
* This function returns the number of uses of one table inside
- * a whole XMLDStructure. Useful to detect if the table must be
+ * a whole XMLDStructure. Useful to detect if the table must be
* locked. Return false if no uses are found.
*/
function getTableUses($tablename) {
@@ -543,7 +543,7 @@ class XMLDBStructure extends XMLDBObject {
/**
* This function returns the number of uses of one field inside
- * a whole XMLDBStructure. Useful to detect if the field must be
+ * a whole XMLDBStructure. Useful to detect if the field must be
* locked. Return false if no uses are found.
*/
function getFieldUses($tablename, $fieldname) {
@@ -558,7 +558,7 @@ class XMLDBStructure extends XMLDBObject {
in_array($fieldname, $key->getRefFields())) {
$uses[] = 'table ' . $table->getName() . ' key ' . $key->getName();
}
- }
+ }
}
/// Check if any index in the table is using it
$table = $this->getTable($tablename);
@@ -567,7 +567,7 @@ class XMLDBStructure extends XMLDBObject {
if (in_array($fieldname, $index->getFields())) {
$uses[] = 'table ' . $table->getName() . ' index ' . $index->getName();
}
- }
+ }
}
/// Check if some foreign key in the whole structure is using it
/// By comparing the reftable and refields with the field)
@@ -600,7 +600,7 @@ class XMLDBStructure extends XMLDBObject {
/**
* This function returns the number of uses of one key inside
- * a whole XMLDBStructure. Useful to detect if the key must be
+ * a whole XMLDBStructure. Useful to detect if the key must be
* locked. Return false if no uses are found.
*/
function getKeyUses($tablename, $keyname) {
@@ -639,7 +639,7 @@ class XMLDBStructure extends XMLDBObject {
/**
* This function returns the number of uses of one index inside
- * a whole XMLDBStructure. Useful to detect if the index must be
+ * a whole XMLDBStructure. Useful to detect if the index must be
* locked. Return false if no uses are found.
*/
function getIndexUses($tablename, $indexname) {
@@ -657,7 +657,7 @@ class XMLDBStructure extends XMLDBObject {
}
}
- /**
+ /**
* This function will return all the errors found in one structure
* looking recursively inside each table/statement. Returns
* an array of errors or false
@@ -673,7 +673,7 @@ class XMLDBStructure extends XMLDBObject {
if ($tables = $this->getTables()) {
foreach ($tables as $table) {
if ($tableerrors = $table->getAllErrors()) {
-
+
}
}
/// Add them to the errors array
@@ -697,14 +697,14 @@ class XMLDBStructure extends XMLDBObject {
}
}
- /**
+ /**
* This function will return the SQL code needed to create the table for the specified DB and
* prefix. Just one simple wrapper over generators.
*/
function getCreateStructureSQL ($dbtype, $prefix, $statement_end=true) {
$results = array();
-
+
if ($tables = $this->getTables()) {
foreach ($tables as $table) {
$results = array_merge($results, $table->getCreateTableSQL($dbtype, $prefix, $statement_end));
diff --git a/lib/xmldb/classes/XMLDBTable.class.php b/lib/xmldb/classes/XMLDBTable.class.php
index 1f869bb592c..d2bda59d7c6 100644
--- a/lib/xmldb/classes/XMLDBTable.class.php
+++ b/lib/xmldb/classes/XMLDBTable.class.php
@@ -27,7 +27,7 @@
/// This class represent one XMLDB table
class XMLDBTable extends XMLDBObject {
-
+
var $fields;
var $keys;
var $indexes;
@@ -625,7 +625,7 @@ class XMLDBTable extends XMLDBObject {
}
}
- /**
+ /**
* This function will output the XML text for one table
*/
function xmlOutput() {
@@ -706,7 +706,7 @@ class XMLDBTable extends XMLDBObject {
$key->setAttributes($type, $fields, $reftable, $reffields);
$this->addKey($key);
}
-
+
/**
* This function will add one new index to the table with all
* its attributes defined
@@ -720,8 +720,8 @@ class XMLDBTable extends XMLDBObject {
$index->setAttributes($type, $fields);
$this->addIndex($index);
}
-
- /**
+
+ /**
* This function will return all the errors found in one table
* looking recursively inside each field/key/index. Returns
* an array of errors or false
@@ -765,7 +765,7 @@ class XMLDBTable extends XMLDBObject {
}
}
- /**
+ /**
* This function will return the SQL code needed to create the table for the specified DB and
* prefix. Just one simple wrapper over generators.
*/
@@ -783,7 +783,7 @@ class XMLDBTable extends XMLDBObject {
return $results;
}
- /**
+ /**
* This function will return the SQL code needed to create the table for the specified DB and
* prefix. Just one simple wrapper over generators.
*/
@@ -801,7 +801,7 @@ class XMLDBTable extends XMLDBObject {
return $results;
}
- /**
+ /**
* This function will return the SQL code needed to drop the table for the specified DB and
* prefix. Just one simple wrapper over generators.
*/
@@ -819,7 +819,7 @@ class XMLDBTable extends XMLDBObject {
return $results;
}
- /**
+ /**
* This function will return the SQL code needed to add one field to the table for the specified DB and
* prefix. Just one simple wrapper over generators.
*/
@@ -837,7 +837,7 @@ class XMLDBTable extends XMLDBObject {
return $results;
}
- /**
+ /**
* This function will return the SQL code needed to drop one field from the table for the specified DB and
* prefix. Just one simple wrapper over generators.
*/
@@ -855,7 +855,7 @@ class XMLDBTable extends XMLDBObject {
return $results;
}
- /**
+ /**
* This function will return the SQL code needed to rename one field from the table for the specified DB and
* prefix. Just one simple wrapper over generators.
*/
diff --git a/lib/xmldb/classes/generators/XMLDBGenerator.class.php b/lib/xmldb/classes/generators/XMLDBGenerator.class.php
index b15278aead1..10baa0a13ea 100644
--- a/lib/xmldb/classes/generators/XMLDBGenerator.class.php
+++ b/lib/xmldb/classes/generators/XMLDBGenerator.class.php
@@ -25,14 +25,14 @@
///////////////////////////////////////////////////////////////////////////
/// This class represent the base generator class where all the
-/// needed functions to generate proper SQL are defined.
+/// needed functions to generate proper SQL are defined.
/// The rest of classes will inherit, by default, the same logic.
/// Functions will be overriden as needed to generate correct SQL.
class XMLDBgenerator {
-/// Please, avoid editing this defaults in this base class!
+/// Please, avoid editing this defaults in this base class!
/// It could change the behaviour of the rest of generators
/// that, by default, inherit this configuration.
/// To change any of them, do it in extended classes instead.
@@ -403,7 +403,7 @@ class XMLDBgenerator {
} else {
/// We force default '' for not null char columns without proper default
/// some day this should be out!
- if ($this->default_for_char !== NULL &&
+ if ($this->default_for_char !== NULL &&
$xmldb_field->getType() == XMLDB_TYPE_CHAR &&
$xmldb_field->getNotNull()) {
$default .= ' default ' . "'" . $this->default_for_char . "'";
@@ -415,7 +415,7 @@ class XMLDBgenerator {
/**
* Given one correct XMLDBTable and the new name, returns the SQL statements
* to rename it (inside one array)
- */
+ */
function getRenameTableSQL($xmldb_table, $newname) {
$results = array(); //Array where all the sentences will be stored
@@ -437,7 +437,7 @@ class XMLDBgenerator {
/**
* Given one correct XMLDBTable and the new name, returns the SQL statements
* to drop it (inside one array)
- */
+ */
function getDropTableSQL($xmldb_table) {
$results = array(); //Array where all the sentences will be stored
@@ -607,7 +607,7 @@ class XMLDBgenerator {
foreach($values as $key => $value) {
/// Trim single quotes
$value = trim($value,"'");
- if (stristr($value, 'CONCAT') !== false){
+ if (stristr($value, 'CONCAT') !== false){
/// Look for data between parentesis
preg_match("/CONCAT\s*\((.*)\)$/is", trim($value), $matches);
if (isset($matches[1])) {
@@ -665,7 +665,7 @@ class XMLDBgenerator {
}
}
- /**
+ /**
* Given one string (or one array), ends it with statement_end
*/
function getEndedStatements ($input) {
@@ -674,7 +674,7 @@ class XMLDBgenerator {
foreach ($input as $key=>$content) {
$input[$key] = $this->getEndedStatements($content);
}
- return $input;
+ return $input;
} else {
$input = trim($input) . $this->statement_end;
return $input;
@@ -705,7 +705,7 @@ class XMLDBgenerator {
}
/**
- * Returns the code (array of statements) needed
+ * Returns the code (array of statements) needed
* to create one sequence for the xmldb_table and xmldb_field passes
*/
function getCreateSequenceSQL ($xmldb_table, $xmldb_field) {
@@ -741,7 +741,7 @@ class XMLDBgenerator {
/// Some well-know reserved words
$reserved_words = array (
'user', 'scale', 'type', 'comment', 'view', 'value', 'table', 'index', 'key', 'sequence', 'trigger'
- );
+ );
return $reserved_words;
}
@@ -753,7 +753,7 @@ class XMLDBgenerator {
/// Some well-known tables to be created without prefix
$tables = array (
'adodb_logsql'
- );
+ );
return $tables;
}
}
diff --git a/lib/xmldb/classes/generators/mssql/mssql.class.php b/lib/xmldb/classes/generators/mssql/mssql.class.php
index 151078002cd..366ff044e0d 100644
--- a/lib/xmldb/classes/generators/mssql/mssql.class.php
+++ b/lib/xmldb/classes/generators/mssql/mssql.class.php
@@ -125,11 +125,11 @@ class XMLDBmssql extends XMLDBgenerator {
return $dbtype;
}
- /**
+ /**
* Returns the code needed to create one enum for the xmldb_table and xmldb_field passes
- */
+ */
function getEnumExtraSQL ($xmldb_table, $xmldb_field) {
-
+
$sql = 'CONSTRAINT ' . $this->getNameForObject($xmldb_table->getName(), $xmldb_field->getName(), 'ck');
$sql.= ' CHECK (' . $this->getEncQuoted($xmldb_field->getName()) . ' IN (' . implode(', ', $xmldb_field->getEnumValues()) . '))';
@@ -180,36 +180,36 @@ class XMLDBmssql extends XMLDBgenerator {
/// This file contains the reserved words for MSSQL databases
/// from http://msdn2.microsoft.com/en-us/library/ms189822.aspx
$reserved_words = array (
- 'add', 'all', 'alter', 'and', 'any', 'as', 'asc', 'authorization',
- 'avg', 'backup', 'begin', 'between', 'break', 'browse', 'bulk',
- 'by', 'cascade', 'case', 'check', 'checkpoint', 'close', 'clustered',
- 'coalesce', 'collate', 'column', 'commit', 'committed', 'compute',
- 'confirm', 'constraint', 'contains', 'containstable', 'continue',
- 'controlrow', 'convert', 'count', 'create', 'cross', 'current',
- 'current_date', 'current_time', 'current_timestamp', 'current_user',
- 'cursor', 'database', 'dbcc', 'deallocate', 'declare', 'default', 'delete',
- 'deny', 'desc', 'disk', 'distinct', 'distributed', 'double', 'drop', 'dummy',
- 'dump', 'else', 'end', 'errlvl', 'errorexit', 'escape', 'except', 'exec',
- 'execute', 'exists', 'exit', 'fetch', 'file', 'fillfactor', 'floppy',
- 'for', 'foreign', 'freetext', 'freetexttable', 'from', 'full', 'function',
- 'goto', 'grant', 'group', 'having', 'holdlock', 'identity', 'identitycol',
- 'identity_insert', 'if', 'in', 'index', 'inner', 'insert', 'intersect', 'into',
- 'is', 'isolation', 'join', 'key', 'kill', 'left', 'level', 'like', 'lineno',
- 'load', 'max', 'min', 'mirrorexit', 'national', 'nocheck', 'nonclustered',
- 'not', 'null', 'nullif', 'of', 'off', 'offsets', 'on', 'once', 'only', 'open',
- 'opendatasource', 'openquery', 'openrowset', 'openxml', 'option', 'or', 'order',
- 'outer', 'over', 'percent', 'perm', 'permanent', 'pipe', 'plan', 'precision',
- 'prepare', 'primary', 'print', 'privileges', 'proc', 'procedure', 'processexit',
- 'public', 'raiserror', 'read', 'readtext', 'reconfigure', 'references',
- 'repeatable', 'replication', 'restore', 'restrict', 'return', 'revoke',
- 'right', 'rollback', 'rowcount', 'rowguidcol', 'rule', 'save', 'schema',
- 'select', 'serializable', 'session_user', 'set', 'setuser', 'shutdown', 'some',
- 'statistics', 'sum', 'system_user', 'table', 'tape', 'temp', 'temporary',
- 'textsize', 'then', 'to', 'top', 'tran', 'transaction', 'trigger', 'truncate',
- 'tsequal', 'uncommitted', 'union', 'unique', 'update', 'updatetext', 'use',
- 'user', 'values', 'varying', 'view', 'waitfor', 'when', 'where', 'while',
+ 'add', 'all', 'alter', 'and', 'any', 'as', 'asc', 'authorization',
+ 'avg', 'backup', 'begin', 'between', 'break', 'browse', 'bulk',
+ 'by', 'cascade', 'case', 'check', 'checkpoint', 'close', 'clustered',
+ 'coalesce', 'collate', 'column', 'commit', 'committed', 'compute',
+ 'confirm', 'constraint', 'contains', 'containstable', 'continue',
+ 'controlrow', 'convert', 'count', 'create', 'cross', 'current',
+ 'current_date', 'current_time', 'current_timestamp', 'current_user',
+ 'cursor', 'database', 'dbcc', 'deallocate', 'declare', 'default', 'delete',
+ 'deny', 'desc', 'disk', 'distinct', 'distributed', 'double', 'drop', 'dummy',
+ 'dump', 'else', 'end', 'errlvl', 'errorexit', 'escape', 'except', 'exec',
+ 'execute', 'exists', 'exit', 'fetch', 'file', 'fillfactor', 'floppy',
+ 'for', 'foreign', 'freetext', 'freetexttable', 'from', 'full', 'function',
+ 'goto', 'grant', 'group', 'having', 'holdlock', 'identity', 'identitycol',
+ 'identity_insert', 'if', 'in', 'index', 'inner', 'insert', 'intersect', 'into',
+ 'is', 'isolation', 'join', 'key', 'kill', 'left', 'level', 'like', 'lineno',
+ 'load', 'max', 'min', 'mirrorexit', 'national', 'nocheck', 'nonclustered',
+ 'not', 'null', 'nullif', 'of', 'off', 'offsets', 'on', 'once', 'only', 'open',
+ 'opendatasource', 'openquery', 'openrowset', 'openxml', 'option', 'or', 'order',
+ 'outer', 'over', 'percent', 'perm', 'permanent', 'pipe', 'plan', 'precision',
+ 'prepare', 'primary', 'print', 'privileges', 'proc', 'procedure', 'processexit',
+ 'public', 'raiserror', 'read', 'readtext', 'reconfigure', 'references',
+ 'repeatable', 'replication', 'restore', 'restrict', 'return', 'revoke',
+ 'right', 'rollback', 'rowcount', 'rowguidcol', 'rule', 'save', 'schema',
+ 'select', 'serializable', 'session_user', 'set', 'setuser', 'shutdown', 'some',
+ 'statistics', 'sum', 'system_user', 'table', 'tape', 'temp', 'temporary',
+ 'textsize', 'then', 'to', 'top', 'tran', 'transaction', 'trigger', 'truncate',
+ 'tsequal', 'uncommitted', 'union', 'unique', 'update', 'updatetext', 'use',
+ 'user', 'values', 'varying', 'view', 'waitfor', 'when', 'where', 'while',
'with', 'work', 'writetext'
- );
+ );
return $reserved_words;
}
}
diff --git a/lib/xmldb/classes/generators/mysql/mysql.class.php b/lib/xmldb/classes/generators/mysql/mysql.class.php
index 936ec7a3dcd..ea26ce798a3 100644
--- a/lib/xmldb/classes/generators/mysql/mysql.class.php
+++ b/lib/xmldb/classes/generators/mysql/mysql.class.php
@@ -161,7 +161,7 @@ class XMLDBmysql extends XMLDBGenerator {
function getCommentSQL ($xmldb_table) {
$comment = '';
-
+
if ($xmldb_table->getComment()) {
$comment .= 'ALTER TABLE ' . $this->getEncQuoted($this->prefix . $xmldb_table->getName());
$comment .= " COMMENT='" . substr($xmldb_table->getComment(), 0, 250) . "'";
@@ -216,7 +216,7 @@ class XMLDBmysql extends XMLDBGenerator {
'utc_timestamp', 'values', 'varbinary', 'varchar', 'varcharacter',
'varying', 'when', 'where', 'while', 'with', 'write', 'x509',
'xor', 'year_month', 'zerofill'
- );
+ );
return $reserved_words;
}
}
diff --git a/lib/xmldb/classes/generators/oci8po/oci8po.class.php b/lib/xmldb/classes/generators/oci8po/oci8po.class.php
index 77c660c05bd..6e434adb3b4 100644
--- a/lib/xmldb/classes/generators/oci8po/oci8po.class.php
+++ b/lib/xmldb/classes/generators/oci8po/oci8po.class.php
@@ -114,11 +114,11 @@ class XMLDBoci8po extends XMLDBgenerator {
return $dbtype;
}
- /**
+ /**
* Returns the code needed to create one enum for the xmldb_table and xmldb_field passes
- */
+ */
function getEnumExtraSQL ($xmldb_table, $xmldb_field) {
-
+
$sql = 'CONSTRAINT ' . $this->getNameForObject($xmldb_table->getName(), $xmldb_field->getName(), 'ck');
$sql.= ' CHECK (' . $this->getEncQuoted($xmldb_field->getName()) . ' IN (' . implode(', ', $xmldb_field->getEnumValues()) . '))';
@@ -131,14 +131,14 @@ class XMLDBoci8po extends XMLDBgenerator {
function getCreateSequenceSQL ($xmldb_table, $xmldb_field) {
$sequence_name = $this->getNameForObject($xmldb_table->getName(), $xmldb_field->getName(), 'seq');
-
+
$sequence = "CREATE SEQUENCE " . $sequence_name;
$sequence.= "\n START WITH 1";
$sequence.= "\n INCREMENT BY 1";
$sequence.= "\n NOMAXVALUE";
$trigger_name = $this->getNameForObject($xmldb_table->getName(), $xmldb_field->getName(), 'trg');
-
+
$trigger = "CREATE OR REPLACE TRIGGER " . $trigger_name;
$trigger.= "\n BEFORE INSERT";
$trigger.= "\nON " . $this->getEncQuoted($this->prefix . $xmldb_table->getName());
@@ -158,11 +158,11 @@ class XMLDBoci8po extends XMLDBgenerator {
function getDropSequenceSQL ($xmldb_table, $xmldb_field, $include_trigger=false) {
$sequence_name = $this->getNameForObject($xmldb_table->getName(), $xmldb_field->getName(), 'seq');
-
+
$sequence = "DROP SEQUENCE " . $sequence_name;
$trigger_name = $this->getNameForObject($xmldb_table->getName(), $xmldb_field->getName(), 'trg');
-
+
$trigger = "DROP TRIGGER " . $trigger_name;
if ($include_trigger) {
@@ -222,7 +222,7 @@ class XMLDBoci8po extends XMLDBgenerator {
'unique', 'update', 'user', 'validate', 'values',
'varchar', 'varchar2', 'view', 'whenever',
'where', 'with'
- );
+ );
return $reserved_words;
}
}
diff --git a/lib/xmldb/classes/generators/postgres7/postgres7.class.php b/lib/xmldb/classes/generators/postgres7/postgres7.class.php
index ba8bd60e6e1..333a0823b37 100644
--- a/lib/xmldb/classes/generators/postgres7/postgres7.class.php
+++ b/lib/xmldb/classes/generators/postgres7/postgres7.class.php
@@ -114,11 +114,11 @@ class XMLDBpostgres7 extends XMLDBgenerator {
return $dbtype;
}
- /**
+ /**
* Returns the code needed to create one enum for the xmldb_table and xmldb_field passes
- */
+ */
function getEnumExtraSQL ($xmldb_table, $xmldb_field) {
-
+
$sql = 'CONSTRAINT ' . $this->getNameForObject($xmldb_table->getName(), $xmldb_field->getName(), 'ck');
$sql.= ' CHECK (' . $this->getEncQuoted($xmldb_field->getName()) . ' IN (' . implode(', ', $xmldb_field->getEnumValues()) . '))';
@@ -143,21 +143,21 @@ class XMLDBpostgres7 extends XMLDBgenerator {
/// This file contains the reserved words for PostgreSQL databases
/// http://www.postgresql.org/docs/current/static/sql-keywords-appendix.html
$reserved_words = array (
- 'all', 'analyse', 'analyze', 'and', 'any', 'array', 'as', 'asc',
- 'asymmetric', 'authorization', 'between', 'binary', 'both', 'case',
- 'cast', 'check', 'collate', 'column', 'constraint', 'create', 'cross',
- 'current_date', 'current_role', 'current_time', 'current_timestamp',
- 'current_user', 'default', 'deferrable', 'desc', 'distinct', 'do',
- 'else', 'end', 'except', 'false', 'for', 'foreign', 'freeze', 'from',
- 'full', 'grant', 'group', 'having', 'ilike', 'in', 'initially', 'inner',
- 'intersect', 'into', 'is', 'isnull', 'join', 'leading', 'left', 'like',
- 'limit', 'localtime', 'localtimestamp', 'natural', 'new', 'not',
- 'notnull', 'null', 'off', 'offset', 'old', 'on', 'only', 'or', 'order',
- 'outer', 'overlaps', 'placing', 'primary', 'references', 'right', 'select',
- 'session_user', 'similar', 'some', 'symmetric', 'table', 'then', 'to',
- 'trailing', 'true', 'union', 'unique', 'user', 'using', 'verbose',
+ 'all', 'analyse', 'analyze', 'and', 'any', 'array', 'as', 'asc',
+ 'asymmetric', 'authorization', 'between', 'binary', 'both', 'case',
+ 'cast', 'check', 'collate', 'column', 'constraint', 'create', 'cross',
+ 'current_date', 'current_role', 'current_time', 'current_timestamp',
+ 'current_user', 'default', 'deferrable', 'desc', 'distinct', 'do',
+ 'else', 'end', 'except', 'false', 'for', 'foreign', 'freeze', 'from',
+ 'full', 'grant', 'group', 'having', 'ilike', 'in', 'initially', 'inner',
+ 'intersect', 'into', 'is', 'isnull', 'join', 'leading', 'left', 'like',
+ 'limit', 'localtime', 'localtimestamp', 'natural', 'new', 'not',
+ 'notnull', 'null', 'off', 'offset', 'old', 'on', 'only', 'or', 'order',
+ 'outer', 'overlaps', 'placing', 'primary', 'references', 'right', 'select',
+ 'session_user', 'similar', 'some', 'symmetric', 'table', 'then', 'to',
+ 'trailing', 'true', 'union', 'unique', 'user', 'using', 'verbose',
'when', 'where'
- );
+ );
return $reserved_words;
}
}
diff --git a/lib/xmldb/xmldb.xsd b/lib/xmldb/xmldb.xsd
index 0829bb1b293..ee0e594b759 100644
--- a/lib/xmldb/xmldb.xsd
+++ b/lib/xmldb/xmldb.xsd
@@ -19,7 +19,7 @@
Starting index update (additions)...');
mtrace('Index size before: '.$CFG->search_index_size."\n");
-
+
//get all modules
if ($mods = get_records_select('modules')) {
//append virtual modules onto array
$mods = array_merge($mods, search_get_additional_modules());
-
+
foreach ($mods as $mod) {
//build include file and function names
- $class_file = $CFG->dirroot.'/search/documents/'.$mod->name.'_document.php';
+ $class_file = $CFG->dirroot.'/search/documents/'.$mod->name.'_document.php';
$db_names_function = $mod->name.'_db_names';
$get_document_function = $mod->name.'_single_document';
- $additions = array();
-
+ $additions = array();
+
if (file_exists($class_file)) {
require_once($class_file);
-
+
//if both required functions exist
if (function_exists($db_names_function) and function_exists($get_document_function)) {
mtrace("Checking $mod->name module for additions.");
$values = $db_names_function();
- $where = (isset($values[4])) ? $values[4] : '';
-
+ $where = (isset($values[4])) ? $values[4] : '';
+
//select records in MODULE table, but not in SEARCH_DATABASE_TABLE
$sql = "select id, ".$values[0]." as docid from ".$values[1].
" where id not in".
" (select docid from ".SEARCH_DATABASE_TABLE." where doctype like '$mod->name')".
" and ".$values[2]." > $indexdate".
- " $where";
+ " $where";
+
+ $records = get_records_sql($sql);
- $records = get_records_sql($sql);
-
//foreach record, build a module specific search document using the get_document function
- if (is_array($records)) {
+ if (is_array($records)) {
foreach($records as $record) {
$additions[] = $get_document_function($record->id);
} //foreach
- } //if
-
+ } //if
+
//foreach document, add it to the index and database table
foreach ($additions as $add) {
++$addition_count;
-
+
//object to insert into db
- $dbid = $dbcontrol->addDocument($add);
-
+ $dbid = $dbcontrol->addDocument($add);
+
//synchronise db with index
- $add->addField(Zend_Search_Lucene_Field::Keyword('dbid', $dbid));
-
+ $add->addField(Zend_Search_Lucene_Field::Keyword('dbid', $dbid));
+
mtrace(" Add: $add->title (database id = $add->dbid, moodle instance id = $add->docid)");
-
+
$index->addDocument($add);
} //foreach
-
+
mtrace("Finished $mod->name.\n");
- } //if
+ } //if
} //if
} //foreach
} //if
-
+
//commit changes
$index->commit();
-
+
//update index date and size
set_config("search_indexer_run_date", time());
set_config("search_index_size", (int)$CFG->search_index_size + (int)$addition_count);
diff --git a/search/cron.php b/search/cron.php
index 245ffa1a48b..36797e3c140 100644
--- a/search/cron.php
+++ b/search/cron.php
@@ -1,22 +1,22 @@
dirroot/search/lib.php");
-
+
mtrace("
| ||||||||||||||||||
Server Time: '.date('r',time()));
mtrace("Testing global search capabilities:\n");
-
+
$phpversion = phpversion();
-
- if (!search_check_php5()) {
+
+ if (!search_check_php5()) {
mtrace("ERROR: PHP 5.0.0 or later required (currently using version $phpversion).");
exit(0);
} else {
@@ -34,35 +34,35 @@
//fix paths for testing
set_include_path(get_include_path().":../");
require_once("$CFG->dirroot/search/Zend/Search/Lucene.php");
-
+
mtrace("Checking activity modules:\n");
-
+
//the presence of the required search functions -
// * mod_iterator
// * mod_get_content_for_index
//are the sole basis for including a module in the index at the moment.
-
+
if ($mods = get_records_select('modules')) {
$mods = array_merge($mods, search_get_additional_modules());
-
+
foreach ($mods as $mod) {
- $class_file = $CFG->dirroot.'/search/documents/'.$mod->name.'_document.php';
-
+ $class_file = $CFG->dirroot.'/search/documents/'.$mod->name.'_document.php';
+
if (file_exists($class_file)) {
include_once($class_file);
-
+
if (!defined('SEARCH_TYPE_'.strtoupper($mod->name))) {
mtrace("ERROR: Constant 'SEARCH_TYPE_".strtoupper($mod->name)."' is not defined in /search/lib.php");
continue;
} //if
-
+
$iter_function = $mod->name.'_iterator';
$index_function = $mod->name.'_get_content_for_index';
-
+
if (function_exists($index_function) && function_exists($iter_function)) {
if (is_array($iter_function())) {
$documents = $index_function(array_pop($iter_function()));
-
+
if (is_array($documents)) {
mtrace("Success: '$mod->name' module seems to be ready for indexing.");
} else {
@@ -79,13 +79,13 @@
} //else
} //foreach
} //if
-
+
//finished modules
mtrace("\nFinished checking activity modules.");
-
+
//now blocks...
//
-
+
mtrace("
Back to query page or Start indexing.");
mtrace('');
diff --git a/search/update.php b/search/update.php
index d784acd4f13..0217afd3e40 100644
--- a/search/update.php
+++ b/search/update.php
@@ -2,100 +2,100 @@
require_once('../config.php');
require_once("$CFG->dirroot/search/lib.php");
-
+
require_login();
if (!isadmin()) {
error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
} //if
-
+
//check for php5 (lib.php)
if (!search_check_php5()) {
$phpversion = phpversion();
mtrace("Sorry, global search requires PHP 5.0.0 or later (currently using version $phpversion)");
exit(0);
- } //if
-
- require_once("$CFG->dirroot/search/indexlib.php");
-
+ } //if
+
+ require_once("$CFG->dirroot/search/indexlib.php");
+
$index = new Zend_Search_Lucene(SEARCH_INDEX_PATH);
$dbcontrol = new IndexDBControl();
$update_count = 0;
-
+
$indexdate = $CFG->search_indexer_run_date;
- mtrace("Starting index update (updates)...\n");
-
+ mtrace("Starting index update (updates)...\n");
+
if ($mods = get_records_select('modules')) {
$mods = array_merge($mods, search_get_additional_modules());
-
+
foreach ($mods as $mod) {
$class_file = $CFG->dirroot.'/search/documents/'.$mod->name.'_document.php';
$get_document_function = $mod->name.'_single_document';
$delete_function = $mod->name.'_delete';
$db_names_function = $mod->name.'_db_names';
- $updates = array();
-
+ $updates = array();
+
if (file_exists($class_file)) {
require_once($class_file);
-
+
if (function_exists($delete_function) and function_exists($db_names_function) and function_exists($get_document_function)) {
mtrace("Checking $mod->name module for updates.");
$values = $db_names_function();
-
+
//TODO: check 'in' syntax with other RDBMS' (add and update.php as well)
$sql = "select id, ".$values[0]." as docid from ".$values[1].
" where ".$values[3]." > $indexdate".
" and id in (select docid from ".SEARCH_DATABASE_TABLE.")";
-
- $records = get_records_sql($sql);
-
- if (is_array($records)) {
+
+ $records = get_records_sql($sql);
+
+ if (is_array($records)) {
foreach($records as $record) {
$updates[] = $delete_function($record->docid);
} //foreach
- } //if
-
+ } //if
+
foreach ($updates as $update) {
++$update_count;
-
- //delete old document
- $doc = $index->find("+docid:$update +doctype:$mod->name");
-
+
+ //delete old document
+ $doc = $index->find("+docid:$update +doctype:$mod->name");
+
//get the record, should only be one
- foreach ($doc as $thisdoc) {
+ foreach ($doc as $thisdoc) {
mtrace(" Delete: $thisdoc->title (database id = $thisdoc->dbid, index id = $thisdoc->id, moodle instance id = $thisdoc->docid)");
-
+
$dbcontrol->delDocument($thisdoc);
- $index->delete($thisdoc->id);
+ $index->delete($thisdoc->id);
} //foreach
-
+
//add new modified document back into index
$add = $get_document_function($update);
-
+
//object to insert into db
- $dbid = $dbcontrol->addDocument($add);
-
+ $dbid = $dbcontrol->addDocument($add);
+
//synchronise db with index
- $add->addField(Zend_Search_Lucene_Field::Keyword('dbid', $dbid));
-
+ $add->addField(Zend_Search_Lucene_Field::Keyword('dbid', $dbid));
+
mtrace(" Add: $add->title (database id = $add->dbid, moodle instance id = $add->docid)");
-
- $index->addDocument($add);
+
+ $index->addDocument($add);
} //foreach
-
+
mtrace("Finished $mod->name.\n");
- } //if
+ } //if
} //if
} //foreach
} //if
-
+
//commit changes
$index->commit();
-
+
//update index date
set_config("search_indexer_run_date", time());
- mtrace("Finished $update_count updates.");
+ mtrace("Finished $update_count updates.");
?>
\ No newline at end of file