}
-/**
- * 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.
*
// 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;
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 .= '</' . $tag . '>';
}
- return $truncate;
+ return $truncate;
}