From 7710da22bdff316f35d75df30ec275472f0e2eee Mon Sep 17 00:00:00 2001 From: skodak Date: Tue, 7 Mar 2006 16:42:30 +0000 Subject: [PATCH] parameter cleaup - round 7; corrected search in user.php, semicolon in case fixed in utfdbmigrate (I wonder if it caused any problems) --- admin/user.php | 83 ++++++++++++++++++++---------------------- admin/users.php | 2 +- admin/utfdbmigrate.php | 14 +++---- 3 files changed, 48 insertions(+), 51 deletions(-) diff --git a/admin/user.php b/admin/user.php index 0d6587020f3..6d969893d57 100644 --- a/admin/user.php +++ b/admin/user.php @@ -1,38 +1,35 @@ firstname = get_string("admin"); - $user->lastname = get_string("user"); - $user->username = "admin"; - $user->password = md5("admin"); - $user->email = "root@localhost"; - $user->confirmed = 1; - $user->lang = $CFG->lang; - $user->maildisplay = 1; + $user->firstname = get_string("admin"); + $user->lastname = get_string("user"); + $user->username = "admin"; + $user->password = md5("admin"); + $user->email = "root@localhost"; + $user->confirmed = 1; + $user->lang = $CFG->lang; + $user->maildisplay = 1; $user->timemodified = time(); if (! $user->id = insert_record("user", $user)) { @@ -85,14 +82,14 @@ } if ($newuser and confirm_sesskey()) { // Create a new user - $user->auth = "manual"; - $user->firstname = ""; - $user->lastname = ""; - $user->username = "changeme"; - $user->password = ""; - $user->email = ""; - $user->lang = $CFG->lang; - $user->confirmed = 1; + $user->auth = "manual"; + $user->firstname = ""; + $user->lastname = ""; + $user->username = "changeme"; + $user->password = ""; + $user->email = ""; + $user->lang = $CFG->lang; + $user->confirmed = 1; $user->timemodified = time(); if (! $user->id = insert_record("user", $user)) { @@ -130,7 +127,7 @@ error("No such user!"); } - unset($confirmeduser); + $confirmeduser = new object(); $confirmeduser->id = $confirmuser; $confirmeduser->confirmed = 1; $confirmeduser->timemodified = time(); @@ -158,7 +155,7 @@ exit; } else if (!$user->deleted) { - unset($updateuser); + $updateuser = new object(); $updateuser->id = $user->id; $updateuser->deleted = "1"; $updateuser->username = "$user->email.".time(); // Remember it just in case @@ -199,7 +196,7 @@ $columnicon = " pixpath/t/$columnicon.gif\" alt=\"\" />"; } - $$column = "".$string[$column]."$columnicon"; + $$column = "".$string[$column]."$columnicon"; } if ($sort == "name") { @@ -262,15 +259,15 @@ echo ""; print_paging_bar($usercount, $page, $perpage, - "user.php?sort=$sort&dir=$dir&perpage=$perpage&firstinitial=$firstinitial&lastinitial=$lastinitial&search=$search&"); + "user.php?sort=$sort&dir=$dir&perpage=$perpage&firstinitial=$firstinitial&lastinitial=$lastinitial&search=".urlencode(stripslashes($search))."&"); flush(); if (!$users) { $match = array(); - if ($search) { - $match[] = $search; + if ($search !== '') { + $match[] = s($search); } if ($firstinitial) { $match[] = get_string("firstname").": $firstinitial"."___"; @@ -336,7 +333,7 @@ echo "
"; echo "
"; - echo ""; + echo ""; echo ""; if ($search) { echo ""; @@ -349,7 +346,7 @@ print_table($table); print_paging_bar($usercount, $page, $perpage, "user.php?sort=$sort&dir=$dir&perpage=$perpage". - "&firstinitial=$firstinitial&lastinitial=$lastinitial&search=$search&"); + "&firstinitial=$firstinitial&lastinitial=$lastinitial&search=".urlencode(stripslashes($search))."&"); print_heading("sesskey\">".get_string("addnewuser").""); } diff --git a/admin/users.php b/admin/users.php index 09b4be00ade..2f00a1a980c 100644 --- a/admin/users.php +++ b/admin/users.php @@ -1,6 +1,6 @@ dirroot.'/lib/adminlib.php'); + require_once($CFG->libdir.'/adminlib.php'); require_once($CFG->libdir.'/environmentlib.php'); require_login(); @@ -19,8 +19,8 @@ error ('unicode db migration has already been performed!'); } - $migrate = optional_param('migrate'); - $confirm = optional_param('confirm'); + $migrate = optional_param('migrate', 0, PARAM_BOOL); + $confirm = optional_param('confirm', 0, PARAM_BOOL); $textlib = textlib_get_instance(); @@ -151,8 +151,8 @@ function db_migrate2utf8(){ //Eloy: Perhaps some type of limit parameter here @ob_implicit_flush(true); @ob_end_flush(); - $maxrecords = optional_param('maxrecords',0, PARAM_INT); - $globallang = optional_param('globallang'); + $maxrecords = optional_param('maxrecords', 0, PARAM_INT); + $globallang = optional_param('globallang', '', PARAM_FILE); $processedrecords = 0; $ignoretables = array(); //list of tables to ignore, optional @@ -353,7 +353,7 @@ function db_migrate2utf8(){ //Eloy: Perhaps some type of limit parameter here break; - case 'PHP_FUNCTION'; //use the default php function to execute + case 'PHP_FUNCTION': //use the default php function to execute if ($debug) { $db->debug=999; }