24 include_once
"config.php";
26 $_GET[
"client_id"] = str_replace(
"..",
"",
$_GET[
"client_id"]);
29 chdir(
"../../../../../");
30 include_once
"webservice/soap/include/inc.soap_functions.php";
41 if (isset($_FILES[
'img_file'][
'size']) && $_FILES[
'img_file'][
'size']>0)
44 chdir(
"../../../../../");
45 include_once
"webservice/soap/include/inc.soap_functions.php";
46 $safefilename = preg_replace(
"/[^a-zA-z0-9_\.]/",
"", $_FILES[
"img_file"][
"name"]);
48 if (file_exists(
$iliasAbsolutePath.$iliasMobPath.
"mm_".$media_object->getId() .
"/" . $media_object->getTitle()))
51 $media_object->_saveUsage($media_object->getId(),
$_GET[
"obj_type"].
":html",
$_GET[
"obj_id"]);
55 $mobs[$media_object->getId()] = $media_object->getId();
60 $tpl->loadTemplatefile(
"tpl.imagemanager.html", TRUE, TRUE);
64 && (
$_POST[
'lib_action']==
'delete') && !empty(
$img))
71 $tpl->touchBlock(
"delete_allowed");
75 $tpl->setVariable(
"REQUEST_URI",
$_GET[
"request_uri"]);
77 $tpl->setVariable(
"OBJ_ID",
$_GET[
"obj_id"]);
78 $tpl->setVariable(
"OBJ_TYPE",
$_GET[
"obj_type"]);
79 $tpl->setVariable(
"SESSION_ID",
$_GET[
"session_id"]);
80 $tpl->setVariable(
"CLIENT_ID",
$_GET[
"client_id"]);
81 $tpl->setVariable(
"VALUE_UPDATE",
$_GET[
"update"]);
83 if (
$_GET[
"update"] == 1)
85 $tpl->setVariable(
"INSERT_COMMAND",
"{#update}");
89 $tpl->setVariable(
"INSERT_COMMAND",
"{#insert}");
95 $error_messages .=
'<span class="error">';
98 $error_messages .= $err .
"<br />";
100 $error_messages .=
"</span>";
102 $tpl->setVariable(
"ERROR_MESSAGES", $error_messages);
105 function outMobImages()
119 foreach ($mobs as $mob)
121 $mobdir = $iliasAbsolutePath.$iliasMobPath.
"mm_".$mob .
"/";
125 while (FALSE !== ($entry =
$d->read()))
127 $ext = strtolower(substr(strrchr($entry,
'.'), 1));
128 if (is_file($mobdir.$entry) && in_array($ext, $tinyMCE_valid_imgs))
130 $arr_tinyMCE_image_files[$i][
"file_name"] = $entry;
131 $arr_tinyMCE_image_files[$i][
"file_dir"] = $mobdir;
132 $arr_tinyMCE_image_files[$i][
"http_dir"] = $iliasHttpPath.$iliasMobPath.
"mm_".$mob .
"/";
140 $errors[] =
'{#ibrowser.errornodir}';
144 sort($arr_tinyMCE_image_files);
146 for ($k=0; $k<count($arr_tinyMCE_image_files); $k++)
148 $entry = $arr_tinyMCE_image_files[$k][
"file_name"];
149 $size = getimagesize($arr_tinyMCE_image_files[$k][
"file_dir"].$entry);
150 $fsize = filesize($arr_tinyMCE_image_files[$k][
"file_dir"].$entry);
151 $tpl->setCurrentBlock(
"imagefile");
152 $tpl->setVariable(
"IMAGEFILE_VALUE", $arr_tinyMCE_image_files[$k][
"http_dir"]);
153 $tpl->setVariable(
"IMAGEFILE_TEXT", $entry);
156 $tpl->setVariable(
"IMAGEFILE_SELECTED",
" selected=\"selected\"");
158 $tpl->parseCurrentBlock();
162 function outMobImageParams()
166 for ($k=0; $k<count($arr_tinyMCE_image_files); $k++)
168 $tpl->setCurrentBlock(
"imageparams");
169 $entry = $arr_tinyMCE_image_files[$k][
"file_name"];
170 $size = getimagesize($arr_tinyMCE_image_files[$k][
"file_dir"].$entry);
171 $fsize = filesize($arr_tinyMCE_image_files[$k][
"file_dir"].$entry);
172 $tpl->setVariable(
"IMG_WIDTH",
$size[0]);
173 $tpl->setVariable(
"IMG_HEIGHT",
$size[1]);
174 $tpl->setVariable(
"IMG_PATH", $arr_tinyMCE_image_files[$k][
"http_dir"]);
175 $tpl->setVariable(
"F_SIZE", filesize_h($fsize,2));
176 $tpl->parseCurrentBlock();
188 function filesize_h(
$size, $dec = 1)
190 $sizes = array(
'byte(s)',
'kb',
'mb',
'gb');
191 $count = count($sizes);
194 while (
$size >= 1024 && ($i < $count - 1)) {
199 return round(
$size, $dec) .
' ' . $sizes[$i];
202 function liboptions($arr, $prefix =
'', $sel =
'')
205 foreach($arr as $lib) {
206 $buf .=
'<option value="'.$lib[
'value'].
'"'.(($lib[
'value'] == $sel)?
' selected':
'').
'>'.$prefix.$lib[
'text'].
'</option>'.
"\n";