24 include dirname(dirname(__DIR__)) .
'/mainfile.php';
31 $op = Request::getCmd(
'op',
'list');
34 $start = Request::getInt(
'start', 0);
37 exit(
'Target not set');
44 $xoopsTpl->assign(
'sitename', htmlspecialchars(
$xoops->getConfig(
'sitename'), ENT_QUOTES));
52 $form =
$helper->getForm($param,
'category_imagemanager');
60 foreach (array_keys($images) as
$i) {
61 if ($category->getVar(
'imgcat_storetype') ==
'db') {
62 $lcode =
'[img align=left id=' . $images[
$i]->getVar(
'image_id') .
']' . $images[
$i]->getVar(
'image_nicename') .
'[/img]';
63 $code =
'[img align=center id=' . $images[
$i]->getVar(
'image_id') .
']' . $images[
$i]->getVar(
'image_nicename') .
'[/img]';
64 $rcode =
'[img align=right id=' . $images[
$i]->getVar(
'image_id') .
']' . $images[
$i]->getVar(
'image_nicename') .
'[/img]';
65 $src =
$helper->url(
"image.php?id=" . $images[$i]->getVar(
'image_id'));
67 $lcode =
'[img align=left]' .
\XoopsBaseConfig::get(
'uploads-url') .
'/' . $images[
$i]->getVar(
'image_name') .
'[/img]';
69 $rcode =
'[img align=right]' .
\XoopsBaseConfig::get(
'uploads-url') .
'/' . $images[
$i]->getVar(
'image_name') .
'[/img]';
73 'id' => $images[$i]->getVar(
'image_id'),
74 'nicename' => $images[$i]->getVar(
'image_nicename'),
75 'mimetype' => $images[$i]->getVar(
'image_mimetype'),
88 $perm_handler =
$xoops->getHandlerGroupperm();
92 $obj =
$helper->getHandlerImages()->create();
101 if (!
$xoops->security()->check()) {
102 $xoops->redirect(
'imagemanager.php?imgcat_id=' .
$imgcat_id, 3, implode(
'<br />',
$xoops->security()->getErrors()));
105 $mimetypes = array(
'image/gif',
'image/jpeg',
'image/pjpeg',
'image/x-png',
'image/png');
109 $image_id = Request::getInt(
'image_id', 0);
110 $obj =
$helper->getHandlerImages()->create();
112 $obj->setVar(
'image_nicename', Request::getString(
'image_nicename',
''));
113 $obj->setVar(
'image_created', time());
114 $obj->setVar(
'image_display', Request::getInt(
'image_display', 1));
115 $obj->setVar(
'image_weight', Request::getInt(
'image_weight', 0));
118 $xoops_upload_file = Request::getArray(
'xoops_upload_file', array());
123 $category->getVar(
'imgcat_maxsize'),
124 $category->getVar(
'imgcat_maxwidth'),
125 $category->getVar(
'imgcat_maxheight')
127 if ($uploader->fetchMedia($xoops_upload_file[0])) {
128 $uploader->setPrefix(
"img");
129 if (!$uploader->upload()) {
130 $msg[] = $uploader->getErrors();
131 $obj->setVar(
'image_name',
'blank.gif');
132 $obj->setVar(
'image_mimetype',
'image/gif');
134 $obj->setVar(
'image_mimetype', $uploader->getMediaType());
135 if ($category->getVar(
'imgcat_storetype') ==
'db') {
136 $fp = @fopen($uploader->getSavedDestination(),
'rb');
137 $fbinary = @fread($fp, filesize($uploader->getSavedDestination()));
139 $image_body = $fbinary;
141 $obj->setVar(
'image_name',
'images/' . $uploader->getSavedFileName());
147 if ($category->getVar(
'imgcat_storetype') ==
'db') {
149 if (!is_object($imagebody)) {
150 $imagebody =
$helper->getHandlerImagesBody()->create();
151 $imagebody->setVar(
'image_id',
$image_id);
153 $imagebody->setVar(
'image_body', $image_body);
154 if (
$helper->getHandlerImagesBody()->insert($imagebody)) {
155 @unlink($uploader->getSavedDestination());
160 echo
$xoops->alert(
'error', $obj->getHtmlErrors());
165 $xoopsTpl->display(
'module:images/images_imagemanager.tpl');
if(empty($target)) $groups
if(!is_object($module)||!$module->getVar('isactive')) $msg
const _AM_IMAGES_IMG_SAVE