27 $_GET[$k] = str_replace(array(
"\x00",
"\n",
"\r",
"\\",
"'",
'"',
"\x1a"),
"", $v);
31 include_once
"config.php";
33 $_GET[
"client_id"] = str_replace(
"..",
"",
$_GET[
"client_id"]);
36 chdir(
"../../../../../");
37 include_once
"webservice/soap/include/inc.soap_functions.php";
51 if (isset($_FILES[
'img_file'][
'size']) && $_FILES[
'img_file'][
'size']>0)
54 chdir(
"../../../../../");
55 include_once
"webservice/soap/include/inc.soap_functions.php";
56 $safefilename = preg_replace(
"/[^a-zA-z0-9_\.]/",
"", $_FILES[
"img_file"][
"name"]);
58 if (file_exists(
$iliasAbsolutePath.$iliasMobPath.
"mm_".$media_object->getId() .
"/" . $media_object->getTitle()))
61 $media_object->_saveUsage($media_object->getId(),
$_GET[
"obj_type"].
":html",
$_GET[
"obj_id"]);
65 $mobs[$media_object->getId()] = $media_object->getId();
70 $tpl->loadTemplatefile(
"tpl.imagemanager.html", TRUE, TRUE);
74 && (
$_POST[
'lib_action']==
'delete') && !empty(
$img))
81 $tpl->touchBlock(
"delete_allowed");
85 $tpl->setVariable(
"REQUEST_URI",
$_GET[
"request_uri"]);
87 $tpl->setVariable(
"OBJ_ID",
$_GET[
"obj_id"]);
88 $tpl->setVariable(
"OBJ_TYPE",
$_GET[
"obj_type"]);
89 $tpl->setVariable(
"SESSION_ID",
$_GET[
"session_id"]);
90 $tpl->setVariable(
"CLIENT_ID",
$_GET[
"client_id"]);
91 $tpl->setVariable(
"VALUE_UPDATE",
$_GET[
"update"]);
93 if (
$_GET[
"update"] == 1)
95 $tpl->setVariable(
"INSERT_COMMAND",
"{#update}");
99 $tpl->setVariable(
"INSERT_COMMAND",
"{#insert}");
102 $error_messages =
"";
105 $error_messages .=
'<span class="error">';
108 $error_messages .= $err .
"<br />";
110 $error_messages .=
"</span>";
112 $tpl->setVariable(
"ERROR_MESSAGES", $error_messages);
115 function outMobImages()
129 foreach ($mobs as $mob)
131 $mobdir = $iliasAbsolutePath.$iliasMobPath.
"mm_".$mob .
"/";
135 while (FALSE !== ($entry =
$d->read()))
137 $ext = strtolower(substr(strrchr($entry,
'.'), 1));
138 if (is_file($mobdir.$entry) && in_array($ext, $tinyMCE_valid_imgs))
140 $arr_tinyMCE_image_files[$i][
"file_name"] = $entry;
141 $arr_tinyMCE_image_files[$i][
"file_dir"] = $mobdir;
142 $arr_tinyMCE_image_files[$i][
"http_dir"] = $iliasHttpPath.$iliasMobPath.
"mm_".$mob .
"/";
150 $errors[] =
'{#ibrowser.errornodir}';
154 sort($arr_tinyMCE_image_files);
156 for ($k=0; $k<count($arr_tinyMCE_image_files); $k++)
158 $entry = $arr_tinyMCE_image_files[$k][
"file_name"];
159 $size = getimagesize($arr_tinyMCE_image_files[$k][
"file_dir"].$entry);
160 $fsize = filesize($arr_tinyMCE_image_files[$k][
"file_dir"].$entry);
161 $tpl->setCurrentBlock(
"imagefile");
162 $tpl->setVariable(
"IMAGEFILE_VALUE", $arr_tinyMCE_image_files[$k][
"http_dir"]);
163 $tpl->setVariable(
"IMAGEFILE_TEXT", $entry);
166 $tpl->setVariable(
"IMAGEFILE_SELECTED",
" selected=\"selected\"");
168 $tpl->parseCurrentBlock();
172 function outMobImageParams()
176 for ($k=0; $k<count($arr_tinyMCE_image_files); $k++)
178 $tpl->setCurrentBlock(
"imageparams");
179 $entry = $arr_tinyMCE_image_files[$k][
"file_name"];
180 $size = getimagesize($arr_tinyMCE_image_files[$k][
"file_dir"].$entry);
181 $fsize = filesize($arr_tinyMCE_image_files[$k][
"file_dir"].$entry);
182 $tpl->setVariable(
"IMG_WIDTH", $size[0]);
183 $tpl->setVariable(
"IMG_HEIGHT", $size[1]);
184 $tpl->setVariable(
"IMG_PATH", $arr_tinyMCE_image_files[$k][
"http_dir"]);
185 $tpl->setVariable(
"F_SIZE", filesize_h($fsize,2));
186 $tpl->parseCurrentBlock();
198 function filesize_h($size, $dec = 1)
200 $sizes = array(
'byte(s)',
'kb',
'mb',
'gb');
201 $count = count($sizes);
204 while ($size >= 1024 && ($i < $count - 1)) {
209 return round($size, $dec) .
' ' . $sizes[$i];
212 function liboptions($arr, $prefix =
'', $sel =
'')
215 foreach($arr as $lib) {
216 $buf .=
'<option value="'.$lib[
'value'].
'"'.(($lib[
'value'] == $sel)?
' selected':
'').
'>'.$prefix.$lib[
'text'].
'</option>'.
"\n";