function images_form($edit = 0) { global $xoopsModule, $xoopsModuleConfig, $xoopsSecurity, $xoopsUser, $rmc_config; $category = rmc_server_var($_GET, 'category', 0); $cat = new RMImageCategory($category); if (!$cat->isNew() && $cat->getVar('status') != 'open') { showMessage(sprintf(__('Category %s is closed. Please, select another category.', 'rmcommon'), '"' . $cat->getVar('name') . '"'), 1); $cat = new RMImageCategory(); } /*$upload = new RMFlashUploader('images', 'images.php');*/ if (!$cat->isNew()) { $uploader = new RMFlashUploader('files-container', RMCURL . '/include/upload.php'); $uploader->add_setting('scriptData', array('action' => 'upload', 'category' => $cat->id(), 'rmsecurity' => TextCleaner::getInstance()->encrypt($xoopsUser->uid() . '|' . RMCURL . '/images.php' . '|' . $xoopsSecurity->createToken(), true))); $uploader->add_setting('multi', true); $uploader->add_setting('fileExt', '*.jpg;*.png;*.gif'); $uploader->add_setting('fileDesc', __('All Images (*.jpg, *.png, *.gif)', 'rmcommon')); $uploader->add_setting('sizeLimit', $cat->getVar('filesize') * $cat->getVar('sizeunit')); $uploader->add_setting('buttonText', __('Browse Images...', 'rmcommon')); $uploader->add_setting('queueSizeLimit', 100); $uploader->add_setting('onComplete', "function(event, id, file, resp, data){\n eval('ret = '+resp);\n if (ret.error){\n \$('#upload-errors').append('<span class=\"failed\"><strong>'+file.name+'</strong>: '+ret.message+'</span>');\n } else {\n total++;\n ids[total-1] = ret.id;\n \$('#upload-errors').append('<span class=\"done\"><strong>'+file.name+'</strong>: " . __('Uploaded successfully!', 'rmcommon') . "</span>');\n }\n return true;\n }"); $uploader->add_setting('onAllComplete', "function(event, data){\n \t\n \tif(total<=0) return;\n \t\n \$('.select_image_cat').hide('slow');\n \$('#upload-errors').hide('slow');\n \$('#upload-errors').html('');\n \$('#upload-controls').hide('slow');\n \$('#resizer-bar').show('slow');\n \$('#resizer-bar').effect('highlight',{},1000);\n \$('#gen-thumbnails').show();\n \n var increments = 1/total*100;\n url = '" . RMCURL . "/images.php';\n \n params = '" . TextCleaner::getInstance()->encrypt($xoopsUser->uid() . '|' . RMCURL . '/images.php' . '|' . $xoopsSecurity->createToken(), true) . "';\n resize_image(params);\n \n }"); RMTemplate::get()->add_head($uploader->render()); } RMTemplate::get()->add_style('imgmgr.css', 'rmcommon'); RMTemplate::get()->add_script('include/js/images.js'); // Load Categories $categories = RMFunctions::load_images_categories("WHERE status='open' ORDER BY id_cat DESC"); xoops_cp_header(); RMFunctions::create_toolbar(); include RMTemplate::get()->get_template('images_uploadimages.php', 'module', 'rmcommon'); xoops_cp_footer(); }
/** * @desc Formulario de archivos **/ function formFiles($edit = 0) { global $tpl, $xoopsModule, $xoopsModuleConfig, $xoopsUser, $xoopsSecurity; define("RMCSUBLOCATION", 'newfile'); $id = rmc_server_var($_GET, 'id', 0); $item = rmc_server_var($_GET, 'item', 0); //Verificamos si el software es válido if ($item <= 0) { redirectMsg('files.php', __('No download item ID has been provided!', 'dtransport'), RMMSG_WARN); } //Verificamos si existe el software $sw = new DTSoftware($item); if ($sw->isNew()) { redirectMsg('files.php', __('Specified download item does not exists!', 'dtransport'), RMMSG_ERROR); } $file_exists = true; if ($edit) { //Verificamos si archivo es válido if ($id <= 0) { redirectMsg('./files.php?item=' . $item, __('No file ID has been specified!', 'dtransport'), RMMSG_WARN); } //Verificamos si existe archivo $fl = new DTFile($id); if ($fl->isNew()) { redirectMsg('files.php?item=' . $item, __('Specified file does not exists!', 'dtransport'), RMMSG_ERROR); } if ($sw->getVar('secure')) { $dir = $xoopsModuleConfig['directory_secure']; } else { $dir = $xoopsModuleConfig['directory_insecure']; } if (!$fl->remote()) { if (!is_file($dir . '/' . $fl->file())) { $file_exists = false; showMessage(sprintf(__('File %s does not exists! You need to upload this file again.', 'dtransport'), $dir . '/' . $fl->file()), RMMSG_WARN); } } } xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » <a href='items.php'>" . $sw->getVar('name') . "</a> » <a href='files.php?item=" . $sw->id() . "'>" . __('Files', 'dtransport') . "</a> » " . ($edit ? __('Edit file', 'dtransport') : __('New file', 'dtransport'))); $tpl->assign('xoops_pagetitle', $xoopsModule->name() . " » " . $sw->getVar('name') . " » " . __('Files', 'dtransport') . " » " . ($edit ? __('Edit file', 'dtransport') : __('New file', 'dtransport'))); $db = XoopsDatabaseFactory::getDatabaseConnection(); $func = new DTFunctions(); $func->toolbar(); $rmf = RMFunctions::get(); $rmu = RMUtilities::get(); // Uploader $tc = TextCleaner::getInstance(); $uploader = new RMFlashUploader('dtfiles-uploader', DT_URL . '/ajax/upload.php'); $token = $xoopsSecurity->createToken(); $uploader->add_setting('onUploadStart', 'function(file){ $("#dtfiles-uploader").uploadify("settings", "formData", { action: "upload", item: $("#item").val(), XOOPS_TOKEN_REQUEST: $("#XOOPS_TOKEN_REQUEST").val(), data: "' . $tc->encrypt($_SERVER['HTTP_USER_AGENT'] . '|' . session_id() . '|' . $xoopsUser->uid() . '|' . $rmf->current_url()) . '" }); }'); $uploader->add_setting('multi', false); $uploader->add_setting('fileExt', '*.' . implode(";*.", $xoopsModuleConfig['type_file'])); $uploader->add_setting('fileDesc', sprintf(__('Allowed files (%s)', 'dtransport'), implode(";*.", $xoopsModuleConfig['type_file']) . ')')); $uploader->add_setting('sizeLimit', $xoopsModuleConfig['size_file'] * 1024 * 1024); $uploader->add_setting('buttonText', __('Select File...', 'rmcommon')); $uploader->add_setting('queueSizeLimit', 1); $uploader->add_setting('auto', true); $uploader->add_setting('onUploadSuccess', "function(file, resp, data){\n eval('ret = '+resp);\n if (ret.error==1){\n \$('.dt-errors').html(ret.message).slideDown('fast');\n upload_error = 1;\n } else {\n upload_error = 0;\n getFilesToken();\n \$('#dtfiles-preview .name').html(ret.file);\n \$('#dtfiles-preview .size').html(ret.size);\n \$('#size').val(ret.fullsize);\n \$('#dtfiles-preview .type').html(ret.type);\n \$('#dtfiles-preview .secure').html(ret.secure);\n }\n return true;\n }"); $uploader->add_setting('onQueueComplete', "function(event, data){\n if(upload_error==1) return;\n \$('.dt-errors').slideUp('fast');\n \$('#dtfiles-uploader').fadeOut('fast');\n \$('#dtfiles-preview').fadeIn('fast');\n }"); $uploader->add_setting('onSelectOnce', "function(event, data){\n \$('#upload-errors').html('');\n }"); if ($edit && $file_exists) { $uploader->add_setting('onInit', 'function(instance){ $("#dtfiles-uploader").hide(); }'); } $groups = array(); //Lista de grupos $sql = "SELECT * FROM " . $db->prefix('dtrans_groups') . " WHERE id_soft={$item}"; $result = $db->queryF($sql); while ($rows = $db->fetchArray($result)) { $group = new DTFileGroup(); $group->assignVars($rows); $groups[] = array('id' => $group->id(), 'name' => $group->name()); } $tpl->add_head($uploader->render()); $tpl->add_style('admin.css', 'dtransport'); $tpl->add_style('files.css', 'dtransport'); $tpl->add_local_script('admin.js', 'dtransport'); $tpl->add_local_script('files.js', 'dtransport'); $tpl->add_head_script('var upload_error = 0;'); include DT_PATH . '/include/js_strings.php'; xoops_cp_header(); include $tpl->get_template("admin/dtrans_filesform.php", 'module', 'dtransport'); xoops_cp_footer(); }
RMTemplate::get()->add_local_script('images_editor.js', 'rmcommon', 'include'); if (!$cat->isNew()) { $uploader = new RMFlashUploader('files-container', 'upload.php'); $uploader->add_setting('scriptData', array('action' => 'upload', 'category' => $cat->id(), 'rmsecurity' => TextCleaner::getInstance()->encrypt($xoopsUser->uid() . '|' . RMCURL . '/images.php' . '|' . $xoopsSecurity->createToken(), true))); $uploader->add_setting('multi', true); $uploader->add_setting('fileExt', '*.jpg;*.png;*.gif'); $uploader->add_setting('fileDesc', __('All Images (*.jpg, *.png, *.gif)', 'rmcommon')); $uploader->add_setting('sizeLimit', $cat->getVar('filesize') * $cat->getVar('sizeunit')); $uploader->add_setting('buttonText', __('Browse Images...', 'rmcommon')); $uploader->add_setting('queueSizeLimit', 100); $uploader->add_setting('auto', true); $uploader->add_setting('onSelect', "function(event, qid, file){\n \tif (queuefiles[qid]) return false;\n \tqueuefiles[qid] = true;\n \treturn true;\n }"); $uploader->add_setting('onComplete', "function(event, id, file, resp, data){\n eval('ret = '+resp);\n if (ret.error){\n \$('#upload-errors').append('<span class=\"failed\"><strong>'+file.name+'</strong>: '+ret.message+'</span>');\n } else {\n total++;\n ids[total-1] = ret.id;\n \$('#upload-errors').append('<span class=\"done\"><strong>'+file.name+'</strong>: " . __('Uploaded successfully!', 'rmcommon') . "</span>');\n }\n return true;\n }"); $uploader->add_setting('onAllComplete', "function(event, data){\n if(total<=0) return;\n \$('.categories_selector').hide('slow');\n \$('#upload-errors').hide('slow');\n \$('#upload-errors').html('');\n \$('#upload-controls').hide('slow');\n \$('#resizer-bar').show('slow');\n \$('#resizer-bar').effect('highlight',{},1000);\n \$('#gen-thumbnails').show();\n \n var increments = 1/total*100;\n url = '" . RMCURL . "/images.php';\n \n params = '" . TextCleaner::getInstance()->encrypt($xoopsUser->uid() . '|' . RMCURL . '/images.php' . '|' . $xoopsSecurity->createToken(), true) . "';\n resize_image(params);\n \n }"); $uploader->add_setting('onSelectOnce', "function(event, data){\n \$('#upload-errors').html('');\n }"); RMTemplate::get()->add_head($uploader->render()); } $categories = RMFunctions::load_images_categories("WHERE status='open' ORDER BY id_cat DESC", true); RMTemplate::get()->add_style('imgmgr.css', 'rmcommon'); RMTemplate::get()->add_style('pagenav.css', 'rmcommon'); RMTemplate::get()->add_style('editor_img.css', 'rmcommon'); if ($type == 'tiny') { RMTemplate::get()->add_script(RMCURL . '/api/editors/tinymce/tiny_mce_popup.js'); } else { RMTemplate::get()->add_head('<script type="text/javascript">var exmPopup = window.parent.' . $en . ';</script>'); } RMEvents::get()->run_event('rmcommon.loading_editorimages', ''); include RMTemplate::get()->get_template('editor_image.php', 'module', 'rmcommon'); } elseif ($action == 'load-images') { $db = Database::getInstance(); if (!$xoopsSecurity->check()) {
/** * @desc Formulario de creación de muchas imágenes **/ function formBulkImages() { global $mc, $xoopsUser, $tpl, $xoopsModule, $xoopsSecurity; $page = rmc_server_var($_REQUEST, 'page', 1); $owner = rmc_server_var($_REQUEST, 'owner', 0); $uid = rmc_server_var($_REQUEST, 'uid', 0); $sort = rmc_server_var($_REQUEST, 'sort', 'created'); $mode = rmc_server_var($_REQUEST, 'mode', 1); $psets = rmc_server_var($_REQUEST, 'albums', array()); $tags = rmc_server_var($_REQUEST, 'tags', ''); $ruta = "page={$page}&owner={$owner}&sort={$sort}&mode={$mode}"; $db = Database::getInstance(); //Lista de albumes $sql = "SELECT * FROM " . $db->prefix('gs_sets') . " WHERE owner='" . ($uid ? $uid : $xoopsUser->uid()) . "' ORDER BY id_set DESC"; $result = $db->query($sql); $sets = array(); while ($rows = $db->fetchArray($result)) { $sets[] = array('id' => $rows['id_set'], 'title' => $rows['title'], 'selected' => in_array($rows['id_set'], $psets)); } $show_controls = false; if ($uid > 0 && !empty($sets)) { $show_controls = true; $uploader = new RMFlashUploader('files-container', '../include/upload.php'); $uploader->add_setting('scriptData', array('op' => 'savebulk', 'sets' => implode(',', $psets), 'uid' => $uid, 'owner' => $owner, 'sort' => $sort, 'mode' => $mode, 'page' => $page, 'tags' => $tags, 'token' => $xoopsSecurity->createToken(), 'rmsecurity' => TextCleaner::getInstance()->encrypt($xoopsUser->uid() . '|' . GS_URL . '/admin/images.php' . '|' . $xoopsSecurity->createToken(), true))); $uploader->add_setting('multi', true); $uploader->add_setting('fileExt', '*.jpg;*.png;*.gif;*.JPG'); $uploader->add_setting('fileDesc', __('All Images (*.jpg, *.png, *.gif)', 'galleries')); $uploader->add_setting('sizeLimit', $mc['size_image'] * 1024); $uploader->add_setting('buttonText', __('Browse Images...', 'galleries')); $uploader->add_setting('queueSizeLimit', 100); $uploader->add_setting('onComplete', "function(event, id, file, resp, data){\n eval('ret = '+resp);\n if (ret.error){\n \$('#upload-errors').append('<span class=\"failed\"><strong>'+file.name+'</strong>: '+ret.message+'</span>');\n } else {\n total++;\n ids[total-1] = ret.id;\n \$('#upload-errors').append('<span class=\"done\"><strong>'+file.name+'</strong>: " . __('Uploaded successfully!', 'rmcommon') . "</span>');\n }\n return true;\n }"); $uploader->add_setting('onAllComplete', "function(event, data){\n \n if(total<=0){ return; }\n \n \$('.select_image_cat').hide('slow');\n \$('#upload-errors').hide('slow');\n \$('#upload-errors').html('');\n \$('#upload-controls').hide('slow');\n \$('#resizer-bar').show('slow');\n \$('#resizer-bar').effect('highlight',{},1000);\n \$('#gen-thumbnails').show();\n \n var increments = 1/total*100;\n url = '" . GS_URL . "/include/upload.php';\n params = '" . TextCleaner::getInstance()->encrypt($xoopsUser->uid() . '|' . GS_URL . '/admin/images.php' . '|' . $xoopsSecurity->createToken(), true) . "';\n resize_image(params);\n \n }"); $uploader->add_setting('onError', 'function (event,ID,fileObj,errorObj) { alert(errorObj.type + \' Error: \' + errorObj.info); }'); RMTemplate::get()->add_head($uploader->render()); } $form = new RMForm('', 'frmImgs', 'images.php'); $ele = new RMFormUser('', 'uid', 0, $uid ? array($uid) : array($xoopsUser->uid()), 0); $users_field = $ele->render(); GSFunctions::toolbar(); xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » " . __('Create batch images', 'galleries')); RMTemplate::get()->assign('xoops_pagetitle', __('Create batch images', 'galleries')); RMTemplate::get()->add_local_script('images.js', 'galleries'); RMTemplate::get()->add_style('uploader.css', 'galleries'); xoops_cp_header(); include RMTemplate::get()->get_template("admin/gs_formimages.php", 'module', 'galleries'); xoops_cp_footer(); }