ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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 $img, 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="", string $a_css_location="")
 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)
 
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:
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 36 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 1199 of file class.ilUtil.php.

References ILIAS\Repository\int().

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

1199  : ?int
1200  {
1201  $test_str = explode('_', $ilias_id);
1202 
1203  $parsed_inst_id = (int) ($test_str[1] ?? 0);
1204  $prefix = $test_str[0] ?? '';
1205 
1206  if ($prefix === 'il' && $parsed_inst_id === $inst_id && count($test_str) === 4) {
1207  return is_numeric($test_str[3]) ? (int) $test_str[3] : null;
1208  }
1209  return null;
1210  }
+ 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 1179 of file class.ilUtil.php.

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

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

1179  : ?int
1180  {
1181  $test_str = explode('_', $role_title);
1182  $prefix = $test_str[0] ?? '';
1183 
1184  if ($prefix === 'il') {
1185  $ref_id = $test_str[3] ?? null;
1186  return is_numeric($ref_id) ? (int) $ref_id : null;
1187  }
1188  return null;
1189  }
$ref_id
Definition: ltiauth.php:67
+ 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 1327 of file class.ilUtil.php.

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

Referenced by ilSessionReminderCheck\__construct(), ilMail\_getAutoGeneratedMessageString(), ilMail\_getInstallationSignature(), ilAuthProviderCAS\doAuthentication(), ilErrorHandling\errorHandler(), ilPasswordAssistanceGUI\getBaseUrl(), ilMailEnvironmentHelper\getHttpPath(), ilTestPlayerAbstractGUI\getNavigationUrlParameter(), ilForumMailNotification\getPermanentLink(), ilForumMailEventNotificationSender\getPermanentLink(), ilChatroomAdminViewGUI\getReadmePath(), ilMailFormCall\getRefererRedirectUrl(), ilSoapClient\init(), ilCronManagerImpl\runActiveJobs(), ilMailSummaryNotification\send(), and ilCronDeleteInactiveUserReminderMail\sendReminder().

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

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 1054 of file class.ilUtil.php.

References $DIC, $ilDB, $ilSetting, $res, ilRbacReview\_getOperationIdsByName(), ilDBConstants\FETCHMODE_OBJECT, ILIAS\Repository\int(), RECOVERY_FOLDER_ID, and SYSTEM_ROLE_ID.

Referenced by ilGroupActionTargetExplorerGUI\__construct(), ilObjSurveyQuestionPool\_getAvailableQuestionpools(), ilObjQuestionPool\_getAvailableQuestionpools(), ilObjTest\_getAvailableTests(), ilECSSettingsGUI\exportImported(), ilGroupUserActionProvider\getCommandAccess(), ilCourseGroupingAssignmentTableGUI\getItems(), ilObjSurvey\getQuestionblocksTable(), ilECSSettingsGUI\imported(), and ilObjectCopyGUI\sourceExists().

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

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

Referenced by ilObjRoleGUI\adoptPermObject(), ilMailSearchObjectGUI\cancel(), ilAppointmentPresentationCourseGUI\collectPropertiesAndActions(), ilObjSessionGUI\eventsListObject(), ilMemberExport\fetchUsers(), ilAttendanceList\getHTML(), ilCourseGroupingAssignmentTableGUI\getItems(), ilPermissionGUI\initRoleForm(), ilConsultationHoursTableGUI\parse(), ilLDAPSettingsGUI\prepareGlobalRoleSelection(), ilAuthShibbolethSettingsGUI\prepareRoleSelect(), ilECSSettingsGUI\prepareRoleSelect(), ilCASSettingsGUI\prepareRoleSelection(), ilSamlSettingsGUI\prepareRoleSelection(), and ilOpenIdConnectSettingsGUI\prepareRoleSelection().

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

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

References $url.

Referenced by ilCmiXapiStatementsDeleteRequest\_lookUpDataCount(), ilObjectListGUI\appendRepositoryFrameParameter(), ilXapiCompliantStatementsReportLinkBuilder\appendRequestParameters(), ilCmiXapiAbstractReportLinkBuilder\appendRequestParameters(), assImagemapQuestionGUI\buildAreaLinkTarget(), ilCmiXapiLaunchGUI\buildLaunchLink(), ilPasswordAssistanceGUI\buildUrl(), ilAssQuestionHintRequestGUI\confirmRequestCmd(), ilStartUpGUI\doApacheAuthentication(), ilTestExpressPageObjectGUI\executeCommand(), ilObjTestGUI\executeCreateQuestionObject(), ilRTEGlobalTemplate\fillJavascriptFile(), ilGlobalTemplate\fillJavascriptFile(), ilDataCollectionGlobalTemplate\fillJavascriptFile(), ilAssQuestionHintsTableGUI\fillRow(), ilCmiXapiStatementsDeleteRequest\getBatchUrl(), ilObjQuestionPoolListGUI\getCommandLink(), ilObjTestListGUI\getCommandLink(), ilTestRandomQuestionSetSourcePoolDefinitionListTableGUI\getDeleteHref(), ilCmiXapiStatementsDeleteRequest\getDeleteStateUrls(), ilTestRandomQuestionSetSourcePoolDefinitionListTableGUI\getEditHref(), ILIAS\LearningModule\Menu\ilLMMenuGUI\getEntries(), ilIntLinkRepItemExplorerGUI\getNodeHref(), assImagemapQuestionGUI\getPreviousSolutionConfirmationCheckboxHtml(), ilAuthFrontendCredentialsApache\getTargetUrl(), ILIAS\StaticURL\Handler\LegacyGotoHandler\handle(), ilInitialisation\redirect(), ilInternalLinkGUI\renderLink(), ilPCQuestionGUI\setTabs(), and ilAuthFrontendCredentialsSoap\tryAuthenticationOnLoginPage().

380  : string
381  {
382  $amp = $xml_style
383  ? "&amp;"
384  : "&";
385 
386  $url = (is_int(strpos($a_url, "?")))
387  ? $a_url . $amp . $a_par
388  : $a_url . "?" . $a_par;
389 
390  return $url;
391  }
$url
Definition: ltiregstart.php:35
+ Here is the caller graph for this function:

◆ deducibleSize()

static ilUtil::deducibleSize ( string  $a_mime)
static

checks if mime type is provided by getimagesize()

Deprecated:

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

Referenced by ilObjMediaObject\_determineWidthHeight(), ilObjMediaObject\_saveTempFileAsMediaObject(), ilClipboardTableGUI\fillRow(), ilMediaPoolTableGUI\fillRow(), ilMediaItem\getOriginalSize(), and ilObjMediaPoolSubItemListGUI\parseImage().

928  : bool
929  {
930  if (($a_mime == "image/gif") || ($a_mime == "image/jpeg") ||
931  ($a_mime == "image/png") || ($a_mime == "application/x-shockwave-flash") ||
932  ($a_mime == "image/tiff") || ($a_mime == "image/x-ms-bmp") ||
933  ($a_mime == "image/psd") || ($a_mime == "image/iff")) {
934  return true;
935  } else {
936  return false;
937  }
938  }
+ 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 357 of file class.ilUtil.php.

References $DIC, and ILIAS\FileDelivery\Delivery\setMimeType().

Referenced by ilCSVTestExport\deliver(), ilCertificateUtilHelper\deliverData(), ilMemberExportGUI\deliverData(), ilObjTest\deliverPDFfromFO(), ilPublicUserProfileGUI\deliverVCard(), ilObjLanguageFolderGUI\downloadDeprecatedObject(), ilPRGMembersExportGUI\downloadExportFile(), ilMemberExportGUI\downloadExportFile(), ilObjLanguageExtGUI\downloadObject(), ilSurveyParticipantsGUI\exportAllCodesObject(), ilRegistrationSettingsGUI\exportCodes(), ilSurveyParticipantsGUI\exportCodesObject(), ilSessionOverviewGUI\exportCSV(), ilSurveyEvaluationGUI\exportCumulatedResults(), ilSurveyEvaluationGUI\exportEvaluationUser(), ilObjLinkResourceGUI\exportHTML(), ilObjAssessmentFolderGUI\exportLogObject(), ilDidacticTemplateSettingsGUI\exportTemplate(), ilCalendarRemoteAccessHandler\handleRequest(), ilForumExportGUI\printPost(), ilObjSCORMLearningModule\sendExportFile(), and ilChatroomHistoryGUI\showMessages().

