ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilUtil Class Reference

Util class various functions, usage as namespace. More...

+ Collaboration diagram for ilUtil:

Static Public Member Functions

static getImageTagByType (string $a_type, string $a_path, bool $a_big=false)
 Builds an html image tag. More...
 
static getImagePath (string $image_name, string $module_path="", string $mode="output", bool $offline=false)
 get image path (for images located in a template directory) More...
 
static getHtmlPath (string $relative_path)
 get url of path More...
 
static getStyleSheetLocation (string $mode="output", string $a_css_name="")
 get full style sheet file name (path inclusive) of current user More...
 
static getNewContentStyleSheetLocation (string $mode="output")
 get full style sheet file name (path inclusive) of current user More...
 
static switchColor (int $a_num, string $a_css1, string $a_css2)
 switches style sheets for each even $a_num (used for changing colors of different result rows) More...
 
static makeClickable (string $a_text, bool $detectGotoLinks=false, ?string $ilias_http_path=null)
 
static is_email (string $a_email, ?ilMailRfc822AddressParserFactory $mailAddressParserFactory=null)
 This preg-based function checks whether an e-mail address is formally valid. More...
 
static isLogin (string $a_login)
 
static img (string $a_src, ?string $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
 Build img tag. More...
 
static deliverData (string $a_data, string $a_filename, string $mime="application/octet-stream")
 
static appendUrlParameterString (string $a_url, string $a_par, bool $xml_style=false)
 
static stripSlashes (string $a_str, bool $a_strip_html=true, string $a_allow="")
 
static stripOnlySlashes (string $a_str)
 
static secureString (string $a_str, bool $a_strip_html=true, string $a_allow="")
 
static getSecureTags ()
 
static securePlainString (string $a_str)
 
static htmlencodePlainString (string $a_str, bool $a_make_links_clickable, bool $a_detect_goto_links=false)
 Encodes a plain text string into HTML for display in a browser. More...
 
static maskTag (string $a_str, string $tag, array $fix_param=[])
 
static secureLink (string $a_str)
 
static stripScriptHTML (string $a_str, string $a_allow="", bool $a_rm_js=true)
 
static secureUrl (string $url)
 
static extractParameterString (string $a_parstr)
 
static yn2tf (string $a_yn)
 
static tf2yn (bool $a_tf)
 
static deducibleSize (string $a_mime)
 checks if mime type is provided by getimagesize() More...
 
static redirect (string $a_script)
 
static insertInstIntoID (string $a_value)
 inserts installation id into ILIAS id More...
 
static groupNameExists (string $a_group_name, ?int $a_id=null)
 checks if group name already exists. More...
 
static isWindows ()
 
static now ()
 Return current timestamp in Y-m-d H:i:s format. More...
 
static _getObjectsByOperations ( $a_obj_type, string $a_operation, int $a_usr_id=0, int $limit=0)
 Get all objects of a specific type and check access This function is not recursive, instead it parses the serialized rbac_pa entries. More...
 
static isHTML (string $a_text)
 Checks if a given string contains HTML or not. More...
 
static __extractRefId (string $role_title)
 extract ref id from role title, e.g. More...
 
static __extractId (string $ilias_id, int $inst_id)
 extract ref id from role title, e.g. More...
 
static _sortIds (array $a_ids, string $a_table, string $a_field, string $a_id_name)
 Function that sorts ids by a given table field using WHERE IN E.g: __sort(array(6,7),'usr_data','lastname','usr_id') => sorts by lastname. More...
 
static getSystemMessageHTML (string $a_txt, string $a_type="info")
 Get HTML for a system message. More...
 
static setCookie (string $a_cookie_name, string $a_cookie_value='', bool $a_also_set_super_global=true, bool $a_set_cookie_invalid=false)
 
static _getHttpPath ()
 
static parseImportId (string $a_import_id)
 Parse an ilias import id Typically of type il_[IL_INST_ID]_[OBJ_TYPE]_[OBJ_ID] returns array( 'orig' => 'il_4800_rolt_123' 'prefix' => 'il' 'inst_id => '4800' 'type' => 'rolt' 'id' => '123'. More...
 
static formatSize (int $size, string $a_mode='short', ?ilLanguage $a_lng=null)
 Returns the specified file size value in a human friendly form. More...
 

Static Protected Member Functions

static fmtFloat (float $a_float, int $a_decimals=0, ?string $a_dec_point=null, ?string $a_thousands_sep=null, bool $a_suppress_dot_zero=false)
 format a float More...
 

Static Private Member Functions

static replaceLinkProperties (array $matches)
 
static maskSecureTags (string $a_str, array $allow_array)
 
static unmaskSecureTags (string $a_str, array $allow_array)
 
static maskAttributeTag (string $a_str, string $tag, string $tag_att)
 
static unmaskAttributeTag (string $a_str, string $tag, string $tag_att)
 
static unmaskTag (string $a_str, string $tag, array $fix_param=[])
 

Detailed Description

Util class various functions, usage as namespace.

Author
Sascha Hofmann sasch.nosp@m.ahof.nosp@m.mann@.nosp@m.gmx..nosp@m.de
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Deprecated:
12 This component will be removed with ILIAS 12 The 2021 Technical Board has decided to mark the ilUtil class as deprecated. The ilUtil is a historically grown helper class with many different UseCases and functions. The class is not under direct maintainership and the responsibilities are unclear. In this context, the class should no longer be used in the code and existing uses should be converted to their own service in the medium term. If you need ilUtil for the implementation of a new function in ILIAS > 7, please contact the Technical Board.

Definition at line 38 of file class.ilUtil.php.

Member Function Documentation

◆ __extractId()

static ilUtil::__extractId ( string  $ilias_id,
int  $inst_id 
)
static

extract ref id from role title, e.g.

893 from 'il_122_role_893'

Parameters
string$ilias_idwith format like il_<instid>_<objTyp>_ID
int$inst_idInstallation ID must match inst id in param ilias_id
Deprecated:

Definition at line 1200 of file class.ilUtil.php.

1200 : ?int
1201 {
1202 $test_str = explode('_', $ilias_id);
1203
1204 $parsed_inst_id = (int) ($test_str[1] ?? 0);
1205 $prefix = $test_str[0] ?? '';
1206
1207 if ($prefix === 'il' && $parsed_inst_id === $inst_id && count($test_str) === 4) {
1208 return is_numeric($test_str[3]) ? (int) $test_str[3] : null;
1209 }
1210 return null;
1211 }

References ILIAS\Repository\int().

Referenced by ilObjUser\_getUserData(), ilUserImportParser\extractRolesBeginTag(), ilExerciseXMLParser\handlerBeginTag(), ilFileXMLParser\handlerBeginTag(), ilObjectXMLParser\handlerBeginTag(), ilUserImportParser\importBeginTag(), ilSoapUserAdministration\importUsers(), ilSoapRBACAdministration\parseUserID(), ilGroupXMLParser\save(), and ilUserImportParser\verifyBeginTag().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __extractRefId()

static ilUtil::__extractRefId ( string  $role_title)
static

extract ref id from role title, e.g.

893 from 'il_crs_member_893'

Parameters
string$role_titlewith format like il_crs_member_893
Deprecated:

Definition at line 1180 of file class.ilUtil.php.

1180 : ?int
1181 {
1182 $test_str = explode('_', $role_title);
1183 $prefix = $test_str[0] ?? '';
1184
1185 if ($prefix === 'il') {
1186 $ref_id = $test_str[3] ?? null;
1187 return is_numeric($ref_id) ? (int) $ref_id : null;
1188 }
1189 return null;
1190 }
$ref_id
Definition: ltiauth.php:66

References $ref_id, and ILIAS\Repository\int().

Referenced by ilSoapCourseAdministration\getCoursesForUser(), ilSoapGroupAdministration\getGroupsForUser(), and ilSoapRoleObjectXMLWriter\start().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getHttpPath()

static ilUtil::_getHttpPath ( )
static
Deprecated:

Definition at line 1328 of file class.ilUtil.php.

1328 : string
1329 {
1330 global $DIC;
1331
1332 $ilIliasIniFile = $DIC["ilIliasIniFile"];
1333
1334 if ((isset($_SERVER['SHELL']) && $_SERVER['SHELL']) || PHP_SAPI === 'cli' ||
1335 // fallback for windows systems, useful in crons
1336 (class_exists("ilContext") && !ilContext::usesHTTP())) {
1337 return $ilIliasIniFile->readVariable('server', 'http_path');
1338 } else {
1339 return ILIAS_HTTP_PATH;
1340 }
1341 }
static usesHTTP()
Uses HTTP aka browser.
$_SERVER['HTTP_HOST']
Definition: raiseError.php:26
global $DIC
Definition: shib_login.php:26
$ilIliasIniFile
Definition: server.php:37

References $_SERVER, $DIC, $ilIliasIniFile, and ilContext\usesHTTP().

Referenced by ILIAS\Cron\Job\Manager\UI\JobTable\__construct(), ilSamlIdpTableGUI\__construct(), ILIAS\Mail\Attachments\MailAttachmentTableGUI\__construct(), ilMail\_getAutoGeneratedMessageString(), ILIAS\Mail\Placeholder\MailSignatureIliasUrlPlaceholder\addPlaceholder(), ilErrorHandling\errorHandler(), ilPasswordAssistanceGUI\getBaseUrl(), ilMailEnvironmentHelper\getHttpPath(), ilTestPlayerAbstractGUI\getNavigationUrlParameter(), ilForumMailNotification\getPermanentLink(), ilForumMailEventNotificationSender\getPermanentLink(), ilMailFormCall\getRefererRedirectUrl(), ilLDAPSettingsGUI\getRoleAssignmentTable(), ILIAS\Forum\Notification\ForumNotificationTable\getTableComponent(), ilSoapClient\init(), ilLDAPSettingsGUI\roleMappingCmd(), ILIAS\Cron\Job\Manager\JobManagerImpl\runActiveJobs(), ilMailSummaryNotification\send(), ilLDAPSettingsGUI\serverListCmd(), ilMailFolderGUI\showFolder(), and ilForumModeratorsGUI\showModeratorsCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getObjectsByOperations()

static ilUtil::_getObjectsByOperations (   $a_obj_type,
string  $a_operation,
int  $a_usr_id = 0,
int  $limit = 0 
)
static

Get all objects of a specific type and check access This function is not recursive, instead it parses the serialized rbac_pa entries.

Get all objects of a specific type where access is granted for the given operation. This function does a checkAccess call for all objects in the object hierarchy and return only the objects of the given type. Please note if access is not granted to any object in the hierarchy the function skips all objects under it. Example: You want a list of all Courses that are visible and readable for the user. The function call would be: $your_list = IlUtil::getObjectsByOperation ("crs", "visible"); Lets say there is a course A where the user would have access to according to his role assignments. Course A lies within a group object which is not readable for the user. Therefore course A won't appear in the result list although the queried operations 'read' would actually permit the user to access course A.

@access public

Parameters
string/arrayobject type 'lm' or array('lm','sahs')
stringpermission to check e.g. 'visible' or 'read'
intid of user in question
intlimit of results. if not given it defaults to search max hits.If limit is -1 limit is unlimited
Returns
array of ref_ids

Definition at line 1055 of file class.ilUtil.php.

1060 : array {
1061 global $DIC;
1062
1063 $ilDB = $DIC->database();
1064 $rbacreview = $DIC->rbac()->review();
1065 $ilAccess = $DIC->access();
1066 $ilUser = $DIC->user();
1067 $ilSetting = $DIC->settings();
1068 $tree = $DIC->repositoryTree();
1069
1070 if (!is_array($a_obj_type)) {
1071 $where = "WHERE type = " . $ilDB->quote($a_obj_type, "text") . " ";
1072 } else {
1073 $where = "WHERE " . $ilDB->in("type", $a_obj_type, false, "text") . " ";
1074 }
1075
1076 // limit number of results default is search result limit
1077 if (!$limit) {
1078 $limit = (int) $ilSetting->get('search_max_hits', "100");
1079 }
1080 if ($limit == -1) {
1081 $limit = 10000;
1082 }
1083
1084 // default to logged in usr
1085 $a_usr_id = $a_usr_id ?: $ilUser->getId();
1086 $a_roles = $rbacreview->assignedRoles($a_usr_id);
1087
1088 // Since no rbac_pa entries are available for the system role. This function returns !all! ref_ids in the case the user
1089 // is assigned to the system role
1090 if ($rbacreview->isAssigned($a_usr_id, SYSTEM_ROLE_ID)) {
1091 $query = "SELECT ref_id FROM object_reference obr LEFT JOIN object_data obd ON obr.obj_id = obd.obj_id " .
1092 "LEFT JOIN tree ON obr.ref_id = tree.child " .
1093 $where .
1094 "AND tree = 1";
1095
1096 $res = $ilDB->query($query);
1097 $counter = 0;
1098 $ref_ids = [];
1099 while ($row = $ilDB->fetchObject($res)) {
1100 // Filter recovery folder
1101 if ($tree->isGrandChild(RECOVERY_FOLDER_ID, $row->ref_id)) {
1102 continue;
1103 }
1104
1105 if ($counter++ >= $limit) {
1106 break;
1107 }
1108
1109 $ref_ids[] = $row->ref_id;
1110 }
1111 return $ref_ids;
1112 } // End Administrators
1113
1114 // Check ownership if it is not asked for edit_permission or a create permission
1115 if ($a_operation == 'edit_permissions' or strpos($a_operation, 'create') !== false) {
1116 $check_owner = ") ";
1117 } else {
1118 $check_owner = "OR owner = " . $ilDB->quote($a_usr_id, "integer") . ") ";
1119 }
1120
1121 $ops_ids = ilRbacReview::_getOperationIdsByName([$a_operation]);
1122 $ops_id = $ops_ids[0];
1123
1124 $and = "AND ((" . $ilDB->in("rol_id", $a_roles, false, "integer") . " ";
1125
1126 $query = "SELECT DISTINCT(obr.ref_id),obr.obj_id,type FROM object_reference obr " .
1127 "JOIN object_data obd ON obd.obj_id = obr.obj_id " .
1128 "LEFT JOIN rbac_pa ON obr.ref_id = rbac_pa.ref_id " .
1129 $where .
1130 $and .
1131 "AND (" . $ilDB->like("ops_id", "text", "%i:" . $ops_id . "%") . " " .
1132 "OR " . $ilDB->like("ops_id", "text", "%:\"" . $ops_id . "\";%") . ")) " .
1133 $check_owner;
1134
1135 $res = $ilDB->query($query);
1136 $counter = 0;
1137 $ref_ids = [];
1138 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1139 if ($counter >= $limit) {
1140 break;
1141 }
1142
1143 // Filter objects in recovery folder
1144 if ($tree->isGrandChild(RECOVERY_FOLDER_ID, $row->ref_id)) {
1145 continue;
1146 }
1147
1148 // Check deleted, hierarchical access ...
1149 if ($ilAccess->checkAccessOfUser($a_usr_id, $a_operation, '', $row->ref_id, $row->type, $row->obj_id)) {
1150 $counter++;
1151 $ref_ids[] = $row->ref_id;
1152 }
1153 }
1154 return $ref_ids ?: [];
1155 }
static _getOperationIdsByName(array $operations)
get ops_id's by name.
const RECOVERY_FOLDER_ID
Definition: constants.php:37
const SYSTEM_ROLE_ID
Definition: constants.php:29
$res
Definition: ltiservices.php:69
global $ilSetting
Definition: privfeed.php:31
$counter

References $ilDB.

Referenced by ilGroupActionTargetExplorerGUI\__construct(), ilObjTest\_getAvailableTests(), ilECSSettingsGUI\exportImported(), ILIAS\Course\Grouping\Table\AssignmentRetrieval\getAllEligibleRefIDs(), ilGroupUserActionProvider\getCommandAccess(), and ilECSSettingsGUI\imported().

+ Here is the caller graph for this function:

◆ _sortIds()

static ilUtil::_sortIds ( array  $a_ids,
string  $a_table,
string  $a_field,
string  $a_id_name 
)
static

Function that sorts ids by a given table field using WHERE IN E.g: __sort(array(6,7),'usr_data','lastname','usr_id') => sorts by lastname.

Deprecated:

Definition at line 1219 of file class.ilUtil.php.

1219 : array
1220 {
1221 global $DIC;
1222
1223 $ilDB = $DIC->database();
1224
1225 if (!$a_ids) {
1226 return [];
1227 }
1228
1229 // use database to sort user array
1230 $where = "WHERE " . $a_id_name . " IN (";
1231 $where .= implode(",", ilArrayUtil::quoteArray($a_ids));
1232 $where .= ") ";
1233
1234 $query = "SELECT " . $a_id_name . " FROM " . $a_table . " " .
1235 $where .
1236 "ORDER BY " . $a_field;
1237
1238 $res = $ilDB->query($query);
1239 $ids = [];
1240 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
1241 $ids[] = $row->$a_id_name;
1242 }
1243 return $ids;
1244 }
static quoteArray(array $a_array)
Quotes all members of an array for usage in DB query statement.

