4 include_once
"../../../../../classes/class.ilIniFile.php";
5 $file =
"../../../../../ilias.ini.php";
8 $htdocs=
$ini->readVariable(
"server",
"absolute_path") .
"/";
32 $_GET[
"client_id"] = str_replace(
"..",
"",
$_GET[
"client_id"]);
35 chdir(
"../../../../../");
36 include_once
"webservice/soap/include/inc.soap_functions.php";
48 if (isset($_FILES[
'img_file'][
'size']) && $_FILES[
'img_file'][
'size']>0)
51 chdir(
"../../../../../");
52 include_once
"webservice/soap/include/inc.soap_functions.php";
53 $safefilename = preg_replace(
"/[^a-zA-z0-9_\.]/",
"", $_FILES[
"img_file"][
"name"]);
55 if (file_exists(
$iliasAbsolutePath.$iliasMobPath.
"mm_".$media_object->getId() .
"/" . $media_object->getTitle()))
58 $media_object->_saveUsage($media_object->getId(), $_GET[
"obj_type"].
":html", $_GET[
"obj_id"]);
63 $mobs[$media_object->getId()] = $media_object->getId();
69 $tpl->loadTemplatefile(
"tpl.img_upload.html",
true,
true);
71 $tpl->setVariable(
"REQUEST_URI",
$_GET[
"request_uri"]);
73 $tpl->setVariable(
"OBJ_ID",
$_GET[
"obj_id"]);
74 $tpl->setVariable(
"OBJ_TYPE",
$_GET[
"obj_type"]);
75 $tpl->setVariable(
"SESSION_ID",
$_GET[
"session_id"]);
76 $tpl->setVariable(
"CLIENT_ID",
$_GET[
"client_id"]);
77 $tpl->setVariable(
"VALUE_UPDATE",
$_GET[
"update"]);
79 if (
$_GET[
"update"] == 1)
81 $tpl->setVariable(
"INSERT_TYPE",
"button");
82 $tpl->setVariable(
"INSERT_COMMAND",
"{#update}");
83 $tpl->touchBlock(
'src');
84 $tpl->touchBlock(
'preview');
88 $tpl->setVariable(
"INSERT_TYPE",
"submit");
89 $tpl->setVariable(
"INSERT_COMMAND",
"{#ilimgupload.upload}");
90 $tpl->touchBlock(
'upload');
96 $error_messages .=
'<span class="error">';
99 $error_messages .= $err .
"<br />";
101 $error_messages .=
"</span>";
106 $tpl->setVariable(
'HEIGHT',
$_POST[
'height']);
109 $tpl->touchBlock(
'adoptimage');
113 $tpl->setVariable(
"ERROR_MESSAGES", $error_messages);
117 function filesize_h(
$size, $dec = 1)
119 $sizes = array(
'byte(s)',
'kb',
'mb',
'gb');
120 $count = count($sizes);
123 while (
$size >= 1024 && ($i < $count - 1)) {
128 return round(
$size, $dec) .
' ' . $sizes[$i];