From f39309cba8f507a67c18cce4268a9d87cc62a15e Mon Sep 17 00:00:00 2001 From: scyrma Date: Thu, 1 May 2008 08:07:53 +0000 Subject: [PATCH] MDL-3381: Remove all remaining core calls to ctype_* functions and make ctype a recommended optional library. (backport from 1.9) --- admin/environment.xml | 15 +++++++++++++++ course/lib.php | 4 ++-- install/lang/en_utf8/installer.php | 2 ++ lang/en_utf8/admin.php | 2 ++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/admin/environment.xml b/admin/environment.xml index 4d07c5c4fc3..93379ad1fbc 100644 --- a/admin/environment.xml +++ b/admin/environment.xml @@ -122,6 +122,11 @@ + + + + + @@ -177,6 +182,11 @@ + + + + + @@ -244,6 +254,11 @@ + + + + + diff --git a/course/lib.php b/course/lib.php index ad6ceb9e2ca..70d2d3edd4c 100644 --- a/course/lib.php +++ b/course/lib.php @@ -326,7 +326,7 @@ function build_mnet_logs_array($hostid, $course, $user=0, $date=0, $order="l.tim if ($modaction) { $firstletter = substr($modaction, 0, 1); - if (ctype_alpha($firstletter)) { + if (preg_match('/[[:alpha:]]/', $firstletter)) { $where .= " AND\n lower(l.action) LIKE '%" . strtolower($modaction) . "%'"; } else if ($firstletter == '-') { $where .= " AND\n lower(l.action) NOT LIKE '%" . strtolower(substr($modaction, 1)) . "%'"; @@ -389,7 +389,7 @@ function build_logs_array($course, $user=0, $date=0, $order="l.time ASC", $limit if ($modaction) { $firstletter = substr($modaction, 0, 1); - if (ctype_alpha($firstletter)) { + if (preg_match('/[[:alpha:]]/', $firstletter)) { $joins[] = "lower(l.action) LIKE '%" . strtolower($modaction) . "%'"; } else if ($firstletter == '-') { $joins[] = "lower(l.action) NOT LIKE '%" . strtolower(substr($modaction, 1)) . "%'"; diff --git a/install/lang/en_utf8/installer.php b/install/lang/en_utf8/installer.php index 38d768a516b..fe03c3876b4 100644 --- a/install/lang/en_utf8/installer.php +++ b/install/lang/en_utf8/installer.php @@ -51,6 +51,8 @@ $string['configurationcompletehead'] = 'Configuration completed'; $string['configurationcompletesub'] = 'Moodle made an attempt to save your configuration in a file in the root of your Moodle installation.'; $string['continue'] = 'Continue'; $string['curlrecommended'] = 'Installing the optional Curl library is highly recommended in order to enable Moodle Networking functionality.'; +$string['ctyperecommended'] = 'Installing the optional CTYPE library is highly recommended in order to improve site performance, particularly if your site is supporting non-latin languages.'; +$string['ctyperequired'] = 'The ctype PHP extension is now required by Moodle, in order to improve site performance and to offer multilingual compatibility.'; $string['customcheck'] = 'Other Checks'; $string['database'] = 'Database'; $string['databasecreationsettings'] = 'Now you need to configure the database settings where most Moodle data diff --git a/lang/en_utf8/admin.php b/lang/en_utf8/admin.php index d27726dd768..e8168eeeeb7 100644 --- a/lang/en_utf8/admin.php +++ b/lang/en_utf8/admin.php @@ -214,6 +214,8 @@ $string['cronerrorpassword'] = 'Sorry, you have not provided a valid password to $string['cronremotepassword'] = 'Cron password for remote access'; $string['cronwarning'] = 'The cron.php maintenance script has not been run for at least 24 hours.'; $string['curlrecommended'] = 'Installing the optional Curl library is highly recommended in order to enable Moodle Networking functionality.'; +$string['ctyperecommended'] = 'Installing the optional ctype PHP extension is highly recommended in order to improve site performance, particularly if your site is supporting non-latin languages.'; +$string['ctyperequired'] = 'The ctype PHP extension is now required by Moodle, in order to improve site performance and to offer multilingual compatibility.'; $string['customcheck'] = 'Other Checks'; $string['datarootsecuritywarning'] = 'Your site configuration might not be secure. Please make sure that your dataroot directory ($a) is not directly accessible via web.'; $string['dbmigrate'] = 'Moodle Database Migration';