Exemple #1
0
}
// allowed extentions for uploaded image files
$tinyMCE_valid_imgs = array('gif', 'jpg', 'jpeg', 'png');
// allow upload in image library
$tinyMCE_upload_allowed = true;
include_once 'webservice/soap/include/inc.soap_functions.php';
$mobs = ilSoapFunctions::getMobsOfObject(session_id() . '::' . CLIENT_ID, $_GET['obj_type'] . ':html', (int) $_GET['obj_id']);
$preview = '';
$img = isset($_POST['imglist']) ? $_POST['imglist'] : '';
$_root = $installpath;
$errors = array();
// upload images
if (isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) {
    include_once 'webservice/soap/include/inc.soap_functions.php';
    $safefilename = preg_replace('/[^a-zA-z0-9_\\.]/', '', $_FILES['img_file']['name']);
    $media_object = ilSoapFunctions::saveTempFileAsMediaObject(session_id() . '::' . CLIENT_ID, $safefilename, $_FILES['img_file']['tmp_name']);
    if (file_exists($iliasAbsolutePath . $iliasMobPath . 'mm_' . $media_object->getId() . '/' . $media_object->getTitle())) {
        // only save usage if the file was uploaded
        $media_object->_saveUsage($media_object->getId(), $_GET['obj_type'] . ':html', (int) $_GET['obj_id']);
    }
    $preview = $iliasHttpPath . $iliasMobPath . 'mm_' . $media_object->getId() . '/' . $media_object->getTitle();
    $mobs[$media_object->getId()] = $media_object->getId();
}
$tpl = new ilTemplate(dirname(__FILE__) . '/tpl.imagemanager.html', true, true);
// delete image
if ($tinyMCE_img_delete_allowed && isset($_POST['lib_action']) && $_POST['lib_action'] == 'delete' && !empty($img)) {
    deleteImg();
}
if ($tinyMCE_img_delete_allowed) {
    $tpl->touchBlock("delete_allowed");
}