From b378097c0311cbbe9da7aca4036a4817520a8b25 Mon Sep 17 00:00:00 2001 From: mudrd8mz Date: Thu, 30 Jul 2009 15:16:53 +0000 Subject: [PATCH] MDL-19972 reverting the previous commit Petr does not agree with adding this new function before require_login() and friends are re-thinked. --- lib/moodlelib.php | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 687a322234..826741a8e5 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -2231,17 +2231,6 @@ function require_login($courseorid=0, $autologinguest=true, $cm=null, $setwantsu } -/** - * Prints error if the user is logged in as guest user with username 'guest'. - * - * @return void - */ -function require_real_user($user=NULL) { - if (isguestuser($user)) { - print_error('guestsarenotallowed'); - } -} - /** * This function just makes sure a user is logged out. * @@ -7671,7 +7660,7 @@ function shorten_text($text, $ideal=30, $exact = false, $ending='...') { // if the words shouldn't be cut in the middle... if (!$exact) { // ...search the last occurance of a space... - for ($k=strlen($truncate);$k>0;$k--) { + for ($k=strlen($truncate);$k>0;$k--) { if (!empty($truncate[$k]) && ($char = $truncate[$k])) { if ($char == '.' or $char == ' ') { $breakpos = $k+1; @@ -7681,23 +7670,23 @@ function shorten_text($text, $ideal=30, $exact = false, $ending='...') { break; // character boundary. } } - } + } - if (isset($breakpos)) { + if (isset($breakpos)) { // ...and cut the text in this position $truncate = substr($truncate, 0, $breakpos); - } - } + } + } // add the defined ending to the text - $truncate .= $ending; + $truncate .= $ending; // close all unclosed html-tags foreach ($open_tags as $tag) { $truncate .= ''; } - return $truncate; + return $truncate; } -- 2.39.5