39 return "<img src=\"".ilUtil::getImagePath(
$filename).
"\" alt=\"".$lng->txt(
"obj_".$a_type).
"\" title=\"".$lng->txt(
"obj_".$a_type).
"\" border=\"0\" vspace=\"0\"/>";
59 if($ilSetting->get(
"custom_icons"))
66 include_once(
'./Services/Container/classes/class.ilContainer.php');
99 public static function getImagePath(
$img, $module_path =
"", $mode =
"output", $offline =
false)
103 if (is_int(strpos($_SERVER[
"PHP_SELF"],
"setup.php")))
107 if ($module_path !=
"")
109 $module_path =
"/".$module_path;
113 $default_img =
".".$module_path.
"/templates/default/images/".
$img;
116 require_once(
"./Services/Style/classes/class.ilStyleDefinition.php");
120 if (is_object($styleDefinition))
122 $image_dir = $styleDefinition->getImageDirectory(
126 if ($current_skin ==
"default")
128 $user_img =
".".$module_path.
"/templates/default/".$image_dir.
"/".
$img;
129 $skin_img =
".".$module_path.
"/templates/default/images/".
$img;
131 else if (is_object($styleDefinition) && $current_skin !=
"default")
133 $user_img =
"./Customizing/global/skin/".
134 $current_skin.$module_path.
"/".$image_dir.
"/".
$img;
135 $skin_img =
"./Customizing/global/skin/".
136 $current_skin.$module_path.
"/images/".
$img;
141 return "./images/".$img;
143 else if (@file_exists($user_img) && $image_dir !=
"")
147 else if (file_exists($skin_img))
167 if (substr($relative_path, 0, 2) ==
'./')
169 $relative_path = (substr($relative_path, 1));
171 if (substr($relative_path, 0, 1) !=
'/')
173 $relative_path =
'/' . $relative_path;
175 $htmlpath = ILIAS_HTTP_PATH . $relative_path;
197 require_once(
"./Services/Style/classes/class.ilStyleDefinition.php");
198 $stylesheet_name = (strlen($a_css_name))
201 if (strlen($a_css_location) && (strcmp(substr($a_css_location, -1),
"/") != 0))
203 $a_css_location = $a_css_location .
"/";
208 require_once(
"./Services/Style/classes/class.ilStyleDefinition.php");
211 $filename =
"./Customizing/global/skin/".ilStyleDefinition::getCurrentSkin().
"/".$a_css_location.$stylesheet_name;
215 $filename =
"./" . $a_css_location .
"templates/default/".$stylesheet_name;
218 if ($mode !=
"filesystem")
220 $vers = str_replace(
" ",
"-", $ilias->getSetting(
"ilias_version"));
221 $vers =
"?vers=".str_replace(
".",
"-", $vers);
236 public static function getJSLocation($a_js_name, $a_js_location =
"", $add_version = FALSE)
241 $js_name = $a_js_name;
242 if (strlen($a_js_location) && (strcmp(substr($a_js_location, -1),
"/") != 0)) $a_js_location = $a_js_location .
"/";
246 require_once(
"./Services/Style/classes/class.ilStyleDefinition.php");
249 $filename =
"./Customizing/global/skin/".ilStyleDefinition::getCurrentSkin().
"/".$a_js_location.$js_name;
253 $filename =
"./" . $a_js_location .
"templates/default/".$js_name;
258 $vers = str_replace(
" ",
"-", $ilias->getSetting(
"ilias_version"));
259 $vers =
"?vers=".str_replace(
".",
"-", $vers);
275 if (defined(
"ILIAS_MODULE"))
280 $base .=
"../Services/Privacy/";
285 $base =
"./Services/Privacy/";
288 if (is_file($base.
"w3c/p3p.xml"))
290 return ILIAS_HTTP_PATH.
"w3c/p3p.xml";
294 return ILIAS_HTTP_PATH.
"/w3c/p3p_template.xml";
310 if ($mode !=
"filesystem")
312 $vers = str_replace(
" ",
"-", $ilias->getSetting(
"ilias_version"));
313 $vers =
"?vers=".str_replace(
".",
"-", $vers);
317 require_once(
"./Services/Style/classes/class.ilStyleDefinition.php");
320 $in_style =
"./templates/".ilStyleDefinition::getCurrentSkin().
"/"
321 .ilStyleDefinition::getCurrentStyle().
"_cont.css";
325 $in_style =
"./Customizing/global/skin/".ilStyleDefinition::getCurrentSkin().
"/"
326 .ilStyleDefinition::getCurrentStyle().
"_cont.css";
329 if (is_file(
"./".$in_style))
331 return $in_style.$vers;
335 return "templates/default/delos_cont.css".$vers;
357 public static function formSelect($selected,$varname,$options,$multiple =
false,$direct_text =
false,
$size =
"0",
358 $style_class =
"", $attribs =
"",$disabled =
false)
362 if ($multiple ==
true)
364 $multiple =
" multiple=\"multiple\"";
372 if ($style_class !=
"")
374 $class =
" class=\"".$style_class.
"\"";
381 if (is_array($attribs))
383 foreach ($attribs as $key => $val)
385 $attributes .=
" ".$key.
"=\"".$val.
"\"";
390 $disabled =
' disabled=\"disabled\"';
393 $str =
"<select name=\"".$varname .
"\"".$multiple.
" $class size=\"".
$size.
"\" $attributes $disabled>\n";
395 foreach ((array) $options as $key => $val)
400 $style = $val[
"style"];
404 $sty = ($style !=
"")
405 ?
' style="'.$style.
'" '
410 $str .=
" <option $sty value=\"".$key.
"\"";
414 $str .=
" <option $sty value=\"".$val.
"\"";
416 if (is_array($selected) )
418 if (in_array($key,$selected))
420 $str .=
" selected=\"selected\"";
423 else if ($selected == $key)
425 $str .=
" selected=\"selected\"";
430 $str .=
">".$val.
"</option>\n";
434 $str .=
">".$lng->txt($val).
"</option>\n";
438 $str .=
"</select>\n";
454 return($values[$selected]);
468 public static function formCheckbox ($checked,$varname,$value,$disabled =
false)
470 $str =
"<input type=\"checkbox\" name=\"".$varname.
"\"";
474 $str .=
" checked=\"checked\"";
479 $str .=
" disabled=\"disabled\"";
484 if (substr($varname,-2) ==
"[]")
492 $varname_id = substr($varname,0,-2).
"_".$value;
496 $varname_id = $varname;
500 $varname_id = ereg_replace(
"\[",
"_",$varname_id);
501 $varname_id = ereg_replace(
"\]",
"",$varname_id);
503 $str .=
" value=\"".$value.
"\" id=\"".$varname_id.
"\" />\n";
522 $str =
"<input disabled type=\"radio\" name=\"".$varname.
"\"";
525 $str =
"<input type=\"radio\" name=\"".$varname.
"\"";
529 $str .=
" checked=\"checked\"";
532 $str .=
" value=\"".$value.
"\"";
533 $str .=
" id=\"".$value.
"\" />\n";
556 $str .= (
'onclick="'.$onclick.
'"');
559 $str .= (
" type=\"radio\" name=\"".$varname.
"\"");
562 $str .=
" checked=\"checked\"";
565 $str .=
" value=\"".$value.
"\"";
567 $str .=
" id=\"".$value.
"\" />\n";
582 public static function formInput($varname,$value,$disabled =
false)
585 $str =
"<input type=\"input\" name=\"".$varname.
"\"";
591 $str .=
" value=\"".$value.
"\"";
593 $str .=
" id=\"".$value.
"\" />\n";
619 if (
"" != $a_path &&
"/" != substr($a_path, -1))
666 foreach ($emptyFields as $key => $val)
669 if ($feedback !=
"") $feedback .=
", ";
701 public static function Linkbar ($AScript,$AHits,$ALimit,$AOffset,$AParams = array(),$ALayout = array(), $prefix =
'')
706 $layout_prev =
"<<";
707 $layout_next =
">>";
710 if (count($ALayout > 0))
712 if ($ALayout[
"link"])
714 $layout_link =
" class=\"".$ALayout[
"link"].
"\"";
717 if ($ALayout[
"prev"])
719 $layout_prev = $ALayout[
"prev"];
722 if ($ALayout[
"next"])
724 $layout_next = $ALayout[
"next"];
730 if ($AHits > $ALimit || $AOffset > 0)
732 if (!empty($AParams))
734 foreach ($AParams as $key => $value)
736 $params.= $key.
"=".$value.
"&";
740 if(strpos($AScript,
'&'))
742 $link = $AScript.
"&".$params.$prefix.
"offset=";
746 $link = $AScript.
"?".$params.$prefix.
"offset=";
752 $prevoffset = $AOffset - $ALimit;
753 if ($prevoffset < 0) $prevoffset = 0;
754 $LinkBar .=
"<a".$layout_link.
" href=\"".$link.$prevoffset.
"\">".$layout_prev.
" </a>";
758 $pages=intval($AHits/$ALimit);
761 if (($AHits % $ALimit))
768 for ($i = 1 ;$i <= $pages ; $i++)
770 $newoffset=$ALimit*($i-1);
772 if ($newoffset == $AOffset)
774 $LinkBar .=
"[".$i.
"] ";
778 $LinkBar .=
'<a '.$layout_link.
' href="'.
779 $link.$newoffset.
'">['.$i.
']</a> ';
786 if (! ( ($AOffset/$ALimit)==($pages-1) ) && ($pages!=1) )
788 $newoffset=$AOffset+$ALimit;
789 $LinkBar .=
"<a".$layout_link.
" href=\"".$link.$newoffset.
"\"> ".$layout_next.
"</a>";
817 $ret = eregi_replace(
"(^|[[:space:]]+)(www\.)([[:alnum:]#?/&=\.-]+)",
818 "\\1http://\\2\\3",
$ret);
821 $ret = eregi_replace(
"(^|[[:space:]]+)(ftp\.)([[:alnum:]#?/&=\.-]+)",
822 "\\1ftp://\\2\\3",
$ret);
829 $ret = str_replace(
'src="http://',
'"***masked_im_start***',
$ret);
831 include_once(
"./Services/Utilities/classes/class.ilMWParserAdapter.php");
833 $ret = $parser->replaceFreeExternalLinks(
$ret);
836 $ret = str_replace(
'"***masked_im_start***',
'src="http://',
$ret);
840 if ($detectGotoLinks)
843 $regExp =
"<a[^>]*href=\"(".str_replace(
"/",
"\/",ILIAS_HTTP_PATH).
"\/goto.php\?target=\w+_(\d+)[^\"]*)\"[^>]*>[^<]*<\/a>";
845 $ret = preg_replace_callback(
847 array(
"ilUtil",
"replaceLinkProperties"),
851 $regExp =
"<a[^>]*href=\"(".str_replace(
"/",
"\/",ILIAS_HTTP_PATH).
"\/goto_.*[a-z0-9]+_([0-9]+)\.html)\"[^>]*>[^<]*<\/a>";
853 $ret = preg_replace_callback(
855 array(
"ilUtil",
"replaceLinkProperties"),
886 $link =
"<a href=".$matches[1].
" target=\"_self\">".
$title.
"</a>";
910 public static function makeDateSelect($prefix, $year =
"", $month =
"", $day =
"", $startyear =
"",$a_long_month =
true,$a_further_options = array(), $emptyoption =
false)
915 if(isset($a_further_options[
'disabled']) and $a_further_options[
'disabled'])
917 $disabled =
'disabled="disabled" ';
923 if (!strlen($year)) $year = $now[
"year"];
924 if (!strlen($month)) $month = $now[
"mon"];
925 if (!strlen($day)) $day = $now[
"mday"];
929 $month = (int) $month;
934 $sel_day .=
'<select ';
935 if(isset($a_further_options[
'select_attributes']))
937 foreach($a_further_options[
'select_attributes'] as $name => $value)
939 $sel_day .= ($name.
'="'.$value.
'" ');
943 $sel_day .= $disabled.
"name=\"".$prefix.
"[d]\" id=\"".$prefix.
"_d\">\n";
945 if ($emptyoption) $sel_day .=
"<option value=\"0\">--</option>\n";
946 for ($i = 1; $i <= 31; $i++)
948 $sel_day .=
"<option value=\"$i\">" . sprintf(
"%02d", $i) .
"</option>\n";
950 $sel_day .=
"</select>\n";
951 $sel_day = preg_replace(
"/(value\=\"$day\")/",
"$1 selected=\"selected\"", $sel_day);
954 $sel_month =
'<select ';
955 if(isset($a_further_options[
'select_attributes']))
957 foreach($a_further_options[
'select_attributes'] as $name => $value)
959 $sel_month .= ($name.
'="'.$value.
'" ');
962 $sel_month .= $disabled.
"name=\"".$prefix.
"[m]\" id=\"".$prefix.
"_m\">\n";
964 if ($emptyoption) $sel_month .=
"<option value=\"0\">--</option>\n";
965 for ($i = 1; $i <= 12; $i++)
969 $sel_month .=
"<option value=\"$i\">" . $lng->txt(
"month_" . sprintf(
"%02d", $i) .
"_long") .
"</option>\n";
973 $sel_month .=
"<option value=\"$i\">" . $i .
"</option>\n";
976 $sel_month .=
"</select>\n";
977 $sel_month = preg_replace(
"/(value\=\"$month\")/",
"$1 selected=\"selected\"", $sel_month);
980 $sel_year =
'<select ';
981 if(isset($a_further_options[
'select_attributes']))
983 foreach($a_further_options[
'select_attributes'] as $name => $value)
985 $sel_year .= ($name.
'="'.$value.
'" ');
988 $sel_year .= $disabled.
"name=\"".$prefix.
"[y]\" id=\"".$prefix.
"_y\">\n";
989 if ((strlen($startyear) == 0) || ($startyear > $year))
991 if (!$emptyoption || $year != 0) $startyear = $year - 5;
994 if(($year + 5) < (date(
'Y',time()) + 5))
996 $end_year = date(
'Y',time()) + 5;
1000 $end_year = $year + 5;
1003 if ($emptyoption) $sel_year .=
"<option value=\"0\">----</option>\n";
1004 for ($i = $startyear; $i <= $end_year; $i++)
1006 $sel_year .=
"<option value=\"$i\">" . sprintf(
"%04d", $i) .
"</option>\n";
1008 $sel_year .=
"</select>\n";
1009 $sel_year = preg_replace(
"/(value\=\"$year\")/",
"$1 selected=\"selected\"", $sel_year);
1012 $dateformat =
"d-m-Y";
1013 $dateformat = strtolower(preg_replace(
"/\W/",
"", $dateformat));
1014 $dateformat = strtolower(preg_replace(
"/(\w)/",
"%%$1", $dateformat));
1015 $dateformat = preg_replace(
"/%%d/", $sel_day, $dateformat);
1016 $dateformat = preg_replace(
"/%%m/", $sel_month, $dateformat);
1017 $dateformat = preg_replace(
"/%%y/", $sel_year, $dateformat);
1039 public static function makeTimeSelect($prefix, $short =
true, $hour =
"", $minute =
"", $second =
"",$a_use_default =
true,$a_further_options = array())
1045 if(count($a_further_options))
1047 if(isset($a_further_options[
'minute_steps']))
1049 $minute_steps = $a_further_options[
'minute_steps'];
1051 if(isset($a_further_options[
'disabled']) and $a_further_options[
'disabled'])
1053 $disabled =
'disabled="disabled" ';
1057 if ($a_use_default and !strlen(
"$hour$minute$second")) {
1064 $minute = (int)$minute;
1065 $second = (int)$second;
1068 $sel_hour =
'<select ';
1069 if(isset($a_further_options[
'select_attributes']))
1071 foreach($a_further_options[
'select_attributes'] as $name => $value)
1073 $sel_hour .= $name.
'='.$value.
' ';
1076 $sel_hour .=
" ".$disabled.
"name=\"".$prefix.
"[h]\" id=\"".$prefix.
"_h\">\n";
1078 $format = $ilUser->getTimeFormat();
1079 for ($i = 0; $i <= 23; $i++)
1083 $sel_hour .=
"<option value=\"$i\">" . sprintf(
"%02d", $i) .
"</option>\n";
1087 $sel_hour .=
"<option value=\"$i\">" . date(
"ga", mktime($i, 0, 0)) .
"</option>\n";
1090 $sel_hour .=
"</select>\n";
1091 $sel_hour = preg_replace(
"/(value\=\"$hour\")/",
"$1 selected=\"selected\"", $sel_hour);
1094 $sel_minute .=
"<select ".$disabled.
"name=\"".$prefix.
"[m]\" id=\"".$prefix.
"_m\">\n";
1096 for ($i = 0; $i <= 59; $i = $i + $minute_steps)
1098 $sel_minute .=
"<option value=\"$i\">" . sprintf(
"%02d", $i) .
"</option>\n";
1100 $sel_minute .=
"</select>\n";
1101 $sel_minute = preg_replace(
"/(value\=\"$minute\")/",
"$1 selected=\"selected\"", $sel_minute);
1105 $sel_second .=
"<select ".$disabled.
"name=\"".$prefix.
"[s]\" id=\"".$prefix.
"_s\">\n";
1107 for ($i = 0; $i <= 59; $i++)
1109 $sel_second .=
"<option value=\"$i\">" . sprintf(
"%02d", $i) .
"</option>\n";
1111 $sel_second .=
"</select>\n";
1112 $sel_second = preg_replace(
"/(value\=\"$second\")/",
"$1 selected=\"selected\"", $sel_second);
1114 $timeformat = $lng->text[
"lang_timeformat"];
1115 if (strlen($timeformat) == 0) $timeformat =
"H:i:s";
1116 $timeformat = strtolower(preg_replace(
"/\W/",
"", $timeformat));
1117 $timeformat = preg_replace(
"/(\w)/",
"%%$1", $timeformat);
1118 $timeformat = preg_replace(
"/%%h/", $sel_hour, $timeformat);
1119 $timeformat = preg_replace(
"/%%i/", $sel_minute, $timeformat);
1121 $timeformat = preg_replace(
"/%%s/",
"", $timeformat);
1123 $timeformat = preg_replace(
"/%%s/", $sel_second, $timeformat);
1148 if(is_object($ilias))
1150 require_once
'./Services/PEAR/lib/Mail/RFC822.php';
1155 $addresses = $parser->parseAddressList($a_email,
'ilias',
false,
true);
1156 if(!is_a($addresses,
'PEAR_Error') &&
1157 count($addresses) == 1 && $addresses[0]->host !=
'ilias'
1175 "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|".
1176 "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|".
1177 "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|".
1178 "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|".
1179 "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|".
1180 "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|".
1181 "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|".
1182 "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|".
1183 "WF|WS|XN|YE|YT|YU|ZA|ZM|ZW");
1185 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));
1198 public static function isPassword($a_passwd, &$customError = null)
1202 include_once(
'./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
1209 $customError = null;
1214 case empty($a_passwd):
1217 case strlen($a_passwd) < 6:
1220 case !preg_match(
"/^[A-Za-z0-9_\.\+\?\#\-\*\@!\$\%\~]+$/", $a_passwd):
1233 if( empty($a_passwd) )
1235 $customError = $lng->txt(
'password_empty');
1243 if( $security->getPasswordMinLength() > 0 && strlen($a_passwd) < $security->getPasswordMinLength() )
1245 $errors[] = sprintf( $lng->txt(
'password_to_short'), $security->getPasswordMinLength() );
1246 $isPassword =
false;
1250 if( $security->getPasswordMaxLength() > 0 && strlen($a_passwd) > $security->getPasswordMaxLength() )
1252 $errors[] = sprintf( $lng->txt(
'password_to_long'), $security->getPasswordMaxLength() );
1253 $isPassword =
false;
1257 if( $security->isPasswordCharsAndNumbersEnabled() )
1259 $hasCharsAndNumbers =
true;
1262 if( !preg_match(
'/[A-Za-z]+/',$a_passwd) )
1264 $hasCharsAndNumbers =
false;
1268 if( !preg_match(
'/[0-9]+/',$a_passwd) )
1270 $hasCharsAndNumbers =
false;
1273 if( !$hasCharsAndNumbers )
1275 $errors[] = $lng->txt(
'password_must_chars_and_numbers');
1276 $isPassword =
false;
1281 if( $security->isPasswordSpecialCharsEnabled() )
1283 $specialCharsReg =
'/[_\.\+\?\#\-\*\@!\$\%\~\/\:\;]+/';
1286 if( !preg_match($specialCharsReg, $a_passwd) )
1288 $errors[] = $lng->txt(
'password_must_special_chars');
1289 $isPassword =
false;
1294 if( !preg_match(
"/^[A-Za-z0-9_\.\+\?\#\-\*\@!\$\%\~\/\:\;]+$/", $a_passwd) )
1296 $errors[] = $lng->txt(
'password_contains_invalid_chars');
1297 $isPassword =
false;
1307 $customError = $lng->txt(
'password_multiple_errors');
1308 $customError .=
'<br />'.implode(
'<br />',
$errors);
1326 include_once(
'./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
1331 $validPasswordChars =
'A-Z a-z 0-9 _.+?#-*@!$%~/:;';
1335 $validPasswordChars =
'A-Z a-z 0-9 _.+?#-*@!$%~';
1338 return sprintf($lng->txt(
'password_allow_chars'), $validPasswordChars);
1349 if (empty($a_login))
1354 if (strlen($a_login) < 3)
1362 if (!ereg(
"^[A-Za-z0-9_\.\+\*\@!\$\%\~\-]+$", $a_login))
1383 public static function shortenText ($a_str, $a_len, $a_dots =
false, $a_next_blank =
false,
1384 $a_keep_extension =
false)
1386 include_once(
"./Services/Utilities/classes/class.ilStr.php");
1402 if ($a_keep_extension)
1404 $p = strrpos($a_str,
'.');
1406 if ($p ===
false || $p == 0 || strlen($a_str) - $p > $a_len)
1411 $a_str .=
"\xe2\x80\xa6";
1418 $a_str =
ilStr::subStr($a_str,0,$len - (strlen($a_str) - $p + 1)).
"\xe2\x80\xa6".substr($a_str, $p);
1422 $a_str =
ilStr::subStr($a_str,0,$len - (strlen($a_str) - $p + 1)).substr($a_str, $p);
1442 include_once(
"./Services/Utilities/classes/class.ilStr.php");
1443 $str_arr = explode(
" ", $a_str);
1445 for ($i = 0; $i < count($str_arr); $i++)
1452 $str_arr[$i].=
"...";
1457 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);
1503 public static function rCopy ($a_sdir, $a_tdir, $preserveTimeAttributes =
false)
1506 if (!@is_dir($a_sdir) or
1513 $dir = opendir($a_sdir);
1515 while(
$file = readdir($dir))
1517 if (
$file !=
"." and
1521 if (@is_dir($a_sdir.
"/".
$file))
1523 if (!@is_dir($a_tdir.
"/".
$file))
1538 if (@is_file($a_sdir.
"/".
$file))
1540 if (!copy($a_sdir.
"/".
$file,$a_tdir.
"/".
$file))
1544 if ($preserveTimeAttributes)
1545 touch($a_tdir.
"/".
$file, filectime($a_sdir.
"/".
$file));
1564 if ($mode ==
"filesystem")
1566 return "./".ILIAS_WEB_DIR.
"/".$ilias->client_id;
1570 if (defined(
"ILIAS_MODULE"))
1572 return "../".ILIAS_WEB_DIR.
"/".$ilias->client_id;
1576 return "./".ILIAS_WEB_DIR.
"/".$ilias->client_id;
1591 return CLIENT_DATA_DIR;
1608 include_once(
"./Services/User/classes/class.ilObjUser.php");
1624 include_once(
"./Services/User/classes/class.ilObjUser.php");
1638 if (!is_dir($temp_path))
1642 $temp_name = tempnam($temp_path,
"tmp");
1648 $temp_name = str_replace(
"\\",
"/", $temp_name);
1678 public static function unzip($a_file, $overwrite =
false, $a_flat =
false)
1680 if (!is_file($a_file))
1690 copy($a_file, $tmpdir.DIRECTORY_SEPARATOR.basename($a_file));
1691 $orig_file = $a_file;
1692 $a_file = $tmpdir.DIRECTORY_SEPARATOR.basename($a_file);
1693 $origpathinfo = pathinfo($orig_file);
1696 $pathinfo = pathinfo($a_file);
1697 $dir = $pathinfo[
"dirname"];
1698 $file = $pathinfo[
"basename"];
1703 $unzip = PATH_TO_UNZIP;
1749 $unzipcmd =
"-o ".ilUtil::escapeShellArg(
$file);
1758 include_once(
"./Services/Utilities/classes/class.ilFileUtils.php");
1759 $filearray = array();
1761 if (is_array($filearray[
"file"]))
1763 foreach ($filearray[
"file"] as $k => $f)
1765 if (substr($f, 0, 1) !=
"." && $f != basename($orig_file))
1767 copy($filearray[
"path"][$k].$f, $origpathinfo[
"dirname"].DIRECTORY_SEPARATOR.$f);
1781 public static function zip($a_dir, $a_file, $compress_content =
false)
1785 if($compress_content)
1788 $pathinfo = pathinfo($a_dir);
1789 chdir($pathinfo[
"dirname"]);
1792 $pathinfo = pathinfo($a_file);
1793 $dir = $pathinfo[
"dirname"];
1794 $file = $pathinfo[
"basename"];
1796 if(!$compress_content)
1809 if (is_array($a_dir))
1812 foreach($a_dir as $dir)
1814 $name = basename($dir);
1815 $source.=
" ".ilUtil::escapeShellArg($name);
1820 $name = basename($a_dir);
1821 if (trim($name) !=
"*")
1831 $zipcmd =
"-r ".ilUtil::escapeShellArg($a_file).
" ".$source;
1841 $pathinfo = pathinfo($a_dir);
1842 chdir($pathinfo[
"dirname"]);
1844 $pathinfo = pathinfo($a_file);
1845 $dir = $pathinfo[
"dirname"];
1846 $file = $pathinfo[
"basename"]; $zipcmd =
"-r ".ilUtil::escapeShellArg($a_file).
" ".$source;
1848 $mkisofs = PATH_TO_MKISOFS;
1855 $name = basename($a_dir);
1858 $zipcmd =
"-r -J -o ".$a_file.
" ".$source;
1874 return PATH_TO_CONVERT;
1900 if($current_version >= $version)
1915 if(preg_match(
"/([0-9]+)\.([0-9]+)\.([0-9]+)([\.|\-]([0-9]+))?/", $a_version, $match))
1917 $version = str_pad($match[1], 2, 0, STR_PAD_LEFT).
1918 str_pad($match[2], 2, 0, STR_PAD_LEFT).
1919 str_pad($match[3], 2, 0, STR_PAD_LEFT).
1920 str_pad($match[5], 2, 0, STR_PAD_LEFT);
1921 return (
int)$version;
1934 public static function convertImage($a_from, $a_to, $a_target_format =
"", $a_geometry =
"",
1935 $a_background_color =
"")
1937 $format_str = ($a_target_format !=
"")
1938 ? strtoupper($a_target_format).
":"
1941 if ($a_geometry !=
"")
1943 if (is_int(strpos($a_geometry,
"x")))
1945 $geometry =
" -geometry ".$a_geometry.
" ";
1949 $geometry =
" -geometry ".$a_geometry.
"x".$a_geometry.
" ";
1953 $bg_color = ($a_background_color !=
"")
1954 ?
" -background color ".$a_background_color.
" "
1956 $convert_cmd =
ilUtil::escapeShellArg($a_from).
" ".$bg_color.$geometry.ilUtil::escapeShellArg($format_str.$a_to);
1971 public static function resizeImage($a_from, $a_to, $a_width, $a_height, $a_constrain_prop =
false)
1973 if ($a_constrain_prop)
1975 $size =
" -geometry ".$a_width.
"x".$a_height.
" ";
1979 $size =
" -resize ".$a_width.
"x".$a_height.
"! ";
1992 public static function img($a_src, $a_alt =
"", $a_width =
"", $a_height =
"", $a_border = 0, $a_id =
"")
1994 $img =
'<img src="'.$a_src.
'"';
1997 $img.=
' alt="'.$a_alt.
'" title="'.$a_alt.
'"';
2001 $img.=
' width="'.$a_width.
'"';
2003 if ($a_height !=
"")
2005 $img.=
' height="'.$a_height.
'"';
2009 $img.=
' id="'.$a_id.
'"';
2011 $img.=
' border="'.(int) $a_border.
'"/>';
2025 $html_file = str_replace(
".pdf",
".html",$pdf_file);
2027 $fp = fopen( $html_file ,
"wb");
2042 $htmldoc_path = PATH_TO_HTMLDOC;
2044 $htmldoc =
"--no-toc ";
2045 $htmldoc .=
"--no-jpeg ";
2046 $htmldoc .=
"--webpage ";
2048 $htmldoc .=
"--bodyfont Arial ";
2049 $htmldoc .=
"--charset iso-8859-15 ";
2050 $htmldoc .=
"--color ";
2051 $htmldoc .=
"--size A4 ";
2052 $htmldoc .=
"--format pdf ";
2053 $htmldoc .=
"--footer ... ";
2054 $htmldoc .=
"--header ... ";
2055 $htmldoc .=
"--left 60 ";
2057 $htmldoc .= $html_file;
2068 public static function deliverData($a_data, $a_filename, $mime =
"application/octet-stream", $charset =
"")
2070 $disposition =
"attachment";
2073 include_once
'./Services/Http/classes/class.ilHTTPS.php';
2083 #header("Pragma: ");
2084 #header("Cache-Control: ");
2085 #header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
2086 #header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
2087 #header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
2088 #header("Cache-Control: post-check=0, pre-check=0", false);
2090 else if ($disposition ==
"attachment")
2092 header(
"Cache-control: private");
2096 header(
"Cache-Control: no-cache, must-revalidate");
2097 header(
"Pragma: no-cache");
2102 if (strlen($charset))
2104 $charset =
"; charset=$charset";
2106 header(
"Content-Type: $mime$charset");
2107 header(
"Content-Disposition:$disposition; filename=\"".$ascii_filename.
"\"");
2108 header(
"Content-Description: ".$ascii_filename);
2109 header(
"Content-Length: ".(
string)(strlen($a_data)));
2114 header(
'Cache-Control: must-revalidate, post-check=0, pre-check=0');
2115 header(
'Pragma: public');
2118 header(
"Connection: close");
2131 public static function deliverFile($a_file, $a_filename,$a_mime =
'', $isInline =
false, $removeAfterDelivery =
false,
2132 $a_exit_after =
true)
2135 if(!file_exists($a_file))
2141 $disposition =
"inline";
2143 $disposition =
"attachment";
2154 $mime =
"application/octet-stream";
2158 if ($disposition ==
"attachment")
2160 header(
"Cache-control: private");
2164 header(
"Cache-Control: no-cache, must-revalidate");
2165 header(
"Pragma: no-cache");
2170 header(
"Content-Type: $mime");
2171 header(
"Content-Disposition:$disposition; filename=\"".$ascii_filename.
"\"");
2172 header(
"Content-Description: ".$ascii_filename);
2175 $filesize = @filesize($a_file);
2178 header(
"Content-Length: ".(
string)$filesize);
2181 include_once
'./Services/Http/classes/class.ilHTTPS.php';
2182 #if($_SERVER['HTTPS'])
2185 header(
'Cache-Control: must-revalidate, post-check=0, pre-check=0');
2186 header(
'Pragma: public');
2189 header(
"Connection: close");
2191 if ($removeAfterDelivery)
2213 $chunksize = 1*(1024*1024);
2215 $handle = fopen($a_file,
'rb');
2216 if ($handle ===
false)
2220 while (!feof($handle))
2222 $buffer = fread($handle, $chunksize);
2225 return fclose($handle);
2255 $ascii_filename = htmlentities($a_filename, ENT_NOQUOTES,
'UTF-8');
2256 $ascii_filename = preg_replace(
'/\&(.)[^;]*;/',
'\\1', $ascii_filename);
2257 $ascii_filename = preg_replace(
'/[\x7f-\xff]/',
'_', $ascii_filename);
2260 $ascii_filename = preg_replace(
'/[:\x5c\/\*\?\"<>\|]/',
'_', $ascii_filename);
2262 return $ascii_filename;
2274 $sep =
'###HTMLTAG###';
2276 preg_match_all(
"@<[^>]*>@", $htmlText, $matches);
2277 $tmp = preg_replace(
"@(<[^>]*>)@", $sep, $htmlText);
2278 $tmp = explode($sep, $tmp);
2280 for ($i=0; $i<count($tmp); $i++)
2281 $tmp[$i] = htmlentities($tmp[$i], ENT_COMPAT,
"UTF-8");
2283 $tmp = join($sep, $tmp);
2285 for ($i=0; $i<count($matches[0]); $i++)
2286 $tmp = preg_replace(
"@$sep@", $matches[0][$i], $tmp, 1);
2299 return PATH_TO_JAVA;
2318 $url = (is_int(strpos($a_url,
"?")))
2319 ? $a_url.$amp.$a_par
2320 : $a_url.
"?".$a_par;
2342 $a_dir = trim($a_dir);
2345 if (substr($a_dir,-1) ==
"/")
2347 $a_dir = substr($a_dir,0,-1);
2351 if (!(
$path = substr($a_dir,0, strrpos($a_dir,
"/") - strlen($a_dir))))
2358 return @mkdir($a_dir,fileperms(
$path));
2378 $dirs = array($a_dir);
2379 $a_dir = dirname($a_dir);
2382 while($last_dirname != $a_dir)
2384 array_unshift(
$dirs, $a_dir);
2385 $last_dirname = $a_dir;
2386 $a_dir = dirname($a_dir);
2390 $reverse_paths = array_reverse(
$dirs, TRUE);
2392 foreach ($reverse_paths as $key => $value)
2394 if ($found_index == -1)
2398 $found_index = $key;
2404 foreach (
$dirs as $dirindex => $dir)
2407 if ($dirindex >= $found_index)
2409 if (! file_exists($dir))
2411 if (strcmp(substr($dir,strlen($dir)-1,1),
"/") == 0)
2415 $dir = substr($dir,0,strlen($dir)-1);
2417 if (! mkdir($dir, $umask))
2419 error_log(
"Can't make directory: $dir");
2423 elseif (! is_dir($dir))
2425 error_log(
"$dir is not a directory");
2431 $umask = fileperms($dir);
2447 public static function delDir($a_dir, $a_clean_only =
false)
2449 if (!is_dir($a_dir) || is_int(strpos($a_dir,
"..")))
2454 $current_dir = opendir($a_dir);
2463 while($entryname = readdir($current_dir))
2465 $files[] = $entryname;
2468 foreach($files as
$file)
2470 if(is_dir($a_dir.
"/".$file) and ($file !=
"." and $file!=
".."))
2474 elseif ($file !=
"." and $file !=
"..")
2476 unlink(${a_dir}.
"/".${file});
2480 closedir($current_dir);
2494 public static function getDir($a_dir, $a_rec =
false, $a_sub_dir =
"")
2496 $current_dir = opendir($a_dir.$a_sub_dir);
2500 $subitems = array();
2501 while($entry = readdir($current_dir))
2503 if(is_dir($a_dir.
"/".$entry))
2505 $dirs[$entry] = array(
"type" =>
"dir",
"entry" => $entry,
2506 "subdir" => $a_sub_dir);
2507 if ($a_rec && $entry !=
"." && $entry !=
"..")
2510 $subitems = array_merge($subitems,
$si);
2515 if ($entry !=
"." && $entry !=
"..")
2517 $size = filesize($a_dir.$a_sub_dir.
"/".$entry);
2518 $files[$entry] = array(
"type" =>
"file",
"entry" => $entry,
2519 "size" =>
$size,
"subdir" => $a_sub_dir);
2526 return array_merge(
$dirs, $files, $subitems);
2537 if (is_array($a_arr))
2539 foreach ($a_arr as $k => $v)
2556 if (is_array($a_data))
2558 foreach ($a_data as $k => $v)
2585 public static function stripSlashes($a_str, $a_strip_html =
true, $a_allow =
"")
2587 if (ini_get(
"magic_quotes_gpc"))
2589 $a_str = stripslashes($a_str);
2605 if (ini_get(
"magic_quotes_gpc"))
2607 $a_str = stripslashes($a_str);
2619 public static function secureString($a_str, $a_strip_html =
true, $a_allow =
"")
2622 $only_secure =
true;
2623 $allow_tags = explode(
">", $a_allow);
2625 $allow_array = array();
2626 foreach($allow_tags as $allow)
2630 $allow = str_replace(
"<",
"", $allow);
2632 if (!in_array($allow, $sec_tags))
2634 $only_secure =
false;
2636 $allow_array[] = $allow;
2641 if (($only_secure || $a_allow ==
"") && $a_strip_html)
2645 $allow_array = array (
"b",
"i",
"strong",
"em",
"code",
"cite",
2646 "gap",
"sub",
"sup",
"pre",
"strike");
2652 $a_str = strip_tags($a_str);
2677 return array(
"strong",
"em",
"u",
"strike",
"ol",
"li",
"ul",
"p",
"div",
2678 "i",
"b",
"code",
"sup",
"sub",
"pre",
"gap",
"a",
"img");
2683 foreach ($allow_array as
$t)
2698 array(
"param" =>
"align",
"value" =>
"left"),
2699 array(
"param" =>
"align",
"value" =>
"center"),
2700 array(
"param" =>
"align",
"value" =>
"justify"),
2701 array(
"param" =>
"align",
"value" =>
"right")
2716 foreach ($allow_array as
$t)
2731 array(
"param" =>
"align",
"value" =>
"left"),
2732 array(
"param" =>
"align",
"value" =>
"center"),
2733 array(
"param" =>
"align",
"value" =>
"justify"),
2734 array(
"param" =>
"align",
"value" =>
"right")
2756 if (ini_get(
"magic_quotes_gpc"))
2758 return stripslashes($a_str);
2785 if ($a_make_links_clickable)
2803 $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);
2806 foreach ($matches as $match)
2809 foreach ($matches[0] as $match)
2811 $matched_text = $match[0];
2813 if ($matched_offset != previous_offset)
2816 $encoded .= nl2br(htmlspecialchars(substr($a_str, $pos1, $pos2 - $pos1)));
2822 $pos1 = $pos2 + strlen($matched_text);
2824 if ($pos1 < strlen($a_str))
2826 $encoded .= nl2br(htmlspecialchars(substr($a_str, $pos1)));
2831 $encoded = nl2br(htmlspecialchars($a_str));
2841 $ws =
"[ \t\r\f\v\n]*";
2842 $att = $ws.
"[^>]*".$ws;
2844 while (eregi(
"<($tag$att($tag_att$ws=$ws\"(([\$@!*()~;,_0-9A-z/:=%\\.&#?+\\-])*)\")$att)>",
2847 $un = array(
".",
"-",
"+",
"?",
'$',
"*",
"(",
")");
2853 $ff = str_replace($un, $esc, $found[1]);
2856 $a_str = eregi_replace(
"<".$ff.
">",
2857 "<$tag $tag_att$tag_att=\"".$found[3].
"\">", $a_str);
2858 if ($old_str == $a_str)
2860 $ilLog->write(
"ilUtil::maskA-".htmlentities($old_str).
" == ".
2861 htmlentities($a_str));
2865 $a_str = str_ireplace(
"</$tag>",
2866 "</$tag>", $a_str);
2874 while (eregi(
"<($tag $tag_att$tag_att=\"(([\$@!*()~;,_0-9A-z/:=%\\.&#?+\\-])*)\")>",
2877 $un = array(
".",
"-",
"+",
"?",
'$',
"*",
"(",
")");
2883 $ff = str_replace($un, $esc, $found[1]);
2886 $a_str = eregi_replace(
"<".$ff.
">",
2887 "<$tag $tag_att=\"".ilUtil::secureLink($found[2]).
"\">", $a_str);
2888 if ($old_str == $a_str)
2890 $ilLog->write(
"ilUtil::unmaskA-".htmlentities($old_str).
" == ".
2891 htmlentities($a_str));
2895 $a_str = str_replace(
"</$tag>",
"</$tag>", $a_str);
2901 $a_str = str_replace(array(
"<$t>",
"<".strtoupper(
$t).
">"),
2902 "<".
$t.
">", $a_str);
2903 $a_str = str_replace(array(
"</$t>",
"</".strtoupper(
$t).
">"),
2904 "</".
$t.
">", $a_str);
2906 if (is_array($fix_param))
2908 foreach ($fix_param as $p)
2912 $a_str = str_replace(
"<$t $k=\"$v\">",
2913 "<".
"$t $k=\"$v\"".
">", $a_str);
2922 $a_str = str_replace(
"<".
$t.
">",
"<".$t.
">", $a_str);
2923 $a_str = str_replace(
"</".
$t.
">",
"</".$t.
">", $a_str);
2925 if (is_array($fix_param))
2927 foreach ($fix_param as $p)
2931 $a_str = str_replace(
"<$t $k=\"$v\">",
2932 "<".
"$t $k=\"$v\"".
">", $a_str);
2940 $a_str = str_ireplace(
"javascript",
"jvscrpt", $a_str);
2941 $a_str = str_ireplace(array(
"%00",
"%0a",
"%0d",
"%1a",
"�",
"�",
2942 "�",
"�",
"
",
"
",
" ",
" "),
"-", $a_str);
2963 $negativestr =
"a,abbr,acronym,address,applet,area,b,base,basefont,".
2964 "bdo,big,blockquote,body,br,button,caption,center,cite,code,col,".
2965 "colgroup,dd,del,dfn,dir,div,dl,dt,em,fieldset,font,form,frame,".
2966 "frameset,h1,h2,h3,h4,h5,h6,head,hr,html,i,iframe,img,input,ins,isindex,kbd,".
2967 "label,legend,li,link,map,menu,meta,noframes,noscript,object,ol,".
2968 "optgroup,option,p,param,q,s,samp,script,select,small,span,".
2969 "strike,strong,style,sub,sup,table,tbody,td,textarea,tfoot,th,thead,".
2970 "title,tr,tt,u,ul,var";
2971 $a_allow = strtolower ($a_allow);
2972 $negatives = explode(
",",$negativestr);
2973 $outer_old_str =
"";
2974 while($outer_old_str != $a_str)
2976 $outer_old_str = $a_str;
2977 foreach ($negatives as $item)
2979 $pos = strpos($a_allow,
"<$item>");
2985 while($old_str != $a_str)
2988 $a_str = preg_replace(
"/<\/?\s*$item(\/?)\s*>/i",
"", $a_str);
2989 $a_str = preg_replace(
"/<\/?\s*$item(\/?)\s+([^>]*)>/i",
"", $a_str);
2998 $a_str = preg_replace(
"/<\s*\w*(\/?)(\s+[^>]*)?(\s+on[^>]*)>/i",
"", $a_str);
3001 $a_str = preg_replace(
"/<\s*\w*(\/?)\s+[^>]*javascript[^>]*>/i",
"", $a_str);
3005 $a_str = preg_replace(
"/<\s*\w*(\/?)\s+[^>]*expression[^>]*>/i",
"", $a_str);
3022 if (ini_get(
"magic_quotes_gpc"))
3028 return addslashes($a_str);
3049 $a_str = htmlspecialchars($a_str);
3053 $a_str = str_replace(
"{",
"{", $a_str);
3054 $a_str = str_replace(
"}",
"}", $a_str);
3073 return addslashes($a_str);
3105 while(($spos=strpos($a_parstr,
"=")) &&
$ok)
3108 $cpar = substr($a_parstr,0,$spos);
3109 $a_parstr = substr($a_parstr,$spos,strlen($a_parstr)-$spos);
3110 while(substr($cpar,0,1)==
"," ||substr($cpar,0,1)==
" " || substr($cpar,0,1)==chr(13) || substr($cpar,0,1)==chr(10))
3111 $cpar = substr($cpar,1,strlen($cpar)-1);
3112 while(substr($cpar,strlen($cpar)-1,1)==
" " || substr($cpar,strlen($cpar)-1,1)==chr(13) || substr($cpar,strlen($cpar)-1,1)==chr(10))
3113 $cpar = substr($cpar,0,strlen($cpar)-1);
3117 while($cpar != $cpar_old)
3120 $cpar = eregi_replace(
"[^a-zA-Z0-9_]",
"", $cpar);
3126 if($spos=strpos($a_parstr,
"\""))
3128 $a_parstr = substr($a_parstr,$spos+1,strlen($a_parstr)-$spos);
3129 $spos=strpos($a_parstr,
"\"");
3132 $cval = substr($a_parstr,0,$spos);
3134 $a_parstr = substr($a_parstr,$spos+1,strlen($a_parstr)-$spos-1);
3144 if(
$ok)
return $par;
else return false;
3149 if (is_array($a_par_arr))
3152 foreach ($a_par_arr as $par => $val)
3171 for($i=0; $i<strlen($a_str); $i++)
3173 $ret.= ord(substr($a_str,$i,1)).
" ";
3187 if(strtolower($a_yn) ==
"y")
3227 global $array_sortby,$array_sortorder;
3231 if ($array_sortorder ==
"asc")
3236 if ($array_sortorder ==
"desc")
3238 return !
ilStr::strCmp($a[$array_sortby], $b[$array_sortby]);
3255 global $array_sortby,$array_sortorder;
3257 if ($array_sortorder ==
"asc")
3259 return $a[
"$array_sortby"] > $b[
"$array_sortby"];
3262 if ($array_sortorder ==
"desc")
3264 return $a[
"$array_sortby"] < $b[
"$array_sortby"];
3279 public static function sortArray($array,$a_array_sortby,$a_array_sortorder = 0,$a_numeric =
false,
3280 $a_keep_keys =
false)
3282 include_once(
"./Services/Utilities/classes/class.ilStr.php");
3285 if (! $a_keep_keys) {
3290 global $array_sortby,$array_sortorder;
3292 $array_sortby = $a_array_sortby;
3294 if ($a_array_sortorder ==
"desc")
3296 $array_sortorder =
"desc";
3300 $array_sortorder =
"asc";
3306 uasort($array, array(
"ilUtil",
"sort_func_numeric"));
3310 usort($array, array(
"ilUtil",
"sort_func_numeric"));
3317 uasort($array, array(
"ilUtil",
"sort_func"));
3321 usort($array, array(
"ilUtil",
"sort_func"));
3343 public static function stableSortArray($array,$a_array_sortby,$a_array_sortorder = 0,$a_numeric =
false)
3345 global $array_sortby,$array_sortorder;
3347 $array_sortby = $a_array_sortby;
3349 if ($a_array_sortorder ==
"desc")
3351 $array_sortorder =
"desc";
3355 $array_sortorder =
"asc";
3359 $sort_array = array_values($array);
3372 public static function mergesort(&$array, $cmp_function =
'strcmp') {
3374 if (count($array) < 2)
return;
3377 $halfway = count($array) / 2;
3378 $array1 = array_slice($array, 0, $halfway);
3379 $array2 = array_slice($array, $halfway);
3386 if (call_user_func($cmp_function, end($array1), $array2[0]) < 1) {
3387 $array = array_merge($array1, $array2);
3394 while ($ptr1 < count($array1) && $ptr2 < count($array2)) {
3395 if (call_user_func($cmp_function, $array1[$ptr1], $array2[$ptr2]) < 1) {
3396 $array[] = $array1[$ptr1++];
3399 $array[] = $array2[$ptr2++];
3404 while ($ptr1 < count($array1)) $array[] = $array1[$ptr1++];
3405 while ($ptr2 < count($array2)) $array[] = $array2[$ptr2++];
3425 $existing_sub_key_values = array();
3427 foreach ($array as $key=>$sub_array)
3429 if (!in_array($sub_array[$sub_key], $existing_sub_key_values))
3431 $existing_sub_key_values[] = $sub_array[$sub_key];
3432 $target[$key] = $sub_array;
3451 $a_desired_type = strtolower($a_desired_type);
3453 $im_types = ImageTypes();
3455 switch($a_desired_type)
3458 if ($im_types & IMG_JPG)
return "jpg";
3459 if ($im_types & IMG_GIF)
return "gif";
3460 if ($im_types & IMG_PNG)
return "png";
3464 if ($im_types & IMG_GIF)
return "gif";
3465 if ($im_types & IMG_JPG)
return "jpg";
3466 if ($im_types & IMG_PNG)
return "png";
3470 if ($im_types & IMG_PNG)
return "png";
3471 if ($im_types & IMG_JPG)
return "jpg";
3472 if ($im_types & IMG_GIF)
return "gif";
3490 if (($a_mime ==
"image/gif") || ($a_mime ==
"image/jpeg") ||
3491 ($a_mime ==
"image/png") || ($a_mime ==
"application/x-shockwave-flash") ||
3492 ($a_mime ==
"image/tiff") || ($a_mime ==
"image/x-ms-bmp") ||
3493 ($a_mime ==
"image/psd") || ($a_mime ==
"image/iff"))
3513 global
$log, $PHP_SELF;
3516 if (!is_int(strpos($a_script,
"://")))
3518 if (substr($a_script, 0, 1) !=
"/" && defined(
"ILIAS_HTTP_PATH"))
3520 if (is_int(strpos($_SERVER[
"PHP_SELF"],
"/setup/")))
3522 $a_script =
"setup/".$a_script;
3524 $a_script = ILIAS_HTTP_PATH.
"/".$a_script;
3530 global $ilPluginAdmin;
3531 if (is_object($ilPluginAdmin))
3533 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_SERVICE,
"UIComponent",
"uihk");
3534 foreach ($pl_names as $pl)
3537 $gui_class = $ui_plugin->getUIClassInstance();
3538 $resp = $gui_class->getHTML(
"Services/Utilities",
"redirect", array(
"html" => $a_script));
3541 $a_script = $gui_class->modifyHTML($a_script, $resp);
3546 header(
"Location: ".$a_script);
3560 if (substr($a_value, 0, 4) ==
"il__")
3562 $a_value =
"il_".IL_INST_ID.
"_".substr($a_value, 4, strlen($a_value) - 4);
3582 if (empty($a_group_name))
3584 $message = __METHOD__.
": No groupname given!";
3585 $ilErr->raiseError($message,$ilErr->WARNING);
3588 $clause = ($a_id) ?
" AND obj_id != ".$ilDB->quote($a_id).
" " :
"";
3590 $q =
"SELECT obj_id FROM object_data ".
3591 "WHERE title = ".$ilDB->quote($a_group_name,
"text").
" ".
3592 "AND type = ".$ilDB->quote(
"grp",
"text").
3595 $r = $ilDB->query($q);
3615 $my_pid = getmypid();
3616 return (
"MEMORY USAGE (% KB PID ): ".`ps -eo%mem,rss,pid | grep $my_pid`);
3627 if (strtolower(substr(php_uname(), 0, 3)) ==
"win")
3637 setlocale(LC_CTYPE,
"UTF8",
"en_US.UTF-8");
3639 return escapeshellarg($a_arg);
3653 if(ini_get(
'safe_mode') == 1)
3657 setlocale(LC_CTYPE,
"UTF8",
"en_US.UTF-8");
3658 return escapeshellcmd($a_arg);
3677 $cmd =
'"'.$cmd.
'"';
3682 if (version_compare(phpversion(),
"5.2",
"<") && strpos($args,
'"') !==
false)
3684 $cmd =
'"'.$cmd.
" ".$args.
'"';
3726 public static function excelTime($year =
"", $month =
"", $day =
"", $hour =
"", $minute =
"", $second =
"")
3728 $starting_time = mktime(0, 0, 0, 1, 2, 1970);
3729 if (strcmp(
"$year$month$day$hour$minute$second",
"") == 0)
3731 $target_time = time();
3740 $target_time = mktime($hour, $minute, $second, $month, $day, $year);
3741 $difference = $target_time - $starting_time;
3742 $days = (($difference - ($difference % 86400)) / 86400);
3743 $difference = $difference - ($days * 86400) + 3600;
3744 return ($days + 25570 + ($difference / 86400));
3755 $def_arr = explode(
",", SUFFIX_REPL_DEFAULT);
3756 foreach ($def_arr as $def)
3761 $def_arr = explode(
",", SUFFIX_REPL_ADDITIONAL);
3762 foreach ($def_arr as $def)
3782 if ($a_dir ==
"/" || $a_dir ==
"" || is_int(strpos($a_dir,
".."))
3783 || trim($a_old_suffix) ==
"")
3789 if (!@is_dir($a_dir))
3795 $dir = opendir($a_dir);
3797 while(
$file = readdir($dir))
3799 if (
$file !=
"." and
3803 if (@is_dir($a_dir.
"/".
$file))
3809 if (@is_file($a_dir.
"/".
$file))
3812 if(strrpos(
$file,
'.') == (strlen(
$file) - 1))
3814 rename($a_dir.
'/'.
$file,substr($a_dir.
'/'.
$file,0,-1));
3818 $path_info = pathinfo($a_dir.
"/".
$file);
3820 if (strtolower($path_info[
"extension"]) ==
3821 strtolower($a_old_suffix))
3823 $pos = strrpos($a_dir.
"/".
$file,
".");
3824 $new_name = substr($a_dir.
"/".
$file, 0, $pos).
".".$a_new_suffix;
3825 rename($a_dir.
"/".
$file, $new_name);
3834 return strpos($_SERVER[
"SCRIPT_FILENAME"],
"api") !==
false ||
3835 strpos($_SERVER[
"SCRIPT_FILENAME"],
"dummy") !==
false;
3839 if (preg_match(
"/&" . $paramName .
"=/", $qstring)) {
3840 return preg_replace(
"/&" . $paramName .
"=[^&]+/",
"&" . $paramName .
"=" . urlencode($paramValue), $qstring);
3842 return $qstring .
"&" . $paramName .
"=" . urlencode($paramValue);
3848 foreach ($parametersArray as $paramName => $paramValue ) {
3863 srand((
double) microtime()*1000000);
3865 include_once(
'./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
3868 for ($i=1; $i<=$a_number; $i++)
3870 $min = ($security->getPasswordMinLength() > 0)
3871 ? $security->getPasswordMinLength()
3873 $max = ($security->getPasswordMaxLength() > 0)
3874 ? $security->getPasswordMaxLength()
3880 $length = rand($min,$max);
3883 $consonants =
"bcdfghjklmnpqrstvwxyz";
3884 $numbers =
"1234567890";
3885 $special =
"_.+?#-*@!$%~";
3889 if ($security->isPasswordCharsAndNumbersEnabled())
3891 $num_pos = rand(0, $length - 1);
3895 if ($security->isPasswordSpecialCharsEnabled())
3897 $spec_pos = rand(0, $length - 1);
3898 if ($security->isPasswordCharsAndNumbersEnabled())
3900 if ($num_pos == $spec_pos)
3913 for ($j=0; $j < $length; $j++)
3915 if ($security->isPasswordCharsAndNumbersEnabled() && $num_pos == $j)
3917 $pw.= $numbers[rand(0,strlen($numbers)-1)];
3919 else if ($security->isPasswordSpecialCharsEnabled() && $spec_pos == $j)
3921 $pw.= $special[rand(0,strlen($special)-1)];
3928 $pw.= $consonants[rand(0,strlen($consonants)-1)];
3933 $pw.= $vowels[rand(0,strlen($vowels)-1)];
3947 $path = preg_replace(
"/[\/\\\]+$/",
"",
$path);
3968 foreach(
$data as $k=>$datum)
3970 if(is_null($datum))
$data[$k] =
'null';
3971 if(is_string($datum))
$data[$k] =
"'" . $datum .
"'";
3975 return "[" . implode(
', ',
$data) .
"]";
3984 public static function virusHandling($a_file, $a_orig_name =
"", $a_clean =
true)
3988 if (IL_VIRUS_SCANNER !=
"None")
3990 require_once(
"./Services/VirusScanner/classes/class.ilVirusScannerFactory.php");
3992 if (($vs_txt = $vs->scanFile($a_file, $a_orig_name)) !=
"")
3994 if ($a_clean && (IL_VIRUS_CLEAN_COMMAND !=
""))
3996 $clean_txt = $vs->cleanFile($a_file, $a_orig_name);
3997 if ($vs->fileCleaned())
3999 $vs_txt.=
"<br />".$lng->txt(
"cleaned_file").
4000 "<br />".$clean_txt;
4001 $vs_txt.=
"<br />".$lng->txt(
"repeat_scan");
4002 if (($vs2_txt = $vs->scanFile($a_file, $a_orig_name)) !=
"")
4004 return array(
false, nl2br($vs_txt).
"<br />".$lng->txt(
"repeat_scan_failed").
4005 "<br />".nl2br($vs2_txt));
4009 return array(
true, nl2br($vs_txt).
"<br />".$lng->txt(
"repeat_scan_succeded"));
4014 return array(
false, nl2br($vs_txt).
"<br />".$lng->txt(
"cleaning_failed"));
4019 return array(
false, nl2br($vs_txt));
4024 return array(
true,
"");
4035 $a_mode =
"move_uploaded")
4037 global
$lng, $ilias;
4040 if (!is_file($a_file))
4042 if ($a_raise_errors)
4044 $ilias->raiseError($lng->txt(
"upload_error_file_not_found"), $ilias->error_obj->MESSAGE);
4058 if ($a_raise_errors)
4060 $ilias->raiseError($lng->txt(
"file_is_infected").
"<br />".
4062 $ilias->error_obj->MESSAGE);
4080 return rename($a_file, $a_target);
4084 return copy($a_file, $a_target);
4088 return move_uploaded_file($a_file, $a_target);
4102 list($datum, $uhrzeit) = explode (
" ",$mysql_date_time);
4103 list($jahr, $monat, $tag) = explode(
"-", $datum);
4104 list($std, $min, $sec) = explode(
":", $uhrzeit);
4105 return mktime ((
int) $std, (
int) $min, (
int) $sec, (
int) $monat, (
int) $tag, (
int) $jahr);
4116 return date(
"Y-m-d H:i:s");
4136 $resultarray = array();
4137 foreach (
$row as $rowindex => $entry)
4144 if (strpos($entry,
"\"") !== FALSE)
4146 $entry = str_replace(
"\"",
"\"\"", $entry);
4153 if ($compatibleWithMSExcel)
4156 $entry = str_replace(chr(13).chr(10), chr(10), $entry);
4162 $resultarray[$rowindex] =
"\"" . $entry .
"\"";
4166 $resultarray[$rowindex] = utf8_decode(
"\"" . $entry .
"\"");
4173 $resultarray[$rowindex] = $entry;
4177 $resultarray[$rowindex] = utf8_decode($entry);
4181 return $resultarray;
4185 public static function isDN($a_str)
4187 return(preg_match(
"/^[a-z]+([a-z0-9-]*[a-z0-9]+)?(\.([a-z]+([a-z0-9-]*[a-z0-9]+)?)+)*$/",$a_str));
4193 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])\.".
4194 "(\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));
4228 global $ilDB,$rbacreview,$ilAccess,
$ilUser,$ilias,$tree;
4230 if(!is_array($a_obj_type))
4232 $where =
"WHERE type = ".$ilDB->quote($a_obj_type,
"text").
" ";
4236 $where =
"WHERE ".$ilDB->in(
"type", $a_obj_type,
false,
"text").
" ";
4242 $limit = $ilias->getSetting(
'search_max_hits',100);
4250 $a_usr_id = $a_usr_id ? $a_usr_id : $ilUser->getId();
4251 $a_roles = $rbacreview->assignedRoles($a_usr_id);
4255 if($rbacreview->isAssigned($a_usr_id,SYSTEM_ROLE_ID))
4257 $query =
"SELECT ref_id FROM object_reference obr LEFT JOIN object_data obd ON obr.obj_id = obd.obj_id ".
4258 "LEFT JOIN tree ON obr.ref_id = tree.child ".
4264 while(
$row = $ilDB->fetchObject(
$res))
4267 if($tree->isGrandChild(RECOVERY_FOLDER_ID,
$row->ref_id))
4272 if($counter++ >= $limit)
4277 $ref_ids[] =
$row->ref_id;
4279 return $ref_ids ? $ref_ids : array();
4283 if($a_operation ==
'edit_permissions' or strpos($a_operation,
'create') !==
false)
4285 $check_owner =
") ";
4289 $check_owner =
"OR owner = ".$ilDB->quote($a_usr_id,
"integer").
") ";
4293 $ops_id = $ops_ids[0];
4295 $and =
"AND ((".$ilDB->in(
"rol_id", $a_roles,
false,
"integer").
" ";
4297 $query =
"SELECT DISTINCT(obr.ref_id),obr.obj_id,type FROM object_reference obr ".
4298 "JOIN object_data obd ON obd.obj_id = obr.obj_id ".
4299 "LEFT JOIN rbac_pa ON obr.ref_id = rbac_pa.ref_id ".
4302 "AND (".$ilDB->like(
"ops_id",
"text",
"%i:".$ops_id.
"%").
" ".
4303 "OR ".$ilDB->like(
"ops_id",
"text",
"%:\"".$ops_id.
"\";%").
")) ".
4310 if($counter >= $limit)
4316 if($tree->isGrandChild(RECOVERY_FOLDER_ID,
$row->ref_id))
4322 if($ilAccess->checkAccessOfUser($a_usr_id,$a_operation,
'',
$row->ref_id,
$row->type,
$row->obj_id))
4325 $ref_ids[] =
$row->ref_id;
4328 return $ref_ids ? $ref_ids : array();
4344 $cgi = URL_TO_LATEX;
4347 include_once
"./Services/Administration/classes/class.ilSetting.php";
4352 $a_text = preg_replace(
"/\\\\([RZN])([^a-zA-Z]|<\/span>)/",
"\\mathbb{".
"$1".
"}".
"$2", $a_text);
4358 $o_start = $a_start;
4360 $a_start = str_replace(
"\\",
"", $a_start);
4361 $a_end = str_replace(
"\\",
"", $a_end);
4363 while (is_int($spos = stripos($a_text, $a_start, $cpos)))
4365 if (is_int ($epos = stripos($a_text, $a_end, $spos + 1)))
4367 $tex = substr($a_text, $spos + strlen($a_start), $epos - $spos - strlen($a_start));
4370 if (!is_int(strpos($tex,
"</div>")))
4374 $a_text = substr($a_text, 0, $spos).
4375 "<img alt=\"".htmlentities($tex).
"\" src=\"".$cgi.
"?".
4376 rawurlencode(str_replace(
'&',
'&', str_replace(
'>',
'>', str_replace(
'<',
'<', $tex)))).
"\" ".
4378 substr($a_text, $epos + strlen($a_end));
4382 $tex = $a_start.$tex.$a_end;
4387 $mj_start =
"[tex]";
4392 $mj_start =
'<span class="math">';
4393 $mj_end =
'</span>';
4403 preg_replace(
'/' . $o_start .
'(.*?)' . $o_end .
'/ie',
4404 "'".$mj_start.
"' . preg_replace('/[\\\\\\\\\\]{2}/', '\\cr', str_replace('<', '<', str_replace('<br/>', '', str_replace('<br />', '', str_replace('<br>', '', '$1'))))) . '".$mj_end.
"'", $tex);
4406 $a_text = substr($a_text, 0, $spos).
4408 substr($a_text, $epos + strlen($a_end));
4415 $result_text = $a_text;
4417 return $result_text;
4431 $result_text = $a_text;
4436 $cgi = URL_TO_LATEX;
4440 while (preg_match(
'/' . $start .
'(.*?)' . $end .
'/ie', $result_text, $found))
4442 $cnt = (int)
$GLOBALS[
"teximgcnt"]++;
4444 $fpr = @fopen($cgi.
"?".rawurlencode($found[1]),
"r");
4450 $buf = fread($fpr, 1024);
4453 if (is_int(strpos(strtoupper(substr($buf, 0, 5)),
"GIF")))
4461 $fpw = fopen($a_dir.
"/teximg/img".$cnt.
".".$suffix,
"w");
4471 $img_str =
"./teximg/img".$cnt.
".".$suffix;
4472 $result_text = str_replace($found[0],
4473 '<img alt="'.$found[1].
'" src="'.$img_str.
'" />', $result_text);
4477 return $result_text;
4493 if ($prepare_for_latex_output)
4508 if (preg_match_all(
"/(<pre>.*?<\/pre>)/ims",
$result, $matches))
4510 foreach ($matches[0] as $found)
4513 if (strpos(
"\n", $found) === FALSE)
4515 $replacement =
"\n";
4517 $removed = preg_replace(
"/<br\s*?\/>/ims", $replacement, $found);
4522 if ($prepare_for_latex_output)
4543 if( preg_match(
"/<[^>]*?>/", $a_text) )
4559 public static function int2array ($seconds, $periods = null)
4562 if (!is_array($periods))
4565 'years' => 31536000,
4566 'months' => 2592000,
4575 $seconds = (float) $seconds;
4576 foreach ($periods as $period => $value)
4578 $count = floor($seconds / $value);
4585 $values[$period] = $count;
4586 $seconds = $seconds % $value;
4609 if (!is_array($duration))
4614 foreach ($duration as $key => $value) {
4619 $segment_name = $key;
4620 $segment_name = $lng->txt($segment_name);
4621 $segment = $value .
' ' . $segment_name;
4625 $segment_name = substr($key, 0, -1);
4626 $segment_name = $lng->txt($segment_name);
4627 $segment = $value .
' ' . $segment_name;
4630 $array[] = $segment;
4632 $len = count($array);
4636 $array=array_slice($array,0,(3-$len));
4639 $str = implode(
', ', $array);
4649 $umf=get_cfg_var(
"upload_max_filesize");
4651 $pms=get_cfg_var(
"post_max_size");
4654 $max_filesize=min($umf, $pms);
4655 if (!$max_filesize) $max_filesize=max($umf, $pms);
4657 return $lng->txt(
"file_notice").
" $max_filesize.";
4671 $test_str = explode(
'_',$role_title);
4673 if ($test_str[0] ==
'il')
4675 $test2 = (int) $test_str[3];
4676 return is_numeric ($test2) ? (int) $test2 :
false;
4694 $test_str = explode(
'_',$ilias_id);
4696 if ($test_str[0] ==
'il' && $test_str[1] == $inst_id && count($test_str) == 4)
4698 $test2 = (int) $test_str[3];
4699 return is_numeric ($test2) ? (int) $test2 :
false;
4718 public static function _sortIds($a_ids,$a_table,$a_field,$a_id_name)
4728 $where =
"WHERE ".$a_id_name.
" IN (";
4732 $query =
"SELECT ".$a_id_name.
" FROM ".$a_table.
" ".
4734 "ORDER BY ".$a_field;
4739 $ids[] =
$row->$a_id_name;
4741 return $ids ? $ids : array();
4771 if(!is_array($a_array) or !count($a_array))
4776 foreach($a_array as $k => $item)
4778 $a_array[$k] = $ilDB->quote($item);
4792 public static function sendInfo($a_info =
"",$a_keep =
false)
4795 $tpl->setMessage(
"info", $a_info, $a_keep);
4809 $tpl->setMessage(
"failure", $a_info, $a_keep);
4821 $tpl->setMessage(
"question", $a_info, $a_keep);
4835 $tpl->setMessage(
"success", $a_info, $a_keep);
4844 $tpl->addBlockFile(
"INFOPANEL",
"infopanel",
"tpl.infopanel.html",
4845 "Services/Utilities");
4846 $tpl->setCurrentBlock(
"infopanel");
4848 if (!empty(
$_SESSION[
"infopanel"][
"text"]))
4850 $link =
"<a href=\"".$dir.$_SESSION[
"infopanel"][
"link"].
"\" target=\"".
4853 $link .= $lng->txt(
$_SESSION[
"infopanel"][
"text"]);
4858 if (!empty(
$_SESSION[
"infopanel"][
"img"]))
4860 $link .=
"<td><a href=\"".$_SESSION[
"infopanel"][
"link"].
"\" target=\"".
4863 $link .=
"<img src=\"".$ilias->tplPath.$ilias->account->prefs[
"skin"].
"/images/".
4864 $_SESSION[
"infopanel"][
"img"].
"\" border=\"0\" vspace=\"0\"/>";
4865 $link .=
"</a></td>";
4868 $tpl->setVariable(
"INFO_ICONS",$link);
4869 $tpl->parseCurrentBlock();
4890 if (!is_dir($directory))
4894 $size = @filesize($directory);
4898 if ($DIR = opendir($directory))
4900 while (($dirfile = readdir($DIR)) !==
false)
4902 if (is_link($directory . DIRECTORY_SEPARATOR . $dirfile) || $dirfile ==
'.' || $dirfile ==
'..')
4904 if (is_file($directory . DIRECTORY_SEPARATOR . $dirfile))
4905 $size += filesize($directory . DIRECTORY_SEPARATOR . $dirfile);
4906 else if (is_dir($directory . DIRECTORY_SEPARATOR . $dirfile))
4909 $dirSize =
ilUtil::dirsize($directory . DIRECTORY_SEPARATOR . $dirfile);
4923 return md5(rand(1,9999999) + str_replace(
" ",
"", (
string) microtime()));
4926 public static function setCookie($a_cookie_name,$a_cookie_value =
'', $a_also_set_super_global =
true, $a_set_cookie_invalid =
false)
4933 if(!(
bool)$a_set_cookie_invalid) $expire = 0;
4934 else $expire = time() - (365*24*60*60);
4938 if( version_compare(PHP_VERSION,
'5.2.0',
'>=') )
4941 setcookie( $a_cookie_name, $a_cookie_value, $expire,
4942 IL_COOKIE_PATH, IL_COOKIE_DOMAIN, IL_COOKIE_SECURE, IL_COOKIE_HTTPONLY
4948 setcookie( $a_cookie_name, $a_cookie_value, $expire,
4953 if((
bool)$a_also_set_super_global)
$_COOKIE[$a_cookie_name] = $a_cookie_value;
4958 return strip_tags(self::stripSlashes($a_filename));
4965 if($_SERVER[
'SHELL'] || php_sapi_name() ==
'cli' ||
4969 return $ilIliasIniFile->readVariable(
'server',
'http_path');
4973 return ILIAS_HTTP_PATH;
4987 $bt = debug_backtrace();
4990 echo
"<br>".$t[
"file"].
", ".$t[
"function"].
" [".$t[
"line"].
"]";
5010 $exploded = explode(
'_'.$a_import_id);
5012 $parsed[
'orig'] = $a_import_id;
5013 if($exploded[0] ==
'il')
5015 $parsed[
'prefix'] = $exploded[0];
5017 if(is_numeric($exploded[1]))
5019 $parsed[
'inst_id'] = (int) $exploded[1];
5021 $parsed[
'type'] = $exploded[2];
5023 if(is_numeric($exploded[3]))
5025 $parsed[
'id'] = (int) $exploded[3];
5039 '/([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff^|]*)\|/',
5042 PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE
5047 for($i = 0; $vars[$i]; $i++)
5049 $result[$vars[$i++]] = unserialize($vars[$i]);