parameter cleaup - round 1

This commit is contained in:
skodak 2006-03-06 10:02:59 +00:00
parent 1452f9e11b
commit 1c47adc540
14 changed files with 43 additions and 48 deletions

View file

@ -1,14 +1,10 @@
<?PHP // $Id$ <?PHP // $Id$
// Admin-only script to assign administrative rights to users // Admin-only script to assign administrative rights to users
require_once("../config.php"); require_once('../config.php');
define("MAX_USERS_PER_PAGE", 50); define("MAX_USERS_PER_PAGE", 50);
$add = optional_param('add', "", PARAM_ALPHA);
$remove = optional_param('remove', '', PARAM_ALPHA);
$search = optional_param('search', '', PARAM_ALPHA);
if (! $site = get_site()) { if (! $site = get_site()) {
redirect("$CFG->wwwroot/$CFG->admin/index.php"); redirect("$CFG->wwwroot/$CFG->admin/index.php");
} }

View file

@ -1,9 +1,9 @@
<?PHP // $Id$ <?PHP // $Id$
// config.php - allows admin to edit all configuration variables // config.php - allows admin to edit all configuration variables
include("../config.php"); require_once('../config.php');
$auth = optional_param( 'auth','',PARAM_CLEAN ); $auth = optional_param('auth', '', PARAM_SAFEDIR);
require_login(); require_login();
@ -19,8 +19,9 @@
error(get_string('confirmsesskeybad', 'error')); error(get_string('confirmsesskeybad', 'error'));
} }
/// If data submitted, then process and store. $focus = '';
/// If data submitted, then process and store.
if ($config = data_submitted()) { if ($config = data_submitted()) {
@ -66,6 +67,7 @@
} }
$modules = get_list_of_plugins("auth"); $modules = get_list_of_plugins("auth");
$options = array();
foreach ($modules as $module) { foreach ($modules as $module) {
$options[$module] = get_string("auth_$module"."title", "auth"); $options[$module] = get_string("auth_$module"."title", "auth");
} }
@ -105,10 +107,6 @@
} }
$user_fields = array("firstname", "lastname", "email", "phone1", "phone2", "department", "address", "city", "country", "description", "idnumber", "lang"); $user_fields = array("firstname", "lastname", "email", "phone1", "phone2", "department", "address", "city", "country", "description", "idnumber", "lang");
if (empty($focus)) {
$focus = "";
}
$guestoptions[0] = get_string("hide"); $guestoptions[0] = get_string("hide");
$guestoptions[1] = get_string("show"); $guestoptions[1] = get_string("show");

View file