References $DIC, $ilDB, $res, ilDBConstants\FETCHMODE_OBJECT, and ilArrayUtil\quoteArray().

Referenced by ilObjRoleGUI\adoptPermObject(), ilAppointmentPresentationCourseGUI\collectPropertiesAndActions(), ilObjSessionGUI\eventsListObject(), ilMemberExport\fetchUsers(), ilAttendanceList\getHTML(), ilPermissionGUI\initRoleForm(), ilConsultationHoursTableGUI\parse(), ilLDAPSettingsGUI\prepareGlobalRoleSelection(), ilAuthShibbolethSettingsGUI\prepareRoleSelect(), ilECSSettingsGUI\prepareRoleSelect(), ilSamlSettingsGUI\prepareRoleSelection(), ilOpenIdConnectSettingsGUI\prepareRoleSelection(), and ILIAS\Calendar\ConsultationHours\BookingDataProvider\read().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ appendUrlParameterString()

static ilUtil::appendUrlParameterString ( string  $a_url,
string  $a_par,
bool  $xml_style = false 
)
static

◆ deducibleSize()

static ilUtil::deducibleSize ( string  $a_mime)
static

checks if mime type is provided by getimagesize()

Deprecated:

Definition at line 929 of file class.ilUtil.php.

929 : bool
930 {
931 if (($a_mime == "image/gif") || ($a_mime == "image/jpeg") ||
932 ($a_mime == "image/png") || ($a_mime == "application/x-shockwave-flash") ||
933 ($a_mime == "image/tiff") || ($a_mime == "image/x-ms-bmp") ||
934 ($a_mime == "image/psd") || ($a_mime == "image/iff")) {
935 return true;
936 } else {
937 return false;
938 }
939 }

Referenced by ilMediaItem\getOriginalSize().

+ Here is the caller graph for this function:

◆ deliverData()

static ilUtil::deliverData ( string  $a_data,
string  $a_filename,
string  $mime = "application/octet-stream" 
)
static
Deprecated:
use ilFileDelivery

Definition at line 358 of file class.ilUtil.php.

362 : void {
363 global $DIC;
364 $delivery = new Delivery(
365 Delivery::DIRECT_PHP_OUTPUT,
366 $DIC->http()
367 );
368 $delivery->setMimeType($mime);
369 $delivery->setSendMimeType(true);
370 $delivery->setDisposition(Delivery::DISP_ATTACHMENT);
371 $delivery->setDownloadFileName($a_filename);
372 $delivery->setConvertFileNameToAsci(true);
373 $repsonse = $DIC->http()->response()->withBody(Streams::ofString($a_data));
374 $DIC->http()->saveResponse($repsonse);
375 $delivery->deliver();
376 }

Referenced by ilMemberExportGUI\deliverData(), ilCertificateUtilHelper\deliverData(), ilObjTest\deliverPDFfromFO(), ILIAS\User\Profile\PublicProfileGUI\deliverVCard(), ilObjLanguageFolderGUI\downloadDeprecatedObject(), ilMemberExportGUI\downloadExportFile(), ilPRGMembersExportGUI\downloadExportFile(), ilObjLanguageExtGUI\downloadObject(), ilSurveyParticipantsGUI\exportAllCodesObject(), ilRegistrationSettingsGUI\exportCodes(), ilSurveyParticipantsGUI\exportCodesObject(), ilSessionOverviewGUI\exportCSV(), ilSurveyEvaluationGUI\exportEvaluationUser(), ilObjLinkResourceGUI\exportHTML(), ilObjTestFolderGUI\exportLegacyLogsObject(), ilObjTestGUI\exportLegacyLogsObject(), ilDidacticTemplateSettingsGUI\exportTemplate(), ilCalendarRemoteAccessHandler\handleRequest(), and ilObjSCORMLearningModule\sendExportFile().

+ Here is the caller graph for this function:

◆ extractParameterString()

static ilUtil::extractParameterString ( string  $a_parstr)
static
Deprecated:

Definition at line 850 of file class.ilUtil.php.

850 : array
851 {
852 // parse parameters in array
853 $par = [];
854 $ok = true;
855 while (($spos = strpos($a_parstr, "=")) && $ok) {
856 // extract parameter
857 $cpar = substr($a_parstr, 0, $spos);
858 $a_parstr = substr($a_parstr, $spos, strlen($a_parstr) - $spos);
859 while (substr($cpar, 0, 1) == "," || substr($cpar, 0, 1) == " " || substr($cpar, 0, 1) == chr(13) || substr(
860 $cpar,
861 0,
862 1
863 ) == chr(10)) {
864 $cpar = substr($cpar, 1, strlen($cpar) - 1);
865 }
866 while (substr($cpar, strlen($cpar) - 1, 1) == " " || substr($cpar, strlen($cpar) - 1, 1) == chr(
867 13
868 ) || substr($cpar, strlen($cpar) - 1, 1) == chr(10)) {
869 $cpar = substr($cpar, 0, strlen($cpar) - 1);
870 }
871
872 // parameter name should only
873 $cpar_old = "";
874 while ($cpar != $cpar_old) {
875 $cpar_old = $cpar;
876 $cpar = preg_replace("/[^a-zA-Z0-9_]/i", "", $cpar);
877 }
878
879 // extract value
880 if ($cpar != "") {
881 if ($spos = strpos($a_parstr, "\"")) {
882 $a_parstr = substr($a_parstr, $spos + 1, strlen($a_parstr) - $spos);
883 $spos = strpos($a_parstr, "\"");
884 if (is_int($spos)) {
885 $cval = substr($a_parstr, 0, $spos);
886 $par[$cpar] = $cval;
887 $a_parstr = substr($a_parstr, $spos + 1, strlen($a_parstr) - $spos - 1);
888 } else {
889 $ok = false;
890 }
891 } else {
892 $ok = false;
893 }
894 }
895 }
896
897 return $ok ? $par : [];
898 }

Referenced by ilPCMediaObjectGUI\saveAliasProperties(), and ilMediaItem\setParameters().

+ Here is the caller graph for this function:

◆ fmtFloat()

static ilUtil::fmtFloat ( float  $a_float,
int  $a_decimals = 0,
?string  $a_dec_point = null,
?string  $a_thousands_sep = null,
bool  $a_suppress_dot_zero = false 
)
staticprotected

format a float

this functions takes php's number_format function and formats the given value with appropriate thousand and decimal separator.

Deprecated:

Definition at line 1385 of file class.ilUtil.php.

1391 : string {
1392 global $DIC;
1393
1394 $lng = $DIC->language();
1395
1396 if ($a_dec_point === null) {
1397 $a_dec_point = ".";
1398 }
1399 if ($a_dec_point === '-lang_sep_decimal-') {
1400 $a_dec_point = ".";
1401 }
1402
1403 if ($a_thousands_sep === null) {
1404 $a_thousands_sep = $lng->txt('lang_sep_thousand');
1405 }
1406 if ($a_thousands_sep === '-lang_sep_thousand-') {
1407 $a_thousands_sep = ",";
1408 }
1409
1410 $txt = number_format($a_float, $a_decimals, $a_dec_point, $a_thousands_sep);
1411
1412 // remove trailing ".0"
1413 if (($a_suppress_dot_zero == 0 || $a_decimals == 0)
1414 && substr($txt, -2) == $a_dec_point . '0'
1415 ) {
1416 $txt = substr($txt, 0, strlen($txt) - 2);
1417 }
1418 if ($a_float == 0 and $txt == "") {
1419 $txt = "0";
1420 }
1421
1422 return $txt;
1423 }
$txt
Definition: error.php:31
global $lng
Definition: privfeed.php:31

◆ formatSize()

static ilUtil::formatSize ( int  $size,
string  $a_mode = 'short',
?ilLanguage  $a_lng = null 
)
static

Returns the specified file size value in a human friendly form.

By default, the oder of magnitude 1024 is used. Thus the value returned by this function is the same value that Windows and Mac OS X return for a file. The value is a GibiBig, MebiBit, KibiBit or byte unit.

For more information about these units see: http://en.wikipedia.org/wiki/Megabyte

Parameters
integersize in bytes
stringmode: "short" is useful for display in the repository "long" is useful for display on the info page of an object
ilLanguageThe language object, or null if you want to use the system language.

Definition at line 1441 of file class.ilUtil.php.

