39 $lng = $DIC->language();
45 include_once(
"./Services/Object/classes/class.ilObject.php");
48 return "<img src=\"" .
$filename .
"\" alt=\"" .
$lng->txt(
"obj_" .
$a_type) .
"\" title=\"" .
$lng->txt(
"obj_" .
$a_type) .
"\" border=\"0\" vspace=\"0\"/>";
65 include_once(
"./Services/Object/classes/class.ilObject.php");
79 public static function getImagePath(
$img, $module_path =
"", $mode =
"output", $offline =
false)
83 $styleDefinition = null;
84 if (isset($DIC[
"styleDefinition"])) {
85 $styleDefinition = $DIC[
"styleDefinition"];
88 if (is_int(strpos(
$_SERVER[
"PHP_SELF"],
"setup.php"))) {
91 if ($module_path !=
"") {
92 $module_path =
"/" . $module_path;
96 $default_img =
"." . $module_path .
"/templates/default/images/" .
$img;
99 require_once(
"./Services/Style/System/classes/class.ilStyleDefinition.php");
100 $current_skin = ilStyleDefinition::getCurrentSkin();
101 $current_style = ilStyleDefinition::getCurrentStyle();
103 if (is_object($styleDefinition)) {
104 $image_dir = $styleDefinition->getImageDirectory($current_style);
106 if ($current_skin ==
"default") {
107 $user_img =
"." . $module_path .
"/templates/default/" . $image_dir .
"/" .
$img;
108 $skin_img =
"." . $module_path .
"/templates/default/images/" .
$img;
109 } elseif (is_object($styleDefinition) && $current_skin !=
"default") {
110 $user_img =
"./Customizing/global/skin/" .
111 $current_skin . $module_path .
"/" . $image_dir .
"/" .
$img;
112 $skin_img =
"./Customizing/global/skin/" .
113 $current_skin . $module_path .
"/images/" .
$img;
130 return "./images/" .
$img;
131 } elseif (@file_exists($user_img) && $image_dir !=
"") {
133 } elseif (file_exists($skin_img)) {
152 if (substr($relative_path, 0, 2) ==
'./') {
153 $relative_path = (substr($relative_path, 1));
155 if (substr($relative_path, 0, 1) !=
'/') {
156 $relative_path =
'/' . $relative_path;
158 $htmlpath = ILIAS_HTTP_PATH . $relative_path;
182 require_once(
"./Services/Style/System/classes/class.ilStyleDefinition.php");
183 $stylesheet_name = (strlen($a_css_name))
185 : ilStyleDefinition::getCurrentStyle() .
".css";
186 if (strlen($a_css_location) && (strcmp(substr($a_css_location, -1),
"/") != 0)) {
187 $a_css_location = $a_css_location .
"/";
192 require_once(
"./Services/Style/System/classes/class.ilStyleDefinition.php");
193 if (ilStyleDefinition::getCurrentSkin() !=
"default") {
194 $filename =
"./Customizing/global/skin/" . ilStyleDefinition::getCurrentSkin() .
"/" . $a_css_location . $stylesheet_name;
197 $filename =
"./" . $a_css_location .
"templates/default/" . $stylesheet_name;
200 if ($mode !=
"filesystem") {
201 $vers = str_replace(
" ",
"-",
$ilSetting->get(
"ilias_version"));
202 $vers =
"?vers=" . str_replace(
".",
"-", $vers);
205 $vers .= ($skin->getVersion() !=
'' ? str_replace(
".",
"-",
'-' . $skin->getVersion()) :
'');
220 public static function getJSLocation($a_js_name, $a_js_location =
"", $add_version =
false)
227 $js_name = $a_js_name;
228 if (strlen($a_js_location) && (strcmp(substr($a_js_location, -1),
"/") != 0)) {
229 $a_js_location = $a_js_location .
"/";
234 require_once(
"./Services/Style/System/classes/class.ilStyleDefinition.php");
235 if (ilStyleDefinition::getCurrentSkin() !=
"default") {
236 $filename =
"./Customizing/global/skin/" . ilStyleDefinition::getCurrentSkin() .
"/" . $a_js_location . $js_name;
239 $filename =
"./" . $a_js_location .
"templates/default/" . $js_name;
243 $vers = str_replace(
" ",
"-",
$ilSetting->get(
"ilias_version"));
244 $vers =
"?vers=" . str_replace(
".",
"-", $vers);
261 $base .=
"../Services/Privacy/";
264 $base =
"./Services/Privacy/";
267 if (is_file(
$base .
"w3c/p3p.xml")) {
268 return ILIAS_HTTP_PATH .
"w3c/p3p.xml";
270 return ILIAS_HTTP_PATH .
"/w3c/p3p_template.xml";
288 if ($mode !=
"filesystem") {
289 $vers = str_replace(
" ",
"-",
$ilSetting->get(
"ilias_version"));
290 $vers =
"?vers=" . str_replace(
".",
"-", $vers);
294 require_once(
"./Services/Style/System/classes/class.ilStyleDefinition.php");
295 if (ilStyleDefinition::getCurrentSkin() ==
"default") {
296 $in_style =
"./templates/" . ilStyleDefinition::getCurrentSkin() .
"/" 297 . ilStyleDefinition::getCurrentStyle() .
"_cont.css";
299 $in_style =
"./Customizing/global/skin/" . ilStyleDefinition::getCurrentSkin() .
"/" 300 . ilStyleDefinition::getCurrentStyle() .
"_cont.css";
303 if (is_file(
"./" . $in_style)) {
304 return $in_style . $vers;
306 return "templates/default/delos_cont.css" . $vers;
333 $direct_text =
false,
341 $lng = $DIC->language();
343 if ($multiple ==
true) {
344 $multiple =
" multiple=\"multiple\"";
350 $class =
" class=\" form-control " . $style_class .
"\"";
356 if (is_array($attribs)) {
357 foreach ($attribs as
$key => $val) {
362 $disabled =
' disabled=\"disabled\"';
365 $str =
"<select name=\"" . $varname .
"\"" . $multiple .
" $class size=\"" .
$size .
"\" $attributes $disabled>\n";
369 if (is_array($val)) {
375 ?
' style="' .
$style .
'" ' 379 $str .=
" <option $sty value=\"" .
$key .
"\"";
381 $str .=
" <option $sty value=\"" . $val .
"\"";
383 if (is_array($selected)) {
384 if (in_array(
$key, $selected)) {
385 $str .=
" selected=\"selected\"";
387 } elseif ($selected ==
$key) {
388 $str .=
" selected=\"selected\"";
392 $str .=
">" . $val .
"</option>\n";
394 $str .=
">" .
$lng->txt($val) .
"</option>\n";
398 $str .=
"</select>\n";
414 return($values[$selected]);
428 public static function formCheckbox($checked, $varname, $value, $disabled =
false)
430 $str =
"<input type=\"checkbox\" name=\"" . $varname .
"\"";
433 $str .=
" checked=\"checked\"";
437 $str .=
" disabled=\"disabled\"";
442 if (substr($varname, -2) ==
"[]") {
448 $varname_id = substr($varname, 0, -2) .
"_" . $value;
450 $varname_id = $varname;
454 $varname_id = str_replace(
"[",
"_", $varname_id);
455 $varname_id = str_replace(
"]",
"", $varname_id);
457 $str .=
" value=\"" . $value .
"\" id=\"" . $varname_id .
"\" />\n";
476 $str =
"<input disabled type=\"radio\" name=\"" . $varname .
"\"";
478 $str =
"<input type=\"radio\" name=\"" . $varname .
"\"";
481 $str .=
" checked=\"checked\"";
484 $str .=
" value=\"" . $value .
"\"";
485 $str .=
" id=\"" . $value .
"\" />\n";
501 public static function formRadioButton($checked, $varname, $value, $onclick=null, $disabled =
false)
506 $str .= (
'onclick="' . $onclick .
'"');
509 $str .= (
" type=\"radio\" name=\"" . $varname .
"\"");
511 $str .=
" checked=\"checked\"";
515 $str .=
" disabled=\"disabled\"";
518 $str .=
" value=\"" . $value .
"\"";
520 $str .=
" id=\"" . $value .
"\" />\n";
535 public static function formInput($varname, $value, $disabled =
false)
537 $str =
"<input type=\"input\" name=\"" . $varname .
"\"";
542 $str .=
" value=\"" . $value .
"\"";
544 $str .=
" id=\"" . $value .
"\" />\n";
570 if (
"" != $a_path &&
"/" != substr($a_path, -1)) {
612 foreach ($emptyFields as
$key => $val) {
614 if ($feedback !=
"") {
648 public static function Linkbar($AScript, $AHits, $ALimit, $AOffset, $AParams =
array(), $ALayout =
array(), $prefix =
'')
653 $layout_prev =
"<<";
654 $layout_next =
">>";
657 if ((is_array($ALayout) && (count($ALayout) > 0))) {
658 if ($ALayout[
"link"]) {
659 $layout_link =
" class=\"" . $ALayout[
"link"] .
"\"";
662 if ($ALayout[
"prev"]) {
663 $layout_prev = $ALayout[
"prev"];
666 if ($ALayout[
"next"]) {
667 $layout_next = $ALayout[
"next"];
673 if ($AHits > $ALimit || $AOffset > 0) {
674 if (!empty($AParams)) {
675 foreach ($AParams as
$key => $value) {
680 if (strpos($AScript,
'&')) {
681 $link = $AScript .
"&" .
$params . $prefix .
"offset=";
683 $link = $AScript .
"?" .
$params . $prefix .
"offset=";
688 $prevoffset = $AOffset - $ALimit;
689 if ($prevoffset < 0) {
692 $LinkBar .=
"<a" . $layout_link .
" href=\"" . $link . $prevoffset .
"\">" . $layout_prev .
" </a>";
696 $pages=intval($AHits/$ALimit);
699 if (($AHits % $ALimit)) {
707 for (
$i = 1 ;
$i <= $pages ;
$i++) {
708 $newoffset=$ALimit*(
$i-1);
710 if ($newoffset == $AOffset) {
711 $LinkBar .=
"[" .
$i .
"] ";
713 $LinkBar .=
'<a ' . $layout_link .
' href="' .
714 $link . $newoffset .
'">[' .
$i .
']</a> ';
721 if (!(($AOffset/$ALimit)==($pages-1)) && ($pages!=1)) {
722 $newoffset=$AOffset+$ALimit;
723 $LinkBar .=
"<a" . $layout_link .
" href=\"" . $link . $newoffset .
"\"> " . $layout_next .
"</a>";
750 "/(^|[\s]+)(www\.)([A-Za-z0-9#&=?.\/\-]+)/i",
757 "/(^|[\s]+)(ftp\.)([A-Za-z0-9#&=?.\/\-]+)/i",
767 $ret = str_replace(
'src="http://',
'"***masked_im_start***',
$ret);
769 include_once(
"./Services/Utilities/classes/class.ilMWParserAdapter.php");
774 $ret = str_replace(
'"***masked_im_start***',
'src="http://',
$ret);
778 if ($detectGotoLinks) {
780 $regExp =
"<a[^>]*href=\"(" . str_replace(
"/",
"\/", ILIAS_HTTP_PATH) .
"\/goto.php\?target=\w+_(\d+)[^\"]*)\"[^>]*>[^<]*<\/a>";
782 $ret = preg_replace_callback(
783 "/" . $regExp .
"/i",
784 array(
"ilUtil",
"replaceLinkProperties"),
789 $regExp =
"<a[^>]*href=\"(" . str_replace(
"/",
"\/", ILIAS_HTTP_PATH) .
"\/goto_.*[a-z0-9]+_([0-9]+)\.html)\"[^>]*>[^<]*<\/a>";
791 $ret = preg_replace_callback(
792 "/" . $regExp .
"/i",
793 array(
"ilUtil",
"replaceLinkProperties"),
817 $ref_id = $matches[2];
823 $link =
"<a href=" . $matches[1] .
" target=\"_self\">" .
$title .
"</a>";
847 public static function makeDateSelect($prefix, $year =
"", $month =
"", $day =
"", $startyear =
"", $a_long_month =
true, $a_further_options =
array(), $emptyoption =
false)
851 $lng = $DIC->language();
854 if (isset($a_further_options[
'disabled']) and $a_further_options[
'disabled']) {
855 $disabled =
'disabled="disabled" ';
860 if (!strlen($year)) {
861 $year = $now[
"year"];
863 if (!strlen($month)) {
864 $month = $now[
"mon"];
872 $month = (int) $month;
877 $sel_day .=
'<select class="form-control" ';
878 if (isset($a_further_options[
'select_attributes'])) {
879 foreach ($a_further_options[
'select_attributes'] as
$name => $value) {
880 $sel_day .= (
$name .
'="' . $value .
'" ');
884 $sel_day .= $disabled .
"name=\"" . $prefix .
"[d]\" id=\"" . $prefix .
"_d\">\n";
887 $sel_day .=
"<option value=\"0\">--</option>\n";
889 for (
$i = 1;
$i <= 31;
$i++) {
890 $sel_day .=
"<option value=\"$i\">" . sprintf(
"%02d",
$i) .
"</option>\n";
892 $sel_day .=
"</select>\n";
893 $sel_day = preg_replace(
"/(value\=\"$day\")/",
"$1 selected=\"selected\"", $sel_day);
896 $sel_month =
'<select class="form-control" ';
897 if (isset($a_further_options[
'select_attributes'])) {
898 foreach ($a_further_options[
'select_attributes'] as
$name => $value) {
899 $sel_month .= (
$name .
'="' . $value .
'" ');
902 $sel_month .= $disabled .
"name=\"" . $prefix .
"[m]\" id=\"" . $prefix .
"_m\">\n";
905 $sel_month .=
"<option value=\"0\">--</option>\n";
907 for (
$i = 1;
$i <= 12;
$i++) {
909 $sel_month .=
"<option value=\"$i\">" .
$lng->txt(
"month_" . sprintf(
"%02d",
$i) .
"_long") .
"</option>\n";
911 $sel_month .=
"<option value=\"$i\">" .
$i .
"</option>\n";
914 $sel_month .=
"</select>\n";
915 $sel_month = preg_replace(
"/(value\=\"$month\")/",
"$1 selected=\"selected\"", $sel_month);
918 $sel_year =
'<select class="form-control" ';
919 if (isset($a_further_options[
'select_attributes'])) {
920 foreach ($a_further_options[
'select_attributes'] as
$name => $value) {
921 $sel_year .= (
$name .
'="' . $value .
'" ');
924 $sel_year .= $disabled .
"name=\"" . $prefix .
"[y]\" id=\"" . $prefix .
"_y\">\n";
925 if ((strlen($startyear) == 0) || ($startyear > $year)) {
926 if (!$emptyoption || $year != 0) {
927 $startyear = $year - 5;
931 if (($year + 5) < (
date(
'Y',
time()) + 5)) {
934 $end_year = $year + 5;
938 $sel_year .=
"<option value=\"0\">----</option>\n";
940 for (
$i = $startyear;
$i <= $end_year;
$i++) {
941 $sel_year .=
"<option value=\"$i\">" . sprintf(
"%04d",
$i) .
"</option>\n";
943 $sel_year .=
"</select>\n";
944 $sel_year = preg_replace(
"/(value\=\"$year\")/",
"$1 selected=\"selected\"", $sel_year);
947 $dateformat =
"d-m-Y";
948 $dateformat = strtolower(preg_replace(
"/\W/",
"", $dateformat));
949 $dateformat = strtolower(preg_replace(
"/(\w)/",
"%%$1", $dateformat));
950 $dateformat = preg_replace(
"/%%d/", $sel_day, $dateformat);
951 $dateformat = preg_replace(
"/%%m/", $sel_month, $dateformat);
952 $dateformat = preg_replace(
"/%%y/", $sel_year, $dateformat);
974 public static function makeTimeSelect($prefix, $short =
true, $hour =
"", $minute =
"", $second =
"", $a_use_default =
true, $a_further_options =
array())
978 $lng = $DIC->language();
983 if (count($a_further_options)) {
984 if (isset($a_further_options[
'minute_steps'])) {
985 $minute_steps = $a_further_options[
'minute_steps'];
987 if (isset($a_further_options[
'disabled']) and $a_further_options[
'disabled']) {
988 $disabled =
'disabled="disabled" ';
992 if ($a_use_default and !strlen(
"$hour$minute$second")) {
999 $minute = (int) $minute;
1000 $second = (int) $second;
1003 $sel_hour =
'<select ';
1004 if (isset($a_further_options[
'select_attributes'])) {
1005 foreach ($a_further_options[
'select_attributes'] as
$name => $value) {
1006 $sel_hour .=
$name .
'=' . $value .
' ';
1009 $sel_hour .=
" " . $disabled .
"name=\"" . $prefix .
"[h]\" id=\"" . $prefix .
"_h\" class=\"form-control\">\n";
1012 for (
$i = 0;
$i <= 23;
$i++) {
1014 $sel_hour .=
"<option value=\"$i\">" . sprintf(
"%02d",
$i) .
"</option>\n";
1016 $sel_hour .=
"<option value=\"$i\">" .
date(
"ga", mktime(
$i, 0, 0)) .
"</option>\n";
1019 $sel_hour .=
"</select>\n";
1020 $sel_hour = preg_replace(
"/(value\=\"$hour\")/",
"$1 selected=\"selected\"", $sel_hour);
1023 $sel_minute .=
"<select " . $disabled .
"name=\"" . $prefix .
"[m]\" id=\"" . $prefix .
"_m\" class=\"form-control\">\n";
1025 for (
$i = 0;
$i <= 59;
$i =
$i + $minute_steps) {
1026 $sel_minute .=
"<option value=\"$i\">" . sprintf(
"%02d",
$i) .
"</option>\n";
1028 $sel_minute .=
"</select>\n";
1029 $sel_minute = preg_replace(
"/(value\=\"$minute\")/",
"$1 selected=\"selected\"", $sel_minute);
1033 $sel_second .=
"<select " . $disabled .
"name=\"" . $prefix .
"[s]\" id=\"" . $prefix .
"_s\" class=\"form-control\">\n";
1035 for (
$i = 0;
$i <= 59;
$i++) {
1036 $sel_second .=
"<option value=\"$i\">" . sprintf(
"%02d",
$i) .
"</option>\n";
1038 $sel_second .=
"</select>\n";
1039 $sel_second = preg_replace(
"/(value\=\"$second\")/",
"$1 selected=\"selected\"", $sel_second);
1041 $timeformat =
$lng->text[
"lang_timeformat"];
1042 if (strlen($timeformat) == 0) {
1043 $timeformat =
"H:i:s";
1045 $timeformat = strtolower(preg_replace(
"/\W/",
"", $timeformat));
1046 $timeformat = preg_replace(
"/(\w)/",
"%%$1", $timeformat);
1047 $timeformat = preg_replace(
"/%%h/", $sel_hour, $timeformat);
1048 $timeformat = preg_replace(
"/%%i/", $sel_minute, $timeformat);
1050 $timeformat = preg_replace(
"/%%s/",
"", $timeformat);
1052 $timeformat = preg_replace(
"/%%s/", $sel_second, $timeformat);
1076 if ($mailAddressParserFactory === null) {
1083 $parser = $mailAddressParserFactory->getParser($a_email);
1084 $addresses =
$parser->parse();
1091 "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|" .
1092 "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|" .
1093 "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|" .
1094 "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|" .
1095 "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|" .
1096 "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|" .
1097 "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|" .
1098 "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|" .
1099 "WF|WS|XN|YE|YT|YU|ZA|ZM|ZW" 1102 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));
1114 public static function isPassword($a_passwd, &$customError = null)
1118 $lng = $DIC->language();
1120 include_once(
'./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
1124 if (empty($a_passwd)) {
1125 $customError =
$lng->txt(
'password_empty');
1133 if ($security->getPasswordMinLength() > 0 && strlen($a_passwd) < $security->getPasswordMinLength()) {
1134 $errors[] = sprintf(
$lng->txt(
'password_to_short'), $security->getPasswordMinLength());
1135 $isPassword =
false;
1140 if ($security->getPasswordMaxLength() > 0 && strlen($a_passwd) > $security->getPasswordMaxLength()) {
1141 $errors[] = sprintf(
$lng->txt(
'password_to_long'), $security->getPasswordMaxLength());
1142 $isPassword =
false;
1146 if ($security->isPasswordCharsAndNumbersEnabled()) {
1147 $hasCharsAndNumbers =
true;
1150 if (!preg_match(
'/[A-Za-z]+/', $a_passwd)) {
1151 $hasCharsAndNumbers =
false;
1155 if (!preg_match(
'/[0-9]+/', $a_passwd)) {
1156 $hasCharsAndNumbers =
false;
1159 if (!$hasCharsAndNumbers) {
1160 $errors[] =
$lng->txt(
'password_must_chars_and_numbers');
1161 $isPassword =
false;
1165 require_once
'Services/Utilities/classes/class.ilStr.php';
1166 if ($security->getPasswordNumberOfUppercaseChars() > 0) {
1167 if (
ilStr::strLen($a_passwd) -
ilStr::strLen(preg_replace(
'/[A-Z]/',
'', $a_passwd)) < $security->getPasswordNumberOfUppercaseChars()) {
1168 $errors[] = sprintf(
$lng->txt(
'password_must_contain_ucase_chars'), $security->getPasswordNumberOfUppercaseChars());
1169 $isPassword =
false;
1173 if ($security->getPasswordNumberOfLowercaseChars() > 0) {
1174 if (
ilStr::strLen($a_passwd) -
ilStr::strLen(preg_replace(
'/[a-z]/',
'', $a_passwd)) < $security->getPasswordNumberOfLowercaseChars()) {
1175 $errors[] = sprintf(
$lng->txt(
'password_must_contain_lcase_chars'), $security->getPasswordNumberOfLowercaseChars());
1176 $isPassword =
false;
1181 if ($security->isPasswordSpecialCharsEnabled()) {
1183 if (!preg_match(self::getPasswordValidChars(
true,
true), $a_passwd)) {
1184 $errors[] =
$lng->txt(
'password_must_special_chars');
1185 $isPassword =
false;
1190 if (!preg_match(self::getPasswordValidChars(), $a_passwd)) {
1191 $errors[] =
$lng->txt(
'password_contains_invalid_chars');
1192 $isPassword =
false;
1198 } elseif (count(
$errors) > 1) {
1199 $customError =
$lng->txt(
'password_multiple_errors');
1200 $customError .=
'<br />' . implode(
'<br />',
$errors);
1214 include_once
'Services/PrivacySecurity/classes/class.ilSecuritySettings.php';
1219 if (is_string($user)) {
1221 } elseif (is_array($user)) {
1223 $login = $user[
'login'];
1224 $userId = $user[
'id'];
1226 $login = $user->getLogin();
1227 $userId = $user->getId();
1232 if ($login && (
int) $security->getPasswordMustNotContainLoginnameStatus() &&
1233 strpos(strtolower($clear_text_password), strtolower($login)) !== false
1235 $error_language_variable =
'password_contains_parts_of_login_err';
1252 if ($a_only_special_chars) {
1253 return '/[_\.\+\?\#\-\*\@!\$\%\~\/\:\;]+/';
1255 return '/^[A-Za-z0-9_\.\+\?\#\-\*\@!\$\%\~\/\:\;]+$/';
1258 return 'A-Z a-z 0-9 _.+?#-*@!$%~/:;';
1273 $lng = $DIC->language();
1275 include_once(
'./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
1278 $infos =
array(sprintf(
$lng->txt(
'password_allow_chars'), self::getPasswordValidChars(
false)));
1281 if ($security->getPasswordMinLength() > 0) {
1282 $infos[] = sprintf(
$lng->txt(
'password_to_short'), $security->getPasswordMinLength());
1286 if ($security->getPasswordMaxLength() > 0) {
1287 $infos[] = sprintf(
$lng->txt(
'password_to_long'), $security->getPasswordMaxLength());
1291 if ($security->isPasswordCharsAndNumbersEnabled()) {
1292 $infos[] =
$lng->txt(
'password_must_chars_and_numbers');
1296 if ($security->isPasswordSpecialCharsEnabled()) {
1297 $infos[] =
$lng->txt(
'password_must_special_chars');
1300 if ($security->getPasswordNumberOfUppercaseChars() > 0) {
1301 $infos[] = sprintf(
$lng->txt(
'password_must_contain_ucase_chars'), $security->getPasswordNumberOfUppercaseChars());
1304 if ($security->getPasswordNumberOfLowercaseChars() > 0) {
1305 $infos[] = sprintf(
$lng->txt(
'password_must_contain_lcase_chars'), $security->getPasswordNumberOfLowercaseChars());
1308 return implode(
'<br />', $infos);
1319 if (empty($a_login)) {
1323 if (strlen($a_login) < 3) {
1330 if (!preg_match(
"/^[A-Za-z0-9_\.\+\*\@!\$\%\~\-]+$/", $a_login)) {
1354 $a_next_blank =
false,
1355 $a_keep_extension =
false 1357 include_once(
"./Services/Utilities/classes/class.ilStr.php");
1359 if ($a_next_blank) {
1369 if ($a_keep_extension) {
1370 $p = strrpos($a_str,
'.');
1372 if ($p ===
false || $p == 0 || strlen($a_str) - $p > $a_len) {
1375 $a_str .=
"\xe2\x80\xa6";
1379 $a_str =
ilStr::subStr($a_str, 0, $len - (strlen($a_str) - $p + 1)) .
"\xe2\x80\xa6" . substr($a_str, $p);
1381 $a_str =
ilStr::subStr($a_str, 0, $len - (strlen($a_str) - $p + 1)) . substr($a_str, $p);
1404 include_once(
"./Services/Utilities/classes/class.ilStr.php");
1405 $str_arr = explode(
" ", $a_str);
1407 for (
$i = 0;
$i < count($str_arr);
$i++) {
1411 $str_arr[
$i].=
"...";
1416 return implode($str_arr,
" ");
1431 while (is_int(strpos($a_str,
"="))) {
1432 $eq_pos = strpos($a_str,
"=");
1433 $qu1_pos = strpos($a_str,
"\"");
1434 $qu2_pos = strpos(substr($a_str, $qu1_pos + 1),
"\"") + $qu1_pos + 1;
1435 if (is_int($eq_pos) && is_int($qu1_pos) && is_int($qu2_pos)) {
1436 $var = trim(substr($a_str, 0, $eq_pos));
1437 $val = trim(substr($a_str, $qu1_pos + 1, ($qu2_pos - $qu1_pos) - 1));
1438 $attribs[$var] = $val;
1439 $a_str = substr($a_str, $qu2_pos + 1);
1465 public static function rCopy($a_sdir, $a_tdir, $preserveTimeAttributes =
false)
1467 $sourceFS = LegacyPathHelper::deriveFilesystemFrom($a_sdir);
1468 $targetFS = LegacyPathHelper::deriveFilesystemFrom($a_tdir);
1470 $sourceDir = LegacyPathHelper::createRelativePath($a_sdir);
1471 $targetDir = LegacyPathHelper::createRelativePath($a_tdir);
1474 if (!$sourceFS->hasDir($sourceDir)) {
1478 $sourceList = $sourceFS->listContents($sourceDir,
true);
1480 foreach ($sourceList as $item) {
1481 if ($item->isDir()) {
1485 $itemPath = $targetDir .
'/' . substr($item->getPath(), strlen($sourceDir));
1486 $stream = $sourceFS->readStream($item->getPath());
1487 $targetFS->writeStream($itemPath, $stream);
1514 if ($mode ==
"filesystem") {
1515 return "./" . ILIAS_WEB_DIR .
"/" . CLIENT_ID;
1517 if (
defined(
"ILIAS_MODULE")) {
1518 return "../" . ILIAS_WEB_DIR .
"/" . CLIENT_ID;
1520 return "./" . ILIAS_WEB_DIR .
"/" . CLIENT_ID;
1537 return CLIENT_DATA_DIR;
1551 include_once(
"./Services/User/classes/class.ilObjUser.php");
1552 return ilObjUser::_getUsersOnline($a_user_id);
1567 include_once(
"./Services/User/classes/class.ilObjUser.php");
1580 if ($a_temp_path === null) {
1583 $temp_path = $a_temp_path;
1586 if (!is_dir($temp_path)) {
1589 $temp_name = tempnam($temp_path,
"tmp");
1595 $temp_name = str_replace(
"\\",
"/", $temp_name);
1630 public static function unzip($a_file, $overwrite =
false, $a_flat =
false)
1634 $log = $DIC->logger()->root();
1636 if (!is_file($a_file)) {
1644 copy($a_file, $tmpdir . DIRECTORY_SEPARATOR . basename($a_file));
1645 $orig_file = $a_file;
1646 $a_file = $tmpdir . DIRECTORY_SEPARATOR . basename($a_file);
1647 $origpathinfo = pathinfo($orig_file);
1650 $pathinfo = pathinfo($a_file);
1651 $dir = $pathinfo[
"dirname"];
1652 $file = $pathinfo[
"basename"];
1657 $unzip = PATH_TO_UNZIP;
1708 $dir_realpath = realpath($dir);
1710 if (is_link(
$name)) {
1712 if (substr(
$target, 0, strlen($dir_realpath)) != $dir_realpath) {
1721 include_once(
"./Services/Utilities/classes/class.ilFileUtils.php");
1722 $filearray =
array();
1724 if (is_array($filearray[
"file"])) {
1725 foreach ($filearray[
"file"] as $k => $f) {
1726 if (substr($f, 0, 1) !=
"." && $f != basename($orig_file)) {
1727 copy($filearray[
"path"][$k] . $f, $origpathinfo[
"dirname"] . DIRECTORY_SEPARATOR . $f);
1741 public static function zip($a_dir, $a_file, $compress_content =
false)
1745 if ($compress_content) {
1747 $pathinfo = pathinfo($a_dir);
1748 chdir($pathinfo[
"dirname"]);
1751 $pathinfo = pathinfo($a_file);
1752 $dir = $pathinfo[
"dirname"];
1753 $file = $pathinfo[
"basename"];
1755 if (!$compress_content) {
1766 if (is_array($a_dir)) {
1768 foreach ($a_dir as $dir) {
1769 $name = basename($dir);
1773 $name = basename($a_dir);
1774 if (trim(
$name) !=
"*") {
1791 $pathinfo = pathinfo($a_dir);
1792 chdir($pathinfo[
"dirname"]);
1794 $pathinfo = pathinfo($a_file);
1795 $dir = $pathinfo[
"dirname"];
1796 $file = $pathinfo[
"basename"];
1799 $mkisofs = PATH_TO_MKISOFS;
1805 $name = basename($a_dir);
1808 $zipcmd =
"-r -J -o " . $a_file .
" " .
$source;
1824 return PATH_TO_CONVERT;
1848 $current_version = self::processConvertVersion($current_version[0]);
1849 $version = self::processConvertVersion($a_version);
1850 if ($current_version >=
$version) {
1864 if (preg_match(
"/([0-9]+)\.([0-9]+)\.([0-9]+)([\.|\-]([0-9]+))?/", $a_version, $match)) {
1865 $version = str_pad($match[1], 2, 0, STR_PAD_LEFT) .
1866 str_pad($match[2], 2, 0, STR_PAD_LEFT) .
1867 str_pad($match[3], 2, 0, STR_PAD_LEFT) .
1868 str_pad($match[5], 2, 0, STR_PAD_LEFT);
1885 $a_target_format =
"",
1887 $a_background_color =
"" 1889 $format_str = ($a_target_format !=
"")
1890 ? strtoupper($a_target_format) .
":" 1893 if ($a_geometry !=
"") {
1894 if (is_int(strpos($a_geometry,
"x"))) {
1895 $geometry =
" -geometry " . $a_geometry .
" ";
1897 $geometry =
" -geometry " . $a_geometry .
"x" . $a_geometry .
" ";
1901 $bg_color = ($a_background_color !=
"")
1902 ?
" -background color " . $a_background_color .
" " 1919 public static function resizeImage($a_from, $a_to, $a_width, $a_height, $a_constrain_prop =
false)
1921 if ($a_constrain_prop) {
1922 $size =
" -geometry " . $a_width .
"x" . $a_height .
" ";
1924 $size =
" -resize " . $a_width .
"x" . $a_height .
"! ";
1937 public static function img($a_src, $a_alt =
"", $a_width =
"", $a_height =
"", $a_border = 0, $a_id =
"", $a_class =
"")
1939 $img =
'<img src="' . $a_src .
'"';
1941 $img.=
' alt="' . htmlspecialchars($a_alt) .
'" title="' . htmlspecialchars($a_alt) .
'"';
1943 if ($a_width !=
"") {
1944 $img.=
' width="' . htmlspecialchars($a_width) .
'"';
1946 if ($a_height !=
"") {
1947 $img.=
' height="' . htmlspecialchars($a_height) .
'"';
1949 if ($a_class !=
"") {
1950 $img.=
' class="' . $a_class .
'"';
1953 $img.=
' id="' . $a_id .
'"';
1955 $img.=
' border="' . (int) $a_border .
'"/>';
1966 public static function deliverData($a_data, $a_filename, $mime =
"application/octet-stream", $charset =
"")
1968 $disposition =
"attachment";
1971 include_once
'./Services/Http/classes/class.ilHTTPS.php';
1980 #header("Pragma: "); 1981 #header("Cache-Control: "); 1982 #header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); 1983 #header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); 1984 #header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 1985 #header("Cache-Control: post-check=0, pre-check=0", false); 1986 } elseif ($disposition ==
"attachment") {
1987 header(
"Cache-control: private");
1989 header(
"Cache-Control: no-cache, must-revalidate");
1990 header(
"Pragma: no-cache");
1995 if (strlen($charset)) {
1996 $charset =
"; charset=$charset";
1998 header(
"Content-Type: $mime$charset");
2001 header(
"Content-Length: " . (
string) (strlen($a_data)));
2005 header(
'Cache-Control: must-revalidate, post-check=0, pre-check=0');
2006 header(
'Pragma: public');
2009 header(
"Connection: close");
2027 $removeAfterDelivery =
false,
2028 $a_exit_after =
true 2032 if (!file_exists($a_file)) {
2043 if (strlen($a_mime)) {
2044 $delivery->setMimeType($a_mime);
2047 $delivery->setDownloadFileName($a_filename);
2048 $delivery->setConvertFileNameToAsci((
bool) !$DIC[
'ilClientIniFile']->readVariable(
'file_access',
'disable_ascii'));
2049 $delivery->setDeleteFile($removeAfterDelivery);
2050 $delivery->deliver();
2065 $chunksize = 1*(1024*1024);
2067 $handle = fopen($a_file,
'rb');
2068 if ($handle ===
false) {
2071 while (!feof($handle)) {
2072 $buffer = fread($handle, $chunksize);
2075 return fclose($handle);
2106 $umlauts =
array(
"Ä"=>
"Ae",
"Ö"=>
"Oe",
"Ü"=>
"Ue",
2107 "ä"=>
"ae",
"ö"=>
"oe",
"ü"=>
"ue",
"ß"=>
"ss");
2108 foreach ($umlauts as $src => $tgt) {
2109 $a_filename = str_replace($src, $tgt, $a_filename);
2130 $sep =
'###HTMLTAG###';
2132 preg_match_all(
"@<[^>]*>@", $htmlText, $matches);
2133 $tmp = preg_replace(
"@(<[^>]*>)@", $sep, $htmlText);
2134 $tmp = explode($sep, $tmp);
2136 for (
$i=0;
$i<count($tmp);
$i++) {
2137 $tmp[
$i] = htmlentities($tmp[
$i], ENT_COMPAT,
"UTF-8");
2140 $tmp = join($sep, $tmp);
2142 for (
$i=0;
$i<count($matches[0]);
$i++) {
2143 $tmp = preg_replace(
"@$sep@", $matches[0][
$i], $tmp, 1);
2157 return PATH_TO_JAVA;
2176 $url = (is_int(strpos($a_url,
"?")))
2177 ? $a_url . $amp . $a_par
2178 : $a_url .
"?" . $a_par;
2203 $a_dir = trim($a_dir);
2206 if (substr($a_dir, -1) ==
"/") {
2207 $a_dir = substr($a_dir, 0, -1);
2211 if (!(
$path = substr($a_dir, 0, strrpos($a_dir,
"/") - strlen($a_dir)))) {
2217 return @mkdir($a_dir, fileperms(
$path));
2242 $dirs =
array($a_dir);
2243 $a_dir = dirname($a_dir);
2246 while ($last_dirname != $a_dir) {
2247 array_unshift($dirs, $a_dir);
2248 $last_dirname = $a_dir;
2249 $a_dir = dirname($a_dir);
2253 $reverse_paths = array_reverse($dirs,
true);
2255 foreach ($reverse_paths as
$key => $value) {
2256 if ($found_index == -1) {
2257 if (is_dir($value)) {
2258 $found_index =
$key;
2264 foreach ($dirs as $dirindex => $dir) {
2266 if ($dirindex >= $found_index) {
2267 if (!file_exists($dir)) {
2268 if (strcmp(substr($dir, strlen($dir)-1, 1),
"/") == 0) {
2271 $dir = substr($dir, 0, strlen($dir)-1);
2273 if (!mkdir($dir, $umask)) {
2274 error_log(
"Can't make directory: $dir");
2277 } elseif (!is_dir($dir)) {
2282 $umask = fileperms($dir);
2305 public static function delDir($a_dir, $a_clean_only =
false)
2307 if (!is_dir($a_dir) || is_int(strpos($a_dir,
".."))) {
2311 $current_dir = opendir($a_dir);
2320 while ($entryname = readdir($current_dir)) {
2325 if (is_dir($a_dir .
"/" . $file) and ($file !=
"." and $file!=
"..")) {
2327 } elseif ($file !=
"." and $file !=
"..") {
2328 unlink($a_dir .
"/" . $file);
2332 closedir($current_dir);
2333 if (!$a_clean_only) {
2354 public static function getDir($a_dir, $a_rec =
false, $a_sub_dir =
"")
2356 $current_dir = opendir($a_dir . $a_sub_dir);
2360 $subitems =
array();
2361 while ($entry = readdir($current_dir)) {
2362 if (is_dir($a_dir .
"/" . $entry)) {
2363 $dirs[$entry] =
array(
"type" =>
"dir",
"entry" => $entry,
2364 "subdir" => $a_sub_dir);
2365 if ($a_rec && $entry !=
"." && $entry !=
"..") {
2367 $subitems = array_merge($subitems,
$si);
2370 if ($entry !=
"." && $entry !=
"..") {
2371 $size = filesize($a_dir . $a_sub_dir .
"/" . $entry);
2372 $files[$entry] =
array(
"type" =>
"file",
"entry" => $entry,
2373 "size" =>
$size,
"subdir" => $a_sub_dir);
2380 return array_merge($dirs,
$files, $subitems);
2391 if (is_array($a_arr)) {
2392 foreach ($a_arr as $k => $v) {
2406 $df = new \ILIAS\Data\Factory;
2419 if (is_array($a_data)) {
2420 foreach ($a_data as $k => $v) {
2441 public static function stripSlashes($a_str, $a_strip_html =
true, $a_allow =
"")
2443 if (ini_get(
"magic_quotes_gpc")) {
2444 $a_str = stripslashes($a_str);
2460 if (ini_get(
"magic_quotes_gpc")) {
2461 $a_str = stripslashes($a_str);
2473 public static function secureString($a_str, $a_strip_html =
true, $a_allow =
"")
2476 $only_secure =
true;
2477 $allow_tags = explode(
">", $a_allow);
2479 $allow_array =
array();
2480 foreach ($allow_tags as $allow) {
2482 $allow = str_replace(
"<",
"", $allow);
2484 if (!in_array($allow, $sec_tags)) {
2485 $only_secure =
false;
2487 $allow_array[] = $allow;
2492 if (($only_secure || $a_allow ==
"") && $a_strip_html) {
2493 if ($a_allow ==
"") {
2494 $allow_array =
array(
"b",
"i",
"strong",
"em",
"code",
"cite",
2495 "gap",
"sub",
"sup",
"pre",
"strike",
"bdo");
2501 $a_str = strip_tags($a_str);
2513 if ($a_strip_html) {
2523 return array(
"strong",
"em",
"u",
"strike",
"ol",
"li",
"ul",
"p",
"div",
2524 "i",
"b",
"code",
"sup",
"sub",
"pre",
"gap",
"a",
"img",
"bdo");
2529 foreach ($allow_array as
$t) {
2542 array(
"param" =>
"align",
"value" =>
"left"),
2543 array(
"param" =>
"align",
"value" =>
"center"),
2544 array(
"param" =>
"align",
"value" =>
"justify"),
2545 array(
"param" =>
"align",
"value" =>
"right")
2560 foreach ($allow_array as
$t) {
2573 array(
"param" =>
"align",
"value" =>
"left"),
2574 array(
"param" =>
"align",
"value" =>
"center"),
2575 array(
"param" =>
"align",
"value" =>
"justify"),
2576 array(
"param" =>
"align",
"value" =>
"right")
2598 if (ini_get(
"magic_quotes_gpc")) {
2599 return stripslashes($a_str);
2624 if ($a_make_links_clickable) {
2641 $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);
2645 foreach ($matches[0] as $match) {
2646 $matched_text = $match[0];
2650 $encoded .= nl2br(htmlspecialchars(substr($a_str, $pos1, $pos2 - $pos1)));
2656 $pos1 = $pos2 + strlen($matched_text);
2658 if ($pos1 < strlen($a_str)) {
2659 $encoded .= nl2br(htmlspecialchars(substr($a_str, $pos1)));
2662 $encoded = nl2br(htmlspecialchars($a_str));
2675 $att = $ws .
"[^>]*" . $ws;
2678 '/<(' .
$tag . $att .
'(' . $tag_att . $ws .
'="' . $ws .
'(([$@!*()~;,_0-9A-z\/:=%.&#?+\-])*)")' . $att .
')>/i',
2683 $a_str = preg_replace(
2684 "/<" . preg_quote($found[1],
"/") .
">/i",
2685 '<' .
$tag .
' ' . $tag_att . $tag_att .
'="' . $found[3] .
'">',
2688 if ($old_str == $a_str) {
2689 $ilLog->write(
"ilUtil::maskA-" . htmlentities($old_str) .
" == " .
2690 htmlentities($a_str));
2694 $a_str = str_ireplace(
2709 '/<(' .
$tag .
' ' . $tag_att . $tag_att .
'="(([$@!*()~;,_0-9A-z\/:=%.&#?+\-])*)")>/i',
2714 $a_str = preg_replace(
2715 "/<" . preg_quote($found[1],
"/") .
">/i",
2719 if ($old_str == $a_str) {
2720 $ilLog->write(
"ilUtil::unmaskA-" . htmlentities($old_str) .
" == " .
2721 htmlentities($a_str));
2725 $a_str = str_replace(
'</' .
$tag .
'>',
'</' .
$tag .
'>', $a_str);
2731 $a_str = str_replace(
2732 array(
"<$t>",
"<" . strtoupper(
$t) .
">"),
2733 "<" .
$t .
">",
2736 $a_str = str_replace(
2737 array(
"</$t>",
"</" . strtoupper(
$t) .
">"),
2738 "</" .
$t .
">",
2742 if (is_array($fix_param)) {
2743 foreach ($fix_param as $p) {
2746 $a_str = str_replace(
2748 "<" .
"$t $k=\"$v\"" .
">",
2759 $a_str = str_replace(
"<" .
$t .
">",
"<" .
$t .
">", $a_str);
2760 $a_str = str_replace(
"</" .
$t .
">",
"</" .
$t .
">", $a_str);
2762 if (is_array($fix_param)) {
2763 foreach ($fix_param as $p) {
2766 $a_str = str_replace(
2767 "<$t $k=\"$v\">",
2768 "<" .
"$t $k=\"$v\"" .
">",
2778 $a_str = str_ireplace(
"javascript",
"jvscrpt", $a_str);
2779 $a_str = str_ireplace(
array(
"%00",
"%0a",
"%0d",
"%1a",
"�",
"�",
2780 "�",
"�",
"
",
"
",
" ",
" "),
"-", $a_str);
2801 $negativestr =
"a,abbr,acronym,address,applet,area,base,basefont," .
2802 "big,blockquote,body,br,button,caption,center,cite,code,col," .
2803 "colgroup,dd,del,dfn,dir,div,dl,dt,em,fieldset,font,form,frame," .
2804 "frameset,h1,h2,h3,h4,h5,h6,head,hr,html,i,iframe,img,input,ins,isindex,kbd," .
2805 "label,legend,li,link,map,menu,meta,noframes,noscript,object,ol," .
2806 "optgroup,option,p,param,q,s,samp,script,select,small,span," .
2807 "strike,strong,style,sub,sup,table,tbody,td,textarea,tfoot,th,thead," .
2808 "title,tr,tt,u,ul,var";
2809 $a_allow = strtolower($a_allow);
2810 $negatives = explode(
",", $negativestr);
2811 $outer_old_str =
"";
2812 while ($outer_old_str != $a_str) {
2813 $outer_old_str = $a_str;
2814 foreach ($negatives as $item) {
2815 $pos = strpos($a_allow,
"<$item>");
2818 if ($pos ===
false) {
2820 while ($old_str != $a_str) {
2822 $a_str = preg_replace(
"/<\/?\s*$item(\/?)\s*>/i",
"", $a_str);
2823 $a_str = preg_replace(
"/<\/?\s*$item(\/?)\s+([^>]*)>/i",
"", $a_str);
2831 $a_str = preg_replace(
"/<\s*\w*(\/?)(\s+[^>]*)?(\s+on[^>]*)>/i",
"", $a_str);
2834 $a_str = preg_replace(
"/<\s*\w*(\/?)\s+[^>]*javascript[^>]*>/i",
"", $a_str);
2838 $a_str = preg_replace(
"/<\s*\w*(\/?)\s+[^>]*expression[^>]*>/i",
"", $a_str);
2860 $a_str = htmlspecialchars($a_str);
2864 $a_str = str_replace(
"{",
"{", $a_str);
2865 $a_str = str_replace(
"}",
"}", $a_str);
2881 if (filter_var(
$url, FILTER_VALIDATE_URL) ===
false &&
2882 filter_var(
"http://" .
$url, FILTER_VALIDATE_URL) ===
false &&
2883 filter_var(
"http:" .
$url, FILTER_VALIDATE_URL) ===
false &&
2884 filter_var(
"http://de.de" .
$url, FILTER_VALIDATE_URL) ===
false &&
2885 filter_var(
"http://de.de/" .
$url, FILTER_VALIDATE_URL) ===
false) {
2888 if (trim(strtolower(parse_url(
$url, PHP_URL_SCHEME))) ==
"javascript") {
2891 $url = htmlspecialchars(
$url, ENT_QUOTES);
2908 return addslashes($a_str);
2940 while (($spos=strpos($a_parstr,
"=")) &&
$ok) {
2942 $cpar = substr($a_parstr, 0, $spos);
2943 $a_parstr = substr($a_parstr, $spos, strlen($a_parstr)-$spos);
2944 while (substr($cpar, 0, 1)==
"," ||substr($cpar, 0, 1)==
" " || substr($cpar, 0, 1)==chr(13) || substr($cpar, 0, 1)==chr(10)) {
2945 $cpar = substr($cpar, 1, strlen($cpar)-1);
2947 while (substr($cpar, strlen($cpar)-1, 1)==
" " || substr($cpar, strlen($cpar)-1, 1)==chr(13) || substr($cpar, strlen($cpar)-1, 1)==chr(10)) {
2948 $cpar = substr($cpar, 0, strlen($cpar)-1);
2953 while ($cpar != $cpar_old) {
2955 $cpar = preg_replace(
"/[^a-zA-Z0-9_]/i",
"", $cpar);
2960 if ($spos=strpos($a_parstr,
"\"")) {
2961 $a_parstr = substr($a_parstr, $spos+1, strlen($a_parstr)-$spos);
2962 $spos=strpos($a_parstr,
"\"");
2963 if (is_int($spos)) {
2964 $cval = substr($a_parstr, 0, $spos);
2966 $a_parstr = substr($a_parstr, $spos+1, strlen($a_parstr)-$spos-1);
2985 if (is_array($a_par_arr)) {
2987 foreach ($a_par_arr as $par => $val) {
3004 $ret = $a_str .
": ";
3005 for (
$i=0;
$i<strlen($a_str);
$i++) {
3006 $ret.= ord(substr($a_str,
$i, 1)) .
" ";
3020 if (strtolower($a_yn) ==
"y") {
3054 global $array_sortby,$array_sortorder;
3056 if (!isset($array_sortby)) {
3063 if ($array_sortorder ==
"asc") {
3067 if ($array_sortorder ==
"desc") {
3068 return !
ilStr::strCmp($a[$array_sortby], $b[$array_sortby]);
3085 global $array_sortby,$array_sortorder;
3087 if ($array_sortorder ==
"asc") {
3088 return $a[
"$array_sortby"] > $b[
"$array_sortby"];
3091 if ($array_sortorder ==
"desc") {
3092 return $a[
"$array_sortby"] < $b[
"$array_sortby"];
3110 $a_array_sortorder = 0,
3112 $a_keep_keys =
false 3114 include_once(
"./Services/Utilities/classes/class.ilStr.php");
3117 if (!$a_keep_keys) {
3118 return self::stableSortArray($array, $a_array_sortby, $a_array_sortorder, $a_numeric, $a_keep_keys);
3122 global $array_sortby,$array_sortorder;
3123 $array_sortby = $a_array_sortby;
3125 if ($a_array_sortorder ==
"desc") {
3126 $array_sortorder =
"desc";
3128 $array_sortorder =
"asc";
3132 uasort($array,
array(
"ilUtil",
"sort_func_numeric"));
3134 usort($array,
array(
"ilUtil",
"sort_func_numeric"));
3138 uasort($array,
array(
"ilUtil",
"sort_func"));
3140 usort($array,
array(
"ilUtil",
"sort_func"));
3162 public static function stableSortArray($array, $a_array_sortby, $a_array_sortorder = 0, $a_numeric =
false)
3164 global $array_sortby,$array_sortorder;
3166 $array_sortby = $a_array_sortby;
3168 if ($a_array_sortorder ==
"desc") {
3169 $array_sortorder =
"desc";
3171 $array_sortorder =
"asc";
3175 $sort_array = array_values($array);
3185 public static function mergesort(&$array, $cmp_function =
'strcmp')
3188 if (count($array) < 2) {
3193 $halfway = count($array) / 2;
3194 $array1 = array_slice($array, 0, $halfway);
3195 $array2 = array_slice($array, $halfway);
3202 if (call_user_func($cmp_function, end($array1), $array2[0]) < 1) {
3203 $array = array_merge($array1, $array2);
3210 while ($ptr1 < count($array1) && $ptr2 < count($array2)) {
3211 if (call_user_func($cmp_function, $array1[$ptr1], $array2[$ptr2]) < 1) {
3212 $array[] = $array1[$ptr1++];
3214 $array[] = $array2[$ptr2++];
3219 while ($ptr1 < count($array1)) {
3220 $array[] = $array1[$ptr1++];
3222 while ($ptr2 < count($array2)) {
3223 $array[] = $array2[$ptr2++];
3244 $existing_sub_key_values =
array();
3246 foreach ($array as
$key=>$sub_array) {
3247 if (!in_array($sub_array[$sub_key], $existing_sub_key_values)) {
3248 $existing_sub_key_values[] = $sub_array[$sub_key];
3268 $a_desired_type = strtolower($a_desired_type);
3270 $im_types = ImageTypes();
3272 switch ($a_desired_type) {
3275 if ($im_types & IMG_JPG) {
3278 if ($im_types & IMG_GIF) {
3281 if ($im_types & IMG_PNG) {
3287 if ($im_types & IMG_GIF) {
3290 if ($im_types & IMG_JPG) {
3293 if ($im_types & IMG_PNG) {
3299 if ($im_types & IMG_PNG) {
3302 if ($im_types & IMG_JPG) {
3305 if ($im_types & IMG_GIF) {
3311 if ($im_types & IMG_PNG) {
3314 if ($im_types & IMG_JPG) {
3317 if ($im_types & IMG_GIF) {
3337 if (($a_mime ==
"image/gif") || ($a_mime ==
"image/jpeg") ||
3338 ($a_mime ==
"image/png") || ($a_mime ==
"application/x-shockwave-flash") ||
3339 ($a_mime ==
"image/tiff") || ($a_mime ==
"image/x-ms-bmp") ||
3340 ($a_mime ==
"image/psd") || ($a_mime ==
"image/iff")) {
3357 if (!isset($DIC[
'ilCtrl']) || !$DIC[
'ilCtrl'] instanceof
ilCtrl) {
3358 $ctrl =
new ilCtrl();
3360 $ctrl = $DIC->ctrl();
3362 $ctrl->redirectToURL($a_script);
3375 if (substr($a_value, 0, 4) ==
"il__") {
3376 $a_value =
"il_" . IL_INST_ID .
"_" . substr($a_value, 4, strlen($a_value) - 4);
3396 $ilDB = $DIC->database();
3399 if (isset($DIC[
"ilErr"])) {
3403 if (empty($a_group_name)) {
3404 $message = __METHOD__ .
": No groupname given!";
3408 $clause = ($a_id) ?
" AND obj_id != " .
$ilDB->quote($a_id) .
" " :
"";
3410 $q =
"SELECT obj_id FROM object_data " .
3411 "WHERE title = " .
$ilDB->quote($a_group_name,
"text") .
" " .
3412 "AND type = " .
$ilDB->quote(
"grp",
"text") .
3417 if (
$r->numRows()) {
3432 $my_pid = getmypid();
3433 return (
"MEMORY USAGE (% KB PID ): " . `ps -eo%mem,rss,pid | grep $my_pid`);
3444 if (strtolower(substr(php_uname(), 0, 3)) ==
"win") {
3453 setlocale(LC_CTYPE,
"UTF8",
"en_US.UTF-8");
3455 return escapeshellarg($a_arg);
3469 if (ini_get(
'safe_mode') == 1) {
3472 setlocale(LC_CTYPE,
"UTF8",
"en_US.UTF-8");
3473 return escapeshellcmd($a_arg);
3489 if (
ilUtil::isWindows() && strpos($cmd,
" ") !==
false && substr($cmd, 0, 1) !==
'"') {
3491 $cmd =
'"' . $cmd .
'"';
3495 if (version_compare(phpversion(),
"5.2",
"<") && strpos($args,
'"') !==
false) {
3496 $cmd =
'"' . $cmd .
" " . $args .
'"';
3500 $cmd .=
" " . $args;
3506 $cmd .=
" " . $args;
3511 $DIC->logger()->root()->debug(
"ilUtil::execQuoted: " . $cmd .
".");
3538 public static function excelTime($year =
"", $month =
"", $day =
"", $hour =
"", $minute =
"", $second =
"")
3540 $starting_time = mktime(0, 0, 0, 1, 2, 1970);
3541 if (strcmp(
"$year$month$day$hour$minute$second",
"") == 0) {
3542 $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;
3554 return str_replace(
",",
".", ($days + 25570 + ($difference / 86400)));
3565 $def_arr = explode(
",", SUFFIX_REPL_DEFAULT);
3566 foreach ($def_arr as
$def) {
3570 $def_arr = explode(
",", SUFFIX_REPL_ADDITIONAL);
3571 foreach ($def_arr as $def) {
3582 $file_peaces = explode(
'.', $a_initial_filename);
3584 $file_extension = array_pop($file_peaces);
3586 if (SUFFIX_REPL_ADDITIONAL) {
3587 $string_extensions = SUFFIX_REPL_DEFAULT .
"," . SUFFIX_REPL_ADDITIONAL;
3589 $string_extensions = SUFFIX_REPL_DEFAULT;
3592 $sufixes = explode(
",", $string_extensions);
3594 if (in_array($file_extension, $sufixes)) {
3595 $file_extension =
"sec";
3598 array_push($file_peaces, $file_extension);
3600 $safe_filename =
"";
3601 foreach ($file_peaces as $piece) {
3602 $safe_filename .=
"$piece";
3603 if ($piece != end($file_peaces)) {
3604 $safe_filename .=
".";
3608 return $safe_filename;
3625 if ($a_dir ==
"/" || $a_dir ==
"" || is_int(strpos($a_dir,
".."))
3626 || trim($a_old_suffix) ==
"") {
3631 if (!@is_dir($a_dir)) {
3636 $dir = opendir($a_dir);
3638 while (
$file = readdir($dir)) {
3639 if (
$file !=
"." and
3642 if (@is_dir($a_dir .
"/" .
$file)) {
3647 if (@is_file($a_dir .
"/" . $file)) {
3649 if (strrpos($file,
'.') == (strlen($file) - 1)) {
3650 rename($a_dir .
'/' . $file, substr($a_dir .
'/' . $file, 0, -1));
3651 $file = substr($file, 0, -1);
3654 $path_info = pathinfo($a_dir .
"/" . $file);
3656 if (strtolower($path_info[
"extension"]) ==
3657 strtolower($a_old_suffix)) {
3658 $pos = strrpos($a_dir .
"/" . $file,
".");
3659 $new_name = substr($a_dir .
"/" . $file, 0, $pos) .
"." . $a_new_suffix;
3660 rename($a_dir .
"/" . $file, $new_name);
3670 return strpos(
$_SERVER[
"SCRIPT_FILENAME"],
"api") !==
false ||
3671 strpos(
$_SERVER[
"SCRIPT_FILENAME"],
"dummy") !==
false;
3676 if (preg_match(
"/&" . $paramName .
"=/", $qstring)) {
3677 return preg_replace(
"/&" . $paramName .
"=[^&]+/",
"&" . $paramName .
"=" . urlencode($paramValue), $qstring);
3679 return $qstring .
"&" . $paramName .
"=" . urlencode($paramValue);
3685 foreach ($parametersArray as $paramName => $paramValue) {
3700 srand((
double) microtime()*1000000);
3702 include_once(
'./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
3705 for (
$i=1;
$i<=$a_number;
$i++) {
3706 $min = ($security->getPasswordMinLength() > 0)
3707 ? $security->getPasswordMinLength()
3709 $max = ($security->getPasswordMaxLength() > 0)
3710 ? $security->getPasswordMaxLength()
3715 $random = new \ilRandom();
3716 $length = $random->int($min, $max);
3717 $next = $random->int(1, 2);
3719 $vowels_uc = strtoupper($vowels);
3720 $consonants =
"bcdfghjklmnpqrstvwxyz";
3721 $consonants_uc = strtoupper($consonants);
3722 $numbers =
"1234567890";
3723 $special =
"_.+?#-*@!$%~";
3726 if ($security->getPasswordNumberOfUppercaseChars() > 0) {
3727 for ($j = 0; $j < $security->getPasswordNumberOfUppercaseChars(); $j++) {
3730 $pw.= $consonants_uc[$random->int(0, strlen($consonants_uc) - 1)];
3735 $pw.= $vowels_uc[$random->int(0, strlen($vowels_uc) - 1)];
3742 if ($security->isPasswordCharsAndNumbersEnabled()) {
3743 $pw.= $numbers[$random->int(0, strlen($numbers) - 1)];
3746 if ($security->isPasswordSpecialCharsEnabled()) {
3747 $pw.= $special[$random->int(0, strlen($special) - 1)];
3750 $num_lcase_chars = max($security->getPasswordNumberOfLowercaseChars(), $length - strlen($pw));
3751 for ($j = 0; $j < $num_lcase_chars; $j++) {
3754 $pw.= $consonants[$random->int(0, strlen($consonants) - 1)];
3759 $pw.= $vowels[$random->int(0, strlen($vowels) - 1)];
3765 $pw = str_shuffle($pw);
3774 $path = preg_replace(
"/[\/\\\]+$/",
"",
$path);
3794 foreach (
$data as $k=>$datum) {
3795 if (is_null($datum)) {
3798 if (is_string($datum)) {
3799 $data[$k] =
"'" . $datum .
"'";
3801 if (is_array($datum)) {
3806 return "[" . implode(
', ',
$data) .
"]";
3815 public static function virusHandling($a_file, $a_orig_name =
"", $a_clean =
true)
3819 $lng = $DIC->language();
3821 if (IL_VIRUS_SCANNER !=
"None") {
3822 require_once(
"./Services/VirusScanner/classes/class.ilVirusScannerFactory.php");
3824 if (($vs_txt = $vs->scanFile($a_file, $a_orig_name)) !=
"") {
3825 if ($a_clean && (IL_VIRUS_CLEAN_COMMAND !=
"")) {
3826 $clean_txt = $vs->cleanFile($a_file, $a_orig_name);
3827 if ($vs->fileCleaned()) {
3828 $vs_txt.=
"<br />" .
$lng->txt(
"cleaned_file") .
3829 "<br />" . $clean_txt;
3830 $vs_txt.=
"<br />" .
$lng->txt(
"repeat_scan");
3831 if (($vs2_txt = $vs->scanFile($a_file, $a_orig_name)) !=
"") {
3832 return array(
false, nl2br($vs_txt) .
"<br />" .
$lng->txt(
"repeat_scan_failed") .
3833 "<br />" . nl2br($vs2_txt));
3835 return array(
true, nl2br($vs_txt) .
"<br />" .
$lng->txt(
"repeat_scan_succeded"));
3838 return array(
false, nl2br($vs_txt) .
"<br />" .
$lng->txt(
"cleaning_failed"));
3841 return array(
false, nl2br($vs_txt));
3846 return array(
true,
"");
3869 public static function moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors =
true, $a_mode =
"move_uploaded")
3872 $targetFilename = basename($a_target);
3874 include_once(
"./Services/Utilities/classes/class.ilFileUtils.php");
3878 list($targetFilesystem, $targetDir) = self::sanitateTargetPath($a_target);
3880 $upload = $DIC->upload();
3883 if (!$upload->hasBeenProcessed()) {
3888 if (!$upload->hasUploads()) {
3889 throw new ilException($DIC->language()->txt(
"upload_error_file_not_found"));
3894 $UploadResult = $upload->getResults()[$a_file];
3895 $ProcessingStatus = $UploadResult->getStatus();
3896 if ($ProcessingStatus->getCode() === ProcessingStatus::REJECTED) {
3897 throw new ilException($ProcessingStatus->getMessage());
3900 if ($a_raise_errors) {
3909 $upload->moveOneFileTo($UploadResult, $targetDir, $targetFilesystem, $targetFilename,
true);
3923 list($datum, $uhrzeit) = explode(
" ", $mysql_date_time);
3924 list($jahr, $monat,
$tag) = explode(
"-", $datum);
3925 list($std, $min, $sec) = explode(
":", $uhrzeit);
3926 return mktime((
int) $std, (
int) $min, (
int) $sec, (
int) $monat, (
int)
$tag, (
int) $jahr);
3937 return date(
"Y-m-d H:i:s");
3955 public static function &
processCSVRow(&
$row, $quoteAll =
false, $separator =
";", $outUTF8 =
false, $compatibleWithMSExcel =
true)
3957 $resultarray =
array();
3958 foreach (
$row as $rowindex => $entry) {
3963 if (strpos($entry,
"\"") !==
false) {
3964 $entry = str_replace(
"\"",
"\"\"", $entry);
3967 if (strpos($entry, $separator) !==
false) {
3970 if ($compatibleWithMSExcel) {
3972 $entry = str_replace(chr(13) . chr(10), chr(10), $entry);
3976 $resultarray[$rowindex] =
"\"" . $entry .
"\"";
3978 $resultarray[$rowindex] = utf8_decode(
"\"" . $entry .
"\"");
3982 $resultarray[$rowindex] = $entry;
3984 $resultarray[$rowindex] = utf8_decode($entry);
3988 return $resultarray;
3992 public static function isDN($a_str)
3994 return(preg_match(
"/^[a-z]+([a-z0-9-]*[a-z0-9]+)?(\.([a-z]+([a-z0-9-]*[a-z0-9]+)?)+)*$/", $a_str));
4000 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])\." .
4001 "(\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));
4037 $ilDB = $DIC->database();
4038 $rbacreview = $DIC->rbac()->review();
4039 $ilAccess = $DIC->access();
4042 $tree = $DIC->repositoryTree();
4044 if (!is_array($a_obj_type)) {
4045 $where =
"WHERE type = " .
$ilDB->quote($a_obj_type,
"text") .
" ";
4047 $where =
"WHERE " .
$ilDB->in(
"type", $a_obj_type,
false,
"text") .
" ";
4052 $limit =
$ilSetting->get(
'search_max_hits', 100);
4059 $a_usr_id = $a_usr_id ? $a_usr_id :
$ilUser->getId();
4060 $a_roles = $rbacreview->assignedRoles($a_usr_id);
4064 if ($rbacreview->isAssigned($a_usr_id, SYSTEM_ROLE_ID)) {
4065 $query =
"SELECT ref_id FROM object_reference obr LEFT JOIN object_data obd ON obr.obj_id = obd.obj_id " .
4066 "LEFT JOIN tree ON obr.ref_id = tree.child " .
4074 if ($tree->isGrandChild(RECOVERY_FOLDER_ID,
$row->ref_id)) {
4082 $ref_ids[] =
$row->ref_id;
4084 return $ref_ids ? $ref_ids :
array();
4088 if ($a_operation ==
'edit_permissions' or strpos($a_operation,
'create') !==
false) {
4089 $check_owner =
") ";
4091 $check_owner =
"OR owner = " .
$ilDB->quote($a_usr_id,
"integer") .
") ";
4095 $ops_id = $ops_ids[0];
4097 $and =
"AND ((" .
$ilDB->in(
"rol_id", $a_roles,
false,
"integer") .
" ";
4099 $query =
"SELECT DISTINCT(obr.ref_id),obr.obj_id,type FROM object_reference obr " .
4100 "JOIN object_data obd ON obd.obj_id = obr.obj_id " .
4101 "LEFT JOIN rbac_pa ON obr.ref_id = rbac_pa.ref_id " .
4104 "AND (" .
$ilDB->like(
"ops_id",
"text",
"%i:" . $ops_id .
"%") .
" " .
4105 "OR " .
$ilDB->like(
"ops_id",
"text",
"%:\"" . $ops_id .
"\";%") .
")) " .
4116 if ($tree->isGrandChild(RECOVERY_FOLDER_ID,
$row->ref_id)) {
4121 if ($ilAccess->checkAccessOfUser($a_usr_id, $a_operation,
'',
$row->ref_id,
$row->type,
$row->obj_id)) {
4123 $ref_ids[] =
$row->ref_id;
4126 return $ref_ids ? $ref_ids :
array();
4138 case strpos($a_target, ILIAS_WEB_DIR .
'/' . CLIENT_ID) === 0:
4139 case strpos($a_target,
'./' . ILIAS_WEB_DIR .
'/' . CLIENT_ID) === 0:
4140 case strpos($a_target, CLIENT_WEB_DIR) === 0:
4143 case strpos($a_target, CLIENT_DATA_DIR .
"/temp") === 0:
4146 case strpos($a_target, CLIENT_DATA_DIR) === 0:
4149 case strpos($a_target, ILIAS_ABSOLUTE_PATH .
'/Customizing') === 0:
4153 throw new InvalidArgumentException(
"Can not move files to \"$a_target\" because path can not be mapped to web, storage or customizing location.");
4156 $absTargetDir = dirname($a_target);
4157 $targetDir = LegacyPathHelper::createRelativePath($absTargetDir);
4159 return array( $targetFilesystem, $targetDir );
4169 include_once
'./Services/MathJax/classes/class.ilMathJax.php';
4179 include_once
'./Services/MathJax/classes/class.ilMathJax.php';
4189 include_once
'./Services/MathJax/classes/class.ilMathJax.php';
4190 return ilMathJax::getInstance()->insertLatexImages($a_text,
'[tex]',
'[/tex]', $a_dir .
'/teximg',
'./teximg');
4201 public static function prepareTextareaOutput($txt_output, $prepare_for_latex_output =
false, $omitNl2BrWhenTextArea =
false)
4204 $is_html = self::isHTML(
$result);
4206 if ($prepare_for_latex_output) {
4207 include_once
'./Services/MathJax/classes/class.ilMathJax.php';
4214 if (!$omitNl2BrWhenTextArea) {
4220 if (preg_match_all(
"/(<pre>.*?<\/pre>)/ims",
$result, $matches)) {
4221 foreach ($matches[0] as $found) {
4223 if (strpos(
"\n", $found) ===
false) {
4224 $replacement =
"\n";
4226 $removed = preg_replace(
"/<br\s*?\/>/ims", $replacement, $found);
4231 if ($prepare_for_latex_output) {
4252 if (strlen(strip_tags($a_text)) < strlen($a_text)) {
4272 $lng = $DIC->language();
4280 $diff = $to->diff(
$from);
4283 $periods[
"years"] = $diff->format(
"%y");
4284 $periods[
"months"] = $diff->format(
"%m");
4285 $periods[
"days"] = $diff->format(
"%d");
4286 $periods[
"hours"] = $diff->format(
"%h");
4287 $periods[
"minutes"] = $diff->format(
"%i");
4288 $periods[
"seconds"] = $diff->format(
"%s");
4296 $segment_name = ($value > 1)
4298 : substr(
$key, 0, -1);
4299 $array[] = $value .
' ' .
$lng->txt($segment_name);
4303 $len =
sizeof($array);
4305 $array = array_slice($array, 0, (3-$len));
4308 return implode(
', ', $array);
4313 $max_filesize = self::formatBytes(
4314 self::getUploadSizeLimitBytes()
4319 $lng = $DIC->language();
4330 return $lng->txt(
"file_notice") .
" $max_filesize.";
4335 $unit =
array(
'',
'K',
'M',
'G',
'T',
'P');
4337 for (
$i = 0, $maxUnits = count($unit);
$size >= 1024 &&
$i <= $maxUnits;
$i++) {
4341 return round(
$size, $decimals) . $unit[
$i];
4346 $uploadSizeLimitBytes = min(
4347 self::convertPhpIniSizeValueToBytes(ini_get(
'post_max_size')),
4348 self::convertPhpIniSizeValueToBytes(ini_get(
'upload_max_filesize'))
4351 return $uploadSizeLimitBytes;
4356 if (is_numeric($phpIniSizeValue)) {
4357 return $phpIniSizeValue;
4360 $suffix = substr($phpIniSizeValue, -1);
4361 $value = substr($phpIniSizeValue, 0, -1);
4363 switch (strtoupper($suffix)) {
4394 $test_str = explode(
'_', $role_title);
4396 if ($test_str[0] ==
'il') {
4397 $test2 = (int) $test_str[3];
4398 return is_numeric($test2) ? (int) $test2 :
false;
4415 $test_str = explode(
'_', $ilias_id);
4417 if ($test_str[0] ==
'il' && $test_str[1] == $inst_id && count($test_str) == 4) {
4418 $test2 = (int) $test_str[3];
4419 return is_numeric($test2) ? (int) $test2 :
false;
4438 public static function _sortIds($a_ids, $a_table, $a_field, $a_id_name)
4442 $ilDB = $DIC->database();
4449 $where =
"WHERE " . $a_id_name .
" IN (";
4453 $query =
"SELECT " . $a_id_name .
" FROM " . $a_table .
" " .
4455 "ORDER BY " . $a_field;
4459 $ids[] =
$row->$a_id_name;
4461 return $ids ? $ids :
array();
4477 $ilDB = $DIC->database();
4492 $ilDB = $DIC->database();
4495 if (!is_array($a_array) or !count($a_array)) {
4499 foreach ($a_array as $k => $item) {
4500 $a_array[$k] =
$ilDB->quote($item);
4514 public static function sendInfo($a_info =
"", $a_keep =
false)
4519 $tpl->setMessage(
"info", $a_info, $a_keep);
4534 if (isset($DIC[
"tpl"])) {
4536 $tpl->setMessage(
"failure", $a_info, $a_keep);
4551 $tpl->setMessage(
"question", $a_info, $a_keep);
4567 $tpl->setMessage(
"success", $a_info, $a_keep);
4575 $lng = $DIC->language();
4582 "tpl.infopanel.html",
4583 "Services/Utilities" 4585 $tpl->setCurrentBlock(
"infopanel");
4587 if (!empty(
$_SESSION[
"infopanel"][
"text"])) {
4588 $link =
"<a href=\"" .
$_SESSION[
"infopanel"][
"link"] .
"\" target=\"" .
4596 if (!empty(
$_SESSION[
"infopanel"][
"img"])) {
4597 $link .=
"<td><a href=\"" .
$_SESSION[
"infopanel"][
"link"] .
"\" target=\"" .
4600 $link .=
"<img src=\"" .
"./templates/" .
$ilUser->prefs[
"skin"] .
"/images/" .
4601 $_SESSION[
"infopanel"][
"img"] .
"\" border=\"0\" vspace=\"0\"/>";
4602 $link .=
"</a></td>";
4605 $tpl->setVariable(
"INFO_ICONS", $link);
4606 $tpl->parseCurrentBlock();
4627 if (!is_dir($directory)) {
4630 $size = @filesize($directory);
4634 if ($DIR = opendir($directory)) {
4635 while (($dirfile = readdir($DIR)) !==
false) {
4636 if (is_link($directory . DIRECTORY_SEPARATOR . $dirfile) || $dirfile ==
'.' || $dirfile ==
'..') {
4639 if (is_file($directory . DIRECTORY_SEPARATOR . $dirfile)) {
4640 $size += filesize($directory . DIRECTORY_SEPARATOR . $dirfile);
4641 } elseif (is_dir($directory . DIRECTORY_SEPARATOR . $dirfile)) {
4643 $dirSize =
ilUtil::dirsize($directory . DIRECTORY_SEPARATOR . $dirfile);
4645 if ($dirSize >= 0) {
4659 $random = new \ilRandom();
4660 return md5($random->int(1, 9999999) + str_replace(
" ",
"", (
string) microtime()));
4663 public static function setCookie($a_cookie_name, $a_cookie_value =
'', $a_also_set_super_global =
true, $a_set_cookie_invalid =
false)
4670 if (!(
bool) $a_set_cookie_invalid) {
4682 if (
defined(
'IL_COOKIE_SECURE')) {
4683 $secure = IL_COOKIE_SECURE;
4696 if ((
bool) $a_also_set_super_global) {
4697 $_COOKIE[$a_cookie_name] = $a_cookie_value;
4703 return strip_tags(self::stripSlashes($a_filename));
4712 if (
$_SERVER[
'SHELL'] || php_sapi_name() ==
'cli' ||
4717 return ILIAS_HTTP_PATH;
4728 $bt = debug_backtrace();
4730 foreach ($bt as
$t) {
4731 if ($cnt != 0 && ($a_limit == 0 || $cnt <= $a_limit)) {
4732 echo
"<br>" . $t[
"file"] .
", " . $t[
"function"] .
" [" . $t[
"line"] .
"]";
4755 $exploded = explode(
'_', $a_import_id);
4757 $parsed[
'orig'] = $a_import_id;
4758 if ($exploded[0] ==
'il') {
4759 $parsed[
'prefix'] = $exploded[0];
4761 if (is_numeric($exploded[1])) {
4762 $parsed[
'inst_id'] = (int) $exploded[1];
4764 $parsed[
'type'] = $exploded[2];
4766 if (is_numeric($exploded[3])) {
4767 $parsed[
'id'] = (int) $exploded[3];
4781 '/([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff^|]*)\|/',
4784 PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE
4789 for (
$i = 0; $vars[
$i];
$i++) {
4811 $fp = @fopen(
$file,
'rb');
4829 header(
"Accept-Ranges: 0-$length");
4833 if (isset(
$_SERVER[
'HTTP_RANGE'])) {
4837 list(, $range) = explode(
'=',
$_SERVER[
'HTTP_RANGE'], 2);
4839 if (strpos($range,
',') !==
false) {
4844 header(
'HTTP/1.1 416 Requested Range Not Satisfiable');
4845 header(
"Content-Range: bytes $start-$end/$size");
4852 if ($range ==
'-') {
4855 $c_start =
$size - substr($range, 1);
4857 $range = explode(
'-', $range);
4858 $c_start = $range[0];
4859 $c_end = (isset($range[1]) && is_numeric($range[1])) ? $range[1] :
$size;
4865 $c_end = ($c_end >
$end) ?
$end : $c_end;
4867 if ($c_start > $c_end || $c_start >
$size - 1 || $c_end >=
$size) {
4868 header(
'HTTP/1.1 416 Requested Range Not Satisfiable');
4869 header(
"Content-Range: bytes $start-$end/$size");
4875 $length =
$end - $start + 1;
4877 header(
'HTTP/1.1 206 Partial Content');
4880 header(
"Content-Range: bytes $start-$end/$size");
4881 header(
"Content-Length: $length");
4885 while (!feof($fp) && ($p = ftell($fp)) <=
$end) {
4886 if ($p + $buffer >
$end) {
4890 $buffer =
$end - $p + 1;
4893 echo fread($fp, $buffer);
4935 protected static function fmtFloat($a_float, $a_decimals=0, $a_dec_point = null, $a_thousands_sep = null, $a_suppress_dot_zero=
false)
4939 $lng = $DIC->language();
4941 if ($a_dec_point == null) {
4946 if ($a_dec_point ==
'-lang_sep_decimal-') {
4950 if ($a_thousands_sep == null) {
4951 $a_thousands_sep =
$lng->txt(
'lang_sep_thousand');
4953 if ($a_thousands_sep ==
'-lang_sep_thousand-') {
4954 $a_thousands_sep =
",";
4957 $txt = number_format($a_float, $a_decimals, $a_dec_point, $a_thousands_sep);
4960 if (($a_suppress_dot_zero == 0 || $a_decimals == 0)
4961 && substr(
$txt, -2) == $a_dec_point .
'0' 4965 if ($a_float == 0 and
$txt ==
"") {
4992 $lng = $DIC->language();
4993 if ($a_lng == null) {
4997 $mag = self::_getSizeMagnitude();
4999 if (
$size >= $mag * $mag * $mag) {
5000 $scaled_size =
$size / $mag / $mag / $mag;
5001 $scaled_unit =
'lang_size_gb';
5003 if (
$size >= $mag * $mag) {
5004 $scaled_size =
$size / $mag / $mag;
5005 $scaled_unit =
'lang_size_mb';
5007 if (
$size >= $mag) {
5008 $scaled_size =
$size / $mag;
5009 $scaled_unit =
'lang_size_kb';
5011 $scaled_size =
$size;
5012 $scaled_unit =
'lang_size_bytes';
5017 $result = self::fmtFloat($scaled_size, ($scaled_unit
5018 ==
'lang_size_bytes') ? 0 : 1, $a_lng->txt(
'lang_sep_decimal'), $a_lng->txt(
'lang_sep_thousand'),
true)
5019 .
' ' . $a_lng->txt($scaled_unit);
5020 if ($a_mode ==
'long' &&
$size > $mag) {
5021 $result .=
' (' . self::fmtFloat(
$size, 0, $a_lng->txt(
'lang_sep_decimal'), $a_lng->txt(
'lang_sep_thousand')) .
' ' 5022 . $a_lng->txt(
'lang_size_bytes') .
')';
5035 return ((
int) $a_value) * pow(self::_getSizeMagnitude(), 2);
5040 return ((
int) $a_value) / (pow(self::_getSizeMagnitude(), 2));
5054 if (!isset(self::$db_supports_distinct_umlauts)) {
5055 $ilDB = $DIC->database();
5056 $set =
$ilDB->query(
"SELECT (" .
$ilDB->quote(
"A",
"text") .
" = " .
$ilDB->quote(
"Ä",
"text") .
") t FROM DUAL ");
5057 $rec =
$ilDB->fetchAssoc($set);
5058 self::$db_supports_distinct_umlauts = !(bool) $rec[
"t"];
5061 return self::$db_supports_distinct_umlauts;
static maskTag($a_str, $t, $fix_param="")
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static isConvertVersionAtLeast($a_version)
Compare convert version numbers.
static _getIcon( $a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
static getMemString()
get current memory usage as string
static tf2yn($a_tf)
convert true/false to "y"/"n"
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
static removeItemFromDesktops($a_id)
removes object from all user's desktops public
static getSafeFilename($a_initial_filename)
static shortenWords($a_str, $a_len=30, $a_dots=true)
Ensure that the maximum word lenght within a text is not longer than $a_len.
This class provides processing control methods.
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
static shortenText( $a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
static attribsToArray($a_str)
converts a string of format var1 = "val1" var2 = "val2" ...
static securePlainString($a_str)
Remove unsecure characters from a plain text string.
static rRenameSuffix($a_dir, $a_old_suffix, $a_new_suffix)
Renames all files with certain suffix and gives them a new suffix.
static virusHandling($a_file, $a_orig_name="", $a_clean=true)
scan file for viruses and clean files if possible
static strPos($a_haystack, $a_needle, $a_offset=null)
static _getOperationIdsByName($operations)
get ops_id's by name.
const STORAGE
The filesystem outside of the ilias web root.
static usesHTTP()
Uses HTTP aka browser.
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
static convertPhpIniSizeValueToBytes($phpIniSizeValue)
static is_email($a_email, ilMailRfc822AddressParserFactory $mailAddressParserFactory=null)
This preg-based function checks whether an e-mail address is formally valid.
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
static unserializeSession($data)
Returns the unserialized ILIAS session data.
static isPasswordValidForUserContext($clear_text_password, $user, &$error_language_variable=null)
static getImageTagByType($a_type, $a_path, $a_big=false)
Builds an html image tag TODO: function still in use, but in future use getImagePath and move HTML-Co...
static sort_func_numeric($a, $b)
sub-function to sort an array
static getMySQLTimestamp($a_ts)
Get MySQL timestamp in 4.1.x or higher format (yyyy-mm-dd hh:mm:ss) This function converts a timestam...
static prepareTextareaOutput($txt_output, $prepare_for_latex_output=false, $omitNl2BrWhenTextArea=false)
Prepares a string for a text area output where latex code may be in it If the text is HTML-free...
static Linkbar($AScript, $AHits, $ALimit, $AOffset, $AParams=array(), $ALayout=array(), $prefix='')
Linkbar Diese Funktion erzeugt einen typischen Navigationsbalken mit "Previous"- und "Next"-Links und...
static unmaskAttributeTag($a_str, $tag, $tag_att)
static $db_supports_distinct_umlauts
static getSelectName($selected, $values)
???
static parseImportId($a_import_id)
Parse an ilias import id Typically of type il_[IL_INST_ID]_[OBJ_TYPE]_[OBJ_ID] returns array( 'orig' ...
static _getObjectsByOperations($a_obj_type, $a_operation, $a_usr_id=0, $limit=0)
Get all objects of a specific type and check access This function is not recursive, instead it parses the serialized rbac_pa entries.
static MB2Bytes($a_value)
static groupNameExists($a_group_name, $a_id=0)
checks if group name already exists.
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
static getUsersOnline($a_user_id=0)
reads all active sessions from db and returns users that are online OR returns only one active user i...
static getNewContentStyleSheetLocation($mode="output")
get full style sheet file name (path inclusive) of current user
static _getSizeMagnitude()
Returns the magnitude used for size units.
static unique_multi_array($array, $sub_key)
Make a multi-dimensional array to have only DISTINCT values for a certain "column".
static getPasswordValidChars($a_as_regex=true, $a_only_special_chars=false)
All valid chars for password.
static _lookupTitle($a_id)
lookup object title
static assembleParameterString($a_par_arr)
static generatePasswords($a_number)
Generate a number of passwords.
static deducibleSize($a_mime)
checks if mime type is provided by getimagesize()
static dumpVar($mixed=null)
Dump var.
static getClientIdByString($clientId)
static formatBytes($size, $decimals=0)
static subStr($a_str, $a_start, $a_length=null)
static getTypeIconPath($a_type, $a_obj_id, $a_size='small')
Get type icon path path Return image path for icon_xxx.pngs Or (if enabled) path to custom icon Depre...
static maskSecureTags($a_str, $allow_array)
static isPassword($a_passwd, &$customError=null)
validates a password public
static dbSupportsDisctinctUmlauts()
Only temp fix for #8603, should go to db classes.
static now()
Return current timestamp in Y-m-d H:i:s format.
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
$stream
PHP stream implementation.
static stripScriptHTML($a_str, $a_allow="", $a_rm_js=true)
strip only html tags (4.0) from text $allowed contains tags to be allowed, in format tags a and b ar...
static escapeShellCmd($a_arg)
escape shell cmd
static makeTimeSelect($prefix, $short=true, $hour="", $minute="", $second="", $a_use_default=true, $a_further_options=array())
Creates a combination of HTML selects for time inputs.
static getPasswordRequirementsInfo()
infotext for ilPasswordInputGUI setInfo()
static isWindows()
check wether the current client system is a windows system
static processConvertVersion($a_version)
Parse convert version string, e.g.
static stripOnlySlashes($a_str)
strip slashes if magic qoutes is enabled
static & processCSVRow(&$row, $quoteAll=false, $separator=";", $outUTF8=false, $compatibleWithMSExcel=true)
Convertes an array for CSV usage.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static buildLatexImages($a_text, $a_dir)
replace [tex]...[/tex] tags with formula image code for offline use
static _removeItemFromDesktops($a_id)
removes object from all user's desktops public
static getP3PLocation()
Get p3p file path.
static maskAttributeTag($a_str, $tag, $tag_att)
static unmaskSecureTags($a_str, $allow_array)
static _sanitizeFilemame($a_filename)
Class ilMailRfc822AddressParserFactory.
static getAssociatedUsersOnline($a_user_id)
reads all active sessions from db and returns users that are online and who have a local role in a gr...
static __extractRefId($role_title)
extract ref id from role title, e.g.
static getJavaPath()
get full java path (dir + java command)
static getConvertCmd()
get convert command
static setCookie($a_cookie_name, $a_cookie_value='', $a_also_set_super_global=true, $a_set_cookie_invalid=false)
static appendUrlParameterString($a_url, $a_par, $xml_style=false)
append URL parameter string ("par1=value1&par2=value2...") to given URL string
catch(Exception $e) $message
static formDisabledRadioButton($checked, $varname, $value, $disabled)
???
static replaceUrlParameterString($url, $parametersArray)
static resizeImage($a_from, $a_to, $a_width, $a_height, $a_constrain_prop=false)
resize image
foreach($_POST as $key=> $value) $res
static execConvert($args)
execute convert command
static date_mysql2time($mysql_date_time)
make time object from mysql_date_time
static _sortIds($a_ids, $a_table, $a_field, $a_id_name)
Function that sorts ids by a given table field using WHERE IN E.g: __sort(array(6,7),'usr_data','lastname','usr_id') => sorts by lastname.
static stableSortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false)
Sort an aray using a stable sort algorithm, which preveserves the sequence of array elements which ha...
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static KT_replaceParam($qstring, $paramName, $paramValue)
static _lookupObjId($a_id)
static makeClickable($a_text, $detectGotoLinks=false)
makeClickable In Texten enthaltene URLs und Mail-Adressen klickbar machen
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
static mergesort(&$array, $cmp_function='strcmp')
static getUploadSizeLimitBytes()
static Bytes2MB($a_value)
static period2String(ilDateTime $a_from, $a_to=null)
Return a string of time period.
static setPathStr($a_path)
??? public
static stripSlashesRecursive($a_data, $a_strip_html=true, $a_allow="")
Strip slashes from array and sub-arrays.
const CUSTOMIZING
The filesystem within the web root where all the skins and plugins are saved.
static infoPanel($a_keep=true)
static convertImage( $a_from, $a_to, $a_target_format="", $a_geometry="", $a_background_color="")
convert image
static CreateIsoFromFolder($a_dir, $a_file)
static getGDSupportedImageType($a_desired_type)
returns the best supported image type by this PHP build
static sort_func($a, $b)
sub-function to sort an array
static createDirectory($a_dir, $a_mod=0755)
create directory
static clear($a_var)
Unset a value.
Add a drawing to the header
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
get($a_format, $a_format_str='', $a_tz='')
get formatted date
static removeTrailingPathSeparators($path)
static zip($a_dir, $a_file, $compress_content=false)
zips given directory/file into given zip.file
static makeDateSelect($prefix, $year="", $month="", $day="", $startyear="", $a_long_month=true, $a_further_options=array(), $emptyoption=false)
Creates a combination of HTML selects for date inputs.
static unmaskTag($a_str, $t, $fix_param="")
static getHtmlPath($relative_path)
get url of path
static _getAssociatedUsersOnline($a_user_id, $a_no_anonymous=false)
reads all active sessions from db and returns users that are online and who have a local role in a gr...
Create styles array
The data for the language used.
static array_php2js($data)
convert php arrays to javascript arrays
static replaceLinkProperties($matches)
replaces target _blank with _self and the link text with the according object title.
rangeDownload($file)
Send a file via range request, see http://mobiforge.com/design-development/content-delivery-mobile-de...
static formRadioButton($checked, $varname, $value, $onclick=null, $disabled=false)
??? public
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
includeMathjax($a_tpl=null)
Include Mathjax.
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static getInstance()
Get https instance.
static execQuoted($cmd, $args=null)
exec command and fix spaces on windows
static getJSLocation($a_js_name, $a_js_location="", $add_version=false)
get full javascript file name (path inclusive) of current user
static stripSlashesArray($a_arr, $a_strip_html=true, $a_allow="")
Strip slashes from array.
static htmlentitiesOutsideHTMLTags($htmlText)
Encodes HTML entities outside of HTML tags.
static ilTempnam($a_temp_path=null)
Create a temporary file in an ILIAS writable directory.
static secureUrl($url)
Prepare secure href attribute.
static dirsize($directory)
get size of a directory or a file.
static quoteArray($a_array)
Quotes all members of an array for usage in DB query statement.
static secureLink($a_str)
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
static getDataDir()
get data directory (outside webspace)
static formSelect( $selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
static strToUpper($a_string)
static getInstance()
Singleton: get instance.
static renameExecutables($a_dir)
Rename uploaded executables for security reasons.
static escapeShellArg($a_arg)
static switchColor($a_num, $a_css1, $a_css2)
switches style sheets for each even $a_num (used for changing colors of different result rows) ...
static prepareDBString($a_str)
prepare a string for db writing (insert/update)
static checkInput($vars)
???
const TEMPORARY
The ILIAS temporary directory.
static insertInstIntoID($a_value)
inserts installation id into ILIAS id
static secureString($a_str, $a_strip_html=true, $a_allow="")
Remove unsecure tags.
static insertLatexImages($a_text, $a_start='[tex]', $a_end='[/tex]')
replace [tex]...[/tex] tags with formula image code
static formInput($varname, $value, $disabled=false)
create html input area
static recursive_dirscan($dir, &$arr)
Recursively scans a given directory and writes path and filename into referenced array.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
static formatSize($size, $a_mode='short', $a_lng=null)
Returns the specified file size value in a human friendly form.
static isHTML($a_text)
Checks if a given string contains HTML or not.
static htmlencodePlainString($a_str, $a_make_links_clickable, $a_detect_goto_links=false)
Encodes a plain text string into HTML for display in a browser.
static yn2tf($a_yn)
convert "y"/"n" to true/false
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
static checkFormEmpty($emptyFields)
??? public
static redirect($a_script)
static extractParameterString($a_parstr)
extracts parameter value pairs from a string into an array
static excelTime($year="", $month="", $day="", $hour="", $minute="", $second="")
Calculates a Microsoft Excel date/time value.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static getWebspaceDir($mode="filesystem")
get webspace directory
static __extractId($ilias_id, $inst_id)
extract ref id from role title, e.g.
static _getInstance()
Get instance of ilSecuritySettings.
static fmtFloat($a_float, $a_decimals=0, $a_dec_point=null, $a_thousands_sep=null, $a_suppress_dot_zero=false)
format a float
if(function_exists('posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
Class FlySystemFileAccessTest.
static getValidFilename($a_filename)
Get valid filename.
const WEB
The filesystem within the ilias web root.
static formCheckbox($checked, $varname, $value, $disabled=false)
??? public
static printBacktrace($a_limit=0)
printBacktrace
static strCmp($a, $b)
Compare two strings.
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
static dumpString($a_str)
dumps ord values of every character of string $a_str
static sanitateTargetPath($a_target)
static readFile($a_file)
there are some known problems with the original readfile method, which sometimes truncates delivered ...