6require_once 
'Services/Init/classes/class.ilInitialisation.php';
 
   21$lng->loadLanguageModule(
"form");
 
   25if (defined(
'ILIAS_HTTP_PATH')) {
 
   26    $weburl = substr(ILIAS_HTTP_PATH, 0, strrpos(ILIAS_HTTP_PATH, 
'/node_modules')) . 
'/';
 
   53include_once 
'webservice/soap/include/inc.soap_functions.php';
 
   62if (isset($_FILES[
'img_file']) && is_array($_FILES[
'img_file'])) {
 
   64    while (substr($_FILES[
'img_file'][
'name'], -1) == 
'/') {
 
   65        $_FILES[
'img_file'][
'name'] = substr($_FILES[
'img_file'][
'name'], 0, -1);
 
   68    $error = $_FILES[
'img_file'][
'error'];
 
   70        case UPLOAD_ERR_INI_SIZE:
 
   71            $errors->fields[] = array(
'name' => 
'img_file', 
'message' => 
$lng->txt(
'form_msg_file_size_exceeds'));
 
   74        case UPLOAD_ERR_FORM_SIZE:
 
   75            $errors->fields[] = array(
'name' => 
'img_file', 
'message' => 
$lng->txt(
"form_msg_file_size_exceeds"));
 
   78        case UPLOAD_ERR_PARTIAL:
 
   79            $errors->fields[] = array(
'name' => 
'img_file', 
'message' => 
$lng->txt(
"form_msg_file_partially_uploaded"));
 
   82        case UPLOAD_ERR_NO_FILE:
 
   83            $errors->fields[] = array(
'name' => 
'img_file', 
'message' => 
$lng->txt(
"form_msg_file_no_upload"));
 
   86        case UPLOAD_ERR_NO_TMP_DIR:
 
   87            $errors->fields[] = array(
'name' => 
'img_file', 
'message' => 
$lng->txt(
"form_msg_file_missing_tmp_dir"));
 
   90        case UPLOAD_ERR_CANT_WRITE:
 
   91            $errors->fields[] = array(
'name' => 
'img_file', 
'message' => 
$lng->txt(
"form_msg_file_cannot_write_to_disk"));
 
   94        case UPLOAD_ERR_EXTENSION:
 
   95            $errors->fields[] = array(
'name' => 
'img_file', 
'message' => 
$lng->txt(
"form_msg_file_upload_stopped_ext"));
 
  101        $finfo = pathinfo($_FILES[
'img_file'][
'name']);
 
  102        require_once 
'Services/Utilities/classes/class.ilMimeTypeUtil.php';
 
  103        $mime_type = 
ilMimeTypeUtil::getMimeType($_FILES[
'img_file'][
'tmp_name'], $_FILES[
'img_file'][
'name'], $_FILES[
'img_file'][
'type']);
 
  104        if (!in_array(strtolower($finfo[
'extension']), 
$tinyMCE_valid_imgs) || !in_array($mime_type, array(
 
  109            $errors->fields[] = array(
'name' => 
'img_file', 
'message' => 
$lng->txt(
"form_msg_file_wrong_file_type"));
 
  115        if ($_FILES[
'img_file'][
"tmp_name"] != 
"") {
 
  117            if ($vir[0] == 
false) {
 
  118                $errors->fields[] = array(
'name' => 
'img_file', 
'message' => 
$lng->txt(
"form_msg_file_virus_found") . 
"<br />" . $vir[1]);
 
  123        include_once 
'webservice/soap/include/inc.soap_functions.php';
 
  124        $safefilename = preg_replace(
'/[^a-zA-z0-9_\.]/', 
'', $_FILES[
'img_file'][
'name']);
 
  128            $media_object->_saveUsage($media_object->getId(), 
$_GET[
'obj_type'] . 
':html', (
int) 
$_GET[
'obj_id']);
 
  131            $mobs[$media_object->getId()] = $media_object->getId();
 
  139if (
$_GET[
"update"] == 1) {
 
  140    $panel[
"img_url_tab_desc"]= 
"ilimgupload.edit_image";
 
  141    $panel[
"img_from_url_desc"]=
"ilimgupload.edit_image_desc";
 
  142    $panel[
'img_insert_command'] = 
"ilimgupload.insert";
 
  145    $panel[
"img_url_tab_desc"]= 
"ilimgupload.upload_image_from_url";
 
  146    $panel[
"img_from_url_desc"]=
"ilimgupload.upload_image_from_url_desc";
 
  147    $panel[
'img_insert_command'] = 
"ilimgupload.insert";
 
  151foreach (
$mobs as $mob) {
 
  156        while (
false !== ($entry = 
$d->read())) {
 
  157            $ext = strtolower(substr(strrchr($entry, 
'.'), 1));
 
  184echo json_encode(array(
'response' => 
$response));
 
An exception for terminatinating execution or to throw for unit testing.
static initILIAS()
ilias initialisation
static getMimeType($a_file='', $a_filename='', $a_mime='')
static getMobsOfObject($sid, $a_type, $a_id)
static saveTempFileAsMediaObject($sid, $name, $tmp_name)
static virusHandling($a_file, $a_orig_name="", $a_clean=true)
scan file for viruses and clean files if possible
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
foreach($mobs as $mob) $response
$tinyMCE_img_delete_allowed
if(isset($_FILES['img_file']) &&is_array($_FILES['img_file'])) $panel
if(defined('ILIAS_HTTP_PATH')) $installpath