37                 return "<img src=\"".ilUtil::getImagePath(
$filename).
"\" alt=\"".$lng->txt(
"obj_".$a_type).
"\" title=\"".$lng->txt(
"obj_".$a_type).
"\" border=\"0\" vspace=\"0\"/>";
 
   56                 if($ilSetting->get(
"custom_icons"))
 
   63                                         include_once(
'./Services/Container/classes/class.ilContainer.php');
 
   96                 global $ilias, $styleDefinition, 
$ilCtrl, $ilUser;
 
   98                 if (is_int(strpos($_SERVER[
"PHP_SELF"], 
"setup.php")))
 
  102                 if ($module_path != 
"")
 
  104                         $module_path = 
"/".$module_path;
 
  108                 $default_img = 
".".$module_path.
"/templates/default/images/".
$img;
 
  110                 if (is_object($styleDefinition))
 
  112                         $image_dir = $styleDefinition->getImageDirectory($ilias->account->prefs[
"style"]);
 
  114                 if ($ilUser->skin == 
"default")
 
  116                         $user_img = 
".".$module_path.
"/templates/default/".$image_dir.
"/".
$img;
 
  117                         $skin_img = 
".".$module_path.
"/templates/default/images/".
$img;
 
  119                 else if (is_object($styleDefinition) && $ilUser->skin != 
"default")
 
  121                         $user_img = 
"./Customizing/global/skin/".
 
  122                                 $ilias->account->skin.$module_path.
"/".$image_dir.
"/".
$img;
 
  123                         $skin_img = 
"./Customizing/global/skin/".
 
  124                                 $ilias->account->skin.$module_path.
"/images/".
$img;
 
  129                         return "./images/".$img;
 
  131                 else if (@file_exists($user_img) && $image_dir != 
"")
 
  135                 else if (file_exists($skin_img))
 
  153         if (substr($relative_path, 0, 2) == 
'./')
 
  155             $relative_path = (substr($relative_path, 1));
 
  157         if (substr($relative_path, 0, 1) != 
'/')
 
  159             $relative_path = 
'/' . $relative_path;
 
  161         $htmlpath = ILIAS_HTTP_PATH . $relative_path;
 
  180                 $stylesheet_name = (strlen($a_css_name)) ? $a_css_name : $ilias->account->prefs[
"style"].
".css";
 
  181                 if (strlen($a_css_location) && (strcmp(substr($a_css_location, -1), 
"/") != 0)) $a_css_location = $a_css_location . 
"/";
 
  184                 if ($ilias->account->skin != 
"default")
 
  186                         $filename = 
"./Customizing/global/skin/".$ilias->account->skin.
"/".$a_css_location.$stylesheet_name;
 
  190                         $filename = 
"./" . $a_css_location . 
"templates/default/".$stylesheet_name;
 
  193                 if ($mode != 
"filesystem")
 
  195                         $vers = str_replace(
" ", 
"-", $ilias->getSetting(
"ilias_version"));
 
  196                         $vers = 
"?vers=".str_replace(
".", 
"-", $vers);
 
  209         function getJSLocation($a_js_name, $a_js_location = 
"", $add_version = FALSE)
 
  214                 $js_name = $a_js_name;
 
  215                 if (strlen($a_js_location) && (strcmp(substr($a_js_location, -1), 
"/") != 0)) $a_js_location = $a_js_location . 
"/";
 
  218                 if ($ilias->account->skin != 
"default")
 
  220                         $filename = 
"./Customizing/global/skin/".$ilias->account->skin.
"/".$a_js_location.$js_name;
 
  224                         $filename = 
"./" . $a_js_location . 
"templates/default/".$js_name;
 
  229                         $vers = str_replace(
" ", 
"-", $ilias->getSetting(
"ilias_version"));
 
  230                         $vers = 
"?vers=".str_replace(
".", 
"-", $vers);
 
  244                 if (defined(
"ILIAS_MODULE"))
 
  249                                 $base .= 
"../Services/Privacy/";
 
  254                         $base = 
"./Services/Privacy/";
 
  257                 if (is_file($base.
"w3c/p3p.xml"))
 
  259                         return ILIAS_HTTP_PATH.
"w3c/p3p.xml";
 
  263                         return ILIAS_HTTP_PATH.
"/w3c/p3p_template.xml";
 
  277                 if ($mode != 
"filesystem")
 
  279                         $vers = str_replace(
" ", 
"-", $ilias->getSetting(
"ilias_version"));
 
  280                         $vers = 
"?vers=".str_replace(
".", 
"-", $vers);
 
  283                 if ($ilias->account->skin == 
"default")
 
  285                         $in_style = 
"./templates/".$ilias->account->skin.
"/".$ilias->account->prefs[
"style"].
"_cont.css";
 
  289                         $in_style = 
"./Customizing/global/skin/".$ilias->account->skin.
"/".$ilias->account->prefs[
"style"].
"_cont.css";
 
  292                 if (is_file(
"./".$in_style))
 
  294                         return $in_style.$vers;
 
  298                         return "templates/default/delos_cont.css".$vers;
 
  318         public static function formSelect($selected,$varname,$options,$multiple = 
false,$direct_text = 
false, 
$size = 
"0",
 
  319                 $style_class = 
"", $attribs = 
"",$disabled = 
false)
 
  323                 if ($multiple == 
true)
 
  325                         $multiple = 
" multiple=\"multiple\"";
 
  333                 if ($style_class != 
"")
 
  335                         $class = 
" class=\"".$style_class.
"\"";
 
  342                 if (is_array($attribs))
 
  344                         foreach ($attribs as $key => $val)
 
  346                                 $attributes .= 
" ".$key.
"=\"".$val.
"\"";
 
  351                         $disabled = 
' disabled=\"disabled\"';
 
  354                 $str = 
"<select name=\"".$varname .
"\"".$multiple.
" $class size=\"".
$size.
"\" $attributes $disabled>\n";
 
  356                 foreach ($options as $key => $val)
 
  361                                 $style = $val[
"style"];
 
  365                         $sty = ($style != 
"")
 
  366                                 ? 
' style="'.$style.
'" ' 
  371                                 $str .= 
" <option $sty value=\"".$key.
"\"";
 
  375                                 $str .= 
" <option $sty value=\"".$val.
"\"";
 
  377                         if (is_array($selected) )
 
  379                                 if (in_array($key,$selected))
 
  381                                         $str .= 
" selected=\"selected\"";
 
  384                         else if ($selected == $key)
 
  386                                 $str .= 
" selected=\"selected\"";
 
  391                                 $str .= 
">".$val.
"</option>\n";
 
  395                                 $str .= 
">".$lng->txt($val).
"</option>\n";
 
  399                 $str .= 
"</select>\n";
 
  413                 return($values[$selected]);
 
  425         public static function formCheckbox ($checked,$varname,$value,$disabled = 
false)
 
  427                 $str = 
"<input type=\"checkbox\" name=\"".$varname.
"\"";
 
  431                         $str .= 
" checked=\"checked\"";
 
  436                         $str .= 
" disabled=\"disabled\"";
 
  441                 if (substr($varname,-2) == 
"[]")
 
  449                         $varname_id = substr($varname,0,-2).
"_".$value;
 
  453                         $varname_id = $varname;
 
  457                 $varname_id = ereg_replace(
"\[",
"_",$varname_id);
 
  458                 $varname_id = ereg_replace(
"\]",
"",$varname_id);
 
  460                 $str .= 
" value=\"".$value.
"\" id=\"".$varname_id.
"\" />\n";
 
  477               $str = 
"<input disabled type=\"radio\" name=\"".$varname.
"\"";
 
  480               $str = 
"<input type=\"radio\" name=\"".$varname.
"\"";
 
  484                 $str .= 
" checked=\"checked\"";
 
  487             $str .= 
" value=\"".$value.
"\"";
 
  488             $str .= 
" id=\"".$value.
"\" />\n";
 
  505                 $str = 
"<input type=\"radio\" name=\"".$varname.
"\"";
 
  508                         $str .= 
" checked=\"checked\"";
 
  511                 $str .= 
" value=\"".$value.
"\"";
 
  513                 $str .= 
" id=\"".$value.
"\" />\n";
 
  530             $str = 
"<input type=\"input\" name=\"".$varname.
"\"";
 
  536                 $str .= 
" value=\"".$value.
"\"";
 
  538                 $str .= 
" id=\"".$value.
"\" />\n";
 
  561                 if (
"" != $a_path && 
"/" != substr($a_path, -1))
 
  606                 $tpltab = 
new ilTemplate(
"tpl.tabs.html", 
true, 
true);
 
  608                 for ($i=1; $i<=4; $i++)
 
  610                         $tpltab->setCurrentBlock(
"tab");
 
  613                                 $tabtype = 
"tabactive";
 
  618                                 $tabtype = 
"tabinactive";
 
  625                                 $txt = $lng->txt(
"view_content");
 
  628                                 $txt = $lng->txt(
"edit_properties");
 
  631                                 $txt = $lng->txt(
"perm_settings");
 
  634                                 $txt = $lng->txt(
"show_owner");
 
  637                         $tpltab->setVariable(
"CONTENT", $txt);
 
  638                         $tpltab->setVariable(
"TABTYPE", $tabtype);
 
  639                         $tpltab->setVariable(
"TAB", 
$tab);
 
  640                         $tpltab->setVariable(
"LINK", $a_o[
"LINK".$i]);
 
  641                         $tpltab->parseCurrentBlock();
 
  644                 return $tpltab->get();
 
  660                 foreach ($emptyFields as $key => $val)
 
  663                                 if ($feedback != 
"") $feedback .= 
", ";
 
  693         function Linkbar ($AScript,$AHits,$ALimit,$AOffset,$AParams = array(),$ALayout = array(), $prefix = 
'')
 
  698                 $layout_prev = 
"<<";
 
  699                 $layout_next = 
">>";
 
  702                 if (count($ALayout > 0))
 
  704                         if ($ALayout[
"link"])
 
  706                                 $layout_link = 
" class=\"".$ALayout[
"link"].
"\"";
 
  709                         if ($ALayout[
"prev"])
 
  711                                 $layout_prev = $ALayout[
"prev"];
 
  714                         if ($ALayout[
"next"])
 
  716                                 $layout_next = $ALayout[
"next"];
 
  722                 if ($AHits > $ALimit || $AOffset > 0)
 
  724                         if (!empty($AParams))
 
  726                                 foreach ($AParams as $key => $value)
 
  728                                         $params.= $key.
"=".$value.
"&";
 
  732                         if(strpos($AScript,
'&'))
 
  734                                 $link = $AScript.
"&".$params.$prefix.
"offset=";
 
  738                                 $link = $AScript.
"?".$params.$prefix.
"offset=";
 
  744                                 $prevoffset = $AOffset - $ALimit;
 
  745                                 if ($prevoffset < 0) $prevoffset = 0;
 
  746                                 $LinkBar .= 
"<a".$layout_link.
" href=\"".$link.$prevoffset.
"\">".$layout_prev.
" </a>";
 
  750                         $pages=intval($AHits/$ALimit);
 
  753                         if (($AHits % $ALimit))
 
  760                         for ($i = 1 ;$i <= $pages ; $i++)
 
  762                                 $newoffset=$ALimit*($i-1);
 
  764                                 if ($newoffset == $AOffset)
 
  766                                         $LinkBar .= 
