24 include_once
"HTML/Template/ITX.php";
25 include_once
"config.php";
27 $_GET[
"client_id"] = str_replace(
"..",
"",
$_GET[
"client_id"]);
30 chdir(
"../../../../../");
31 include_once
"webservice/soap/include/inc.soap_functions.php";
37 $request_uri = urldecode(empty($_POST[
'request_uri'])?(empty(
$_GET[
'request_uri'])?
'':
$_GET[
'request_uri']):$_POST[
'request_uri']);
38 $img = isset($_POST[
'imglist'])?$_POST[
'imglist']:
'';
43 if (isset($_FILES[
'img_file'][
'size']) && $_FILES[
'img_file'][
'size']>0)
46 chdir(
"../../../../../");
47 include_once
"webservice/soap/include/inc.soap_functions.php";
48 $safefilename = preg_replace(
"/[^a-zA-z0-9_\.]/",
"", $_FILES[
"img_file"][
"name"]);
50 if (file_exists(
$iliasAbsolutePath.$iliasMobPath.
"mm_".$media_object->getId() .
"/" . $media_object->getTitle()))
53 $media_object->_saveUsage($media_object->getId(),
$_GET[
"obj_type"].
":html",
$_GET[
"obj_id"]);
57 $mobs[$media_object->getId()] = $media_object->getId();
61 $tpl->loadTemplatefile(
"tpl.imagemanager.html", TRUE, TRUE);
65 && ($_POST[
'lib_action']==
'delete') && !empty(
$img))
72 $tpl->touchBlock(
"delete_allowed");
76 $tpl->setVariable(
"REQUEST_URI",
$_GET[
"request_uri"]);
78 $tpl->setVariable(
"OBJ_ID",
$_GET[
"obj_id"]);
79 $tpl->setVariable(
"OBJ_TYPE",
$_GET[
"obj_type"]);
80 $tpl->setVariable(
"SESSION_ID",
$_GET[
"session_id"]);
81 $tpl->setVariable(
"CLIENT_ID",
$_GET[
"client_id"]);
82 $tpl->setVariable(
"VALUE_UPDATE",
$_GET[
"update"]);
84 if (
$_GET[
"update"] == 1)
86 $tpl->setVariable(
"INSERT_COMMAND",
"{#update}");
90 $tpl->setVariable(
"INSERT_COMMAND",
"{#insert}");
96 $error_messages .=
'<span class="error">';
99 $error_messages .= $err .
"<br />";
101 $error_messages .=
"</span>";
103 $tpl->setVariable(
"ERROR_MESSAGES", $error_messages);
106 function outMobImages()
120 foreach ($mobs as $mob)
122 $mobdir = $iliasAbsolutePath.$iliasMobPath.
"mm_".$mob .
"/";
126 while (FALSE !== ($entry =
$d->read()))
128 $ext = strtolower(substr(strrchr($entry,
'.'), 1));
129 if (is_file($mobdir.$entry) && in_array($ext, $tinyMCE_valid_imgs))
131 $arr_tinyMCE_image_files[$i][
"file_name"] = $entry;
132 $arr_tinyMCE_image_files[$i][
"file_dir"] = $mobdir;
133 $arr_tinyMCE_image_files[$i][
"http_dir"] = $iliasHttpPath.$iliasMobPath.
"mm_".$mob .
"/";
141 $errors[] =
'{#ibrowser.errornodir}';
145 sort($arr_tinyMCE_image_files);
147 for ($k=0; $k<count($arr_tinyMCE_image_files); $k++)
149 $entry = $arr_tinyMCE_image_files[$k][
"file_name"];
150 $size = getimagesize($arr_tinyMCE_image_files[$k][
"file_dir"].$entry);
151 $fsize = filesize($arr_tinyMCE_image_files[$k][
"file_dir"].$entry);
152 $tpl->setCurrentBlock(
"imagefile");
153 $tpl->setVariable(
"IMAGEFILE_VALUE", $arr_tinyMCE_image_files[$k][
"http_dir"]);
154 $tpl->setVariable(
"IMAGEFILE_TEXT", $entry);
157 $tpl->setVariable(
"IMAGEFILE_SELECTED",
" selected=\"selected\"");
159 $tpl->parseCurrentBlock();
163 function outMobImageParams()
167 for ($k=0; $k<count($arr_tinyMCE_image_files); $k++)
169 $tpl->setCurrentBlock(
"imageparams");
170 $entry = $arr_tinyMCE_image_files[$k][
"file_name"];
171 $size = getimagesize($arr_tinyMCE_image_files[$k][
"file_dir"].$entry);
172 $fsize = filesize($arr_tinyMCE_image_files[$k][
"file_dir"].$entry);
173 $tpl->setVariable(
"IMG_WIDTH",
$size[0]);
174 $tpl->setVariable(
"IMG_HEIGHT",
$size[1]);
175 $tpl->setVariable(
"IMG_PATH", $arr_tinyMCE_image_files[$k][
"http_dir"]);
176 $tpl->setVariable(
"F_SIZE", filesize_h($fsize,2));
177 $tpl->parseCurrentBlock();
189 function filesize_h(
$size, $dec = 1)
191 $sizes = array(
'byte(s)',
'kb',
'mb',
'gb');
192 $count = count($sizes);
195 while (
$size >= 1024 && ($i < $count - 1)) {
200 return round(
$size, $dec) .
' ' . $sizes[$i];
203 function liboptions($arr, $prefix =
'', $sel =
'')
206 foreach($arr as $lib) {
207 $buf .=
'<option value="'.$lib[
'value'].
'"'.(($lib[
'value'] == $sel)?
' selected':
'').
'>'.$prefix.$lib[
'text'].
'</option>'.
"\n";