1441 : string
1442 {
1443 global $DIC;
1444
1445 $lng = $DIC->language();
1446 if ($a_lng == null) {
1447 $a_lng = $lng;
1448 }
1449
1450 $mag = 1024;
1451
1452 if ($size >= $mag * $mag * $mag) {
1453 $scaled_size = $size / $mag / $mag / $mag;
1454 $scaled_unit = 'lang_size_gb';
1455 } else {
1456 if ($size >= $mag * $mag) {
1457 $scaled_size = $size / $mag / $mag;
1458 $scaled_unit = 'lang_size_mb';
1459 } else {
1460 if ($size >= $mag) {
1461 $scaled_size = $size / $mag;
1462 $scaled_unit = 'lang_size_kb';
1463 } else {
1464 $scaled_size = $size;
1465 $scaled_unit = 'lang_size_bytes';
1466 }
1467 }
1468 }
1469
1470 $result = self::fmtFloat(
1471 $scaled_size,
1472 ($scaled_unit
1473 == 'lang_size_bytes') ? 0 : 1,
1474 $a_lng->txt('lang_sep_decimal'),
1475 $a_lng->txt('lang_sep_thousand'),
1476 true
1477 )
1478 . ' ' . $a_lng->txt($scaled_unit);
1479 if ($a_mode == 'long' && $size > $mag) {
1480 $result .= ' (' . self::fmtFloat(
1481 $size,
1482 0,
1483 $a_lng->txt('lang_sep_decimal'),
1484 $a_lng->txt('lang_sep_thousand')
1485 ) . ' '
1486 . $a_lng->txt('lang_size_bytes') . ')';
1487 }
1488
1489 return $result;
1490 }
static fmtFloat(float $a_float, int $a_decimals=0, ?string $a_dec_point=null, ?string $a_thousands_sep=null, bool $a_suppress_dot_zero=false)
format a float

References $DIC, and $lng.

Referenced by ilFileSystemTableGUI\fillRow(), ilMemberExportFileTableGUI\fillRow(), ILIAS\Mail\Attachments\MailAttachmentTableGUI\getRows(), ilMailAttachmentGUI\saveAttachments(), and ilMailFormGUI\showForm().

+ Here is the caller graph for this function:

◆ getHtmlPath()

static ilUtil::getHtmlPath ( string  $relative_path)
static

get url of path

Parameters
$relative_pathstring: complete path to file, relative to web root (e.g. /public/data/pfplms103/mobs/mm_732/athena_standing.jpg)
Deprecated:

Definition at line 111 of file class.ilUtil.php.

111 : string
112 {
113 if (substr($relative_path, 0, 2) == './') {
114 $relative_path = (substr($relative_path, 1));
115 }
116 if (substr($relative_path, 0, 1) != '/') {
117 $relative_path = '/' . $relative_path;
118 }
119 $htmlpath = ILIAS_HTTP_PATH . $relative_path;
120 return $htmlpath;
121 }

Referenced by ilAuthFrontendCredentialsApache\tryAuthenticationOnLoginPage().

+ Here is the caller graph for this function:

◆ getImagePath()

static ilUtil::getImagePath ( string  $image_name,
string  $module_path = "",
string  $mode = "output",
bool  $offline = false 
)
static

get image path (for images located in a template directory)

Deprecated:
use UI Service!

Definition at line 68 of file class.ilUtil.php.

73 : string {
74 if ($offline) {
75 return "./images/" . $image_name;
76 }
77
78 global $DIC;
79 $styleDefinition = $DIC["styleDefinition"] ?? null;
80
81 if ($module_path != "") {
82 throw new \LogicException(
83 "\$module_path only supports '' as value."
84 );
85 }
86
87 $use_custom_skin = (ilStyleDefinition::getCurrentSkin() !== "default");
88
89 if ($use_custom_skin) {
90 $filename =
91 "./Customizing/skin/"
94 . (!is_object($styleDefinition) ? "images" : $styleDefinition->getImageDirectory(ilStyleDefinition::getCurrentStyle())) . "/"
95 . $image_name;
96
97 if (file_exists($filename)) {
98 return $filename;
99 }
100 }
101
102 return "./assets/images/" . $image_name;
103 }
$filename
Definition: buildRTE.php:78
static getCurrentSkin()
get the current skin use always this function instead of getting the account's skin the current skin ...
static getCurrentStyle()
get the current style or sub style use always this function instead of getting the account's style th...

Referenced by ilStudyProgrammeIndividualPlanTableGUI\__construct(), ilStudyProgrammeExpandableProgressListGUI\__construct(), ilPollUserTableGUI\__construct(), ILIAS\MediaCast\Video\VideoItem\__construct(), ilRepositoryObjectPlugin\_getImagePath(), ilObjDataCollectionGUI\addHeaderAction(), ILIAS\COPage\Page\PageQueryActionHandler\allCommand(), ilExSubmissionObjectGUI\askUnlinkBlogObject(), ilExSubmissionObjectGUI\askUnlinkPortfolioObject(), ilPersonalSkillsGUI\assignMaterials(), ILIAS\Notifications\ilNotificationPushHandler\buildContent(), ilLPStatusIcons\buildImagePath(), assMatchingQuestionGUI\buildTermHtml(), ilMembershipGUI\confirmAssignFromWaitingList(), ilMembershipGUI\confirmAssignSubscribers(), ilMembershipGUI\confirmDeleteParticipants(), ilSessionMembershipGUI\confirmDeleteParticipants(), ilObjRoleGUI\confirmDeleteRoleObject(), ilObjMediaCastGUI\confirmDeletionItemsObject(), ilMembershipGUI\confirmRefuseFromList(), ilMembershipGUI\confirmRefuseSubscribers(), ilObjForumGUI\decorateWithAutosave(), ilObjSkillTreeGUI\deleteNodes(), ilPDNewsGUI\displayHeader(), ilPDNotesGUI\displayHeader(), ilPageObjectGUI\displayMedia(), ilLMPageObjectGUI\editLayout(), ilObjTypeDefinitionGUI\editObject(), ilObjSessionGUI\eventsListObject(), ilBlogPostingGUI\executeCommand(), ilPCInteractiveImageGUI\executeCommand(), ilAchievementsGUI\executeCommand(), ilLMPageObjectGUI\executeCommand(), ilPersonalNotificationsSettingsGUI\executeCommand(), ilPortfolioRepositoryGUI\executeCommand(), ilObjSAHSLearningModuleGUI\executeCommand(), ilSystemStyleHTMLExport\export(), ilTable2GUI\fillActionRow(), ilDataCollectionGlobalTemplate\fillAdminPanel(), ilLuceneSearchGUI\fillAdminPanel(), ilGlobalTemplate\fillAdminPanel(), ILIAS\components\UICore\MetaTemplate\PageContentGUI\fillAdminPanel(), ilTable2GUI\fillHeader(), ilAccessPermissionsStatusTableGUI\fillRow(), ilAvailableRolesStatusTableGUI\fillRow(), ilShibbolethRoleAssignmentTableGUI\fillRow(), ilCalendarInboxSharedTableGUI\fillRow(), ilCalendarManageTableGUI\fillRow(), ilCalendarSharedListTableGUI\fillRow(), ilPageLayoutTableGUI\fillRow(), ilCourseObjectiveQuestionsTableGUI\fillRow(), ilTimingsManageTableGUI\fillRow(), ilTimingsPersonalTableGUI\fillRow(), ilCourseReferenceDeleteConfirmationTableGUI\fillRow(), ilFileSystemTableGUI\fillRow(), ilHistoryTableGUI\fillRow(), ilItemGroupItemsTableGUI\fillRow(), ilExportIDTableGUI\fillRow(), ilLMPagesTableGUI\fillRow(), ilMediaPoolTableGUI\fillRow(), ilClipboardTableGUI\fillRow(), ilSessionMaterialsTableGUI\fillRow(), ilSessionOverviewTableGUI\fillRow(), ilSurveyQuestionTableGUI\fillRow(), ilSurveyQuestionsTableGUI\fillRow(), ilQuestionBrowserTableGUI\fillRow(), ilLPCollectionSettingsTableGUI\fillRow(), ilLPProgressTableGUI\fillRow(), ilTrMatrixTableGUI\fillRow(), ilTrObjectUsersPropsTableGUI\fillRow(), ilTrUserObjectsPropsTableGUI\fillRow(), ilECSServerTableGUI\fillRow(), ilDataCollectionGlobalTemplate\fillSideIcons(), ilGlobalTemplate\fillSideIcons(), assQuestion\fixUnavailableSkinImageSources(), ilSCORMPresentationGUI\frameset(), assQuestionGUI\generateCorrectnessIconsForCorrectness(), ilForumThreadFormGUI\generateInputItems(), ilUserAvatarResolver\getAvatar(), ILIAS\Mail\Folder\MailFolderTableUI\getAvatar(), ilPCInteractiveImage\getBackgroundImage(), ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable\getColums(), ilAssNestedOrderingElementsInputGUI\getCorrectnessIcon(), ilBadgeLearningHistoryProvider\getEntries(), ilCourseLearningHistoryProvider\getEntries(), ilFirstLoginLearningHistoryProvider\getEntries(), ilSkillLearningHistoryProvider\getEntries(), ilStudyProgrammeExpandableProgressListGUI\getExpandedImageURL(), ILIAS\GlobalScreen\Scope\Layout\Provider\PagePart\StandardPagePartProvider\getFaviconPath(), ilMainMenuSearchGUI\getHTML(), ilNewsTimelineGUI\getHTML(), ilAdvancedSelectionListGUI\getHTML(), ilDclBooleanRecordRepresentation\getHTML(), ILIAS\File\Icon\IconDatabaseRepository\getIconFilePathBySuffix(), ILIAS\Administration\AdministrationMainBarProvider\getIconForGroup(), ilObject\getIconForType(), ilSkillTreeNode\getIconPath(), ilObjSCORMInitData\getIliasScormVars(), ilSCORM13PlayerGUI\getInlineCSS(), ilCalendarSelectionBlockGUI\getLegacyContent(), ilPDMailBlockGUI\getListItemForData(), ILIAS\COPage\PC\InteractiveImage\InteractiveImageQueryActionHandler\getLoader(), ILIAS\GlobalScreen\Scope\Layout\Provider\PagePart\StandardPagePartProvider\getLogo(), ilLMHtmlExportViewLayoutProvider\getMainBarModification(), ILIAS\Test\Results\Presentation\AttemptResultsTable\getMapping(), ILIAS\User\Presentation\UserMetaBarProvider\getMetaBarItems(), ilLMEditorExplorerGUI\getNodeIcon(), ilLMTOCExplorerGUI\getNodeIcon(), ilMailExplorer\getNodeIcon(), ilMediaPoolExplorerGUI\getNodeIcon(), ilWorkspaceExplorerGUI\getNodeIcon(), ilPersonalSkillExplorerGUI\getNodeIcon(), ilSkillTemplateTreeExplorerGUI\getNodeIcon(), ilSkillTreeExplorerGUI\getNodeIcon(), ilVirtualSkillTreeExplorerGUI\getNodeIcon(), ilTaxonomyExplorerGUI\getNodeIcon(), ilPRGActionNoteBuilder\getNoteFor(), ilStudyProgrammeExpandableProgressListGUI\getNotExpandedImageURL(), ilExplorer\getOutput(), ilSCORMExplorer\getOutputIcons(), ILIAS\Portfolio\PortfolioPrintViewProviderGUI\getPages(), ilPortfolioRepositoryGUI\getPortfolioList(), ilTestQuestionHeaderBlockBuilder\getQuestionInfoHTML(), ilTestQuestionNavigationGUI\getQuestionMarkIconSource(), ilDidacticTemplateSettingsTableDataRetrieval\getRecords(), ILIAS\GlobalScreen\Scope\Layout\Provider\PagePart\StandardPagePartProvider\getResponsiveLogo(), ilTestServiceGUI\getResultsSignature(), ILIAS\Blog\BlogPrintViewProviderGUI\getSelectionForm(), ILIAS\Portfolio\PortfolioPrintViewProviderGUI\getSelectionForm(), ILIAS\Wiki\WikiPrintViewProviderGUI\getSelectionForm(), ILIAS\EmployeeTalk\Provider\MyStaffListEntryProvider\getStaticSubItems(), ILIAS\Membership\GlobalScreen\MembershipMainBarProvider\getStaticSubItems(), ILIAS\MyStaff\Provider\StaffMainBarProvider\getStaticSubItems(), ILIAS\Repository\Provider\RepositoryMainBarProvider\getStaticSubItems(), ILIAS\MainMenu\Provider\StandardTopItemsProvider\getStaticTopItems(), ILIAS\components\Authentication\Pages\AuthPageLanguagesOverviewTable\getStatusIcon(), ilPRGStatusInfoBuilder\getStatusInfoFor(), ilObjGlossaryGUI\getTemplate(), ilCOPageEditGSToolProvider\getToolsForContextStack(), ilLMEditGSToolProvider\getToolsForContextStack(), ilMediaPoolGSToolProvider\getToolsForContextStack(), ilSkillGSToolProvider\getToolsForContextStack(), ilTaxonomyGSToolProvider\getToolsForContextStack(), ILIAS\COPage\Page\PageQueryActionHandler\getTopActions(), ilLMPresentationGUI\ilMedia(), ilLMPageObjectGUI\initEditLayoutForm(), ilObjGroupGUI\initForm(), ilObjLTIConsumerGUI\initHeaderAction(), ilObjBookingPoolGUI\initHeaderAction(), ilObjCmiXapiGUI\initHeaderAction(), ilObjCourseGUI\initHeaderAction(), ilObjForumGUI\initHeaderAction(), ilObjGroupGUI\initHeaderAction(), ilObjStudyProgrammeGUI\initHeaderAction(), ILIAS\Chatroom\BuildChat\initialData(), ilOnScreenChatGUI\initializeFrontend(), ilAwarenessGUI\initJS(), ilObjLTIConsumerListGUI\insertIconsAndCheckboxes(), ilObjectListGUI\insertInfoScreenCommand(), ilObjOrgUnitListGUI\insertInfoScreenCommand(), ilPCResourcesGUI\insertResourcesIntoPageContent(), ilUserCertificateGUI\listCertificates(), ilPersonalSkillsGUI\listProfileForGap(), ilGlossaryTermGUI\listUsages(), ilMStListCertificatesGUI\listUsers(), ilMStListCompetencesSkillsGUI\listUsers(), ilMStListCoursesGUI\listUsers(), ilMStListUsersGUI\listUsers(), ilEmployeeTalkMyStaffListGUI\loadHeader(), ilGlossaryPresentationGUI\media(), assMatchingQuestionGUI\populateDefinition(), ilDashboardGUI\prepareContentView(), ilCalendarPresentationGUI\prepareOutput(), ilGlossaryPresentationGUI\prepareOutput(), ilTable2GUI\render(), ilTableGUI\render(), ilProgressBar\render(), ilLMNavigationRendererGUI\render(), ilCalendarSelectionBlockGUI\renderItem(), ILIAS\Chatroom\BuildChat\renderLanguageVariables(), ilObjLearningSequenceContentGUI\renderTable(), ilPersonalSkillsGUI\saveSelfEvaluation(), ilPersonalSkillsGUI\selfEvaluation(), ilBadgeHandler\sendNotification(), ilLMPresentationGUI\setHeader(), ilImageLinkButton\setImage(), ilSAHSPresentationGUI\setInfoTabs(), ilObjTaxonomyGUI\setTabs(), ilStructureObjectGUI\setTabs(), ilObjMediaObjectGUI\setTabs(), ilObjSAHSLearningModuleGUI\setTabs(), ilPageLayoutGUI\setTabs(), ilObjLanguageExtGUI\setTitleAndDescription(), ilObjPortfolioGUI\setTitleAndDescription(), ilObjUserGUI\setTitleAndDescription(), ilObjWorkspaceRootFolderGUI\setTitleAndDescription(), ilDashboardGUI\show(), ilMembershipOverviewGUI\show(), ilDerivedTasksGUI\show(), ilLMObjectGUI\showActions(), ilObjContentObjectGUI\showActions(), ilContentStyleSettingsGUI\showActions(), ilContainerGUI\showAdministrationPanel(), ilObjWorkspaceFolderGUI\showAdministrationPanel(), ilPasswordAssistanceGUI\showAssistanceForm(), ilLTIConsumerContentGUI\showEmbedded(), ilMailGUI\showHeader(), ilInternalLinkGUI\showLinkHelp(), ilObjMediaPoolGUI\showMedia(), ilPasswordAssistanceGUI\showMessageForm(), ilPageObjectGUI\showPage(), ilContainerGUI\showPasteTreeObject(), ilLMPresentationGUI\showPrintView(), ilLMPresentationGUI\showPrintViewSelection(), ilMailSearchGUI\showResults(), ilLocalUserGUI\showRolesTable(), ilAssQuestionSkillAssignmentsGUI\showSkillSelectionCmd(), ilCourseContentGUI\showStartObjects(), ilContactGUI\showSubTabs(), ilObjectCopyGUI\showTargetSelectionTree(), ilMailFolderGUI\showUser(), ilPasswordAssistanceGUI\showUsernameAssistanceForm(), ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable\taxonomyRepresentation(), and ILIAS\LearningModule\Editing\SubObjectTableBuilder\transformRow().

