1 <?php declare(strict_types=1);
19 chdir(
'../../../../');
21 require_once
'Services/Init/classes/class.ilInitialisation.php';
37 $lng->loadLanguageModule(
'form');
41 if (defined(
'ILIAS_HTTP_PATH')) {
42 $weburl = substr(ILIAS_HTTP_PATH, 0, strrpos(ILIAS_HTTP_PATH,
'/node_modules')) .
'/';
69 include_once
'webservice/soap/include/inc.soap_functions.php';
72 $DIC->http()->wrapper()->query()->retrieve(
74 $DIC->refinery()->kindlyTo()->string()
76 $DIC->http()->wrapper()->query()->retrieve(
78 $DIC->refinery()->kindlyTo()->int()
84 if (
$DIC->http()->wrapper()->post()->has(
'imglist')) {
85 $img =
$DIC->http()->wrapper()->post()->retrieve(
87 $DIC->refinery()->kindlyTo()->string()
93 if (
$DIC->http()->wrapper()->query()->has(
'update')) {
94 $update =
$DIC->http()->wrapper()->query()->retrieve(
96 $DIC->refinery()->kindlyTo()->bool()
102 if (isset($_FILES[
'img_file']) && is_array($_FILES[
'img_file'])) {
103 while (substr($_FILES[
'img_file'][
'name'], -1) ===
'/') {
104 $_FILES[
'img_file'][
'name'] = substr($_FILES[
'img_file'][
'name'], 0, -1);
107 $error = $_FILES[
'img_file'][
'error'];
109 case UPLOAD_ERR_INI_SIZE:
110 $errors->fields[] = [
'name' =>
'img_file',
'message' =>
$lng->txt(
'form_msg_file_size_exceeds')];
113 case UPLOAD_ERR_FORM_SIZE:
114 $errors->fields[] = [
'name' =>
'img_file',
'message' =>
$lng->txt(
"form_msg_file_size_exceeds")];
117 case UPLOAD_ERR_PARTIAL:
118 $errors->fields[] = [
'name' =>
'img_file',
'message' =>
$lng->txt(
"form_msg_file_partially_uploaded")];
121 case UPLOAD_ERR_NO_FILE:
122 $errors->fields[] = [
'name' =>
'img_file',
'message' =>
$lng->txt(
"form_msg_file_no_upload")];
125 case UPLOAD_ERR_NO_TMP_DIR:
126 $errors->fields[] = [
'name' =>
'img_file',
'message' =>
$lng->txt(
"form_msg_file_missing_tmp_dir")];
129 case UPLOAD_ERR_CANT_WRITE:
130 $errors->fields[] = [
'name' =>
'img_file',
'message' =>
$lng->txt(
"form_msg_file_cannot_write_to_disk")];
133 case UPLOAD_ERR_EXTENSION:
134 $errors->fields[] = [
'name' =>
'img_file',
'message' =>
$lng->txt(
"form_msg_file_upload_stopped_ext")];
140 $finfo = pathinfo($_FILES[
'img_file'][
'name']);
142 $_FILES[
'img_file'][
'tmp_name'],
143 $_FILES[
'img_file'][
'name'],
144 $_FILES[
'img_file'][
'type']
147 !in_array($mime_type, [
'image/gif',
'image/jpeg',
'image/png'],
true) ||
150 $errors->fields[] = [
'name' =>
'img_file',
'message' =>
$lng->txt(
"form_msg_file_wrong_file_type")];
158 $_FILES[
'img_file'][
'tmp_name'] !==
'' 161 if ($vir[0] ===
false) {
163 'name' =>
'img_file',
164 'message' =>
$lng->txt(
'form_msg_file_virus_found') .
'<br />' . $vir[1]
169 $safefilename = preg_replace(
'/[^a-zA-Z0-9_\.]/',
'', $_FILES[
'img_file'][
'name']);
173 $_FILES[
'img_file'][
'tmp_name']
177 $media_object::_saveUsage(
178 $media_object->getId(),
179 $DIC->http()->wrapper()->query()->retrieve(
181 $DIC->refinery()->kindlyTo()->string()
183 $DIC->http()->wrapper()->query()->retrieve(
185 $DIC->refinery()->kindlyTo()->int()
190 $mobs[$media_object->getId()] = $media_object->getId();
198 $panel = [
'img_insert_command' =>
"ilimgupload.insert"];
200 $panel[
"img_url_tab_desc"] =
"ilimgupload.edit_image";
201 $panel[
"img_from_url_desc"] =
"ilimgupload.edit_image_desc";
203 $panel[
"img_url_tab_desc"] =
"ilimgupload.upload_image_from_url";
204 $panel[
"img_from_url_desc"] =
"ilimgupload.upload_image_from_url_desc";
208 foreach (
$mobs as $mob) {
210 if (is_dir($mobdir) && (
$d = dir($mobdir))) {
212 while (
false !== ($entry =
$d->read())) {
213 $ext = strtolower(substr(strrchr($entry,
'.'), 1));
240 $DIC->http()->saveResponse(
241 $DIC->http()->response()
242 ->withHeader(ResponseHeader::CONTENT_TYPE,
'application/json')
245 $DIC->http()->sendResponse();
246 $DIC->http()->close();
static getMimeType(string $a_file='', string $a_filename='', string $a_mime='')
static saveTempFileAsMediaObject(string $sid, string $name, string $tmp_name)
if($DIC->http() ->wrapper() ->query() ->has('update')) $uploadedFile
if(isset($_FILES['img_file']) &&is_array($_FILES['img_file'])) $panel
$location
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ChatMainBarProvider .
static virusHandling(string $a_file, string $a_orig_name='', bool $a_clean=true)
static initILIAS()
ilias initialisation
foreach($mobs as $mob) $response
if($DIC->http() ->wrapper() ->post() ->has('imglist')) $_root
$tinyMCE_img_delete_allowed
static getMobsOfObject(string $sid, string $a_type, int $a_id)
if(defined('ILIAS_HTTP_PATH')) $installpath
Class FlySystemFileAccessTest disabled disabled disabled.
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d