"[".$i.
"] ";
 
  770                                         $LinkBar .= 
'<a '.$layout_link.
' href="'.
 
  771                                                 $link.$newoffset.
'">['.$i.
']</a> ';
 
  778                         if (! ( ($AOffset/$ALimit)==($pages-1) ) && ($pages!=1) )
 
  780                                 $newoffset=$AOffset+$ALimit;
 
  781                                 $LinkBar .= 
"<a".$layout_link.
" href=\"".$link.$newoffset.
"\"> ".$layout_next.
"</a>";
 
  807                 $ret = eregi_replace(
"(^|[[:space:]]+)(www\.)([[:alnum:]#?/&=\.-]+)",
 
  808                         "\\1http://\\2\\3", 
$ret);
 
  811                 $ret = eregi_replace(
"(^|[[:space:]]+)(ftp\.)([[:alnum:]#?/&=\.-]+)",
 
  812                         "\\1ftp://\\2\\3", 
$ret);
 
  819                 $ret = str_replace(
'src="http://', 
'"***masked_im_start***', 
$ret);
 
  821                 include_once(
"./Services/Utilities/classes/class.ilMWParserAdapter.php");
 
  823                 $ret = $parser->replaceFreeExternalLinks(
$ret);
 
  826                 $ret = str_replace(
'"***masked_im_start***', 
'src="http://', 
$ret);
 
  830                 if ($detectGotoLinks)
 
  833                         $regExp = 