+ Here is the caller graph for this function:

◆ getImageTagByType()

static ilUtil::getImageTagByType ( string  $a_type,
string  $a_path,
bool  $a_big = false 
)
static

Builds an html image tag.

Deprecated:
Use UI-Service!

Definition at line 45 of file class.ilUtil.php.

45 : string
46 {
47 global $DIC;
48
49 $lng = $DIC->language();
50
51 $size = ($a_big)
52 ? "big"
53 : "small";
54
55 $filename = ilObject::_getIcon(0, $size, $a_type);
56
57 return "<img src=\"" . $filename . "\" alt=\"" . $lng->txt("obj_" . $a_type) . "\" title=\"" . $lng->txt(
58 "obj_" . $a_type
59 ) . "\" border=\"0\" vspace=\"0\"/>";
60 }
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.

References $DIC, $filename, $lng, and ilObject\_getIcon().

Referenced by ilObjTypeDefinitionGUI\displayList(), and ilObjTypeDefinitionGUI\editObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNewContentStyleSheetLocation()

static ilUtil::getNewContentStyleSheetLocation ( string  $mode = "output")
static

get full style sheet file name (path inclusive) of current user

Deprecated:

Definition at line 182 of file class.ilUtil.php.

182 : string
183 {
184
185 // use ilStyleDefinition instead of account to get the current skin and style
186 if (ilStyleDefinition::getCurrentSkin() == "default") {
187 $in_style = "./templates/" . ilStyleDefinition::getCurrentSkin() . "/"
188 . ilStyleDefinition::getCurrentStyle() . "_cont.css";
189 } else {
190 $in_style = "./Customizing/skin/" . ilStyleDefinition::getCurrentSkin() . "/"
191 . ilStyleDefinition::getCurrentStyle() . "_cont.css";
192 }
193
194 if (is_file("./" . $in_style)) {
195 return $in_style;
196 } else {
197 return "assets/css/delos_cont.css";
198 }
199 }

References ilStyleDefinition\getCurrentSkin(), and ilStyleDefinition\getCurrentStyle().

Referenced by ilTinyMCE\addCustomRTESupport(), ilTinyMCE\addUserTextEditor(), ilDataCollectionGlobalTemplate\fillNewContentStyle(), ilGlobalTemplate\fillNewContentStyle(), and ilGlobalPageTemplate\prepareBasicCSS().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSecureTags()

static ilUtil::getSecureTags ( )
static

Definition at line 480 of file class.ilUtil.php.

480 : array
481 {
482 return ["strong",
483 "em",
484 "u",
485 "strike",
486 "ol",
487 "li",
488 "ul",
489 "p",
490 "div",
491 "i",
492 "b",
493 "code",
494 "sup",
495 "sub",
496 "pre",
497 "gap",
498 "a",
499 "img",
500 "bdo"
501 ];
502 }

Referenced by ilAssSelfAssessmentQuestionFormatter\getSelfAssessmentTags(), and secureString().

+ Here is the caller graph for this function:

◆ getStyleSheetLocation()

static ilUtil::getStyleSheetLocation ( string  $mode = "output",
string  $a_css_name = "" 
)
static

get full style sheet file name (path inclusive) of current user

Parameters
$modestring Output mode of the style sheet ("output" or "filesystem"). !"filesystem" generates the ILIAS version number as attribute to force the reload of the style sheet in a different ILIAS version
$a_css_namestring The name of the style sheet. If empty, the default style name will be chosen
$a_css_locationstring The location of the style sheet e.g. a module path. This parameter only makes sense when $a_css_name is used
Deprecated:

Definition at line 133 of file class.ilUtil.php.

136 : string {
137 $force_reload = ($mode !== "filesystem");
138 $use_default_style_file = ($a_css_name === "");
139 $use_custom_skin = (ilStyleDefinition::getCurrentSkin() !== "default");
140
141 // use ilStyleDefinition instead of account to get the current style
142
143 if ($use_default_style_file) {
144 $stylesheet_name = ilStyleDefinition::getCurrentStyle() . ".css";
145 } else {
146 $stylesheet_name = $a_css_name;
147 }
148
149 if ($use_custom_skin) {
150 $filename =
151 "./Customizing/skin/"
154 . $stylesheet_name;
155 } else {
156 $filename = "./assets/css/" . $stylesheet_name;
157 }
158
159 if (!$force_reload) {
160 return $filename;
161 }
162
163 // add version as parameter to force reload for new releases
164
165 // use version from template xml to force reload on changes
167 $skin_version = $skin->getVersion();
168 if ($skin_version !== "") {
169 $skin_version_appendix = str_replace(".", "-", $skin_version);
170 } else {
171 $skin_version_appendix = '0';
172 }
173
174 return $filename . "?skin_version=" . $skin_version_appendix;
175 }

References ilStyleDefinition\getCurrentStyle().

Referenced by ilTinyMCE\addUserTextEditor(), ilSCORMPresentationGUI\contentSelect(), ilObjTest\deliverPDFfromHTML(), ilPageObjectGUI\displayMedia(), ilObjSurveyQuestionPoolGUI\executeCommand(), ilSCORMPresentationGUI\explorer(), ilSystemStyleHTMLExport\export(), ILIAS\COPage\Page\PageQueryActionHandler\getConfig(), ILIAS\Notes\Export\NotesHtmlExport\getInitialisedTemplate(), ilExplorer\getOutput(), ilSCORM13PlayerGUI\getPlayer(), ilPlugin\getStyleSheetLocation(), ILIAS\Glossary\Export\GlossaryHtmlExport\initScreen(), ilGlossaryPresentationGUI\media(), ilTestPlayerAbstractGUI\outCorrectSolution(), ilTestServiceGUI\outCorrectSolution(), ilLMPresentationGUI\page(), ilGlobalPageTemplate\prepareBasicCSS(), ILIAS\Test\Questions\Presentation\Printer\printAnswers(), ilForumExportGUI\printPost(), ilForumExportGUI\printThread(), ILIAS\Export\PrintProcessGUI\renderPrintView(), ilTestEvaluationGUI\setCss(), ilLMPresentationGUI\setSystemStyle(), ilInternalLinkGUI\showLinkHelp(), ilContainerGUI\showLinkListObject(), ilTestPlayerAbstractGUI\showListOfAnswers(), ilObjMediaPoolGUI\showMedia(), ilPageObjectGUI\showMediaFullscreen(), ilObjMediaPoolGUI\showPage(), ilSCORM13PlayerGUI\specialPage(), ilSAHSPresentationGUI\view(), and ilSCORMPresentationGUI\view().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSystemMessageHTML()

static ilUtil::getSystemMessageHTML ( string  $a_txt,
string  $a_type = "info" 
)
static

Get HTML for a system message.

Deprecated:
replace with UI Compoenten in ilGlobalPageTemplate ATTENTION: This method is deprecated. Use MessageBox from the UI-framework instead.

Definition at line 1253 of file class.ilUtil.php.

1254 {
1255 global $DIC;
1256
1257 $box_factory = $DIC->ui()->factory()->messageBox();
1258 switch ($a_type) {
1259 case 'info':
1260 $box = $box_factory->info($a_txt);
1261 break;
1262 case 'success':
1263 $box = $box_factory->success($a_txt);
1264 break;
1265 case 'question':
1266 $box = $box_factory->confirmation($a_txt);
1267 break;
1268 case 'failure':
1269 $box = $box_factory->failure($a_txt);
1270 break;
1271 default:
1272 throw new InvalidArgumentException();
1273 }
1274
1275 return $DIC->ui()->renderer()->render($box);
1276 }

References $DIC.

Referenced by ilGroupAddToGroupActionGUI\addUser(), ilTestPasswordProtectionGUI\buildPasswordMsg(), ilGroupAddToGroupActionGUI\confirmAddUser(), ilGroupAddToGroupActionGUI\confirmCreateGroupAndAddUser(), ilGroupAddToGroupActionGUI\createGroup(), ilGroupAddToGroupActionGUI\createGroupAndAddUser(), ilDataCollectionGlobalTemplate\fillMessage(), ilGlobalTemplate\fillMessage(), ilClassificationBlockGUI\filterContainer(), ilCalendarAgendaListGUI\getHTML(), ilTaggingGUI\getHTML(), ilInternalLinkGUI\getUserSearchResult(), ilDclRecordEditGUI\save(), ilGroupAddToGroupActionGUI\selectParent(), ilDclRecordEditGUI\sendFailure(), and ilGroupAddToGroupActionGUI\show().

