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

Static Protected Member Functions

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

Static Private Member Functions

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

Detailed Description

Util class various functions, usage as namespace.

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

Definition at line 37 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 1204 of file class.ilUtil.php.

References ILIAS\Repository\int().

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

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

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

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

1184  : ?int
1185  {
1186  $test_str = explode('_', $role_title);
1187  $prefix = $test_str[0] ?? '';
1188 
1189  if ($prefix === 'il') {
1190  $ref_id = $test_str[3] ?? null;
1191  return is_numeric($ref_id) ? (int) $ref_id : null;
1192  }
1193  return null;
1194  }
$ref_id
Definition: ltiauth.php:67
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getHttpPath()

static ilUtil::_getHttpPath ( )
static
Deprecated:

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

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

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

1332  : string
1333  {
1334  global $DIC;
1335 
1336  $ilIliasIniFile = $DIC["ilIliasIniFile"];
1337 
1338  if ((isset($_SERVER['SHELL']) && $_SERVER['SHELL']) || PHP_SAPI === 'cli' ||
1339  // fallback for windows systems, useful in crons
1340  (class_exists("ilContext") && !ilContext::usesHTTP())) {
1341  return $ilIliasIniFile->readVariable('server', 'http_path');
1342  } else {
1343  return ILIAS_HTTP_PATH;
1344  }
1345  }
$ilIliasIniFile
Definition: imgupload.php:32
static usesHTTP()
Uses HTTP aka browser.
global $DIC
Definition: feed.php:28
$_SERVER['HTTP_HOST']
Definition: raiseError.php:10
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getObjectsByOperations()

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

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

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

public

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

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

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

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

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

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

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

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

References $url.

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

385  : string
386  {
387  $amp = $xml_style
388  ? "&amp;"
389  : "&";
390 
391  $url = (is_int(strpos($a_url, "?")))
392  ? $a_url . $amp . $a_par
393  : $a_url . "?" . $a_par;
394 
395  return $url;
396  }
$url
+ 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 933 of file class.ilUtil.php.

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

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

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

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

366  : void {
367  global $DIC;
368  $delivery = new Delivery(
369  Delivery::DIRECT_PHP_OUTPUT,
370  $DIC->http()
371  );
372  $delivery->setMimeType($mime);
373  $delivery->setSendMimeType(true);
374  $delivery->setDisposition(Delivery::DISP_ATTACHMENT);
375  $delivery->setDownloadFileName($a_filename);
376  $delivery->setConvertFileNameToAsci(true);
377  $repsonse = $DIC->http()->response()->withBody(Streams::ofString($a_data));
378  $DIC->http()->saveResponse($repsonse);
379  $delivery->deliver();
380  }
setMimeType(string $mime_type)
Definition: Delivery.php:260
global $DIC
Definition: feed.php:28
Class Delivery.
Definition: Delivery.php:37
+ 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 854 of file class.ilUtil.php.

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

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

References $DIC, $lng, and $txt.

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

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

References $DIC, and $lng.

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

1445  : string
1446  {
1447  global $DIC;
1448 
1449  $lng = $DIC->language();
1450  if ($a_lng == null) {
1451  $a_lng = $lng;
1452  }
1453 
1454  $mag = 1024;
1455 
1456  if ($size >= $mag * $mag * $mag) {
1457  $scaled_size = $size / $mag / $mag / $mag;
1458  $scaled_unit = 'lang_size_gb';
1459  } else {
1460  if ($size >= $mag * $mag) {
1461  $scaled_size = $size / $mag / $mag;
1462  $scaled_unit = 'lang_size_mb';
1463  } else {
1464  if ($size >= $mag) {
1465  $scaled_size = $size / $mag;
1466  $scaled_unit = 'lang_size_kb';
1467  } else {
1468  $scaled_size = $size;
1469  $scaled_unit = 'lang_size_bytes';
1470  }
1471  }
1472  }
1473 
1474  $result = self::fmtFloat(
1475  $scaled_size,
1476  ($scaled_unit
1477  == 'lang_size_bytes') ? 0 : 1,
1478  $a_lng->txt('lang_sep_decimal'),
1479  $a_lng->txt('lang_sep_thousand'),
1480  true
1481  )
1482  . ' ' . $a_lng->txt($scaled_unit);
1483  if ($a_mode == 'long' && $size > $mag) {
1484  $result .= ' (' . self::fmtFloat(
1485  $size,
1486  0,
1487  $a_lng->txt('lang_sep_decimal'),
1488  $a_lng->txt('lang_sep_thousand')
1489  ) . ' '
1490  . $a_lng->txt('lang_size_bytes') . ')';
1491  }
1492 
1493  return $result;
1494  }
$lng
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ getHtmlPath()