361  : void {
362  global $DIC;
363  $delivery = new Delivery(
364  Delivery::DIRECT_PHP_OUTPUT,
365  $DIC->http()
366  );
367  $delivery->setMimeType($mime);
368  $delivery->setSendMimeType(true);
369  $delivery->setDisposition(Delivery::DISP_ATTACHMENT);
370  $delivery->setDownloadFileName($a_filename);
371  $delivery->setConvertFileNameToAsci(true);
372  $repsonse = $DIC->http()->response()->withBody(Streams::ofString($a_data));
373  $DIC->http()->saveResponse($repsonse);
374  $delivery->deliver();
375  }
setMimeType(string $mime_type)
Definition: Delivery.php:270
global $DIC
Definition: feed.php:28
Class Delivery.
Definition: Delivery.php:38
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ extractParameterString()

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

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

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

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

References $DIC, $lng, and $txt.

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

◆ 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 1440 of file class.ilUtil.php.

References $DIC, and $lng.

Referenced by ilLMDownloadTableGUI\fillRow(), ilMemberExportFileTableGUI\fillRow(), ilDclExportTableGUI\fillRow(), ilExportTableGUI\fillRow(), ilFileSystemTableGUI\fillRow(), ilMailAttachmentTableGUI\formatValue(), ilMailAttachmentGUI\saveAttachments(), ilMailFormGUI\showForm(), and ilMailAttachmentGUI\uploadFile().

1440  : string
1441  {
1442  global $DIC;
1443 
1444  $lng = $DIC->language();
1445  if ($a_lng == null) {
1446  $a_lng = $lng;
1447  }
1448 
1449  $mag = 1024;
1450 
1451  if ($size >= $mag * $mag * $mag) {
1452  $scaled_size = $size / $mag / $mag / $mag;
1453  $scaled_unit = 'lang_size_gb';
1454  } else {
1455  if ($size >= $mag * $mag) {
1456  $scaled_size = $size / $mag / $mag;
1457  $scaled_unit = 'lang_size_mb';
1458  } else {
1459  if ($size >= $mag) {
1460  $scaled_size = $size / $mag;
1461  $scaled_unit = 'lang_size_kb';
1462  } else {
1463  $scaled_size = $size;
1464  $scaled_unit = 'lang_size_bytes';
1465  }
1466  }
1467  }
1468 
1469  $result = self::fmtFloat(
1470  $scaled_size,
1471  ($scaled_unit
1472  == 'lang_size_bytes') ? 0 : 1,
1473  $a_lng->txt('lang_sep_decimal'),
1474  $a_lng->txt('lang_sep_thousand'),
1475  true
1476  )
1477  . ' ' . $a_lng->txt($scaled_unit);
1478  if ($a_mode == 'long' && $size > $mag) {
1479  $result .= ' (' . self::fmtFloat(
1480  $size,
1481  0,
1482  $a_lng->txt('lang_sep_decimal'),
1483  $a_lng->txt('lang_sep_thousand')
1484  ) . ' '
1485  . $a_lng->txt('lang_size_bytes') . ')';
1486  }
1487 
1488  return $result;
1489  }
global $DIC
Definition: feed.php:28
$lng
+ 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. /data/pfplms103/mobs/mm_732/athena_standing.jpg)
Deprecated:

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

Referenced by ilObjMediaObject\_getURL(), SurveyTextQuestionGUI\getPrintView(), SurveySingleChoiceQuestionGUI\getPrintView(), SurveyMultipleChoiceQuestionGUI\getPrintView(), SurveyMatrixQuestionGUI\getPrintView(), assMultipleChoiceGUI\renderSolutionOutput(), assSingleChoiceGUI\renderSolutionOutput(), assKprimChoiceGUI\renderSolutionOutput(), and ilAuthFrontendCredentialsApache\tryAuthenticationOnLoginPage().

120  : string
121  {
122  if (substr($relative_path, 0, 2) == './') {
123  $relative_path = (substr($relative_path, 1));
124  }
125  if (substr($relative_path, 0, 1) != '/') {
126  $relative_path = '/' . $relative_path;
127  }
128  $htmlpath = ILIAS_HTTP_PATH . $relative_path;
129  return $htmlpath;
130  }
+ Here is the caller graph for this function:

◆ getImagePath()