"<a[^>]*href=\"(".str_replace(
"/",
"\/",ILIAS_HTTP_PATH).
"\/goto.php\?target=\w+_(\d+)[^\"]*)\"[^>]*>[^<]*<\/a>";
 
  835                         $ret = preg_replace_callback(
 
  837                                 array(
"ilUtil", 
"replaceLinkProperties"),
 
  841                         $regExp = 
"<a[^>]*href=\"(".str_replace(
"/",
"\/",ILIAS_HTTP_PATH).
"\/goto_.*[a-z0-9]+_([0-9]+)\.html)\"[^>]*>[^<]*<\/a>";
 
  843                         $ret = preg_replace_callback(
 
  845                                 array(
"ilUtil", 
"replaceLinkProperties"),
 
  874                                 $link = 
"<a href=".$matches[1].
" target=\"_self\">".
$title.
"</a>";
 
  898                 $m = explode(
" ",microtime());
 
  925         function makeDateSelect($prefix, $year = 
"", $month = 
"", $day = 
"", $startyear = 
"",$a_long_month = 
true,$a_further_options = array(), $emptyoption = 
false)
 
  930                 if(isset($a_further_options[
'disabled']) and $a_further_options[
'disabled'])
 
  932                         $disabled = 
'disabled="disabled" ';
 
  938                         if (!strlen($year)) $year = $now[
"year"];
 
  939                         if (!strlen($month)) $month = $now[
"mon"];
 
  940                         if (!strlen($day)) $day = $now[
"mday"];
 
  944                 $month = (int) $month;
 
  949                 $sel_day .= 
'<select ';
 
  950                 if(isset($a_further_options[
'select_attributes']))
 
  952                         foreach($a_further_options[
'select_attributes'] as $name => $value)
 
  954                                 $sel_day .= ($name.
'="'.$value.
'" ');
 
  958                 $sel_day .= $disabled.
"name=\"".$prefix.
"[d]\" id=\"".$prefix.
"_d\">\n";
 
  960                 if ($emptyoption) $sel_day .= 
"<option value=\"0\">--</option>\n";
 
  961                 for ($i = 1; $i <= 31; $i++)
 
  963                         $sel_day .= 
"<option value=\"$i\">" . sprintf(
"%02d", $i) . 
"</option>\n";
 
  965                 $sel_day .= 
"</select>\n";
 
  966                 $sel_day = preg_replace(
"/(value\=\"$day\")/", 
"$1 selected=\"selected\"", $sel_day);
 
  969                 $sel_month = 
'<select ';
 
  970                 if(isset($a_further_options[
'select_attributes']))
 
  972                         foreach($a_further_options[
'select_attributes'] as $name => $value)
 
  974                                 $sel_month .= ($name.
'="'.$value.
'" ');
 
  977                 $sel_month .= $disabled.
"name=\"".$prefix.
"[m]\" id=\"".$prefix.
"_m\">\n";
 
  979                 if ($emptyoption) $sel_month .= 
"<option value=\"0\">--</option>\n";
 
  980                 for ($i = 1; $i <= 12; $i++)
 
  984                                 $sel_month .= 
"<option value=\"$i\">" . $lng->txt(
"month_" . sprintf(
"%02d", $i) . 
"_long") . 
"</option>\n";
 
  988                                 $sel_month .= 
"<option value=\"$i\">" . $i  . 
"</option>\n";
 
  991                 $sel_month .= 
"</select>\n";
 
  992                 $sel_month = preg_replace(
"/(value\=\"$month\")/", 
"$1 selected=\"selected\"", $sel_month);
 
  995                 $sel_year = 
'<select ';
 
  996                 if(isset($a_further_options[
'select_attributes']))
 
  998                         foreach($a_further_options[
'select_attributes'] as $name => $value)
 
 1000                                 $sel_year .= ($name.
'="'.$value.
'" ');
 
 1003                 $sel_year .= $disabled.
"name=\"".$prefix.
"[y]\" id=\"".$prefix.
"_y\">\n";
 
 1004                 if ((strlen($startyear) == 0) || ($startyear > $year))
 
 1006                         if (!$emptyoption || $year != 0) $startyear = $year - 5;
 
 1009                 if(($year + 5) < (date(
'Y',time()) + 5))
 
 1011                         $end_year = date(
'Y',time()) + 5;
 
 1015                         $end_year = $year + 5;
 
 1018                 if ($emptyoption) $sel_year .= 
"<option value=\"0\">----</option>\n";
 
 1019                 for ($i = $startyear; $i <= $end_year; $i++)
 
 1021                         $sel_year .= 
"<option value=\"$i\">" . sprintf(
"%04d", $i) . 
"</option>\n";
 
 1023                 $sel_year .= 
"</select>\n";
 
 1024                 $sel_year = preg_replace(
"/(value\=\"$year\")/", 
"$1 selected=\"selected\"", $sel_year);
 
 1027                 $dateformat = 
"d-m-Y";
 
 1028                 $dateformat = strtolower(preg_replace(
"/\W/", 
"", $dateformat));
 
 1029                 $dateformat = strtolower(preg_replace(
"/(\w)/", 
"%%$1", $dateformat));
 
 1030                 $dateformat = preg_replace(
"/%%d/", $sel_day, $dateformat);
 
 1031                 $dateformat = preg_replace(
"/%%m/", $sel_month, $dateformat);
 
 1032                 $dateformat = preg_replace(
"/%%y/", $sel_year, $dateformat);
 
 1052         function makeTimeSelect($prefix, $short = 
true, $hour = 
"", $minute = 
"", $second = 
"",$a_use_default = 
true,$a_further_options = array())
 
 1054                 global 
$lng, $ilUser;
 
 1058                 if(count($a_further_options))
 
 1060                         if(isset($a_further_options[
'minute_steps']))
 
 1062                                 $minute_steps = $a_further_options[
'minute_steps'];
 
 1064                         if(isset($a_further_options[
'disabled']) and $a_further_options[
'disabled'])
 
 1066                                 $disabled = 
'disabled="disabled" ';
 
 1070                 if ($a_use_default and !strlen(
"$hour$minute$second")) {
 
 1077                         $minute = (int)$minute;
 
 1078                         $second = (int)$second;
 
 1081                 $sel_hour = 
'<select ';
 
 1082                 if(isset($a_further_options[
'select_attributes']))
 
 1084                         foreach($a_further_options[
'select_attributes'] as $name => $value)
 
 1086                                 $sel_hour .= $name.
'='.$value.
' ';
 
 1089                 $sel_hour .= 
" ".$disabled.
"name=\"".$prefix.
"[h]\" id=\"".$prefix.
"_h\">\n";
 
 1091                 $format = $ilUser->getTimeFormat();
 
 1092                 for ($i = 0; $i <= 23; $i++)
 
 1096                           $sel_hour .= 
"<option value=\"$i\">" . sprintf(
"%02d", $i) . 
"</option>\n";
 
 1100                           $sel_hour .= 
"<option value=\"$i\">" . date(
"ga", mktime($i, 0, 0)) . 
"</option>\n";
 
 1103                 $sel_hour .= 
"</select>\n";
 
 1104                 $sel_hour = preg_replace(
"/(value\=\"$hour\")/", 
"$1 selected=\"selected\"", $sel_hour);
 
 1107                 $sel_minute .= 
"<select ".$disabled.
"name=\"".$prefix.
"[m]\" id=\"".$prefix.
"_m\">\n";
 
 1109                 for ($i = 0; $i <= 59; $i = $i + $minute_steps)
 
 1111                         $sel_minute .= 
"<option value=\"$i\">" . sprintf(
"%02d", $i) . 
"</option>\n";
 
 1113                 $sel_minute .= 
"</select>\n";
 
 1114                 $sel_minute = preg_replace(
"/(value\=\"$minute\")/", 
"$1 selected=\"selected\"", $sel_minute);
 
 1118                         $sel_second .= 
"<select ".$disabled.
"name=\"".$prefix.
"[s]\" id=\"".$prefix.
"_s\">\n";
 
 1120                         for ($i = 0; $i <= 59; $i++)
 
 1122                                 $sel_second .= 
"<option value=\"$i\">" . sprintf(
"%02d", $i) . 
"</option>\n";
 
 1124                         $sel_second .= 
"</select>\n";
 
 1125                         $sel_second = preg_replace(
"/(value\=\"$second\")/", 
"$1 selected=\"selected\"", $sel_second);
 
 1127                 $timeformat = $lng->text[
"lang_timeformat"];
 
 1128                 if (strlen($timeformat) == 0) $timeformat = 
"H:i:s";
 
 1129                 $timeformat = strtolower(preg_replace(
"/\W/", 
"", $timeformat));
 
 1130                 $timeformat = preg_replace(
"/(\w)/", 
"%%$1", $timeformat);
 
 1131                 $timeformat = preg_replace(
"/%%h/", $sel_hour, $timeformat);
 
 1132                 $timeformat = preg_replace(
"/%%i/", $sel_minute, $timeformat);
 
 1134                         $timeformat = preg_replace(
"/%%s/", 
"", $timeformat);
 
 1136                         $timeformat = preg_replace(
"/%%s/", $sel_second, $timeformat);
 
 1159                 $successfulInclude = @include_once (
'Services/Mail/classes/class.ilMail.php');
 
 1165                         require_once 
'Mail/RFC822.php';
 
 1169                                 $addresses = $parser->parseAddressList($a_email, 
'ilias', 
false, 
true);
 
 1170                                 if (! is_a($addresses, 
'PEAR_Error') &&
 
 1171                                         count($addresses) == 1 && $addresses[0]->host != 
'ilias')
 
 1186                                 "AC|AD|AE|AERO|AF|AG|AI|AL|AM|AN|AO|AQ|AR|ARPA|AS|ASIA|AT|AU|AW|AX|AZ|BA|BB|BD|BE|BF|BG|BH|BI|BIZ|BJ|BM|BN|BO|BR|BS|BT|BV|BW|BY|".
 
 1187                                 "BZ|CA|CAT|CC|CD|CF|CG|CH|CI|CK|CL|CM|CN|CO|COM|COOP|CR|CU|CV|CX|CY|CZ|DE|DJ|DK|DM|DO|DZ|EC|EDU|EE|EG|".
 
 1188                                 "ER|ES|ET|EU|FI|FJ|FK|FM|FO|FR|GA|GB|GD|GE|GF|GG|GH|GI|GL|GM|GN|GOV|GP|GQ|GR|GS|GT|GU|GW|GY|HK|HM|HN|HR|HT|".
 
 1189                                 "HU|ID|IE|IL|IM|IN|INFO|INT|IO|IQ|IR|IS|IT|JE|JM|JO|JOBS|JP|KE|KG|KH|KI|KM|KN|KP|KR|KW|KY|KZ|LA|LB|LC|".
 
 1190                                 "LI|LK|LR|LS|LT|LU|LV|LY|MA|MC|MD|ME|MG|MH|MIL|MK|ML|MM|MN|MO|MOBI|MP|MQ|MR|MS|MT|MU|MUSEUM|MV|MW|MX|".
 
 1191                                 "MY|MZ|NA|NAME|NC|NE|NET|NF|NG|NI|NL|NO|NP|NR|NU|NZ|OM|ORG|PA|PE|PF|PG|PH|PK|PL|PM|PN|PR|PRO|PS|".
 
 1192                                 "PT|PW|PY|QA|RE|RO|RS|RU|RW|SA|SB|SC|SD|SE|SG|SH|SI|SJ|SK|SL|SM|SN|SO|SR|ST|SU|SV|SY|SZ|TC|TD|TEL|".
 
 1193                                 "TF|TG|TH|TJ|TK|TL|TM|TN|TO|TP|TR|TRAVEL|TT|TV|TW|TZ|UA|UG|UK|US|UY|UZ|VA|VC|VE|VG|VI|VN|VU|".
 
 1194                                 "WF|WS|XN|YE|YT|YU|ZA|ZM|ZW");
 
 1196                         return(preg_match(
"/^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.)+(".$tlds.
")|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i",$a_email));
 
 1211                 include_once(
'./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
 
 1218                         $customError = null;
 
 1223                                 case empty($a_passwd):
 
 1226                                 case strlen($a_passwd) < 6:
 
 1229                                 case !preg_match(
"/^[A-Za-z0-9_\.\+\?\#\-\*\@!\$\%\~]+$/", $a_passwd):
 
 1242                 if( empty($a_passwd) )
 
 1244                         $customError = $lng->txt(
'password_empty');
 
 1252                 if( $security->getPasswordMinLength() > 0 && strlen($a_passwd) < $security->getPasswordMinLength() )
 
 1254                         $errors[] = sprintf( $lng->txt(
'password_to_short'), $security->getPasswordMinLength() );
 
 1255                         $isPassword = 
false;
 
 1259                 if( $security->getPasswordMaxLength() > 0 && strlen($a_passwd) > $security->getPasswordMaxLength() )
 
 1261                         $errors[] = sprintf( $lng->txt(
'password_to_long'), $security->getPasswordMaxLength() );
 
 1262                         $isPassword = 
false;
 
 1266                 if( $security->isPasswordCharsAndNumbersEnabled() )
 
 1268                         $hasCharsAndNumbers = 
true;
 
 1270                         if( !preg_match(
'/[A-Za-z]+/',$a_passwd) )
 
 1272                                 $hasCharsAndNumbers = 
false;
 
 1276                         if( !preg_match(
'/[0-9]+/',$a_passwd) )
 
 1278                                 $hasCharsAndNumbers = 
false;
 
 1281                         if( !$hasCharsAndNumbers )
 
 1283                                 $errors[] = $lng->txt(
'password_must_chars_and_numbers');
 
 1284                                 $isPassword = 
false;
 
 1289                 if( $security->isPasswordSpecialCharsEnabled() )
 
 1291                         $specialCharsReg = 
'/[_\.\+\?\#\-\*\@!\$\%\~\/\:\;]+/';
 
 1294                         if( !preg_match($specialCharsReg, $a_passwd) )
 
 1296                                 $errors[] = $lng->txt(
'password_must_special_chars');
 
 1297                                 $isPassword = 
false;
 
 1302                 if( !preg_match(
"/^[A-Za-z0-9_\.\+\?\#\-\*\@!\$\%\~\/\:\;]+$/", $a_passwd) )
 
 1304                         $errors[] = $lng->txt(
'password_contains_invalid_chars');
 
 1305                         $isPassword = 
false;
 
 1315                         $customError = $lng->txt(
'password_multiple_errors');
 
 1316                         $customError .= 
'<br />'.implode(
'<br />', 
$errors);
 
 1332                 include_once(
'./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
 
 1337                         $validPasswordChars = 
'A-Z a-z 0-9 _.+?#-*@!$%~/:;';
 
 1341                         $validPasswordChars = 
'A-Z a-z 0-9 _.+?#-*@!$%~';
 
 1344                 return sprintf($lng->txt(
'password_allow_chars'), $validPasswordChars);
 
 1355                 if (empty($a_login))
 
 1360                 if (strlen($a_login) < 3)
 
 1368                 if (!ereg(
"^[A-Za-z0-9_\.\+\*\@!\$\%\~\-]+$", $a_login))
 
 1387         public static function shortenText ($a_str, $a_len, $a_dots = 
false, $a_next_blank = 
false,
 
 1388                 $a_keep_extension = 
false)
 
 1390                 include_once(
"./Services/Utilities/classes/class.ilStr.php");
 
 1406                         if ($a_keep_extension)
 
 1408                                 $p = strrpos($a_str, 
'.');      
 
 1410                         if ($p === 
false || $p == 0 || strlen($a_str) - $p > $a_len)
 
 1415                                         $a_str .= 
"\xe2\x80\xa6"; 
 
 1422                                         $a_str = 
ilStr::subStr($a_str,0,$len - (strlen($a_str) - $p + 1)).
"\xe2\x80\xa6".substr($a_str, $p);
 
 1426                                         $a_str = 
ilStr::subStr($a_str,0,$len - (strlen($a_str) - $p + 1)).substr($a_str, $p);
 
 1444                 include_once(
"./Services/Utilities/classes/class.ilStr.php");
 
 1445                 $str_arr = explode(
" ", $a_str);
 
 1447                 for ($i = 0; $i < count($str_arr); $i++)
 
 1454                                         $str_arr[$i].= 
"...";
 
 1459                 return implode($str_arr, 
" ");
 
 1472                 while (is_int(strpos($a_str, 
"=")))
 
 1474                         $eq_pos = strpos($a_str, 
"=");
 
 1475                         $qu1_pos = strpos($a_str, 
"\"");
 
 1476                         $qu2_pos = strpos(substr($a_str, $qu1_pos + 1), 
"\"") + $qu1_pos + 1;
 
 1477                         if (is_int($eq_pos) && is_int($qu1_pos) && is_int($qu2_pos))
 
 1479                                 $var = trim(substr($a_str, 0, $eq_pos));
 
 1480                                 $val = trim(substr($a_str, $qu1_pos + 1, ($qu2_pos - $qu1_pos) - 1));
 
 1481                                 $attribs[$var] = $val;
 
 1482                                 $a_str = substr($a_str, $qu2_pos + 1);
 
 1501         function rCopy ($a_sdir, $a_tdir, $preserveTimeAttributes = 
false)
 
 1504                 if (!@is_dir($a_sdir) or
 
 1511                 $dir = opendir($a_sdir);
 
 1515                         if (
$file != 
"." and
 
 1519                                 if (@is_dir($a_sdir.
"/".
$file))
 
 1521                                         if (!@is_dir($a_tdir.
"/".
$file))
 
 1536                                 if (@is_file($a_sdir.
"/".
$file))
 
 1538                                         if (!copy($a_sdir.
"/".
$file,$a_tdir.
"/".
$file))
 
 1542                                         if ($preserveTimeAttributes)
 
 1543                                                 touch($a_tdir.
"/".
$file, filectime($a_sdir.
"/".
$file));
 
 1561                 if ($mode == 
"filesystem")
 
 1563                         return "./".ILIAS_WEB_DIR.
"/".$ilias->client_id;
 
 1567                         if (defined(
"ILIAS_MODULE"))
 
 1569                                 return "../".ILIAS_WEB_DIR.
"/".$ilias->client_id;
 
 1573                                 return "./".ILIAS_WEB_DIR.
"/".$ilias->client_id;
 
 1585                 return CLIENT_DATA_DIR;
 
 1600                 include_once(
"./Services/User/classes/class.ilObjUser.php");
 
 1614                 include_once(
"./Services/User/classes/class.ilObjUser.php");
 
 1626                 if (!is_dir($temp_path))
 
 1630                 $temp_name = tempnam($temp_path, 
"tmp");
 
 1636                 $temp_name = str_replace(
"\\", 
"/", $temp_name);
 
 1661         public static function unzip($a_file, $overwrite = 
false, $a_flat = 
false)
 
 1663                 if (!is_file($a_file))
 
 1673                         copy($a_file, $tmpdir.DIRECTORY_SEPARATOR.basename($a_file));
 
 1674                         $orig_file = $a_file;
 
 1675                         $a_file = $tmpdir.DIRECTORY_SEPARATOR.basename($a_file);
 
 1676                         $origpathinfo = pathinfo($orig_file);
 
 1679                 $pathinfo = pathinfo($a_file);
 
 1680                 $dir = $pathinfo[
"dirname"];
 
 1681                 $file = $pathinfo[
"basename"];
 
 1686                 $unzip = PATH_TO_UNZIP;
 
 1691                 $unzipcmd = 
"-Z -1 ".ilUtil::escapeShellArg(
$file);
 
 1695                 foreach($arr as $line)
 
 1697                         if(is_int(strpos($line, 
"/")))
 
 1699                                 $zdir = substr($line, 0, strrpos($line, 
"/"));
 
 1700                                 $nr = substr_count($zdir, 
"/");
 
 1704                                         $nr = substr_count($zdir, 
"/");
 
 1705                                         $zdirs[$zdir] = $nr;                            
 
 1707                                         $zdir = substr($zdir, 0, strrpos($zdir, 
"/"));
 
 1714                 foreach($zdirs as $zdir => $nr)                         
 
 1726                         $unzipcmd = 
"-o ".ilUtil::escapeShellArg(
$file);
 
 1735                         include_once(
"./Services/Utilities/classes/class.ilFileUtils.php");
 
 1736                         $filearray = array();
 
 1738                         if (is_array($filearray[
"file"]))
 
 1740                                 foreach ($filearray[
"file"] as $k => $f)
 
 1742                                         if (substr($f, 0, 1) != 
"." && $f != basename($orig_file))
 
 1744                                                 copy($filearray[
"path"][$k].$f, $origpathinfo[
"dirname"].DIRECTORY_SEPARATOR.$f);
 
 1755         public static function zip($a_dir, $a_file, $compress_content = 
false)
 
 1759                 if($compress_content)
 
 1762                         $pathinfo = pathinfo($a_dir);
 
 1763                         chdir($pathinfo[
"dirname"]);
 
 1766                 $pathinfo = pathinfo($a_file);
 
 1767                 $dir = $pathinfo[
"dirname"];
 
 1768                 $file = $pathinfo[
"basename"];
 
 1770                 if(!$compress_content)
 
 1783                 if (is_array($a_dir))
 
 1786                         foreach($a_dir as 
$dir)
 
 1788                                 $name = basename($dir);
 
 1789                                 $source.= 
" ".ilUtil::escapeShellArg($name);
 
 1794                         $name = basename($a_dir);
 
 1795                         if (trim($name) != 
"*")
 
 1805                 $zipcmd = 
"-r ".ilUtil::escapeShellArg($a_file).
" ".$source;
 
 1815                 $pathinfo = pathinfo($a_dir);
 
 1816                 chdir($pathinfo[
"dirname"]);
 
 1818                 $pathinfo = pathinfo($a_file);
 
 1819                 $dir = $pathinfo[
"dirname"];
 
 1820                 $file = $pathinfo[
"basename"];  $zipcmd = 
"-r ".ilUtil::escapeShellArg($a_file).
" ".$source;
 
 1822                 $mkisofs = PATH_TO_MKISOFS;
 
 1829                 $name = basename($a_dir);
 
 1832                 $zipcmd = 
"-r -J -o ".$a_file.
" ".$source;
 
 1846                 return PATH_TO_CONVERT;
 
 1866         function convertImage($a_from, $a_to, $a_target_format = 
"", $a_geometry = 
"",
 
 1867                 $a_background_color = 
"")
 
 1869                 $format_str = ($a_target_format != 
"")
 
 1870                         ? strtoupper($a_target_format).
":" 
 1872                 $geometry = ($a_geometry != 
"")
 
 1873                         ? 
" -geometry ".$a_geometry.
"x".$a_geometry.
" " 
 1875                 $bg_color = ($a_background_color != 
"")
 
 1876                         ? 
" -background color ".$a_background_color.
" " 
 1878                 $convert_cmd = 
ilUtil::escapeShellArg($a_from).
" ".$bg_color.$geometry.ilUtil::escapeShellArg($format_str.$a_to);
 
 1891         function resizeImage($a_from, $a_to, $a_width, $a_height, $a_constrain_prop = 
false)
 
 1893                 if ($a_constrain_prop)
 
 1895                         $size = 
" -geometry ".$a_width.
"x".$a_height.
" ";
 
 1899                         $size = 
" -resize ".$a_width.
"x".$a_height.
"! ";
 
 1909         function img($a_src, $a_alt = 
"", $a_width = 
"", $a_height = 
"", $a_border = 0)
 
 1911                 $img = 
'<img src="'.$a_src.
'"';
 
 1914                         $img.= 
' alt="'.$a_alt.
'" title="'.$a_alt.
'"';
 
 1918                         $img.= 
' width="'.$a_width.
'"';
 
 1920                 if ($a_height != 
"")
 
 1922                         $img.= 
' height="'.$a_height.
'"';
 
 1924                 $img.= 
' border="'.(int) $a_border.
'"/>';
 
 1936                 $html_file = str_replace(
".pdf",
".html",$pdf_file);
 
 1938                 $fp = fopen( $html_file ,
"wb");
 
 1952                 $htmldoc_path = PATH_TO_HTMLDOC;
 
 1954                 $htmldoc = 
"--no-toc ";
 
 1955                 $htmldoc .= 
"--no-jpeg ";
 
 1956                 $htmldoc .= 
"--webpage ";
 
 1958                 $htmldoc .= 
"--bodyfont Arial ";
 
 1959                 $htmldoc .= 
"--charset iso-8859-15 ";
 
 1960                 $htmldoc .= 
"--color ";
 
 1961                 $htmldoc .= 
"--size A4  ";      
 
 1962                 $htmldoc .= 
"--format pdf ";
 
 1963                 $htmldoc .= 
"--footer ... ";
 
 1964                 $htmldoc .= 
"--header ... ";
 
 1965                 $htmldoc .= 
"--left 60 ";
 
 1967                 $htmldoc .= $html_file;
 
 1975         public static function deliverData($a_data, $a_filename, $mime = 
"application/octet-stream", $charset = 
"")
 
 1977                 $disposition = 
"attachment"; 
 
 1980                 include_once 
'./classes/class.ilHTTPS.php';
 
 1989                         #header("Pragma: "); 
 1990                         #header("Cache-Control: "); 
 1991                         #header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); 
 1992                         #header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); 
 1993                         #header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 
 1994                         #header("Cache-Control: post-check=0, pre-check=0", false); 
 1996                 else if ($disposition == 
"attachment")
 
 1998                         header(
"Cache-control: private");
 
 2002                         header(
"Cache-Control: no-cache, must-revalidate");
 
 2003                         header(
"Pragma: no-cache");
 
 2008                 if (strlen($charset))
 
 2010                         $charset = 
"; charset=$charset";
 
 2012                 header(
"Content-Type: $mime$charset");
 
 2013                 header(
"Content-Disposition:$disposition; filename=\"".$ascii_filename.
"\"");
 
 2014                 header(
"Content-Description: ".$ascii_filename);
 
 2015                 header(
"Content-Length: ".(
string)(strlen($a_data)));
 
 2020             header(
'Cache-Control: must-revalidate, post-check=0, pre-check=0');
 
 2021             header(
'Pragma: public');
 
 2024                 header(
"Connection: close");
 
 2035         function deliverFile($a_file, $a_filename,$a_mime = 
'', $isInline = 
false, $removeAfterDelivery = 
false)
 
 2038                 if(!file_exists($a_file))
 
 2044                         $disposition = 
"inline"; 
 
 2046                         $disposition =  
"attachment"; 
 
 2057                         $mime = 
"application/octet-stream"; 
 
 2061                 if ($disposition == 
"attachment")
 
 2063                         header(
"Cache-control: private");
 
 2067                         header(
"Cache-Control: no-cache, must-revalidate");
 
 2068                         header(
"Pragma: no-cache");
 
 2073                 header(
"Content-Type: $mime");
 
 2074                 header(
"Content-Disposition:$disposition; filename=\"".$ascii_filename.
"\"");
 
 2075                 header(
"Content-Description: ".$ascii_filename);
 
 2078                 $filesize = @filesize($a_file);
 
 2081                         header(
"Content-Length: ".(
string)$filesize);
 
 2084                 include_once 
'./classes/class.ilHTTPS.php';
 
 2085                 #if($_SERVER['HTTPS']) 
 2088             header(
'Cache-Control: must-revalidate, post-check=0, pre-check=0');
 
 2089             header(
'Pragma: public');
 
 2092                 header(
"Connection: close");
 
 2094                 if ($removeAfterDelivery)
 
 2110                 $chunksize = 1*(1024*1024); 
 
 2112                 $handle = fopen($a_file, 
'rb');
 
 2113                 if ($handle === 
false)
 
 2117                 while (!feof($handle))
 
 2119                         $buffer = fread($handle, $chunksize);
 
 2122                 return fclose($handle);
 
 2150                 $ascii_filename = htmlentities($a_filename, ENT_NOQUOTES, 
'UTF-8');
 
 2151                 $ascii_filename = preg_replace(
'/\&(.)[^;]*;/', 
'\\1', $ascii_filename);
 
 2152                 $ascii_filename = preg_replace(
'/[\x7f-\xff]/', 
'_', $ascii_filename);
 
 2155                 $ascii_filename = preg_replace(
'/[:\x5c\/\*\?\"<>\|]/', 
'_', $ascii_filename);
 
 2157                 return $ascii_filename;
 
 2166                 $sep = 
'###HTMLTAG###';
 
 2168                 preg_match_all(
"@<[^>]*>@", $htmlText, $matches);   
 
 2169                 $tmp = preg_replace(
"@(<[^>]*>)@", $sep, $htmlText);
 
 2170                 $tmp = explode($sep, $tmp);
 
 2172                 for ($i=0; $i<count($tmp); $i++)
 
 2173                         $tmp[$i] = htmlentities($tmp[$i], ENT_COMPAT, 
"UTF-8");
 
 2175                 $tmp = join($sep, $tmp);
 
 2177                 for ($i=0; $i<count($matches[0]); $i++)
 
 2178                         $tmp = preg_replace(
"@$sep@", $matches[0][$i], $tmp, 1);
 
 2188                 return PATH_TO_JAVA;
 
 2204                 $url = (is_int(strpos($a_url, 
"?")))
 
 2205                         ? $a_url.$amp.$a_par
 
 2206                         : $a_url.
"?".$a_par;
 
 2227                 $a_dir = trim($a_dir);
 
 2230                 if (substr($a_dir,-1) == 
"/")
 
 2232                         $a_dir = substr($a_dir,0,-1);
 
 2236                 if (!(
$path = substr($a_dir,0, strrpos($a_dir,
"/") - strlen($a_dir))))
 
 2243                 return @mkdir($a_dir,fileperms(
$path));
 
 2261                 $dirs = array($a_dir);
 
 2262                 $a_dir = dirname($a_dir);
 
 2265                 while($last_dirname != $a_dir)
 
 2267                         array_unshift(
$dirs, $a_dir);
 
 2268                         $last_dirname = $a_dir;
 
 2269                         $a_dir = dirname($a_dir);
 
 2273                 $reverse_paths = array_reverse(
$dirs, TRUE);
 
 2275                 foreach ($reverse_paths as $key => $value)
 
 2277                         if ($found_index == -1)
 
 2281                                         $found_index = $key;
 
 2290                         if ($dirindex >= $found_index)
 
 2292                                 if (! file_exists(
$dir))
 
 2294                                         if (strcmp(substr(
$dir,strlen(
$dir)-1,1),
"/") == 0)
 
 2300                                         if (! mkdir(
$dir, $umask))
 
 2302                                                 error_log(
"Can't make directory: $dir");
 
 2306                                 elseif (! is_dir(
$dir))
 
 2308                                         error_log(
"$dir is not a directory");
 
 2314                                         $umask = fileperms(
$dir);
 
 2328         public static function delDir($a_dir, $a_clean_only = 
false)
 
 2330                 if (!is_dir($a_dir) || is_int(strpos($a_dir, 
"..")))
 
 2335                 $current_dir = opendir($a_dir);
 
 2344                 while($entryname = readdir($current_dir))
 
 2351                         if(is_dir($a_dir.
"/".$file) and ($file != 
"." and $file!=
".."))
 
 2355                         elseif ($file != 
"." and $file != 
"..")
 
 2357                                 unlink(${a_dir}.
"/".${file});
 
 2361                 closedir($current_dir);
 
 2374                 $current_dir = opendir($a_dir);
 
 2378                 while($entry = readdir($current_dir))
 
 2380                         if(is_dir($a_dir.
"/".$entry))
 
 2382                                 $dirs[$entry] = array(
"type" => 
"dir", 
"entry" => $entry);
 
 2386                                 if ($entry != 
"." && $entry != 
"..")
 
 2388                                         $size = filesize($a_dir.
"/".$entry);
 
 2389                                         $files[$entry] = array(
"type" => 
"file", 
"entry" => $entry,
 
 2405                 if (is_array($a_arr))
 
 2407                         foreach ($a_arr as $k => $v)
 
 2421                 if (is_array($a_data))
 
 2423                         foreach ($a_data as $k => $v)
 
 2448         public static function stripSlashes($a_str, $a_strip_html = 
true, $a_allow = 
"")
 
 2450                 if (ini_get(
"magic_quotes_gpc"))
 
 2452                         $a_str = stripslashes($a_str);
 
 2465                 if (ini_get(
"magic_quotes_gpc"))
 
 2467                         $a_str = stripslashes($a_str);
 
 2479                 $only_secure = 
true;
 
 2480                 $allow_tags = explode(
">", $a_allow);
 
 2482                 $allow_array = array();
 
 2483                 foreach($allow_tags as $allow)
 
 2487                                 $allow = str_replace(
"<", 
"", $allow);
 
 2489                                 if (!in_array($allow, $sec_tags))
 
 2491                                         $only_secure = 
false;
 
 2493                                 $allow_array[] = $allow;
 
 2498                 if (($only_secure || $a_allow == 
"") && $a_strip_html)
 
 2502                                 $allow_array = array (
"b", 
"i", 
"strong", 
"em", 
"code", 
"cite",
 
 2503                                         "gap", 
"sub", 
"sup", 
"pre", 
"strike");
 
 2509                         $a_str = strip_tags($a_str);            
 
 2534                 return array(
"strong", 
"em", 
"u", 
"strike", 
"ol", 
"li", 
"ul", 
"p", 
"div",
 
 2535                         "i", 
"b", 
"code", 
"sup", 
"sub", 
"pre", 
"gap", 
"a", 
"img");
 
 2540                 foreach ($allow_array as 
$t)
 
 2555                                                 array(
"param" => 
"align", 
"value" => 
"left"),
 
 2556                                                 array(
"param" => 
"align", 
"value" => 
"center"),
 
 2557                                                 array(
"param" => 
"align", 
"value" => 
"justify"),
 
 2558                                                 array(
"param" => 
"align", 
"value" => 
"right")
 
 2573                 foreach ($allow_array as 
$t)
 
 2588                                                 array(
"param" => 
"align", 
"value" => 
"left"),
 
 2589                                                 array(
"param" => 
"align", 
"value" => 
"center"),
 
 2590                                                 array(
"param" => 
"align", 
"value" => 
"justify"),
 
 2591                                                 array(
"param" => 
"align", 
"value" => 
"right")
 
 2610                 if (ini_get(
"magic_quotes_gpc"))
 
 2612                         return stripslashes($a_str);
 
 2637                 if ($a_make_links_clickable)
 
 2655                         $numberOfMatches = preg_match_all(
'/(?:(?:http|https|ftp|ftps|mailto):|www\.)(?:[a-zA-Z0-9]|[;\/?:|&=+$,]|[\\-_.!~*\'()]|%[0-9a-fA-F]{2}|#|[;?:@&=+$,])+/',$a_str, $matches, PREG_OFFSET_CAPTURE);
 
 2658                         foreach ($matches as $match)
 
 2661                         foreach ($matches[0] as $match)
 
 2663                                 $matched_text = $match[0];
 
 2665                                 if ($matched_offset != previous_offset)
 
 2668                                         $encoded .= nl2br(htmlspecialchars(substr($a_str, $pos1, $pos2 - $pos1)));
 
 2674                                 $pos1 = $pos2 + strlen($matched_text);
 
 2676                         if ($pos1 < strlen($a_str))
 
 2678                                 $encoded .= nl2br(htmlspecialchars(substr($a_str, $pos1)));
 
 2683                         $encoded = nl2br(htmlspecialchars($a_str));
 
 2693                 $ws = 
"[ \t\r\f\v\n]*";
 
 2694                 $att = $ws.
"[^>]*".$ws;
 
 2696                 while (eregi(
"<($tag$att($tag_att$ws=$ws\"(([\$@!*()~;,_0-9A-z/:=%\\.&#?+\\-])*)\")$att)>",
 
 2699                         $un = array(
".", 
"-", 
"+", 
"?", 
'$', 
"*", 
"(", 
")");
 
 2705                         $ff = str_replace($un, $esc, $found[1]);
 
 2708                         $a_str = eregi_replace(
"<".$ff.
">",
 
 2709                                 "<$tag $tag_att$tag_att=\"".$found[3].
"\">", $a_str);
 
 2710                         if ($old_str == $a_str)
 
 2712                                 $ilLog->write(
"ilUtil::maskA-".htmlentities($old_str).
" == ".
 
 2713                                         htmlentities($a_str));
 
 2717                 $a_str = str_ireplace(
"</$tag>",
 
 2718                         "</$tag>", $a_str);
 
 2726                 while (eregi(
"<($tag $tag_att$tag_att=\"(([\$@!*()~;,_0-9A-z/:=%\\.&#?+\\-])*)\")>",
 
 2729                         $un = array(
".", 
"-", 
"+", 
"?", 
'$', 
"*", 
"(", 
")");
 
 2735                         $ff = str_replace($un, $esc, $found[1]);
 
 2738                         $a_str = eregi_replace(
"<".$ff.
">",
 
 2739                                 "<$tag $tag_att=\"".ilUtil::secureLink($found[2]).
"\">", $a_str);
 
 2740                         if ($old_str == $a_str)
 
 2742                                 $ilLog->write(
"ilUtil::unmaskA-".htmlentities($old_str).
" == ".
 
 2743                                         htmlentities($a_str));
 
 2747                 $a_str = str_replace(
"</$tag>", 
"</$tag>", $a_str);
 
 2753                 $a_str = str_replace(array(
"<$t>", 
"<".strtoupper(
$t).
">"),
 
 2754                         "<".
$t.
">", $a_str);
 
 2755                 $a_str = str_replace(array(
"</$t>", 
"</".strtoupper(
$t).
">"),
 
 2756                         "</".
$t.
">", $a_str);
 
 2758                 if (is_array($fix_param))
 
 2760                         foreach ($fix_param      as $p)
 
 2764                                 $a_str = str_replace(
"<$t $k=\"$v\">",
 
 2765                                         "<".
"$t $k=\"$v\"".
">", $a_str);
 
 2774                 $a_str = str_replace(
"<".
$t.
">", 
"<".$t.
">", $a_str);
 
 2775                 $a_str = str_replace(
"</".
$t.
">", 
"</".$t.
">", $a_str);
 
 2777                 if (is_array($fix_param))
 
 2779                         foreach ($fix_param      as $p)
 
 2783                                 $a_str = str_replace(
"<$t $k=\"$v\">",
 
 2784                                         "<".
"$t $k=\"$v\"".
">", $a_str);
 
 2792                 $a_str = str_ireplace(
"javascript", 
"jvscrpt", $a_str);
 
 2793                 $a_str = str_ireplace(array(
"%00", 
"%0a", 
"%0d", 
"%1a", 
"�", 
"�",
 
 2794                         "�", 
"�", 
"
", 
"
", 
"
", 
"
"), 
"-", $a_str);
 
 2813                 $negativestr = 
"a,abbr,acronym,address,applet,area,b,base,basefont,".
 
 2814                         "bdo,big,blockquote,body,br,button,caption,center,cite,code,col,".
 
 2815                         "colgroup,dd,del,dfn,dir,div,dl,dt,em,fieldset,font,form,frame,".
 
 2816                         "frameset,h1,h2,h3,h4,h5,h6,head,hr,html,i,iframe,img,input,ins,isindex,kbd,".
 
 2817                         "label,legend,li,link,map,menu,meta,noframes,noscript,object,ol,".
 
 2818                         "optgroup,option,p,param,q,s,samp,script,select,small,span,".
 
 2819                         "strike,strong,style,sub,sup,table,tbody,td,textarea,tfoot,th,thead,".
 
 2820                         "title,tr,tt,u,ul,var";
 
 2821                 $a_allow = strtolower ($a_allow);
 
 2822                 $negatives = explode(
",",$negativestr);
 
 2823                 $outer_old_str = 
"";
 
 2824                 while($outer_old_str != $a_str)
 
 2826                         $outer_old_str = $a_str;
 
 2827                         foreach ($negatives as $item)
 
 2829                                 $pos = strpos($a_allow, 
"<$item>");
 
 2835                                         while($old_str != $a_str)
 
 2838                                                 $a_str = preg_replace(
"/<\/?\s*$item(\/?)\s*>/i", 
"", $a_str);
 
 2839                                                 $a_str = preg_replace(
"/<\/?\s*$item(\/?)\s+([^>]*)>/i", 
"", $a_str);
 
 2848                         $a_str = preg_replace(
"/<\s*\w*(\/?)(\s+[^>]*)?(\s+on[^>]*)>/i", 
"", $a_str);
 
 2851                         $a_str = preg_replace(
"/<\s*\w*(\/?)\s+[^>]*javascript[^>]*>/i", 
"", $a_str);
 
 2855                         $a_str = preg_replace(
"/<\s*\w*(\/?)\s+[^>]*expression[^>]*>/i", 
"", $a_str);
 
 2869                 if (ini_get(
"magic_quotes_gpc"))
 
 2875                         return addslashes($a_str);
 
 2894                 $a_str = htmlspecialchars($a_str);
 
 2898                 $a_str = str_replace(
"{", 
"{", $a_str);
 
 2899                 $a_str = str_replace(
"}", 
"}", $a_str);
 
 2916                 return addslashes($a_str);
 
 2944                 while(($spos=strpos($a_parstr,
"=")) && 
$ok)
 
 2947                         $cpar = substr($a_parstr,0,$spos);
 
 2948                         $a_parstr = substr($a_parstr,$spos,strlen($a_parstr)-$spos);
 
 2949                         while(substr($cpar,0,1)==
"," ||substr($cpar,0,1)==
" " || substr($cpar,0,1)==chr(13) || substr($cpar,0,1)==chr(10))
 
 2950                         $cpar = substr($cpar,1,strlen($cpar)-1);
 
 2951                         while(substr($cpar,strlen($cpar)-1,1)==
" " || substr($cpar,strlen($cpar)-1,1)==chr(13) || substr($cpar,strlen($cpar)-1,1)==chr(10))
 
 2952                         $cpar = substr($cpar,0,strlen($cpar)-1);
 
 2956                         while($cpar != $cpar_old)
 
 2959                                 $cpar = eregi_replace(
"[^a-zA-Z0-9_]", 
"", $cpar);
 
 2965                                 if($spos=strpos($a_parstr,
"\""))
 
 2967                                         $a_parstr = substr($a_parstr,$spos+1,strlen($a_parstr)-$spos);
 
 2968                                         $spos=strpos($a_parstr,
"\"");
 
 2971                                                 $cval = substr($a_parstr,0,$spos);
 
 2973                                                 $a_parstr = substr($a_parstr,$spos+1,strlen($a_parstr)-$spos-1);
 
 2983                 if(
$ok) 
return $par; 
else return false;
 
 2988                 if (is_array($a_par_arr))
 
 2991                         foreach ($a_par_arr as $par => $val)
 
 3007                 for($i=0; $i<strlen($a_str); $i++)
 
 3009                         $ret.= ord(substr($a_str,$i,1)).
" ";
 
 3020                 if(strtolower($a_yn) == 
"y")
 
 3055                 global $array_sortby,$array_sortorder;
 
 3059                 if ($array_sortorder == 
"asc")
 
 3064                 if ($array_sortorder == 
"desc")
 
 3066                         return !
ilStr::strCmp($a[$array_sortby], $b[$array_sortby]);
 
 3081                 global $array_sortby,$array_sortorder;
 
 3083                 if ($array_sortorder == 
"asc")
 
 3085                         return $a[
"$array_sortby"] > $b[
"$array_sortby"];
 
 3088                 if ($array_sortorder == 
"desc")
 
 3090                         return $a[
"$array_sortby"] < $b[
"$array_sortby"];
 
 3103         public static function sortArray($array,$a_array_sortby,$a_array_sortorder = 0,$a_numeric = 
false,
 
 3104                 $a_keep_keys = 
false)
 
 3106                 include_once(
"./Services/Utilities/classes/class.ilStr.php");
 
 3109                 if (! $a_keep_keys) {
 
 3114                 global $array_sortby,$array_sortorder;
 
 3116                 $array_sortby = $a_array_sortby;
 
 3118                 if ($a_array_sortorder == 
"desc")
 
 3120                         $array_sortorder = 
"desc";
 
 3124                         $array_sortorder = 
"asc";
 
 3130                                 uasort($array, array(
"ilUtil", 
"sort_func_numeric"));
 
 3134                                 usort($array, array(
"ilUtil", 
"sort_func_numeric"));
 
 3141                                 uasort($array, array(
"ilUtil", 
"sort_func"));
 
 3145                                 usort($array, array(
"ilUtil", 
"sort_func"));
 
 3165         function stableSortArray($array,$a_array_sortby,$a_array_sortorder = 0,$a_numeric = 
false)
 
 3167                 global $array_sortby,$array_sortorder;
 
 3169                 $array_sortby = $a_array_sortby;
 
 3171                 if ($a_array_sortorder == 
"desc")
 
 3173                         $array_sortorder = 
"desc";
 
 3177                         $array_sortorder = 
"asc";
 
 3181                 $sort_array = array_values($array);
 
 3196                  if (count($array) < 2) 
return;
 
 3199                  $halfway = count($array) / 2;
 
 3200                  $array1 = array_slice($array, 0, $halfway);
 
 3201                  $array2 = array_slice($array, $halfway);
 
 3208                  if (call_user_func($cmp_function, end($array1), $array2[0]) < 1) {
 
 3209                          $array = array_merge($array1, $array2);
 
 3216                  while ($ptr1 < count($array1) && $ptr2 < count($array2)) {
 
 3217                          if (call_user_func($cmp_function, $array1[$ptr1], $array2[$ptr2]) < 1) {
 
 3218                                  $array[] = $array1[$ptr1++];
 
 3221                                  $array[] = $array2[$ptr2++];
 
 3226                  while ($ptr1 < count($array1)) $array[] = $array1[$ptr1++];
 
 3227                  while ($ptr2 < count($array2)) $array[] = $array2[$ptr2++];
 
 3245                 $existing_sub_key_values = array();
 
 3247                 foreach ($array as $key=>$sub_array)
 
 3249                         if (!in_array($sub_array[$sub_key], $existing_sub_key_values))
 
 3251                                 $existing_sub_key_values[] = $sub_array[$sub_key];
 
 3252                                 $target[$key] = $sub_array;
 
 3269                 $a_desired_type = strtolower($a_desired_type);
 
 3271                 $im_types = ImageTypes();
 
 3273                 switch($a_desired_type)
 
 3276                         if ($im_types & IMG_JPG) 
return "jpg";
 
 3277                         if ($im_types & IMG_GIF) 
return "gif";
 
 3278                         if ($im_types & IMG_PNG) 
return "png";
 
 3282                         if ($im_types & IMG_GIF) 
return "gif";
 
 3283                         if ($im_types & IMG_JPG) 
return "jpg";
 
 3284                         if ($im_types & IMG_PNG) 
return "png";
 
 3288                         if ($im_types & IMG_PNG) 
return "png";
 
 3289                         if ($im_types & IMG_JPG) 
return "jpg";
 
 3290                         if ($im_types & IMG_GIF) 
return "gif";
 
 3306                 if (($a_mime == 
"image/gif") || ($a_mime == 
"image/jpeg") ||
 
 3307                 ($a_mime == 
"image/png") || ($a_mime == 
"application/x-shockwave-flash") ||
 
 3308                 ($a_mime == 
"image/tiff") || ($a_mime == 
"image/x-ms-bmp") ||
 
 3309                 ($a_mime == 
"image/psd") || ($a_mime == 
"image/iff"))
 
 3327                 global 
$log, $PHP_SELF;
 
 3330                 if (!is_int(strpos($a_script, 
"://")))
 
 3332                         if (substr($a_script, 0, 1) != 
"/" && defined(
"ILIAS_HTTP_PATH"))
 
 3334                                 if (is_int(strpos($_SERVER[
"PHP_SELF"], 
"/setup/")))
 
 3336                                         $a_script = 
"setup/".$a_script;
 
 3338                                 $a_script = ILIAS_HTTP_PATH.
"/".$a_script;
 
 3342                 header(
"Location: ".$a_script);
 
 3353                 if (substr($a_value, 0, 4) == 
"il__")
 
 3355                         $a_value = 
"il_".IL_INST_ID.
"_".substr($a_value, 4, strlen($a_value) - 4);
 
 3373                 if (empty($a_group_name))
 
 3375                         $message = get_class($this).
"::_NameExists(): No groupname given!";
 
 3376                         $ilErr->raiseError($message,$ilErr->WARNING);
 
 3379                 $clause = ($a_id) ? 
" AND obj_id != ".$ilDB->quote($a_id).
" " : 
"";
 
 3381                 $q = 
"SELECT obj_id FROM object_data ".
 
 3382                 "WHERE title = ".$ilDB->quote($a_group_name, 
"text").
" ".
 
 3383                 "AND type = ".$ilDB->quote(
"grp", 
"text").
 
 3386                 $r = $ilDB->query($q);
 
 3409                         "FROM object_data ,object_reference ".
 
 3410                         "WHERE (".$ilDB->like(
"object_data.title", 
"text", 
"%".$a_search_str.
"%").
" ".
 
 3411                         "OR ".$ilDB->like(
"object_data.description", 
"text", 
"%".$a_search_str.
"%").
") ".
 
 3412                         "AND object_data.type = 'grp' ".
 
 3413                         "AND object_data.obj_id = object_reference.obj_id ".
 
 3416                 $res = $ilDB->query($q);
 
 3422                         $ids[
$row->obj_id] = array(
 
 3423                         "ref_id"        => 
$row->ref_id,
 
 3424                         "title"         => 
$row->title,
 
 3425                         "description"   => 
$row->description);
 
 3428                 return $ids ? $ids : array();
 
 3436                 $my_pid = getmypid();
 
 3437                 return (
"MEMORY USAGE (% KB PID ): ".`ps -eo%mem,rss,pid | grep $my_pid`);
 
 3445                 if (strtolower(substr(php_uname(), 0, 3)) == 
"win")
 
 3455                 setlocale(LC_CTYPE, 
"UTF8", 
"en_US.UTF-8"); 
 
 3457                 return escapeshellarg($a_arg);
 
 3469                 if(ini_get(
'safe_mode') == 1)
 
 3473                 setlocale(LC_CTYPE, 
"UTF8", 
"en_US.UTF-8"); 
 
 3474                 return escapeshellcmd($a_arg);
 
 3489                         $cmd = 
'"'.$cmd.
'"';
 
 3494                                 if (version_compare(phpversion(), 
"5.2", 
"<") && strpos($args, 
'"') !== 
false)
 
 3496                                         $cmd = 
'"'.$cmd.
" ".$args.
'"';
 
 3534         function excelTime($year = 
"", $month = 
"", $day = 
"", $hour = 
"", $minute = 
"", $second = 
"")
 
 3536                 $starting_time = mktime(0, 0, 0, 1, 2, 1970);
 
 3537                 if (strcmp(
"$year$month$day$hour$minute$second", 
"") == 0)
 
 3539                         $target_time = time();
 
 3548                 $target_time = mktime($hour, $minute, $second, $month, $day, $year);
 
 3549                 $difference = $target_time - $starting_time;
 
 3550                 $days = (($difference - ($difference % 86400)) / 86400);
 
 3551                 $difference = $difference - ($days * 86400) + 3600;
 
 3552                 return ($days + 25570 + ($difference / 86400));
 
 3560                 $def_arr = explode(
",", SUFFIX_REPL_DEFAULT);
 
 3561                 foreach ($def_arr as $def)
 
 3566                 $def_arr = explode(
",", SUFFIX_REPL_ADDITIONAL);
 
 3567                 foreach ($def_arr as $def)
 
 3585                 if ($a_dir == 
"/" || $a_dir == 
"" || is_int(strpos($a_dir, 
".."))
 
 3586                         || trim($a_old_suffix) == 
"")
 
 3592                 if (!@is_dir($a_dir))
 
 3598                 $dir = opendir($a_dir);
 
 3602                         if (
$file != 
"." and
 
 3606                                 if (@is_dir($a_dir.
"/".
$file))
 
 3612                                 if (@is_file($a_dir.
"/".
$file))
 
 3615                                         if(strrpos(
$file,
'.') == (strlen(
$file) - 1))
 
 3617                                                 rename($a_dir.
'/'.
$file,substr($a_dir.
'/'.
$file,0,-1));
 
 3621                                         $path_info = pathinfo($a_dir.
"/".
$file);
 
 3623                                         if (strtolower($path_info[
"extension"]) ==
 
 3624                                         strtolower($a_old_suffix))
 
 3626                                                 $pos = strrpos($a_dir.
"/".
$file, 
".");
 
 3627                                                 $new_name = substr($a_dir.
"/".
$file, 0, $pos).
".".$a_new_suffix;
 
 3628                                                 rename($a_dir.
"/".
$file, $new_name);
 
 3637                 return  strpos($_SERVER[
"SCRIPT_FILENAME"],
"api") !== 
false ||
 
 3638                 strpos($_SERVER[
"SCRIPT_FILENAME"],
"dummy") !== 
false;
 
 3642                 if (preg_match(
"/&" . $paramName . 
"=/", $qstring)) {
 
 3643                         return preg_replace(
"/&" . $paramName . 
"=[^&]+/", 
"&" . $paramName . 
"=" . urlencode($paramValue), $qstring);
 
 3645                         return $qstring . 
"&" . $paramName . 
"=" . urlencode($paramValue);
 
 3651                 foreach ($parametersArray as $paramName => $paramValue ) {
 
 3663                 srand((
double) microtime()*1000000);
 
 3665                 include_once(
'./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
 
 3668         for ($i=1; $i<=$a_number; $i++)
 
 3670                 $min = ($security->getPasswordMinLength() > 0)
 
 3671                         ? $security->getPasswordMinLength()
 
 3673                 $max = ($security->getPasswordMaxLength() > 0)
 
 3674                         ? $security->getPasswordMaxLength()
 
 3680                         $length  = rand($min,$max);
 
 3683                         $consonants = 
"bcdfghjklmnpqrstvwxyz";
 
 3684                         $numbers = 
"1234567890";
 
 3685                         $special = 
"_.+?#-*@!$%~";
 
 3689                         if ($security->isPasswordCharsAndNumbersEnabled())
 
 3691                                 $num_pos = rand(0, $length - 1);
 
 3695                         if ($security->isPasswordSpecialCharsEnabled())
 
 3697                                 $spec_pos = rand(0, $length - 1);
 
 3698                                 if ($security->isPasswordCharsAndNumbersEnabled())
 
 3700                                         if ($num_pos == $spec_pos)      
 
 3713                         for ($j=0; $j < $length; $j++)
 
 3715                                 if ($security->isPasswordCharsAndNumbersEnabled() && $num_pos == $j)
 
 3717                                         $pw.= $numbers[rand(0,strlen($numbers)-1)];
 
 3719                                 else if ($security->isPasswordSpecialCharsEnabled() && $spec_pos == $j)
 
 3721                                         $pw.= $special[rand(0,strlen($special)-1)];
 
 3728                                                         $pw.= $consonants[rand(0,strlen($consonants)-1)];
 
 3733                                                         $pw.= $vowels[rand(0,strlen($vowels)-1)];
 
 3747                 $path = preg_replace(
"/[\/\\\]+$/", 
"", 
$path);
 
 3766                 foreach(
$data as $k=>$datum)
 
 3768                         if(is_null($datum)) 
$data[$k] = 
'null';
 
 3769                         if(is_string($datum)) 
$data[$k] = 
"'" . $datum . 
"'";
 
 3773                 return "[" . implode(
', ', 
$data) . 
"]";
 
 3784                 if (IL_VIRUS_SCANNER != 
"None")
 
 3786                         require_once(
"classes/class.ilVirusScannerFactory.php");
 
 3788                         if (($vs_txt = $vs->scanFile($a_file, $a_orig_name)) != 
"")
 
 3790                                 if ($a_clean && (IL_VIRUS_CLEAN_COMMAND != 
""))
 
 3792                                         $clean_txt = $vs->cleanFile($a_file, $a_orig_name);
 
 3793                                         if ($vs->fileCleaned())
 
 3795                                                 $vs_txt.= 
"<br />".$lng->txt(
"cleaned_file").
 
 3796                                                         "<br />".$clean_txt;
 
 3797                                                 $vs_txt.= 
"<br />".$lng->txt(
"repeat_scan");
 
 3798                                                 if (($vs2_txt = $vs->scanFile($a_file, $a_orig_name)) != 
"")
 
 3800                                                         return array(
false, nl2br($vs_txt).
"<br />".$lng->txt(
"repeat_scan_failed").
 
 3801                                                                 "<br />".nl2br($vs2_txt));
 
 3805                                                         return array(
true, nl2br($vs_txt).
"<br />".$lng->txt(
"repeat_scan_succeded"));
 
 3810                                                 return array(
false, nl2br($vs_txt).
"<br />".$lng->txt(
"cleaning_failed"));
 
 3815                                         return array(
false, nl2br($vs_txt));
 
 3820                 return array(
true,
"");
 
 3829                 global 
$lng, $ilias;
 
 3832                 if (!is_file($a_file))
 
 3834                         if ($a_raise_errors)
 
 3836                                 $ilias->raiseError($lng->txt(
"upload_error_file_not_found"), $ilias->error_obj->MESSAGE);
 
 3850                         if ($a_raise_errors)
 
 3852                                 $ilias->raiseError($lng->txt(
"file_is_infected").
"<br />".
 
 3854                                         $ilias->error_obj->MESSAGE);
 
 3869                         return move_uploaded_file($a_file, $a_target);
 
 3878                 list($datum, $uhrzeit) = explode (
" ",$mysql_date_time);
 
 3879                 list($jahr, $monat, $tag) = explode(
"-", $datum);
 
 3880                 list($std, $min, $sec) = explode(
":", $uhrzeit);
 
 3881                 return mktime ((
int) $std, (
int) $min, (
int) $sec, (
int) $monat, (
int) $tag, (
int) $jahr);
 
 3889                  return date(
"Y-m-d H:i:s");
 
 3907                 $resultarray = array();
 
 3908                 foreach (
$row as $rowindex => $entry)
 
 3915                         if (strpos($entry, 
"\"") !== FALSE)
 
 3917                                 $entry = str_replace(
"\"", 
"\"\"", $entry);
 
 3924                         if ($compatibleWithMSExcel)
 
 3927                                 $entry = str_replace(chr(13).chr(10), chr(10), $entry);
 
 3933                                         $resultarray[$rowindex] = 
"\"" . $entry . 
"\"";
 
 3937                                         $resultarray[$rowindex] = utf8_decode(
"\"" . $entry . 
"\"");
 
 3944                                         $resultarray[$rowindex] = $entry;
 
 3948                                         $resultarray[$rowindex] = utf8_decode($entry);
 
 3952                 return $resultarray;
 
 3958                 return(preg_match(
"/^[a-z]+([a-z0-9-]*[a-z0-9]+)?(\.([a-z]+([a-z0-9-]*[a-z0-9]+)?)+)*$/",$a_str));
 
 3964                 return(preg_match(
"/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.".
 
 3965                                                   "(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/",$a_str));
 
 3997                 global 
$ilDB,$rbacreview,$ilAccess,$ilUser,$ilias,$tree;
 
 3999                 if(!is_array($a_obj_type))
 
 4001                         $where = 
"WHERE type = ".$ilDB->quote($a_obj_type, 
"text").
" ";
 
 4005                         $where = 
"WHERE ".$ilDB->in(
"type", $a_obj_type, 
false, 
"text").
" ";
 
 4011                         $limit = $ilias->getSetting(
'search_max_hits',100);
 
 4019                 $a_usr_id = $a_usr_id ? $a_usr_id : $ilUser->getId();
 
 4020                 $a_roles = $rbacreview->assignedRoles($a_usr_id);
 
 4024                 if($rbacreview->isAssigned($a_usr_id,SYSTEM_ROLE_ID))
 
 4026                         $query = 
"SELECT ref_id FROM object_reference obr LEFT JOIN object_data obd ON obr.obj_id = obd.obj_id ".
 
 4027                                 "LEFT JOIN tree ON obr.ref_id = tree.child ".
 
 4033                         while(
$row = $ilDB->fetchObject(
$res))
 
 4036                                 if($tree->isGrandChild(RECOVERY_FOLDER_ID, 
$row->ref_id))
 
 4041                                 if($counter++ >= $limit)
 
 4046                                 $ref_ids[] = 
$row->ref_id;
 
 4048                         return $ref_ids ? $ref_ids : array();
 
 4052                 if($a_operation == 
'edit_permissions' or strpos($a_operation,
'create') !== 
false)
 
 4054                         $check_owner = 
") ";
 
 4058                         $check_owner = 
"OR owner = ".$ilDB->quote($a_usr_id, 
"integer").
") ";
 
 4062                 $ops_id = $ops_ids[0];
 
 4064                 $and = 
"AND ((".$ilDB->in(
"rol_id", $a_roles, 
false, 
"integer").
" ";
 
 4066                 $query = 
"SELECT DISTINCT(obr.ref_id),obr.obj_id,type FROM object_reference obr ".
 
 4067                         "JOIN object_data obd ON obd.obj_id = obr.obj_id ".
 
 4068                         "LEFT JOIN rbac_pa  ON obr.ref_id = rbac_pa.ref_id ".
 
 4071                         "AND (".$ilDB->like(
"ops_id", 
"text",
"%i:".$ops_id.
"%"). 
" ".
 
 4072                         "OR ".$ilDB->like(
"ops_id", 
"text", 
"%:\"".$ops_id.
"\";%").
")) ".
 
 4079                         if($counter >= $limit)
 
 4085                         if($tree->isGrandChild(RECOVERY_FOLDER_ID, 
$row->ref_id))
 
 4091                         if($ilAccess->checkAccessOfUser($a_usr_id,$a_operation,
'',
$row->ref_id,
$row->type,
$row->obj_id))
 
 4094                                 $ref_ids[] = 
$row->ref_id;
 
 4097                 return $ref_ids ? $ref_ids : array();
 
 4106         function insertLatexImages($a_text, $a_start = 
"\[tex\]", $a_end = 
"\[\/tex\]", $a_cgi = URL_TO_LATEX)
 
 4111                 include_once 
"./Services/Administration/classes/class.ilSetting.php";
 
 4112                 $jsMathSetting = 
new ilSetting(
"jsMath");
 
 4114                         $jsMathSetting->get(
"enable") && ($ilUser->getPref(
"js_math") || ($ilUser->getPref(
"js_math") === FALSE && ($jsMathSetting->get(
"makedefault"))));
 
 4119                         if (!$tpl->out_jsmath_info)
 
 4121                                 include_once 
"./classes/class.ilTemplate.php";
 
 4122                                 $template = 
new ilTemplate(
"tpl.jsmath_warning.html", TRUE, TRUE);
 
 4123                                 $lng->loadLanguageModule(
"jsmath");
 
 4124                                 $template->setVariable(
"TEXT_JSMATH_NO_JAVASCRIPT", $lng->txt(
"jsmath_no_javascript"));
 
 4125                                 $info = $template->get();
 
 4126                                 $tpl->out_jsmath_info = TRUE;
 
 4128                         $a_text = preg_replace(
"/\\\\([RZN])([^a-zA-Z]|<\/span>)/", 
"\\mathbb{".
"$1".
"}".
"$2", $a_text);
 
 4129                         $tpl->addJavaScript($jsMathSetting->get(
"path_to_jsmath") . 
"/easy/load.js");
 
 4134                 $o_start = $a_start;
 
 4136                 $a_start = str_replace(
"\\", 
"", $a_start);
 
 4137                 $a_end = str_replace(
"\\", 
"", $a_end);
 
 4144                 while (is_int($spos = stripos($a_text, $a_start, $cpos)))       
 
 4146                         if (is_int ($epos = stripos($a_text, $a_end, $spos + 1)))
 
 4148                                 $tex = substr($a_text, $spos + strlen($a_start), $epos - $spos - strlen($a_start));
 
 4151                                 if (!is_int(strpos($tex, 
"</div>")))
 
 4155                                                 $a_text = substr($a_text, 0, $spos).
 
 4156                                                         "<img alt=\"".htmlentities($tex).
"\" src=\"".$a_cgi.
"?".
 
 4157                                                         rawurlencode(str_replace(
'&', 
'&', str_replace(
'>', 
'>', str_replace(
'<', 
'<', $tex)))).
"\" ".
 
 4159                                                         substr($a_text, $epos + strlen($a_end));
 
 4163                                                 $tex = $a_start.$tex.$a_end;
 
 4166                                                         preg_replace(
'/' . $o_start . 
'(.*?)' . $o_end . 
'/ie',
 
 4167                                                         "'<span class=\"math\">' . preg_replace('/[\\\\\\\\\\]{2}/', '\\cr', str_replace('<', '<', str_replace('<br/>', '', str_replace('<br />', '', str_replace('<br>', '', '$1'))))) . '</span>[[info]]'", $tex);
 
 4170                                                 $a_text = substr($a_text, 0, $spos).
 
 4172                                                         substr($a_text, $epos + strlen($a_end));
 
 4181                         $a_text = str_replace(
"[[info]]", $info, $a_text);
 
 4184                 $result_text = $a_text;
 
 4192                 return $result_text;
 
 4209         include_once 
"./Services/Administration/classes/class.ilSetting.php";
 
 4210         $jsMathSetting = 
new ilSetting(
"jsMath");
 
 4211         if ($jsMathSetting->get(
"enable") && ($ilUser->getPref(
"js_math") || ($ilUser->getPref(
"js_math") === FALSE && ($jsMathSetting->get(
"makedefault")))))
 
 4214             if (!$tpl->out_jsmath_info)
 
 4216                 include_once 
"./classes/class.ilTemplate.php";
 
 4217                 $template = 
new ilTemplate(
"tpl.jsmath_warning.html", TRUE, TRUE);
 
 4218                 $lng->loadLanguageModule(
"jsmath");
 
 4219                 $template->setVariable(
"TEXT_JSMATH_NO_JAVASCRIPT", $lng->txt(
"jsmath_no_javascript"));
 
 4220                 $info = $template->get();
 
 4221                 $tpl->out_jsmath_info = TRUE;
 
 4223             $a_text = preg_replace(
"/\\\\([RZN])([^a-zA-Z]|<\/span>)/", 
"\\mathbb{".
"$1".
"}".
"$2", $a_text);
 
 4224             $result_text = preg_replace(
'/' . $a_start . 
'(.*?)' . $a_end . 
'/ie',
 
 4225                 "'<span class=\"math\">' . preg_replace('/[\\\\\\\\\\]{2}/', '\\cr', str_replace('<', '<', str_replace('<br/>', '', str_replace('<br />', '', str_replace('<br>', '', '$1'))))) . '</span>[[info]]'", $a_text);
 
 4227             $result_text = str_replace(
"[[info]]", $info, $result_text);
 
 4228             $tpl->addJavaScript($jsMathSetting->get(
"path_to_jsmath") . 
"/easy/load.js");
 
 4232             $result_text = preg_replace(
'/' . $a_start . 
'(.*?)' . $a_end . 
'/ie',
 
 4233                 "'<img alt=\"'.htmlentities('$1').'\" src=\"$a_cgi?'.rawurlencode(str_replace('&', '&', str_replace('>', '>', str_replace('<', '<', '$1')))).'\" ".
 
 4237         return $result_text;
 
 4246         function buildLatexImages($a_text, $a_dir ,$a_start = 
"\[tex\]", $a_end = 
"\[\/tex\]", $a_cgi = URL_TO_LATEX)
 
 4248                 $result_text = $a_text;
 
 4252                         while (preg_match(
'/' . $a_start . 
'(.*?)' . $a_end . 
'/ie', $result_text, $found))
 
 4254                                 $cnt = (int) 
$GLOBALS[
"teximgcnt"]++;
 
 4256                                 $fpr = @fopen($a_cgi.
"?".rawurlencode($found[1]), 
"r");
 
 4262                                                 $buf = fread($fpr, 1024);
 
 4265                                                         if (is_int(strpos(strtoupper(substr($buf, 0, 5)), 
"GIF")))
 
 4273                                                         $fpw = fopen($a_dir.
"/teximg/img".$cnt.
".".$suffix, 
"w");
 
 4283                                 $img_str = 
"./teximg/img".$cnt.
".".$suffix;
 
 4284                                 $result_text = str_replace($found[0],
 
 4285                                         '<img alt="'.$found[1].
'" src="'.$img_str.
'" />', $result_text);
 
 4289                 return $result_text;
 
 4302                 $is_html = $this->isHTML(
$result);
 
 4303                 if ($prepare_for_latex_output)
 
 4318                         if (preg_match_all(
"/(<pre>.*?<\/pre>)/ims", 
$result, $matches))
 
 4320                                 foreach ($matches[0] as $found)
 
 4323                                         if (strpos(
"\n", $found) === FALSE)
 
 4325                                                 $replacement = 
"\n";
 
 4327                                         $removed = preg_replace(
"/<br\s*?\/>/ims", $replacement, $found);
 
 4332                 if ($prepare_for_latex_output)
 
 4353                 if (!is_array($periods))
 
 4356                         'years' => 31536000,
 
 4357                         'months' => 2592000,
 
 4366                 $seconds = (float) $seconds;
 
 4367                 foreach ($periods as $period => $value)
 
 4369                         $count = floor($seconds / $value);
 
 4376                         $values[$period] = $count;
 
 4377                         $seconds = $seconds % $value;
 
 4398                 if (!is_array($duration))
 
 4403                 foreach ($duration as $key => $value) {
 
 4408                                 $segment_name = $key;
 
 4409                                 $segment_name = $lng->txt($segment_name);
 
 4410                                 $segment = $value . 
' ' . $segment_name;
 
 4414                                 $segment_name = substr($key, 0, -1);
 
 4415                                 $segment_name = $lng->txt($segment_name);
 
 4416                                 $segment = $value . 
' ' . $segment_name;
 
 4419                         $array[] = $segment;
 
 4421                 $len = count($array);
 
 4425                         $array=array_slice($array,0,(3-$len));
 
 4428                 $str = implode(
', ', $array);
 
 4438                 $umf=get_cfg_var(
"upload_max_filesize");
 
 4440                 $pms=get_cfg_var(
"post_max_size");
 
 4443                 $max_filesize=min($umf, $pms);
 
 4444                 if (!$max_filesize) $max_filesize=max($umf, $pms);
 
 4446                 return $lng->txt(
"file_notice").
" $max_filesize.";
 
 4458                 $test_str = explode(
'_',$role_title);
 
 4460                 if ($test_str[0] == 
'il')
 
 4462                         $test2 = (int) $test_str[3];
 
 4463                         return is_numeric ($test2) ? (int) $test2 : 
false;
 
 4480                 $test_str = explode(
'_',$ilias_id);
 
 4482                 if ($test_str[0] == 
'il' && $test_str[1] == $inst_id && count($test_str) == 4)
 
 4484                         $test2 = (int) $test_str[3];
 
 4485                         return is_numeric ($test2) ? (int) $test2 : 
false;
 
 4512                 $where = 
"WHERE ".$a_id_name.
" IN (";
 
 4516                 $query = 
"SELECT ".$a_id_name.
" FROM ".$a_table.
" ".
 
 4518                         "ORDER BY ".$a_field;
 
 4523                         $ids[] = 
$row->$a_id_name;
 
 4525                 return $ids ? $ids : array();
 
 4550                 if(!is_array($a_array) or !count($a_array))
 
 4555                 foreach($a_array as $k => $item)
 
 4557                         $a_array[$k] = $ilDB->quote($item);
 
 4569         public static function sendInfo($a_info = 
"",$a_keep = 
false)
 
 4572                 $tpl->setMessage(
"info", $a_info, $a_keep);
 
 4584                 $tpl->setMessage(
"failure", $a_info, $a_keep);
 
 4596                 $tpl->setMessage(
"question", $a_info, $a_keep);
 
 4608                 $tpl->setMessage(
"success", $a_info, $a_keep);
 
 4617                         $tpl->addBlockFile(
"INFOPANEL", 
"infopanel", 
"tpl.infopanel.html");
 
 4618                         $tpl->setCurrentBlock(
"infopanel");
 
 4620                         if (!empty(
$_SESSION[
"infopanel"][
"text"]))
 
 4622                                 $link = 
"<a href=\"".$dir.$_SESSION[
"infopanel"][
"link"].
"\" target=\"".
 
 4625                                 $link .= $lng->txt(
$_SESSION[
"infopanel"][
"text"]);
 
 4630                         if (!empty(
$_SESSION[
"infopanel"][
"img"]))
 
 4632                                 $link .= 
"<td><a href=\"".$_SESSION[
"infopanel"][
"link"].
"\" target=\"".
 
 4635                                 $link .= 
"<img src=\"".$ilias->tplPath.$ilias->account->prefs[
"skin"].
"/images/".
 
 4636                                         $_SESSION[
"infopanel"][
"img"].
"\" border=\"0\" vspace=\"0\"/>";
 
 4637                                 $link .= 
"</a></td>";
 
 4640                         $tpl->setVariable(
"INFO_ICONS",$link);
 
 4641                         $tpl->parseCurrentBlock();
 
 4661                 if (!is_dir($directory))
 
 4665                         $size = @filesize($directory);
 
 4669                 if ($DIR = opendir($directory))
 
 4671                         while (($dirfile = readdir($DIR)) !== 
false)
 
 4673                                 if (is_link($directory . DIRECTORY_SEPARATOR  . $dirfile) || $dirfile == 
'.' || $dirfile == 
'..')
 
 4675                                 if (is_file($directory .  DIRECTORY_SEPARATOR   . $dirfile))
 
 4676                                         $size += filesize($directory . DIRECTORY_SEPARATOR   . $dirfile);
 
 4677                                 else if (is_dir($directory . DIRECTORY_SEPARATOR   . $dirfile))
 
 4680                                         $dirSize = 
ilUtil::dirsize($directory .  DIRECTORY_SEPARATOR   . $dirfile);
 
 4694                 return md5(rand(1,9999999) + str_replace(
" ", 
"", (
string) microtime()));
 
 4697         public static function setCookie($a_cookie_name,$a_cookie_value = 
'', $a_also_set_super_global = 
true, $a_set_cookie_invalid = 
false)
 
 4704                 if(!(
bool)$a_set_cookie_invalid) $expire = 0;
 
 4705                 else $expire = time() - (365*24*60*60);
 
 4709                 if( version_compare(PHP_VERSION, 
'5.2.0', 
'>=') )
 
 4712                         setcookie( $a_cookie_name, $a_cookie_value, $expire,
 
 4713                                 IL_COOKIE_PATH, IL_COOKIE_DOMAIN, IL_COOKIE_SECURE, IL_COOKIE_HTTPONLY
 
 4719                         setcookie( $a_cookie_name, $a_cookie_value, $expire,
 
 4724                 if((
bool)$a_also_set_super_global) 
$_COOKIE[$a_cookie_name] = $a_cookie_value;
 
 4729                 return strip_tags(self::stripSlashes($a_filename));
 
 4736                 if($_SERVER[
'SHELL'])
 
 4738                         return $ilIliasIniFile->readVariable(
'server', 
'http_path');
 
 4742                         return ILIAS_HTTP_PATH;