ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilUtil Class Reference

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

+ Collaboration diagram for ilUtil:

Static Public Member Functions

static getImageTagByType (string $a_type, string $a_path, bool $a_big=false)
 Builds an html image tag. More...
 
static getImagePath (string $image_name, string $module_path="", string $mode="output", bool $offline=false)
 get image path (for images located in a template directory) More...
 
static getHtmlPath (string $relative_path)
 get url of path More...
 
static getStyleSheetLocation (string $mode="output", string $a_css_name="")
 get full style sheet file name (path inclusive) of current user More...
 
static getNewContentStyleSheetLocation (string $mode="output")
 get full style sheet file name (path inclusive) of current user More...
 
static switchColor (int $a_num, string $a_css1, string $a_css2)
 switches style sheets for each even $a_num (used for changing colors of different result rows) More...
 
static makeClickable (string $a_text, bool $detectGotoLinks=false)
 
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 1193 of file class.ilUtil.php.

References ILIAS\Repository\int(), and null.

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

1193  : ?int
1194  {
1195  $test_str = explode('_', $ilias_id);
1196 
1197  $parsed_inst_id = (int) ($test_str[1] ?? 0);
1198  $prefix = $test_str[0] ?? '';
1199 
1200  if ($prefix === 'il' && $parsed_inst_id === $inst_id && count($test_str) === 4) {
1201  return is_numeric($test_str[3]) ? (int) $test_str[3] : null;
1202  }
1203  return null;
1204  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ 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 1173 of file class.ilUtil.php.

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

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

1173  : ?int
1174  {
1175  $test_str = explode('_', $role_title);
1176  $prefix = $test_str[0] ?? '';
1177 
1178  if ($prefix === 'il') {
1179  $ref_id = $test_str[3] ?? null;
1180  return is_numeric($ref_id) ? (int) $ref_id : null;
1181  }
1182  return null;
1183  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$ref_id
Definition: ltiauth.php:65
+ 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 1321 of file class.ilUtil.php.

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

Referenced by ilSamlIdpTableGUI\__construct(), ILIAS\COPage\Editor\Server\UI\ServerTable\__construct(), ilSessionReminderCheck\__construct(), ILIAS\Mail\Attachments\MailAttachmentTableGUI\__construct(), ILIAS\BackgroundTasks\Task\Job\Manager\UI\JobTable\__construct(), ilMail\_getAutoGeneratedMessageString(), ILIAS\Mail\Placeholder\MailSignatureIliasUrlPlaceholder\addPlaceholder(), ilAuthProviderCAS\doAuthentication(), ilErrorHandling\errorHandler(), ilPasswordAssistanceGUI\getBaseUrl(), ilMailEnvironmentHelper\getHttpPath(), ilTestPlayerAbstractGUI\getNavigationUrlParameter(), ilForumMailNotification\getPermanentLink(), ilForumMailEventNotificationSender\getPermanentLink(), ilChatroomAdminViewGUI\getReadmePath(), ilMailFormCall\getRefererRedirectUrl(), ilSoapClient\init(), ILIAS\BackgroundTasks\Task\Job\Manager\JobManagerImpl\runActiveJobs(), ilMailSummaryNotification\send(), ilCronDeleteInactiveUserReminderMail\sendReminder(), ilMailFolderGUI\showFolder(), and ilStartUpGUI\showLogout().

1321  : string
1322  {
1323  global $DIC;
1324 
1325  $ilIliasIniFile = $DIC["ilIliasIniFile"];
1326 
1327  if ((isset($_SERVER['SHELL']) && $_SERVER['SHELL']) || PHP_SAPI === 'cli' ||
1328  // fallback for windows systems, useful in crons
1329  (class_exists("ilContext") && !ilContext::usesHTTP())) {
1330  return $ilIliasIniFile->readVariable('server', 'http_path');
1331  } else {
1332  return ILIAS_HTTP_PATH;
1333  }
1334  }
static usesHTTP()
Uses HTTP aka browser.
$ilIliasIniFile
Definition: server.php:35
$_SERVER['HTTP_HOST']
Definition: raiseError.php:26
global $DIC
Definition: shib_login.php:22
+ 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 1048 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(), and ilECSSettingsGUI\imported().

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

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

References $url.

Referenced by ilCmiXapiStatementsDeleteRequest\_lookUpDataCount(), ilObjectListGUI\appendRepositoryFrameParameter(), ilXapiCompliantStatementsReportLinkBuilder\appendRequestParameters(), ilCmiXapiAbstractReportLinkBuilder\appendRequestParameters(), ILIAS\StaticURL\Handler\HandlerService\appendUnknownParameters(), assImagemapQuestionGUI\buildAreaLinkTarget(), ilCmiXapiLaunchGUI\buildLaunchLink(), ilPasswordAssistanceGUI\buildUrl(), ilAssQuestionHintRequestGUI\confirmRequestCmd(), ilStartUpGUI\doApacheAuthentication(), ilRTEGlobalTemplate\fillJavascriptFile(), ilGlobalTemplate\fillJavascriptFile(), ilDataCollectionGlobalTemplate\fillJavascriptFile(), ilAssQuestionHintsTableGUI\fillRow(), ilCmiXapiStatementsDeleteRequest\getBatchUrl(), ilObjQuestionPoolListGUI\getCommandLink(), ilObjTestListGUI\getCommandLink(), ilCmiXapiStatementsDeleteRequest\getDeleteStateUrls(), 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().

374  : string
375  {
376  $amp = $xml_style
377  ? "&amp;"
378  : "&";
379 
380  $url = (is_int(strpos($a_url, "?")))
381  ? $a_url . $amp . $a_par
382  : $a_url . "?" . $a_par;
383 
384  return $url;
385  }
$url
Definition: shib_logout.php:66
+ 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 922 of file class.ilUtil.php.

Referenced by ilObjMediaObject\_determineWidthHeight(), and ilMediaItem\getOriginalSize().

922  : bool
923  {
924  if (($a_mime == "image/gif") || ($a_mime == "image/jpeg") ||
925  ($a_mime == "image/png") || ($a_mime == "application/x-shockwave-flash") ||
926  ($a_mime == "image/tiff") || ($a_mime == "image/x-ms-bmp") ||
927  ($a_mime == "image/psd") || ($a_mime == "image/iff")) {
928  return true;
929  } else {
930  return false;
931  }
932  }
+ 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 351 of file class.ilUtil.php.

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

Referenced by 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(), ilObjTestFolderGUI\exportLegacyLogsObject(), ilObjTestGUI\exportLegacyLogsObject(), ilDidacticTemplateSettingsGUI\exportTemplate(), ilCalendarRemoteAccessHandler\handleRequest(), ilForumExportGUI\printPost(), ilObjSCORMLearningModule\sendExportFile(), and ilChatroomHistoryGUI\showMessages().

355  : void {
356  global $DIC;
357  $delivery = new Delivery(
358  Delivery::DIRECT_PHP_OUTPUT,
359  $DIC->http()
360  );
361  $delivery->setMimeType($mime);
362  $delivery->setSendMimeType(true);
363  $delivery->setDisposition(Delivery::DISP_ATTACHMENT);
364  $delivery->setDownloadFileName($a_filename);
365  $delivery->setConvertFileNameToAsci(true);
366  $repsonse = $DIC->http()->response()->withBody(Streams::ofString($a_data));
367  $DIC->http()->saveResponse($repsonse);
368  $delivery->deliver();
369  }
setMimeType(string $mime_type)
Definition: Delivery.php:282
global $DIC
Definition: shib_login.php:22
Class Delivery.
Definition: Delivery.php:39
+ 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 843 of file class.ilUtil.php.

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

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

References $DIC, $lng, $txt, and null.

1384  : string {
1385  global $DIC;
1386 
1387  $lng = $DIC->language();
1388 
1389  if ($a_dec_point === null) {
1390  $a_dec_point = ".";
1391  }
1392  if ($a_dec_point === '-lang_sep_decimal-') {
1393  $a_dec_point = ".";
1394  }
1395 
1396  if ($a_thousands_sep === null) {
1397  $a_thousands_sep = $lng->txt('lang_sep_thousand');
1398  }
1399  if ($a_thousands_sep === '-lang_sep_thousand-') {
1400  $a_thousands_sep = ",";
1401  }
1402 
1403  $txt = number_format($a_float, $a_decimals, $a_dec_point, $a_thousands_sep);
1404 
1405  // remove trailing ".0"
1406  if (($a_suppress_dot_zero == 0 || $a_decimals == 0)
1407  && substr($txt, -2) == $a_dec_point . '0'
1408  ) {
1409  $txt = substr($txt, 0, strlen($txt) - 2);
1410  }
1411  if ($a_float == 0 and $txt == "") {
1412  $txt = "0";
1413  }
1414 
1415  return $txt;
1416  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
$txt
Definition: error.php:31
global $lng
Definition: privfeed.php:31

◆ formatSize()

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

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

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

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

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

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

References $DIC, $lng, and null.

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

1434  : string
1435  {
1436  global $DIC;
1437 
1438  $lng = $DIC->language();
1439  if ($a_lng == null) {
1440  $a_lng = $lng;
1441  }
1442 
1443  $mag = 1024;
1444 
1445  if ($size >= $mag * $mag * $mag) {
1446  $scaled_size = $size / $mag / $mag / $mag;
1447  $scaled_unit = 'lang_size_gb';
1448  } else {
1449  if ($size >= $mag * $mag) {
1450  $scaled_size = $size / $mag / $mag;
1451  $scaled_unit = 'lang_size_mb';
1452  } else {
1453  if ($size >= $mag) {
1454  $scaled_size = $size / $mag;
1455  $scaled_unit = 'lang_size_kb';
1456  } else {
1457  $scaled_size = $size;
1458  $scaled_unit = 'lang_size_bytes';
1459  }
1460  }
1461  }
1462 
1463  $result = self::fmtFloat(
1464  $scaled_size,
1465  ($scaled_unit
1466  == 'lang_size_bytes') ? 0 : 1,
1467  $a_lng->txt('lang_sep_decimal'),
1468  $a_lng->txt('lang_sep_thousand'),
1469  true
1470  )
1471  . ' ' . $a_lng->txt($scaled_unit);
1472  if ($a_mode == 'long' && $size > $mag) {
1473  $result .= ' (' . self::fmtFloat(
1474  $size,
1475  0,
1476  $a_lng->txt('lang_sep_decimal'),
1477  $a_lng->txt('lang_sep_thousand')
1478  ) . ' '
1479  . $a_lng->txt('lang_size_bytes') . ')';
1480  }
1481 
1482  return $result;
1483  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
global $lng
Definition: privfeed.php:31
+ Here is the caller graph for this function:

◆ getHtmlPath()

static ilUtil::getHtmlPath ( string  $relative_path)
static

get url of path

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

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

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

109  : string
110  {
111  if (substr($relative_path, 0, 2) == './') {
112  $relative_path = (substr($relative_path, 1));
113  }
114  if (substr($relative_path, 0, 1) != '/') {
115  $relative_path = '/' . $relative_path;
116  }
117  $htmlpath = ILIAS_HTTP_PATH . $relative_path;
118  return $htmlpath;
119  }
+ Here is the caller graph for this function:

◆ getImagePath()

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

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

Deprecated:
use UI Service!

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

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

Referenced by ilPollUserTableGUI\__construct(), ilStudyProgrammeIndividualPlanTableGUI\__construct(), ilStudyProgrammeExpandableProgressListGUI\__construct(), ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\Extract\Video\VideoItem\__construct(), ilTermDefinitionEditorGUI\__construct(), ilRepositoryObjectPlugin\_getImagePath(), ilPCTableGUI\_renderTable(), ilWikiPageGUI\addHeaderAction(), ilObjDataCollectionGUI\addHeaderAction(), ilContainerRenderer\addHeaderRow(), ilContainerGUI\addHeaderRow(), ILIAS\UI\Implementation\Component\Layout\Page\PageQueryActionHandler\allCommand(), ilUserPrivacySettingsGUI\appendChatJsToTemplate(), ilExSubmissionObjectGUI\askUnlinkBlogObject(), ilExSubmissionObjectGUI\askUnlinkPortfolioObject(), ilPersonalSkillsGUI\assignMaterials(), ilObjAuthSettingsGUI\authSettingsObject(), ilLPStatusIcons\buildImagePath(), assMatchingQuestionGUI\buildTermHtml(), 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(), 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(), ilTable2GUI\fillActionRow(), ilLuceneAdvancedSearchGUI\fillAdminPanel(), ilLuceneSearchGUI\fillAdminPanel(), ILIAS\components\UICore\MetaTemplate\PageContentGUI\fillAdminPanel(), ilGlobalTemplate\fillAdminPanel(), ilDataCollectionGlobalTemplate\fillAdminPanel(), ilTable2GUI\fillHeader(), ilConditionHandlerTableGUI\fillRow(), ilLDAPRoleAssignmentTableGUI\fillRow(), ilShibbolethRoleAssignmentTableGUI\fillRow(), ilAccessPermissionsStatusTableGUI\fillRow(), ilCalendarSharedListTableGUI\fillRow(), ilCalendarInboxSharedTableGUI\fillRow(), ilAvailableRolesStatusTableGUI\fillRow(), ilCourseObjectiveQuestionsTableGUI\fillRow(), ilECSServerTableGUI\fillRow(), ilHistoryTableGUI\fillRow(), ilCalendarManageTableGUI\fillRow(), ilLMPagesTableGUI\fillRow(), ilClipboardTableGUI\fillRow(), ilPageLayoutTableGUI\fillRow(), ilItemGroupItemsTableGUI\fillRow(), ilLPCollectionSettingsTableGUI\fillRow(), ilExportIDTableGUI\fillRow(), ilTimingsPersonalTableGUI\fillRow(), ilCourseReferenceDeleteConfirmationTableGUI\fillRow(), ilTimingsManageTableGUI\fillRow(), ilSessionOverviewTableGUI\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(), assQuestionGUI\generateCorrectnessIconsForCorrectness(), ilForumThreadFormGUI\generateInputItems(), ilPasswordAssistanceGUI\getAssignPasswordForm(), ilUserAvatarResolver\getAvatar(), ILIAS\Mail\Folder\MailFolderTableUI\getAvatar(), ilPCInteractiveImage\getBackgroundImage(), ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable\getColums(), ILIAS\GlobalScreen\Scope\Layout\Provider\PagePart\StandardPagePartProvider\getContent(), ilAssNestedOrderingElementsInputGUI\getCorrectnessIcon(), ILIAS\LearningModule\Table\SubObjectRetrieval\getData(), ilPCMediaObjectGUI\getEnabledMapAreas(), ilFirstLoginLearningHistoryProvider\getEntries(), ilCourseLearningHistoryProvider\getEntries(), ilLearningHistoryEntryCollector\getEntries(), ilBadgeLearningHistoryProvider\getEntries(), ilSkillLearningHistoryProvider\getEntries(), ilStudyProgrammeExpandableProgressListGUI\getExpandedImageURL(), ILIAS\GlobalScreen\Scope\Layout\Provider\PagePart\StandardPagePartProvider\getFaviconPath(), ilLMPresentationGUI\getHeaderAction(), ilDclBooleanRecordRepresentation\getHTML(), ilMainMenuSearchGUI\getHTML(), ilNewsTimelineGUI\getHTML(), ilAdvancedSelectionListGUI\getHTML(), ilRatingGUI\getHTML(), ilForumNotificationTableGUI\getIcon(), ILIAS\File\Icon\IconDatabaseRepository\getIconFilePathBySuffix(), ILIAS\Administration\AdministrationMainBarProvider\getIconForGroup(), ilObject\getIconForType(), 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(), ilPDMailBlockGUI\getListItemForData(), ILIAS\COPage\PC\InteractiveImage\InteractiveImageQueryActionHandler\getLoader(), ILIAS\GlobalScreen\Scope\Layout\Provider\PagePart\StandardPagePartProvider\getLogo(), ilLMHtmlExportViewLayoutProvider\getMainBarModification(), ILIAS\Test\Results\Presentation\AttemptResultsTable\getMapping(), ILIAS\User\Provider\UserMetaBarProvider\getMetaBarItems(), ilLMEditorExplorerGUI\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(), ilPortfolioRepositoryGUI\getPortfolioList(), assSingleChoiceGUI\getPreview(), assMultipleChoiceGUI\getPreview(), assKprimChoiceGUI\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(), ILIAS\components\Authentication\Pages\AuthPageLanguagesOverviewTable\getStatusIcon(), ilPRGStatusInfoBuilder\getStatusInfoFor(), ilObjGlossaryGUI\getTemplate(), assKprimChoiceGUI\getTestOutput(), assSingleChoiceGUI\getTestOutput(), assMultipleChoiceGUI\getTestOutput(), ilPageObjectGUI\getTinyMenu(), ilLMGSToolProvider\getTocTool(), ilMediaPoolGSToolProvider\getToolsForContextStack(), ilCOPageEditGSToolProvider\getToolsForContextStack(), ilLMGSToolProvider\getToolsForContextStack(), ilTaxonomyGSToolProvider\getToolsForContextStack(), ilLMEditGSToolProvider\getToolsForContextStack(), ilSkillGSToolProvider\getToolsForContextStack(), ILIAS\UI\Implementation\Component\Layout\Page\PageQueryActionHandler\getTopActions(), ilLMPresentationGUI\ilMedia(), ilLMPageObjectGUI\initEditLayoutForm(), ilObjGroupGUI\initForm(), ilConditionHandlerGUI\initFormCondition(), ilObjCmiXapiGUI\initHeaderAction(), ilObjBookingPoolGUI\initHeaderAction(), ilObjLTIConsumerGUI\initHeaderAction(), ilObjStudyProgrammeGUI\initHeaderAction(), ilObjBlogGUI\initHeaderAction(), ilObjGroupGUI\initHeaderAction(), ilObjCourseGUI\initHeaderAction(), ilObjForumGUI\initHeaderAction(), ILIAS\Chatroom\BuildChat\initialData(), ilOnScreenChatGUI\initializeFrontend(), ilAwarenessGUI\initJS(), ilObjUserFolderGUI\initNewAccountMailForm(), ilLMPresentationGUI\initScreenHead(), 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(), assMatchingQuestionGUI\populateDefinition(), ilDashboardGUI\prepareContentView(), ilGlossaryPresentationGUI\prepareOutput(), ilCalendarPresentationGUI\prepareOutput(), ilLMNavigationRendererGUI\render(), ilProgressBar\render(), ilTableGUI\render(), ilTable2GUI\render(), ilPCTableGUI\renderCell(), ilRatingGUI\renderDetails(), ilCalendarSelectionBlockGUI\renderItem(), ILIAS\Chatroom\BuildChat\renderLanguageVariables(), ilObjForumGUI\renderPostContent(), assSingleChoiceGUI\renderSolutionOutput(), assMultipleChoiceGUI\renderSolutionOutput(), assMatchingQuestionGUI\renderSolutionOutput(), assKprimChoiceGUI\renderSolutionOutput(), ilObjLearningSequenceContentGUI\renderTable(), ilPersonalSkillsGUI\saveSelfEvaluation(), ilPersonalSkillsGUI\selfEvaluation(), ilBadgeHandler\sendNotification(), ilLMPresentationGUI\setHeader(), ilImageLinkButton\setImage(), ilSAHSPresentationGUI\setInfoTabs(), ilStructureObjectGUI\setTabs(), ilPageLayoutGUI\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\showAssistanceForm(), ilStartUpGUI\showCASLoginForm(), ilLTIConsumerContentGUI\showEmbedded(), ilMailGUI\showHeader(), ilInternalLinkGUI\showLinkHelp(), ilObjMediaPoolGUI\showMedia(), ilPasswordAssistanceGUI\showMessageForm(), ilPageObjectGUI\showPage(), ilContainerGUI\showPasteTreeObject(), ilLMPresentationGUI\showPrintView(), ilLMPresentationGUI\showPrintViewSelection(), ilMailSearchGUI\showResults(), ilLocalUserGUI\showRolesTable(), ilAssQuestionSkillAssignmentsGUI\showSkillSelectionCmd(), ilCourseContentGUI\showStartObjects(), ilContactGUI\showSubTabs(), ilObjectCopyGUI\showTargetSelectionTree(), ilMailFolderGUI\showUser(), ilPasswordAssistanceGUI\showUsernameAssistanceForm(), and ILIAS\TestQuestionPool\Questions\Presentation\QuestionTable\taxonomyRepresentation().

71  : string {
72  if ($offline) {
73  return "./images/" . $image_name;
74  }
75 
76  global $DIC;
77  $styleDefinition = $DIC["styleDefinition"] ?? null;
78 
79  if ($module_path != "") {
80  throw new \LogicException(
81  "\$module_path only supports '' as value."
82  );
83  }
84 
85  $use_custom_skin = (ilStyleDefinition::getCurrentSkin() !== "default");
86 
87  if ($use_custom_skin) {
88  $filename =
89  "./Customizing/skin/"
92  . (!is_object($styleDefinition) ? "images" : $styleDefinition->getImageDirectory(ilStyleDefinition::getCurrentStyle())) . "/"
93  . $image_name;
94 
95  if (file_exists($filename)) {
96  return $filename;
97  }
98  }
99 
100  return "./assets/images/" . $image_name;
101  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static getCurrentSkin()
get the current skin use always this function instead of getting the account&#39;s skin the current skin ...
global $DIC
Definition: shib_login.php:22
$filename
Definition: buildRTE.php:78
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: shib_login.php:22
$filename
Definition: buildRTE.php:78
global $lng
Definition: privfeed.php:31
+ 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 180 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().

180  : string
181  {
182 
183  // use ilStyleDefinition instead of account to get the current skin and style
184  if (ilStyleDefinition::getCurrentSkin() == "default") {
185  $in_style = "./templates/" . ilStyleDefinition::getCurrentSkin() . "/"
186  . ilStyleDefinition::getCurrentStyle() . "_cont.css";
187  } else {
188  $in_style = "./Customizing/global/skin/" . ilStyleDefinition::getCurrentSkin() . "/"
189  . ilStyleDefinition::getCurrentStyle() . "_cont.css";
190  }
191 
192  if (is_file("./" . $in_style)) {
193  return $in_style;
194  } else {
195  return "assets/css/delos_cont.css";
196  }
197  }
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 473 of file class.ilUtil.php.

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

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

◆ getStyleSheetLocation()

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

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

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

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

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

Referenced by ilExport\_generateIndexFile(), ilTinyMCE\addRTESupport(), ilTinyMCE\addUserTextEditor(), ilSCORMPresentationGUI\contentSelect(), ilObjTest\deliverPDFfromHTML(), ilPageObjectGUI\displayMedia(), ilObjSurveyQuestionPoolGUI\executeCommand(), ilSCORMPresentationGUI\explorer(), ilSystemStyleHTMLExport\export(), ILIAS\UI\Implementation\Component\Layout\Page\PageQueryActionHandler\getConfig(), ILIAS\Notes\Export\NotesHtmlExport\getInitialisedTemplate(), ILIAS\Portfolio\Export\PortfolioHtmlExport\getInitialisedTemplate(), ILIAS\Wiki\Export\BlogHtmlExport\getInitialisedTemplate(), ilExplorer\getOutput(), ilSCORM13PlayerGUI\getPlayer(), ilCOPageHTMLExport\getPreparedMainTemplate(), ilPlugin\getStyleSheetLocation(), ilCOPageHTMLExport\initResourceTemplate(), ILIAS\Glossary\Export\GlossaryHtmlExport\initScreen(), ILIAS\LearningModule\Export\LMHtmlExport\initScreen(), ilLMPresentationGUI\layout(), ilGlossaryPresentationGUI\media(), ilTestServiceGUI\outCorrectSolution(), ilTestPlayerAbstractGUI\outCorrectSolution(), ilLMPresentationGUI\page(), ilGlobalPageTemplate\prepareBasicCSS(), ILIAS\Test\Questions\Presentation\Printer\printAnswers(), ilForumExportGUI\printPost(), ILIAS\Test\Questions\Presentation\Printer\printSelectedQuestions(), ilForumExportGUI\printThread(), ilPortfolioPageGUI\renderConsultationHours(), ILIAS\Export\PrintProcessGUI\renderPrintView(), ilTestEvaluationGUI\setCss(), ilLMPresentationGUI\setSystemStyle(), ilInternalLinkGUI\showLinkHelp(), ilContainerGUI\showLinkListObject(), ilTestPlayerAbstractGUI\showListOfAnswers(), ilObjMediaPoolGUI\showMedia(), ilPageObjectGUI\showMediaFullscreen(), ilObjMediaPoolGUI\showPage(), ilSCORM13PlayerGUI\specialPage(), ilSAHSPresentationGUI\view(), and ilSCORMPresentationGUI\view().

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

References $DIC.

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

1247  {
1248  global $DIC;
1249 
1250  $box_factory = $DIC->ui()->factory()->messageBox();
1251  switch ($a_type) {
1252  case 'info':
1253  $box = $box_factory->info($a_txt);
1254  break;
1255  case 'success':
1256  $box = $box_factory->success($a_txt);
1257  break;
1258  case 'question':
1259  $box = $box_factory->confirmation($a_txt);
1260  break;
1261  case 'failure':
1262  $box = $box_factory->failure($a_txt);
1263  break;
1264  default:
1265  throw new InvalidArgumentException();
1266  }
1267 
1268  return $DIC->ui()->renderer()->render($box);
1269  }
global $DIC
Definition: shib_login.php:22
+ 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 974 of file class.ilUtil.php.

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

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

974  : bool
975  {
976  global $DIC;
977 
978  $ilDB = $DIC->database();
979 
980  $ilErr = null;
981  if (isset($DIC["ilErr"])) {
982  $ilErr = $DIC["ilErr"];
983  }
984 
985  if (empty($a_group_name)) {
986  $message = __METHOD__ . ": No groupname given!";
987  $ilErr->raiseError($message, $ilErr->WARNING);
988  }
989 
990  $clause = ($a_id !== null) ? " AND obj_id != " . $ilDB->quote($a_id) . " " : "";
991 
992  $q = "SELECT obj_id FROM object_data " .
993  "WHERE title = " . $ilDB->quote($a_group_name, "text") . " " .
994  "AND type = " . $ilDB->quote("grp", "text") .
995  $clause;
996 
997  $r = $ilDB->query($q);
998 
999  return $r->numRows() > 0;
1000  }
$ilErr
Definition: raiseError.php:33
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
$q
Definition: shib_logout.php:21
$message
Definition: xapiexit.php:31
$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 587 of file class.ilUtil.php.

References makeClickable().

Referenced by ilMailFolderGUI\confirmDeleteMails().

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

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

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

References IL_INST_ID.

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

954  : string
955  {
956  if (substr($a_value, 0, 4) == "il__") {
957  $a_value = "il_" . IL_INST_ID . "_" . substr($a_value, 4, strlen($a_value) - 4);
958  }
959 
960  return $a_value;
961  }
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 272 of file class.ilUtil.php.

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

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().

275  : bool {
276  if ($mailAddressParserFactory === null) {
277  $mailAddressParserFactory = new ilMailRfc822AddressParserFactory();
278  }
279 
280  try {
281  $parser = $mailAddressParserFactory->getParser($a_email);
282  $addresses = $parser->parse();
283  return count($addresses) == 1 && $addresses[0]->getHost() != ilMail::ILIAS_HOST;
284  } catch (ilException $e) {
285  return false;
286  }
287  }
const ILIAS_HOST
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 1158 of file class.ilUtil.php.

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

1158  : bool
1159  {
1160  if (strlen(strip_tags($a_text)) < strlen($a_text)) {
1161  return true;
1162  }
1163 
1164  return false;
1165  }
+ Here is the caller graph for this function:

◆ isLogin()

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

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

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

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

◆ isWindows()

static ilUtil::isWindows ( )
static
Deprecated:

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

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

1005  : bool
1006  {
1007  return (strtolower(substr(php_uname(), 0, 3)) === "win");
1008  }
+ 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 218 of file class.ilUtil.php.

References $DIC.

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

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

◆ maskAttributeTag()

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

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

References $DIC.

Referenced by maskSecureTags().

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

◆ maskSecureTags()

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

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

References maskAttributeTag(), and maskTag().

Referenced by secureString().

497  : string
498  {
499  foreach ($allow_array as $t) {
500  switch ($t) {
501  case "a":
502  $a_str = ilUtil::maskAttributeTag($a_str, "a", "href");
503  break;
504 
505  case "img":
506  $a_str = ilUtil::maskAttributeTag($a_str, "img", "src");
507  break;
508 
509  case "p":
510  case "div":
511  $a_str = ilUtil::maskTag($a_str, $t, [
512  ["param" => "align", "value" => "left"],
513  ["param" => "align", "value" => "center"],
514  ["param" => "align", "value" => "justify"],
515  ["param" => "align", "value" => "right"]
516  ]);
517  break;
518 
519  default:
520  $a_str = ilUtil::maskTag($a_str, $t);
521  break;
522  }
523  }
524 
525  return $a_str;
526  }
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 707 of file class.ilUtil.php.

Referenced by maskSecureTags().

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

Referenced by ilChangeEvent\_catchupWriteEvents(), ilHistory\_copyEntriesForObject(), ilHistory\_createEntry(), ilLMPageObject\_getPresentationTitle(), ilObjSCORMTracking\_insertTrackData(), ilLMTracker\_isNodeVisible(), ilPageObject\_lookupActive(), ilObjUser\_setUserInactive(), ilObjUser\_toggleActiveStatusOfUsers(), ilWikiContributor\_writeStatus(), ilLikeData\addExpression(), ILIAS\Skill\Profile\SkillProfileCompletionDBRepository\addFulfilmentEntry(), ilSkillLevelDBRepository\addLevel(), ILIAS\Exercise\Submission\SubmissionRepository\addLocalFile(), ILIAS\Skill\Profile\SkillProfileCompletionDBRepository\addNonFulfilmentEntry(), ilExSubmission\addResourceObject(), ILIAS\Exercise\Submission\SubmissionRepository\addUpload(), ILIAS\Exercise\Submission\SubmissionRepository\addZipUpload(), ilRepositoryObjectPlugin\beforeActivation(), ILIAS\Data\Text\HTML\ExportFileDBRepository\create(), 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(), ilObjSCORM2004LearningModule\importSuccess(), ilObjSCORMLearningModule\importSuccess(), ilLMContentRendererGUI\renderDeactivatedPageMessage(), ilSkillUserLevelDBRepository\resetUserSkillLevelStatus(), ilObjUser\saveAsNew(), ilObjForum\saveData(), ilExAssignmentMemberStatus\setFeedback(), ilExAssignmentMemberStatus\setMark(), ilExAssignmentMemberStatus\setSent(), ilExAssignmentMemberStatus\setStatus(), 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\SubmissionRepository\updateWebDirAccessTime(), ilPageObject\writeRenderedContent(), and ilSkillUserLevelDBRepository\writeUserSkillLevelStatus().

1015  : string
1016  {
1017  return date("Y-m-d H:i:s");
1018  }
+ 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 1350 of file class.ilUtil.php.

References ILIAS\Repository\int().

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

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

References $DIC, and init().

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

937  : void
938  {
939  global $DIC;
940 
941  if (!isset($DIC['ilCtrl']) || !$DIC['ilCtrl'] instanceof ilCtrl) {
942  (new InitCtrlService())->init($DIC);
943  }
944  $DIC->ctrl()->redirectToURL($a_script);
945  }
Class InitCtrlService wraps the initialization of ilCtrl.
global $DIC
Definition: shib_login.php:22
+ 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 245 of file class.ilUtil.php.

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

245  : string
246  {
247  global $DIC;
248  $cache = $DIC['ilObjDataCache'];
249 
250  $link = $matches[0];
251  $ref_id = (int) $matches[2];
252  if ($ref_id > 0) {
253  $obj_id = $cache->lookupObjId($ref_id);
254  if ($obj_id > 0) {
255  $title = $cache->lookupTitle($obj_id);
256  $link = '<a href="' . $matches[1] . '" target="_self">' . $title . '</a>';
257  }
258  }
259 
260  return $link;
261  }
$ref_id
Definition: ltiauth.php:65
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

◆ secureLink()

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

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

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

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

◆ securePlainString()

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

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

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

562  : string
563  {
564  if (ini_get("magic_quotes_gpc")) {
565  return stripslashes($a_str);
566  } else {
567  return $a_str;
568  }
569  }
+ 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 414 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().

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

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

823  : string
824  {
825  // check if url is valid (absolute or relative)
826  if (filter_var($url, FILTER_VALIDATE_URL) === false &&
827  filter_var("http://" . $url, FILTER_VALIDATE_URL) === false &&
828  filter_var("http:" . $url, FILTER_VALIDATE_URL) === false &&
829  filter_var("http://de.de" . $url, FILTER_VALIDATE_URL) === false &&
830  filter_var("http://de.de/" . $url, FILTER_VALIDATE_URL) === false) {
831  return "";
832  }
833  if (trim(strtolower(parse_url($url, PHP_URL_SCHEME) ?? '')) === "javascript") {
834  return "";
835  }
836 
837  return htmlspecialchars($url, ENT_QUOTES);
838  }
$url
Definition: shib_logout.php:66
+ 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 1274 of file class.ilUtil.php.

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

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

1279  : void {
1280  global $DIC;
1281 
1282  $http = $DIC->http();
1283  $cookie_jar = $http->cookieJar();
1284 
1285  $cookie_factory = new CookieFactoryImpl();
1286 
1287  $cookie_expire = null;
1288  if (defined('IL_COOKIE_EXPIRE') && is_numeric(IL_COOKIE_EXPIRE) && IL_COOKIE_EXPIRE > 0) {
1289  $cookie_expire = (int) IL_COOKIE_EXPIRE;
1290  }
1291 
1292  $expires = null;
1293  if ($a_set_cookie_invalid) {
1294  $expires = time() - 10;
1295  } elseif ($cookie_expire > 0) {
1296  $expires = time() + $cookie_expire;
1297  }
1298 
1299  $cookie = $cookie_factory->create($a_cookie_name, $a_cookie_value)
1300  ->withExpires($expires)
1301  ->withSecure(defined('IL_COOKIE_SECURE') ? IL_COOKIE_SECURE : false)
1302  ->withPath(defined('IL_COOKIE_PATH') ? IL_COOKIE_PATH : '')
1303  ->withDomain(defined('IL_COOKIE_DOMAIN') ? IL_COOKIE_DOMAIN : '')
1304  ->withHttpOnly(defined('IL_COOKIE_HTTPONLY') ? IL_COOKIE_HTTPONLY : false);
1305 
1306 
1307  if (
1308  defined('IL_COOKIE_SECURE') && IL_COOKIE_SECURE &&
1309  (!isset(session_get_cookie_params()['samesite']) || strtolower(session_get_cookie_params()['samesite']) !== 'strict')
1310  ) {
1311  $cookie = $cookie->withSamesite(Cookie::SAMESITE_LAX);
1312  }
1313  $jar = $cookie_jar->with($cookie);
1314  $response = $jar->renderIntoResponseHeader($http->response());
1315  $http->saveResponse($response);
1316  }
$response
Definition: xapitoken.php:93
$http
Definition: deliver.php:30
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
const IL_COOKIE_PATH(isset($_GET['client_id']))
Definition: index.php:47
+ 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 402 of file class.ilUtil.php.

Referenced by assQuestionGUI\writeQuestionGenericPostData().

402  : string
403  {
404  if (ini_get("magic_quotes_gpc")) {
405  $a_str = stripslashes($a_str);
406  }
407 
408  return $a_str;
409  }
+ 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 775 of file class.ilUtil.php.

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

775  : string
776  {
777  $negativestr = "a,abbr,acronym,address,applet,area,base,basefont," .
778  "big,blockquote,body,br,button,caption,center,cite,code,col," .
779  "colgroup,dd,del,dfn,dir,div,dl,dt,em,fieldset,font,form,frame," .
780  "frameset,h1,h2,h3,h4,h5,h6,head,hr,html,i,iframe,img,input,ins,isindex,kbd," .
781  "label,legend,li,link,map,menu,meta,noframes,noscript,object,ol," .
782  "optgroup,option,p,param,q,s,samp,script,select,small,span," .
783  "strike,strong,style,sub,sup,table,tbody,td,textarea,tfoot,th,thead," .
784  "title,tr,tt,u,ul,var";
785  $a_allow = strtolower($a_allow);
786  $negatives = explode(",", $negativestr);
787  $outer_old_str = "";
788  while ($outer_old_str != $a_str) {
789  $outer_old_str = $a_str;
790  foreach ($negatives as $item) {
791  $pos = strpos($a_allow, "<$item>");
792 
793  // remove complete tag, if not allowed
794  if ($pos === false) {
795  $old_str = "";
796  while ($old_str != $a_str) {
797  $old_str = $a_str;
798  $a_str = preg_replace("/<\/?\s*$item(\/?)\s*>/i", "", $a_str);
799  $a_str = preg_replace("/<\/?\s*$item(\/?)\s+([^>]*)>/i", "", $a_str);
800  }
801  }
802  }
803  }
804 
805  if ($a_rm_js) {
806  // remove all attributes if an "on..." attribute is given
807  $a_str = preg_replace("/<\s*\w*(\/?)(\s+[^>]*)?(\s+on[^>]*)>/i", "", $a_str);
808 
809  // remove all attributes if a "javascript" is within tag
810  $a_str = preg_replace("/<\s*\w*(\/?)\s+[^>]*javascript[^>]*>/i", "", $a_str);
811 
812  // remove all attributes if an "expression" is within tag
813  // (IE allows something like <b style='width:expression(alert(1))'>test</b>)
814  $a_str = preg_replace("/<\s*\w*(\/?)\s+[^>]*expression[^>]*>/i", "", $a_str);
815  }
816 
817  return $a_str;
818  }
+ 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 390 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(), ilObjContentObjectGUI\addTooltip(), ilPCInteractiveImage\addTriggerArea(), ILIAS\UI\Component\Legacy\Content\Filter\FilterManager\apply(), ilCmiXapiStatementsGUI\asyncUserAutocompleteCmd(), ilLTIConsumerXapiStatementsGUI\asyncUserAutocompleteCmd(), ilLTIConsumerGradeSynchronizationGUI\asyncUserAutocompleteCmd(), ilObjForumGUI\autosaveDraftAsyncObject(), ilObjForumGUI\autosaveThreadDraftAsyncObject(), ilRepositoryTrashGUI\buildPath(), ilDashboardBlockGUI\changePDItemPresentationObject(), ilDashboardBlockGUI\changePDItemSortingObject(), ilClozeGapInputBuilderGUI\checkInput(), ilFileInputGUI\checkInput(), ilDclGenericMultiInputGUI\checkInput(), ilObjSurvey\cloneTextblocks(), ilFileSystemGUI\createDirectory(), ilObjFileBasedLMGUI\createFromDirectory(), ilObjForumGUI\decorateWithAutosave(), ilExAssignmentEditorGUI\deleteAssignmentsObject(), ilMailAttachmentGUI\deleteAttachments(), ilFileSystemGUI\deleteFile(), ilPCInteractiveImage\deleteOverlay(), ilPCInteractiveImageGUI\deleteOverlays(), ilObjSurveyGUI\doAutoCompleteObject(), ilObjContentObjectGUI\doExportHTML(), ilObjContentObjectGUI\doExportXML(), ilStartUpGUI\doSamlAuthentication(), ilSCORM13PlayerGUI\downloadLog(), ilObjLanguageExtGUI\downloadObject(), ilMailGUI\executeCommand(), ilCronManagerGUI\executeCommand(), assQuestionGUI\executeCommand(), ilObjMediaPoolGUI\export(), ilObjContentObjectGUI\export(), ilObjContentObjectGUI\exportHTML(), ilFileSystemGUI\extCommand(), ilExportIDTableGUI\fillRow(), ilPDNewsTableGUI\fillRow(), ilMailSearchObjectMembershipsTableGUI\fillRow(), ilObjTestGUI\forwardCommandToQuestion(), ilMailTemplateGUI\getAjaxPlaceholdersById(), ilPCDataTableGUI\getCellContent(), 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(), 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(), ilPresentationTableGUI\initFilter(), ILIAS\COPage\PC\MediaObject\MediaObjectCommandActionHandler\insertCommand(), ILIAS\COPage\PC\Paragraph\ParagraphCommandActionHandler\insertParagraph(), ilECSUser\loadFromGET(), ilLDAPRoleGroupMappingSettings\loadFromPost(), ilECSSettingsGUI\loadFromPost(), ilObjEmployeeTalkSeriesGUI\loadRecurrenceSettings(), ilEmployeeTalkAppointmentGUI\loadRecurrenceSettings(), ilObjSessionGUI\loadRecurrenceSettings(), ilLDAPSettingsGUI\loadRoleAssignmentRule(), ilMailSearchGUI\lookupRecipientAsync(), ilMailFormGUI\lookupRecipientAsync(), ilObjLanguageExtGUI\maintainExecuteObject(), ilMediaPoolExportOptionXMLMasterNoMedia\onExportOptionSelected(), ilMediaPoolExportOptionXMLMaster\onExportOptionSelected(), ilCSVReader\open(), ilSCORM13PlayerGUI\openLog(), assQuestionGUI\outChapterSelector(), assQuestionGUI\outPageSelector(), ilSCORMTrackingUsersTableGUI\parse(), ilTrashTableGUI\parse(), ilFileSystemGUI\parseCurrentDirectory(), ilObjStudyProgrammeAutoMembershipsGUI\parseQueryString(), ilRepositorySearchGUI\performSearch(), ilLegacyFormElementsUtil\prepareFormOutput(), ilAnswerWizardInputGUI\prepareFormOutput(), ilLMPageGUI\processAnswer(), ilICalParser\purgeString(), ilMailBodyPurifier\purify(), ilInitialisation\redirect(), ilLuceneSearchGUI\remoteSearch(), ilFileSystemGUI\renameFile(), ilObjForumGUI\renderPostingForm(), ilEMailInputGUI\sanitize(), ilFileSystemGUI\sanitizeCurrentDirectory(), ilQtiMatImageSecurity\sanitizeLabel(), ilChatroomFormFactory\saniziteArrayElementsTrafo(), ilLMEditShortTitlesGUI\save(), ilLMPageObjectGUI\save(), ilObjSkillTreeGUI\saveAllTemplateTitles(), ilObjSkillTreeGUI\saveAllTitles(), ilExerciseSubmissionFeedbackGUI\saveCommentForLearners(), ilExerciseManagementGUI\saveEvaluationFromModalObject(), ilObjContentObjectGUI\saveExportIds(), ilObjWikiGUI\saveGradingObject(), ilObjSystemFolderGUI\saveHeaderTitlesObject(), ilSurveyEditorGUI\saveHeadingObject(), ilObjSystemFolderGUI\saveJavaServerObject(), ILIAS\Test\Scoring\Manual\TestScoringByQuestionGUI\saveManScoringByQuestion(), ILIAS\Test\Scoring\Manual\TestScoringByParticipantGUI\saveManScoringParticipantScreen(), ilObjLanguageExtGUI\saveObject(), ilObjPortfolioBaseGUI\savePortfolioPagesOrdering(), ilObjTaxonomyGUI\saveSorting(), ilPortfolioRepositoryGUI\saveTitles(), ilObjectTranslationGUI\saveTranslations(), ilLegalDocumentsAdministrationGUI\searchUser(), ilPCTableGUI\setAlignment(), ilForumPageCommandForwarder\setBackLinkTab(), ilContentPagePageCommandForwarder\setBackLinkTab(), ilPCInteractiveImage\setMapAreaProperties(), ilObjMediaObjectGUI\setObjectPerCreationForm(), ilLDAPRoleGroupMappingSetting\setRoleByName(), ilPCTableGUI\setStyles(), 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\Data\Text\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\UI\Implementation\Component\Layout\Page\PageCommandActionHandler\updateCommand(), ilPCDataTableGUI\updateJS(), ilMDKeyword\updateKeywords(), ilObjLinkResourceGUI\updateLinks(), ilExerciseXMLParser\updateMarking(), ilSessionMembershipGUI\updateMembers(), ILIAS\COPage\PC\Paragraph\ParagraphCommandActionHandler\updateParagraph(), ilAdvancedMDSettingsGUI\updateRecords(), ilRegistrationGUI\updateSubscriptionRequest(), ilFileSystemGUI\uploadFile(), ilObjLanguageExtGUI\uploadObject(), ilObjForumGUI\viewThreadObject(), and assMatchingQuestionGUI\writeAnswerSpecificPostData().

390  : string
391  {
392  if (ini_get("magic_quotes_gpc")) {
393  $a_str = stripslashes($a_str);
394  }
395 
396  return ilUtil::secureString($a_str, $a_strip_html, $a_allow);
397  }
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 205 of file class.ilUtil.php.

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

205  : string
206  {
207  if (!($a_num % 2)) {
208  return $a_css1;
209  } else {
210  return $a_css2;
211  }
212  }
+ Here is the caller graph for this function:

◆ tf2yn()

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

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

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

908  : string
909  {
910  if ($a_tf) {
911  return "y";
912  } else {
913  return "n";
914  }
915  }
+ Here is the caller graph for this function:

◆ unmaskAttributeTag()

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

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

References $DIC, and secureLink().

Referenced by unmaskSecureTags().

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

References unmaskAttributeTag(), and unmaskTag().

Referenced by secureString().

528  : string
529  {
530  foreach ($allow_array as $t) {
531  switch ($t) {
532  case "a":
533  $a_str = ilUtil::unmaskAttributeTag($a_str, "a", "href");
534  break;
535 
536  case "img":
537  $a_str = ilUtil::unmaskAttributeTag($a_str, "img", "src");
538  break;
539 
540  case "p":
541  case "div":
542  $a_str = ilUtil::unmaskTag($a_str, $t, [
543  ["param" => "align", "value" => "left"],
544  ["param" => "align", "value" => "center"],
545  ["param" => "align", "value" => "justify"],
546  ["param" => "align", "value" => "right"]
547  ]);
548  break;
549 
550  default:
551  $a_str = ilUtil::unmaskTag($a_str, $t);
552  break;
553  }
554  }
555 
556  return $a_str;
557  }
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 733 of file class.ilUtil.php.

Referenced by unmaskSecureTags().

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

◆ yn2tf()


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