static ilUtil::getHtmlPath ( string  $relative_path)
static

get url of path

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

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

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

126  : string
127  {
128  if (substr($relative_path, 0, 2) == './') {
129  $relative_path = (substr($relative_path, 1));
130  }
131  if (substr($relative_path, 0, 1) != '/') {
132  $relative_path = '/' . $relative_path;
133  }
134  $htmlpath = ILIAS_HTTP_PATH . $relative_path;
135  return $htmlpath;
136  }
+ Here is the caller graph for this function:

◆ getImagePath()

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

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

Deprecated:
use UI Service!

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

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

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

72  : string {
73  global $DIC;
74 
75  $styleDefinition = null;
76  if (isset($DIC["styleDefinition"])) {
77  $styleDefinition = $DIC["styleDefinition"];
78  }
79 
80  if (is_int(strpos($_SERVER["PHP_SELF"], "setup.php"))) {
81  $module_path = "..";
82  }
83  if ($module_path != "") {
84  $module_path = "/" . $module_path;
85  }
86 
87  // default image
88  $default_img = "." . $module_path . "/templates/default/images/" . $img;
89 
90  // use ilStyleDefinition instead of account to get the current skin and style
91  $current_skin = ilStyleDefinition::getCurrentSkin();
92  $current_style = ilStyleDefinition::getCurrentStyle();
93 
94  if (is_object($styleDefinition)) {
95  $image_dir = $styleDefinition->getImageDirectory($current_style);
96  }
97  $skin_img = "";
98  if ($current_skin == "default") {
99  $user_img = "." . $module_path . "/templates/default/" . $image_dir . "/" . $img;
100  $skin_img = "." . $module_path . "/templates/default/images/" . $img;
101  } elseif (is_object($styleDefinition) && $current_skin != "default") {
102  $user_img = "./Customizing/global/skin/" .
103  $current_skin . $module_path . "/" . $image_dir . "/" . $img;
104  $skin_img = "./Customizing/global/skin/" .
105  $current_skin . $module_path . "/images/" . $img;
106  }
107 
108 
109  if ($offline) {
110  return "./images/" . $img;
111  } elseif (@file_exists($user_img) && $image_dir != "") {
112  return $user_img; // found image for skin and style
113  } elseif (file_exists($skin_img)) {
114  return $skin_img; // found image in skin/images
115  }
116 
117  return $default_img; // take image in default
118  }
global $DIC
Definition: feed.php:28
static getCurrentSkin()
get the current skin use always this function instead of getting the account&#39;s skin the current skin ...
$_SERVER['HTTP_HOST']
Definition: raiseError.php:10
$img
Definition: imgupload.php:83
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 44 of file class.ilUtil.php.

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

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

44  : string
45  {
46  global $DIC;
47 
48  $lng = $DIC->language();
49 
50  $size = ($a_big)
51  ? "big"
52  : "small";
53 
54  $filename = ilObject::_getIcon(0, $size, $a_type);
55 
56  return "<img src=\"" . $filename . "\" alt=\"" . $lng->txt("obj_" . $a_type) . "\" title=\"" . $lng->txt(
57  "obj_" . $a_type
58  ) . "\" border=\"0\" vspace=\"0\"/>";
59  }
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
$lng
global $DIC
Definition: feed.php:28
$filename
Definition: buildRTE.php:78
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNewContentStyleSheetLocation()

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

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

Deprecated:

Definition at line 191 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().

191  : string
192  {
193 
194  // use ilStyleDefinition instead of account to get the current skin and style
195  if (ilStyleDefinition::getCurrentSkin() == "default") {
196  $in_style = "./templates/" . ilStyleDefinition::getCurrentSkin() . "/"
197  . ilStyleDefinition::getCurrentStyle() . "_cont.css";
198  } else {
199  $in_style = "./Customizing/global/skin/" . ilStyleDefinition::getCurrentSkin() . "/"
200  . ilStyleDefinition::getCurrentStyle() . "_cont.css";
201  }
202 
203  if (is_file("./" . $in_style)) {
204  return $in_style;
205  } else {
206  return "templates/default/delos_cont.css";
207  }
208  }
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 484 of file class.ilUtil.php.

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

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

◆ getStyleSheetLocation()

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

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

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

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

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

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

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

References $DIC.

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