+ Here is the caller graph for this function:

◆ groupNameExists()

static ilUtil::groupNameExists ( string  $a_group_name,
?int  $a_id = null 
)
static

checks if group name already exists.

Groupnames must be unique for mailing purposes static function

@access public

Parameters
stringgroupname
integerobj_id of group to exclude from the check.
Returns
boolean true if exists

Definition at line 981 of file class.ilUtil.php.

981 : bool
982 {
983 global $DIC;
984
985 $ilDB = $DIC->database();
986
987 $ilErr = null;
988 if (isset($DIC["ilErr"])) {
989 $ilErr = $DIC["ilErr"];
990 }
991
992 if (empty($a_group_name)) {
993 $message = __METHOD__ . ": No groupname given!";
994 $ilErr->raiseError($message, $ilErr->WARNING);
995 }
996
997 $clause = ($a_id !== null) ? " AND obj_id != " . $ilDB->quote($a_id) . " " : "";
998
999 $q = "SELECT obj_id FROM object_data " .
1000 "WHERE title = " . $ilDB->quote($a_group_name, "text") . " " .
1001 "AND type = " . $ilDB->quote("grp", "text") .
1002 $clause;
1003
1004 $r = $ilDB->query($q);
1005
1006 return $r->numRows() > 0;
1007 }
$ilErr
Definition: raiseError.php:33
$q
Definition: shib_logout.php:23
$message
Definition: xapiexit.php:31

References $DIC, $ilDB, $ilErr, $message, and $q.

Referenced by ilGroupNameAsMailValidator\__construct(), ilMailAddressTypeHelperImpl\doesGroupNameExists(), and ilSoapGroupAdministration\groupExists().

+ Here is the caller graph for this function:

◆ htmlencodePlainString()

static ilUtil::htmlencodePlainString ( string  $a_str,
bool  $a_make_links_clickable,
bool  $a_detect_goto_links = false 
)
static

Encodes a plain text string into HTML for display in a browser.

This function encodes HTML special characters: < > & with < > & and converts newlines into

If $a_make_links_clickable is set to true, URLs in the plain string which are considered to be safe, are made clickable.

Parameters
stringthe plain text string
booleanset this to true, to make links in the plain string clickable.
booleanset this to true, to detect goto links

Definition at line 594 of file class.ilUtil.php.

598 : string {
599 $encoded = "";
600
601 if ($a_make_links_clickable) {
602 // Find text sequences in the plain text string which match
603 // the URI syntax rules, and pass them to ilUtil::makeClickable.
604 // Encode all other text sequences in the plain text string using
605 // htmlspecialchars and nl2br.
606 // The following expressions matches URI's as specified in RFC 2396.
607 //
608 // The expression matches URI's, which start with some well known
609 // schemes, like "http:", or with "www.". This must be followed
610 // by at least one of the following RFC 2396 expressions:
611 // - alphanum: [a-zA-Z0-9]
612 // - reserved: [;\/?:|&=+$,]
613 // - mark: [\\-_.!~*\'()]
614 // - escaped: %[0-9a-fA-F]{2}
615 // - fragment delimiter: #
616 // - uric_no_slash: [;?:@&=+$,]
617 $matches = [];
618 $numberOfMatches = preg_match_all(
619 '/(?:(?:http|https|ftp|ftps|mailto):|www\.)(?:[a-zA-Z0-9]|[;\/?:|&=+$,]|[\\-_.!~*\'()]|%[0-9a-fA-F]{2}|#|[;?:@&=+$,])+/',
620 $a_str,
621 $matches,
622 PREG_OFFSET_CAPTURE
623 );
624 $pos1 = 0;
625 $encoded = "";
626
627 foreach ($matches[0] as $match) {
628 $matched_text = $match[0];
629 $pos2 = $match[1];
630
631 // encode plain text
632 $encoded .= nl2br(htmlspecialchars(substr($a_str, $pos1, $pos2 - $pos1)));
633
634 // encode URI
635 $encoded .= ilUtil::makeClickable($matched_text, $a_detect_goto_links);
636
637
638 $pos1 = $pos2 + strlen($matched_text);
639 }
640 if ($pos1 < strlen($a_str)) {
641 $encoded .= nl2br(htmlspecialchars(substr($a_str, $pos1)));
642 }
643 } else {
644 $encoded = nl2br(htmlspecialchars($a_str));
645 }
646 return $encoded;
647 }
static makeClickable(string $a_text, bool $detectGotoLinks=false, ?string $ilias_http_path=null)

References makeClickable().

+ Here is the call graph for this function:

◆ img()

static ilUtil::img ( string  $a_src,
?string  $a_alt = null,
  $a_width = "",
  $a_height = "",
  $a_border = 0,
  $a_id = "",
  $a_class = "" 
)
static

Build img tag.

Deprecated:

Definition at line 325 of file class.ilUtil.php.

333 {
334 $img = '<img src="' . $a_src . '"';
335 if (!is_null($a_alt)) {
336 $img .= ' alt="' . htmlspecialchars($a_alt) . '"';
337 }
338 if ($a_width != "") {
339 $img .= ' width="' . htmlspecialchars($a_width) . '"';
340 }
341 if ($a_height != "") {
342 $img .= ' height="' . htmlspecialchars($a_height) . '"';
343 }
344 if ($a_class != "") {
345 $img .= ' class="' . $a_class . '"';
346 }
347 if ($a_id != "") {
348 $img .= ' id="' . $a_id . '"';
349 }
350 $img .= ' />';
351
352 return $img;
353 }

Referenced by ilTable2GUI\fillHeader(), ilItemGroupItemsTableGUI\fillRow(), ilExportIDTableGUI\fillRow(), ilLMPagesTableGUI\fillRow(), ilMediaPoolTableGUI\fillRow(), ilAdminSubItemsTableGUI\fillRow(), ilSearchResultTableGUI\fillRow(), ilObjClipboardTableGUI\fillRow(), ILIAS\Repository\Provider\RepositoryMainBarProvider\getHomeItem(), ilMainMenuSearchGUI\getHTML(), ilNoteGUI\getOriginHeader(), ilLMPageObjectGUI\initEditLayoutForm(), ilOnScreenChatGUI\initializeFrontend(), ilPCResourcesGUI\insertResourcesIntoPageContent(), ilSCORM2004TrackingItemsTableGUI\parseValue(), ilSCORMTrackingItemsTableGUI\parseValue(), ilNestedListInputGUI\render(), and ilExplorerBaseGUI\renderNode().

+ Here is the caller graph for this function:

◆ insertInstIntoID()

static ilUtil::insertInstIntoID ( string  $a_value)
static

inserts installation id into ILIAS id

e.g. "il__pg_3" -> "il_43_pg_3"

Deprecated:

Definition at line 961 of file class.ilUtil.php.

961 : string
962 {
963 if (substr($a_value, 0, 4) == "il__") {
964 $a_value = "il_" . IL_INST_ID . "_" . substr($a_value, 4, strlen($a_value) - 4);
965 }
966
967 return $a_value;
968 }
const IL_INST_ID
Definition: constants.php:40

References IL_INST_ID.

Referenced by ilObjTest\modifyExportIdentifier(), ilObjQuestionPool\modifyExportIdentifier(), and ilObjMediaObject\modifyExportIdentifier().

+ Here is the caller graph for this function:

◆ is_email()

static ilUtil::is_email ( string  $a_email,
?ilMailRfc822AddressParserFactory  $mailAddressParserFactory = null 
)
static

This preg-based function checks whether an e-mail address is formally valid.

It works with all top level domains including the new ones (.biz, .info, .museum etc.) and the special ones (.arpa, .int etc.) as well as with e-mail addresses based on IPs (e.g. webma.nosp@m.ster.nosp@m.@123..nosp@m.45.1.nosp@m.23.45) Valid top level domains: http://data.iana.org/TLD/tlds-alpha-by-domain.txt

Deprecated:
use ilMailRfc822AddressParserFactory directly

Definition at line 279 of file class.ilUtil.php.

282 : bool {
283 if ($mailAddressParserFactory === null) {
284 $mailAddressParserFactory = new ilMailRfc822AddressParserFactory();
285 }
286
287 try {
288 $parser = $mailAddressParserFactory->getParser($a_email);
289 $addresses = $parser->parse();
290 return count($addresses) == 1 && $addresses[0]->getHost() != ilMail::ILIAS_HOST;
291 } catch (ilException $e) {
292 return false;
293 }
294 }
Base class for ILIAS Exception handling.
const string ILIAS_HOST

Referenced by ilEMailInputGUI\checkInput(), ilPasswordAssistanceGUI\emailTrafo(), ilCmiXapiUser\getIdent(), ilSurveyExecutionGUI\mailUserResults(), ilObjSurveyGUI\mailUserResultsObject(), ilCalendarUserNotification\validate(), and ilObjCourse\validateInfoSettings().

+ Here is the caller graph for this function:

◆ isHTML()

static ilUtil::isHTML ( string  $a_text)
static

Checks if a given string contains HTML or not.

Parameters
string$a_textText which should be checked
Returns
boolean @access public

Definition at line 1165 of file class.ilUtil.php.

1165 : bool
1166 {
1167 if (strlen(strip_tags($a_text)) < strlen($a_text)) {
1168 return true;
1169 }
1170
1171 return false;
1172 }

Referenced by assQuestionExport\addQTIMaterial(), assTextQuestion\getSolutionSubmit(), ilAssSelfAssessmentQuestionFormatter\handleLineBreaks(), ilLegacyFormElementsUtil\prepareTextareaOutput(), and assMatchingQuestionExport\toXML().

+ Here is the caller graph for this function:

◆ isLogin()

static ilUtil::isLogin ( string  $a_login)
static
Deprecated:

Definition at line 299 of file class.ilUtil.php.

299 : bool
300 {
301 if (empty($a_login)) {
302 return false;
303 }
304
305 if (strlen($a_login) < 3) {
306 return false;
307 }
308
309 // FIXME - If ILIAS is configured to use RFC 822
310 // compliant mail addresses we should not
311 // allow the @ character.
312 if (!preg_match("/^[A-Za-z0-9_\.\+\*\@!\$\%\~\-]+$/", $a_login)) {
313 return false;
314 }
315
316 return true;
317 }

Referenced by ilUserLoginInputGUI\checkInput(), ilAuthProviderApache\doAuthentication(), ilAccountRegistrationGUI\saveForm(), and ILIAS\User\Profile\PersonalProfileGUI\updateLoginOrSetErrorMessages().

+ Here is the caller graph for this function:

◆ isWindows()

static ilUtil::isWindows ( )
static
Deprecated:

Definition at line 1012 of file class.ilUtil.php.

1012 : bool
1013 {
1014 return (strtolower(substr(php_uname(), 0, 3)) === "win");
1015 }

Referenced by ilGitInformation\detect(), ilImagemapPreview\execQuoted(), and ilShellUtil\execQuoted().

+ Here is the caller graph for this function:

◆ makeClickable()

static ilUtil::makeClickable ( string  $a_text,
bool  $detectGotoLinks = false,
?string  $ilias_http_path = null 
)
static
Deprecated:
Use the respective Refinery transformation $refinery->string()->makeClickable("foo bar") to convert URL-like string parts to an HTML anchor (<a>) element. Will be removed in ILIAS 10.

Definition at line 220 of file class.ilUtil.php.

224 : string {
225 global $DIC;
226
227 $ret = $DIC->refinery()->string()->makeClickable()->transform($a_text);
228
229 if ($detectGotoLinks) {
230 $ilias_http_path = $ilias_http_path ?? (defined('ILIAS_HTTP_PATH') ? ILIAS_HTTP_PATH : '');
231
232 $goto = '<a[^>]*href="(' . str_replace('@', '\@', $ilias_http_path) . '/goto';
233 $regExp = $goto . '.php\?target=\w+_(\d+)[^"]*)"[^>]*>[^<]*</a>';
234 $ret = preg_replace_callback(
235 '@' . $regExp . '@i',
236 [self::class, 'replaceLinkProperties'],
237 $ret
238 );
239
240 // Edited this regex to allow multiple links in $ret: .* to [^"><]*.
241 $regExp = $goto . '_[^"><]*[a-z0-9]+_([0-9]+)\.html)"[^>]*>[^<]*</a>';
242 $ret = preg_replace_callback(
243 '@' . $regExp . '@i',
244 [self::class, 'replaceLinkProperties'],
245 $ret
246 );
247 }
248
249 return $ret;
250 }

