11 include
'../../../mainfile.php';
12 XoopsLogger::getInstance()->activated =
false;
13 XoopsLogger::getInstance()->renderingEnabled =
false;
19 echo
'<input type="hidden" id="ret-token" value="'.$xoopsSecurity->createToken().
'" />';
36 RMTemplate::get()->add_local_script(
'jquery.min.js',
'rmcommon',
'include');
37 RMTemplate::get()->add_local_script(
'jquery-ui.min.js',
'rmcommon',
'include');
38 RMTemplate::get()->add_local_script(
'images_editor.js',
'rmcommon',
'include');
42 $uploader->add_setting(
'scriptData', array(
44 'category'=>
$cat->id(),
48 $uploader->add_setting(
'fileExt',
'*.jpg;*.png;*.gif');
49 $uploader->add_setting(
'fileDesc',
__(
'All Images (*.jpg, *.png, *.gif)',
'rmcommon'));
50 $uploader->add_setting(
'sizeLimit',
$cat->getVar(
'filesize') *
$cat->getVar(
'sizeunit'));
51 $uploader->add_setting(
'buttonText',
__(
'Browse Images...',
'rmcommon'));
52 $uploader->add_setting(
'queueSizeLimit', 100);
54 $uploader->add_setting(
'onSelect',
"function(file){
55 if (queuefiles[file]) return false;
56 queuefiles[file] = true;
57 \$('#upload-errors').html('');
60 $uploader->add_setting(
'onUploadSuccess',
"function(file, resp, data){
63 \$('#upload-errors').append('<span class=\"failed\"><strong>'+file.name+'</strong>: '+ret.message+'</span>');
66 ids[total-1] = ret.id;
67 \$('#upload-errors').append('<span class=\"done\"><strong>'+file.name+'</strong>: ".
__(
'Uploaded successfully!',
'rmcommon').
"</span>');
71 $uploader->add_setting(
'onQueueComplete',
"function(event, data){
73 \$('.categories_selector').hide('slow');
74 \$('#upload-errors').hide('slow');
75 \$('#upload-errors').html('');
76 \$('#upload-controls').hide('slow');
77 \$('#resizer-bar').show('slow');
78 \$('#resizer-bar').effect('highlight',{},1000);
79 \$('#gen-thumbnails').show();
81 var increments = 1/total*100;
82 url = '".
RMCURL.
"/images.php".(
$target!=
''?
"?taget=$target&id=$container":
'').
"';
100 RMTemplate::get()->add_head(
'<script type="text/javascript">var exmPopup = window.parent.'.
$en.
';</script>');
103 RMEvents::get()->run_event(
'rmcommon.loading.editorimages',
'');
105 include
RMTemplate::get()->get_template(
'editor_image.php',
'module',
'rmcommon');
109 $db = XoopsDatabaseFactory::getDatabaseConnection();
112 _e(
'Sorry, unauthorized operation!',
'rmcommon');
119 send_message(
__(
'There are not categories yet! Please create one in order to add images.',
'rmcommon'));
128 $sql =
"SELECT COUNT(*) FROM ".$db->prefix(
"rmc_images");
129 if (!
$cat->isNew())
$sql .=
" WHERE cat='".
$cat->id().
"'";
144 $nav->target_url(
'javascript:;" onclick="show_library({PAGE_NUM});');
147 $sql =
"SELECT * FROM ".$db->prefix(
"rmc_images").
" ".(!
$cat->isNew() ?
"WHERE cat='".$cat->id().
"'" :
'').
" ORDER BY id_img DESC LIMIT $start,$limit";
151 $categories = array();
156 $current_size = array();
158 foreach ($sizes as $size){
159 if (empty($current_size)){
160 $current_size = $size;
162 if ($current_size[
'width']>=$size[
'width'] && $size[
'width']>0){
163 $current_size = $size;
168 $mimes = include(XOOPS_ROOT_PATH.
'/include/mimetypes.inc.php');
172 $img->assignVars($row);
173 if (!isset($categories[$img->getVar(
'cat')])){
174 $categories[$img->getVar(
'cat')] =
new RMImageCategory($img->getVar(
'cat'));
177 if (!isset($authors[$img->getVar(
'uid')])){
178 $authors[$img->getVar(
'uid')] =
new XoopsUser($img->getVar(
'uid'));
181 $fd = pathinfo($img->getVar(
'file'));
182 $filesurl = XOOPS_UPLOAD_URL.
'/'.date(
'Y',$img->getVar(
'date')).
'/'.date(
'm',$img->getVar(
'date'));
184 $thumb = date(
'Y',$img->getVar(
'date')).
'/'.date(
'm',$img->getVar(
'date')).
'/sizes/'.$fd[
'filename'].
'_'.$current_size[
'width'].
'x'.$current_size[
'height'].
'.'.$fd[
'extension'];
185 if(!file_exists(XOOPS_UPLOAD_PATH.
'/'.$thumb)){
186 $thumb = date(
'Y',$img->getVar(
'date')).
'/'.date(
'm',$img->getVar(
'date')).
'/'.$fd[
'filename'].
'.'.$fd[
'extension'];
191 'title' => $img->getVar(
'title'),
192 'date' => formatTimestamp($img->getVar(
'date'),
'l'),
193 'desc' => $img->getVar(
'desc',
'n'),
194 'cat' => $categories[$img->getVar(
'cat')]->getVar(
'name'),
195 'author' => $authors[$img->getVar(
'uid')],
196 'thumb' => XOOPS_UPLOAD_URL.
'/'.$thumb,
198 'file' => $fd[
'filename'],
199 'extension' => $fd[
'extension'],
200 'mime' => isset($mimes[$fd[
'extension']]) ? $mimes[$fd[
'extension']] :
'application/octet-stream',
202 'file'=>array(
'caption'=>
__(
'File URL',
'rmcommon'),
'value'=>XOOPS_UPLOAD_URL.
'/'.date(
'Y',$img->getVar(
'date')).
'/'.date(
'm',$img->getVar(
'date')).
'/'.$img->getVar(
'file')),
203 'none'=>array(
'caption'=>
__(
'None',
'rmcommon'),
'value'=>
'')
210 include
RMTemplate::get()->get_template(
'images_list_editor.php',
'module',
'rmcommon');