22 require_once dirname(__FILE__).
'/../../../../../../mainfile.php';
25 $xoops->simpleHeader(
false);
28 $helper->loadLanguage(
'tinymce');
31 $op = Request::getCmd(
'op',
'list');
33 $start = Request::getInt(
'start', 0);
42 $param = array(
'imgcat_id' =>
$imgcat_id,
'target' => null);
43 $form =
$helper->getForm($param,
'category_imagemanager');
51 foreach (array_keys($images) as
$i) {
52 if ($category->getVar(
'imgcat_storetype') ==
'db') {
53 $src =
$helper->url(
"image.php?id=" . $images[$i]->getVar(
'image_id'));
56 $src = $xoops_uploads_url .
'/' . $images[
$i]->getVar(
'image_name');
59 'id' => $images[$i]->getVar(
'image_id'),
60 'nicename' => $images[$i]->getVar(
'image_nicename'),
61 'mimetype' => $images[$i]->getVar(
'image_mimetype'),
71 $perm_handler =
$xoops->getHandlerGroupperm();
75 $obj =
$helper->getHandlerImages()->create();
77 $form =
$helper->getForm(array(
'obj' => $obj,
'target' => null),
'image_imagemanager');
85 if (!
$xoops->security()->check()) {
86 $xoops->redirect(
'xoops_images.php?imgcat_id=' .
$imgcat_id, 3, implode(
'<br />',
$xoops->security()->getErrors()));
89 $mimetypes = array(
'image/gif',
'image/jpeg',
'image/pjpeg',
'image/x-png',
'image/png');
93 $image_id = Request::getInt(
'image_id', 0);
94 $obj =
$helper->getHandlerImages()->create();
96 $obj->setVar(
'image_nicename', Request::getString(
'image_nicename',
''));
97 $obj->setVar(
'image_created', time());
98 $obj->setVar(
'image_display', Request::getInt(
'image_display', 1));
99 $obj->setVar(
'image_weight', Request::getInt(
'image_weight', 0));
102 $xoops_upload_file = Request::getArray(
'xoops_upload_file', array());
107 $category->getVar(
'imgcat_maxsize'),
108 $category->getVar(
'imgcat_maxwidth'),
109 $category->getVar(
'imgcat_maxheight')
111 if ($uploader->fetchMedia($xoops_upload_file[0])) {
112 $uploader->setPrefix(
"img");
113 if (!$uploader->upload()) {
114 $msg[] = $uploader->getErrors();
115 $obj->setVar(
'image_name',
'blank.gif');
116 $obj->setVar(
'image_mimetype',
'image/gif');
118 $obj->setVar(
'image_mimetype', $uploader->getMediaType());
119 if ($category->getVar(
'imgcat_storetype') ==
'db') {
120 $fp = @fopen($uploader->getSavedDestination(),
'rb');
121 $fbinary = @fread($fp, filesize($uploader->getSavedDestination()));
123 $image_body = $fbinary;
125 $obj->setVar(
'image_name',
'images/' . $uploader->getSavedFileName());
131 if ($category->getVar(
'imgcat_storetype') ==
'db') {
133 if (!is_object($imagebody)) {
134 $imagebody =
$helper->getHandlerImagesBody()->create();
135 $imagebody->setVar(
'image_id',
$image_id);
137 $imagebody->setVar(
'image_body', $image_body);
138 if (
$helper->getHandlerImagesBody()->insert($imagebody)) {
139 @unlink($uploader->getSavedDestination());
144 echo
$xoops->alert(
'error', $obj->getHtmlErrors());
147 $xoopsTpl->display(
'module:images/images_tinymce.tpl');
static getHelper($dirname= 'system')
if(!is_object($module)||!$module->getVar('isactive')) $msg
const _AM_IMAGES_IMG_SAVE