From 9152fc9938105282329a7cd4605ce22a573651c4 Mon Sep 17 00:00:00 2001 From: skodak Date: Sun, 28 Jan 2007 21:18:08 +0000 Subject: [PATCH] MDL-8323 finished full conversion to proper $COURSE global - no more $CFG->coursetheme, $CFG->courselang - improved course_setup(), current_language() and current_theme(); and Chameleon theme fixes needed for global $COURSE MDL-7962 chat seems to be completely broken in head (fixed wrong JS) * reworked chat themes support MDL-8338 Cron does not need cookies MDL-8339 forum cron capabilities problems * minor deprecated function current_encoding() cleanup --- admin/cron.php | 39 +++++----- lib/deprecatedlib.php | 10 +++ lib/moodlelib.php | 66 +++++------------ lib/weblib.php | 20 ++++-- mod/chat/chatd.php | 5 +- mod/chat/gui_header_js/chatinput.php | 15 ++-- mod/chat/gui_header_js/jsupdate.php | 19 ++--- mod/chat/gui_header_js/jsupdated.php | 19 ++--- mod/chat/gui_header_js/users.php | 22 +++--- mod/chat/gui_sockets/chatinput.php | 6 +- mod/chat/lib.php | 12 ---- mod/forum/lib.php | 38 ++++------ mod/wiki/ewiki/ewiki.php | 102 +++++++++++++-------------- theme/chameleon/ui/chameleon.php | 16 ++--- theme/chameleon/ui/css.php | 11 ++- user/editlib.php | 2 +- 16 files changed, 177 insertions(+), 225 deletions(-) diff --git a/admin/cron.php b/admin/cron.php index 7ad03d3290..47dfd097a2 100644 --- a/admin/cron.php +++ b/admin/cron.php @@ -17,7 +17,11 @@ /// from the command line. define('FULLME', 'cron'); - + + +/// Do not set moodle cookie because we do not need it here, it is better to emulate session + $nomoodlecookie = true; + /// The current directory in PHP version 4.3.0 and above isn't necessarily the /// directory of the script when run from the command line. The require_once() /// would fail, so we'll have to chdir() @@ -29,6 +33,10 @@ require_once(dirname(__FILE__) . '/../config.php'); require_once($CFG->libdir.'/adminlib.php'); +/// extra safety + @session_write_close(); + +/// check if execution allowed if (isset($_SERVER['REMOTE_ADDR'])) { // if the script is accessed via the web. if (!empty($CFG->cronclionly)) { // This script can only be run via the cli. @@ -46,28 +54,16 @@ } } - if (!$alreadyadmin = has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID))) { - unset($_SESSION['USER']); - unset($USER); - unset($_SESSION['SESSION']); - unset($SESSION); - $USER = get_admin(); /// Temporarily, to provide environment for this script - // we need to override the admin timezone to the moodle timezone! - $USER->timezone = $CFG->timezone; - } - //unset test cookie, user must login again anyway - setcookie('MoodleSessionTest'.$CFG->sessioncookie, '', time() - 3600, '/'); +/// emulate normal session + $SESSION = new object(); + $USER = get_admin(); /// Temporarily, to provide environment for this script -/// switch to site language and locale - if (!empty($CFG->courselang)) { - unset ($CFG->courselang); - } - if (!empty($SESSION->lang)) { - unset ($SESSION->lang); - } +/// ignore admins timezone, language and locale - use site deafult instead! + $USER->timezone = $CFG->timezone; $USER->lang = ''; - moodle_setlocale(); + $USER->theme = ''; + course_setup(SITEID); /// send mime type and encoding if (check_browser_version('MSIE')) { @@ -79,6 +75,9 @@ @header('Content-Type: text/plain; charset=utf-8'); } +/// no more headers and buffers + while(@ob_end_flush()); + /// Start output log $timenow = time(); diff --git a/lib/deprecatedlib.php b/lib/deprecatedlib.php index fa932916e1..771ed73559 100644 --- a/lib/deprecatedlib.php +++ b/lib/deprecatedlib.php @@ -912,6 +912,16 @@ function detect_munged_arguments($string, $allowdots=1) { return false; } +/** Deprecated function - returns the code of the current charset - originally depended on the selected language pack. + * + * @param $ignorecache not used anymore + * @return string always returns 'UTF-8' + */ +function current_charset($ignorecache = false) { + return 'UTF-8'; +} + + ///////////////////////////////////////////////////////////// /// Old functions not used anymore - candidates for removal ///////////////////////////////////////////////////////////// diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 7a84222ca2..fe2af18b63 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -1548,11 +1548,13 @@ function confirm_sesskey($sesskey=NULL) { } /** - * Setup all global $CFG course variables, set locale and also + * Setup all global $CFG course variables, set locale and also themes + * This function can be used on pages that do not require login instead of require_login() + * * @param mixed $courseorid id of the course or course object */ function course_setup($courseorid=0) { - global $COURSE, $HTTPSPAGEREQUIRED, $CFG; + global $COURSE, $CFG, $SITE, $USER; /// Redefine global $COURSE if needed if (empty($courseorid)) { @@ -1562,7 +1564,9 @@ function course_setup($courseorid=0) { $COURSE = clone($courseorid); } else { global $course; // used here only to prevent repeated fetching from DB - may be removed later - if ($course->id == $courseorid) { + if (!empty($course->id) and $course->id == SITEID) { + $COURSE = clone($SITE); + } else if (!empty($course->id) and $course->id == $courseorid) { $COURSE = clone($course); } else { if (!$COURSE = get_record('course', 'id', $courseorid)) { @@ -1571,33 +1575,10 @@ function course_setup($courseorid=0) { } } -/// set locale - we should use $COURSE->lang directly in the future -/// $CFG->courselang is now used in cron and chat to override current language and locale - if ($COURSE->id == SITEID or empty($COURSE->lang)) { - unset($CFG->courselang); - } else { - $CFG->courselang = $COURSE->lang; - } +/// set locale and themes moodle_setlocale(); - -/// setup themes - $COURSE->theme should be used instead of $CFG->coursetheme soon - if ($COURSE->id == SITEID or empty($CFG->allowcoursethemes) or empty($COURSE->theme)) { - unset($CFG->coursetheme); - } else { - $CFG->coursetheme = $COURSE->theme; - } theme_setup(); -/// We have to change some URLs in styles if we are in a $HTTPSPAGEREQUIRED page -/// in case theme changed after call to httpsrequired(); - if (!empty($HTTPSPAGEREQUIRED)) { - $CFG->themewww = str_replace('http:', 'https:', $CFG->themewww); - $CFG->pixpath = str_replace('http:', 'https:', $CFG->pixpath); - $CFG->modpixpath = str_replace('http:', 'https:', $CFG->modpixpath); - foreach ($CFG->stylesheets as $key => $stylesheet) { - $CFG->stylesheets[$key] = str_replace('http:', 'https:', $stylesheet); - } - } } /** @@ -4024,15 +4005,15 @@ function clean_filename($string) { * @return string */ function current_language() { - global $CFG, $USER, $SESSION; + global $CFG, $USER, $SESSION, $COURSE; - if (!empty($CFG->courselang)) { // Course language can override all other settings for this page - $return = $CFG->courselang; + if (!empty($OURSE->lang)) { // Course language can override all other settings for this page + $return = $OURSE->lang; } else if (!empty($SESSION->lang)) { // Session language can override other settings $return = $SESSION->lang; - } else if (!empty($USER->lang)) { // User language can override site language + } else if (!empty($USER->lang)) { $return = $USER->lang; } else { @@ -4046,15 +4027,6 @@ function current_language() { return $return; } -/* Obsoleted function - returns the code of the current charset - originally depended on the selected language pack. - * - * @param $ignorecache not used anymore - * @return string always returns 'UTF-8' - */ -function current_charset($ignorecache = false) { - return 'UTF-8'; -} - /** * Prints out a translated string. * @@ -5874,13 +5846,9 @@ function httpsrequired() { $CFG->httpswwwroot = str_replace('http:', 'https:', $CFG->wwwroot); $CFG->httpsthemewww = str_replace('http:', 'https:', $CFG->themewww); - // change theme paths to pictures - $CFG->themewww = str_replace('http:', 'https:', $CFG->themewww); - $CFG->pixpath = str_replace('http:', 'https:', $CFG->pixpath); - $CFG->modpixpath = str_replace('http:', 'https:', $CFG->modpixpath); - foreach ($CFG->stylesheets as $key => $stylesheet) { - $CFG->stylesheets[$key] = str_replace('http:', 'https:', $stylesheet); - } + // change theme URLs to https + theme_setup(); + } else { $CFG->httpswwwroot = $CFG->wwwroot; $CFG->httpsthemewww = $CFG->themewww; @@ -6543,11 +6511,13 @@ function check_dir_exists($dir, $create=false, $recursive=false) { function report_session_error() { global $CFG, $FULLME; - theme_setup(); // Sets up theme global variables if (empty($CFG->lang)) { $CFG->lang = "en"; } + // Set up default theme and locale + theme_setup(); moodle_setlocale(); + //clear session cookies setcookie('MoodleSession'.$CFG->sessioncookie, '', time() - 3600, $CFG->sessioncookiepath); setcookie('MoodleSessionTest'.$CFG->sessioncookie, '', time() - 3600, $CFG->sessioncookiepath); diff --git a/lib/weblib.php b/lib/weblib.php index 59de6d1cc4..abdd7934d8 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -2338,18 +2338,18 @@ function print_footer($course=NULL, $usercourse=NULL, $return=false) { * @return string */ function current_theme() { - global $CFG, $USER, $SESSION; + global $CFG, $USER, $SESSION, $COURSE; if (!empty($CFG->pagetheme)) { // Page theme is for special page-only themes set by code return $CFG->pagetheme; - } else if (!empty($CFG->coursetheme) and !empty($CFG->allowcoursethemes)) { // Course themes override others - return $CFG->coursetheme; + } else if (!empty($CFG->allowcoursethemes) and !empty($COURSE->theme)) { // Course themes override others + return $COURSE->theme; } else if (!empty($SESSION->theme)) { // Session theme can override other settings return $SESSION->theme; - } else if (!empty($USER->theme) and !empty($CFG->allowuserthemes)) { // User theme can override site theme + } else if (!empty($CFG->allowuserthemes) and !empty($USER->theme)) { // User theme can override site theme return $USER->theme; } else { @@ -2516,7 +2516,7 @@ function style_sheet_setup($lastmodified=0, $lifetime=300, $themename='', $force function theme_setup($theme = '', $params=NULL) { /// Sets up global variables related to themes - global $CFG, $THEME, $SESSION, $USER; + global $CFG, $THEME, $SESSION, $USER, $HTTPSPAGEREQUIRED; if (empty($theme)) { $theme = current_theme(); @@ -2574,6 +2574,16 @@ function theme_setup($theme = '', $params=NULL) { } $CFG->stylesheets[] = $CFG->themewww.'/'.$theme.'/styles.php'.$paramstring; +/// We have to change some URLs in styles if we are in a $HTTPSPAGEREQUIRED page + if (!empty($HTTPSPAGEREQUIRED)) { + $CFG->themewww = str_replace('http:', 'https:', $CFG->themewww); + $CFG->pixpath = str_replace('http:', 'https:', $CFG->pixpath); + $CFG->modpixpath = str_replace('http:', 'https:', $CFG->modpixpath); + foreach ($CFG->stylesheets as $key => $stylesheet) { + $CFG->stylesheets[$key] = str_replace('http:', 'https:', $stylesheet); + } + } + } diff --git a/mod/chat/chatd.php b/mod/chat/chatd.php index a6dd9d883d..86c462a8ef 100755 --- a/mod/chat/chatd.php +++ b/mod/chat/chatd.php @@ -228,7 +228,7 @@ class ChatDaemon { static $str; $info = &$this->sets_info[$sessionid]; - chat_force_language($info['lang']); + course_setup($info['course'], $info['user']); $timenow = time(); @@ -501,6 +501,7 @@ class ChatDaemon { $this->sets_info[$sessionid] = array( 'lastinfocommit' => 0, 'lastmessageindex' => 0, + 'course' => $course, 'courseid' => $course->id, 'chatuser' => $chatuser, 'chatid' => $chat->id, @@ -706,7 +707,7 @@ class ChatDaemon { { // Simply give them the message - chat_force_language($info['lang']); + course_setup($info['course'], $info['user']); $output = chat_format_message_manually($message, $info['courseid'], $sender, $info['user']); $this->trace('Delivering message "'.$output->text.'" to '.$this->conn_sets[$sessionid][CHAT_CONNECTION_CHANNEL]); diff --git a/mod/chat/gui_header_js/chatinput.php b/mod/chat/gui_header_js/chatinput.php index 4fbf97affb..c389234b41 100644 --- a/mod/chat/gui_header_js/chatinput.php +++ b/mod/chat/gui_header_js/chatinput.php @@ -11,16 +11,11 @@ error('Not logged in!'); } - //Get the course theme - $COURSE = get_record('course','id',$chatuser->course); - //Get the user theme - $USER = get_record('user','id',$chatuser->userid); - - //Adjust the prefered theme (main, course, user) - theme_setup(); + $USER = get_record('user', 'id', $chatuser->userid); - chat_force_language($chatuser->lang); + //Setup course, lang and theme + course_setup($chatuser->course); ob_start(); ?> @@ -31,10 +26,10 @@ if(waitFlag) return false; waitFlag = true; var input_chat_message = document.getElementById('input_chat_message'); - getElementById('sendForm').chat_message.value = input_chat_message.value; + document.getElementById('sendForm').chat_message.value = input_chat_message.value; input_chat_message.value = ''; input_chat_message.className = 'wait'; - getElementById('sendForm').submit(); + document.getElementById('sendForm').submit(); enableForm(); return false; } diff --git a/mod/chat/gui_header_js/jsupdate.php b/mod/chat/gui_header_js/jsupdate.php index 5b15a73413..f6825f5fdd 100644 --- a/mod/chat/gui_header_js/jsupdate.php +++ b/mod/chat/gui_header_js/jsupdate.php @@ -13,26 +13,19 @@ error('Not logged in!'); } - //Get the course theme - $course = get_record('course','id',$chatuser->course,'','','','','id,theme'); - //Set the course theme if necessary - if (!empty($course->theme)) { - if (!empty($CFG->allowcoursethemes)) { - $CFG->coursetheme = $course->theme; - } + //Get the minimal course + if (!$course = get_record('course','id',$chatuser->course,'','','','','id,theme,lang')) { + error('incorrect course id'); } //Get the user theme and enough info to be used in chat_format_message() which passes it along to - // chat_format_message_manually() -- and only id and timezone are used. - if (!$USER = get_record('user','id',$chatuser->userid,'','','','','id, theme, username, timezone')) { + if (!$USER = get_record('user','id',$chatuser->userid,'','','','','id, lang, theme, username, timezone')) { error('User does not exist!'); } $USER->description = ''; - //Adjust the prefered theme (main, course, user) - theme_setup(); - - chat_force_language($chatuser->lang); + //Setup course, lang and theme + course_setup($course); // force deleting of timed out users if there is a silence in room or just entering if ((time() - $chat_lasttime) > $CFG->chat_old_ping) { diff --git a/mod/chat/gui_header_js/jsupdated.php b/mod/chat/gui_header_js/jsupdated.php index 675e631206..b9f657bd8b 100644 --- a/mod/chat/gui_header_js/jsupdated.php +++ b/mod/chat/gui_header_js/jsupdated.php @@ -35,25 +35,20 @@ error('Not logged in!'); } - //Get the course theme - $course = get_record('course','id',$chatuser->course,'','','','','id,theme'); - //Set the course theme if necessary - if (!empty($course->theme)) { - if (!empty($CFG->allowcoursethemes)) { - $CFG->coursetheme = $course->theme; - } + //Get the minimal course + if (!$course = get_record('course','id',$chatuser->course,'','','','','id,theme,lang')) { + error('incorrect course id'); } + //Get the user theme and enough info to be used in chat_format_message() which passes it along to // chat_format_message_manually() -- and only id and timezone are used. - if (!$USER = get_record('user','id',$chatuser->userid,'','','','','id, theme, username, timezone')) { + if (!$USER = get_record('user','id',$chatuser->userid,'','','','','id, lang, theme, username, timezone')) { error('User does not exist!'); } $USER->description = ''; - //Adjust the prefered theme (main, course, user) - theme_setup(); - - chat_force_language($chatuser->lang); + //Setup course, lang and theme + course_setup($course); // force deleting of timed out users if there is a silence in room or just entering if ((time() - $chat_lasttime) > $CFG->chat_old_ping) { diff --git a/mod/chat/gui_header_js/users.php b/mod/chat/gui_header_js/users.php index eead4f30af..9cd107c5af 100644 --- a/mod/chat/gui_header_js/users.php +++ b/mod/chat/gui_header_js/users.php @@ -12,21 +12,19 @@ error('Not logged in!'); } - //Get the course theme - $course = get_record('course','id',$chatuser->course,'','','','','id,theme'); - //Set the course theme if necessary - if (!empty($course->theme)) { - if (!empty($CFG->allowcoursethemes)) { - $CFG->coursetheme = $course->theme; - } + //Get the minimal course + if (!$course = get_record('course','id',$chatuser->course,'','','','','id,theme,lang')) { + error('incorrect course id'); } - //Get the user theme - $USER = get_record('user','id',$chatuser->userid,'','','','','id, theme'); - //Adjust the prefered theme (main, course, user) - theme_setup(); + //Get the user theme and enough info to be used in chat_format_message() which passes it along to + if (!$USER = get_record('user','id',$chatuser->userid,'','','','','id, lang, theme, username, timezone')) { + error('User does not exist!'); + } + $USER->description = ''; - chat_force_language($chatuser->lang); + //Setup course, lang and theme + course_setup($course); $courseid = $chatuser->course; diff --git a/mod/chat/gui_sockets/chatinput.php b/mod/chat/gui_sockets/chatinput.php index d89c9e5c3e..c33e2ccb86 100644 --- a/mod/chat/gui_sockets/chatinput.php +++ b/mod/chat/gui_sockets/chatinput.php @@ -11,7 +11,11 @@ error('Not logged in!'); } - chat_force_language($chatuser->lang); + //Get the user theme + $USER = get_record('user', 'id', $chatuser->userid); + + //Setup course, lang and theme + course_setup($chatuser->course); ob_start(); ?> diff --git a/mod/chat/lib.php b/mod/chat/lib.php index f924e898b2..7fe38cead7 100644 --- a/mod/chat/lib.php +++ b/mod/chat/lib.php @@ -311,18 +311,6 @@ function chat_refresh_events($courseid = 0) { return true; } -function chat_force_language($lang) { -/// This function prepares moodle to operate in given language -/// usable when $nomoodlecookie = true; -/// BEWARE: there must be no $course, $USER or $SESSION - global $CFG; - - if(!empty($CFG->courselang)) { - unset($CFG->courselang); - } - $CFG->lang = $lang; - moodle_setlocale(); -} ////////////////////////////////////////////////////////////////////// /// Functions that require some SQL diff --git a/mod/forum/lib.php b/mod/forum/lib.php index 41ca909eef..411e71efee 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -230,9 +230,7 @@ function forum_cron() { $strforums = get_string('forums', 'forum'); } - if (!empty($USER->id)) { // Remember real USER account if necessary - $realuser = $USER; - } + $realuser = clone($USER); /// Posts older than 2 days will not be mailed. This is to avoid the problem where /// cron has not been running for a long time, and then suddenly people are flooded @@ -301,12 +299,6 @@ function forum_cron() { ); - if (!empty($course->lang)) { - $CFG->courselang = $course->lang; - } else { - unset($CFG->courselang); - } - // Get coursemodule record (and cache these) if (!empty($cachecm[$forum->id])) { @@ -366,8 +358,8 @@ function forum_cron() { /// Override the language and timezone of the "current" user, so that /// mail is customised for the receiver. - $USER->lang = $userto->lang; - $USER->timezone = $userto->timezone; + $USER = $userto; + course_setup($course); $postsubject = "$course->shortname: ".format_string($post->subject,true); $posttext = forum_make_mail_text($course, $forum, $discussion, $post, $userfrom, $userto); @@ -405,15 +397,7 @@ function forum_cron() { } } - unset($CFG->courselang); - - if (!empty($realuser)) { // Restore real USER timezone if necessary - $sitetimezone = $realuser->timezone; - $USER->lang = $realuser->lang; - } else { - $sitetimezone = $CFG->timezone; - $USER->lang = $CFG->lang; - } + $sitetimezone = $CFG->timezone; /// Now see if there are any digest mails waiting to be sent, and if we should send them @@ -470,8 +454,8 @@ function forum_cron() { /// Override the language and timezone of the "current" user, so that /// mail is customised for the receiver. - $USER->lang = $userto->lang; - $USER->timezone = $userto->timezone; + $USER = $userto; + course_setup(SITEID); $postsubject = get_string('digestmailsubject', 'forum', $site->shortname); @@ -505,6 +489,9 @@ function forum_cron() { continue; } + //override language + course_setup($course); + $canunsubscribe = ! forum_is_forcesubscribed($forum->id); $canreply = forum_user_can_post($forum, $userto); @@ -618,9 +605,8 @@ function forum_cron() { mtrace(get_string('digestsentusers', 'forum', $usermailcount)); } - if (!empty($realuser)) { // Restore real USER if necessary - $USER = $realuser; - } + $USER = $realuser; + course_setup(SITEID); // reset cron user language, theme and timezone settings if (!empty($CFG->forum_lastreadclean)) { $timenow = time(); @@ -1660,7 +1646,7 @@ function forum_subscribed_users($course, $forum, $groupid=0, $cache=false) { $results = get_course_users($course->id); // Otherwise get everyone in the course } else { $results = get_records_sql("SELECT u.id, u.username, u.firstname, u.lastname, u.maildisplay, u.mailformat, u.maildigest, u.emailstop, - u.email, u.city, u.country, u.lastaccess, u.lastlogin, u.picture, u.timezone, u.lang, u.trackforums + u.email, u.city, u.country, u.lastaccess, u.lastlogin, u.picture, u.timezone, u.theme, u.lang, u.trackforums FROM {$CFG->prefix}user u, {$CFG->prefix}forum_subscriptions s $grouptables WHERE s.forum = '$forum->id' diff --git a/mod/wiki/ewiki/ewiki.php b/mod/wiki/ewiki/ewiki.php index bd82f68636..677be7944d 100644 --- a/mod/wiki/ewiki/ewiki.php +++ b/mod/wiki/ewiki/ewiki.php @@ -3,12 +3,12 @@ /* ErfurtWiki - an embedable, fast and user-friendly wiki engine - ¯¯¯¯¯¯¯¯¯¯ + ���������� This is Public Domain (no license, no warranty); but feel free to redistribute it under GPL or anything else you like. http://erfurtwiki.sourceforge.net/ - Mario Salzer and many others(tm) + Mario Salzer and many others(tm) Use it from inside yoursite.php like that: @@ -75,7 +75,7 @@ define("EWIKI_UP_UPLOAD", "upload"); #- other stuff define("EWIKI_DEFAULT_LANG", "en"); - define("EWIKI_CHARSET", current_charset()); + define("EWIKI_CHARSET", "UTF-8"); #- user permissions define("EWIKI_PROTECTED_MODE", 0); # disable funcs + require auth define("EWIKI_PROTECTED_MODE_HIDING", 0); # hides disallowed actions @@ -93,7 +93,7 @@ else { #### END MOODLE CHANGES - define("EWIKI_CHARS_L", "a-z_µ¤$\337-\377"); + define("EWIKI_CHARS_L", "a-z_��$\337-\377"); define("EWIKI_CHARS_U", "A-Z0-9\300-\336"); #### BEGIN MOODLE CHANGES @@ -258,7 +258,7 @@ ## "###" => array("", ""), "**" => array("", ""), "##" => array("", ""), - "µµ" => array("", ""), + "��" => array("", ""), ), "wm_start_end" => array( ), @@ -352,79 +352,79 @@ )); # $ewiki_t["es"] = @array_merge(@$ewiki_t["es"], array( - "EDITTHISPAGE" => "EditarEstaPágina", + "EDITTHISPAGE" => "EditarEstaP�gina", "BACKLINKS" => "EnlacesInversos", - "PAGESLINKINGTO" => "Páginas enlazando \$title", - "PAGEHISTORY" => "InfoPágina", - "INFOABOUTPAGE" => "Información sobre la página", - "LIKEPAGES" => "Páginas como esta", - "NEWESTPAGES" => "Páginas más nuevas", - "LASTCHANGED" => "última modificación %d/%m/%Y a las %H:%M", - "DOESNOTEXIST" => "Esta página aún no existe, por favor eliga EditarEstaPágina si desea crearla.", - "DISABLEDPAGE" => "Esta página no está disponible en este momento.", - "ERRVERSIONSAVE" => "Disculpe, mientras editaba esta página alguién más - salvó una versión modificada. Por favor regrese a + "PAGESLINKINGTO" => "P�ginas enlazando \$title", + "PAGEHISTORY" => "InfoP�gina", + "INFOABOUTPAGE" => "Informaci�n sobre la p�gina", + "LIKEPAGES" => "P�ginas como esta", + "NEWESTPAGES" => "P�ginas m�s nuevas", + "LASTCHANGED" => "�ltima modificaci�n %d/%m/%Y a las %H:%M", + "DOESNOTEXIST" => "Esta p�gina a�n no existe, por favor eliga EditarEstaP�gina si desea crearla.", + "DISABLEDPAGE" => "Esta p�gina no est� disponible en este momento.", + "ERRVERSIONSAVE" => "Disculpe, mientras editaba esta p�gina algui�n m�s + salv� una versi�n modificada. Por favor regrese a a la pantalla anterior y copie sus cambios a su computador - para insertalos nuevamente después de que cargue - la pantalla de edición.", - "ERRORSAVING" => "Ocurrió un error mientras se salvavan sus cambios. Por favor intente de nuevo.", - "THANKSFORCONTRIBUTION" => "Gracias por su contribución!", - "CANNOTCHANGEPAGE" => "Esta página no puede ser modificada.", - "OLDVERCOMEBACK" => "Hacer que esta versión antigua regrese a remplazar la actual", + para insertalos nuevamente despu�s de que cargue + la pantalla de edici�n.", + "ERRORSAVING" => "Ocurri� un error mientras se salvavan sus cambios. Por favor intente de nuevo.", + "THANKSFORCONTRIBUTION" => "Gracias por su contribuci�n!", + "CANNOTCHANGEPAGE" => "Esta p�gina no puede ser modificada.", + "OLDVERCOMEBACK" => "Hacer que esta versi�n antigua regrese a remplazar la actual", "PREVIEW" => "Previsualizar", "SAVE" => "Salvar", - "CANCEL_EDIT" => "CancelarEdición", - "UPLOAD_PICTURE_BUTTON" => "subir gráfica >>>", + "CANCEL_EDIT" => "CancelarEdici�n", + "UPLOAD_PICTURE_BUTTON" => "subir gr�fica >>>", "EDIT_FORM_1" => "BuenEstilo es escribir lo que viene a su mente. No se preocupe mucho - por la apariencia. También puede agregar ReglasDeMarcadoWiki - más adelante si piensa que es necesario.
", + por la apariencia. Tambi�n puede agregar ReglasDeMarcadoWiki + m�s adelante si piensa que es necesario.
", "EDIT_FORM_2" => "
Por favor no escriba cosas, que puedan enfadar a otras personas. Y por favor tenga en mente que - usted no es del todo anónimo en Internet - (encuentre más sobre + usted no es del todo an�nimo en Internet + (encuentre m�s sobre 'IP address' de su computador con Google).", - "BIN_IMGTOOLARGE" => "¡La gráfica es demasiado grande!", - "BIN_NOIMG" => "¡No es un archivo con una gráfica (formato de archivo inaceptable)!", - "FORBIDDEN" => "No está autorizado para acceder a esta página.", + "BIN_IMGTOOLARGE" => "�La gr�fica es demasiado grande!", + "BIN_NOIMG" => "�No es un archivo con una gr�fica (formato de archivo inaceptable)!", + "FORBIDDEN" => "No est� autorizado para acceder a esta p�gina.", )); # $ewiki_t["de"] = @array_merge(@$ewiki_t["de"], array( - "EDITTHISPAGE" => "DieseSeiteÄndern", - "APPENDTOPAGE" => "Ergänze", - "BACKLINKS" => "ZurückLinks", + "EDITTHISPAGE" => "DieseSeite�ndern", + "APPENDTOPAGE" => "Erg�nze", + "BACKLINKS" => "Zur�ckLinks", "PAGESLINKINGTO" => "Verweise zur Seite \$title", "PAGEHISTORY" => "SeitenInfo", - "INFOABOUTPAGE" => "Informationen über Seite", - "LIKEPAGES" => "Ähnliche Seiten", + "INFOABOUTPAGE" => "Informationen �ber Seite", + "LIKEPAGES" => "�hnliche Seiten", "NEWESTPAGES" => "Neueste Seiten", - "LASTCHANGED" => "zuletzt geändert am %d.%m.%Y um %H:%M", + "LASTCHANGED" => "zuletzt ge�ndert am %d.%m.%Y um %H:%M", "DISABLEDPAGE" => "Diese Seite kann momentan nicht angezeigt werden.", - "ERRVERSIONSAVE" => "Entschuldige, aber während Du an der Seite - gearbeitet hast, hat bereits jemand anders eine geänderte + "ERRVERSIONSAVE" => "Entschuldige, aber w�hrend Du an der Seite + gearbeitet hast, hat bereits jemand anders eine ge�nderte Fassung gespeichert. Damit nichts verloren geht, browse bitte - zurück und speichere Deine Änderungen in der Zwischenablage + zur�ck und speichere Deine �nderungen in der Zwischenablage (Bearbeiten->Kopieren) um sie dann wieder an der richtigen - Stelle einzufügen, nachdem du die EditBoxSeite nocheinmal + Stelle einzuf�gen, nachdem du die EditBoxSeite nocheinmal geladen hast.
- Vielen Dank für Deine Mühe.", + Vielen Dank f�r Deine M�he.", "ERRORSAVING" => "Beim Abspeichern ist ein Fehler aufgetreten. Bitte versuche es erneut.", - "THANKSFORCONTRIBUTION" => "Vielen Dank für Deinen Beitrag!", - "CANNOTCHANGEPAGE" => "Diese Seite kann nicht geändert werden.", + "THANKSFORCONTRIBUTION" => "Vielen Dank f�r Deinen Beitrag!", + "CANNOTCHANGEPAGE" => "Diese Seite kann nicht ge�ndert werden.", "OLDVERCOMEBACK" => "Diese alte Version der Seite wieder zur Aktuellen machen", "PREVIEW" => "Vorschau", "SAVE" => "Speichern", - "CANCEL_EDIT" => "ÄnderungenVerwerfen", + "CANCEL_EDIT" => "�nderungenVerwerfen", "UPLOAD_PICTURE_BUTTON" => "Bild hochladen >>>", "EDIT_FORM_1" => "GuterStil ist es, ganz einfach das zu schreiben, was einem gerade in den Sinn kommt. Du solltest dich jetzt noch nicht so sehr - darum kümmern, wie die Seite aussieht. Du kannst später - immernoch zurückkommen und den Text mit WikiTextFormatierungsRegeln + darum k�mmern, wie die Seite aussieht. Du kannst sp�ter + immernoch zur�ckkommen und den Text mit WikiTextFormatierungsRegeln aufputschen.
", "EDIT_FORM_2" => "
Bitte schreib keine Dinge, die andere Leute - verärgern könnten. Und bedenke auch, daß es schnell auf - dich zurückfallen kann wenn du verschiedene andere Dinge sagst (mehr Informationen zur + ver�rgern k�nnten. Und bedenke auch, da� es schnell auf + dich zur�ckfallen kann wenn du verschiedene andere Dinge sagst (mehr Informationen zur 'IP Adresse' deines Computers findest du bei Google).", )); @@ -635,7 +635,7 @@ function ewiki_etag(&$data) { #-- encloses whole page output with a descriptive
function ewiki_page_css_container(&$o, &$id, &$data, &$action) { $o = "
| @µöäüÖÄÜߤ^°«»\'\\', + . strtr($id, ' ./ --_!"�$%&()=?��{[]}`+#*;:,<>| @�������ߤ^���\'\\', '- -----------------------------------------------') . "\">\n" . $o . "\n
\n"; @@ -2180,7 +2180,7 @@ function ewiki_format_html(&$str, &$in, &$iii, &$s) { function ewiki_format_comment(&$str, &$in, &$iii, &$s, $btype) { - $str = ""; + $str = ""; } diff --git a/theme/chameleon/ui/chameleon.php b/theme/chameleon/ui/chameleon.php index 3bf627c2fd..aac69aa330 100644 --- a/theme/chameleon/ui/chameleon.php +++ b/theme/chameleon/ui/chameleon.php @@ -1,23 +1,21 @@ chameleonenabled) && $THEME->chameleonenabled) { +if (!empty($THEME->chameleonenabled)) { $chameleon_isadmin = has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID)); $chameleon_isteacher = false; - if (isset($course->id)) { - $chameleon_courseparam = '?id=' . $course->id; - if (!$chameleon_isadmin) { - $chameleon_isteacher = (has_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, $course->id)) && isset($CFG->coursetheme)); - } - } else { + if ($COURSE->id == SITEID) { $chameleon_courseparam = ''; + } else { + $chameleon_courseparam = '?id=' . $COURSE->id; + $chameleon_isteacher = !empty($COURSE->theme) and has_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, $COURSE->id)); } - if ($chameleon_isadmin || ($chameleon_isteacher && !empty($CFG->allowcoursethemes) && !empty($THEME->chameleonteachereditenabled))) { + if ($chameleon_isadmin or ($chameleon_isteacher and !empty($CFG->allowcoursethemes) and !empty($THEME->chameleonteachereditenabled))) { // either we're an admin or we're a teacher and this is being used as the course theme // if we're on a page using a course theme edit that, otherwise edit the main chameleon theme // $chameleon_theme = (isset($CFG->coursetheme)) ? $CFG->coursetheme : $CFG->theme; - $chameleon_theme = (isset($CFG->coursetheme)) ? $CFG->coursetheme : current_theme(); + $chameleon_theme = current_theme(); ?> diff --git a/theme/chameleon/ui/css.php b/theme/chameleon/ui/css.php index dd4239087d..3b78f645ff 100644 --- a/theme/chameleon/ui/css.php +++ b/theme/chameleon/ui/css.php @@ -8,10 +8,15 @@ if (empty($THEME->chameleonenabled)) { die('CHAMELEON_ERROR Editing this theme has been disabled'); } +$id = optional_param('id', SITEID, PARAM_INT); +if (!$course = get_record('course', 'id', $id)) { + error('Incorrect course id'); +} + +course_setup($course); // we should not require login here -$chameleon_id = isset($_GET['id']) ? (int) $_GET['id'] : 0; -if ($chameleon_id != 0 && !empty($CFG->allowcoursethemes) && !empty($THEME->chameleonteachereditenabled)) { - if (!has_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, $chameleon_id))) { +if ($id != SITEID and !empty($CFG->allowcoursethemes) and !empty($course->theme) and !empty($THEME->chameleonteachereditenabled)) { + if (!has_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, $id))) { die('CHAMELEON_ERROR Either you are not logged in or you are not allowed to edit this theme'); } } else if (!has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID))) { diff --git a/user/editlib.php b/user/editlib.php index 6b18319e5f..4a8ce73db3 100644 --- a/user/editlib.php +++ b/user/editlib.php @@ -96,7 +96,7 @@ function useredit_shared_definition(&$mform) { if (!empty($CFG->sitemailcharset)) { $choices['0'] = get_string('site').' ('.$CFG->sitemailcharset.')'; } else { - $choices['0'] = get_string('site').' ('.current_charset().')'; + $choices['0'] = get_string('site').' (UTF-8)'; } $choices = array_merge($choices, $charsets); $mform->addElement('select', 'preference_mailcharset', get_string('emailcharset'), $choices); -- 2.39.5