1258  {
1259  global $DIC;
1260 
1261  $box_factory = $DIC->ui()->factory()->messageBox();
1262  switch ($a_type) {
1263  case 'info':
1264  $box = $box_factory->info($a_txt);
1265  break;
1266  case 'success':
1267  $box = $box_factory->success($a_txt);
1268  break;
1269  case 'question':
1270  $box = $box_factory->confirmation($a_txt);
1271  break;
1272  case 'failure':
1273  $box = $box_factory->failure($a_txt);
1274  break;
1275  default:
1276  throw new InvalidArgumentException();
1277  }
1278 
1279  return $DIC->ui()->renderer()->render($box);
1280  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ groupNameExists()

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

checks if group name already exists.

Groupnames must be unique for mailing purposes static function

public

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

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

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

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

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

References makeClickable().

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

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

References $img.

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

337  {
338  $img = '<img src="' . $a_src . '"';
339  if (!is_null($a_alt)) {
340  $img .= ' alt="' . htmlspecialchars($a_alt) . '"';
341  }
342  if ($a_width != "") {
343  $img .= ' width="' . htmlspecialchars($a_width) . '"';
344  }
345  if ($a_height != "") {
346  $img .= ' height="' . htmlspecialchars($a_height) . '"';
347  }
348  if ($a_class != "") {
349  $img .= ' class="' . $a_class . '"';
350  }
351  if ($a_id != "") {
352  $img .= ' id="' . $a_id . '"';
353  }
354  $img .= ' />';
355 
356  return $img;
357  }
$img
Definition: imgupload.php:83
+ 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 965 of file class.ilUtil.php.

References IL_INST_ID.

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

965  : string
966  {
967  if (substr($a_value, 0, 4) == "il__") {
968  $a_value = "il_" . IL_INST_ID . "_" . substr($a_value, 4, strlen($a_value) - 4);
969  }
970 
971  return $a_value;
972  }
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 283 of file class.ilUtil.php.

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

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

286  : bool {
287  if ($mailAddressParserFactory === null) {
288  $mailAddressParserFactory = new ilMailRfc822AddressParserFactory();
289  }
290 
291  try {
292  $parser = $mailAddressParserFactory->getParser($a_email);
293  $addresses = $parser->parse();
294  return count($addresses) == 1 && $addresses[0]->getHost() != ilMail::ILIAS_HOST;
295  } catch (ilException $e) {
296  return false;
297  }
298  }
const ILIAS_HOST
Class ilMailRfc822AddressParserFactory.
+ Here is the caller graph for this function:

◆ isHTML()

static ilUtil::isHTML ( string  $a_text)
static

Checks if a given string contains HTML or not.

Parameters
string$a_textText which should be checked
Returns
boolean public

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

Referenced by assTextQuestion\getSolutionSubmit(), ilAssSelfAssessmentQuestionFormatter\handleLineBreaks(), assQuestion\isHTML(), and ilLegacyFormElementsUtil\prepareTextareaOutput().

1169  : bool
1170  {
1171  if (strlen(strip_tags($a_text)) < strlen($a_text)) {
1172  return true;
1173  }
1174 
1175  return false;
1176  }
+ Here is the caller graph for this function:

◆ isLogin()

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

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

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

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

◆ isWindows()

static ilUtil::isWindows ( )
static
Deprecated:

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

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

1016  : bool
1017  {
1018  return (strtolower(substr(php_uname(), 0, 3)) === "win");
1019  }
+ 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 229 of file class.ilUtil.php.

References $DIC.

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

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

◆ maskAttributeTag()

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

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

References $DIC.

Referenced by maskSecureTags().

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

◆ maskSecureTags()

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

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

References maskAttributeTag(), and maskTag().

Referenced by secureString().

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

Referenced by maskSecureTags().

718  : string
719  {
720  $a_str = str_replace(
721  ["<$tag>", "<" . strtoupper($tag) . ">"],
722  "&lt;" . $tag . "&gt;",
723  $a_str
724  );
725  $a_str = str_replace(
726  ["</$tag>", "</" . strtoupper($tag) . ">"],
727  "&lt;/" . $tag . "&gt;",
728  $a_str
729  );
730 
731  foreach ($fix_param as $p) {
732  $k = $p["param"];
733  $v = $p["value"];
734  $a_str = str_replace(
735  "<$tag $k=\"$v\">",
736  "&lt;" . "$tag $k=\"$v\"" . "&gt;",
737  $a_str
738  );
739  }
740 
741  return $a_str;
742  }
+ 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 1026 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\Skill\Profile\SkillProfileCompletionDBRepository\addNonFulfilmentEntry(), ilExSubmission\addResourceObject(), ilRepositoryObjectPlugin\beforeActivation(), ilBlogPosting\create(), ilNewsItem\create(), ilWebDAVMountInstructionsDocumentFormGUI\createFilledObject(), ilPRGAssignmentDBRepository\createFor(), ilPageObject\createFromXML(), ILIAS\Notes\NotesManager\createNote(), ilAuthProviderLTI\createUser(), ilPageActivationDBRepository\getData(), ilCalendarHeaderNavigationGUI\getHTML(), ilNewsItem\getLastNewsIdForContext(), ilLMNavigationStatus\getPredecessorPageId(), ilWikiUserHTMLExport\getProcess(), ilLMNavigationStatus\getSuccessorPageId(), ilSkillUserLevelDBRepository\hasRecentSelfEvaluation(), ilObjSCORM2004LearningModule\importSuccess(), ilObjSCORMLearningModule\importSuccess(), ilPreviewRenderer\render(), ilLMContentRendererGUI\renderDeactivatedPageMessage(), ilSkillUserLevelDBRepository\resetUserSkillLevelStatus(), ilObjUser\saveAsNew(), ilObjForum\saveData(), ilUserProfilePromptDataGateway\saveLastUserPrompt(), ilExAssignmentMemberStatus\setFeedback(), ilExAssignmentMemberStatus\setMark(), ilExAssignmentMemberStatus\setSent(), ilExAssignmentMemberStatus\setStatus(), ilUserProfileStartUpStep\shouldInterceptRequest(), ilObjSCORMTracking\storeJsApiCmi(), ilLMTracker\trackLastPageAccess(), ilBlogPosting\unpublish(), ilObjUser\update(), ilNewsItem\update(), ilPageObject\update(), ilPageObject\updateFromXML(), ILIAS\Notes\NoteDBRepository\updateNoteText(), ilExPeerReview\updatePeerReview(), ilExPeerReview\updatePeerReviewTimestamp(), ilExSubmission\updateTextSubmission(), ilExSubmission\updateTutorDownloadTime(), ILIAS\Exercise\Submission\SubmissionDBRepository\updateWebDirAccessTime(), ilExSubmission\uploadFile(), ilPageObject\writeRenderedContent(), and ilSkillUserLevelDBRepository\writeUserSkillLevelStatus().

1026  : string
1027  {
1028  return date("Y-m-d H:i:s");
1029  }
+ 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 1361 of file class.ilUtil.php.

References ILIAS\Repository\int().

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

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

References $DIC.

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

948  : void
949  {
950  global $DIC;
951 
952  if (!isset($DIC['ilCtrl']) || !$DIC['ilCtrl'] instanceof ilCtrl) {
953  (new InitCtrlService())->init($DIC);
954  }
955  $DIC->ctrl()->redirectToURL($a_script);
956  }
Class InitCtrlService wraps the initialization of ilCtrl.
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ replaceLinkProperties()

static ilUtil::replaceLinkProperties ( array  $matches)
staticprivate

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

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

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

◆ secureLink()

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

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

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

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

◆ securePlainString()

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

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

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

573  : string
574  {
575  if (ini_get("magic_quotes_gpc")) {
576  return stripslashes($a_str);
577  } else {
578  return $a_str;
579  }
580  }
+ 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 425 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().

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

References $url.

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

834  : string
835  {
836  // check if url is valid (absolute or relative)
837  if (filter_var($url, FILTER_VALIDATE_URL) === false &&
838  filter_var("http://" . $url, FILTER_VALIDATE_URL) === false &&
839  filter_var("http:" . $url, FILTER_VALIDATE_URL) === false &&
840  filter_var("http://de.de" . $url, FILTER_VALIDATE_URL) === false &&
841  filter_var("http://de.de/" . $url, FILTER_VALIDATE_URL) === false) {
842  return "";
843  }
844  if (trim(strtolower(parse_url($url, PHP_URL_SCHEME))) == "javascript") {
845  return "";
846  }
847  $url = htmlspecialchars($url, ENT_QUOTES);
848  return $url;
849  }
$url
+ 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 1285 of file class.ilUtil.php.

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

Referenced by ilStartUpGUI\_checkGoto(), ilStartUpGUI\doLogout(), ilLTIViewGUI\logout(), ilSessionControl\removeSessionCookie(), and ilInitialisation\setClientIdCookie().

1290  : void {
1291  global $DIC;
1292 
1293  $http = $DIC->http();
1294  $cookie_jar = $http->cookieJar();
1295 
1296  $cookie_factory = new CookieFactoryImpl();
1297 
1298  $cookie_expire = null;
1299  if (defined('IL_COOKIE_EXPIRE') && is_numeric(IL_COOKIE_EXPIRE) && IL_COOKIE_EXPIRE > 0) {
1300  $cookie_expire = (int) IL_COOKIE_EXPIRE;
1301  }
1302 
1303  $expires = null;
1304  if ($a_set_cookie_invalid) {
1305  $expires = time() - 10;
1306  } elseif ($cookie_expire > 0) {
1307  $expires = time() + $cookie_expire;
1308  }
1309 
1310  $cookie = $cookie_factory->create($a_cookie_name, $a_cookie_value)
1311  ->withExpires($expires)
1312  ->withSecure(defined('IL_COOKIE_SECURE') ? IL_COOKIE_SECURE : false)
1313  ->withPath(defined('IL_COOKIE_PATH') ? IL_COOKIE_PATH : '')
1314  ->withDomain(defined('IL_COOKIE_DOMAIN') ? IL_COOKIE_DOMAIN : '')
1315  ->withHttpOnly(defined('IL_COOKIE_HTTPONLY') ? IL_COOKIE_HTTPONLY : false);
1316 
1317 
1318  if (
1319  defined('IL_COOKIE_SECURE') && IL_COOKIE_SECURE &&
1320  (!isset(session_get_cookie_params()['samesite']) || strtolower(session_get_cookie_params()['samesite']) !== 'strict')
1321  ) {
1322  $cookie = $cookie->withSamesite(Cookie::SAMESITE_LAX);
1323  }
1324  $jar = $cookie_jar->with($cookie);
1325  $response = $jar->renderIntoResponseHeader($http->response());
1326  $http->saveResponse($response);
1327  }
global $DIC
Definition: feed.php:28
$http
Definition: raiseError.php:7
const IL_COOKIE_PATH(isset($_GET["client_id"]))
Definition: metadata.php:64
$response
+ 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 413 of file class.ilUtil.php.

Referenced by assFormulaQuestionGUI\writePostData(), and assQuestionGUI\writeQuestionGenericPostData().

413  : string
414  {
415  if (ini_get("magic_quotes_gpc")) {
416  $a_str = stripslashes($a_str);
417  }
418 
419  return $a_str;
420  }
+ 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 786 of file class.ilUtil.php.

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

786  : string
787  {
788  $negativestr = "a,abbr,acronym,address,applet,area,base,basefont," .
789  "big,blockquote,body,br,button,caption,center,cite,code,col," .
790  "colgroup,dd,del,dfn,dir,div,dl,dt,em,fieldset,font,form,frame," .
791  "frameset,h1,h2,h3,h4,h5,h6,head,hr,html,i,iframe,img,input,ins,isindex,kbd," .
792  "label,legend,li,link,map,menu,meta,noframes,noscript,object,ol," .
793  "optgroup,option,p,param,q,s,samp,script,select,small,span," .
794  "strike,strong,style,sub,sup,table,tbody,td,textarea,tfoot,th,thead," .
795  "title,tr,tt,u,ul,var";
796  $a_allow = strtolower($a_allow);
797  $negatives = explode(",", $negativestr);
798  $outer_old_str = "";
799  while ($outer_old_str != $a_str) {
800  $outer_old_str = $a_str;
801  foreach ($negatives as $item) {
802  $pos = strpos($a_allow, "<$item>");
803 
804  // remove complete tag, if not allowed
805  if ($pos === false) {
806  $old_str = "";
807  while ($old_str != $a_str) {
808  $old_str = $a_str;
809  $a_str = preg_replace("/<\/?\s*$item(\/?)\s*>/i", "", $a_str);
810  $a_str = preg_replace("/<\/?\s*$item(\/?)\s+([^>]*)>/i", "", $a_str);
811  }
812  }
813  }
814  }
815 
816  if ($a_rm_js) {
817  // remove all attributes if an "on..." attribute is given
818  $a_str = preg_replace("/<\s*\w*(\/?)(\s+[^>]*)?(\s+on[^>]*)>/i", "", $a_str);
819 
820  // remove all attributes if a "javascript" is within tag
821  $a_str = preg_replace("/<\s*\w*(\/?)\s+[^>]*javascript[^>]*>/i", "", $a_str);
822 
823  // remove all attributes if an "expression" is within tag
824  // (IE allows something like <b style='width:expression(alert(1))'>test</b>)
825  $a_str = preg_replace("/<\s*\w*(\/?)\s+[^>]*expression[^>]*>/i", "", $a_str);
826  }
827 
828  return $a_str;
829  }
+ 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 401 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(), ilPCParagraph\_input2xml(), ilFileUtils\_sanitizeFilemame(), ilHierarchyFormGUI\_str(), ilObjUserGUI\addAdminLocatorItems(), ilObjGlossaryGUI\addDefinition(), ilInfoScreenGUI\addPreconditionSection(), ilObjContentObjectGUI\addTooltip(), ilPCInteractiveImage\addTriggerArea(), ilTermsOfServiceAcceptanceHistoryGUI\addUserAutoComplete(), ilContainer\applyContainerUserFilter(), ilCmiXapiStatementsGUI\asyncUserAutocompleteCmd(), ilLTIConsumerXapiStatementsGUI\asyncUserAutocompleteCmd(), ilLTIConsumerGradeSynchronizationGUI\asyncUserAutocompleteCmd(), ilObjForumGUI\autosaveDraftAsyncObject(), ilObjForumGUI\autosaveThreadDraftAsyncObject(), ilRepositoryTrashGUI\buildPath(), ilAssQuestionSkillAssignmentsTableGUI\buildSkillPointsInput(), ilObjSystemFolderGUI\changeHeaderTitleObject(), ilPDSelectedItemsBlockGUI\changePDItemPresentation(), ilPDSelectedItemsBlockGUI\changePDItemSorting(), ilMailQuickFilterInputGUI\checkInput(), ilClozeGapInputBuilderGUI\checkInput(), ilOrgUnitMultiLineInputGUI\checkInput(), ilFileInputGUI\checkInput(), ilSuggestedSolutionSelectorGUI\checkInput(), ilDclGenericMultiInputGUI\checkInput(), ilObjSurvey\cloneTextblocks(), ilChatroomAdminSmileyGUI\confirmedDeleteMultipleObject(), ilChatroomPrivateRoomGUI\create(), ilFileSystemGUI\createDirectory(), ilObjFileBasedLMGUI\createFromDirectory(), ilObjForumGUI\decorateWithAutosave(), ilExAssignmentEditorGUI\deleteAssignmentsObject(), ilMailAttachmentGUI\deleteAttachments(), ilFileSystemGUI\deleteFile(), ilPCInteractiveImageGUI\deleteOverlays(), ilChatroomAdminSmileyGUI\deleteSmileyObject(), ilObjSurveyGUI\doAutoCompleteObject(), ilObjForumGUI\doHistoryCheck(), ilStartUpGUI\doSamlAuthentication(), ilSCORM13PlayerGUI\downloadLog(), ilObjLanguageExtGUI\downloadObject(), ilTestExpressPageObjectGUI\executeCommand(), ilMailGUI\executeCommand(), ilCronManagerGUI\executeCommand(), ilObjTestGUI\executeCommand(), assQuestionGUI\executeCommand(), ilObjContentObjectGUI\export(), ilObjMediaPoolGUI\export(), ilObjContentObjectGUI\exportHTML(), ilFileSystemGUI\extCommand(), ilExportIDTableGUI\fillRow(), ilPDNewsTableGUI\fillRow(), ilMailSearchObjectMembershipsTableGUI\fillRow(), ilMailTemplateGUI\getAjaxPlaceholdersById(), ilPCDataTableGUI\getCellContent(), ilSCORM13MDImporter\getDescription(), ilObjUser\getFullname(), ilFormulaInputGUI\getInput(), ilTextAreaInputGUI\getInput(), ilUserLPTableGUI\getItems(), ilLMQuestionListTableGUI\getItems(), ilAccountCodesTableGUI\getItems(), ilAssignedUsersTableGUI\getItems(), ilSCORMTrackingItemsTableGUI\getItems(), ilSCORM2004TrackingItemsTableGUI\getItems(), ilTrUserObjectsPropsTableGUI\getItems(), ilTrObjectUsersPropsTableGUI\getItems(), ilTrSummaryTableGUI\getItems(), ilExplorerBaseGUI\getNodeAsync(), assAnswerCloze\getNumericValueFromText(), ilObjForumGUI\getOrderByParam(), ilSCORMPackageParser\getPackageTitle(), assTextQuestion\getSolutionSubmit(), ilTaggingGUI\getTagsFromInput(), ilSCORM13MDImporter\getTitle(), ilUserTableGUI\getUserIdsForFilter(), ilChatroomInviteUsersToPrivateRoomGUI\getUserList(), ilPCParagraph\handleAjaxContent(), ilObjSessionGUI\handleFileUpload(), ilObjForumGUI\handleFormInput(), ilSCORMPackageParser\handlerCharacterData(), ilChatroomXMLParser\handlerEndTag(), ilForumXMLParser\handlerEndTag(), ilSCORM13Package\il_import(), ilPCTable\importHtml(), ilContentPageDataSet\importRecord(), ilScormAiccImporter\importXmlRepresentation(), ILIAS\COPage\Editor\Components\MediaObject\MediaObjectCommandActionHandler\insertCommand(), ilObjChatroomGUI\insertObject(), ILIAS\COPage\Editor\Components\Paragraph\ParagraphCommandActionHandler\insertParagraph(), ilMDEditorGUI\keywordAutocomplete(), ilGlossaryPresentationGUI\listTerms(), ilECSUser\loadFromGET(), ilLDAPRoleGroupMappingSettings\loadFromPost(), ilECSSettingsGUI\loadFromPost(), ilObjEmployeeTalkSeriesGUI\loadRecurrenceSettings(), ilEmployeeTalkAppointmentGUI\loadRecurrenceSettings(), ilObjSessionGUI\loadRecurrenceSettings(), ilLDAPSettingsGUI\loadRoleAssignmentRule(), ilMailSearchGUI\lookupRecipientAsync(), ilMailFormGUI\lookupRecipientAsync(), ilObjLanguageExtGUI\maintainExecuteObject(), ilCSVReader\open(), ilSCORM13PlayerGUI\openLog(), assQuestionGUI\outChapterSelector(), assQuestionGUI\outPageSelector(), ilSCORMTrackingUsersTableGUI\parse(), ilTrashTableGUI\parse(), ilFileSystemGUI\parseCurrentDirectory(), ilObjStudyProgrammeAutoMembershipsGUI\parseQueryString(), ilRepositorySearchGUI\performSearch(), ilLegacyFormElementsUtil\prepareFormOutput(), ilObjQuestionPoolGUI\printObject(), ilLMPageGUI\processAnswer(), ilICalParser\purgeString(), ilMailBodyPurifier\purify(), ilObjTestGUI\randomselectObject(), ilInitialisation\redirect(), ilLuceneSearchGUI\remoteSearch(), ilExAssignmentFileSystemGUI\renameFile(), ilFileSystemGUI\renameFile(), ilTable2GUI\restoreTemplate(), ilTestScoringByQuestionsGUI\retrieveFeedback(), ilEMailInputGUI\sanitize(), ilFileSystemGUI\sanitizeCurrentDirectory(), ilQtiMatImageSecurity\sanitizeLabel(), ilLMEditShortTitlesGUI\save(), ilLMPageObjectGUI\save(), ilObjSkillManagementGUI\saveAllTemplateTitles(), ilObjSkillTreeGUI\saveAllTemplateTitles(), ilObjSkillManagementGUI\saveAllTitles(), ilObjSkillTreeGUI\saveAllTitles(), ilExerciseManagementGUI\saveCommentForLearnersObject(), ilExerciseManagementGUI\saveEvaluationFromModalObject(), ilObjContentObjectGUI\saveExportIds(), ilObjTestSettingsGeneralGUI\saveGeneralProperties(), ilObjWikiGUI\saveGradingObject(), ilObjSystemFolderGUI\saveHeaderTitleObject(), ilObjSystemFolderGUI\saveHeaderTitlesObject(), ilSurveyEditorGUI\saveHeadingObject(), ilObjSystemFolderGUI\saveJavaServerObject(), ilTestScoringGUI\saveManScoringParticipantScreen(), ilMarkSchemaGUI\saveMarkSchemaFormData(), ilPCParagraph\saveMetaKeywords(), ilObjLanguageExtGUI\saveObject(), ilPersonalProfileGUI\savePersonalDataForm(), ilObjPortfolioBaseGUI\savePortfolioPagesOrdering(), ilObjFileAccessSettingsGUI\saveSettings(), ilObjAssessmentFolderGUI\saveSettingsObject(), ilObjTaxonomyGUI\saveSorting(), ilPortfolioRepositoryGUI\saveTitles(), ilTranslationGUI\saveTranslations(), ilObjectTranslationGUI\saveTranslations(), ilObjStudyProgrammeTreeGUI\saveTreeOrder(), assLongMenu\saveWorkingData(), assClozeTest\saveWorkingData(), ilPDFGenerationRequest\securedString(), ilPCTableGUI\setAlignment(), ilForumPageCommandForwarder\setBackLinkTab(), ilContentPagePageCommandForwarder\setBackLinkTab(), ilSCORM13MDImporter\setDescription(), ilObjMediaObjectGUI\setObjectPerCreationForm(), ilLDAPRoleGroupMappingSetting\setRoleByName(), ilPCTableGUI\setStyles(), ilSCORM13MDImporter\setTitle(), ilPCTableGUI\setWidths(), ilCalendarCategoryGUI\sharePerformSearch(), ilRepositoryTrashGUI\showDeleteConfirmation(), ilStartUpGUI\showSamlLoginForm(), ilObjSCORM2004LearningModuleGUI\showTrackingItems(), ilObjSCORMLearningModuleGUI\showTrackingItems(), ilObjSCORM2004LearningModuleGUI\showTrackingItemsBySco(), ilObjSCORMLearningModuleGUI\showTrackingItemsBySco(), ilObjForumGUI\showUserObject(), ILIAS\COPage\Editor\Components\Paragraph\ParagraphCommandActionHandler\split(), ilBadgeGUIRequest\strArray(), ILIAS\Repository\HTML\HTMLUtil\strip(), ILIAS\Repository\strip(), ilCertificateUtilHelper\stripSlashes(), ilFormPropertyGUI\stripSlashesAddSpaceFallback(), SurveyQuestion\stripSlashesAddSpaceFallback(), ilArrayUtil\stripSlashesArray(), ilArrayUtil\stripSlashesRecursive(), assLongMenuGUI\stripSlashesRecursive(), ilClozeGapInputBuilderGUI\stripSlashesRecursive(), ilDataSet\stripTags(), ilPasswordAssistanceGUI\submitAssignPasswordForm(), ilBuddySystemGUI\transitionAsyncCommand(), ilContainerBaseXmlParser\trimAndStrip(), ilStyleImportParser\trimAndStrip(), ilExerciseXMLParser\trimAndStrip(), ilMDSaxParser\trimAndStrip(), SurveyImportParser\trimAndStrip(), ilMDEditorGUI\updateAnnotation(), ilMDEditorGUI\updateClassification(), ILIAS\COPage\Editor\Components\Page\PageCommandActionHandler\updateCommand(), ilMDEditorGUI\updateEducational(), ilMDEditorGUI\updateGeneral(), ilPCDataTableGUI\updateJS(), ilMDKeyword\updateKeywords(), ilMDEditorGUI\updateLifecycle(), ilObjLinkResourceGUI\updateLinks(), ilExerciseXMLParser\updateMarking(), ilSessionMembershipGUI\updateMembers(), ilMDEditorGUI\updateMetaMetaData(), ILIAS\COPage\Editor\Components\Paragraph\ParagraphCommandActionHandler\updateParagraph(), ilMDEditorGUI\updateQuickEdit(), ilMDEditorGUI\updateQuickEdit_scorm(), ilMDEditorGUI\updateQuickEdit_scorm_propagate(), ilAdvancedMDSettingsGUI\updateRecords(), ilMDEditorGUI\updateRelation(), ilMDEditorGUI\updateRights(), ilRegistrationGUI\updateSubscriptionRequest(), ilMDEditorGUI\updateTechnical(), ilExAssignmentFileSystemGUI\uploadFile(), ilFileSystemGUI\uploadFile(), ilObjLanguageExtGUI\uploadObject(), ilObjForumGUI\viewThreadObject(), assMatchingQuestionGUI\writeAnswerSpecificPostData(), and assLongMenuGUI\writeQuestionSpecificPostData().

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

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

216  : string
217  {
218  if (!($a_num % 2)) {
219  return $a_css1;
220  } else {
221  return $a_css2;
222  }
223  }
+ Here is the caller graph for this function:

◆ tf2yn()

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

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

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

919  : string
920  {
921  if ($a_tf) {
922  return "y";
923  } else {
924  return "n";
925  }
926  }
+ Here is the caller graph for this function:

◆ unmaskAttributeTag()

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

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

References $DIC, and secureLink().

Referenced by unmaskSecureTags().

689  : string
690  {
691  global $DIC;
692 
693  $ilLog = $DIC["ilLog"];
694 
695  while (preg_match(
696  '/&lt;(' . $tag . ' ' . $tag_att . $tag_att . '="(([$@!*()~;,_0-9A-z\/:=%.&#?+\-])*)")&gt;/i',
697  $a_str,
698  $found
699  )) {
700  $old_str = $a_str;
701  $a_str = preg_replace(
702  "/&lt;" . preg_quote($found[1], "/") . "&gt;/i",
703  '<' . $tag . ' ' . $tag_att . '="' . ilUtil::secureLink($found[2]) . '">',
704  $a_str
705  );
706  if ($old_str == $a_str) {
707  $ilLog->write(
708  "ilUtil::unmaskA-" . htmlentities($old_str) . " == " .
709  htmlentities($a_str)
710  );
711  return $a_str;
712  }
713  }
714  $a_str = str_replace('&lt;/' . $tag . '&gt;', '</' . $tag . '>', $a_str);
715  return $a_str;
716  }
static secureLink(string $a_str)
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unmaskSecureTags()

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

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

References unmaskAttributeTag(), and unmaskTag().

Referenced by secureString().

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

Referenced by unmaskSecureTags().

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

◆ yn2tf()


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