@ -14,7 +14,7 @@
error("Site isn't defined!"); error("Site isn't defined!");
} }
$blockid = required_param( 'block',PARAM_INT ); $blockid = required_param('block', PARAM_INT);
if(($blockrecord = blocks_get_record($blockid)) === false) { if(($blockrecord = blocks_get_record($blockid)) === false) {
error('This block does not exist'); error('This block does not exist');

View file

@ -6,7 +6,7 @@
require_once($CFG->libdir.'/blocklib.php'); require_once($CFG->libdir.'/blocklib.php');
require_once($CFG->libdir.'/tablelib.php'); require_once($CFG->libdir.'/tablelib.php');
$confirm = optional_param('confirm', 0, PARAM_INT); $confirm = optional_param('confirm', 0, PARAM_BOOL);
$hide = optional_param('hide', 0, PARAM_INT); $hide = optional_param('hide', 0, PARAM_INT);
$show = optional_param('show', 0, PARAM_INT); $show = optional_param('show', 0, PARAM_INT);
$delete = optional_param('delete', 0, PARAM_INT); $delete = optional_param('delete', 0, PARAM_INT);

View file

@ -3,6 +3,8 @@
require_once('../config.php'); require_once('../config.php');
$focus = '';
if ($site = get_site()) { // If false then this is a new installation if ($site = get_site()) { // If false then this is a new installation
require_login(); require_login();
if (!isadmin()) { if (!isadmin()) {
@ -76,9 +78,6 @@
$config->locale = $CFG->lang; $config->locale = $CFG->lang;
} }
} }
if (empty($focus)) {
$focus = '';
}
$sesskey = !empty($USER->id) ? $USER->sesskey : ''; $sesskey = !empty($USER->id) ? $USER->sesskey : '';
@ -102,7 +101,7 @@
/// Get all the configuration fields and helptext /// Get all the configuration fields and helptext
include('configvars.php'); require('configvars.php');
/// Cycle through the sections to get the sectionnames /// Cycle through the sections to get the sectionnames
$linktext = ''; $linktext = '';

View file

@ -1,5 +1,6 @@
<?php // $Id$ <?php // $Id$
// Shane Elliott // Shane Elliott
defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
/// Add new sitewide configuration variables to this file. /// Add new sitewide configuration variables to this file.

View file

@ -67,7 +67,7 @@
<script type="text/javascript"> <script type="text/javascript">
function function
</script> </script>
<input type="text" name="searchtext" size="30" value="<?php echo $searchtext ?>" <input type="text" name="searchtext" size="30" value="<?php p($searchtext) ?>"
onFocus ="document.creatorsform.add.disabled=true; onFocus ="document.creatorsform.add.disabled=true;
document.creatorsform.remove.disabled=true; document.creatorsform.remove.disabled=true;
document.creatorsform.removeselect.selectedIndex=-1; document.creatorsform.removeselect.selectedIndex=-1;

View file

@ -1,14 +1,10 @@
<?PHP // $Id$ <?PHP // $Id$
// Admin only script to assign course creator rights to users // Admin only script to assign course creator rights to users
require_once("../config.php"); require_once('../config.php');
define("MAX_USERS_PER_PAGE", 50); define("MAX_USERS_PER_PAGE", 50);
$search = optional_param('search', '', PARAM_CLEAN);
$add = optional_param('add', '', PARAM_CLEAN);
$remove = optional_param('remove', '', PARAM_CLEAN );
if (! $site = get_site()) { if (! $site = get_site()) {
redirect("$CFG->wwwroot/$CFG->admin/index.php"); redirect("$CFG->wwwroot/$CFG->admin/index.php");
} }
@ -50,6 +46,7 @@
if (!$frm = data_submitted()) { if (!$frm = data_submitted()) {
print_simple_box("<center>".get_string("adminhelpassigncreators")."</center>", "center", "50%"); print_simple_box("<center>".get_string("adminhelpassigncreators")."</center>", "center", "50%");
$frm = new object();
/// A form was submitted so process the input /// A form was submitted so process the input

View file

@ -1,11 +1,11 @@
<?PHP // $Id$ <?PHP // $Id$
// dbperformance.php - shows latest ADOdb stats for the current server // dbperformance.php - shows latest ADOdb stats for the current server
require_once("../config.php"); require_once('../config.php');
$topframe = optional_param( 'topframe', '', PARAM_ALPHA); $topframe = optional_param('topframe', 0, PARAM_BOOL);
$bottomframe = optional_param( 'bottomframe', '', PARAM_ALPHA); $bottomframe = optional_param('bottomframe', 0, PARAM_BOOL);
$do = optional_param( 'do','',PARAM_ALPHA); $do = optional_param('do', '', PARAM_ALPHA);
require_login(); require_login();

View file

@ -7,8 +7,8 @@
require_login(); require_login();
$sure = optional_param('sure', ''); $sure = optional_param('sure', 0, PARAM_BOOL);
$reallysure = optional_param('reallysure', ''); $reallysure = optional_param('reallysure', 0, PARAM_BOOL);
if (!isadmin()) { if (!isadmin()) {
error('You must be admin to use this script!'); error('You must be admin to use this script!');

View file

@ -1,10 +1,12 @@
<?php // $Id$ <?php // $Id$
/// configuration routines for HTMLArea editor /// configuration routines for HTMLArea editor
require_once("../config.php"); require_once('../config.php');
require_login();
$currentpage = optional_param('tab', 1, PARAM_INT); $currentpage = optional_param('tab', 1, PARAM_INT);
require_login();
if (!isadmin()) { if (!isadmin()) {
error("Only admins can access this page"); error("Only admins can access this page");
} }
@ -27,16 +29,16 @@
} else { } else {
// Generate edit form // Generate edit form
$inactive = NULL; $inactive = array();
switch ( $currentpage ) { switch ( $currentpage ) {
case 1: case 1:
$currenttab = 'htmlarea'; $currenttab = 'htmlarea';
$inactive = array();
break; break;
case 2: case 2:
$currenttab = 'tinymce'; $currenttab = 'tinymce';
$inactive = array();
break; break;
default:
error("Unknown currentpage: $currentpage");
} }
$url = 'editor.php?tab='; $url = 'editor.php?tab=';

View file

@ -2,9 +2,9 @@
// enrol.php - allows admin to edit all enrollment variables // enrol.php - allows admin to edit all enrollment variables
// Yes, enrol is correct English spelling. // Yes, enrol is correct English spelling.
include("../config.php"); include('../config.php');
$enrol = optional_param('enrol', $CFG->enrol, PARAM_ALPHA); $enrol = optional_param('enrol', $CFG->enrol, PARAM_SAFEDIR);
require_login(); require_login();
@ -43,6 +43,7 @@
$modules = get_list_of_plugins("enrol"); $modules = get_list_of_plugins("enrol");
$options = array();
foreach ($modules as $module) { foreach ($modules as $module) {
$options[$module] = get_string("enrolname", "enrol_$module"); $options[$module] = get_string("enrolname", "enrol_$module");
} }

View file

@ -35,9 +35,8 @@
/// Parameters /// Parameters
$action = optional_param('action', '', PARAM_ALPHA); $action = optional_param('action', '', PARAM_ACTION);
$sesskey = optional_param('sesskey'); $version = optional_param('version', '', PARAM_FILE); //
$version = optional_param('version');
/// Security checks /// Security checks
require_login(); require_login();

View file

@ -2,8 +2,8 @@
// filter.php // filter.php
// Edit text filter settings // Edit text filter settings
require_once "../config.php"; require_once '../config.php';
require_once "$CFG->libdir/tablelib.php"; require_once $CFG->libdir.'/tablelib.php';
// check for allowed access // check for allowed access
require_login(); require_login();
@ -16,10 +16,12 @@
// get parameters // get parameters
$param = new Object; $param = new Object;
$param->filter = required_param( 'filter' );
$param->submit = optional_param( 'submit','',PARAM_ALPHA ); $param->filter = required_param('filter', PARAM_PATH);
$param->reset = optional_param( 'reset','',PARAM_ALPHA ); $param->submit = optional_param('submit', 0, PARAM_BOOL);
$filtername = substr( $param->filter, strpos( $param->filter, '/' )+1 ) ; $param->reset = optional_param('reset', 0, PARAM_BOOL);
$filtername = substr($param->filter, strpos( $param->filter, '/' )+1 ) ;
// get translated strings for use on page // get translated strings for use on page
$txt = new Object; $txt = new Object;