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 if (isset($_SERVER[
"HTTPS"])) {
1986 #header("Pragma: ");
1987 #header("Cache-Control: ");
1988 #header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
1989 #header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
1990 #header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
1991 #header("Cache-Control: post-check=0, pre-check=0", false);
1993 else if ($disposition ==
"attachment")
1995 header(
"Cache-control: private");
1999 header(
"Cache-Control: no-cache, must-revalidate");
2000 header(
"Pragma: no-cache");
2005 if (strlen($charset))
2007 $charset =
"; charset=$charset";
2009 header(
"Content-Type: $mime$charset");
2010 header(
"Content-Disposition:$disposition; filename=\"".$ascii_filename.
"\"");
2011 header(
"Content-Description: ".$ascii_filename);
2012 header(
"Content-Length: ".(
string)(strlen($a_data)));
2014 if($_SERVER[
'HTTPS'])
2016 header(
'Cache-Control: must-revalidate, post-check=0, pre-check=0');
2017 header(
'Pragma: public');
2020 header(
"Connection: close");
2031 function deliverFile($a_file, $a_filename,$a_mime =
'', $isInline =
false, $removeAfterDelivery =
false)
2034 if(!file_exists($a_file))
2040 $disposition =
"inline";
2042 $disposition =
"attachment";
2053 $mime =
"application/octet-stream";
2057 if ($disposition ==
"attachment")
2059 header(
"Cache-control: private");
2063 header(
"Cache-Control: no-cache, must-revalidate");
2064 header(
"Pragma: no-cache");
2069 header(
"Content-Type: $mime");
2070 header(
"Content-Disposition:$disposition; filename=\"".$ascii_filename.
"\"");
2071 header(
"Content-Description: ".$ascii_filename);
2074 $filesize = @filesize($a_file);
2077 header(
"Content-Length: ".(
string)$filesize);
2080 include_once
'./classes/class.ilHTTPS.php';
2081 #if($_SERVER['HTTPS'])
2084 header(
'Cache-Control: must-revalidate, post-check=0, pre-check=0');
2085 header(
'Pragma: public');
2088 header(
"Connection: close");
2090 if ($removeAfterDelivery)
2106 $chunksize = 1*(1024*1024);
2108 $handle = fopen($a_file,
'rb');
2115 $buffer = fread(
$handle, $chunksize);
2146 $user_agent = strtolower($_SERVER[
"HTTP_USER_AGENT"]);
2147 if ((is_integer(strpos($user_agent,
"msie"))) && is_integer(strpos($user_agent,
"win")))
2152 $ascii_filename = utf8_decode($a_filename);
2159 $ascii_filename = htmlentities($a_filename,ENT_NOQUOTES,
'UTF-8');
2160 $ascii_filename = preg_replace(
'/\&(.)[^;]*;/',
'\\1', $ascii_filename);
2161 $ascii_filename = preg_replace(
'/[\x7f-\xff]/',
'_', $ascii_filename);
2168 $ascii_filename = preg_replace(
'/[:\x5c\/\*\?\"<>\|]/',
'_', $ascii_filename);
2171 return $ascii_filename;
2180 $sep =
'###HTMLTAG###';
2182 preg_match_all(
"@<[^>]*>@", $htmlText, $matches);
2183 $tmp = preg_replace(
"@(<[^>]*>)@", $sep, $htmlText);
2184 $tmp = explode($sep, $tmp);
2186 for ($i=0; $i<count($tmp); $i++)
2187 $tmp[$i] = htmlentities($tmp[$i], ENT_COMPAT,
"UTF-8");
2189 $tmp = join($sep, $tmp);
2191 for ($i=0; $i<count($matches[0]); $i++)
2192 $tmp = preg_replace(
"@$sep@", $matches[0][$i], $tmp, 1);
2202 return PATH_TO_JAVA;
2218 $url = (is_int(strpos($a_url,
"?")))
2219 ? $a_url.$amp.$a_par
2220 : $a_url.
"?".$a_par;
2241 $a_dir = trim($a_dir);
2244 if (substr($a_dir,-1) ==
"/")
2246 $a_dir = substr($a_dir,0,-1);
2250 if (!(
$path = substr($a_dir,0, strrpos($a_dir,
"/") - strlen($a_dir))))
2257 return @mkdir($a_dir,fileperms(
$path));
2275 $dirs = array($a_dir);
2276 $a_dir = dirname($a_dir);
2279 while($last_dirname != $a_dir)
2281 array_unshift(
$dirs, $a_dir);
2282 $last_dirname = $a_dir;
2283 $a_dir = dirname($a_dir);
2287 $reverse_paths = array_reverse(
$dirs, TRUE);
2289 foreach ($reverse_paths as $key => $value)
2291 if ($found_index == -1)
2295 $found_index = $key;
2304 if ($dirindex >= $found_index)
2306 if (! file_exists(
$dir))
2308 if (strcmp(substr(
$dir,strlen(
$dir)-1,1),
"/") == 0)
2314 if (! mkdir(
$dir, $umask))
2316 error_log(
"Can't make directory: $dir");
2320 elseif (! is_dir(
$dir))
2322 error_log(
"$dir is not a directory");
2328 $umask = fileperms(
$dir);
2342 public static function delDir($a_dir, $a_clean_only =
false)
2344 if (!is_dir($a_dir) || is_int(strpos($a_dir,
"..")))
2349 $current_dir = opendir($a_dir);
2358 while($entryname = readdir($current_dir))
2365 if(is_dir($a_dir.
"/".$file) and ($file !=
"." and $file!=
".."))
2369 elseif ($file !=
"." and $file !=
"..")
2371 unlink(${a_dir}.
"/".${file});
2375 closedir($current_dir);
2388 $current_dir = opendir($a_dir);
2392 while($entry = readdir($current_dir))
2394 if(is_dir($a_dir.
"/".$entry))
2396 $dirs[$entry] = array(
"type" =>
"dir",
"entry" => $entry);
2400 if ($entry !=
"." && $entry !=
"..")
2402 $size = filesize($a_dir.
"/".$entry);
2403 $files[$entry] = array(
"type" =>
"file",
"entry" => $entry,
2419 if (is_array($a_arr))
2421 foreach ($a_arr as $k => $v)
2435 if (is_array($a_data))
2437 foreach ($a_data as $k => $v)
2462 public static function stripSlashes($a_str, $a_strip_html =
true, $a_allow =
"")
2464 if (ini_get(
"magic_quotes_gpc"))
2466 $a_str = stripslashes($a_str);
2479 if (ini_get(
"magic_quotes_gpc"))
2481 $a_str = stripslashes($a_str);
2493 $only_secure =
true;
2494 $allow_tags = explode(
">", $a_allow);
2496 $allow_array = array();
2497 foreach($allow_tags as $allow)
2501 $allow = str_replace(
"<",
"", $allow);
2503 if (!in_array($allow, $sec_tags))
2505 $only_secure =
false;
2507 $allow_array[] = $allow;
2512 if (($only_secure || $a_allow ==
"") && $a_strip_html)
2516 $allow_array = array (
"b",
"i",
"strong",
"em",
"code",
"cite",
2517 "gap",
"sub",
"sup",
"pre",
"strike");
2523 $a_str = strip_tags($a_str);
2548 return array(
"strong",
"em",
"u",
"strike",
"ol",
"li",
"ul",
"p",
"div",
2549 "i",
"b",
"code",
"sup",
"sub",
"pre",
"gap",
"a",
"img");
2554 foreach ($allow_array as
$t)
2569 array(
"param" =>
"align",
"value" =>
"left"),
2570 array(
"param" =>
"align",
"value" =>
"center"),
2571 array(
"param" =>
"align",
"value" =>
"justify"),
2572 array(
"param" =>
"align",
"value" =>
"right")
2587 foreach ($allow_array as
$t)
2602 array(
"param" =>
"align",
"value" =>
"left"),
2603 array(
"param" =>
"align",
"value" =>
"center"),
2604 array(
"param" =>
"align",
"value" =>
"justify"),
2605 array(
"param" =>
"align",
"value" =>
"right")
2624 if (ini_get(
"magic_quotes_gpc"))
2626 return stripslashes($a_str);
2651 if ($a_make_links_clickable)
2669 $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);
2672 foreach ($matches as $match)
2675 foreach ($matches[0] as $match)
2677 $matched_text = $match[0];
2679 if ($matched_offset != previous_offset)
2682 $encoded .= nl2br(htmlspecialchars(substr($a_str, $pos1, $pos2 - $pos1)));
2688 $pos1 = $pos2 + strlen($matched_text);
2690 if ($pos1 < strlen($a_str))
2692 $encoded .= nl2br(htmlspecialchars(substr($a_str, $pos1)));
2697 $encoded = nl2br(htmlspecialchars($a_str));
2707 $ws =
"[ \t\r\f\v\n]*";
2708 $att = $ws.
"[^>]*".$ws;
2710 while (eregi(
"<($tag$att($tag_att$ws=$ws\"(([\$@!*()~;,_0-9A-z/:=%\\.&#?+\\-])*)\")$att)>",
2713 $un = array(
".",
"-",
"+",
"?",
'$',
"*",
"(",
")");
2719 $ff = str_replace($un, $esc, $found[1]);
2722 $a_str = eregi_replace(
"<".$ff.
">",
2723 "<$tag $tag_att$tag_att=\"".$found[3].
"\">", $a_str);
2724 if ($old_str == $a_str)
2726 $ilLog->write(
"ilUtil::maskA-".htmlentities($old_str).
" == ".
2727 htmlentities($a_str));
2731 $a_str = str_ireplace(
"</$tag>",
2732 "</$tag>", $a_str);
2740 while (eregi(
"<($tag $tag_att$tag_att=\"(([\$@!*()~;,_0-9A-z/:=%\\.&#?+\\-])*)\")>",
2743 $un = array(
".",
"-",
"+",
"?",
'$',
"*",
"(",
")");
2749 $ff = str_replace($un, $esc, $found[1]);
2752 $a_str = eregi_replace(
"<".$ff.
">",
2753 "<$tag $tag_att=\"".ilUtil::secureLink($found[2]).
"\">", $a_str);
2754 if ($old_str == $a_str)
2756 $ilLog->write(
"ilUtil::unmaskA-".htmlentities($old_str).
" == ".
2757 htmlentities($a_str));
2761 $a_str = str_replace(
"</$tag>",
"</$tag>", $a_str);
2767 $a_str = str_replace(array(
"<$t>",
"<".strtoupper(
$t).
">"),
2768 "<".
$t.
">", $a_str);
2769 $a_str = str_replace(array(
"</$t>",
"</".strtoupper(
$t).
">"),
2770 "</".
$t.
">", $a_str);
2772 if (is_array($fix_param))
2774 foreach ($fix_param as $p)
2778 $a_str = str_replace(
"<$t $k=\"$v\">",
2779 "<".
"$t $k=\"$v\"".
">", $a_str);
2788 $a_str = str_replace(
"<".
$t.
">",
"<".$t.
">", $a_str);
2789 $a_str = str_replace(
"</".
$t.
">",
"</".$t.
">", $a_str);
2791 if (is_array($fix_param))
2793 foreach ($fix_param as $p)
2797 $a_str = str_replace(
"<$t $k=\"$v\">",
2798 "<".
"$t $k=\"$v\"".
">", $a_str);
2806 $a_str = str_ireplace(
"javascript",
"jvscrpt", $a_str);
2807 $a_str = str_ireplace(array(
"%00",
"%0a",
"%0d",
"%1a",
"�",
"�",
2808 "�",
"�",
"
",
"
",
" ",
" "),
"-", $a_str);
2827 $negativestr =
"a,abbr,acronym,address,applet,area,b,base,basefont,".
2828 "bdo,big,blockquote,body,br,button,caption,center,cite,code,col,".
2829 "colgroup,dd,del,dfn,dir,div,dl,dt,em,fieldset,font,form,frame,".
2830 "frameset,h1,h2,h3,h4,h5,h6,head,hr,html,i,iframe,img,input,ins,isindex,kbd,".
2831 "label,legend,li,link,map,menu,meta,noframes,noscript,object,ol,".
2832 "optgroup,option,p,param,q,s,samp,script,select,small,span,".
2833 "strike,strong,style,sub,sup,table,tbody,td,textarea,tfoot,th,thead,".
2834 "title,tr,tt,u,ul,var";
2835 $a_allow = strtolower ($a_allow);
2836 $negatives = explode(
",",$negativestr);
2837 $outer_old_str =
"";
2838 while($outer_old_str != $a_str)
2840 $outer_old_str = $a_str;
2841 foreach ($negatives as $item)
2843 $pos = strpos($a_allow,
"<$item>");
2849 while($old_str != $a_str)
2852 $a_str = preg_replace(
"/<\/?\s*$item(\/?)\s*>/i",
"", $a_str);
2853 $a_str = preg_replace(
"/<\/?\s*$item(\/?)\s+([^>]*)>/i",
"", $a_str);
2862 $a_str = preg_replace(
"/<\s*\w*(\/?)(\s+[^>]*)?(\s+on[^>]*)>/i",
"", $a_str);
2865 $a_str = preg_replace(
"/<\s*\w*(\/?)\s+[^>]*javascript[^>]*>/i",
"", $a_str);
2869 $a_str = preg_replace(
"/<\s*\w*(\/?)\s+[^>]*expression[^>]*>/i",
"", $a_str);
2883 if (ini_get(
"magic_quotes_gpc"))
2889 return addslashes($a_str);
2908 $a_str = htmlspecialchars($a_str);
2912 $a_str = str_replace(
"{",
"{", $a_str);
2913 $a_str = str_replace(
"}",
"}", $a_str);
2930 return addslashes($a_str);
2958 while(($spos=strpos($a_parstr,
"=")) &&
$ok)
2961 $cpar = substr($a_parstr,0,$spos);
2962 $a_parstr = substr($a_parstr,$spos,strlen($a_parstr)-$spos);
2963 while(substr($cpar,0,1)==
"," ||substr($cpar,0,1)==
" " || substr($cpar,0,1)==chr(13) || substr($cpar,0,1)==chr(10))
2964 $cpar = substr($cpar,1,strlen($cpar)-1);
2965 while(substr($cpar,strlen($cpar)-1,1)==
" " || substr($cpar,strlen($cpar)-1,1)==chr(13) || substr($cpar,strlen($cpar)-1,1)==chr(10))
2966 $cpar = substr($cpar,0,strlen($cpar)-1);
2970 while($cpar != $cpar_old)
2973 $cpar = eregi_replace(
"[^a-zA-Z0-9_]",
"", $cpar);
2979 if($spos=strpos($a_parstr,
"\""))
2981 $a_parstr = substr($a_parstr,$spos+1,strlen($a_parstr)-$spos);
2982 $spos=strpos($a_parstr,
"\"");
2985 $cval = substr($a_parstr,0,$spos);
2987 $a_parstr = substr($a_parstr,$spos+1,strlen($a_parstr)-$spos-1);
2997 if(
$ok)
return $par;
else return false;
3002 if (is_array($a_par_arr))
3005 foreach ($a_par_arr as $par => $val)
3021 for($i=0; $i<strlen($a_str); $i++)
3023 $ret.= ord(substr($a_str,$i,1)).
" ";
3034 if(strtolower($a_yn) ==
"y")
3069 global $array_sortby,$array_sortorder;
3073 if ($array_sortorder ==
"asc")
3078 if ($array_sortorder ==
"desc")
3080 return !
ilStr::strCmp($a[$array_sortby], $b[$array_sortby]);
3095 global $array_sortby,$array_sortorder;
3097 if ($array_sortorder ==
"asc")
3099 return $a[
"$array_sortby"] > $b[
"$array_sortby"];
3102 if ($array_sortorder ==
"desc")
3104 return $a[
"$array_sortby"] < $b[
"$array_sortby"];
3117 public static function sortArray($array,$a_array_sortby,$a_array_sortorder = 0,$a_numeric =
false,
3118 $a_keep_keys =
false)
3120 include_once(
"./Services/Utilities/classes/class.ilStr.php");
3123 if (! $a_keep_keys) {
3128 global $array_sortby,$array_sortorder;
3130 $array_sortby = $a_array_sortby;
3132 if ($a_array_sortorder ==
"desc")
3134 $array_sortorder =
"desc";
3138 $array_sortorder =
"asc";
3144 uasort($array, array(
"ilUtil",
"sort_func_numeric"));
3148 usort($array, array(
"ilUtil",
"sort_func_numeric"));
3155 uasort($array, array(
"ilUtil",
"sort_func"));
3159 usort($array, array(
"ilUtil",
"sort_func"));
3179 function stableSortArray($array,$a_array_sortby,$a_array_sortorder = 0,$a_numeric =
false)
3181 global $array_sortby,$array_sortorder;
3183 $array_sortby = $a_array_sortby;
3185 if ($a_array_sortorder ==
"desc")
3187 $array_sortorder =
"desc";
3191 $array_sortorder =
"asc";
3195 $sort_array = array_values($array);
3210 if (count($array) < 2)
return;
3213 $halfway = count($array) / 2;
3214 $array1 = array_slice($array, 0, $halfway);
3215 $array2 = array_slice($array, $halfway);
3222 if (call_user_func($cmp_function, end($array1), $array2[0]) < 1) {
3223 $array = array_merge($array1, $array2);
3230 while ($ptr1 < count($array1) && $ptr2 < count($array2)) {
3231 if (call_user_func($cmp_function, $array1[$ptr1], $array2[$ptr2]) < 1) {
3232 $array[] = $array1[$ptr1++];
3235 $array[] = $array2[$ptr2++];
3240 while ($ptr1 < count($array1)) $array[] = $array1[$ptr1++];
3241 while ($ptr2 < count($array2)) $array[] = $array2[$ptr2++];
3259 $existing_sub_key_values = array();
3261 foreach ($array as $key=>$sub_array)
3263 if (!in_array($sub_array[$sub_key], $existing_sub_key_values))
3265 $existing_sub_key_values[] = $sub_array[$sub_key];
3266 $target[$key] = $sub_array;
3283 $a_desired_type = strtolower($a_desired_type);
3285 $im_types = ImageTypes();
3287 switch($a_desired_type)
3290 if ($im_types & IMG_JPG)
return "jpg";
3291 if ($im_types & IMG_GIF)
return "gif";
3292 if ($im_types & IMG_PNG)
return "png";
3296 if ($im_types & IMG_GIF)
return "gif";
3297 if ($im_types & IMG_JPG)
return "jpg";
3298 if ($im_types & IMG_PNG)
return "png";
3302 if ($im_types & IMG_PNG)
return "png";
3303 if ($im_types & IMG_JPG)
return "jpg";
3304 if ($im_types & IMG_GIF)
return "gif";
3320 if (($a_mime ==
"image/gif") || ($a_mime ==
"image/jpeg") ||
3321 ($a_mime ==
"image/png") || ($a_mime ==
"application/x-shockwave-flash") ||
3322 ($a_mime ==
"image/tiff") || ($a_mime ==
"image/x-ms-bmp") ||
3323 ($a_mime ==
"image/psd") || ($a_mime ==
"image/iff"))
3341 global
$log, $PHP_SELF;
3344 if (!is_int(strpos($a_script,
"://")))
3346 if (substr($a_script, 0, 1) !=
"/" && defined(
"ILIAS_HTTP_PATH"))
3348 if (is_int(strpos($_SERVER[
"PHP_SELF"],
"/setup/")))
3350 $a_script =
"setup/".$a_script;
3352 $a_script = ILIAS_HTTP_PATH.
"/".$a_script;
3356 header(
"Location: ".$a_script);
3367 if (substr($a_value, 0, 4) ==
"il__")
3369 $a_value =
"il_".IL_INST_ID.
"_".substr($a_value, 4, strlen($a_value) - 4);
3387 if (empty($a_group_name))
3389 $message = get_class($this).
"::_NameExists(): No groupname given!";
3390 $ilErr->raiseError($message,$ilErr->WARNING);
3393 $clause = ($a_id) ?
" AND obj_id != ".$ilDB->quote($a_id).
" " :
"";
3395 $q =
"SELECT obj_id FROM object_data ".
3396 "WHERE title = ".$ilDB->quote($a_group_name,
"text").
" ".
3397 "AND type = ".$ilDB->quote(
"grp",
"text").
3400 $r = $ilDB->query($q);
3423 "FROM object_data ,object_reference ".
3424 "WHERE (".$ilDB->like(
"object_data.title",
"text",
"%".$a_search_str.
"%").
" ".
3425 "OR ".$ilDB->like(
"object_data.description",
"text",
"%".$a_search_str.
"%").
") ".
3426 "AND object_data.type = 'grp' ".
3427 "AND object_data.obj_id = object_reference.obj_id ".
3430 $res = $ilDB->query($q);
3436 $ids[
$row->obj_id] = array(
3437 "ref_id" =>
$row->ref_id,
3438 "title" =>
$row->title,
3439 "description" =>
$row->description);
3442 return $ids ? $ids : array();
3450 $my_pid = getmypid();
3451 return (
"MEMORY USAGE (% KB PID ): ".`ps -eo%mem,rss,pid | grep $my_pid`);
3459 if (strtolower(substr(php_uname(), 0, 3)) ==
"win")
3469 setlocale(LC_CTYPE,
"UTF8",
"en_US.UTF-8");
3471 return escapeshellarg($a_arg);
3483 if(ini_get(
'safe_mode') == 1)
3487 setlocale(LC_CTYPE,
"UTF8",
"en_US.UTF-8");
3488 return escapeshellcmd($a_arg);
3503 $cmd =
'"'.$cmd.
'"';
3508 if (version_compare(phpversion(),
"5.2",
"<") && strpos($args,
'"') !==
false)
3510 $cmd =
'"'.$cmd.
" ".$args.
'"';
3548 function excelTime($year =
"", $month =
"", $day =
"", $hour =
"", $minute =
"", $second =
"")
3550 $starting_time = mktime(0, 0, 0, 1, 2, 1970);
3551 if (strcmp(
"$year$month$day$hour$minute$second",
"") == 0)
3553 $target_time = time();
3562 $target_time = mktime($hour, $minute, $second, $month, $day, $year);
3563 $difference = $target_time - $starting_time;
3564 $days = (($difference - ($difference % 86400)) / 86400);
3565 $difference = $difference - ($days * 86400) + 3600;
3566 return ($days + 25570 + ($difference / 86400));
3574 $def_arr = explode(
",", SUFFIX_REPL_DEFAULT);
3575 foreach ($def_arr as $def)
3580 $def_arr = explode(
",", SUFFIX_REPL_ADDITIONAL);
3581 foreach ($def_arr as $def)
3599 if ($a_dir ==
"/" || $a_dir ==
"" || is_int(strpos($a_dir,
".."))
3600 || trim($a_old_suffix) ==
"")
3606 if (!@is_dir($a_dir))
3612 $dir = opendir($a_dir);
3616 if (
$file !=
"." and
3620 if (@is_dir($a_dir.
"/".
$file))
3626 if (@is_file($a_dir.
"/".
$file))
3629 if(strrpos(
$file,
'.') == (strlen(
$file) - 1))
3631 rename($a_dir.
'/'.
$file,substr($a_dir.
'/'.
$file,0,-1));
3635 $path_info = pathinfo($a_dir.
"/".
$file);
3637 if (strtolower($path_info[
"extension"]) ==
3638 strtolower($a_old_suffix))
3641 $new_name = substr($a_dir.
"/".
$file, 0,
$pos).
".".$a_new_suffix;
3642 rename($a_dir.
"/".
$file, $new_name);
3651 return strpos($_SERVER[
"SCRIPT_FILENAME"],
"api") !==
false ||
3652 strpos($_SERVER[
"SCRIPT_FILENAME"],
"dummy") !==
false;
3656 if (preg_match(
"/&" . $paramName .
"=/", $qstring)) {
3657 return preg_replace(
"/&" . $paramName .
"=[^&]+/",
"&" . $paramName .
"=" . urlencode($paramValue), $qstring);
3659 return $qstring .
"&" . $paramName .
"=" . urlencode($paramValue);
3665 foreach ($parametersArray as $paramName => $paramValue ) {
3677 srand((
double) microtime()*1000000);
3679 include_once(
'./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
3682 for ($i=1; $i<=$a_number; $i++)
3684 $min = ($security->getPasswordMinLength() > 0)
3685 ? $security->getPasswordMinLength()
3687 $max = ($security->getPasswordMaxLength() > 0)
3688 ? $security->getPasswordMaxLength()
3694 $length = rand($min,$max);
3697 $consonants =
"bcdfghjklmnpqrstvwxyz";
3698 $numbers =
"1234567890";
3699 $special =
"_.+?#-*@!$%~";
3703 if ($security->isPasswordCharsAndNumbersEnabled())
3705 $num_pos = rand(0, $length - 1);
3709 if ($security->isPasswordSpecialCharsEnabled())
3711 $spec_pos = rand(0, $length - 1);
3712 if ($security->isPasswordCharsAndNumbersEnabled())
3714 if ($num_pos == $spec_pos)
3727 for ($j=0; $j < $length; $j++)
3729 if ($security->isPasswordCharsAndNumbersEnabled() && $num_pos == $j)
3731 $pw.= $numbers[rand(0,strlen($numbers)-1)];
3733 else if ($security->isPasswordSpecialCharsEnabled() && $spec_pos == $j)
3735 $pw.= $special[rand(0,strlen($special)-1)];
3742 $pw.= $consonants[rand(0,strlen($consonants)-1)];
3747 $pw.= $vowels[rand(0,strlen($vowels)-1)];
3761 $path = preg_replace(
"/[\/\\\]+$/",
"",
$path);
3780 foreach(
$data as $k=>$datum)
3782 if(is_null($datum))
$data[$k] =
'null';
3783 if(is_string($datum))
$data[$k] =
"'" . $datum .
"'";
3787 return "[" . implode(
', ',
$data) .
"]";
3798 if (IL_VIRUS_SCANNER !=
"None")
3800 require_once(
"classes/class.ilVirusScannerFactory.php");
3802 if (($vs_txt = $vs->scanFile($a_file, $a_orig_name)) !=
"")
3804 if ($a_clean && (IL_VIRUS_CLEAN_COMMAND !=
""))
3806 $clean_txt = $vs->cleanFile($a_file, $a_orig_name);
3807 if ($vs->fileCleaned())
3809 $vs_txt.=
"<br />".$lng->txt(
"cleaned_file").
3810 "<br />".$clean_txt;
3811 $vs_txt.=
"<br />".$lng->txt(
"repeat_scan");
3812 if (($vs2_txt = $vs->scanFile($a_file, $a_orig_name)) !=
"")
3814 return array(
false, nl2br($vs_txt).
"<br />".$lng->txt(
"repeat_scan_failed").
3815 "<br />".nl2br($vs2_txt));
3819 return array(
true, nl2br($vs_txt).
"<br />".$lng->txt(
"repeat_scan_succeded"));
3824 return array(
false, nl2br($vs_txt).
"<br />".$lng->txt(
"cleaning_failed"));
3829 return array(
false, nl2br($vs_txt));
3834 return array(
true,
"");
3843 global
$lng, $ilias;
3846 if (!is_file($a_file))
3848 if ($a_raise_errors)
3850 $ilias->raiseError($lng->txt(
"upload_error_file_not_found"), $ilias->error_obj->MESSAGE);
3864 if ($a_raise_errors)
3866 $ilias->raiseError($lng->txt(
"file_is_infected").
"<br />".
3868 $ilias->error_obj->MESSAGE);
3883 return move_uploaded_file($a_file, $a_target);
3892 list($datum, $uhrzeit) = explode (
" ",$mysql_date_time);
3893 list($jahr, $monat, $tag) = explode(
"-", $datum);
3894 list($std, $min, $sec) = explode(
":", $uhrzeit);
3895 return mktime ((
int) $std, (
int) $min, (
int) $sec, (
int) $monat, (
int) $tag, (
int) $jahr);
3903 return date(
"Y-m-d H:i:s");
3921 $resultarray = array();
3922 foreach (
$row as $rowindex => $entry)
3929 if (strpos($entry,
"\"") !== FALSE)
3931 $entry = str_replace(
"\"",
"\"\"", $entry);
3938 if ($compatibleWithMSExcel)
3941 $entry = str_replace(chr(13).chr(10), chr(10), $entry);
3947 $resultarray[$rowindex] =
"\"" . $entry .
"\"";
3951 $resultarray[$rowindex] = utf8_decode(
"\"" . $entry .
"\"");
3958 $resultarray[$rowindex] = $entry;
3962 $resultarray[$rowindex] = utf8_decode($entry);
3966 return $resultarray;
3972 return(preg_match(
"/^[a-z]+([a-z0-9-]*[a-z0-9]+)?(\.([a-z]+([a-z0-9-]*[a-z0-9]+)?)+)*$/",$a_str));
3978 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])\.".
3979 "(\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));
4011 global
$ilDB,$rbacreview,$ilAccess,$ilUser,$ilias,$tree;
4013 if(!is_array($a_obj_type))
4015 $where =
"WHERE type = ".$ilDB->quote($a_obj_type,
"text").
" ";
4019 $where =
"WHERE ".$ilDB->in(
"type", $a_obj_type,
false,
"text").
" ";
4025 $limit = $ilias->getSetting(
'search_max_hits',100);
4033 $a_usr_id = $a_usr_id ? $a_usr_id : $ilUser->getId();
4034 $a_roles = $rbacreview->assignedRoles($a_usr_id);
4038 if($rbacreview->isAssigned($a_usr_id,SYSTEM_ROLE_ID))
4040 $query =
"SELECT ref_id FROM object_reference obr LEFT JOIN object_data obd ON obr.obj_id = obd.obj_id ".
4041 "LEFT JOIN tree ON obr.ref_id = tree.child ".
4047 while(
$row = $ilDB->fetchObject(
$res))
4050 if($tree->isGrandChild(RECOVERY_FOLDER_ID,
$row->ref_id))
4055 if($counter++ >= $limit)
4060 $ref_ids[] =
$row->ref_id;
4062 return $ref_ids ? $ref_ids : array();
4066 if($a_operation ==
'edit_permissions' or strpos($a_operation,
'create') !==
false)
4068 $check_owner =
") ";
4072 $check_owner =
"OR owner = ".$ilDB->quote($a_usr_id,
"integer").
") ";
4076 $ops_id = $ops_ids[0];
4078 $and =
"AND ((".$ilDB->in(
"rol_id", $a_roles,
false,
"integer").
" ";
4080 $query =
"SELECT DISTINCT(obr.ref_id),obr.obj_id,type FROM object_reference obr ".
4081 "JOIN object_data obd ON obd.obj_id = obr.obj_id ".
4082 "LEFT JOIN rbac_pa ON obr.ref_id = rbac_pa.ref_id ".
4085 "AND (".$ilDB->like(
"ops_id",
"text",
"%i:".$ops_id.
"%").
" ".
4086 "OR ".$ilDB->like(
"ops_id",
"text",
"%:\"".$ops_id.
"\";%").
")) ".
4093 if($counter >= $limit)
4099 if($tree->isGrandChild(RECOVERY_FOLDER_ID,
$row->ref_id))
4105 if($ilAccess->checkAccessOfUser($a_usr_id,$a_operation,
'',
$row->ref_id,
$row->type,
$row->obj_id))
4108 $ref_ids[] =
$row->ref_id;
4111 return $ref_ids ? $ref_ids : array();
4120 function insertLatexImages($a_text, $a_start =
"\[tex\]", $a_end =
"\[\/tex\]", $a_cgi = URL_TO_LATEX)
4125 include_once
"./Services/Administration/classes/class.ilSetting.php";
4126 $jsMathSetting =
new ilSetting(
"jsMath");
4128 $jsMathSetting->get(
"enable") && ($ilUser->getPref(
"js_math") || ($ilUser->getPref(
"js_math") === FALSE && ($jsMathSetting->get(
"makedefault"))));
4133 if (!$tpl->out_jsmath_info)
4135 include_once
"./classes/class.ilTemplate.php";
4136 $template =
new ilTemplate(
"tpl.jsmath_warning.html", TRUE, TRUE);
4137 $lng->loadLanguageModule(
"jsmath");
4138 $template->setVariable(
"TEXT_JSMATH_NO_JAVASCRIPT", $lng->txt(
"jsmath_no_javascript"));
4139 $info = $template->get();
4140 $tpl->out_jsmath_info = TRUE;
4142 $a_text = preg_replace(
"/\\\\([RZN])([^a-zA-Z]|<\/span>)/",
"\\mathbb{".
"$1".
"}".
"$2", $a_text);
4143 $tpl->addJavaScript($jsMathSetting->get(
"path_to_jsmath") .
"/easy/load.js");
4148 $o_start = $a_start;
4150 $a_start = str_replace(
"\\",
"", $a_start);
4151 $a_end = str_replace(
"\\",
"", $a_end);
4158 while (is_int($spos = stripos($a_text, $a_start, $cpos)))
4160 if (is_int ($epos = stripos($a_text, $a_end, $spos + 1)))
4162 $tex = substr($a_text, $spos + strlen($a_start), $epos - $spos - strlen($a_start));
4165 if (!is_int(strpos($tex,
"</div>")))
4169 $a_text = substr($a_text, 0, $spos).
4170 "<img alt=\"".htmlentities($tex).
"\" src=\"".$a_cgi.
"?".
4171 rawurlencode(str_replace(
'&',
'&', str_replace(
'>',
'>', str_replace(
'<',
'<', $tex)))).
"\" ".
4173 substr($a_text, $epos + strlen($a_end));
4177 $tex = $a_start.$tex.$a_end;
4180 preg_replace(
'/' . $o_start .
'(.*?)' . $o_end .
'/ie',
4181 "'<span class=\"math\">' . preg_replace('/[\\\\\\\\\\]{2}/', '\\cr', str_replace('<', '<', str_replace('<br/>', '', str_replace('<br />', '', str_replace('<br>', '', '$1'))))) . '</span>[[info]]'", $tex);
4184 $a_text = substr($a_text, 0, $spos).
4186 substr($a_text, $epos + strlen($a_end));
4195 $a_text = str_replace(
"[[info]]", $info, $a_text);
4198 $result_text = $a_text;
4206 return $result_text;
4223 include_once
"./Services/Administration/classes/class.ilSetting.php";
4224 $jsMathSetting =
new ilSetting(
"jsMath");
4225 if ($jsMathSetting->get(
"enable") && ($ilUser->getPref(
"js_math") || ($ilUser->getPref(
"js_math") === FALSE && ($jsMathSetting->get(
"makedefault")))))
4228 if (!$tpl->out_jsmath_info)
4230 include_once
"./classes/class.ilTemplate.php";
4231 $template =
new ilTemplate(
"tpl.jsmath_warning.html", TRUE, TRUE);
4232 $lng->loadLanguageModule(
"jsmath");
4233 $template->setVariable(
"TEXT_JSMATH_NO_JAVASCRIPT", $lng->txt(
"jsmath_no_javascript"));
4234 $info = $template->get();
4235 $tpl->out_jsmath_info = TRUE;
4237 $a_text = preg_replace(
"/\\\\([RZN])([^a-zA-Z]|<\/span>)/",
"\\mathbb{".
"$1".
"}".
"$2", $a_text);
4238 $result_text = preg_replace(
'/' . $a_start .
'(.*?)' . $a_end .
'/ie',
4239 "'<span class=\"math\">' . preg_replace('/[\\\\\\\\\\]{2}/', '\\cr', str_replace('<', '<', str_replace('<br/>', '', str_replace('<br />', '', str_replace('<br>', '', '$1'))))) . '</span>[[info]]'", $a_text);
4241 $result_text = str_replace(
"[[info]]", $info, $result_text);
4242 $tpl->addJavaScript($jsMathSetting->get(
"path_to_jsmath") .
"/easy/load.js");
4246 $result_text = preg_replace(
'/' . $a_start .
'(.*?)' . $a_end .
'/ie',
4247 "'<img alt=\"'.htmlentities('$1').'\" src=\"$a_cgi?'.rawurlencode(str_replace('&', '&', str_replace('>', '>', str_replace('<', '<', '$1')))).'\" ".
4251 return $result_text;
4260 function buildLatexImages($a_text, $a_dir ,$a_start =
"\[tex\]", $a_end =
"\[\/tex\]", $a_cgi = URL_TO_LATEX)
4262 $result_text = $a_text;
4266 while (preg_match(
'/' . $a_start .
'(.*?)' . $a_end .
'/ie', $result_text, $found))
4268 $cnt = (int)
$GLOBALS[
"teximgcnt"]++;
4270 $fpr = @fopen($a_cgi.
"?".rawurlencode($found[1]),
"r");
4276 $buf = fread($fpr, 1024);
4279 if (is_int(strpos(strtoupper(substr($buf, 0, 5)),
"GIF")))
4287 $fpw = fopen($a_dir.
"/teximg/img".$cnt.
".".$suffix,
"w");
4297 $img_str =
"./teximg/img".$cnt.
".".$suffix;
4298 $result_text = str_replace($found[0],
4299 '<img alt="'.$found[1].
'" src="'.$img_str.
'" />', $result_text);
4303 return $result_text;
4315 $result = $txt_output;
4316 $is_html = $this->isHTML($result);
4317 if ($prepare_for_latex_output)
4327 $result = preg_replace(
"/[\n]/",
"<br />", $result);
4332 if (preg_match_all(
"/(<pre>.*?<\/pre>)/ims", $result, $matches))
4334 foreach ($matches[0] as $found)
4337 if (strpos(
"\n", $found) === FALSE)
4339 $replacement =
"\n";
4341 $removed = preg_replace(
"/<br\s*?\/>/ims", $replacement, $found);
4342 $result = str_replace($found, $removed, $result);
4346 if ($prepare_for_latex_output)
4350 $result = str_replace(
"{",
"{", $result);
4351 $result = str_replace(
"}",
"}", $result);
4352 $result = str_replace(
"\\",
"\", $result);
4367 if (!is_array($periods))
4370 'years' => 31536000,
4371 'months' => 2592000,
4380 $seconds = (float) $seconds;
4381 foreach ($periods as $period => $value)
4383 $count = floor($seconds / $value);
4390 $values[$period] = $count;
4391 $seconds = $seconds % $value;
4412 if (!is_array($duration))
4417 foreach ($duration as $key => $value) {
4422 $segment_name = $key;
4423 $segment_name = $lng->txt($segment_name);
4424 $segment = $value .
' ' . $segment_name;
4428 $segment_name = substr($key, 0, -1);
4429 $segment_name = $lng->txt($segment_name);
4430 $segment = $value .
' ' . $segment_name;
4433 $array[] = $segment;
4435 $len = count($array);
4439 $array=array_slice($array,0,(3-$len));
4442 $str = implode(
', ', $array);
4452 $umf=get_cfg_var(
"upload_max_filesize");
4454 $pms=get_cfg_var(
"post_max_size");
4457 $max_filesize=min($umf, $pms);
4458 if (!$max_filesize) $max_filesize=max($umf, $pms);
4460 return $lng->txt(
"file_notice").
" $max_filesize.";
4472 $test_str = explode(
'_',$role_title);
4474 if ($test_str[0] ==
'il')
4476 $test2 = (int) $test_str[3];
4477 return is_numeric ($test2) ? (int) $test2 :
false;
4494 $test_str = explode(
'_',$ilias_id);
4496 if ($test_str[0] ==
'il' && $test_str[1] == $inst_id && count($test_str) == 4)
4498 $test2 = (int) $test_str[3];
4499 return is_numeric ($test2) ? (int) $test2 :
false;
4526 $where =
"WHERE ".$a_id_name.
" IN (";
4530 $query =
"SELECT ".$a_id_name.
" FROM ".$a_table.
" ".
4532 "ORDER BY ".$a_field;
4537 $ids[] =
$row->$a_id_name;
4539 return $ids ? $ids : array();
4564 if(!is_array($a_array) or !count($a_array))
4569 foreach($a_array as $k => $item)
4571 $a_array[$k] = $ilDB->quote($item);
4583 public static function sendInfo($a_info =
"",$a_keep =
false)
4586 $tpl->setMessage(
"info", $a_info, $a_keep);
4598 $tpl->setMessage(
"failure", $a_info, $a_keep);
4610 $tpl->setMessage(
"question", $a_info, $a_keep);
4622 $tpl->setMessage(
"success", $a_info, $a_keep);
4631 $tpl->addBlockFile(
"INFOPANEL",
"infopanel",
"tpl.infopanel.html");
4632 $tpl->setCurrentBlock(
"infopanel");
4634 if (!empty(
$_SESSION[
"infopanel"][
"text"]))
4636 $link =
"<a href=\"".$dir.$_SESSION[
"infopanel"][
"link"].
"\" target=\"".
4639 $link .= $lng->txt(
$_SESSION[
"infopanel"][
"text"]);
4644 if (!empty(
$_SESSION[
"infopanel"][
"img"]))
4646 $link .=
"<td><a href=\"".$_SESSION[
"infopanel"][
"link"].
"\" target=\"".
4649 $link .=
"<img src=\"".$ilias->tplPath.$ilias->account->prefs[
"skin"].
"/images/".
4650 $_SESSION[
"infopanel"][
"img"].
"\" border=\"0\" vspace=\"0\"/>";
4651 $link .=
"</a></td>";
4654 $tpl->setVariable(
"INFO_ICONS",$link);
4655 $tpl->parseCurrentBlock();
4675 if (!is_dir($directory))
4679 $size = @filesize($directory);
4681 return ($size ===
false) ? -1 : $size;
4683 if ($DIR = opendir($directory))
4685 while (($dirfile = readdir($DIR)) !==
false)
4687 if (is_link($directory . DIRECTORY_SEPARATOR . $dirfile) || $dirfile ==
'.' || $dirfile ==
'..')
4689 if (is_file($directory . DIRECTORY_SEPARATOR . $dirfile))
4690 $size += filesize($directory . DIRECTORY_SEPARATOR . $dirfile);
4691 else if (is_dir($directory . DIRECTORY_SEPARATOR . $dirfile))
4694 $dirSize =
ilUtil::dirsize($directory . DIRECTORY_SEPARATOR . $dirfile);
4708 return md5(rand(1,9999999) + str_replace(
" ",
"", (
string) microtime()));
4711 public static function setCookie($a_cookie_name,$a_cookie_value =
'', $a_also_set_super_global =
true, $a_set_cookie_invalid =
false)
4718 if(!(
bool)$a_set_cookie_invalid) $expire = 0;
4719 else $expire = time() - (365*24*60*60);
4723 if( version_compare(PHP_VERSION,
'5.2.0',
'>=') )
4726 setcookie( $a_cookie_name, $a_cookie_value, $expire,
4727 IL_COOKIE_PATH, IL_COOKIE_DOMAIN, IL_COOKIE_SECURE, IL_COOKIE_HTTPONLY
4733 setcookie( $a_cookie_name, $a_cookie_value, $expire,
4738 if((
bool)$a_also_set_super_global)
$_COOKIE[$a_cookie_name] = $a_cookie_value;
4743 return strip_tags(self::stripSlashes($a_filename));
4750 if($_SERVER[
'SHELL'])
4752 return $ilIliasIniFile->readVariable(
'server',
'http_path');
4756 return ILIAS_HTTP_PATH;