Referenced by ilAppointmentPresentationGUI\addEventDescription(), ilAppointmentPresentationCourseGUI\collectPropertiesAndActions(), ilAppointmentPresentationGroupGUI\collectPropertiesAndActions(), ilAppointmentPresentationSessionGUI\collectPropertiesAndActions(), ilCourseRegistrationGUI\fillInformations(), ilGroupRegistrationGUI\fillInformations(), ilPDNewsTableGUI\fillRow(), ilCalendarAppointmentPanelGUI\getHTML(), ilADTExternalLinkPresentationBridge\getHTML(), htmlencodePlainString(), ilObjCourseGUI\infoScreen(), ilObjGroupGUI\infoScreen(), ilNewsForContextBlockGUI\makeClickable(), ilPDNewsTableGUI\makeClickable(), and ilUtilTest\testMakeClickableWithoutGotoLinks().

+ Here is the caller graph for this function:

◆ maskAttributeTag()

static ilUtil::maskAttributeTag ( string  $a_str,
string  $tag,
string  $tag_att 
)
staticprivate

Definition at line 649 of file class.ilUtil.php.

649 : string
650 {
651 global $DIC;
652
653 $ilLog = $DIC["ilLog"];
654
655 $ws = "[\s]*";
656 $att = $ws . "[^>]*" . $ws;
657
658 while (preg_match(
659 '/<(' . $tag . $att . '(' . $tag_att . $ws . '="' . $ws . '(([$@!*()~;,_0-9A-z\/:=%.&#?+\-])*)")' . $att . ')>/i',
660 $a_str,
661 $found
662 )) {
663 $old_str = $a_str;
664 $a_str = preg_replace(
665 "/<" . preg_quote($found[1], "/") . ">/i",
666 '&lt;' . $tag . ' ' . $tag_att . $tag_att . '="' . $found[3] . '"&gt;',
667 $a_str
668 );
669 if ($old_str == $a_str) {
670 $ilLog->write(
671 "ilUtil::maskA-" . htmlentities($old_str) . " == " .
672 htmlentities($a_str)
673 );
674 return $a_str;
675 }
676 }
677 $a_str = str_ireplace(
678 "</$tag>",
679 "&lt;/$tag&gt;",
680 $a_str
681 );
682 return $a_str;
683 }

References $DIC.

Referenced by maskSecureTags().

+ Here is the caller graph for this function:

◆ maskSecureTags()

static ilUtil::maskSecureTags ( string  $a_str,
array  $allow_array 
)
staticprivate

Definition at line 504 of file class.ilUtil.php.

504 : string
505 {
506 foreach ($allow_array as $t) {
507 switch ($t) {
508 case "a":
509 $a_str = ilUtil::maskAttributeTag($a_str, "a", "href");
510 break;
511
512 case "img":
513 $a_str = ilUtil::maskAttributeTag($a_str, "img", "src");
514 break;
515
516 case "p":
517 case "div":
518 $a_str = ilUtil::maskTag($a_str, $t, [
519 ["param" => "align", "value" => "left"],
520 ["param" => "align", "value" => "center"],
521 ["param" => "align", "value" => "justify"],
522 ["param" => "align", "value" => "right"]
523 ]);
524 break;
525
526 default:
527 $a_str = ilUtil::maskTag($a_str, $t);
528 break;
529 }
530 }
531
532 return $a_str;
533 }
static maskTag(string $a_str, string $tag, array $fix_param=[])
static maskAttributeTag(string $a_str, string $tag, string $tag_att)

References maskAttributeTag(), and maskTag().

Referenced by secureString().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ maskTag()

static ilUtil::maskTag ( string  $a_str,
string  $tag,
array  $fix_param = [] 
)
static

Definition at line 714 of file class.ilUtil.php.

714 : string
715 {
716 $a_str = str_replace(
717 ["<$tag>", "<" . strtoupper($tag) . ">"],
718 "&lt;" . $tag . "&gt;",
719 $a_str
720 );
721 $a_str = str_replace(
722 ["</$tag>", "</" . strtoupper($tag) . ">"],
723 "&lt;/" . $tag . "&gt;",
724 $a_str
725 );
726
727 foreach ($fix_param as $p) {
728 $k = $p["param"];
729 $v = $p["value"];
730 $a_str = str_replace(
731 "<$tag $k=\"$v\">",
732 "&lt;" . "$tag $k=\"$v\"" . "&gt;",
733 $a_str
734 );
735 }
736
737 return $a_str;
738 }

Referenced by maskSecureTags().

+ Here is the caller graph for this function:

◆ now()

static ilUtil::now ( )
static

Return current timestamp in Y-m-d H:i:s format.

Deprecated:

Definition at line 1022 of file class.ilUtil.php.

1022 : string
1023 {
1024 return date("Y-m-d H:i:s");
1025 }

Referenced by ilHistory\_copyEntriesForObject(), ilObjSCORMTracking\_insertTrackData(), ILIAS\Skill\Profile\SkillProfileCompletionDBRepository\addFulfilmentEntry(), ilSkillLevelDBRepository\addLevel(), ILIAS\Skill\Profile\SkillProfileCompletionDBRepository\addNonFulfilmentEntry(), ilRepositoryObjectPlugin\beforeActivation(), ilNewsItem\create(), ilPageObject\createFromXML(), ILIAS\Notes\NotesManager\createNote(), ILIAS\Test\Setup\CloneIntroductionAndClosingRemarksMigration\createPageWithNextId(), ilAuthProviderLTI\createUser(), ilCalendarHeaderNavigationGUI\getHTML(), ilNewsItem\getLastNewsIdForContext(), ilLMNavigationStatus\getPredecessorPageId(), ilWikiUserHTMLExport\getProcess(), ilLMNavigationStatus\getSuccessorPageId(), ilSkillUserLevelDBRepository\hasRecentSelfEvaluation(), ilLMContentRendererGUI\renderDeactivatedPageMessage(), ilObjForum\saveData(), ilExAssignmentMemberStatus\setFeedback(), ilExAssignmentMemberStatus\setMark(), ilExAssignmentMemberStatus\setSent(), ilExAssignmentMemberStatus\setStatus(), ilObjSCORMTracking\storeJsApiCmi(), ilBlogPosting\unpublish(), ilNewsItem\update(), ilPageObject\update(), ilPageObject\updateFromXML(), ilExSubmission\updateTextSubmission(), ilExSubmission\updateTutorDownloadTime(), and ILIAS\Exercise\Submission\SubmissionRepository\updateWebDirAccessTime().

+ Here is the caller graph for this function:

◆ parseImportId()

static ilUtil::parseImportId ( string  $a_import_id)
static

