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");
 
   66        return ilObject::_getIcon($a_obj_id, $a_size, 
$a_type);
 
   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");
 
  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))
 
  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");
 
  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");
 
  239            $filename = 
"./" . $a_js_location . 
"templates/default/" . $js_name;
 
  243            $vers = str_replace(
" ", 
"-", 
$ilSetting->get(
"ilias_version"));
 
  244            $vers = 
"?vers=" . str_replace(
".", 
"-", $vers);
 
  258        if (defined(
"ILIAS_MODULE")) {
 
  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");
 
  303        if (is_file(
"./" . $in_style)) {
 
  304            return $in_style . $vers;
 
  306            return "templates/default/delos_cont.css" . $vers;
 
  333        $direct_text = 
false,
 
  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\"';
 
  367            $size_str = 
' size="'.$size.
'" ';
 
  369        $str = 
"<select name=\"" . $varname . 
"\"" . $multiple . 
" $class " . $size_str . 
" $attributes $disabled>\n";
 
  373            if (is_array($val)) {
 
  379                ? 
' style="' . 
$style . 
'" ' 
  383                $str .= 
" <option $sty value=\"" . 
$key . 
"\"";
 
  385                $str .= 
" <option $sty value=\"" . $val . 
"\"";
 
  387            if (is_array($selected)) {
 
  388                if (in_array(
$key, $selected)) {
 
  389                    $str .= 
" selected=\"selected\"";
 
  391            } elseif ($selected == 
$key) {
 
  392                $str .= 
" selected=\"selected\"";
 
  396                $str .= 
">" . $val . 
"</option>\n";
 
  398                $str .= 
">" . 
$lng->txt($val) . 
"</option>\n";
 
  402        $str .= 
"</select>\n";
 
  432    public static function formCheckbox($checked, $varname, $value, $disabled = 
false)
 
  434        $str = 
"<input type=\"checkbox\" name=\"" . $varname . 
"\"";
 
  437            $str .= 
" checked=\"checked\"";
 
  441            $str .= 
" disabled=\"disabled\"";
 
  446        if (substr($varname, -2) == 
"[]") {
 
  452            $varname_id = substr($varname, 0, -2) . 
"_" . $value;
 
  454            $varname_id = $varname;
 
  458        $varname_id = str_replace(
"[", 
"_", $varname_id);
 
  459        $varname_id = str_replace(
"]", 
"", $varname_id);
 
  461        $str .= 
" value=\"" . $value . 
"\" id=\"" . $varname_id . 
"\" />\n";
 
  480            $str = 
"<input disabled type=\"radio\" name=\"" . $varname . 
"\"";
 
  482            $str = 
"<input type=\"radio\" name=\"" . $varname . 
"\"";
 
  485            $str .= 
" checked=\"checked\"";
 
  488        $str .= 
" value=\"" . $value . 
"\"";
 
  489        $str .= 
" id=\"" . $value . 
"\" />\n";
 
  505    public static function formRadioButton($checked, $varname, $value, $onclick = 
null, $disabled = 
false)
 
  510            $str .= (
'onclick="' . $onclick . 
'"');
 
  513        $str .= (
" type=\"radio\" name=\"" . $varname . 
"\"");
 
  515            $str .= 
" checked=\"checked\"";
 
  519            $str .= 
" disabled=\"disabled\"";
 
  522        $str .= 
" value=\"" . $value . 
"\"";
 
  524        $str .= 
" id=\"" . $value . 
"\" />\n";
 
  539    public static function formInput($varname, $value, $disabled = 
false)
 
  541        $str = 
"<input type=\"input\" name=\"" . $varname . 
"\"";
 
  546        $str .= 
" value=\"" . $value . 
"\"";
 
  548        $str .= 
" id=\"" . $value . 
"\" />\n";
 
  574        if (
"" != $a_path && 
"/" != substr($a_path, -1)) {
 
  616        foreach ($emptyFields as 
$key => $val) {
 
  618                if ($feedback != 
"") {
 
  652    public static function Linkbar($AScript, $AHits, $ALimit, $AOffset, $AParams = array(), $ALayout = array(), $prefix = 
'')
 
  657        $layout_prev = 
"<<";
 
  658        $layout_next = 
">>";
 
  661        if ((is_array($ALayout) && (count($ALayout) > 0))) {
 
  662            if ($ALayout[
"link"]) {
 
  663                $layout_link = 
" class=\"" . $ALayout[
"link"] . 
"\"";
 
  666            if ($ALayout[
"prev"]) {
 
  667                $layout_prev = $ALayout[
"prev"];
 
  670            if ($ALayout[
"next"]) {
 
  671                $layout_next = $ALayout[
"next"];
 
  677        if ($AHits > $ALimit || $AOffset > 0) {
 
  678            if (!empty($AParams)) {
 
  679                foreach ($AParams as 
$key => $value) {
 
  684            if (strpos($AScript, 
'&')) {
 
  685                $link = $AScript . 
"&" . 
$params . $prefix . 
"offset=";
 
  687                $link = $AScript . 
"?" . 
$params . $prefix . 
"offset=";
 
  692                $prevoffset = $AOffset - $ALimit;
 
  693                if ($prevoffset < 0) {
 
  696                $LinkBar .= 
"<a" . $layout_link . 
" href=\"" . $link . $prevoffset . 
"\">" . $layout_prev . 
" </a>";
 
  700            $pages = intval($AHits / $ALimit);
 
  703            if (($AHits % $ALimit)) {
 
  711            for (
$i = 1 ;
$i <= $pages ; 
$i++) {
 
  712                $newoffset = $ALimit * (
$i - 1);
 
  714                if ($newoffset == $AOffset) {
 
  715                    $LinkBar .= 
"[" . 
$i . 
"] ";
 
  717                    $LinkBar .= 
'<a ' . $layout_link . 
' href="' .
 
  718                        $link . $newoffset . 
'">[' . 
$i . 
']</a> ';
 
  725            if (!(($AOffset / $ALimit) == ($pages - 1)) && ($pages != 1)) {
 
  726                $newoffset = $AOffset + $ALimit;
 
  727                $LinkBar .= 
"<a" . $layout_link . 
" href=\"" . $link . $newoffset . 
"\"> " . $layout_next . 
"</a>";
 
  754            "/(^|[\s]+)(www\.)([A-Za-z0-9#&=?.\/\-]+)/i",
 
  761            "/(^|[\s]+)(ftp\.)([A-Za-z0-9#&=?.\/\-]+)/i",
 
  771        $ret = str_replace(
'src="http://', 
'"***masked_im_start***', 
$ret);
 
  773        include_once(
"./Services/Utilities/classes/class.ilMWParserAdapter.php");
 
  778        $ret = str_replace(
'"***masked_im_start***', 
'src="http://', 
$ret);
 
  782        if ($detectGotoLinks) {
 
  784            $regExp = 
"<a[^>]*href=\"(" . str_replace(
"/", 
"\/", ILIAS_HTTP_PATH) . 
"\/goto.php\?target=\w+_(\d+)[^\"]*)\"[^>]*>[^<]*<\/a>";
 
  786            $ret = preg_replace_callback(
 
  787                "/" . $regExp . 
"/i",
 
  788                array(
"ilUtil", 
"replaceLinkProperties"),
 
  793            $regExp = 
"<a[^>]*href=\"(" . str_replace(
"/", 
"\/", ILIAS_HTTP_PATH) . 
"\/goto_.*[a-z0-9]+_([0-9]+)\.html)\"[^>]*>[^<]*<\/a>";
 
  795            $ret = preg_replace_callback(
 
  796                "/" . $regExp . 
"/i",
 
  797                array(
"ilUtil", 
"replaceLinkProperties"),
 
  821        $ref_id = $matches[2];
 
  827                $link = 
"<a href=" . $matches[1] . 
" target=\"_self\">" . 
$title . 
"</a>";
 
  851    public static function makeDateSelect($prefix, $year = 
"", $month = 
"", $day = 
"", $startyear = 
"", $a_long_month = 
true, $a_further_options = array(), $emptyoption = 
false)
 
  858        if (isset($a_further_options[
'disabled']) and $a_further_options[
'disabled']) {
 
  859            $disabled = 
'disabled="disabled" ';
 
  864            if (!strlen($year)) {
 
  865                $year = $now[
"year"];
 
  867            if (!strlen($month)) {
 
  868                $month = $now[
"mon"];
 
  876        $month = (int) $month;
 
  881        $sel_day .= 
'<select class="form-control" ';
 
  882        if (isset($a_further_options[
'select_attributes'])) {
 
  883            foreach ($a_further_options[
'select_attributes'] as 
$name => $value) {
 
  884                $sel_day .= (
$name . 
'="' . $value . 
'" ');
 
  888        $sel_day .= $disabled . 
"name=\"" . $prefix . 
"[d]\" id=\"" . $prefix . 
"_d\">\n";
 
  891            $sel_day .= 
"<option value=\"0\">--</option>\n";
 
  893        for (
$i = 1; 
$i <= 31; 
$i++) {
 
  894            $sel_day .= 
"<option value=\"$i\">" . sprintf(
"%02d", 
$i) . 
"</option>\n";
 
  896        $sel_day .= 
"</select>\n";
 
  897        $sel_day = preg_replace(
"/(value\=\"$day\")/", 
"$1 selected=\"selected\"", $sel_day);
 
  900        $sel_month = 
'<select class="form-control" ';
 
  901        if (isset($a_further_options[
'select_attributes'])) {
 
  902            foreach ($a_further_options[
'select_attributes'] as 
$name => $value) {
 
  903                $sel_month .= (
$name . 
'="' . $value . 
'" ');
 
  906        $sel_month .= $disabled . 
"name=\"" . $prefix . 
"[m]\" id=\"" . $prefix . 
"_m\">\n";
 
  909            $sel_month .= 
"<option value=\"0\">--</option>\n";
 
  911        for (
$i = 1; 
$i <= 12; 
$i++) {
 
  913                $sel_month .= 
"<option value=\"$i\">" . 
$lng->txt(
"month_" . sprintf(
"%02d", 
$i) . 
"_long") . 
"</option>\n";
 
  915                $sel_month .= 
"<option value=\"$i\">" . 
$i . 
"</option>\n";
 
  918        $sel_month .= 
"</select>\n";
 
  919        $sel_month = preg_replace(
"/(value\=\"$month\")/", 
"$1 selected=\"selected\"", $sel_month);
 
  922        $sel_year = 
'<select class="form-control" ';
 
  923        if (isset($a_further_options[
'select_attributes'])) {
 
  924            foreach ($a_further_options[
'select_attributes'] as 
$name => $value) {
 
  925                $sel_year .= (
$name . 
'="' . $value . 
'" ');
 
  928        $sel_year .= $disabled . 
"name=\"" . $prefix . 
"[y]\" id=\"" . $prefix . 
"_y\">\n";
 
  929        if ((strlen($startyear) == 0) || ($startyear > $year)) {
 
  930            if (!$emptyoption || $year != 0) {
 
  931                $startyear = $year - 5;
 
  935        if (($year + 5) < (date(
'Y', time()) + 5)) {
 
  936            $end_year = date(
'Y', time()) + 5;
 
  938            $end_year = $year + 5;
 
  942            $sel_year .= 
"<option value=\"0\">----</option>\n";
 
  944        for (
$i = $startyear; 
$i <= $end_year; 
$i++) {
 
  945            $sel_year .= 
"<option value=\"$i\">" . sprintf(
"%04d", 
$i) . 
"</option>\n";
 
  947        $sel_year .= 
"</select>\n";
 
  948        $sel_year = preg_replace(
"/(value\=\"$year\")/", 
"$1 selected=\"selected\"", $sel_year);
 
  951        $dateformat = 
"d-m-Y";
 
  952        $dateformat = strtolower(preg_replace(
"/\W/", 
"", $dateformat));
 
  953        $dateformat = strtolower(preg_replace(
"/(\w)/", 
"%%$1", $dateformat));
 
  954        $dateformat = preg_replace(
"/%%d/", $sel_day, $dateformat);
 
  955        $dateformat = preg_replace(
"/%%m/", $sel_month, $dateformat);
 
  956        $dateformat = preg_replace(
"/%%y/", $sel_year, $dateformat);
 
  978    public static function makeTimeSelect($prefix, $short = 
true, $hour = 
"", $minute = 
"", $second = 
"", $a_use_default = 
true, $a_further_options = array())
 
  987        if (count($a_further_options)) {
 
  988            if (isset($a_further_options[
'minute_steps'])) {
 
  989                $minute_steps = $a_further_options[
'minute_steps'];
 
  991            if (isset($a_further_options[
'disabled']) and $a_further_options[
'disabled']) {
 
  992                $disabled = 
'disabled="disabled" ';
 
  996        if ($a_use_default and !strlen(
"$hour$minute$second")) {
 
 1002            $hour = (int) $hour;
 
 1003            $minute = (int) $minute;
 
 1004            $second = (int) $second;
 
 1007        $sel_hour = 
'<select ';
 
 1008        if (isset($a_further_options[
'select_attributes'])) {
 
 1009            foreach ($a_further_options[
'select_attributes'] as 
$name => $value) {
 
 1010                $sel_hour .= 
$name . 
'=' . $value . 
' ';
 
 1013        $sel_hour .= 
" " . $disabled . 
"name=\"" . $prefix . 
"[h]\" id=\"" . $prefix . 
"_h\" class=\"form-control\">\n";
 
 1016        for (
$i = 0; 
$i <= 23; 
$i++) {
 
 1018                $sel_hour .= 
"<option value=\"$i\">" . sprintf(
"%02d", 
$i) . 
"</option>\n";
 
 1020                $sel_hour .= 
"<option value=\"$i\">" . date(
"ga", mktime(
$i, 0, 0)) . 
"</option>\n";
 
 1023        $sel_hour .= 
"</select>\n";
 
 1024        $sel_hour = preg_replace(
"/(value\=\"$hour\")/", 
"$1 selected=\"selected\"", $sel_hour);
 
 1027        $sel_minute .= 
"<select " . $disabled . 
"name=\"" . $prefix . 
"[m]\" id=\"" . $prefix . 
"_m\" class=\"form-control\">\n";
 
 1029        for (
$i = 0; 
$i <= 59; 
$i = 
$i + $minute_steps) {
 
 1030            $sel_minute .= 
"<option value=\"$i\">" . sprintf(
"%02d", 
$i) . 
"</option>\n";
 
 1032        $sel_minute .= 
"</select>\n";
 
 1033        $sel_minute = preg_replace(
"/(value\=\"$minute\")/", 
"$1 selected=\"selected\"", $sel_minute);
 
 1037            $sel_second .= 
"<select " . $disabled . 
"name=\"" . $prefix . 
"[s]\" id=\"" . $prefix . 
"_s\" class=\"form-control\">\n";
 
 1039            for (
$i = 0; 
$i <= 59; 
$i++) {
 
 1040                $sel_second .= 
"<option value=\"$i\">" . sprintf(
"%02d", 
$i) . 
"</option>\n";
 
 1042            $sel_second .= 
"</select>\n";
 
 1043            $sel_second = preg_replace(
"/(value\=\"$second\")/", 
"$1 selected=\"selected\"", $sel_second);
 
 1045        $timeformat = 
$lng->text[
"lang_timeformat"];
 
 1046        if (strlen($timeformat) == 0) {
 
 1047            $timeformat = 
"H:i:s";
 
 1049        $timeformat = strtolower(preg_replace(
"/\W/", 
"", $timeformat));
 
 1050        $timeformat = preg_replace(
"/(\w)/", 
"%%$1", $timeformat);
 
 1051        $timeformat = preg_replace(
"/%%h/", $sel_hour, $timeformat);
 
 1052        $timeformat = preg_replace(
"/%%i/", $sel_minute, $timeformat);
 
 1054            $timeformat = preg_replace(
"/%%s/", 
"", $timeformat);
 
 1056            $timeformat = preg_replace(
"/%%s/", $sel_second, $timeformat);
 
 1076        if (
null === $a_email || !is_string($a_email)) {
 
 1080        if ($mailAddressParserFactory === 
null) {
 
 1085            $parser = $mailAddressParserFactory->getParser((
string) $a_email);
 
 1086            $addresses = 
$parser->parse();
 
 1101    public static function isPassword($a_passwd, &$customError = 
null)
 
 1107        include_once(
'./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
 
 1111        if (empty($a_passwd)) {
 
 1112            $customError = 
$lng->txt(
'password_empty');
 
 1120        if ($security->getPasswordMinLength() > 0 && strlen($a_passwd) < $security->getPasswordMinLength()) {
 
 1121            $errors[] = sprintf(
$lng->txt(
'password_to_short'), $security->getPasswordMinLength());
 
 1122            $isPassword = 
false;
 
 1127        if ($security->getPasswordMaxLength() > 0 && strlen($a_passwd) > $security->getPasswordMaxLength()) {
 
 1128            $errors[] = sprintf(
$lng->txt(
'password_to_long'), $security->getPasswordMaxLength());
 
 1129            $isPassword = 
false;
 
 1133        if ($security->isPasswordCharsAndNumbersEnabled()) {
 
 1134            $hasCharsAndNumbers = 
true;
 
 1137            if (!preg_match(
'/[A-Za-z]+/', $a_passwd)) {
 
 1138                $hasCharsAndNumbers = 
false;
 
 1142            if (!preg_match(
'/[0-9]+/', $a_passwd)) {
 
 1143                $hasCharsAndNumbers = 
false;
 
 1146            if (!$hasCharsAndNumbers) {
 
 1147                $errors[] = 
$lng->txt(
'password_must_chars_and_numbers');
 
 1148                $isPassword = 
false;
 
 1152        require_once 
'Services/Utilities/classes/class.ilStr.php';
 
 1153        if ($security->getPasswordNumberOfUppercaseChars() > 0) {
 
 1154            if (
ilStr::strLen($a_passwd) - 
ilStr::strLen(preg_replace(
'/[A-Z]/', 
'', $a_passwd)) < $security->getPasswordNumberOfUppercaseChars()) {
 
 1155                $errors[] = sprintf(
$lng->txt(
'password_must_contain_ucase_chars'), $security->getPasswordNumberOfUppercaseChars());
 
 1156                $isPassword = 
false;
 
 1160        if ($security->getPasswordNumberOfLowercaseChars() > 0) {
 
 1161            if (
ilStr::strLen($a_passwd) - 
ilStr::strLen(preg_replace(
'/[a-z]/', 
'', $a_passwd)) < $security->getPasswordNumberOfLowercaseChars()) {
 
 1162                $errors[] = sprintf(
$lng->txt(
'password_must_contain_lcase_chars'), $security->getPasswordNumberOfLowercaseChars());
 
 1163                $isPassword = 
false;
 
 1168        if ($security->isPasswordSpecialCharsEnabled()) {
 
 1170            if (!preg_match(self::getPasswordValidChars(
true, 
true), $a_passwd)) {
 
 1171                $errors[] = 
$lng->txt(
'password_must_special_chars');
 
 1172                $isPassword = 
false;
 
 1177        if (!preg_match(self::getPasswordValidChars(), $a_passwd)) {
 
 1178            $errors[] = 
$lng->txt(
'password_contains_invalid_chars');
 
 1179            $isPassword = 
false;
 
 1185        } elseif (count(
$errors) > 1) {
 
 1186            $customError = 
$lng->txt(
'password_multiple_errors');
 
 1187            $customError .= 
'<br />' . implode(
'<br />', 
$errors);
 
 1201        include_once 
'Services/PrivacySecurity/classes/class.ilSecuritySettings.php';
 
 1206        if (is_string(
$user)) {
 
 1208        } elseif (is_array(
$user)) {
 
 1211            $userId = 
$user[
'id'];
 
 1214            $userId = 
$user->getId();
 
 1219        if (
$login && (
int) $security->getPasswordMustNotContainLoginnameStatus() &&
 
 1220            strpos(strtolower($clear_text_password), strtolower(
$login)) !== 
false 
 1222            $error_language_variable = 
'password_contains_parts_of_login_err';
 
 1239            if ($a_only_special_chars) {
 
 1240                return '/[_\.\+\?\#\-\*\@!\$\%\~\/\:\;]+/';
 
 1242                return '/^[A-Za-z0-9_\.\+\?\#\-\*\@!\$\%\~\/\:\;]+$/';
 
 1245            return 'A-Z a-z 0-9 _.+?#-*@!$%~/:;';
 
 1262        include_once(
'./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
 
 1265        $infos = array(sprintf(
$lng->txt(
'password_allow_chars'), self::getPasswordValidChars(
false)));
 
 1268        if ($security->getPasswordMinLength() > 0) {
 
 1269            $infos[] = sprintf(
$lng->txt(
'password_to_short'), $security->getPasswordMinLength());
 
 1273        if ($security->getPasswordMaxLength() > 0) {
 
 1274            $infos[] = sprintf(
$lng->txt(
'password_to_long'), $security->getPasswordMaxLength());
 
 1278        if ($security->isPasswordCharsAndNumbersEnabled()) {
 
 1279            $infos[] = 
$lng->txt(
'password_must_chars_and_numbers');
 
 1283        if ($security->isPasswordSpecialCharsEnabled()) {
 
 1284            $infos[] = 
$lng->txt(
'password_must_special_chars');
 
 1287        if ($security->getPasswordNumberOfUppercaseChars() > 0) {
 
 1288            $infos[] = sprintf(
$lng->txt(
'password_must_contain_ucase_chars'), $security->getPasswordNumberOfUppercaseChars());
 
 1291        if ($security->getPasswordNumberOfLowercaseChars() > 0) {
 
 1292            $infos[] = sprintf(
$lng->txt(
'password_must_contain_lcase_chars'), $security->getPasswordNumberOfLowercaseChars());
 
 1295        return implode(
'<br />', $infos);
 
 1306        if (empty($a_login)) {
 
 1310        if (strlen($a_login) < 3) {
 
 1317        if (!preg_match(
"/^[A-Za-z0-9_\.\+\*\@!\$\%\~\-]+$/", $a_login)) {
 
 1341        $a_next_blank = 
false,
 
 1342        $a_keep_extension = 
false 
 1344        include_once(
"./Services/Utilities/classes/class.ilStr.php");
 
 1346            if ($a_next_blank) {
 
 1356            if ($a_keep_extension) {
 
 1357                $p = strrpos($a_str, 
'.');      
 
 1359            if ($p === 
false || $p == 0 || strlen($a_str) - $p > $a_len) {
 
 1362                    $a_str .= 
"\xe2\x80\xa6"; 
 
 1366                    $a_str = 
ilStr::subStr($a_str, 0, $len - (strlen($a_str) - $p + 1)) . 
"\xe2\x80\xa6" . substr($a_str, $p);
 
 1368                    $a_str = 
ilStr::subStr($a_str, 0, $len - (strlen($a_str) - $p + 1)) . substr($a_str, $p);
 
 1391        include_once(
"./Services/Utilities/classes/class.ilStr.php");
 
 1392        $str_arr = explode(
" ", $a_str);
 
 1394        for (
$i = 0; 
$i < count($str_arr); 
$i++) {
 
 1398                    $str_arr[
$i] .= 
"...";
 
 1402        return implode(
' ', $str_arr);
 
 1417        while (is_int(strpos($a_str, 
"="))) {
 
 1418            $eq_pos = strpos($a_str, 
"=");
 
 1419            $qu1_pos = strpos($a_str, 
"\"");
 
 1420            $qu2_pos = strpos(substr($a_str, $qu1_pos + 1), 
"\"") + $qu1_pos + 1;
 
 1421            if (is_int($eq_pos) && is_int($qu1_pos) && is_int($qu2_pos)) {
 
 1422                $var = trim(substr($a_str, 0, $eq_pos));
 
 1423                $val = trim(substr($a_str, $qu1_pos + 1, ($qu2_pos - $qu1_pos) - 1));
 
 1424                $attribs[$var] = $val;
 
 1425                $a_str = substr($a_str, $qu2_pos + 1);
 
 1451    public static function rCopy($a_sdir, $a_tdir, $preserveTimeAttributes = 
false)
 
 1453        $sourceFS = LegacyPathHelper::deriveFilesystemFrom($a_sdir);
 
 1454        $targetFS = LegacyPathHelper::deriveFilesystemFrom($a_tdir);
 
 1456        $sourceDir = LegacyPathHelper::createRelativePath($a_sdir);
 
 1457        $targetDir = LegacyPathHelper::createRelativePath($a_tdir);
 
 1464        $sourceList = $sourceFS->listContents(
$sourceDir, 
true);
 
 1466        foreach ($sourceList as $item) {
 
 1467            if ($item->isDir()) {
 
 1471                $itemPath = $targetDir . 
'/' . substr($item->getPath(), strlen(
$sourceDir));
 
 1472                $stream = $sourceFS->readStream($item->getPath());
 
 1473                $targetFS->writeStream($itemPath, 
$stream);
 
 1500        if ($mode == 
"filesystem") {
 
 1501            return "./" . ILIAS_WEB_DIR . 
"/" . CLIENT_ID;
 
 1503            if (defined(
"ILIAS_MODULE")) {
 
 1504                return "../" . ILIAS_WEB_DIR . 
"/" . CLIENT_ID;
 
 1506                return "./" . ILIAS_WEB_DIR . 
"/" . CLIENT_ID;
 
 1523        return CLIENT_DATA_DIR;
 
 1537        include_once(
"./Services/User/classes/class.ilObjUser.php");
 
 1538        return ilObjUser::_getUsersOnline($a_user_id);
 
 1551        if ($a_temp_path === 
null) {
 
 1554            $temp_path = $a_temp_path;
 
 1557        if (!is_dir($temp_path)) {
 
 1560        $temp_name = $temp_path . 
"/" . uniqid(
"tmp");
 
 1594    public static function unzip($a_file, $overwrite = 
false, $a_flat = 
false)
 
 1600        if (!is_file($a_file)) {
 
 1608            copy($a_file, $tmpdir . DIRECTORY_SEPARATOR . basename($a_file));
 
 1609            $orig_file = $a_file;
 
 1610            $a_file = $tmpdir . DIRECTORY_SEPARATOR . basename($a_file);
 
 1611            $origpathinfo = pathinfo($orig_file);
 
 1614        $pathinfo = pathinfo($a_file);
 
 1615        $dir = $pathinfo[
"dirname"];
 
 1616        $file = $pathinfo[
"basename"];
 
 1621        $unzip = PATH_TO_UNZIP;
 
 1672        $dir_realpath = realpath($dir);
 
 1673        foreach (
new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($dir)) as 
$name => 
$f) {
 
 1674            if (is_link(
$name)) {
 
 1676                if (substr(
$target, 0, strlen($dir_realpath)) != $dir_realpath) {
 
 1685            include_once(
"./Services/Utilities/classes/class.ilFileUtils.php");
 
 1686            $filearray = array();
 
 1688            if (is_array($filearray[
"file"])) {
 
 1689                foreach ($filearray[
"file"] as $k => 
$f) {
 
 1690                    if (substr(
$f, 0, 1) != 
"." && 
$f != basename($orig_file)) {
 
 1691                        copy($filearray[
"path"][$k] . 
$f, $origpathinfo[
"dirname"] . DIRECTORY_SEPARATOR . 
$f);
 
 1705    public static function zip($a_dir, $a_file, $compress_content = 
false)
 
 1709        if ($compress_content) {
 
 1711            $pathinfo = pathinfo($a_dir);
 
 1712            chdir($pathinfo[
"dirname"]);
 
 1715        $pathinfo = pathinfo($a_file);
 
 1716        $dir = $pathinfo[
"dirname"];
 
 1717        $file = $pathinfo[
"basename"];
 
 1719        if (!$compress_content) {
 
 1730        if (is_array($a_dir)) {
 
 1732            foreach ($a_dir as $dir) {
 
 1733                $name = basename($dir);
 
 1737            $name = basename($a_dir);
 
 1738            if (trim(
$name) != 
"*") {
 
 1755        $pathinfo = pathinfo($a_dir);
 
 1756        chdir($pathinfo[
"dirname"]);
 
 1758        $pathinfo = pathinfo($a_file);
 
 1759        $dir = $pathinfo[
"dirname"];
 
 1760        $file = $pathinfo[
"basename"];
 
 1763        $mkisofs = PATH_TO_MKISOFS;
 
 1769        $name = basename($a_dir);
 
 1772        $zipcmd = 
"-r -J -o " . $a_file . 
" " . 
$source;
 
 1788        return PATH_TO_CONVERT;
 
 1815        if ($current_version >= 
$version) {
 
 1829        if (preg_match(
"/([0-9]+)\.([0-9]+)\.([0-9]+)([\.|\-]([0-9]+))?/", $a_version, $match)) {
 
 1830            $version = str_pad($match[1], 2, 0, STR_PAD_LEFT) .
 
 1831                str_pad($match[2], 2, 0, STR_PAD_LEFT) .
 
 1832                str_pad($match[3], 2, 0, STR_PAD_LEFT) .
 
 1833                str_pad($match[5], 2, 0, STR_PAD_LEFT);
 
 1850        $a_target_format = 
"",
 
 1852        $a_background_color = 
"" 
 1854        $format_str = ($a_target_format != 
"")
 
 1855            ? strtoupper($a_target_format) . 
":" 
 1858        if ($a_geometry != 
"") {
 
 1859            if (is_int(strpos($a_geometry, 
"x"))) {
 
 1860                $geometry = 
" -geometry " . $a_geometry . 
" ";
 
 1862                $geometry = 
" -geometry " . $a_geometry . 
"x" . $a_geometry . 
" ";
 
 1866        $bg_color = ($a_background_color != 
"")
 
 1867            ? 
" -background color " . $a_background_color . 
" " 
 1884    public static function resizeImage($a_from, $a_to, $a_width, $a_height, $a_constrain_prop = 
false)
 
 1886        if ($a_constrain_prop) {
 
 1887            $size = 
" -geometry " . $a_width . 
"x" . $a_height . 
" ";
 
 1889            $size = 
" -resize " . $a_width . 
"x" . $a_height . 
"! ";
 
 1902    public static function img($a_src, $a_alt = 
null, $a_width = 
"", $a_height = 
"", $a_border = 0, $a_id = 
"", $a_class = 
"")
 
 1904        $img = 
'<img src="' . $a_src . 
'"';
 
 1905        if (!is_null($a_alt)) {
 
 1906            $img .= 
' alt="' . htmlspecialchars($a_alt) . 
'"';
 
 1908        if ($a_width != 
"") {
 
 1909            $img .= 
' width="' . htmlspecialchars($a_width) . 
'"';
 
 1911        if ($a_height != 
"") {
 
 1912            $img .= 
' height="' . htmlspecialchars($a_height) . 
'"';
 
 1914        if ($a_class != 
"") {
 
 1915            $img .= 
' class="' . $a_class . 
'"';
 
 1918            $img .= 
' id="' . $a_id . 
'"';
 
 1931    public static function deliverData($a_data, $a_filename, $mime = 
"application/octet-stream", $charset = 
"")
 
 1933        $disposition = 
"attachment"; 
 
 1936        include_once 
'./Services/Http/classes/class.ilHTTPS.php';
 
 1945            #header("Pragma: ");
 
 1946            #header("Cache-Control: ");
 
 1947            #header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
 
 1948            #header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
 
 1949            #header("Cache-Control: no-store, no-cache, must-revalidate"); 
 
 1950            #header("Cache-Control: post-check=0, pre-check=0", false);
 
 1951        } elseif ($disposition == 
"attachment") {
 
 1952            header(
"Cache-control: private");
 
 1954            header(
"Cache-Control: no-cache, must-revalidate");
 
 1955            header(
"Pragma: no-cache");
 
 1960        if (strlen($charset)) {
 
 1961            $charset = 
"; charset=$charset";
 
 1963        header(
"Content-Type: $mime$charset");
 
 1964        header(
"Content-Disposition:$disposition; filename=\"" . 
$ascii_filename . 
"\"");
 
 1966        header(
"Content-Length: " . (
string) (strlen($a_data)));
 
 1970            header(
'Cache-Control: must-revalidate, post-check=0, pre-check=0');
 
 1971            header(
'Pragma: public');
 
 1974        header(
"Connection: close");
 
 1992        $removeAfterDelivery = 
false,
 
 1993        $a_exit_after = 
true 
 1997        if (!file_exists($a_file)) {
 
 2008        if (strlen($a_mime)) {
 
 2009            $delivery->setMimeType($a_mime);
 
 2012        $delivery->setDownloadFileName($a_filename);
 
 2013        $delivery->setConvertFileNameToAsci((
bool) !
$DIC->clientIni()->readVariable(
'file_access', 
'disable_ascii'));
 
 2014        $delivery->setDeleteFile($removeAfterDelivery);
 
 2015        $delivery->deliver();
 
 2030        $chunksize = 1 * (1024 * 1024); 
 
 2032        $handle = fopen($a_file, 
'rb');
 
 2033        if ($handle === 
false) {
 
 2036        while (!feof($handle)) {
 
 2037            $buffer = fread($handle, $chunksize);
 
 2040        return fclose($handle);
 
 2071        $umlauts = array(
"Ä" => 
"Ae", 
"Ö" => 
"Oe", 
"Ü" => 
"Ue",
 
 2072            "ä" => 
"ae", 
"ö" => 
"oe", 
"ü" => 
"ue", 
"ß" => 
"ss");
 
 2073        foreach ($umlauts as $src => $tgt) {
 
 2074            $a_filename = str_replace($src, $tgt, $a_filename);
 
 2095        $sep = 
'###HTMLTAG###';
 
 2097        preg_match_all(
"@<[^>]*>@", $htmlText, $matches);
 
 2098        $tmp = preg_replace(
"@(<[^>]*>)@", $sep, $htmlText);
 
 2099        $tmp = explode($sep, $tmp);
 
 2101        for (
$i = 0; 
$i < count($tmp); 
$i++) {
 
 2102            $tmp[
$i] = htmlentities($tmp[
$i], ENT_COMPAT, 
"UTF-8");
 
 2105        $tmp = join($sep, $tmp);
 
 2107        for (
$i = 0; 
$i < count($matches[0]); 
$i++) {
 
 2108            $tmp = preg_replace(
"@$sep@", $matches[0][
$i], $tmp, 1);
 
 2122        return PATH_TO_JAVA;
 
 2141        $url = (is_int(strpos($a_url, 
"?")))
 
 2142            ? $a_url . $amp . $a_par
 
 2143            : $a_url . 
"?" . $a_par;
 
 2168        $a_dir = trim($a_dir);
 
 2171        if (substr($a_dir, -1) == 
"/") {
 
 2172            $a_dir = substr($a_dir, 0, -1);
 
 2176        if (!(
$path = substr($a_dir, 0, strrpos($a_dir, 
"/") - strlen($a_dir)))) {
 
 2182        return @mkdir($a_dir, fileperms(
$path));
 
 2207        $dirs = array($a_dir);
 
 2208        $a_dir = dirname($a_dir);
 
 2211        while ($last_dirname != $a_dir) {
 
 2212            array_unshift($dirs, $a_dir);
 
 2213            $last_dirname = $a_dir;
 
 2214            $a_dir = dirname($a_dir);
 
 2218        $reverse_paths = array_reverse($dirs, 
true);
 
 2220        foreach ($reverse_paths as 
$key => $value) {
 
 2221            if ($found_index == -1) {
 
 2222                if (is_dir($value)) {
 
 2223                    $found_index = 
$key;
 
 2229        foreach ($dirs as $dirindex => $dir) {
 
 2231            if ($dirindex >= $found_index) {
 
 2232                if (!file_exists($dir)) {
 
 2233                    if (strcmp(substr($dir, strlen($dir) - 1, 1), 
"/") == 0) {
 
 2236                        $dir = substr($dir, 0, strlen($dir) - 1);
 
 2238                    if (!mkdir($dir, $umask)) {
 
 2239                        error_log(
"Can't make directory: $dir");
 
 2242                } elseif (!is_dir($dir)) {
 
 2247                    $umask = fileperms($dir);
 
 2270    public static function delDir($a_dir, $a_clean_only = 
false)
 
 2272        if (!is_dir($a_dir) || is_int(strpos($a_dir, 
".."))) {
 
 2276        $current_dir = opendir($a_dir);
 
 2285        while ($entryname = readdir($current_dir)) {
 
 2289        foreach (
$files as $file) {
 
 2290            if (is_dir($a_dir . 
"/" . $file) and ($file != 
"." and $file != 
"..")) {
 
 2292            } elseif ($file != 
"." and $file != 
"..") {
 
 2293                unlink($a_dir . 
"/" . $file);
 
 2297        closedir($current_dir);
 
 2298        if (!$a_clean_only) {
 
 2319    public static function getDir($a_dir, $a_rec = 
false, $a_sub_dir = 
"")
 
 2321        $current_dir = opendir($a_dir . $a_sub_dir);
 
 2325        $subitems = array();
 
 2326        while ($entry = readdir($current_dir)) {
 
 2327            if (is_dir($a_dir . 
"/" . $entry)) {
 
 2328                $dirs[$entry] = array(
"type" => 
"dir", 
"entry" => $entry,
 
 2329                    "subdir" => $a_sub_dir);
 
 2330                if ($a_rec && $entry != 
"." && $entry != 
"..") {
 
 2332                    $subitems = array_merge($subitems, 
$si);
 
 2335                if ($entry != 
"." && $entry != 
"..") {
 
 2336                    $size = filesize($a_dir . $a_sub_dir . 
"/" . $entry);
 
 2337                    $files[$entry] = array(
"type" => 
"file", 
"entry" => $entry,
 
 2338                    "size" => 
$size, 
"subdir" => $a_sub_dir);
 
 2345        return array_merge($dirs, 
$files, $subitems);
 
 2356        if (is_array($a_arr)) {
 
 2357            foreach ($a_arr as $k => $v) {
 
 2371        $df = new \ILIAS\Data\Factory;
 
 2384        if (is_array($a_data)) {
 
 2385            foreach ($a_data as $k => $v) {
 
 2406    public static function stripSlashes($a_str, $a_strip_html = 
true, $a_allow = 
"")
 
 2408        if (ini_get(
"magic_quotes_gpc")) {
 
 2409            $a_str = stripslashes($a_str);
 
 2425        if (ini_get(
"magic_quotes_gpc")) {
 
 2426            $a_str = stripslashes($a_str);
 
 2438    public static function secureString($a_str, $a_strip_html = 
true, $a_allow = 
"")
 
 2441        $only_secure = 
true;
 
 2442        $allow_tags = explode(
">", $a_allow);
 
 2444        $allow_array = array();
 
 2445        foreach ($allow_tags as $allow) {
 
 2447                $allow = str_replace(
"<", 
"", $allow);
 
 2449                if (!in_array($allow, $sec_tags)) {
 
 2450                    $only_secure = 
false;
 
 2452                $allow_array[] = $allow;
 
 2457        if (($only_secure || $a_allow == 
"") && $a_strip_html) {
 
 2458            if ($a_allow == 
"") {
 
 2459                $allow_array = array(
"b", 
"i", 
"strong", 
"em", 
"code", 
"cite",
 
 2460                    "gap", 
"sub", 
"sup", 
"pre", 
"strike", 
"bdo");
 
 2466            $a_str = strip_tags($a_str);                
 
 2478            if ($a_strip_html) {
 
 2488        return array(
"strong", 
"em", 
"u", 
"strike", 
"ol", 
"li", 
"ul", 
"p", 
"div",
 
 2489            "i", 
"b", 
"code", 
"sup", 
"sub", 
"pre", 
"gap", 
"a", 
"img", 
"bdo");
 
 2494        foreach ($allow_array as 
$t) {
 
 2507                        array(
"param" => 
"align", 
"value" => 
"left"),
 
 2508                        array(
"param" => 
"align", 
"value" => 
"center"),
 
 2509                        array(
"param" => 
"align", 
"value" => 
"justify"),
 
 2510                        array(
"param" => 
"align", 
"value" => 
"right")
 
 2525        foreach ($allow_array as 
$t) {
 
 2538                        array(
"param" => 
"align", 
"value" => 
"left"),
 
 2539                        array(
"param" => 
"align", 
"value" => 
"center"),
 
 2540                        array(
"param" => 
"align", 
"value" => 
"justify"),
 
 2541                        array(
"param" => 
"align", 
"value" => 
"right")
 
 2563        if (ini_get(
"magic_quotes_gpc")) {
 
 2564            return stripslashes($a_str);
 
 2589        if ($a_make_links_clickable) {
 
 2606            $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);
 
 2610            foreach ($matches[0] as $match) {
 
 2611                $matched_text = $match[0];
 
 2615                $encoded .= nl2br(htmlspecialchars(substr($a_str, $pos1, $pos2 - $pos1)));
 
 2621                $pos1 = $pos2 + strlen($matched_text);
 
 2623            if ($pos1 < strlen($a_str)) {
 
 2624                $encoded .= nl2br(htmlspecialchars(substr($a_str, $pos1)));
 
 2627            $encoded = nl2br(htmlspecialchars($a_str));
 
 2640        $att = $ws . 
"[^>]*" . $ws;
 
 2643            '/<(' . 
$tag . $att . 
'(' . $tag_att . $ws . 
'="' . $ws . 
'(([$@!*()~;,_0-9A-z\/:=%.&#?+\-])*)")' . $att . 
')>/i',
 
 2648            $a_str = preg_replace(
 
 2649                "/<" . preg_quote($found[1], 
"/") . 
">/i",
 
 2650                '<' . 
$tag . 
' ' . $tag_att . $tag_att . 
'="' . $found[3] . 
'">',
 
 2653            if ($old_str == $a_str) {
 
 2654                $ilLog->write(
"ilUtil::maskA-" . htmlentities($old_str) . 
" == " .
 
 2655                    htmlentities($a_str));
 
 2659        $a_str = str_ireplace(
 
 2674            '/<(' . 
$tag . 
' ' . $tag_att . $tag_att . 
'="(([$@!*()~;,_0-9A-z\/:=%.&#?+\-])*)")>/i',
 
 2679            $a_str = preg_replace(
 
 2680                "/<" . preg_quote($found[1], 
"/") . 
">/i",
 
 2684            if ($old_str == $a_str) {
 
 2685                $ilLog->write(
"ilUtil::unmaskA-" . htmlentities($old_str) . 
" == " .
 
 2686                    htmlentities($a_str));
 
 2690        $a_str = str_replace(
'</' . 
$tag . 
'>', 
'</' . 
$tag . 
'>', $a_str);
 
 2696        $a_str = str_replace(
 
 2697            array(
"<$t>", 
"<" . strtoupper(
$t) . 
">"),
 
 2698            "<" . 
$t . 
">",
 
 2701        $a_str = str_replace(
 
 2702            array(
"</$t>", 
"</" . strtoupper(
$t) . 
">"),
 
 2703            "</" . 
$t . 
">",
 
 2707        if (is_array($fix_param)) {
 
 2708            foreach ($fix_param  as $p) {
 
 2711                $a_str = str_replace(
 
 2713                    "<" . 
"$t $k=\"$v\"" . 
">",
 
 2724        $a_str = str_replace(
"<" . 
$t . 
">", 
"<" . 
$t . 
">", $a_str);
 
 2725        $a_str = str_replace(
"</" . 
$t . 
">", 
"</" . 
$t . 
">", $a_str);
 
 2727        if (is_array($fix_param)) {
 
 2728            foreach ($fix_param  as $p) {
 
 2731                $a_str = str_replace(
 
 2732                    "<$t $k=\"$v\">",
 
 2733                    "<" . 
"$t $k=\"$v\"" . 
">",
 
 2743        $a_str = str_ireplace(
"javascript", 
"jvscrpt", $a_str);
 
 2744        $a_str = str_ireplace(array(
"%00", 
"%0a", 
"%0d", 
"%1a", 
"�", 
"�",
 
 2745            "�", 
"�", 
"
", 
"
", 
"
", 
"
"), 
"-", $a_str);
 
 2766        $negativestr = 
"a,abbr,acronym,address,applet,area,base,basefont," .
 
 2767            "big,blockquote,body,br,button,caption,center,cite,code,col," .
 
 2768            "colgroup,dd,del,dfn,dir,div,dl,dt,em,fieldset,font,form,frame," .
 
 2769            "frameset,h1,h2,h3,h4,h5,h6,head,hr,html,i,iframe,img,input,ins,isindex,kbd," .
 
 2770            "label,legend,li,link,map,menu,meta,noframes,noscript,object,ol," .
 
 2771            "optgroup,option,p,param,q,s,samp,script,select,small,span," .
 
 2772            "strike,strong,style,sub,sup,table,tbody,td,textarea,tfoot,th,thead," .
 
 2773            "title,tr,tt,u,ul,var";
 
 2774        $a_allow = strtolower($a_allow);
 
 2775        $negatives = explode(
",", $negativestr);
 
 2776        $outer_old_str = 
"";
 
 2777        while ($outer_old_str != $a_str) {
 
 2778            $outer_old_str = $a_str;
 
 2779            foreach ($negatives as $item) {
 
 2780                $pos = strpos($a_allow, 
"<$item>");
 
 2783                if ($pos === 
false) {
 
 2785                    while ($old_str != $a_str) {
 
 2787                        $a_str = preg_replace(
"/<\/?\s*$item(\/?)\s*>/i", 
"", $a_str);
 
 2788                        $a_str = preg_replace(
"/<\/?\s*$item(\/?)\s+([^>]*)>/i", 
"", $a_str);
 
 2796            $a_str = preg_replace(
"/<\s*\w*(\/?)(\s+[^>]*)?(\s+on[^>]*)>/i", 
"", $a_str);
 
 2799            $a_str = preg_replace(
"/<\s*\w*(\/?)\s+[^>]*javascript[^>]*>/i", 
"", $a_str);
 
 2803            $a_str = preg_replace(
"/<\s*\w*(\/?)\s+[^>]*expression[^>]*>/i", 
"", $a_str);
 
 2825        $a_str = htmlspecialchars($a_str);
 
 2829        $a_str = str_replace(
"{", 
"{", $a_str);
 
 2830        $a_str = str_replace(
"}", 
"}", $a_str);
 
 2846        if (filter_var(
$url, FILTER_VALIDATE_URL) === 
false &&
 
 2847            filter_var(
"http://" . 
$url, FILTER_VALIDATE_URL) === 
false &&
 
 2848            filter_var(
"http:" . 
$url, FILTER_VALIDATE_URL) === 
false &&
 
 2849            filter_var(
"http://de.de" . 
$url, FILTER_VALIDATE_URL) === 
false &&
 
 2850            filter_var(
"http://de.de/" . 
$url, FILTER_VALIDATE_URL) === 
false) {
 
 2853        if (trim(strtolower(parse_url(
$url, PHP_URL_SCHEME))) == 
"javascript") {
 
 2856        $url = htmlspecialchars(
$url, ENT_QUOTES);
 
 2873        return addslashes($a_str);
 
 2905        while (($spos = strpos($a_parstr, 
"=")) && 
$ok) {
 
 2907            $cpar = substr($a_parstr, 0, $spos);
 
 2908            $a_parstr = substr($a_parstr, $spos, strlen($a_parstr) - $spos);
 
 2909            while (substr($cpar, 0, 1) == 
"," || substr($cpar, 0, 1) == 
" " || substr($cpar, 0, 1) == chr(13) || substr($cpar, 0, 1) == chr(10)) {
 
 2910                $cpar = substr($cpar, 1, strlen($cpar) - 1);
 
 2912            while (substr($cpar, strlen($cpar) - 1, 1) == 
" " || substr($cpar, strlen($cpar) - 1, 1) == chr(13) || substr($cpar, strlen($cpar) - 1, 1) == chr(10)) {
 
 2913                $cpar = substr($cpar, 0, strlen($cpar) - 1);
 
 2918            while ($cpar != $cpar_old) {
 
 2920                $cpar = preg_replace(
"/[^a-zA-Z0-9_]/i", 
"", $cpar);
 
 2925                if ($spos = strpos($a_parstr, 
"\"")) {
 
 2926                    $a_parstr = substr($a_parstr, $spos + 1, strlen($a_parstr) - $spos);
 
 2927                    $spos = strpos($a_parstr, 
"\"");
 
 2928                    if (is_int($spos)) {
 
 2929                        $cval = substr($a_parstr, 0, $spos);
 
 2930                        $par[$cpar] = $cval;
 
 2931                        $a_parstr = substr($a_parstr, $spos + 1, strlen($a_parstr) - $spos - 1);
 
 2950        if (is_array($a_par_arr)) {
 
 2952            foreach ($a_par_arr as $par => $val) {
 
 2969        $ret = $a_str . 
": ";
 
 2970        for (
$i = 0; 
$i < strlen($a_str); 
$i++) {
 
 2971            $ret .= ord(substr($a_str, 
$i, 1)) . 
" ";
 
 2985        if (strtolower($a_yn) == 
"y") {
 
 3019        global $array_sortby,$array_sortorder;
 
 3021        if (!isset($array_sortby)) {
 
 3028        if ($array_sortorder == 
"asc") {
 
 3032        if ($array_sortorder == 
"desc") {
 
 3033            return !
ilStr::strCmp($a[$array_sortby], $b[$array_sortby]);
 
 3050        global $array_sortby,$array_sortorder;
 
 3052        if ($array_sortorder == 
"asc") {
 
 3053            return $a[
"$array_sortby"] > $b[
"$array_sortby"];
 
 3056        if ($array_sortorder == 
"desc") {
 
 3057            return $a[
"$array_sortby"] < $b[
"$array_sortby"];
 
 3075        $a_array_sortorder = 0,
 
 3077        $a_keep_keys = 
false 
 3079        include_once(
"./Services/Utilities/classes/class.ilStr.php");
 
 3082        if (!$a_keep_keys) {
 
 3083            return self::stableSortArray($array, $a_array_sortby, $a_array_sortorder, $a_numeric, $a_keep_keys);
 
 3087        global $array_sortby,$array_sortorder;
 
 3088        $array_sortby = $a_array_sortby;
 
 3090        if ($a_array_sortorder == 
"desc") {
 
 3091            $array_sortorder = 
"desc";
 
 3093            $array_sortorder = 
"asc";
 
 3097                uasort($array, array(
"ilUtil", 
"sort_func_numeric"));
 
 3099                usort($array, array(
"ilUtil", 
"sort_func_numeric"));
 
 3103                uasort($array, array(
"ilUtil", 
"sort_func"));
 
 3105                usort($array, array(
"ilUtil", 
"sort_func"));
 
 3127    public static function stableSortArray($array, $a_array_sortby, $a_array_sortorder = 0, $a_numeric = 
false)
 
 3129        global $array_sortby,$array_sortorder;
 
 3131        $array_sortby = $a_array_sortby;
 
 3133        if ($a_array_sortorder == 
"desc") {
 
 3134            $array_sortorder = 
"desc";
 
 3136            $array_sortorder = 
"asc";
 
 3140        $sort_array = array_values($array);
 
 3150    public static function mergesort(&$array, $cmp_function = 
'strcmp')
 
 3153        if (count($array) < 2) {
 
 3158        $halfway = count($array) / 2;
 
 3159        $array1 = array_slice($array, 0, $halfway);
 
 3160        $array2 = array_slice($array, $halfway);
 
 3167        if (call_user_func($cmp_function, end($array1), $array2[0]) < 1) {
 
 3168            $array = array_merge($array1, $array2);
 
 3175        while ($ptr1 < count($array1) && $ptr2 < count($array2)) {
 
 3176            if (call_user_func($cmp_function, $array1[$ptr1], $array2[$ptr2]) < 1) {
 
 3177                $array[] = $array1[$ptr1++];
 
 3179                $array[] = $array2[$ptr2++];
 
 3184        while ($ptr1 < count($array1)) {
 
 3185            $array[] = $array1[$ptr1++];
 
 3187        while ($ptr2 < count($array2)) {
 
 3188            $array[] = $array2[$ptr2++];
 
 3209        $existing_sub_key_values = array();
 
 3211        foreach ($array as 
$key => $sub_array) {
 
 3212            if (!in_array($sub_array[$sub_key], $existing_sub_key_values)) {
 
 3213                $existing_sub_key_values[] = $sub_array[$sub_key];
 
 3233        $a_desired_type = strtolower($a_desired_type);
 
 3235        $im_types = ImageTypes();
 
 3237        switch ($a_desired_type) {
 
 3240            if ($im_types & IMG_JPG) {
 
 3243            if ($im_types & IMG_GIF) {
 
 3246            if ($im_types & IMG_PNG) {
 
 3252            if ($im_types & IMG_GIF) {
 
 3255            if ($im_types & IMG_JPG) {
 
 3258            if ($im_types & IMG_PNG) {
 
 3264            if ($im_types & IMG_PNG) {
 
 3267            if ($im_types & IMG_JPG) {
 
 3270            if ($im_types & IMG_GIF) {
 
 3276            if ($im_types & IMG_PNG) {
 
 3279            if ($im_types & IMG_JPG) {
 
 3282            if ($im_types & IMG_GIF) {
 
 3302        if (($a_mime == 
"image/gif") || ($a_mime == 
"image/jpeg") ||
 
 3303        ($a_mime == 
"image/png") || ($a_mime == 
"application/x-shockwave-flash") ||
 
 3304        ($a_mime == 
"image/tiff") || ($a_mime == 
"image/x-ms-bmp") ||
 
 3305        ($a_mime == 
"image/psd") || ($a_mime == 
"image/iff")) {
 
 3322        if (!isset(
$DIC[
'ilCtrl']) || !
$DIC[
'ilCtrl'] instanceof 
ilCtrl) {
 
 3325            $ctrl = 
$DIC->ctrl();
 
 3327        $ctrl->redirectToURL($a_script);
 
 3340        if (substr($a_value, 0, 4) == 
"il__") {
 
 3341            $a_value = 
"il_" . IL_INST_ID . 
"_" . substr($a_value, 4, strlen($a_value) - 4);
 
 3364        if (isset(
$DIC[
"ilErr"])) {
 
 3368        if (empty($a_group_name)) {
 
 3369            $message = __METHOD__ . 
": No groupname given!";
 
 3373        $clause = ($a_id) ? 
" AND obj_id != " . 
$ilDB->quote($a_id) . 
" " : 
"";
 
 3375        $q = 
"SELECT obj_id FROM object_data " .
 
 3376        "WHERE title = " . 
$ilDB->quote($a_group_name, 
"text") . 
" " .
 
 3377        "AND type = " . 
$ilDB->quote(
"grp", 
"text") .
 
 3382        if (
$r->numRows()) {
 
 3397        $my_pid = getmypid();
 
 3398        return (
"MEMORY USAGE (% KB PID ): " . `ps -eo%mem,rss,pid | grep $my_pid`);
 
 3409        if (strtolower(substr(php_uname(), 0, 3)) == 
"win") {
 
 3418        setlocale(LC_CTYPE, 
"UTF8", 
"en_US.UTF-8"); 
 
 3420        return escapeshellarg($a_arg);
 
 3434        if (ini_get(
'safe_mode') == 1) {
 
 3437        setlocale(LC_CTYPE, 
"UTF8", 
"en_US.UTF-8"); 
 
 3438        return escapeshellcmd($a_arg);
 
 3454        if (
ilUtil::isWindows() && strpos($cmd, 
" ") !== 
false && substr($cmd, 0, 1) !== 
'"') {
 
 3456            $cmd = 
'"' . $cmd . 
'"';
 
 3460                if (version_compare(phpversion(), 
"5.2", 
"<") && strpos($args, 
'"') !== 
false) {
 
 3461                    $cmd = 
'"' . $cmd . 
" " . $args . 
'"';
 
 3465                    $cmd .= 
" " . $args;
 
 3471            $cmd .= 
" " . $args;
 
 3475        $DIC->logger()->root()->debug(
"ilUtil::execQuoted: " . $cmd . 
".");
 
 3502    public static function excelTime($year = 
"", $month = 
"", $day = 
"", $hour = 
"", $minute = 
"", $second = 
"")
 
 3504        $starting_time = mktime(0, 0, 0, 1, 2, 1970);
 
 3505        if (strcmp(
"$year$month$day$hour$minute$second", 
"") == 0) {
 
 3506            $target_time = time();
 
 3512        $target_time = mktime($hour, $minute, $second, $month, $day, $year);
 
 3513        $difference = $target_time - $starting_time;
 
 3514        $days = (($difference - ($difference % 86400)) / 86400);
 
 3515        $difference = $difference - ($days * 86400) + 3600;
 
 3518        return str_replace(
",", 
".", ($days + 25570 + ($difference / 86400)));
 
 3529        $def_arr = explode(
",", SUFFIX_REPL_DEFAULT);
 
 3530        foreach ($def_arr as 
$def) {
 
 3534        $def_arr = explode(
",", SUFFIX_REPL_ADDITIONAL);
 
 3535        foreach ($def_arr as 
$def) {
 
 3546        $file_peaces = explode(
'.', $a_initial_filename);
 
 3548        $file_extension = array_pop($file_peaces);
 
 3550        if (SUFFIX_REPL_ADDITIONAL) {
 
 3551            $string_extensions = SUFFIX_REPL_DEFAULT . 
"," . SUFFIX_REPL_ADDITIONAL;
 
 3553            $string_extensions = SUFFIX_REPL_DEFAULT;
 
 3556        $sufixes = explode(
",", $string_extensions);
 
 3558        if (in_array($file_extension, $sufixes)) {
 
 3559            $file_extension = 
"sec";
 
 3562        array_push($file_peaces, $file_extension);
 
 3564        $safe_filename = 
"";
 
 3565        foreach ($file_peaces as $piece) {
 
 3566            $safe_filename .= 
"$piece";
 
 3567            if ($piece != end($file_peaces)) {
 
 3568                $safe_filename .= 
".";
 
 3572        return $safe_filename;
 
 3589        if ($a_dir == 
"/" || $a_dir == 
"" || is_int(strpos($a_dir, 
".."))
 
 3590            || trim($a_old_suffix) == 
"") {
 
 3595        if (!@is_dir($a_dir)) {
 
 3600        $dir = opendir($a_dir);
 
 3602        while ($file = readdir($dir)) {
 
 3603            if ($file != 
"." and
 
 3606                if (@is_dir($a_dir . 
"/" . $file)) {
 
 3611                if (@is_file($a_dir . 
"/" . $file)) {
 
 3613                    if (strrpos($file, 
'.') == (strlen($file) - 1)) {
 
 3614                        rename($a_dir . 
'/' . $file, substr($a_dir . 
'/' . $file, 0, -1));
 
 3615                        $file = substr($file, 0, -1);
 
 3618                    $path_info = pathinfo($a_dir . 
"/" . $file);
 
 3620                    if (strtolower($path_info[
"extension"]) ==
 
 3621                    strtolower($a_old_suffix)) {
 
 3622                        $pos = strrpos($a_dir . 
"/" . $file, 
".");
 
 3623                        $new_name = substr($a_dir . 
"/" . $file, 0, $pos) . 
"." . $a_new_suffix;
 
 3624                        rename($a_dir . 
"/" . $file, $new_name);
 
 3634        return  strpos(
$_SERVER[
"SCRIPT_FILENAME"], 
"api") !== 
false ||
 
 3635        strpos(
$_SERVER[
"SCRIPT_FILENAME"], 
"dummy") !== 
false;
 
 3640        if (preg_match(
"/&" . $paramName . 
"=/", $qstring)) {
 
 3641            return preg_replace(
"/&" . $paramName . 
"=[^&]+/", 
"&" . $paramName . 
"=" . urlencode($paramValue), $qstring);
 
 3643            return $qstring . 
"&" . $paramName . 
"=" . urlencode($paramValue);
 
 3649        foreach ($parametersArray as $paramName => $paramValue) {
 
 3664        srand((
double) microtime() * 1000000);
 
 3666        include_once(
'./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
 
 3669        for (
$i = 1; 
$i <= $a_number; 
$i++) {
 
 3670            $min = ($security->getPasswordMinLength() > 0)
 
 3671                ? $security->getPasswordMinLength()
 
 3673            $max = ($security->getPasswordMaxLength() > 0)
 
 3674                ? $security->getPasswordMaxLength()
 
 3679            $random = new \ilRandom();
 
 3680            $length  = $random->int($min, $max);
 
 3681            $next  = $random->int(1, 2);
 
 3683            $vowels_uc = strtoupper($vowels);
 
 3684            $consonants = 
"bcdfghjklmnpqrstvwxyz";
 
 3685            $consonants_uc = strtoupper($consonants);
 
 3686            $numbers = 
"1234567890";
 
 3687            $special = 
"_.+?#-*@!$%~";
 
 3690            if ($security->getPasswordNumberOfUppercaseChars() > 0) {
 
 3691                for ($j = 0; $j < $security->getPasswordNumberOfUppercaseChars(); $j++) {
 
 3694                            $pw.= $consonants_uc[$random->int(0, strlen($consonants_uc) - 1)];
 
 3699                            $pw.= $vowels_uc[$random->int(0, strlen($vowels_uc) - 1)];
 
 3706            if ($security->isPasswordCharsAndNumbersEnabled()) {
 
 3707                $pw.= $numbers[$random->int(0, strlen($numbers) - 1)];
 
 3710            if ($security->isPasswordSpecialCharsEnabled()) {
 
 3711                $pw.= $special[$random->int(0, strlen($special) - 1)];
 
 3714            $num_lcase_chars = max($security->getPasswordNumberOfLowercaseChars(), $length - strlen($pw));
 
 3715            for ($j = 0; $j < $num_lcase_chars; $j++) {
 
 3718                        $pw.= $consonants[$random->int(0, strlen($consonants) - 1)];
 
 3723                        $pw.= $vowels[$random->int(0, strlen($vowels) - 1)];
 
 3729            $pw = str_shuffle($pw);
 
 3738        $path = preg_replace(
"/[\/\\\]+$/", 
"", 
$path);
 
 3758        foreach (
$data as $k => $datum) {
 
 3759            if (is_null($datum)) {
 
 3762            if (is_string($datum)) {
 
 3763                $data[$k] = 
"'" . $datum . 
"'";
 
 3765            if (is_array($datum)) {
 
 3770        return "[" . implode(
', ', 
$data) . 
"]";
 
 3779    public static function virusHandling($a_file, $a_orig_name = 
"", $a_clean = 
true)
 
 3785        if (IL_VIRUS_SCANNER != 
"None") {
 
 3786            require_once(
"./Services/VirusScanner/classes/class.ilVirusScannerFactory.php");
 
 3788            if (($vs_txt = $vs->scanFile($a_file, $a_orig_name)) != 
"") {
 
 3789                if ($a_clean && (IL_VIRUS_CLEAN_COMMAND != 
"")) {
 
 3790                    $clean_txt = $vs->cleanFile($a_file, $a_orig_name);
 
 3791                    if ($vs->fileCleaned()) {
 
 3792                        $vs_txt .= 
"<br />" . 
$lng->txt(
"cleaned_file") .
 
 3793                            "<br />" . $clean_txt;
 
 3794                        $vs_txt .= 
"<br />" . 
$lng->txt(
"repeat_scan");
 
 3795                        if (($vs2_txt = $vs->scanFile($a_file, $a_orig_name)) != 
"") {
 
 3796                            return array(
false, nl2br($vs_txt) . 
"<br />" . 
$lng->txt(
"repeat_scan_failed") .
 
 3797                                "<br />" . nl2br($vs2_txt));
 
 3799                            return array(
true, nl2br($vs_txt) . 
"<br />" . 
$lng->txt(
"repeat_scan_succeded"));
 
 3802                        return array(
false, nl2br($vs_txt) . 
"<br />" . 
$lng->txt(
"cleaning_failed"));
 
 3805                    return array(
false, nl2br($vs_txt));
 
 3810        return array(
true,
"");
 
 3833    public static function moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors = 
true, $a_mode = 
"move_uploaded")
 
 3836        $targetFilename = basename($a_target);
 
 3838        include_once(
"./Services/Utilities/classes/class.ilFileUtils.php");
 
 3844        $upload = 
$DIC->upload();
 
 3847        if (!$upload->hasBeenProcessed()) {
 
 3852            if (!$upload->hasUploads()) {
 
 3853                throw new ilException(
$DIC->language()->txt(
"upload_error_file_not_found"));
 
 3858            $UploadResult = $upload->getResults()[$a_file];
 
 3859            $ProcessingStatus = $UploadResult->getStatus();
 
 3860            if ($ProcessingStatus->getCode() === ProcessingStatus::REJECTED) {
 
 3861                throw new ilException($ProcessingStatus->getMessage());
 
 3864            if ($a_raise_errors) {
 
 3873        $upload->moveOneFileTo($UploadResult, $targetDir, $targetFilesystem, $targetFilename, 
true);
 
 3887        list($datum, $uhrzeit) = explode(
" ", $mysql_date_time);
 
 3888        list($jahr, $monat, 
$tag) = explode(
"-", $datum);
 
 3889        list($std, $min, $sec) = explode(
":", $uhrzeit);
 
 3890        return mktime((
int) $std, (
int) $min, (
int) $sec, (
int) $monat, (
int) 
$tag, (
int) $jahr);
 
 3901        return date(
"Y-m-d H:i:s");
 
 3919    public static function &
processCSVRow(&
$row, $quoteAll = 
false, $separator = 
";", $outUTF8 = 
false, $compatibleWithMSExcel = 
true)
 
 3921        $resultarray = array();
 
 3922        foreach (
$row as $rowindex => $entry) {
 
 3927            if (strpos($entry, 
"\"") !== 
false) {
 
 3928                $entry = str_replace(
"\"", 
"\"\"", $entry);
 
 3931            if (strpos($entry, $separator) !== 
false) {
 
 3934            if ($compatibleWithMSExcel) {
 
 3936                $entry = str_replace(chr(13) . chr(10), chr(10), $entry);
 
 3940                    $resultarray[$rowindex] = 
"\"" . $entry . 
"\"";
 
 3942                    $resultarray[$rowindex] = utf8_decode(
"\"" . $entry . 
"\"");
 
 3946                    $resultarray[$rowindex] = $entry;
 
 3948                    $resultarray[$rowindex] = utf8_decode($entry);
 
 3952        return $resultarray;
 
 3956    public static function isDN($a_str)
 
 3958        return(preg_match(
"/^[a-z]+([a-z0-9-]*[a-z0-9]+)?(\.([a-z]+([a-z0-9-]*[a-z0-9]+)?)+)*$/", $a_str));
 
 3964        return(preg_match(
"/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\." .
 
 3965                          "(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/", $a_str));
 
 4002        $rbacreview = 
$DIC->rbac()->review();
 
 4003        $ilAccess = 
$DIC->access();
 
 4008        if (!is_array($a_obj_type)) {
 
 4009            $where = 
"WHERE type = " . 
$ilDB->quote($a_obj_type, 
"text") . 
" ";
 
 4011            $where = 
"WHERE " . 
$ilDB->in(
"type", $a_obj_type, 
false, 
"text") . 
" ";
 
 4016            $limit = 
$ilSetting->get(
'search_max_hits', 100);
 
 4023        $a_usr_id = $a_usr_id ? $a_usr_id : 
$ilUser->getId();
 
 4024        $a_roles = $rbacreview->assignedRoles($a_usr_id);
 
 4028        if ($rbacreview->isAssigned($a_usr_id, SYSTEM_ROLE_ID)) {
 
 4029            $query = 
"SELECT ref_id FROM object_reference obr LEFT JOIN object_data obd ON obr.obj_id = obd.obj_id " .
 
 4030                "LEFT JOIN tree ON obr.ref_id = tree.child " .
 
 4038                if (
$tree->isGrandChild(RECOVERY_FOLDER_ID, 
$row->ref_id)) {
 
 4042                if ($counter++ >= $limit) {
 
 4046                $ref_ids[] = 
$row->ref_id;
 
 4048            return $ref_ids ? $ref_ids : array();
 
 4052        if ($a_operation == 
'edit_permissions' or strpos($a_operation, 
'create') !== 
false) {
 
 4053            $check_owner = 
") ";
 
 4055            $check_owner = 
"OR owner = " . 
$ilDB->quote($a_usr_id, 
"integer") . 
") ";
 
 4059        $ops_id = $ops_ids[0];
 
 4061        $and = 
"AND ((" . 
$ilDB->in(
"rol_id", $a_roles, 
false, 
"integer") . 
" ";
 
 4063        $query = 
"SELECT DISTINCT(obr.ref_id),obr.obj_id,type FROM object_reference obr " .
 
 4064            "JOIN object_data obd ON obd.obj_id = obr.obj_id " .
 
 4065            "LEFT JOIN rbac_pa  ON obr.ref_id = rbac_pa.ref_id " .
 
 4068            "AND (" . 
$ilDB->like(
"ops_id", 
"text", 
"%i:" . $ops_id . 
"%") . 
" " .
 
 4069            "OR " . 
$ilDB->like(
"ops_id", 
"text", 
"%:\"" . $ops_id . 
"\";%") . 
")) " .
 
 4075            if ($counter >= $limit) {
 
 4080            if (
$tree->isGrandChild(RECOVERY_FOLDER_ID, 
$row->ref_id)) {
 
 4085            if ($ilAccess->checkAccessOfUser($a_usr_id, $a_operation, 
'', 
$row->ref_id, 
$row->type, 
$row->obj_id)) {
 
 4087                $ref_ids[] = 
$row->ref_id;
 
 4090        return $ref_ids ? $ref_ids : array();
 
 4102            case strpos($a_target, ILIAS_WEB_DIR . 
'/' . CLIENT_ID) === 0:
 
 4103            case strpos($a_target, 
'./' . ILIAS_WEB_DIR . 
'/' . CLIENT_ID) === 0:
 
 4104            case strpos($a_target, CLIENT_WEB_DIR) === 0:
 
 4107            case strpos($a_target, CLIENT_DATA_DIR . 
"/temp") === 0:
 
 4110            case strpos($a_target, CLIENT_DATA_DIR) === 0:
 
 4113            case strpos($a_target, ILIAS_ABSOLUTE_PATH . 
'/Customizing') === 0:
 
 4117                throw new InvalidArgumentException(
"Can not move files to \"$a_target\" because path can not be mapped to web, storage or customizing location.");
 
 4120        $absTargetDir = dirname($a_target);
 
 4121        $targetDir = LegacyPathHelper::createRelativePath($absTargetDir);
 
 4123        return array( $targetFilesystem, $targetDir );
 
 4133        include_once 
'./Services/MathJax/classes/class.ilMathJax.php';
 
 4143        include_once 
'./Services/MathJax/classes/class.ilMathJax.php';
 
 4153        include_once 
'./Services/MathJax/classes/class.ilMathJax.php';
 
 4154        return ilMathJax::getInstance()->insertLatexImages($a_text, 
'[tex]', 
'[/tex]', $a_dir . 
'/teximg', 
'./teximg');
 
 4165    public static function prepareTextareaOutput($txt_output, $prepare_for_latex_output = 
false, $omitNl2BrWhenTextArea = 
false)
 
 4172            if (!$omitNl2BrWhenTextArea) {
 
 4178            if (preg_match_all(
"/(<pre>.*?<\/pre>)/ims", 
$result, $matches)) {
 
 4179                foreach ($matches[0] as $found) {
 
 4181                    if (strpos(
"\n", $found) === 
false) {
 
 4182                        $replacement = 
"\n";
 
 4184                    $removed = preg_replace(
"/<br\s*?\/>/ims", $replacement, $found);
 
 4192        if ($prepare_for_latex_output) {
 
 4193            include_once 
'./Services/MathJax/classes/class.ilMathJax.php';
 
 4198        if ($prepare_for_latex_output) {
 
 4219        if (strlen(strip_tags($a_text)) < strlen($a_text)) {
 
 4247        $diff = $to->diff(
$from);
 
 4250        $periods[
"years"] = $diff->format(
"%y");
 
 4251        $periods[
"months"] = $diff->format(
"%m");
 
 4252        $periods[
"days"] = $diff->format(
"%d");
 
 4253        $periods[
"hours"] = $diff->format(
"%h");
 
 4254        $periods[
"minutes"] = $diff->format(
"%i");
 
 4255        $periods[
"seconds"] = $diff->format(
"%s");
 
 4257        if (!array_sum($periods)) {
 
 4261        foreach ($periods as 
$key => $value) {
 
 4263                $segment_name = ($value > 1)
 
 4265                    : substr(
$key, 0, -1);
 
 4266                $array[] = $value . 
' ' . 
$lng->txt($segment_name);
 
 4270        $len = 
sizeof($array);
 
 4272            $array = array_slice($array, 0, (3 - $len));
 
 4275        return implode(
', ', $array);
 
 4281            self::getUploadSizeLimitBytes()
 
 4297        return $lng->txt(
"file_notice") . 
" $max_filesize.";
 
 4302        $unit = array(
'', 
'K', 
'M', 
'G', 
'T', 
'P');
 
 4304        for (
$i = 0, $maxUnits = count($unit); 
$size >= 1024 && 
$i <= $maxUnits; 
$i++) {
 
 4308        return round(
$size, $decimals) . $unit[
$i];
 
 4313        $uploadSizeLimitBytes = min(
 
 4314            self::convertPhpIniSizeValueToBytes(ini_get(
'post_max_size')),
 
 4315            self::convertPhpIniSizeValueToBytes(ini_get(
'upload_max_filesize'))
 
 4318        return $uploadSizeLimitBytes;
 
 4323        if (is_numeric($phpIniSizeValue)) {
 
 4324            return $phpIniSizeValue;
 
 4327        $suffix = substr($phpIniSizeValue, -1);
 
 4328        $value = substr($phpIniSizeValue, 0, -1);
 
 4330        switch (strtoupper($suffix)) {
 
 4361        $test_str = explode(
'_', $role_title);
 
 4363        if ($test_str[0] == 
'il') {
 
 4364            $test2 = (int) $test_str[3];
 
 4365            return is_numeric($test2) ? (int) $test2 : 
false;
 
 4382        $test_str = explode(
'_', $ilias_id);
 
 4384        if ($test_str[0] == 
'il' && $test_str[1] == $inst_id && count($test_str) == 4) {
 
 4385            $test2 = (int) $test_str[3];
 
 4386            return is_numeric($test2) ? (int) $test2 : 
false;
 
 4405    public static function _sortIds($a_ids, $a_table, $a_field, $a_id_name)
 
 4416        $where = 
"WHERE " . $a_id_name . 
" IN (";
 
 4420        $query = 
"SELECT " . $a_id_name . 
" FROM " . $a_table . 
" " .
 
 4422            "ORDER BY " . $a_field;
 
 4426            $ids[] = 
$row->$a_id_name;
 
 4428        return $ids ? $ids : array();
 
 4462        if (!is_array($a_array) or !count($a_array)) {
 
 4466        foreach ($a_array as $k => $item) {
 
 4467            $a_array[$k] = 
$ilDB->quote($item);
 
 4481    public static function sendInfo($a_info = 
"", $a_keep = 
false)
 
 4486        $tpl->setMessage(
"info", $a_info, $a_keep);
 
 4501        if (isset(
$DIC[
"tpl"])) {
 
 4503            $tpl->setMessage(
"failure", $a_info, $a_keep);
 
 4518        $tpl->setMessage(
"question", $a_info, $a_keep);
 
 4529    public static function sendSuccess($a_info = 
"", $a_keep = 
false)
 
 4535        $tpl->setMessage(
"success", $a_info, $a_keep);
 
 4550                "tpl.infopanel.html",
 
 4551                "Services/Utilities" 
 4553            $tpl->setCurrentBlock(
"infopanel");
 
 4555            if (!empty(
$_SESSION[
"infopanel"][
"text"])) {
 
 4556                $link = 
"<a href=\"" . 
$_SESSION[
"infopanel"][
"link"] . 
"\" target=\"" .
 
 4564            if (!empty(
$_SESSION[
"infopanel"][
"img"])) {
 
 4565                $link .= 
"<td><a href=\"" . 
$_SESSION[
"infopanel"][
"link"] . 
"\" target=\"" .
 
 4568                $link .= 
"<img src=\"" . 
"./templates/" . 
$ilUser->prefs[
"skin"] . 
"/images/" .
 
 4569                    $_SESSION[
"infopanel"][
"img"] . 
"\" border=\"0\" vspace=\"0\"/>";
 
 4570                $link .= 
"</a></td>";
 
 4573            $tpl->setVariable(
"INFO_ICONS", $link);
 
 4574            $tpl->parseCurrentBlock();
 
 4595        if (!is_dir($directory)) {
 
 4598            $size = @filesize($directory);
 
 4602        if ($DIR = opendir($directory)) {
 
 4603            while (($dirfile = readdir($DIR)) !== 
false) {
 
 4604                if (is_link($directory . DIRECTORY_SEPARATOR . $dirfile) || $dirfile == 
'.' || $dirfile == 
'..') {
 
 4607                if (is_file($directory . DIRECTORY_SEPARATOR . $dirfile)) {
 
 4608                    $size += filesize($directory . DIRECTORY_SEPARATOR . $dirfile);
 
 4609                } elseif (is_dir($directory . DIRECTORY_SEPARATOR . $dirfile)) {
 
 4611                    $dirSize = 
ilUtil::dirsize($directory . DIRECTORY_SEPARATOR . $dirfile);
 
 4613                    if ($dirSize >= 0) {
 
 4627        $random = new \ilRandom();
 
 4628        return md5($random->int(1, 9999999) + str_replace(
" ", 
"", (
string) microtime()));
 
 4631    public static function setCookie($a_cookie_name, $a_cookie_value = 
'', $a_also_set_super_global = 
true, $a_set_cookie_invalid = 
false)
 
 4638        if (!(
bool) $a_set_cookie_invalid) {
 
 4641            $expire = time() - (365 * 24 * 60 * 60);
 
 4650        if (defined(
'IL_COOKIE_SECURE')) {
 
 4651            $secure = IL_COOKIE_SECURE;
 
 4664        if ((
bool) $a_also_set_super_global) {
 
 4665            $_COOKIE[$a_cookie_name] = $a_cookie_value;
 
 4671        return strip_tags(self::stripSlashes($a_filename));
 
 4680        if (
$_SERVER[
'SHELL'] || php_sapi_name() == 
'cli' ||
 
 4685            return ILIAS_HTTP_PATH;
 
 4696        $bt = debug_backtrace();
 
 4698        foreach ($bt as 
$t) {
 
 4699            if ($cnt != 0 && ($a_limit == 0 || $cnt <= $a_limit)) {
 
 4700                echo 
"<br>" . 
$t[
"file"] . 
", " . 
$t[
"function"] . 
" [" . 
$t[
"line"] . 
"]";
 
 4723        $exploded = explode(
'_', $a_import_id);
 
 4725        $parsed[
'orig'] = $a_import_id;
 
 4726        if ($exploded[0] == 
'il') {
 
 4727            $parsed[
'prefix'] = $exploded[0];
 
 4729        if (is_numeric($exploded[1])) {
 
 4730            $parsed[
'inst_id'] = (int) $exploded[1];
 
 4732        $parsed[
'type'] = $exploded[2];
 
 4734        if (is_numeric($exploded[3])) {
 
 4735            $parsed[
'id'] = (int) $exploded[3];
 
 4749            '/([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff^|]*)\|/',
 
 4757        for (
$i = 0; $vars[
$i]; 
$i++) {
 
 4779        $fp = @fopen($file, 
'rb');
 
 4781        $size = filesize($file); 
 
 4797        header(
"Accept-Ranges: 0-$length");
 
 4801        if (isset(
$_SERVER[
'HTTP_RANGE'])) {
 
 4805            list(, $range) = explode(
'=', 
$_SERVER[
'HTTP_RANGE'], 2);
 
 4807            if (strpos($range, 
',') !== 
false) {
 
 4812                header(
'HTTP/1.1 416 Requested Range Not Satisfiable');
 
 4813                header(
"Content-Range: bytes $start-$end/$size");
 
 4820            if ($range == 
'-') {
 
 4823                $c_start = 
$size - substr($range, 1);
 
 4825                $range = explode(
'-', $range);
 
 4826                $c_start = $range[0];
 
 4827                $c_end = (isset($range[1]) && is_numeric($range[1])) ? $range[1] : 
$size;
 
 4833            $c_end = ($c_end > 
$end) ? 
$end : $c_end;
 
 4835            if ($c_start > $c_end || $c_start > 
$size - 1 || $c_end >= 
$size) {
 
 4836                header(
'HTTP/1.1 416 Requested Range Not Satisfiable');
 
 4837                header(
"Content-Range: bytes $start-$end/$size");
 
 4845            header(
'HTTP/1.1 206 Partial Content');
 
 4848        header(
"Content-Range: bytes $start-$end/$size");
 
 4849        header(
"Content-Length: $length");
 
 4853        while (!feof($fp) && ($p = ftell($fp)) <= 
$end) {
 
 4854            if ($p + $buffer > 
$end) {
 
 4858                $buffer = 
$end - $p + 1;
 
 4861            echo fread($fp, $buffer);
 
 4903    protected static function fmtFloat($a_float, $a_decimals = 0, $a_dec_point = 
null, $a_thousands_sep = 
null, $a_suppress_dot_zero = 
false)
 
 4909        if ($a_dec_point == 
null) {
 
 4914        if ($a_dec_point == 
'-lang_sep_decimal-') {
 
 4918        if ($a_thousands_sep == 
null) {
 
 4919            $a_thousands_sep = 
$lng->txt(
'lang_sep_thousand');
 
 4921        if ($a_thousands_sep == 
'-lang_sep_thousand-') {
 
 4922            $a_thousands_sep = 
",";
 
 4925        $txt = number_format($a_float, $a_decimals, $a_dec_point, $a_thousands_sep);
 
 4928        if (($a_suppress_dot_zero == 0 || $a_decimals == 0)
 
 4929            && substr(
$txt, -2) == $a_dec_point . 
'0' 
 4933        if ($a_float == 0 and 
$txt == 
"") {
 
 4961        if ($a_lng == 
null) {
 
 4967        if (
$size >= $mag * $mag * $mag) {
 
 4968            $scaled_size = 
$size / $mag / $mag / $mag;
 
 4969            $scaled_unit = 
'lang_size_gb';
 
 4971            if (
$size >= $mag * $mag) {
 
 4972                $scaled_size = 
$size / $mag / $mag;
 
 4973                $scaled_unit = 
'lang_size_mb';
 
 4975                if (
$size >= $mag) {
 
 4976                    $scaled_size = 
$size / $mag;
 
 4977                    $scaled_unit = 
'lang_size_kb';
 
 4979                    $scaled_size = 
$size;
 
 4980                    $scaled_unit = 
'lang_size_bytes';
 
 4986                                                == 
'lang_size_bytes') ? 0 : 1, $a_lng->txt(
'lang_sep_decimal'), $a_lng->txt(
'lang_sep_thousand'), 
true)
 
 4987                  . 
' ' . $a_lng->txt($scaled_unit);
 
 4988        if ($a_mode == 
'long' && 
$size > $mag) {
 
 4990                       . $a_lng->txt(
'lang_size_bytes') . 
')';
 
 5003        return  ((
int) $a_value) * pow(self::_getSizeMagnitude(), 2);
 
 5008        return  ((
int) $a_value) / (pow(self::_getSizeMagnitude(), 2));
 
 5022        if (!isset(self::$db_supports_distinct_umlauts)) {
 
 5024            $set = 
$ilDB->query(
"SELECT (" . 
$ilDB->quote(
"A", 
"text") . 
" = " . 
$ilDB->quote(
"Ä", 
"text") . 
") t FROM DUAL ");
 
 5025            $rec = 
$ilDB->fetchAssoc($set);
 
 5026            self::$db_supports_distinct_umlauts = !(bool) $rec[
"t"];
 
An exception for terminatinating execution or to throw for unit testing.
static usesHTTP()
Uses HTTP aka browser.
This class provides processing control methods.
@classDescription Date and time handling
get($a_format, $a_format_str='', $a_tz='')
get formatted date
Base class for ILIAS Exception handling.
static getValidFilename($a_filename)
Get valid filename.
static recursive_dirscan($dir, &$arr)
Recursively scans a given directory and writes path and filename into referenced array.
static getInstance()
Get https instance.
Class ilMailRfc822AddressParserFactory.
static getInstance()
Singleton: get instance.
static _removeItemFromDesktops($a_id)
removes object from all user's desktops @access public
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static _getOperationIdsByName($operations)
get ops_id's by name.
static _getInstance()
Get instance of ilSecuritySettings.
static clear($a_var)
Unset a value.
static strPos($a_haystack, $a_needle, $a_offset=null)
static subStr($a_str, $a_start, $a_length=null)
static strCmp($a, $b)
Compare two strings.
static strToUpper($a_string)
static getCurrentSkin()
get the current skin
static getCurrentStyle()
get the current style or sub style
Util class various functions, usage as namespace.
static getPasswordValidChars($a_as_regex=true, $a_only_special_chars=false)
All valid chars for password.
static CreateIsoFromFolder($a_dir, $a_file)
static getDataDir()
get data directory (outside webspace)
static _getSizeMagnitude()
Returns the magnitude used for size units.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static getJSLocation($a_js_name, $a_js_location="", $add_version=false)
get full javascript file name (path inclusive) of current user
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 convertImage( $a_from, $a_to, $a_target_format="", $a_geometry="", $a_background_color="")
convert image
static assembleParameterString($a_par_arr)
static dumpString($a_str)
dumps ord values of every character of string $a_str
static appendUrlParameterString($a_url, $a_par, $xml_style=false)
append URL parameter string ("par1=value1&par2=value2...") to given URL string
static prepareDBString($a_str)
prepare a string for db writing (insert/update)
static getMemString()
get current memory usage as string
static _sanitizeFilemame($a_filename)
static formRadioButton($checked, $varname, $value, $onclick=null, $disabled=false)
??? @access public
static checkInput($vars)
???
static secureString($a_str, $a_strip_html=true, $a_allow="")
Remove unsecure tags.
static unmaskSecureTags($a_str, $allow_array)
static insertLatexImages($a_text, $a_start='[tex]', $a_end='[/tex]')
replace [tex]...[/tex] tags with formula image code
static formCheckbox($checked, $varname, $value, $disabled=false)
??? @access public
static isConvertVersionAtLeast($a_version)
Compare convert version numbers.
static formDisabledRadioButton($checked, $varname, $value, $disabled)
??? @accesspublic @paramstring @paramstring @paramstring
static excelTime($year="", $month="", $day="", $hour="", $minute="", $second="")
Calculates a Microsoft Excel date/time value.
static formatBytes($size, $decimals=0)
static getUploadSizeLimitBytes()
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,...
static checkFormEmpty($emptyFields)
??? @access public
static convertPhpIniSizeValueToBytes($phpIniSizeValue)
static isHTML($a_text)
Checks if a given string contains HTML or not.
static getGDSupportedImageType($a_desired_type)
returns the best supported image type by this PHP build
static setCookie($a_cookie_name, $a_cookie_value='', $a_also_set_super_global=true, $a_set_cookie_invalid=false)
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static stripOnlySlashes($a_str)
strip slashes if magic qoutes is enabled
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
static execQuoted($cmd, $args=null)
exec command and fix spaces on windows
static replaceUrlParameterString($url, $parametersArray)
static insertInstIntoID($a_value)
inserts installation id into ILIAS id
static __extractRefId($role_title)
extract ref id from role title, e.g.
static KT_replaceParam($qstring, $paramName, $paramValue)
static tf2yn($a_tf)
convert true/false to "y"/"n"
static replaceLinkProperties($matches)
replaces target _blank with _self and the link text with the according object title.
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 parseImportId($a_import_id)
Parse an ilias import id Typically of type il_[IL_INST_ID]_[OBJ_TYPE]_[OBJ_ID] returns array( 'orig' ...
static getJavaPath()
get full java path (dir + java command)
static escapeShellArg($a_arg)
static setPathStr($a_path)
??? @access public
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 readFile($a_file)
there are some known problems with the original readfile method, which sometimes truncates delivered ...
static getWebspaceDir($mode="filesystem")
get webspace directory
static unmaskAttributeTag($a_str, $tag, $tag_att)
rangeDownload($file)
Send a file via range request, see http://mobiforge.com/design-development/content-delivery-mobile-de...
static execConvert($args)
execute convert command
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
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 getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
static sanitateTargetPath($a_target)
static redirect($a_script)
static resizeImage($a_from, $a_to, $a_width, $a_height, $a_constrain_prop=false)
resize image
static isPassword($a_passwd, &$customError=null)
validates a password @access public
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static stripSlashesRecursive($a_data, $a_strip_html=true, $a_allow="")
Strip slashes from array and sub-arrays.
static makeClickable($a_text, $detectGotoLinks=false)
makeClickable In Texten enthaltene URLs und Mail-Adressen klickbar machen
static getClientIdByString(string $clientId)
static groupNameExists($a_group_name, $a_id=0)
checks if group name already exists.
static virusHandling($a_file, $a_orig_name="", $a_clean=true)
scan file for viruses and clean files if possible
static buildLatexImages($a_text, $a_dir)
replace [tex]...[/tex] tags with formula image code for offline use
static printBacktrace($a_limit=0)
printBacktrace
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
static maskSecureTags($a_str, $allow_array)
static unmaskTag($a_str, $t, $fix_param="")
static zip($a_dir, $a_file, $compress_content=false)
zips given directory/file into given zip.file
static isWindows()
check wether the current client system is a windows system
static img($a_src, $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
static dumpVar($mixed=null)
Dump var.
static getSafeFilename($a_initial_filename)
static fmtFloat($a_float, $a_decimals=0, $a_dec_point=null, $a_thousands_sep=null, $a_suppress_dot_zero=false)
format a float
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 rRenameSuffix($a_dir, $a_old_suffix, $a_new_suffix)
Renames all files with certain suffix and gives them a new suffix.
static formatSize($size, $a_mode='short', $a_lng=null)
Returns the specified file size value in a human friendly form.
static extractParameterString($a_parstr)
extracts parameter value pairs from a string into an array
static period2String(ilDateTime $a_from, $a_to=null)
Return a string of time period.
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
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,...
static now()
Return current timestamp in Y-m-d H:i:s format.
static getConvertCmd()
get convert command
static getP3PLocation()
Get p3p file path.
static escapeShellCmd($a_arg)
escape shell cmd
static maskAttributeTag($a_str, $tag, $tag_att)
static is_email($a_email, ilMailRfc822AddressParserFactory $mailAddressParserFactory=null)
This preg-based function checks whether an e-mail address is formally valid.
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.
static processConvertVersion($a_version)
Parse convert version string, e.g.
static getNewContentStyleSheetLocation($mode="output")
get full style sheet file name (path inclusive) of current user
static securePlainString($a_str)
Remove unsecure characters from a plain text string.
static dbSupportsDisctinctUmlauts()
Only temp fix for #8603, should go to db classes.
static ilTempnam($a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
static htmlentitiesOutsideHTMLTags($htmlText)
Encodes HTML entities outside of HTML tags.
static getHtmlPath($relative_path)
get url of path
static $db_supports_distinct_umlauts
static getPasswordRequirementsInfo()
infotext for ilPasswordInputGUI setInfo()
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 unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
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 array_php2js($data)
convert php arrays to javascript arrays
includeMathjax($a_tpl=null)
Include Mathjax.
static unique_multi_array($array, $sub_key)
Make a multi-dimensional array to have only DISTINCT values for a certain "column".
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 generatePasswords($a_number)
Generate a number of passwords.
static getSelectName($selected, $values)
???
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static date_mysql2time($mysql_date_time)
make time object from mysql_date_time
static MB2Bytes($a_value)
static yn2tf($a_yn)
convert "y"/"n" to true/false
static quoteArray($a_array)
Quotes all members of an array for usage in DB query statement.
static secureLink($a_str)
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static isPasswordValidForUserContext($clear_text_password, $user, &$error_language_variable=null)
static sort_func_numeric($a, $b)
sub-function to sort an array
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 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 removeItemFromDesktops($a_id)
removes object from all user's desktops @access public
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static shortenText( $a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
static __extractId($ilias_id, $inst_id)
extract ref id from role title, e.g.
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 getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static deducibleSize($a_mime)
checks if mime type is provided by getimagesize()
static attribsToArray($a_str)
converts a string of format var1 = "val1" var2 = "val2" ... into an array
static maskTag($a_str, $t, $fix_param="")
static removeTrailingPathSeparators($path)
static infoPanel($a_keep=true)
static & processCSVRow(&$row, $quoteAll=false, $separator=";", $outUTF8=false, $compatibleWithMSExcel=true)
Convertes an array for CSV usage.
static secureUrl($url)
Prepare secure href attribute.
static unserializeSession($data)
Returns the unserialized ILIAS session data.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
static createDirectory($a_dir, $a_mod=0755)
create directory
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
static formInput($varname, $value, $disabled=false)
create html input area
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 Bytes2MB($a_value)
static renameExecutables($a_dir)
Rename uploaded executables for security reasons.
static dirsize($directory)
get size of a directory or a file.
static stripSlashesArray($a_arr, $a_strip_html=true, $a_allow="")
Strip slashes from array.
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 sort_func($a, $b)
sub-function to sort an array
static mergesort(&$array, $cmp_function='strcmp')
if(array_key_exists('yes', $_REQUEST)) $attributes
const TEMPORARY
The ILIAS temporary directory.
const CUSTOMIZING
The filesystem within the web root where all the skins and plugins are saved.
const WEB
The filesystem within the ilias web root.
const STORAGE
The filesystem outside of the ilias web root.
if(function_exists( 'posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
catch(Exception $e) $message
Class FlySystemFileAccessTest.
$stream
PHP stream implementation.
if(array_key_exists('provider', $_GET)) elseif(array_key_exists( 'provider', $_SESSION)) if(!in_array($providerName, ['Google', 'Microsoft', 'Yahoo'])) $clientId
foreach($_POST as $key=> $value) $res
echo;exit;}function LogoutNotification($SessionID){ global $ilDB;$q="SELECT session_id, data FROM usr_session WHERE expires > (\w+)\|/" PREG_SPLIT_NO_EMPTY PREG_SPLIT_DELIM_CAPTURE
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']