static ilUtil::getImagePath ( string  $img,
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 66 of file class.ilUtil.php.

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

Referenced by ilPollUserTableGUI\__construct(), ilStudyProgrammeIndividualPlanTableGUI\__construct(), ilStudyProgrammeExpandableProgressListGUI\__construct(), ILIAS\MediaCast\Video\VideoItem\__construct(), ilTermDefinitionEditorGUI\__construct(), ilLPStatusIcons\__construct(), ilRepositoryObjectPlugin\_getImagePath(), ilPCTableGUI\_renderTable(), ilExAssignmentGUI\addFiles(), ilWikiPageGUI\addHeaderAction(), ilObjDataCollectionGUI\addHeaderAction(), ilContainerRenderer\addHeaderRow(), ilContainerGUI\addHeaderRow(), ILIAS\COPage\Page\PageQueryActionHandler\allCommand(), ilUserPrivacySettingsGUI\appendChatJsToTemplate(), ilConditionHandlerGUI\askDelete(), ilExSubmissionObjectGUI\askUnlinkBlogObject(), ilExSubmissionObjectGUI\askUnlinkPortfolioObject(), ilPersonalSkillsGUI\assignMaterials(), ilObjAuthSettingsGUI\authSettingsObject(), ilParticipantsTestResultsTableGUI\buildFailedIcon(), ILIAS\Exercise\Assignment\PropertyAndActionBuilderUI\buildFiles(), ilTestQuestionsTableGUI\buildObligatoryColumnContent(), ilTestParticipantsTableGUI\buildOkIcon(), ilParticipantsTestResultsTableGUI\buildPassedIcon(), ilObjContentObjectGUI\chapters(), ilObject\cloneMetaData(), ilMembershipGUI\confirmAssignFromWaitingList(), ilMembershipGUI\confirmAssignSubscribers(), ilMailFolderGUI\confirmDeleteMails(), ilSessionMembershipGUI\confirmDeleteParticipants(), ilMembershipGUI\confirmDeleteParticipants(), ilObjRoleGUI\confirmDeleteRoleObject(), ilObjMediaCastGUI\confirmDeletionItemsObject(), ilMembershipGUI\confirmRefuseFromList(), ilMembershipGUI\confirmRefuseSubscribers(), ilCourseParticipantsGroupsGUI\confirmRemove(), ilSCORM13PlayerGUI\debugGUI(), ilObjForumGUI\decorateWithAutosave(), ilObjSkillTreeGUI\deleteNodes(), ilParticipantsTestResultsGUI\deleteSingleUserResultsCmd(), ilPDNewsGUI\displayHeader(), ilPDNotesGUI\displayHeader(), ilPageObjectGUI\displayMedia(), ilLMPageObjectGUI\editLayout(), ilObjTypeDefinitionGUI\editObject(), ilGlossaryTermGUI\editTerm(), ilObjSessionGUI\eventsListObject(), ilAchievementsGUI\executeCommand(), ilPCInteractiveImageGUI\executeCommand(), ilObjSAHSLearningModuleGUI\executeCommand(), ilLMPageObjectGUI\executeCommand(), ilPortfolioRepositoryGUI\executeCommand(), ilBlogPostingGUI\executeCommand(), ilSystemStyleHTMLExport\export(), ilCOPageHTMLExport\exportHTMLMOB(), ILIAS\Wiki\Export\WikiHtmlExport\exportPageHTML(), ilMailFolderTableGUI\fetchTableData(), ilTable2GUI\fillActionRow(), ilLuceneAdvancedSearchGUI\fillAdminPanel(), ilLuceneSearchGUI\fillAdminPanel(), ILIAS\Services\UICore\MetaTemplate\PageContentGUI\fillAdminPanel(), ilGlobalTemplate\fillAdminPanel(), ilDataCollectionGlobalTemplate\fillAdminPanel(), ilTable2GUI\fillHeader(), ilShibbolethRoleAssignmentTableGUI\fillRow(), ilLDAPRoleAssignmentTableGUI\fillRow(), ilConditionHandlerTableGUI\fillRow(), ilAccessPermissionsStatusTableGUI\fillRow(), ilCalendarSharedListTableGUI\fillRow(), ilAuthLoginPageEditorTableGUI\fillRow(), ilECSServerTableGUI\fillRow(), ilAvailableRolesStatusTableGUI\fillRow(), ilCourseObjectiveQuestionsTableGUI\fillRow(), ilCalendarInboxSharedTableGUI\fillRow(), ilHistoryTableGUI\fillRow(), ilLDAPServerTableGUI\fillRow(), ilSamlIdpTableGUI\fillRow(), ilCalendarManageTableGUI\fillRow(), ilLMPagesTableGUI\fillRow(), ilClipboardTableGUI\fillRow(), ilPageLayoutTableGUI\fillRow(), ilItemGroupItemsTableGUI\fillRow(), ilLPCollectionSettingsTableGUI\fillRow(), ilTimingsPersonalTableGUI\fillRow(), ilExportIDTableGUI\fillRow(), ilCourseReferenceDeleteConfirmationTableGUI\fillRow(), ilTimingsManageTableGUI\fillRow(), ilSessionOverviewTableGUI\fillRow(), ilListOfQuestionsTableGUI\fillRow(), ilSurveyQuestionsTableGUI\fillRow(), ilSessionMaterialsTableGUI\fillRow(), ilSurveyQuestionTableGUI\fillRow(), ilFileSystemTableGUI\fillRow(), ilLPProgressTableGUI\fillRow(), ilTrUserObjectsPropsTableGUI\fillRow(), ilQuestionBrowserTableGUI\fillRow(), ilMediaPoolTableGUI\fillRow(), ilTrObjectUsersPropsTableGUI\fillRow(), ilTrMatrixTableGUI\fillRow(), ilDclFieldListTableGUI\fillRowFromObject(), ilGlobalTemplate\fillSideIcons(), ilDataCollectionGlobalTemplate\fillSideIcons(), assQuestion\fixUnavailableSkinImageSources(), ilSCORMPresentationGUI\frameset(), assQuestionGUI\generateCorrectnessIconsForCorrectness(), ilForumThreadFormGUI\generateInputItems(), ilUserAvatarResolver\getAvatar(), ilPCInteractiveImage\getBackgroundImage(), ilChapterHierarchyFormGUI\getChildIcon(), ilHierarchyFormGUI\getChildIcon(), QuestionTable\getColums(), ILIAS\GlobalScreen\Scope\Layout\Provider\PagePart\StandardPagePartProvider\getContent(), ilHierarchyFormGUI\getContent(), ilAssNestedOrderingElementsInputGUI\getCorrectnessIcon(), ilPCMediaObjectGUI\getEnabledMapAreas(), ilFirstLoginLearningHistoryProvider\getEntries(), ilCourseLearningHistoryProvider\getEntries(), ilLearningHistoryEntryCollector\getEntries(), ilBadgeLearningHistoryProvider\getEntries(), ilSkillLearningHistoryProvider\getEntries(), ilAsyncPropertyFormGUI\getErrorMessageTemplate(), ilStudyProgrammeExpandableProgressListGUI\getExpandedImageURL(), ILIAS\GlobalScreen\Scope\Layout\Provider\PagePart\StandardPagePartProvider\getFaviconPath(), ilLMPresentationGUI\getHeaderAction(), ilDclBooleanRecordRepresentation\getHTML(), ilMainMenuSearchGUI\getHTML(), ilNewsTimelineGUI\getHTML(), ilRatingGUI\getHTML(), ilAdvancedSelectionListGUI\getHTML(), ilForumNotificationTableGUI\getIcon(), ILIAS\File\Icon\IconDatabaseRepository\getIconFilePathBySuffix(), ILIAS\Administration\AdministrationMainBarProvider\getIconForGroup(), ilSkillTreeNode\getIconPath(), ilObjSCORMInitData\getIliasScormVars(), ILIAS\Object\Properties\CoreProperties\TileImage\ilObjectTileImage\getImage(), ilExplorer\getImage(), ilImageMapEditorGUI\getImageMapOutput(), ilCertificateUtilHelper\getImagePath(), ilSCORM13PlayerGUI\getInlineCSS(), ilContainerStartObjectsContentTableGUI\getItems(), ilObjContentObjectGUI\getLayoutOption(), ilCalendarSelectionBlockGUI\getLegacyContent(), ilHierarchyFormGUI\getLevelHTML(), ilPDMailBlockGUI\getListItemForData(), ILIAS\COPage\PC\InteractiveImage\InteractiveImageQueryActionHandler\getLoader(), ILIAS\GlobalScreen\Scope\Layout\Provider\PagePart\StandardPagePartProvider\getLogo(), ilLMHtmlExportViewLayoutProvider\getMainBarModification(), ilTestPassResultsTable\getMapping(), ILIAS\User\Provider\UserMetaBarProvider\getMetaBarItems(), ilLMEditorExplorerGUI\getNodeIcon(), ilPublicSectionExplorerGUI\getNodeIcon(), ilMediaPoolExplorerGUI\getNodeIcon(), ilSkillTreeExplorerGUI\getNodeIcon(), ilTaxonomyExplorerGUI\getNodeIcon(), ilSkillTemplateTreeExplorerGUI\getNodeIcon(), ilVirtualSkillTreeExplorerGUI\getNodeIcon(), ilMailExplorer\getNodeIcon(), ilWorkspaceExplorerGUI\getNodeIcon(), ilLMTOCExplorerGUI\getNodeIcon(), ilPersonalSkillExplorerGUI\getNodeIcon(), ilPRGActionNoteBuilder\getNoteFor(), ilStudyProgrammeExpandableProgressListGUI\getNotExpandedImageURL(), ilExplorer\getOutput(), ilSCORMExplorer\getOutputIcons(), ILIAS\Portfolio\PortfolioPrintViewProviderGUI\getPages(), ilPDMailGUI\getPDMailHTML(), ilPortfolioRepositoryGUI\getPortfolioList(), assSingleChoiceGUI\getPreview(), assKprimChoiceGUI\getPreview(), assMultipleChoiceGUI\getPreview(), assMatchingQuestionGUI\getPreview(), SurveyTextQuestionGUI\getPrintView(), SurveySingleChoiceQuestionGUI\getPrintView(), SurveyMultipleChoiceQuestionGUI\getPrintView(), SurveyMatrixQuestionGUI\getPrintView(), ilTestQuestionHeaderBlockBuilder\getQuestionInfoHTML(), ilTestQuestionNavigationGUI\getQuestionMarkIconSource(), ilDidacticTemplateSettingsTableDataRetrieval\getRecords(), ILIAS\GlobalScreen\Scope\Layout\Provider\PagePart\StandardPagePartProvider\getResponsiveLogo(), ilTestServiceGUI\getResultsSignature(), ILIAS\Portfolio\PortfolioPrintViewProviderGUI\getSelectionForm(), ILIAS\Blog\BlogPrintViewProviderGUI\getSelectionForm(), ILIAS\Wiki\WikiPrintViewProviderGUI\getSelectionForm(), ilObjExerciseGUI\getService(), ILIAS\Membership\GlobalScreen\MembershipMainBarProvider\getStaticSubItems(), ILIAS\MyStaff\Provider\StaffMainBarProvider\getStaticSubItems(), ILIAS\EmployeeTalk\Provider\MyStaffListEntryProvider\getStaticSubItems(), ILIAS\Repository\Provider\RepositoryMainBarProvider\getStaticSubItems(), ILIAS\MainMenu\Provider\StandardTopItemsProvider\getStaticTopItems(), ilPRGStatusInfoBuilder\getStatusInfoFor(), ilObjGlossaryGUI\getTemplate(), assKprimChoiceGUI\getTestOutput(), assSingleChoiceGUI\getTestOutput(), assMultipleChoiceGUI\getTestOutput(), assMatchingQuestionGUI\getTestOutput(), ilPageObjectGUI\getTinyMenu(), ilLMGSToolProvider\getTocTool(), ilTaxonomyGSToolProvider\getToolsForContextStack(), ilLMEditGSToolProvider\getToolsForContextStack(), ilMediaPoolGSToolProvider\getToolsForContextStack(), ilCOPageEditGSToolProvider\getToolsForContextStack(), ilLMGSToolProvider\getToolsForContextStack(), ilSkillGSToolProvider\getToolsForContextStack(), ILIAS\COPage\Page\PageQueryActionHandler\getTopActions(), ilUserAvatarFile\getUrl(), ilLMPresentationGUI\ilMedia(), ilLMPageObjectGUI\initEditLayoutForm(), ilObjGroupGUI\initForm(), ilConditionHandlerGUI\initFormCondition(), ilObjCmiXapiGUI\initHeaderAction(), ilObjLTIConsumerGUI\initHeaderAction(), ilObjBookingPoolGUI\initHeaderAction(), ilObjStudyProgrammeGUI\initHeaderAction(), ilObjGroupGUI\initHeaderAction(), ilObjBlogGUI\initHeaderAction(), ilObjCourseGUI\initHeaderAction(), ilObjForumGUI\initHeaderAction(), ilOnScreenChatGUI\initializeFrontend(), SurveyConstraintsTableGUI\initItems(), ilAwarenessGUI\initJS(), ilObjUserFolderGUI\initNewAccountMailForm(), ilLMPresentationGUI\initScreenHead(), ilObjWikiGUI\initSettingsForm(), ilObjLTIConsumerListGUI\insertIconsAndCheckboxes(), ilObjOrgUnitListGUI\insertInfoScreenCommand(), ilObjectListGUI\insertInfoScreenCommand(), ilPropertyFormGUI\insertItem(), ilPCResourcesGUI\insertResourcesIntoPageContent(), ilUserCertificateGUI\listCertificates(), ilGlossaryPresentationGUI\listDefinitions(), ilPersonalSkillsGUI\listProfileForGap(), ilGlossaryTermGUI\listUsages(), ilMStListCompetencesSkillsGUI\listUsers(), ilMStListUsersGUI\listUsers(), ilMStListCoursesGUI\listUsers(), ilMStListCertificatesGUI\listUsers(), ilEmployeeTalkMyStaffListGUI\loadHeader(), ilGlossaryPresentationGUI\media(), ilObjMediaPoolSubItemListGUI\parseImage(), ilDashboardGUI\prepareContentView(), ilGlossaryPresentationGUI\prepareOutput(), ilCalendarPresentationGUI\prepareOutput(), ilGlossaryPresentationGUI\printViewSelection(), ilLMNavigationRendererGUI\render(), ilProgressBar\render(), ilTableGUI\render(), ilTable2GUI\render(), ilPCTableGUI\renderCell(), ilHierarchyFormGUI\renderChild(), ilRatingGUI\renderDetails(), ilCalendarSelectionBlockGUI\renderItem(), ilChatroomViewGUI\renderLanguageVariables(), ilObjForumGUI\renderPostContent(), assMultipleChoiceGUI\renderSolutionOutput(), assSingleChoiceGUI\renderSolutionOutput(), assMatchingQuestionGUI\renderSolutionOutput(), assKprimChoiceGUI\renderSolutionOutput(), ilObjLearningSequenceContentGUI\renderTable(), ilImagePathResolver\resolveImagePath(), ilPersonalSkillsGUI\saveSelfEvaluation(), ilPersonalSkillsGUI\selfEvaluation(), ilBadgeHandler\sendNotification(), ilLMPresentationGUI\setHeader(), ilImageLinkButton\setImage(), ilSAHSPresentationGUI\setInfoTabs(), ilPageLayoutGUI\setTabs(), ilStructureObjectGUI\setTabs(), ilObjSAHSLearningModuleGUI\setTabs(), ilObjTaxonomyGUI\setTabs(), ilObjMediaObjectGUI\setTabs(), ilObjWorkspaceRootFolderGUI\setTitleAndDescription(), ilObjUserGUI\setTitleAndDescription(), ilObjPortfolioGUI\setTitleAndDescription(), ilObjLanguageExtGUI\setTitleAndDescription(), ilMembershipOverviewGUI\show(), ilDerivedTasksGUI\show(), ilDashboardGUI\show(), ilLMObjectGUI\showActions(), ilContentStyleSettingsGUI\showActions(), ilObjContentObjectGUI\showActions(), ilContainerGUI\showAdministrationPanel(), ilObjWorkspaceFolderGUI\showAdministrationPanel(), ilPasswordAssistanceGUI\showAssignPasswordForm(), ilPasswordAssistanceGUI\showAssistanceForm(), ilStartUpGUI\showCASLoginForm(), ilGlossaryPresentationGUI\showDownloadList(), ilLTIConsumerContentGUI\showEmbedded(), ilMailGUI\showHeader(), ilStructureObjectGUI\showHierarchy(), ilInternalLinkGUI\showLinkHelp(), ilObjMediaPoolGUI\showMedia(), ilPasswordAssistanceGUI\showMessageForm(), ilPageObjectGUI\showPage(), ilContainerGUI\showPasteTreeObject(), ilLMPresentationGUI\showPrintView(), ilLMPresentationGUI\showPrintViewSelection(), ilMailSearchGUI\showResults(), ilLocalUserGUI\showRolesTable(), ilChatroomViewGUI\showRoom(), ilAssQuestionSkillAssignmentsGUI\showSkillSelectionCmd(), ilCourseContentGUI\showStartObjects(), ilContactGUI\showSubTabs(), ilObjectCopyGUI\showTargetSelectionTree(), ilMailFolderGUI\showUser(), ilPasswordAssistanceGUI\showUsernameAssistanceForm(), ilStructureObjectGUI\subchap(), QuestionTable\taxonomyRepresentation(), and ilObjTestGUI\uploadTst().

71  : string {
72  global $DIC;
73 
74  $styleDefinition = null;
75  if (isset($DIC["styleDefinition"])) {
76  $styleDefinition = $DIC["styleDefinition"];
77  }
78 
79  if ($module_path != "") {
80  $module_path = "/" . $module_path;
81  }
82 
83  // default image
84  $default_img = "." . $module_path . "/templates/default/images/" . $img;
85 
86  // use ilStyleDefinition instead of account to get the current skin and style
87  $current_skin = ilStyleDefinition::getCurrentSkin();
88  $current_style = ilStyleDefinition::getCurrentStyle();
89 
90  if (is_object($styleDefinition)) {
91  $image_dir = $styleDefinition->getImageDirectory($current_style);
92  } else {
93  $image_dir = "images";
94  }
95 
96  $skin_img = "";
97 
98  if ($current_skin == "default") {
99  $skin_img = "." . $module_path . "/templates/default/" . $image_dir . "/" . $img;
100  } elseif (is_object($styleDefinition) && $current_skin != "default") {
101  $skin_img = "./Customizing/global/skin/" .
102  $current_skin . "/" . $current_style . "/" . $module_path . $image_dir . "/" . $img;
103  }
104 
105  if ($offline) {
106  return "./images/" . $img;
107  } elseif (file_exists($skin_img)) {
108  return $skin_img; // found image for skin and style
109  }
110 
111  return $default_img; // take image in default
112  }
global $DIC
Definition: feed.php:28
static getCurrentSkin()
get the current skin use always this function instead of getting the account&#39;s skin the current skin ...
static getCurrentStyle()
get the current style or sub style use always this function instead of getting the account&#39;s style th...
+ Here is the call graph for this function:
+ 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 43 of file class.ilUtil.php.

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

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

43  : string
44  {
45  global $DIC;
46 
47  $lng = $DIC->language();
48 
49  $size = ($a_big)
50  ? "big"
51  : "small";
52 
53  $filename = ilObject::_getIcon(0, $size, $a_type);
54 
55  return "<img src=\"" . $filename . "\" alt=\"" . $lng->txt("obj_" . $a_type) . "\" title=\"" . $lng->txt(
56  "obj_" . $a_type
57  ) . "\" border=\"0\" vspace=\"0\"/>";
58  }
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
global $DIC
Definition: feed.php:28
$lng
$filename
Definition: buildRTE.php:78
+ 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 186 of file class.ilUtil.php.

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

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

186  : string
187  {
188 
189  // use ilStyleDefinition instead of account to get the current skin and style
190  if (ilStyleDefinition::getCurrentSkin() == "default") {
191  $in_style = "./templates/" . ilStyleDefinition::getCurrentSkin() . "/"
192  . ilStyleDefinition::getCurrentStyle() . "_cont.css";
193  } else {
194  $in_style = "./Customizing/global/skin/" . ilStyleDefinition::getCurrentSkin() . "/"
195  . ilStyleDefinition::getCurrentStyle() . "_cont.css";
196  }
197 
198  if (is_file("./" . $in_style)) {
199  return $in_style;
200  } else {
201  return "templates/default/delos_cont.css";
202  }
203  }
static getCurrentSkin()
get the current skin use always this function instead of getting the account&#39;s skin the current skin ...
static getCurrentStyle()
get the current style or sub style use always this function instead of getting the account&#39;s style th...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSecureTags()

static ilUtil::getSecureTags ( )
static

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

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

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

◆ getStyleSheetLocation()

static ilUtil::getStyleSheetLocation ( string  $mode = "output",
string  $a_css_name = "",
string  $a_css_location = "" 
)
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 142 of file class.ilUtil.php.

References $DIC, $filename, $ilSetting, ilStyleDefinition\getCurrentSkin(), ilStyleDefinition\getCurrentStyle(), and ilStyleDefinition\getSkins().

Referenced by ilExport\_generateIndexFile(), ilTinyMCE\addRTESupport(), ilTinyMCE\addUserTextEditor(), ilSCORMPresentationGUI\contentSelect(), ilObjTest\deliverPDFfromHTML(), ilTestEvaluationGUI\detailedEvaluation(), ilPageObjectGUI\displayMedia(), ilObjSurveyQuestionPoolGUI\executeCommand(), ilSCORMPresentationGUI\explorer(), ilSystemStyleHTMLExport\export(), ILIAS\COPage\Page\PageQueryActionHandler\getConfig(), ILIAS\Notes\Export\NotesHtmlExport\getInitialisedTemplate(), ILIAS\Portfolio\Export\PortfolioHtmlExport\getInitialisedTemplate(), ILIAS\Blog\Export\BlogHtmlExport\getInitialisedTemplate(), ilExplorer\getOutput(), ilSCORM13PlayerGUI\getPlayer(), ilCOPageHTMLExport\getPreparedMainTemplate(), assMatchingQuestionGUI\getPreview(), ilObjQuestionPoolGUI\getQueryParamInt(), ilPlugin\getStyleSheetLocation(), assMatchingQuestionGUI\getTestOutput(), ilCOPageHTMLExport\initResourceTemplate(), ILIAS\Glossary\Export\GlossaryHtmlExport\initScreen(), ILIAS\LearningModule\Export\LMHtmlExport\initScreen(), ilLMPresentationGUI\layout(), ilGlossaryPresentationGUI\media(), ilTestServiceGUI\outCorrectSolution(), ilTestPlayerAbstractGUI\outCorrectSolution(), ilLMPresentationGUI\page(), ilGlobalPageTemplate\prepareBasicCSS(), ilTestEvaluationGUI\prepareContentForPrint(), ilObjTestGUI\printObject(), ilForumExportGUI\printPost(), ilForumExportGUI\printThread(), ilPortfolioPageGUI\renderConsultationHours(), ILIAS\Export\PrintProcessGUI\renderPrintView(), ilObjTestGUI\reviewobject(), ilTestEvaluationGUI\setCss(), ilLMPresentationGUI\setSystemStyle(), ilInternalLinkGUI\showLinkHelp(), ilContainerGUI\showLinkListObject(), ilTestPlayerAbstractGUI\showListOfAnswers(), ilObjMediaPoolGUI\showMedia(), ilPageObjectGUI\showMediaFullscreen(), ilObjMediaPoolGUI\showPage(), ilParticipantsTestResultsGUI\showUserResults(), ilSCORM13PlayerGUI\specialPage(), ilSAHSPresentationGUI\view(), and ilSCORMPresentationGUI\view().

146  : string {
147  global $DIC;
148 
149  $ilSetting = $DIC->settings();
150 
151  // add version as parameter to force reload for new releases
152  // use ilStyleDefinition instead of account to get the current style
153 
154  $stylesheet_name = (strlen($a_css_name))
155  ? $a_css_name
157  if (strlen($a_css_location) && (strcmp(substr($a_css_location, -1), "/") != 0)) {
158  $a_css_location = $a_css_location . "/";
159  }
160 
161  $filename = "";
162  // use ilStyleDefinition instead of account to get the current skin
163  if (ilStyleDefinition::getCurrentSkin() != "default") {
164  $filename = "./Customizing/global/skin/" . ilStyleDefinition::getCurrentSkin(
165  ) . "/" . ilStyleDefinition::getCurrentStyle() . "/" . $a_css_location . $stylesheet_name;
166  }
167  if (strlen($filename) == 0 || !file_exists($filename)) {
168  $filename = "./" . $a_css_location . "templates/default/" . $stylesheet_name;
169  }
170  $skin_version_appendix = "";
171  if ($mode !== "filesystem") {
172  // use version from template xml to force reload on changes
174  $skin_version = $skin->getVersion();
175  $skin_version_appendix .= ($skin_version !== '' ? str_replace(".", "-", $skin_version) : '0');
176  $skin_version_appendix = "?skin_version=" . $skin_version_appendix;
177  }
178  return $filename . $skin_version_appendix;
179  }
global $DIC
Definition: feed.php:28
static getCurrentSkin()
get the current skin use always this function instead of getting the account&#39;s skin the current skin ...
$filename
Definition: buildRTE.php:78
global $ilSetting
Definition: privfeed.php:18
static getCurrentStyle()
get the current style or sub style use always this function instead of getting the account&#39;s style th...
+ 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 1252 of file class.ilUtil.php.

References $DIC.

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

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

public

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

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

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

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

980  : bool
981  {
982  global $DIC;
983 
984  $ilDB = $DIC->database();
985 
986  $ilErr = null;
987  if (isset($DIC["ilErr"])) {
988  $ilErr = $DIC["ilErr"];
989  }
990 
991  if (empty($a_group_name)) {
992  $message = __METHOD__ . ": No groupname given!";
993  $ilErr->raiseError($message, $ilErr->WARNING);
994  }
995 
996  $clause = ($a_id !== null) ? " AND obj_id != " . $ilDB->quote($a_id) . " " : "";
997 
998  $q = "SELECT obj_id FROM object_data " .
999  "WHERE title = " . $ilDB->quote($a_group_name, "text") . " " .
1000  "AND type = " . $ilDB->quote("grp", "text") .
1001  $clause;
1002 
1003  $r = $ilDB->query($q);
1004 
1005  return $r->numRows() > 0;
1006  }
$ilErr
Definition: raiseError.php:17
global $DIC
Definition: feed.php:28
$q
Definition: shib_logout.php:21
$message
Definition: xapiexit.php:32
$r
+ 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 593 of file class.ilUtil.php.

References makeClickable().

Referenced by ilMailFolderGUI\confirmDeleteMails(), and ilMailFolderTableGUI\fetchTableData().

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

Referenced by ilMailFolderGUI\confirmDeleteMails(), ilTable2GUI\fillHeader(), ilObjClipboardTableGUI\fillRow(), ilPCIIMOverlaysTableGUI\fillRow(), ilLMPagesTableGUI\fillRow(), ilClipboardTableGUI\fillRow(), ilItemGroupItemsTableGUI\fillRow(), ilExportIDTableGUI\fillRow(), ilSearchResultTableGUI\fillRow(), ilAdminSubItemsTableGUI\fillRow(), ilListOfQuestionsTableGUI\fillRow(), ilMediaPoolTableGUI\fillRow(), ilObjectListGUI\getHeaderAction(), ILIAS\Repository\Provider\RepositoryMainBarProvider\getHomeItem(), ilMainMenuSearchGUI\getHTML(), ilObjectAddNewItemGUI\getHTML(), ilObjContentObjectGUI\getLayoutOption(), ilNoteGUI\getOriginHeader(), ilLMPageObjectGUI\initEditLayoutForm(), ilOnScreenChatGUI\initializeFrontend(), ilPCResourcesGUI\insertResourcesIntoPageContent(), ilObjMediaPoolSubItemListGUI\parseImage(), ilSCORMTrackingItemsTableGUI\parseValue(), ilSCORM2004TrackingItemsTableGUI\parseValue(), ilNestedListInputGUI\render(), and ilExplorerBaseGUI\renderNode().

332  {
333  $img = '<img src="' . $a_src . '"';
334  if (!is_null($a_alt)) {
335  $img .= ' alt="' . htmlspecialchars($a_alt) . '"';
336  }
337  if ($a_width != "") {
338  $img .= ' width="' . htmlspecialchars($a_width) . '"';
339  }
340  if ($a_height != "") {
341  $img .= ' height="' . htmlspecialchars($a_height) . '"';
342  }
343  if ($a_class != "") {
344  $img .= ' class="' . $a_class . '"';
345  }
346  if ($a_id != "") {
347  $img .= ' id="' . $a_id . '"';
348  }
349  $img .= ' />';
350 
351  return $img;
352  }
+ 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 960 of file class.ilUtil.php.

References IL_INST_ID.

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

960  : string
961  {
962  if (substr($a_value, 0, 4) == "il__") {
963  $a_value = "il_" . IL_INST_ID . "_" . substr($a_value, 4, strlen($a_value) - 4);
964  }
965 
966  return $a_value;
967  }
const IL_INST_ID
Definition: constants.php:40
+ 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 278 of file class.ilUtil.php.

References Vendor\Package\$e, and ilMail\ILIAS_HOST.

Referenced by ilEMailInputGUI\checkInput(), ilPasswordAssistanceGUI\emailTrafo(), ilCmiXapiUser\getIdent(), ilMimeMailNotification\initLanguage(), ilSurveyExecutionGUI\mailUserResults(), ilObjSurveyGUI\mailUserResultsObject(), ilObjSurvey\updateCode(), ILIAS\Survey\Code\CodeDBRepo\updateExternalData(), ilCalendarUserNotification\validate(), and ilObjCourse\validateInfoSettings().

281  : bool {
282  if ($mailAddressParserFactory === null) {
283  $mailAddressParserFactory = new ilMailRfc822AddressParserFactory();
284  }
285 
286  try {
287  $parser = $mailAddressParserFactory->getParser($a_email);
288  $addresses = $parser->parse();
289  return count($addresses) == 1 && $addresses[0]->getHost() != ilMail::ILIAS_HOST;
290  } catch (ilException $e) {
291  return false;
292  }
293  }
const ILIAS_HOST
Class ilMailRfc822AddressParserFactory.
+ 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 public

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

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

1164  : bool
1165  {
1166  if (strlen(strip_tags($a_text)) < strlen($a_text)) {
1167  return true;
1168  }
1169 
1170  return false;
1171  }
+ Here is the caller graph for this function:

◆ isLogin()

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

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

Referenced by ilUserLoginInputGUI\checkInput(), ilAuthProviderApache\doAuthentication(), ilAccountRegistrationGUI\saveForm(), and ilPersonalProfileGUI\updateLoginOrSetErrorMessages().

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

◆ isWindows()

static ilUtil::isWindows ( )
static
Deprecated:

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

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

1011  : bool
1012  {
1013  return (strtolower(substr(php_uname(), 0, 3)) === "win");
1014  }
+ Here is the caller graph for this function:

◆ makeClickable()

static ilUtil::makeClickable ( string  $a_text,
bool  $detectGotoLinks = false 
)
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 224 of file class.ilUtil.php.

References $DIC.

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

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

◆ maskAttributeTag()

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

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

References $DIC.

Referenced by maskSecureTags().

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

◆ maskSecureTags()

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

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

References maskAttributeTag(), and maskTag().

Referenced by secureString().

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

Referenced by maskSecureTags().

713  : string
714  {
715  $a_str = str_replace(
716  ["<$tag>", "<" . strtoupper($tag) . ">"],
717  "&lt;" . $tag . "&gt;",
718  $a_str
719  );
720  $a_str = str_replace(
721  ["</$tag>", "</" . strtoupper($tag) . ">"],
722  "&lt;/" . $tag . "&gt;",
723  $a_str
724  );
725 
726  foreach ($fix_param as $p) {
727  $k = $p["param"];
728  $v = $p["value"];
729  $a_str = str_replace(
730  "<$tag $k=\"$v\">",
731  "&lt;" . "$tag $k=\"$v\"" . "&gt;",
732  $a_str
733  );
734  }
735 
736  return $a_str;
737  }
+ 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 1021 of file class.ilUtil.php.

Referenced by ilHistory\_copyEntriesForObject(), ilHistory\_createEntry(), ilLMPageObject\_getPresentationTitle(), ilObjSCORMTracking\_insertTrackData(), ilLMTracker\_isNodeVisible(), ilPageObject\_lookupActive(), ilObjUser\_setUserInactive(), ilObjUser\_toggleActiveStatusOfUsers(), ilWikiContributor\_writeStatus(), ilLikeData\addExpression(), ilExSubmission\addFileUpload(), ILIAS\Skill\Profile\SkillProfileCompletionDBRepository\addFulfilmentEntry(), ilSkillLevelDBRepository\addLevel(), ILIAS\Skill\Profile\SkillProfileCompletionDBRepository\addNonFulfilmentEntry(), ilExSubmission\addResourceObject(), ilRepositoryObjectPlugin\beforeActivation(), ilBlogPosting\create(), ilNewsItem\create(), ilWebDAVMountInstructionsDocumentFormGUI\createFilledObject(), ilPRGAssignmentDBRepository\createFor(), ilPageObject\createFromXML(), ILIAS\Notes\NotesManager\createNote(), ILIAS\Test\Setup\CloneIntroductionAndClosingRemarksMigration\createPageWithNextId(), ilAuthProviderLTI\createUser(), ilPageActivationDBRepository\getData(), ilCalendarHeaderNavigationGUI\getHTML(), ilNewsItem\getLastNewsIdForContext(), ilLMNavigationStatus\getPredecessorPageId(), ilWikiUserHTMLExport\getProcess(), ilLMNavigationStatus\getSuccessorPageId(), ilSkillUserLevelDBRepository\hasRecentSelfEvaluation(), ilLMContentRendererGUI\renderDeactivatedPageMessage(), ilSkillUserLevelDBRepository\resetUserSkillLevelStatus(), ilObjUser\saveAsNew(), ilObjForum\saveData(), ilUserProfilePromptDataGateway\saveLastUserPrompt(), ilExAssignmentMemberStatus\setFeedback(), ilExAssignmentMemberStatus\setMark(), ilExAssignmentMemberStatus\setSent(), ilExAssignmentMemberStatus\setStatus(), ilUserProfileStartUpStep\shouldInterceptRequest(), ilObjSCORMTracking\storeJsApiCmi(), ilLMTracker\trackLastPageAccess(), ilBlogPosting\unpublish(), ilObjUser\update(), ilNewsItem\update(), ilPageObject\update(), ilPageObject\updateFromXML(), ILIAS\Notes\NoteDBRepository\updateNoteText(), ilExPeerReview\updatePeerReview(), ilExPeerReview\updatePeerReviewTimestamp(), ilExSubmission\updateTextSubmission(), ilExSubmission\updateTutorDownloadTime(), ILIAS\Exercise\Submission\SubmissionDBRepository\updateWebDirAccessTime(), ilExSubmission\uploadFile(), ilPageObject\writeRenderedContent(), and ilSkillUserLevelDBRepository\writeUserSkillLevelStatus().

1021  : string
1022  {
1023  return date("Y-m-d H:i:s");
1024  }
+ 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 1356 of file class.ilUtil.php.

References ILIAS\Repository\int().

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

1356  : array
1357  {
1358  $exploded = explode('_', $a_import_id);
1359 
1360  $parsed['orig'] = $a_import_id;
1361  if ($exploded[0] == 'il') {
1362  $parsed['prefix'] = $exploded[0];
1363  }
1364  if (is_numeric($exploded[1])) {
1365  $parsed['inst_id'] = (int) $exploded[1];
1366  }
1367  $parsed['type'] = $exploded[2];
1368 
1369  if (is_numeric($exploded[3])) {
1370  $parsed['id'] = (int) $exploded[3];
1371  }
1372  return $parsed;
1373  }
+ 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 943 of file class.ilUtil.php.

References $DIC, and init().

Referenced by ilLearningProgressGUI\__getNextClass(), ilObjItemGroupGUI\_goto(), ilObjLearningSequence\_goto(), ilObjPollGUI\_goto(), ilObjGroupGUI\_goto(), ilObjLinkResourceGUI\_goto(), ilObjSystemFolderGUI\_goto(), ilObjCourseGUI\_goto(), ilCourseRegistrationGUI\add(), ilGroupRegistrationGUI\add(), ilObjLinkResourceGUI\afterSave(), ilObjMediaCastGUI\afterSave(), ilObjSurveyGUI\afterSave(), ilObjOrgUnitGUI\afterSave(), ilObjWikiGUI\afterSave(), ilObjSurveyQuestionPoolGUI\afterSave(), ilObjMediaPoolGUI\afterSave(), ilObjLearningSequenceGUI\afterSave(), ilObjQuestionPoolGUI\afterSave(), ilObjCourseGUI\afterSave(), ilTestPlayerAbstractGUI\afterTestPassFinishedCmd(), ilSurveyExecutionGUI\backToRepository(), ilObjTestGUI\backToRepositoryObject(), ilLMPageObjectGUI\cancel(), SurveyQuestionGUI\cancel(), assQuestionGUI\cancel(), ilMailFormGUI\cancelMail(), ilSharedResourceGUI\cancelPassword(), ilSessionControl\checkCurrentSessionIsAllowed(), ilContainerStartObjectsGUI\checkPermission(), ilInternalLinkGUI\closeLinkHelp(), ilObjectCopyGUI\copyMultipleNonContainer(), ilObjMediaPoolGUI\createMediaFromUploadDir(), ilNewsItem\deliverMobFile(), ilImageMapEditorGUI\editImagemapForward(), ilErrorHandling\errorHandler(), ilSAHSEditGUI\executeCommand(), ilTestExpressPageObjectGUI\executeCommand(), ilDashboardGUI\executeCommand(), ilObjMediaPoolGUI\executeCommand(), ilCalendarPresentationGUI\executeCommand(), ilObjTestGUI\executeCreateQuestionObject(), ilLTIViewGUI\getContextId(), ilPublicUserProfileGUI\getHTML(), ilObjWikiGUI\gotoPageObject(), ilObjItemGroupGUI\gotoParent(), ilObjWikiGUI\gotoStartPageObject(), ilMembershipRegistrationCodeUtils\handleCode(), ilTestExpressPageObjectGUI\handleToolbarCommand(), ilSharedResourceGUI\hasAccess(), ilObjSurveyQuestionPoolGUI\importFileObject(), ilObjSurveyGUI\importSurveyObject(), ilObjQuestionPoolGUI\importVerifiedFileObject(), ilObjTestGUI\importVerifiedFileObject(), ilEditClipboardGUI\insert(), ilMailingListsGUI\mailToList(), ilObjRoleGUI\mailToRoleObject(), ilObjSCORMLearningModuleGUI\newModuleVersionUpload(), ilTestExpressPageObjectGUI\nextQuestion(), ilExerciseManagementGUI\openSubmissionViewObject(), ilAssQuestionHintRequestGUI\performRequestCmd(), ilObjLearningSequenceLearnerGUI\play(), ilTestExpressPageObjectGUI\prevQuestion(), ilStartUpGUI\processIndexPHP(), ilObjQuestionPoolGUI\questionsObject(), ilObjTestGUI\questionsObject(), ilShibbolethWAYF\redirect(), ilInitialisation\redirect(), SurveyQuestionGUI\redirectAfterSaving(), ilExerciseManagementGUI\redirectFeedbackMailObject(), ilObjCourseGUI\redirectLocToTestConfirmedObject(), ilObjCourseGUI\redirectLocToTestObject(), ilBookingReservationsGUI\redirectMailToBooker(), ilPortfolioRepositoryGUI\redirectSendMailToSharer(), ilObjLinkResourceGUI\redirectToLink(), ilTestExpressPageObjectGUI\redirectToQuestionPoolSelectionPage(), ilContentStyleSettingsGUI\saveActiveStyles(), ilMailFormGUI\saveDraft(), assQuestionGUI\saveEdit(), ilPersonalSettingsGUI\savePassword(), ilPersonalProfileGUI\savePublicProfile(), ilContentStyleSettingsGUI\saveScope(), ilLPTableBaseGUI\sendMail(), ilObjContentObjectGUI\sendMailToBlockedUsers(), ilMembershipGUI\sendMailToSelectedUsers(), ilObjAuthSettingsGUI\setAuthModeObject(), ilObjFileBasedLMGUI\showLearningModule(), ilTestOutputGUI\submitSolutionCmd(), ilObjPollGUI\subscribe(), ilContentStyleSettingsGUI\toggleGlobalDefault(), ilContentStyleSettingsGUI\toggleGlobalFixed(), ilObjPortfolioGUI\toRepository(), ilObjPollGUI\unsubscribe(), ilObjSAHSLearningModuleGUI\uploadObject(), and ilObjPollGUI\vote().

943  : void
944  {
945  global $DIC;
946 
947  if (!isset($DIC['ilCtrl']) || !$DIC['ilCtrl'] instanceof ilCtrl) {
948  (new InitCtrlService())->init($DIC);
949  }
950  $DIC->ctrl()->redirectToURL($a_script);
951  }
Class InitCtrlService wraps the initialization of ilCtrl.
global $DIC
Definition: feed.php:28
+ 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 251 of file class.ilUtil.php.

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

251  : string
252  {
253  global $DIC;
254  $cache = $DIC['ilObjDataCache'];
255 
256  $link = $matches[0];
257  $ref_id = (int) $matches[2];
258  if ($ref_id > 0) {
259  $obj_id = $cache->lookupObjId($ref_id);
260  if ($obj_id > 0) {
261  $title = $cache->lookupTitle($obj_id);
262  $link = '<a href="' . $matches[1] . '" target="_self">' . $title . '</a>';
263  }
264  }
265 
266  return $link;
267  }
global $DIC
Definition: feed.php:28
$ref_id
Definition: ltiauth.php:67
+ Here is the call graph for this function:

◆ secureLink()

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

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

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

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

◆ securePlainString()

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

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

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

568  : string
569  {
570  if (ini_get("magic_quotes_gpc")) {
571  return stripslashes($a_str);
572  } else {
573  return $a_str;
574  }
575  }
+ 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 420 of file class.ilUtil.php.

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

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

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

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

829  : string
830  {
831  // check if url is valid (absolute or relative)
832  if (filter_var($url, FILTER_VALIDATE_URL) === false &&
833  filter_var("http://" . $url, FILTER_VALIDATE_URL) === false &&
834  filter_var("http:" . $url, FILTER_VALIDATE_URL) === false &&
835  filter_var("http://de.de" . $url, FILTER_VALIDATE_URL) === false &&
836  filter_var("http://de.de/" . $url, FILTER_VALIDATE_URL) === false) {
837  return "";
838  }
839  if (trim(strtolower(parse_url($url, PHP_URL_SCHEME) ?? '')) === "javascript") {
840  return "";
841  }
842 
843  return htmlspecialchars($url, ENT_QUOTES);
844  }
$url
Definition: ltiregstart.php:35
+ 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 1280 of file class.ilUtil.php.

References $DIC, $http, $response, IL_COOKIE_PATH, and ILIAS\Repository\int().

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

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

◆ stripOnlySlashes()

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

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

Referenced by assQuestionGUI\writeQuestionGenericPostData().

408  : string
409  {
410  if (ini_get("magic_quotes_gpc")) {
411  $a_str = stripslashes($a_str);
412  }
413 
414  return $a_str;
415  }
+ 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 781 of file class.ilUtil.php.

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

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

References secureString().

Referenced by ilObjTaggingSettingsGUI\__construct(), ilSessionReminderCheck\__construct(), ilTaxonomyExplorerGUI\__construct(), ilSearchGUI\__construct(), ilLDAPSettingsGUI\__construct(), ilUserSearchFilter\__parseQueryString(), ilSearchGUI\__parseQueryString(), ilRepositorySearchGUI\__parseQueryString(), ilAdvancedSearchGUI\__performContentSearch(), ilAdvancedSearchGUI\__performEntitySearch(), ilAdvancedSearchGUI\__performGeneralSearch(), ilAdvancedSearchGUI\__performKeywordSearch(), ilAdvancedSearchGUI\__performLifecycleSearch(), ilAdvancedSearchGUI\__performTaxonSearch(), ilAdvancedSearchGUI\__performTitleSearch(), ilObjUserGUI\__sendProfileMail(), ilPCParagraph\_input2xml(), ilFileUtils\_sanitizeFilemame(), ilHierarchyFormGUI\_str(), ilObjContentObjectGUI\addTooltip(), ilPCInteractiveImage\addTriggerArea(), ILIAS\Container\Content\Filter\FilterManager\apply(), ilCmiXapiStatementsGUI\asyncUserAutocompleteCmd(), ilLTIConsumerXapiStatementsGUI\asyncUserAutocompleteCmd(), ilLTIConsumerGradeSynchronizationGUI\asyncUserAutocompleteCmd(), ilObjForumGUI\autosaveDraftAsyncObject(), ilObjForumGUI\autosaveThreadDraftAsyncObject(), ilRepositoryTrashGUI\buildPath(), ilObjSystemFolderGUI\changeHeaderTitleObject(), ilDashboardBlockGUI\changePDItemPresentationObject(), ilDashboardBlockGUI\changePDItemSortingObject(), ilMailQuickFilterInputGUI\checkInput(), ilClozeGapInputBuilderGUI\checkInput(), ilOrgUnitMultiLineInputGUI\checkInput(), ilSuggestedSolutionSelectorGUI\checkInput(), ilFileInputGUI\checkInput(), ilObjSurvey\cloneTextblocks(), ilFileSystemGUI\createDirectory(), ilObjFileBasedLMGUI\createFromDirectory(), ilObjForumGUI\decorateWithAutosave(), ilExAssignmentEditorGUI\deleteAssignmentsObject(), ilMailAttachmentGUI\deleteAttachments(), ilFileSystemGUI\deleteFile(), ilPCInteractiveImage\deleteOverlay(), ilPCInteractiveImageGUI\deleteOverlays(), ilObjSurveyGUI\doAutoCompleteObject(), ilObjForumGUI\doHistoryCheck(), ilStartUpGUI\doSamlAuthentication(), ilSCORM13PlayerGUI\downloadLog(), ilObjLanguageExtGUI\downloadObject(), ilTestExpressPageObjectGUI\executeCommand(), ilMailGUI\executeCommand(), ilCronManagerGUI\executeCommand(), ilObjTestGUI\executeCommand(), assQuestionGUI\executeCommand(), ilObjContentObjectGUI\export(), ilObjMediaPoolGUI\export(), ilObjContentObjectGUI\exportHTML(), ilFileSystemGUI\extCommand(), ilExportIDTableGUI\fillRow(), ilPDNewsTableGUI\fillRow(), ilMailSearchObjectMembershipsTableGUI\fillRow(), ilMailTemplateGUI\getAjaxPlaceholdersById(), ilPCDataTableGUI\getCellContent(), ilSCORM13MDImporter\getDescription(), ilObjUser\getFullname(), ilFormulaInputGUI\getInput(), ilTextAreaInputGUI\getInput(), ilUserLPTableGUI\getItems(), ilLMQuestionListTableGUI\getItems(), ilAssignedUsersTableGUI\getItems(), ilSCORMTrackingItemsTableGUI\getItems(), ilSCORM2004TrackingItemsTableGUI\getItems(), ilTrUserObjectsPropsTableGUI\getItems(), ilTrObjectUsersPropsTableGUI\getItems(), ilTrSummaryTableGUI\getItems(), ilExplorerBaseGUI\getNodeAsync(), assAnswerCloze\getNumericValueFromText(), ilObjForumGUI\getOrderByParam(), ilSCORMPackageParser\getPackageTitle(), assTextQuestion\getSolutionSubmit(), ilTaggingGUI\getTagsFromInput(), ilSCORM13MDImporter\getTitle(), ilUserTableGUI\getUserIdsForFilter(), ilChatroomInviteUsersToPrivateRoomGUI\getUserList(), ilPCParagraph\handleAjaxContent(), ilObjSessionGUI\handleFileUpload(), ilObjForumGUI\handleFormInput(), ilSCORMPackageParser\handlerCharacterData(), ilChatroomXMLParser\handlerEndTag(), ilForumXMLParser\handlerEndTag(), ilSCORM13Package\il_import(), ilContentPageDataSet\importRecord(), ilScormAiccImporter\importXmlRepresentation(), ilPresentationFullGUI\initFilter(), ILIAS\COPage\PC\MediaObject\MediaObjectCommandActionHandler\insertCommand(), ilObjChatroomGUI\insertObject(), ILIAS\COPage\PC\Paragraph\ParagraphCommandActionHandler\insertParagraph(), ilGlossaryPresentationGUI\listTerms(), ilECSUser\loadFromGET(), ilLDAPRoleGroupMappingSettings\loadFromPost(), ilECSSettingsGUI\loadFromPost(), ilObjEmployeeTalkSeriesGUI\loadRecurrenceSettings(), ilEmployeeTalkAppointmentGUI\loadRecurrenceSettings(), ilObjSessionGUI\loadRecurrenceSettings(), ilLDAPSettingsGUI\loadRoleAssignmentRule(), ilMailSearchGUI\lookupRecipientAsync(), ilMailFormGUI\lookupRecipientAsync(), ilObjLanguageExtGUI\maintainExecuteObject(), ilCSVReader\open(), ilSCORM13PlayerGUI\openLog(), assQuestionGUI\outChapterSelector(), assQuestionGUI\outPageSelector(), ilSCORMTrackingUsersTableGUI\parse(), ilTrashTableGUI\parse(), ilFileSystemGUI\parseCurrentDirectory(), ilObjStudyProgrammeAutoMembershipsGUI\parseQueryString(), ilRepositorySearchGUI\performSearch(), ilMarkSchemaGUI\populateMarkSchemaFormData(), ilLegacyFormElementsUtil\prepareFormOutput(), ilAnswerWizardInputGUI\prepareFormOutput(), ilLMPageGUI\processAnswer(), ilICalParser\purgeString(), ilMailBodyPurifier\purify(), ilInitialisation\redirect(), ilLuceneSearchGUI\remoteSearch(), ilExAssignmentFileSystemGUI\renameFile(), ilFileSystemGUI\renameFile(), ilTable2GUI\restoreTemplate(), ilTestScoringByQuestionsGUI\retrieveFeedback(), ilEMailInputGUI\sanitize(), ilFileSystemGUI\sanitizeCurrentDirectory(), ilQtiMatImageSecurity\sanitizeLabel(), ilChatroomFormFactory\saniziteArrayElementsTrafo(), ilLMEditShortTitlesGUI\save(), ilLMPageObjectGUI\save(), ilObjSkillTreeGUI\saveAllTemplateTitles(), ilObjSkillTreeGUI\saveAllTitles(), ilExerciseManagementGUI\saveCommentForLearnersObject(), ilExerciseManagementGUI\saveEvaluationFromModalObject(), ilObjContentObjectGUI\saveExportIds(), ilObjWikiGUI\saveGradingObject(), ilObjSystemFolderGUI\saveHeaderTitleObject(), ilObjSystemFolderGUI\saveHeaderTitlesObject(), ilSurveyEditorGUI\saveHeadingObject(), ilObjSystemFolderGUI\saveJavaServerObject(), ilTestScoringGUI\saveManScoringParticipantScreen(), ilPCParagraph\saveMetaKeywords(), ilObjLanguageExtGUI\saveObject(), ilObjPortfolioBaseGUI\savePortfolioPagesOrdering(), ilObjAssessmentFolderGUI\saveSettingsObject(), ilObjTaxonomyGUI\saveSorting(), ilPortfolioRepositoryGUI\saveTitles(), ilObjectTranslationGUI\saveTranslations(), ilObjStudyProgrammeTreeGUI\saveTreeOrder(), assLongMenu\saveWorkingData(), assClozeTest\saveWorkingData(), ilLegalDocumentsAdministrationGUI\searchUser(), ilPCTableGUI\setAlignment(), ilForumPageCommandForwarder\setBackLinkTab(), ilContentPagePageCommandForwarder\setBackLinkTab(), ilSCORM13MDImporter\setDescription(), ilPCInteractiveImage\setMapAreaProperties(), ilObjMediaObjectGUI\setObjectPerCreationForm(), ilLDAPRoleGroupMappingSetting\setRoleByName(), ilPCTableGUI\setStyles(), ilSCORM13MDImporter\setTitle(), ilPCInteractiveImage\setTriggerProperties(), ilPCTableGUI\setWidths(), ilCalendarCategoryGUI\sharePerformSearch(), ilRepositoryTrashGUI\showDeleteConfirmation(), ilStartUpGUI\showSamlLoginForm(), ilObjSCORM2004LearningModuleGUI\showTrackingItems(), ilObjSCORMLearningModuleGUI\showTrackingItems(), ilObjSCORM2004LearningModuleGUI\showTrackingItemsBySco(), ilObjSCORMLearningModuleGUI\showTrackingItemsBySco(), ilObjForumGUI\showUserObject(), ILIAS\COPage\PC\Paragraph\ParagraphCommandActionHandler\split(), ilBadgeGUIRequest\strArray(), ILIAS\User\UserGUIRequest\strArray(), ILIAS\Repository\HTML\HTMLUtil\strip(), ILIAS\Repository\strip(), ilCertificateUtilHelper\stripSlashes(), ilFormPropertyGUI\stripSlashesAddSpaceFallback(), SurveyQuestion\stripSlashesAddSpaceFallback(), ilArrayUtil\stripSlashesArray(), ilArrayUtil\stripSlashesRecursive(), assLongMenuGUI\stripSlashesRecursive(), ilClozeGapInputBuilderGUI\stripSlashesRecursive(), ilDataSet\stripTags(), ilBuddySystemGUI\transitionAsyncCommand(), ilContainerBaseXmlParser\trimAndStrip(), ilStyleImportParser\trimAndStrip(), ilExerciseXMLParser\trimAndStrip(), ilMDSaxParser\trimAndStrip(), SurveyImportParser\trimAndStrip(), ILIAS\COPage\Page\PageCommandActionHandler\updateCommand(), ilPCDataTableGUI\updateJS(), ilMDKeyword\updateKeywords(), ilObjLinkResourceGUI\updateLinks(), ilExerciseXMLParser\updateMarking(), ilSessionMembershipGUI\updateMembers(), ILIAS\COPage\PC\Paragraph\ParagraphCommandActionHandler\updateParagraph(), ilAdvancedMDSettingsGUI\updateRecords(), ilRegistrationGUI\updateSubscriptionRequest(), ilExAssignmentFileSystemGUI\uploadFile(), ilFileSystemGUI\uploadFile(), ilObjLanguageExtGUI\uploadObject(), ilObjForumGUI\viewThreadObject(), assMatchingQuestionGUI\writeAnswerSpecificPostData(), and assLongMenuGUI\writeQuestionSpecificPostData().

396  : string
397  {
398  if (ini_get("magic_quotes_gpc")) {
399  $a_str = stripslashes($a_str);
400  }
401 
402  return ilUtil::secureString($a_str, $a_strip_html, $a_allow);
403  }
static secureString(string $a_str, bool $a_strip_html=true, string $a_allow="")
+ 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 211 of file class.ilUtil.php.

Referenced by ilObjForumGUI\renderPostContent(), and ilForumExportGUI\renderPostHtml().

211  : string
212  {
213  if (!($a_num % 2)) {
214  return $a_css1;
215  } else {
216  return $a_css2;
217  }
218  }
+ Here is the caller graph for this function:

◆ tf2yn()

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

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

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

914  : string
915  {
916  if ($a_tf) {
917  return "y";
918  } else {
919  return "n";
920  }
921  }
+ Here is the caller graph for this function:

◆ unmaskAttributeTag()

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

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

References $DIC, and secureLink().

Referenced by unmaskSecureTags().

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

References unmaskAttributeTag(), and unmaskTag().

Referenced by secureString().

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

Referenced by unmaskSecureTags().

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

◆ yn2tf()


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