From: Martin Langhoff Date: Thu, 4 Jan 2007 00:15:04 +0000 (+1300) Subject: cvsimport fixups -- cvshead had strayed from upstream X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=f3f7610c9013bd06ae0033e0143cc87e68c64bf3;p=moodle.git cvsimport fixups -- cvshead had strayed from upstream --- diff --git a/admin/config.php b/admin/config.php deleted file mode 100644 index fd1694b239..0000000000 --- a/admin/config.php +++ /dev/null @@ -1,185 +0,0 @@ -id)) { // Additional identity check - if (!confirm_sesskey()) { - error(get_string('confirmsesskeybad', 'error')); - } - } - - validate_form($config, $err); - - if (count($err) == 0) { - foreach ($config as $name => $value) { - if ($name == "sessioncookie") { - $value = eregi_replace("[^a-zA-Z0-9_]", "", $value); - } - if ($name == "defaultallowedmodules") { - $value = implode(',',$value); - } - if ($name == 'hiddenuserfields') { - if (in_array('none', $value)) { - $value = ''; - } else { - $value = implode(',',$value); - } - } - if ($name == "locale") { - $value = trim($value); - } - $conf = new object(); - $conf->name = $name; - $conf->value = $value; - if ($current = get_record('config', 'name', $name)) { - $conf->id = $current->id; - if (! update_record('config', $conf)) { - error("Error: Could not update $name to $value"); - } - } else { - if (! insert_record('config', $conf)) { - error("Error: could not add new variable $name !"); - } - } - } - redirect('index.php'); - exit; - - } else { - foreach ($err as $key => $value) { - $focus = "form.$key"; - } - } - } - -/// Otherwise fill and print the form. - - if (empty($config)) { - $config = $CFG; - } - - $sesskey = !empty($USER->id) ? $USER->sesskey : ''; - - - $stradmin = get_string('administration'); - $strconfiguration = get_string('configuration'); - $strconfigvariables = get_string('configvariables', 'admin'); - - if ($site) { - print_header("$site->shortname: $strconfigvariables", $site->fullname, - "$stradmin -> ". - "$strconfiguration -> $strconfigvariables", $focus); - print_heading($strconfigvariables); - } else { - print_header(); - print_heading($strconfigvariables); - print_simple_box(get_string('configintro', 'admin'), 'center', "50%"); - echo '
'; - } - - - -/// Get all the configuration fields and helptext - require('configvars.php'); - -/// Cycle through the sections to get the sectionnames - $linktext = ''; - foreach($configvars as $sectionname=>$section) { - if ($linktext !== '') { - $linktext .= ' | '; - } - $linktext .= ''.get_string('configsection'.$sectionname, 'admin').''; - } - - echo "
$linktext
\n"; - - - echo '
'; - echo '
'; - -/// Cycle through each section of the configuration - foreach ($configvars as $sectionname=>$section) { - - print_heading(''.get_string('configsection'.$sectionname, 'admin')); - - $table = NULL; - $table->data = array(); - foreach ($section as $configvariable=>$configobject) { - $table->data[] = array ( $configvariable.': ', - $configobject->field - ); - if ($configobject->display_warning()) { - $table->data[] = array ( ' ', - ''.$configobject->warning.'' - ); - } - $table->data[] = array ( ' ', - ''.$configobject->help.'' - ); - $table->align = array ('right', 'left'); - } - print_table($table); - - } - echo '
'; - echo ''; - echo ''; - echo '
'; - - echo '
'; - - - - - - /// Lock some options - - $httpsurl = str_replace('http://', 'https://', $CFG->wwwroot); - if ($httpsurl != $CFG->wwwroot) { - if (ini_get('allow_url_fopen')) { - if ((($fh = @fopen($httpsurl, 'r')) == false) and ($config->loginhttps == 0)) { - echo ''."\n"; - } - } - } - - - if ($site) { - print_footer(); - } - - exit; - -/// Functions ///////////////////////////////////////////////////////////////// - -function validate_form(&$form, &$err) { - - // Currently no checks are needed ... - - return true; -} - -?> diff --git a/admin/configvars.php b/admin/configvars.php deleted file mode 100644 index b7fb49fcbe..0000000000 --- a/admin/configvars.php +++ /dev/null @@ -1,660 +0,0 @@ -help = $help; - $this->field = $field; - $this->warning = $warning; - } - - function display_warning() { - return false; - } -} - - - - - -//////////////////////////////////////////////////////////////////// -/// Miscellaneous config variables -//////////////////////////////////////////////////////////////////// - $misc = array(); - - -/// maxeditingtime - unset($options); - $options[3600] = get_string('numminutes', '', 60); - $options[2700] = get_string('numminutes', '', 45); - $options[1800] = get_string('numminutes', '', 30); - $options[900] = get_string('numminutes', '', 15); - $options[300] = get_string('numminutes', '', 5); - $options[60] = get_string('numminutes', '', 1); - - $misc['maxeditingtime'] = new configvar (get_string('configmaxeditingtime', 'admin'), - choose_from_menu ($options, 'maxeditingtime', $config->maxeditingtime, '', '', '', true) ); - -/// debug - unset($options); - $options[5] = $strno; - $options[15] = $stryes; - - $misc['debug'] = new configvar (get_string('configdebug', 'admin'), - choose_from_menu ($options, 'debug', $config->debug, '', '', '', true) ); - - $misc['perfdebug'] = new configvar (get_string('configperfdebug', 'admin'), - choose_from_menu ($options, 'perfdebug', $config->perfdebug, '', '', '', true) ); - -/// enablerssfeeds -class configvarrss extends configvar { - function display_warning() { - return (!function_exists('utf8_encode')); - } -} - - $misc['enablerssfeeds'] = new configvarrss (get_string('configenablerssfeeds', 'admin'), - choose_from_menu ($noyesoptions, 'enablerssfeeds', $config->enablerssfeeds, '', '', '', true), - ' You need to add XML support to your PHP installation.' ); - - $misc['mymoodleredirect'] = new configvar (get_string('configmymoodleredirect','admin'), - choose_from_menu($noyesoptions,'mymoodleredirect',$config->mymoodleredirect,'','','',true)); - - unset($options); - $options[5] = get_string('worldblogs','blog'); - $options[4] = get_string('siteblogs','blog'); - $options[3] = get_string('courseblogs','blog'); - $options[2] = get_string('groupblogs','blog'); - $options[1] = get_string('personalblogs','blog'); - $options[0] = get_string('disableblogs','blog'); - - $misc['bloglevel'] = new configvar (get_string('configbloglevel', 'admin'), - choose_from_menu ($options, 'bloglevel', $config->bloglevel,'','','',true)); - -//////////////////////////////////////////////////////////////////// -/// OPERATING SYSTEM config variables -//////////////////////////////////////////////////////////////////// - $operatingsystem = array(); - -/// gdversion - unset($options); - $options[0] = get_string('gdnot'); - $options[1] = get_string('gd1'); - $options[2] = get_string('gd2'); - - $installed = check_gd_version(); - - $operatingsystem['gdversion'] = new configvar (get_string('configgdversion', 'admin'), - choose_from_menu ($options, 'gdversion', $installed, '', '', '', true) ); - -/// dbsessions - $operatingsystem['dbsessions'] = new configvar (get_string('configdbsessions', 'admin'), - choose_from_menu ($noyesoptions, 'dbsessions', $config->dbsessions, '', '', '', true) ); - -/// sessiontimeout - unset($options); - $options[14400] = get_string('numhours', '', 4); - $options[10800] = get_string('numhours', '', 3); - $options[7200] = get_string('numhours', '', 2); - $options[5400] = get_string('numhours', '', '1.5'); - $options[3600] = get_string('numminutes', '', 60); - $options[2700] = get_string('numminutes', '', 45); - $options[1800] = get_string('numminutes', '', 30); - $options[900] = get_string('numminutes', '', 15); - $options[300] = get_string('numminutes', '', 5); - - $operatingsystem['sessiontimeout'] = new configvar (get_string('configsessiontimeout', 'admin'), - choose_from_menu ($options, 'sessiontimeout', $config->sessiontimeout, '', '', '', true) ); - -/// sessioncookie - $operatingsystem['sessioncookie'] = new configvar (get_string('configsessioncookie', 'admin'), - '' ); - $operatingsystem['sessioncookiepath'] = new configvar (get_string('configsessioncookiepath', 'admin'), - '' ); - -/// zip - $operatingsystem['zip'] = new configvar (get_string('configzip', 'admin'), - '' ); - -/// unzip - $operatingsystem['unzip'] = new configvar (get_string('configunzip', 'admin'), - '' ); - - $operatingsystem['pathtodu'] = new configvar(get_string('configpathtodu', 'admin'), - ''); - -/// slasharguments - unset($options); - $options[0] = "file.php?file=/1/pic.jpg"; - $options[1] = "file.php/1/pic.jpg"; - - $operatingsystem['slasharguments'] = new configvar (get_string('configslasharguments', 'admin'), - choose_from_menu ($options, 'slasharguments', $config->slasharguments, '', '', '', true) ); - -/// proxyhost - $operatingsystem['proxyhost'] = new configvar (get_string('configproxyhost', 'admin'), - '' ); - -/// proxyport - $operatingsystem['proxyport'] = new configvar ('', - '' ); - - - -//////////////////////////////////////////////////////////////////// -/// PERMISSIONS config variables -//////////////////////////////////////////////////////////////////// - $permissions = array(); - -/// teacherassignteachers - $permissions['teacherassignteachers'] = new configvar (get_string('configteacherassignteachers', 'admin'), - choose_from_menu ($noyesoptions, 'teacherassignteachers', $config->teacherassignteachers, '', '', '', true) ); - -/// allowunenroll - $permissions['allowunenroll'] = new configvar (get_string('configallowunenroll', 'admin'), - choose_from_menu ($noyesoptions, 'allowunenroll', $config->allowunenroll, '', '', '', true) ); - -/// allusersaresitestudents - $permissions['allusersaresitestudents'] = new configvar (get_string('configallusersaresitestudents', 'admin'), - choose_from_menu ($noyesoptions, 'allusersaresitestudents', $config->allusersaresitestudents, '', '', '', true) ); - -/// showsiteparticipantslist - unset($options); - $options[0] = get_string('siteteachers'); - $options[1] = get_string('allteachers'); - $options[2] = get_string('studentsandteachers'); - - $permissions['showsiteparticipantslist'] = new configvar (get_string('configshowsiteparticipantslist', 'admin'), - choose_from_menu ($options, 'showsiteparticipantslist', $config->showsiteparticipantslist, '', '', '', true) ); - -/// forcelogin - $permissions['forcelogin'] = new configvar (get_string('configforcelogin', 'admin'), - choose_from_menu ($noyesoptions, 'forcelogin', $config->forcelogin, '', '', '', true) ); - -/// forceloginforprofiles - $permissions['forceloginforprofiles'] = new configvar (get_string('configforceloginforprofiles', 'admin'), - choose_from_menu ($noyesoptions, 'forceloginforprofiles', $config->forceloginforprofiles, '', '', '', true) ); - -/// opentogoogle - $permissions['opentogoogle'] = new configvar (get_string('configopentogoogle', 'admin'), - choose_from_menu ($noyesoptions, 'opentogoogle', $config->opentogoogle, '', '', '', true) ); - -/// maxbytes - $options = get_max_upload_sizes(); - - $permissions['maxbytes'] = new configvar (get_string('configmaxbytes', 'admin'), - choose_from_menu ($options, 'maxbytes', $config->maxbytes, '', '', 0, true) ); - -/// messaging - $permissions['messaging'] = new configvar (get_string('configmessaging', 'admin'), - choose_from_menu ($noyesoptions, 'messaging', $config->messaging, '', '', '', true) ); - -/// allowobjectembed - $permissions['allowobjectembed'] = new configvar (get_string('configallowobjectembed', 'admin'), - choose_from_menu ($noyesoptions, 'allowobjectembed', $config->allowobjectembed, '', '', '', true) ); - -/// enabletrusttext - $permissions['enabletrusttext'] = new configvar (get_string('configenabletrusttext', 'admin'), - choose_from_menu ($noyesoptions, 'enabletrusttext', $config->enabletrusttext, '', '', '', true) ); - - unset($options); - $options['none'] = 'No courses'; - $options['all'] = 'All courses'; - $options['requested'] = 'Requested courses'; - - $permissions['restrictmodulesfor'] = new configvar (get_string('configrestrictmodulesfor','admin'), - ' '. - choose_from_menu($options,'restrictmodulesfor',$config->restrictmodulesfor,'','togglemodules(this.selectedIndex);','',true) ); - - $permissions['restrictbydefault'] = new configvar (get_string('configrestrictbydefault','admin'), - choose_from_menu($noyesoptions, 'restrictbydefault',$config->restrictbydefault,'','','',true) ); - - $allowstr = ''; - - $permissions['defaultallowedmodules'] = new configvar (get_string('configdefaultallowedmodules','admin'),$allowstr); - - -/// course requests - $reqcourse['enablecourserequests'] = new configvar (get_string('configenablecourserequests', 'admin'), - choose_from_menu ($noyesoptions,'enablecourserequests',$config->enablecourserequests,'','','',true) ); - -/// default category for course requests - require_once($CFG->dirroot.'/course/lib.php'); - $reqcourse['defaultrequestedcategory'] = new configvar (get_string('configdefaultrequestedcategory', 'admin'), - choose_from_menu (make_categories_options(), 'defaultrequestedcategory',$config->defaultrequestedcategory,'','','',true) ); - - $reqcourse['requestedteachername'] = new configvar (get_string('configrequestedteachername','admin'), - ''); - - $reqcourse['requestedteachersname'] = new configvar (get_string('configrequestedteachersname','admin'), - ''); - - $reqcourse['requestedstudentname'] = new configvar (get_string('configrequestedstudentname','admin'), - ''); - - $reqcourse['requestedstudentsname'] = new configvar (get_string('configrequestedstudentsname','admin'), - ''); - -//////////////////////////////////////////////////////////////////// -/// INTERFACE config variables -//////////////////////////////////////////////////////////////////// - $interface = array(); - -/// language settings - $interface['lang'] = new configvar ( get_string('configlang', 'admin'), - choose_from_menu(get_list_of_languages(), 'lang', $config->lang, '', '', '', true) ); - -/// language menu - $interface['langmenu'] = new configvar ( get_string('configlangmenu', 'admin'), - choose_from_menu($noyesoptions, 'langmenu', $config->langmenu, '', '', '', true) ); - -/// language list - $interface['langlist'] = new configvar ( get_string('configlanglist', 'admin'), - '' ); - -/// language menu - $interface['langcache'] = new configvar ( get_string('configlangcache', 'admin'), - choose_from_menu($noyesoptions, 'langcache', $config->langcache, '', '', '', true) ); - -/// locale - $interface['locale'] = new configvar ( get_string('configlocale', 'admin'), - '' ); - -/// docroot - $interface['docroot'] = new configvar ( get_string('configdocroot', 'admin'), - '' ); - -/// doctonewwindow - $interface['doctonewwindow'] = new configvar ( get_string('configdoctonewwindow', 'admin'), - choose_from_menu($noyesoptions, 'doctonewwindow', $config->doctonewwindow, '', '', '', true) ); - -/// timezone - $interface['timezone'] = new configvar ( get_string('configtimezone', 'admin'), - choose_from_menu (get_list_of_timezones(), 'timezone', $config->timezone, get_string('serverlocaltime'), '', '99', true ) ); - -/// country - $interface['country'] = new configvar ( get_string('configcountry', 'admin'), - choose_from_menu (get_list_of_countries(), 'country', $config->country, get_string('selectacountry'), '', 0, true) ); - -/// framename - if (empty($config->framename)) { - $config->framename = "_top"; - } - - $interface['framename'] = new configvar (get_string('configframename', 'admin'), - '' ); - -/// language list - $interface['themelist'] = new configvar ( get_string('configthemelist', 'admin'), - '' ); - -/// user themes - $interface['allowuserthemes'] = new configvar (get_string('configallowuserthemes', 'admin'), - choose_from_menu ($noyesoptions, 'allowuserthemes', $config->allowuserthemes, '', '', '', true) ); - -/// course themes - $interface['allowcoursethemes'] = new configvar (get_string('configallowcoursethemes', 'admin'), - choose_from_menu ($noyesoptions, 'allowcoursethemes', $config->allowcoursethemes, '', '', '', true) ); - -/// allowuserblockhiding - $interface['allowuserblockhiding'] = new configvar (get_string('configallowuserblockhiding', 'admin'), - choose_from_menu ($noyesoptions, 'allowuserblockhiding', $config->allowuserblockhiding, '', '', '', true) ); - -/// showblocksonmodpages - $interface['showblocksonmodpages'] = new configvar (get_string('configshowblocksonmodpages', 'admin'), - choose_from_menu ($noyesoptions, 'showblocksonmodpages', $config->showblocksonmodpages, '', '', '', true) ); - - -/// tabselectedtofront - $interface['tabselectedtofront'] = new configvar (get_string('tabselectedtofront', 'admin'), - choose_from_menu ($noyesoptions, 'tabselectedtofront', $config->tabselectedtofront, '', '', '', true) ); - - - -//////////////////////////////////////////////////////////////////// -/// USER config variables -//////////////////////////////////////////////////////////////////// - $user = array(); - -/// sitepolicy - $user['sitepolicy'] = new configvar (get_string('configsitepolicy', 'admin'), - '' ); - - -/// fullnamedisplay - unset($options); - $options['language'] = get_string('language'); - $options['firstname lastname'] = get_string('firstname') . ' + ' . get_string('lastname'); - $options['lastname firstname'] = get_string('lastname') . ' + ' . get_string('firstname'); - $options['firstname'] = get_string('firstname'); - - $user['fullnamedisplay'] = new configvar (get_string('configfullnamedisplay', 'admin'), - choose_from_menu ($options, 'fullnamedisplay', $config->fullnamedisplay, '', '', '', true) ); - -/// extendedusernamechars - $user['extendedusernamechars'] = new configvar (get_string('configextendedusernamechars', 'admin'), - choose_from_menu ($noyesoptions, 'extendedusernamechars', $config->extendedusernamechars, '', '', '', true) ); - -/// autologinguests - $user['autologinguests'] = new configvar (get_string('configautologinguests', 'admin'), - choose_from_menu ($noyesoptions, 'autologinguests', $config->autologinguests, '', '', '', true) ); - -/// hiddenuserfields - $fields = array('none', 'description', 'city', 'country', 'webpage', 'icqnumber', 'skypeid', 'yahooid', 'aimid', 'msnid', 'lastaccess'); - if (empty($config->hiddenuserfields)) { - $config->hiddenuserfields = 'none'; - } - $configfields = array_flip(explode(',', $config->hiddenuserfields)); - $fieldoptions = ''; - foreach ($fields as $value) { - $fieldoptions .= '