Parse an ilias import id Typically of type il_[IL_INST_ID]_[OBJ_TYPE]_[OBJ_ID] returns array( 'orig' => 'il_4800_rolt_123' 'prefix' => 'il' 'inst_id => '4800' 'type' => 'rolt' 'id' => '123'.

Deprecated:

Definition at line 1357 of file class.ilUtil.php.

1357 : array
1358 {
1359 $exploded = explode('_', $a_import_id);
1360
1361 $parsed['orig'] = $a_import_id;
1362 if ($exploded[0] == 'il') {
1363 $parsed['prefix'] = $exploded[0];
1364 }
1365 if (is_numeric($exploded[1])) {
1366 $parsed['inst_id'] = (int) $exploded[1];
1367 }
1368 $parsed['type'] = $exploded[2];
1369
1370 if (is_numeric($exploded[3])) {
1371 $parsed['id'] = (int) $exploded[3];
1372 }
1373 return $parsed;
1374 }

References ILIAS\Repository\int().

Referenced by ilECSEnrolmentStatusCommandQueueHandler\handleCreate(), ilAdvancedMDRecordParser\handlerBeginTag(), ilQuestionPageParser\handlerEndTag(), and ilAdvancedMDFieldDefinitionInternalLink\importValueFromXML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ redirect()

static ilUtil::redirect ( string  $a_script)
static
Deprecated:
Use $DIC->ctrl()->redirectToURL() instead

Definition at line 944 of file class.ilUtil.php.

944 : void
945 {
946 global $DIC;
947
948 if (!isset($DIC['ilCtrl']) || !$DIC['ilCtrl'] instanceof ilCtrl) {
949 (new InitCtrlService())->init($DIC);
950 }
951 $DIC->ctrl()->redirectToURL($a_script);
952 }
Class InitCtrlService wraps the initialization of ilCtrl.
Class ilCtrl provides processing control methods.

References $DIC, and init().

Referenced by ilLearningProgressGUI\__getNextClass(), ilObjCourseGUI\_goto(), ilObjSystemFolderGUI\_goto(), ilObjItemGroupGUI\_goto(), ilObjPollGUI\_goto(), ilObjLinkResourceGUI\_goto(), ilObjGroupGUI\_goto(), ilObjLearningSequence\_goto(), ilCourseRegistrationGUI\add(), ilGroupRegistrationGUI\add(), ilObjCourseGUI\afterSave(), ilObjLearningSequenceGUI\afterSave(), ilObjMediaCastGUI\afterSave(), ilObjMediaPoolGUI\afterSave(), ilObjOrgUnitGUI\afterSave(), ilObjSurveyGUI\afterSave(), ilObjSurveyQuestionPoolGUI\afterSave(), ilObjQuestionPoolGUI\afterSave(), ilObjLinkResourceGUI\afterSave(), ilTestPlayerAbstractGUI\afterTestPassFinishedCmd(), ilSurveyExecutionGUI\backToRepository(), ilObjTestGUI\backToRepositoryObject(), ilLMPageObjectGUI\cancel(), SurveyQuestionGUI\cancel(), ilMailFormGUI\cancelMail(), ilSharedResourceGUI\cancelPassword(), ilContainerStartObjectsGUI\checkPermission(), ilInternalLinkGUI\closeLinkHelp(), ilObjectCopyGUI\copyMultipleNonContainer(), ilImageMapEditorGUI\editImagemapForward(), ilErrorHandling\errorHandler(), ilCalendarPresentationGUI\executeCommand(), ilDashboardGUI\executeCommand(), ilObjMediaPoolGUI\executeCommand(), ilSAHSEditGUI\executeCommand(), ILIAS\User\Profile\PublicProfileGUI\getHTML(), ilObjItemGroupGUI\gotoParent(), ilObjWikiGUI\gotoStartPageObject(), ilMembershipRegistrationCodeUtils\handleCode(), ilObjSurveyQuestionPoolGUI\importFile(), ilObjSurveyGUI\importSurveyObject(), ilEditClipboardGUI\insert(), ilMailingListsGUI\mailToList(), ilObjRoleGUI\mailToRoleObject(), ilObjSCORMLearningModuleGUI\newModuleVersionUpload(), ilExerciseManagementGUI\openSubmissionViewObject(), ilObjLearningSequenceLearnerGUI\play(), ilShibbolethWAYF\redirect(), SurveyQuestionGUI\redirectAfterSaving(), ilExerciseManagementGUI\redirectFeedbackMailObject(), ilObjCourseGUI\redirectLocToTestConfirmedObject(), ilObjCourseGUI\redirectLocToTestObject(), ilBookingReservationsGUI\redirectMailToBooker(), ilPortfolioRepositoryGUI\redirectSendMailToSharer(), ilObjLinkResourceGUI\redirectToLink(), ilContentStyleSettingsGUI\saveActiveStyles(), ilMailFormGUI\saveDraft(), ILIAS\User\Profile\PersonalProfileGUI\savePublicProfile(), ilContentStyleSettingsGUI\saveScope(), ilObjContentObjectGUI\sendMailToBlockedUsers(), ilMembershipGUI\sendMailToSelectedUsers(), ilObjAuthSettingsGUI\setAuthModeObject(), ilTestPlayerAbstractGUI\submitSolutionCmd(), ilObjPollGUI\subscribe(), ilContentStyleSettingsGUI\toggleGlobalDefault(), ilContentStyleSettingsGUI\toggleGlobalFixed(), ilObjPortfolioGUI\toRepository(), ilObjPollGUI\unsubscribe(), ilObjSAHSLearningModuleGUI\uploadObject(), and ilObjPollGUI\vote().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ replaceLinkProperties()

static ilUtil::replaceLinkProperties ( array  $matches)
staticprivate

Definition at line 252 of file class.ilUtil.php.

252 : string
253 {
254 global $DIC;
255 $cache = $DIC['ilObjDataCache'];
256
257 $link = $matches[0];
258 $ref_id = (int) $matches[2];
259 if ($ref_id > 0) {
260 $obj_id = $cache->lookupObjId($ref_id);
261 if ($obj_id > 0) {
262 $title = $cache->lookupTitle($obj_id);
263 $link = '<a href="' . $matches[1] . '" target="_self">' . $title . '</a>';
264 }
265 }
266
267 return $link;
268 }

References $DIC, $ref_id, and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ secureLink()

static ilUtil::secureLink ( string  $a_str)
static
Deprecated:

Definition at line 760 of file class.ilUtil.php.

760 : string
761 {
762 $a_str = str_ireplace("javascript", "jvscrpt", $a_str);
763 $a_str = str_ireplace(["%00",
764 "%0a",
765 "%0d",
766 "%1a",
767 "&#00;",
768 "&#x00;",
769 "&#0;",
770 "&#x0;",
771 "&#x0a;",
772 "&#x0d;",
773 "&#10;",
774 "&#13;"
775 ], "-", $a_str);
776 return $a_str;
777 }

Referenced by ilObjMediaObjectGUI\savePropertiesObject(), and unmaskAttributeTag().

+ Here is the caller graph for this function:

◆ securePlainString()

static ilUtil::securePlainString ( string  $a_str)
static
Deprecated:

Definition at line 569 of file class.ilUtil.php.

569 : string
570 {
571 if (ini_get("magic_quotes_gpc")) {
572 return stripslashes($a_str);
573 } else {
574 return $a_str;
575 }
576 }

Referenced by ilMailFormGUI\editAttachments(), ilMailFormGUI\saveDraft(), ilMailFormGUI\saveMailBeforeSearch(), ilMailFormGUI\search(), ilMailFormGUI\searchUsers(), ilMailFormGUI\sendMessage(), and ilMailFormGUI\showForm().

+ Here is the caller graph for this function:

◆ secureString()

static ilUtil::secureString ( string  $a_str,
bool  $a_strip_html = true,
string  $a_allow = "" 
)
static
Deprecated:

Definition at line 421 of file class.ilUtil.php.

421 : string
422 {
423 // check whether all allowed tags can be made secure
424 $only_secure = true;
425 $allow_tags = explode(">", $a_allow);
426 $sec_tags = ilUtil::getSecureTags();
427 $allow_array = [];
428 foreach ($allow_tags as $allow) {
429 if ($allow != "") {
430 $allow = str_replace("<", "", $allow);
431
432 if (!in_array($allow, $sec_tags)) {
433 $only_secure = false;
434 }
435 $allow_array[] = $allow;
436 }
437 }
438
439 // default behaviour: allow only secure tags 1:1
440 if (($only_secure || $a_allow == "") && $a_strip_html) {
441 if ($a_allow === "") {
442 $allow_array = ["b",
443 "i",
444 "strong",
445 "em",
446 "code",
447 "cite",
448 "gap",
449 "sub",
450 "sup",
451 "pre",
452 "strike",
453 "bdo"
454 ];
455 }
456
457 // this currently removes parts of strings like "a <= b"
458 // because "a <= b" is treated like "<spam onclick='hurt()'>ss</spam>"
459 $a_str = ilUtil::maskSecureTags($a_str, $allow_array);
460 $a_str = strip_tags($a_str); // strip all other tags
461 $a_str = ilUtil::unmaskSecureTags($a_str, $allow_array);
462
463 // a possible solution could be something like:
464 // $a_str = str_replace("<", "&lt;", $a_str);
465 // $a_str = str_replace(">", "&gt;", $a_str);
466 // $a_str = ilUtil::unmaskSecureTags($a_str, $allow_array);
467 //
468 // output would be ok then, but input fields would show
469 // "a &lt;= b" for input "a <= b" if data is brought back to a form
470 } else {
471 // only for scripts, that need to allow more/other tags and parameters
472 if ($a_strip_html) {
473 $a_str = ilUtil::stripScriptHTML($a_str, $a_allow);
474 }
475 }
476
477 return $a_str;
478 }
static maskSecureTags(string $a_str, array $allow_array)
static getSecureTags()
static unmaskSecureTags(string $a_str, array $allow_array)
static stripScriptHTML(string $a_str, string $a_allow="", bool $a_rm_js=true)

References getSecureTags(), maskSecureTags(), stripScriptHTML(), and unmaskSecureTags().

Referenced by ilOrgUnitExplorerGUI\getNodeContent(), assKprimChoiceGUI\handleAnswerTextsSubmit(), ilUserDataSet\importRecord(), ilTaggingSlateContentGUI\renderResourcesForTag(), ilAssSelfAssessmentQuestionFormatter\stripHtmlExceptSelfAssessmentTags(), and stripSlashes().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ secureUrl()

static ilUtil::secureUrl ( string  $url)
static
Deprecated:

Definition at line 830 of file class.ilUtil.php.

830 : string
831 {
832 // check if url is valid (absolute or relative)
833 if (filter_var($url, FILTER_VALIDATE_URL) === false &&
834 filter_var("http://" . $url, FILTER_VALIDATE_URL) === false &&
835 filter_var("http:" . $url, FILTER_VALIDATE_URL) === false &&
836 filter_var("http://de.de" . $url, FILTER_VALIDATE_URL) === false &&
837 filter_var("http://de.de/" . $url, FILTER_VALIDATE_URL) === false) {
838 return "";
839 }
840 if (trim(strtolower(parse_url($url, PHP_URL_SCHEME) ?? '')) === "javascript") {
841 return "";
842 }
843
844 return htmlspecialchars($url, ENT_QUOTES);
845 }

References $url.

Referenced by ilGroupedListGUI\getHTML(), and ilObjMediaObject\getXML().

+ Here is the caller graph for this function:

◆ setCookie()

static ilUtil::setCookie ( string  $a_cookie_name,
string  $a_cookie_value = '',
bool  $a_also_set_super_global = true,
bool  $a_set_cookie_invalid = false 
)
static
Deprecated:
use HTTP-service instead

Definition at line 1281 of file class.ilUtil.php.

1286 : void {
1287 global $DIC;
1288
1289 $http = $DIC->http();
1290 $cookie_jar = $http->cookieJar();
1291
1292 $cookie_factory = new CookieFactoryImpl();
1293
1294 $cookie_expire = null;
1295 if (defined('IL_COOKIE_EXPIRE') && is_numeric(IL_COOKIE_EXPIRE) && IL_COOKIE_EXPIRE > 0) {
1296 $cookie_expire = (int) IL_COOKIE_EXPIRE;
1297 }
1298
1299 $expires = null;
1300 if ($a_set_cookie_invalid) {
1301 $expires = time() - 10;
1302 } elseif ($cookie_expire > 0) {
1303 $expires = time() + $cookie_expire;
1304 }
1305
1306 $cookie = $cookie_factory->create($a_cookie_name, $a_cookie_value)
1307 ->withExpires($expires)
1308 ->withSecure(defined('IL_COOKIE_SECURE') ? IL_COOKIE_SECURE : false)
1309 ->withPath(defined('IL_COOKIE_PATH') ? IL_COOKIE_PATH : '')
1310 ->withDomain(defined('IL_COOKIE_DOMAIN') ? IL_COOKIE_DOMAIN : '')
1311 ->withHttpOnly(defined('IL_COOKIE_HTTPONLY') ? IL_COOKIE_HTTPONLY : false);
1312
1313
1314 if (
1315 defined('IL_COOKIE_SECURE') && IL_COOKIE_SECURE &&
1316 (!isset(session_get_cookie_params()['samesite']) || strtolower(session_get_cookie_params()['samesite']) !== 'strict')
1317 ) {
1318 $cookie = $cookie->withSamesite(Cookie::SAMESITE_LAX);
1319 }
1320 $jar = $cookie_jar->with($cookie);
1321 $response = $jar->renderIntoResponseHeader($http->response());
1322 $http->saveResponse($response);
1323 }
const IL_COOKIE_PATH(isset($_GET['client_id']))
Definition: index.php:47
$http
Definition: deliver.php:30
$response
Definition: xapitoken.php:93

Referenced by ilInitialisation\determineClient(), ilSoapAdministration\initAuth(), ilLTIViewGUI\logout(), ilSessionControl\removeSessionCookie(), and ilInitialisation\setClientIdCookie().

+ Here is the caller graph for this function:

◆ stripOnlySlashes()

static ilUtil::stripOnlySlashes ( string  $a_str)
static
Deprecated:

Definition at line 409 of file class.ilUtil.php.

409 : string
410 {
411 if (ini_get("magic_quotes_gpc")) {
412 $a_str = stripslashes($a_str);
413 }
414
415 return $a_str;
416 }

Referenced by assQuestionGUI\writeQuestionGenericPostData().

+ Here is the caller graph for this function:

◆ stripScriptHTML()

static ilUtil::stripScriptHTML ( string  $a_str,
string  $a_allow = "",
bool  $a_rm_js = true 
)
static
Deprecated:

Definition at line 782 of file class.ilUtil.php.

782 : string
783 {
784 $negativestr = "a,abbr,acronym,address,applet,area,base,basefont," .
785 "big,blockquote,body,br,button,caption,center,cite,code,col," .
786 "colgroup,dd,del,dfn,dir,div,dl,dt,em,fieldset,font,form,frame," .
787 "frameset,h1,h2,h3,h4,h5,h6,head,hr,html,i,iframe,img,input,ins,isindex,kbd," .
788 "label,legend,li,link,map,menu,meta,noframes,noscript,object,ol," .
789 "optgroup,option,p,param,q,s,samp,script,select,small,span," .
790 "strike,strong,style,sub,sup,table,tbody,td,textarea,tfoot,th,thead," .
791 "title,tr,tt,u,ul,var";
792 $a_allow = strtolower($a_allow);
793 $negatives = explode(",", $negativestr);
794 $outer_old_str = "";
795 while ($outer_old_str != $a_str) {
796 $outer_old_str = $a_str;
797 foreach ($negatives as $item) {
798 $pos = strpos($a_allow, "<$item>");
799
800 // remove complete tag, if not allowed
801 if ($pos === false) {
802 $old_str = "";
803 while ($old_str != $a_str) {
804 $old_str = $a_str;
805 $a_str = preg_replace("/<\/?\s*$item(\/?)\s*>/i", "", $a_str);
806 $a_str = preg_replace("/<\/?\s*$item(\/?)\s+([^>]*)>/i", "", $a_str);
807 }
808 }
809 }
810 }
811
812 if ($a_rm_js) {
813 // remove all attributes if an "on..." attribute is given
814 $a_str = preg_replace("/<\s*\w*(\/?)(\s+[^>]*)?(\s+on[^>]*)>/i", "", $a_str);
815
816 // remove all attributes if a "javascript" is within tag
817 $a_str = preg_replace("/<\s*\w*(\/?)\s+[^>]*javascript[^>]*>/i", "", $a_str);
818
819 // remove all attributes if an "expression" is within tag
820 // (IE allows something like <b style='width:expression(alert(1))'>test</b>)
821 $a_str = preg_replace("/<\s*\w*(\/?)\s+[^>]*expression[^>]*>/i", "", $a_str);
822 }
823
824 return $a_str;
825 }

Referenced by ilDataCollectionGlobalTemplate\fillHeader(), ilGlobalTemplate\fillHeader(), ILIAS\components\UICore\MetaTemplate\PageContentGUI\fillHeader(), ilDataCollectionGlobalTemplate\fillWindowTitle(), ilGlobalTemplate\fillWindowTitle(), and secureString().

+ Here is the caller graph for this function:

◆ stripSlashes()

static ilUtil::stripSlashes ( string  $a_str,
bool  $a_strip_html = true,
string  $a_allow = "" 
)
static
Deprecated:

Definition at line 397 of file class.ilUtil.php.

397 : string
398 {
399 if (ini_get("magic_quotes_gpc")) {
400 $a_str = stripslashes($a_str);
401 }
402
403 return ilUtil::secureString($a_str, $a_strip_html, $a_allow);
404 }
static secureString(string $a_str, bool $a_strip_html=true, string $a_allow="")

References secureString().

Referenced by ilTaxonomyExplorerGUI\__construct(), ilObjTaggingSettingsGUI\__construct(), ilSearchGUI\__construct(), ilLDAPSettingsGUI\__construct(), ilSearchGUI\__parseQueryString(), ilUserSearchFilter\__parseQueryString(), ilRepositorySearchGUI\__parseQueryString(), ilFileUtils\_sanitizeFilemame(), ilObjContentObjectGUI\addTooltip(), ILIAS\Container\Content\Filter\FilterManager\apply(), ilCmiXapiStatementsGUI\asyncUserAutocompleteCmd(), ilLTIConsumerXapiStatementsGUI\asyncUserAutocompleteCmd(), ilObjForumGUI\autosaveDraftAsyncObject(), ilObjForumGUI\autosaveThreadDraftAsyncObject(), ilRepositoryTrashGUI\buildPath(), ilDashboardBlockGUI\changePDItemPresentationObject(), ilDashboardBlockGUI\changePDItemSortingObject(), ilFileInputGUI\checkInput(), ilClozeGapInputBuilderGUI\checkInput(), ilObjSurvey\cloneTextblocks(), ilMailAttachmentGUI\confirmDeleteAttachments(), ilFileSystemGUI\createDirectory(), ilObjFileBasedLMGUI\createFromDirectory(), ilObjForumGUI\decorateWithAutosave(), ilExAssignmentEditorGUI\deleteAssignmentsObject(), ilFileSystemGUI\deleteFile(), ilPCInteractiveImage\deleteOverlay(), ilObjSurveyGUI\doAutoCompleteObject(), ilObjContentObjectGUI\doExportHTML(), ilObjContentObjectGUI\doExportXML(), ilStartUpGUI\doSamlAuthentication(), ilSCORM13PlayerGUI\downloadLog(), ilObjLanguageExtGUI\downloadObject(), ilCronManagerGUI\executeCommand(), ilMailGUI\executeCommand(), assQuestionGUI\executeCommand(), ilObjContentObjectGUI\export(), ilObjMediaPoolGUI\export(), ilObjContentObjectGUI\exportHTML(), ilFileSystemGUI\extCommand(), ilMailSearchObjectMembershipsTableGUI\fillRow(), ilExportIDTableGUI\fillRow(), ilPDNewsTableGUI\fillRow(), ilObjTestGUI\forwardCommandToQuestion(), ilMailTemplateGUI\getAjaxPlaceholdersByIdCommand(), ilPCDataTableGUI\getCellContent(), ilObjUser\getFullname(), ilSamlSettingsGUI\getIdpForm(), ilFormulaInputGUI\getInput(), ilTextAreaInputGUI\getInput(), ilAssignedUsersTableGUI\getItems(), ilLMQuestionListTableGUI\getItems(), ilSCORM2004TrackingItemsTableGUI\getItems(), ilSCORMTrackingItemsTableGUI\getItems(), ilTrObjectUsersPropsTableGUI\getItems(), ilTrUserObjectsPropsTableGUI\getItems(), ilUserLPTableGUI\getItems(), ilTrSummaryTableGUI\getItems(), ilExplorerBaseGUI\getNodeAsync(), assAnswerCloze\getNumericValueFromText(), ilObjForumGUI\getOrderByParam(), ilSCORMPackageParser\getPackageTitle(), assTextQuestion\getSolutionSubmit(), ilTaggingGUI\getTagsFromInput(), ilUserTableGUI\getUserIdsForFilter(), ilChatroomInviteUsersToPrivateRoomGUI\getUserList(), ilObjSessionGUI\handleFileUpload(), ilObjForumGUI\handleFormInput(), ilSCORMPackageParser\handlerCharacterData(), ilChatroomXMLParser\handlerEndTag(), ilForumXMLParser\handlerEndTag(), ilSCORM13Package\il_import(), ilContentPageDataSet\importRecord(), ilPresentationFullGUI\initFilter(), ilPresentationTableGUI\initFilter(), ILIAS\COPage\PC\Paragraph\ParagraphCommandActionHandler\insertParagraph(), ilECSUser\loadFromGET(), ilECSSettingsGUI\loadFromPost(), ilLDAPRoleGroupMappingSettings\loadFromPost(), ilObjEmployeeTalkSeriesGUI\loadRecurrenceSettings(), ilObjSessionGUI\loadRecurrenceSettings(), ilEmployeeTalkAppointmentGUI\loadRecurrenceSettings(), ilLDAPSettingsGUI\loadRoleAssignmentRule(), ilMailSearchGUI\lookupRecipientAsync(), ilMailFormGUI\lookupRecipientAsync(), ilObjLanguageExtGUI\maintainExecuteObject(), ilMediaPoolExportOptionXMLMaster\onExportOptionSelected(), ilMediaPoolExportOptionXMLMasterNoMedia\onExportOptionSelected(), ILIAS\Survey\CSVReader\open(), ilSCORM13PlayerGUI\openLog(), assQuestionGUI\outChapterSelector(), assQuestionGUI\outPageSelector(), ilTrashTableGUI\parse(), ilSCORMTrackingUsersTableGUI\parse(), ilFileSystemGUI\parseCurrentDirectory(), ilObjStudyProgrammeAutoMembershipsGUI\parseQueryString(), ilRepositorySearchGUI\performSearch(), ilLegacyFormElementsUtil\prepareFormOutput(), ilAnswerWizardInputGUI\prepareFormOutput(), ilLMPageGUI\processAnswer(), ilICalParser\purgeString(), ilMailBodyPurifier\purify(), ilLuceneSearchGUI\remoteSearch(), ilFileSystemGUI\renameFile(), ilObjForumGUI\renderPostingForm(), ilEMailInputGUI\sanitize(), ilFileSystemGUI\sanitizeCurrentDirectory(), ilQtiMatImageSecurity\sanitizeLabel(), ilChatroomFormFactory\saniziteArrayElementsTrafo(), ilLMEditShortTitlesGUI\save(), ilLMPageObjectGUI\save(), ilObjSkillTreeGUI\saveAllTemplateTitles(), ilObjSkillTreeGUI\saveAllTitles(), ilObjAuthSettingsGUI\saveApacheSettingsObject(), ilExerciseSubmissionFeedbackGUI\saveCommentForLearners(), ilExerciseManagementGUI\saveEvaluationFromModalObject(), ilObjContentObjectGUI\saveExportIds(), ilObjWikiGUI\saveGradingObject(), ilObjSystemFolderGUI\saveHeaderTitlesObject(), ilSurveyEditorGUI\saveHeadingObject(), ilObjSystemFolderGUI\saveJavaServerObject(), ILIAS\Test\Scoring\Manual\TestScoringByQuestionGUI\saveManScoringByQuestion(), ILIAS\Test\Scoring\Manual\TestScoringByParticipantGUI\saveManScoringParticipantScreen(), ilObjLanguageExtGUI\saveObject(), ilObjPortfolioBaseGUI\savePortfolioPagesOrdering(), ilObjTaxonomyGUI\saveSorting(), ilPortfolioRepositoryGUI\saveTitles(), ilLegalDocumentsAdministrationGUI\searchUser(), ilPCTableGUI\setAlignment(), ilContentPagePageCommandForwarder\setBackLinkTab(), ilForumPageCommandForwarder\setBackLinkTab(), ilLDAPRoleGroupMappingSetting\setRoleByName(), ilPCTableGUI\setStyles(), ilPCInteractiveImage\setTriggerProperties(), ilPCTableGUI\setWidths(), ilCalendarCategoryGUI\sharePerformSearch(), ilStartUpGUI\showSamlLoginForm(), ilObjSCORM2004LearningModuleGUI\showTrackingItems(), ilObjSCORMLearningModuleGUI\showTrackingItems(), ilObjSCORM2004LearningModuleGUI\showTrackingItemsBySco(), ilObjSCORMLearningModuleGUI\showTrackingItemsBySco(), ilObjForumGUI\showUserObject(), ilBadgeGUIRequest\strArray(), ILIAS\User\UserGUIRequest\strArray(), ILIAS\Repository\HTML\HTMLUtil\strip(), ILIAS\Repository\strip(), ilCertificateUtilHelper\stripSlashes(), ilFormPropertyGUI\stripSlashesAddSpaceFallback(), SurveyQuestion\stripSlashesAddSpaceFallback(), ilArrayUtil\stripSlashesArray(), ilClozeGapInputBuilderGUI\stripSlashesRecursive(), ilArrayUtil\stripSlashesRecursive(), assLongMenuGUI\stripSlashesRecursive(), ilDataSet\stripTags(), ilBuddySystemGUI\transitionAsyncCommand(), ilContainerBaseXmlParser\trimAndStrip(), ilCourseXMLParser\trimAndStrip(), ilExerciseXMLParser\trimAndStrip(), ilGroupXMLParser\trimAndStrip(), ilStyleImportParser\trimAndStrip(), SurveyImportParser\trimAndStrip(), ilWebLinkXmlParser\trimAndStrip(), ILIAS\COPage\Page\PageCommandActionHandler\updateCommand(), ilPCDataTableGUI\updateJS(), ilObjLinkResourceGUI\updateLinks(), ilExerciseXMLParser\updateMarking(), ilSessionMembershipGUI\updateMembers(), ILIAS\COPage\PC\Paragraph\ParagraphCommandActionHandler\updateParagraph(), ilAdvancedMDSettingsGUI\updateRecords(), ilRegistrationGUI\updateSubscriptionRequest(), ilFileSystemGUI\uploadFile(), ilObjLanguageExtGUI\uploadObject(), ilObjForumGUI\viewThreadObject(), and assMatchingQuestionGUI\writeAnswerSpecificPostData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ switchColor()

static ilUtil::switchColor ( int  $a_num,
string  $a_css1,
string  $a_css2 
)
static

switches style sheets for each even $a_num (used for changing colors of different result rows)

Deprecated:

Definition at line 207 of file class.ilUtil.php.

207 : string
208 {
209 if (!($a_num % 2)) {
210 return $a_css1;
211 } else {
212 return $a_css2;
213 }
214 }

Referenced by ilForumExportGUI\renderPostHtml().

+ Here is the caller graph for this function:

◆ tf2yn()

static ilUtil::tf2yn ( bool  $a_tf)
static
Deprecated:

Definition at line 915 of file class.ilUtil.php.

915 : string
916 {
917 if ($a_tf) {
918 return "y";
919 } else {
920 return "n";
921 }
922 }

Referenced by ilObjRoleGUI\permSaveObject(), ilObjSAHSLearningModule\setAutoReview(), ilObjGlossary\update(), ilObjSAHSLearningModule\update(), and ilObjContentObject\updateProperties().

+ Here is the caller graph for this function:

◆ unmaskAttributeTag()

static ilUtil::unmaskAttributeTag ( string  $a_str,
string  $tag,
string  $tag_att 
)
staticprivate

Definition at line 685 of file class.ilUtil.php.

685 : string
686 {
687 global $DIC;
688
689 $ilLog = $DIC["ilLog"];
690
691 while (preg_match(
692 '/&lt;(' . $tag . ' ' . $tag_att . $tag_att . '="(([$@!*()~;,_0-9A-z\/:=%.&#?+\-])*)")&gt;/i',
693 $a_str,
694 $found
695 )) {
696 $old_str = $a_str;
697 $a_str = preg_replace(
698 "/&lt;" . preg_quote($found[1], "/") . "&gt;/i",
699 '<' . $tag . ' ' . $tag_att . '="' . ilUtil::secureLink($found[2]) . '">',
700 $a_str
701 );
702 if ($old_str == $a_str) {
703 $ilLog->write(
704 "ilUtil::unmaskA-" . htmlentities($old_str) . " == " .
705 htmlentities($a_str)
706 );
707 return $a_str;
708 }
709 }
710 $a_str = str_replace('&lt;/' . $tag . '&gt;', '</' . $tag . '>', $a_str);
711 return $a_str;
712 }
static secureLink(string $a_str)

References $DIC, and secureLink().

Referenced by unmaskSecureTags().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unmaskSecureTags()

static ilUtil::unmaskSecureTags ( string  $a_str,
array  $allow_array 
)
staticprivate

Definition at line 535 of file class.ilUtil.php.

535 : string
536 {
537 foreach ($allow_array as $t) {
538 switch ($t) {
539 case "a":
540 $a_str = ilUtil::unmaskAttributeTag($a_str, "a", "href");
541 break;
542
543 case "img":
544 $a_str = ilUtil::unmaskAttributeTag($a_str, "img", "src");
545 break;
546
547 case "p":
548 case "div":
549 $a_str = ilUtil::unmaskTag($a_str, $t, [
550 ["param" => "align", "value" => "left"],
551 ["param" => "align", "value" => "center"],
552 ["param" => "align", "value" => "justify"],
553 ["param" => "align", "value" => "right"]
554 ]);
555 break;
556
557 default:
558 $a_str = ilUtil::unmaskTag($a_str, $t);
559 break;
560 }
561 }
562
563 return $a_str;
564 }
static unmaskAttributeTag(string $a_str, string $tag, string $tag_att)
static unmaskTag(string $a_str, string $tag, array $fix_param=[])

References unmaskAttributeTag(), and unmaskTag().

Referenced by secureString().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unmaskTag()

static ilUtil::unmaskTag ( string  $a_str,
string  $tag,
array  $fix_param = [] 
)
staticprivate

Definition at line 740 of file class.ilUtil.php.

740 : string
741 {
742 $a_str = str_replace("&lt;" . $tag . "&gt;", "<" . $tag . ">", $a_str);
743 $a_str = str_replace("&lt;/" . $tag . "&gt;", "</" . $tag . ">", $a_str);
744
745 foreach ($fix_param as $p) {
746 $k = $p["param"];
747 $v = $p["value"];
748 $a_str = str_replace(
749 "&lt;$tag $k=\"$v\"&gt;",
750 "<" . "$tag $k=\"$v\"" . ">",
751 $a_str
752 );
753 }
754 return $a_str;
755 }

Referenced by unmaskSecureTags().

+ Here is the caller graph for this function:

◆ yn2tf()


The documentation for this class was generated from the following file: