function show_rss_content() { global $xoopsConfig; include_once $GLOBALS['xoops']->path('class/template.php'); $tpl = new XoopsTpl(); $module = rmc_server_var($_GET, 'mod', ''); if ($module == '') { redirect_header('backend.php', 1, __('Choose an option to see its feed', 'rmcommon')); die; } if (!file_exists(XOOPS_ROOT_PATH . '/modules/' . $module . '/rss.php')) { redirect_header('backend.php', 1, __('This module does not support rss feeds', 'rmcommon')); die; } $GLOBALS['xoopsLogger']->activated = false; if (function_exists('mb_http_output')) { mb_http_output('pass'); } header('Content-Type:text/xml; charset=utf-8'); include XOOPS_ROOT_PATH . '/modules/' . $module . '/rss.php'; if (!isset($rss_channel['image'])) { $rmc_config = RMFunctions::configs(); $rss_channel['image']['url'] = $rmc_config['rssimage']; $dimention = getimagesize(XOOPS_ROOT_PATH . '/images/logo.png'); $rss_channel['image']['width'] = $dimention[0] > 144 ? 144 : $dimention[0]; $rss_channel['image']['height'] = $dimention[1] > 400 ? 400 : $dimention[1]; } include RMTemplate::get()->get_template('rmc_rss.php', 'module', 'rmcommon'); }
function get_modules_ajax() { XoopsLogger::getInstance()->activated = false; XoopsLogger::getInstance()->renderingEnabled = false; $db = Database::getInstance(); $sql = "SELECT COUNT(*) FROM " . $db->prefix("modules"); $page = rmc_server_var($_POST, 'page', 1); $limit = RMFunctions::configs('mods_number'); list($num) = $db->fetchRow($db->query($sql)); $tpages = ceil($num / $limit); $page = $page > $tpages ? $tpages : $page; $start = $num <= 0 ? 0 : ($page - 1) * $limit; $nav = new RMPageNav($num, $limit, $page, 5); $nav->target_url('javascript:;" onclick="get_mods_page({PAGE_NUM})'); $sql = 'SELECT * FROM ' . $db->prefix('modules') . " ORDER BY mid, weight LIMIT {$start},{$limit}"; $result = $db->query($sql); $installed_mods = array(); while ($row = $db->fetchArray($result)) { $mod = new XoopsModule(); $mod->assignVars($row); $installed_mods[] = $mod; } include RMTemplate::get()->get_template('rmc_mods_installed.php', 'module', 'rmcommon'); die; }
/** * Class constructor. * Load all data from configurations and generate the initial clases * to manage the email * * @param string Content type for message body. It usually text/plain or text/html. * Default is 'text/plain' but can be changed later */ public function __construct($content_type = 'text/plain') { $config = RMFunctions::configs(); $config_handler =& xoops_gethandler('config'); $xconfig = $config_handler->getConfigsByCat(XOOPS_CONF_MAILER); // Instantiate the Swit Transport according to our preferences // We can change this preferences later switch ($config['transport']) { case 'mail': $this->swTransport = Swift_MailTransport::newInstance(); break; case 'smtp': $this->swTransport = Swift_SmtpTransport::newInstance($config['smtp_server'], $config['smtp_port'], $config['smtp_crypt'] != 'none' ? $config['smtp_crypt'] : ''); $this->swTransport->setUsername($config['smtp_user']); $this->swTransport->setPassword($config['smtp_pass']); break; case 'sendmail': $this->swTransport = Swift_SendmailTransport::newInstance($config['sendmail_path']); break; } // Create the message object // Also this object could be change later with message() method $this->swMessage = Swift_Message::newInstance(); $this->swMessage->setReplyTo($xconfig['from']); $this->swMessage->setFrom(array($xconfig['from'] => $xconfig['fromname'])); $this->swMessage->setContentType($content_type); }
public function eventRmcommonXoopsCommonEnd() { global $xoopsConfig; // Get preloaders from current theme RMEvents::get()->load_extra_preloads(XOOPS_THEME_PATH . '/' . $xoopsConfig['theme_set'], ucfirst($xoopsConfig['theme_set'] . 'Theme')); $url = RMFunctions::current_url(); $p = parse_url($url); $config = RMFunctions::configs(); if (substr($p['path'], -11) == 'backend.php' && $config['rss_enable']) { include_once RMCPATH . '/rss.php'; die; } }
public function eventCoreHeaderEnd() { /** * Use internal blocks manager if enabled */ $config = RMFunctions::configs(); if ($config['blocks_enable']) { global $xoopsTpl; $bks = RMBlocksFunctions::construct_blocks(); $bks = RMEvents::get()->run_event('rmcommon.retrieve.xoops.blocks', $bks); $b =& $xoopsTpl->get_template_vars('xoBlocks'); $blocks = array_merge($b, $bks); $xoopsTpl->assign_by_ref('xoBlocks', $blocks); unset($b, $bks); } }
function rd_show_page() { RMTemplate::get()->assign('xoops_pagetitle', __('Home Page', 'docs')); xoops_cp_header(); include_once RMCPATH . '/class/form.class.php'; $content = @file_get_contents(XOOPS_CACHE_PATH . '/rd_homepage.html'); $content = TextCleaner::getInstance()->to_display($content); $editor = new RMFormEditor('', 'homepage', '100%', '450px', $content); $rmc_config = RMFunctions::configs(); if ($rmc_config['editor_type'] == 'tiny') { $tiny = TinyEditor::getInstance(); $tiny->add_config('theme_advanced_buttons1', 'res_index'); } include RMEvents::get()->run_event('docs.get.homepage.template', RMTemplate::get()->get_template('admin/rd_homepage.php', 'module', 'docs')); xoops_cp_footer(); }
public function eventCoreClassTheme_blocksRetrieveBlocks($params) { // xos_logos_PageBuilder $xpb = $params[0]; // Template $tpl = $params[1]; // Blocks $blocks =& $params[2]; /** * Use internal blocks manager if enabled */ $config = RMFunctions::configs(); if ($config['blocks_enable']) { $blocks = array(); } RMEvents::get()->run_event('rmcommon.retrieve.blocks', $blocks, $xpb, $tpl); }
/** * @desc Formulario de creación y edición de sección **/ function rd_show_form($edit = 0) { global $xoopsModule, $xoopsConfig, $xoopsSecurity, $xoopsUser, $xoopsModuleConfig, $rmc_config; define('RMCSUBLOCATION', 'newresource'); $id = rmc_server_var($_GET, 'id', 0); $parent = rmc_server_var($_GET, 'parent', 0); if ($id <= 0) { redirectMsg('sections.php?id=' . $id, __('You must select a Document in order to create a new section', 'docs'), 1); die; } // Check if provided Document exists global $res; $res = new RDResource($id); if ($res->isNew()) { redirectMsg('sections.php?id=' . $id, __('Specified Document does not exists!', 'docs'), 1); die; } if ($edit) { $id_sec = rmc_server_var($_GET, 'sec', 0); //Verifica si la sección es válida if ($id_sec <= 0) { redirectMsg('sections.php?id=' . $id, __('Specify a section to edit', 'docs'), 1); die; } //Comprueba si la sección es existente $sec = new RDSection($id_sec); if ($sec->isNew()) { redirectMsg('sections.php?id=' . $id, __('Specified section does not exists', 'docs'), 1); die; } } // Get order $order = RDFunctions::order('MAX', $parent, $res->id()); $order++; $rmc_config = RMFunctions::configs(); $form = new RMForm('', 'frmsec', 'sections.php'); if ($rmc_config['editor_type'] == 'tiny') { $tiny = TinyEditor::getInstance(); $tiny->add_config('theme_advanced_buttons1', 'rd_refs'); $tiny->add_config('theme_advanced_buttons1', 'rd_figures'); $tiny->add_config('theme_advanced_buttons1', 'rd_toc'); } $editor = new RMFormEditor('', 'content', '100%', '300px', $edit ? $rmc_config['editor_type'] == 'tiny' ? $sec->getVar('content') : $sec->getVar('content', 'e') : '', '', 0); $usrfield = new RMFormUser('', 'uid', false, $edit ? array($sec->getVar('uid')) : $xoopsUser->getVar('uid')); RMTemplate::get()->add_style('admin.css', 'docs'); RMTemplate::get()->add_script('../include/js/scripts.php?file=metas.js'); RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.validate.min.js'); RMTemplate::get()->add_head('<script type="text/javascript">var docsurl = "' . XOOPS_URL . '/modules/docs";</script>'); RDFunctions::toolbar(); xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » " . ($edit ? __('Edit Section', 'docs') : __('Create Section', 'docs'))); RMTemplate::get()->assign('xoops_pagetitle', $edit ? __('Edit Section', 'docs') : __('Create Section', 'docs')); xoops_cp_header(); $sections = array(); RDFunctions::getSectionTree($sections, 0, 0, $id, 'id_sec, title', isset($sec) ? $sec->id() : 0); include RMEvents::get()->run_event('docs.get.secform.template', RMTemplate::get()->get_template('admin/rd_sections_form.php', 'module', 'docs')); xoops_cp_footer(); }
/** * Get a list of existing igures according to given parameters */ function figures_list() { global $rmc_config; $id = rmc_server_var($_REQUEST, 'id', 0); $container = rmc_server_var($_GET, 'container', ''); $rmc_config = RMFunctions::configs(); $db = XoopsDatabaseFactory::getDatabaseConnection(); //Navegador de páginas $sql = "SELECT COUNT(*) FROM " . $db->prefix('rd_figures') . " WHERE id_res='{$id}'"; $sql1 = ''; if ($search) { //Separamos la frase en palabras para realizar la búsqueda $words = explode(" ", $search); foreach ($words as $k) { //Verificamos el tamaño de la palabra if (strlen($k) <= 2) { continue; } $sql1 .= ($sql1 == '' ? ' AND ' : " OR ") . " desc LIKE '%{$k}%' "; } } list($num) = $db->fetchRow($db->queryF($sql . $sql1)); $page = rmc_server_var($_GET, 'page', 1); $page = $page <= 0 ? 1 : $page; $limit = rmc_server_var($_GET, 'limit', 5); $tpages = ceil($num / $limit); $page = $page > $tpages ? $tpages : $page; $start = $num <= 0 ? 0 : ($page - 1) * $limit; $nav = new RMPageNav($num, $limit, $page, 4); $nav->target_url('javascript:;" onclick="docsAjax.getFigures(' . $id . ',6,{PAGE_NUM},\'' . $container . '\');"'); //Lista de Referencias existentes $sql = "SELECT id_fig,`desc`,content FROM " . $db->prefix('rd_figures') . " WHERE id_res='{$id}'"; $sql .= " ORDER BY id_fig DESC LIMIT {$start},{$limit}"; $result = $db->query($sql); $figures = array(); while ($rows = $db->fetchArray($result)) { $figures[] = array('id' => $rows['id_fig'], 'desc' => $rows['desc'], 'content' => TextCleaner::getInstance()->truncate($rows['content'], 150)); } include RMTemplate::get()->get_template('ajax/rd_figures_list.php', 'module', 'docs'); die; }
/** * Get all comments for given parameters * @param string Object id (can be a module name) * @param string Params for comment item * @param string Object type (eg. module, plugin, etc) * @param int Comment parent id, will return all comments under a given parent * @param int User that has been posted the comments * @return array */ public function get_comments($obj, $params, $type = 'module', $parent = 0, $user = null, $assign = true) { global $xoopsUser; define('COMMENTS_INCLUDED', 1); $db = Database::getInstance(); $rmc_config = RMFunctions::configs(); $params = urlencode($params); $sql = "SELECT * FROM " . $db->prefix("rmc_comments") . " WHERE status='approved' AND id_obj='{$obj}' AND params='{$params}' AND type='{$type}' AND parent='{$parent}'" . ($user == null ? '' : " AND user='******'") . " ORDER BY posted"; $result = $db->query($sql); $ucache = array(); $ecache = array(); while ($row = $db->fetchArray($result)) { $com = new RMComment(); $com->assignVars($row); // Editor data if (!isset($ecache[$com->getVar('user')])) { $ecache[$com->getVar('user')] = new RMCommentUser($com->getVar('user')); } $editor = $ecache[$com->getVar('user')]; if ($editor->getVar('xuid') > 0) { if (!isset($ucache[$editor->getVar('xuid')])) { $ucache[$editor->getVar('xuid')] = new XoopsUser($editor->getVar('xuid')); } $user = $ucache[$editor->getVar('xuid')]; $poster = array('id' => $user->getVar('uid'), 'name' => $user->getVar('uname'), 'email' => $user->getVar('email'), 'posts' => $user->getVar('posts'), 'avatar' => XOOPS_UPLOAD_URL . '/' . $user->getVar('user_avatar'), 'rank' => $user->rank(), 'url' => $user->getVar('url') != 'http://' ? $user->getVar('url') : ''); } else { $poster = array('id' => 0, 'name' => $editor->getVar('name'), 'email' => $editor->getVar('email'), 'posts' => 0, 'avatar' => '', 'rank' => '', 'url' => $editor->getVar('url') != 'http://' ? $editor->getVar('url') : ''); } if ($xoopsUser && $xoopsUser->isAdmin()) { $editlink = RMCURL . '/comments.php?action=edit&id=' . $com->id() . '&ret=' . urlencode(self::current_url()); } elseif ($rmc_config['allow_edit']) { $time_limit = time() - $com->getVar('posted'); if ($xoopsUser && $xoopsUser->getVar('uid') == $editor->getVar('xuid') && $time_limit < $rmc_config['edit_limit'] * 3600) { $editlink = RMCURL . '/post_comment.php?action=edit&id=' . $com->id() . '&ret=' . urlencode(self::current_url()); } else { $editlink = ''; } } $comms[] = array('id' => $row['id_com'], 'text' => TextCleaner::getInstance()->clean_disabled_tags(TextCleaner::getInstance()->popuplinks(TextCleaner::getInstance()->nofollow($com->getVar('content')))), 'poster' => $poster, 'posted' => sprintf(__('Posted on %s'), formatTimestamp($com->getVar('posted'), 'l')), 'ip' => $com->getVar('ip'), 'edit' => $editlink); unset($editor); } $comms = RMEvents::get()->run_event('rmcommon.loading.comments', $comms, $obj, $params, $type, $parent, $user); global $xoopsTpl; $xoopsTpl->assign('lang_edit', __('Edit', 'rmcommon')); if ($assign) { $xoopsTpl->assign('comments', $comms); return true; } else { return $comms; } }
/** * Visualiza todas las referencias existentes de la publicación **/ function references($edit = 0) { global $xoopsUser, $xoopsTpl, $rmc_messages, $xoopsSecurity; $id = rmc_server_var($_REQUEST, 'id', 0); $search = rmc_server_var($_REQUEST, 'search', ''); $id_ref = rmc_server_var($_REQUEST, 'ref', 0); $id_editor = rmc_server_var($_REQUEST, 'editor', 0); $rmc_config = RMFunctions::configs(); $db = XoopsDatabaseFactory::getDatabaseConnection(); $id = intval($id); //Navegador de páginas $sql = "SELECT COUNT(*) FROM " . $db->prefix('rd_references') . " WHERE id_res='{$id}'"; $sql1 = ''; if ($search) { //Separamos la frase en palabras para realizar la búsqueda $words = explode(" ", $search); foreach ($words as $k) { //Verificamos el tamaño de la palabra if (strlen($k) <= 2) { continue; } $sql1 .= ($sql1 == '' ? ' AND ' : " OR ") . " title LIKE '%{$k}%' "; } } list($num) = $db->fetchRow($db->queryF($sql . $sql1)); $page = rmc_server_var($_REQUEST, 'page', 1); $page = $page <= 0 ? 1 : $page; $limit = 13; $tpages = ceil($num / $limit); $page = $page > $tpages ? $tpages : $page; $start = $num <= 0 ? 0 : ($page - 1) * $limit; $nav = new RMPageNav($num, $limit, $page, 4); $nav->target_url("?id={$id}&page={PAGE_NUM}&search={$search}"); $ruta = '?id=' . $id . '&page=' . $page . '&search=' . $search; //Lista de Referencias existentes $sql = "SELECT id_ref,title,text FROM " . $db->prefix('rd_references') . " WHERE id_res='{$id}'"; $sql1 = ''; if ($search) { //Separamos la frase en palabras para realizar la búsqueda $words = explode(" ", $search); foreach ($words as $k) { //Verificamos el tamaño de la palabra if (strlen($k) <= 2) { continue; } $sql1 .= ($sql1 == '' ? ' AND ' : " OR ") . " title LIKE '%{$k}%' "; } } $sql2 = " ORDER BY id_ref DESC LIMIT {$start},{$limit}"; $result = $db->queryF($sql . $sql1 . $sql2); $references = array(); while ($rows = $db->fetchArray($result)) { $references[] = array('id' => $rows['id_ref'], 'title' => $rows['title'], 'content' => TextCleaner::getInstance()->truncate($rows['text'], 150)); } if ($edit) { if ($id_ref <= 0) { redirectMsg('./references.php' . $ruta, __('A note has not been specified!', 'docs'), 1); die; } $ref = new RDReference($id_ref); if ($ref->isNew()) { redirectMsg('./references.php' . $ruta, __('Specified note does not exists!', 'docs'), 1); die; } } $theme_css = xoops_getcss(); $vars = $xoopsTpl->get_template_vars(); extract($vars); RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.min.js'); RMTemplate::get()->add_script(RMCURL . '/include/js/jquery-ui.min.js'); RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.checkboxes.js'); RMTemplate::get()->add_script('include/js/scripts.php?file=ajax.js'); RMTemplate::get()->add_script('include/js/references.js'); RMTemplate::get()->add_script('include/js/editor-' . $rmc_config['editor_type'] . '.js'); if ($rmc_config['editor_type'] == 'tiny') { RMTemplate::get()->add_script(XOOPS_URL . '/modules/rmcommon/api/editors/tinymce/tiny_mce_popup.js'); } elseif ($rmc_config['editor_type'] == 'xoops') { RMTemplate::get()->add_script(XOOPS_URL . '/modules/rmcommon/api/editors/exmcode/editor-popups.js'); } RMTemplate::get()->add_style('refs.css', 'docs'); RMTemplate::get()->add_style('jquery.css', 'rmcommon'); // Options for table header $options[] = array('title' => __('Select Document', 'docs'), 'href' => 'javascript:;', 'attrs' => 'id="option-resource" onclick="docsAjax.getSectionsList(1);"', 'tip' => __('Select another Document to show the notes that belong to this.', 'docs')); $options[] = array('title' => __('Create Note', 'docs'), 'href' => 'javascript:;', 'attrs' => 'id="option-new" onclick="docsAjax.displayForm();"', 'tip' => __('Create a new note.', 'docs')); // Get additional options from other modules or plugins $options = RMEvents::get()->run_event('docs.notes.options', $options, $id, $edit, $edit ? $ref : null); // Insert adtional content in template $other_content = ''; $other_content = RMEvents::get()->run_event('docs.additional.notes.content', $other_content, $id, $edit, $edit ? $ref : null); include RMTemplate::get()->get_template('rd_references.php', 'module', 'docs'); }
/** * @desc Formulario para crear nueva sección **/ function formSection($edit = 0) { global $xoopsConfig, $xoopsUser, $xoopsModuleConfig, $id, $res; $res = rmc_server_var($_GET, 'id', $res); //Verifica si se proporcionó una publicación para la sección if ($res <= 0) { RDFunctions::error_404(); } $res = new RDResource($res); if ($res->isNew()) { RDFunctions::error_404(); } //Verificamos si es una publicación aprobada if (!$res->getVar('approved')) { redirect_header(RDURL, 2, __('Specified section does not exists!', 'docs')); die; } //Verificamos si el usuario tiene permisos de edicion if (!$xoopsUser->uid() == $res->getVar('owner') && !$res->isEditor($xoopsUser->uid()) && !$xoopsUser->isAdmin()) { redirect_header($section->permalink(), 1, __('Operation not allowed!', 'docs')); die; } if ($edit) { $id = rmc_server_var($_GET, 'id', $id); //Verifica si la sección es válida if ($id == '') { RDfunctions::error_404(); } //Comprueba si la sección es existente $section = new RDSection($id); if ($section->isNew()) { RDFunctions::error_404(); } } include 'header.php'; include_once RMCPATH . '/class/form.class.php'; define('RD_NO_FIGURES', 1); $rmc_config = RMFunctions::configs(); $editor = new RMFormEditor('', 'content', '100%', '300px', $edit ? $section->getVar('content', $rmc_config['editor_type'] == 'tiny' ? 's' : 'e') : '', '', false); if ($rmc_config['editor_type'] == 'tiny') { $tiny = TinyEditor::getInstance(); $tiny->configuration['content_css'] .= ',' . XOOPS_URL . '/modules/docs/css/figures.css'; $tiny->add_config('theme_advanced_buttons1', 'rd_refs'); $tiny->add_config('theme_advanced_buttons1', 'rd_figures'); $tiny->add_config('theme_advanced_buttons1', 'rd_toc'); } // Arbol de Secciones $sections = array(); RDFunctions::sections_tree_index(0, 0, $res, '', '', false, $sections, false); // Breadcrumb RDFunctions::breadcrumb(); $res_edit = RDFunctions::url() . ($xoopsModuleConfig['permalinks'] ? '/list/' . $res->id() . '/' : '?action=list&id=' . $res->id()); RMBreadCrumb::get()->add_crumb($res->getVar('title'), $res_edit); if ($edit) { RMBreadCrumb::get()->add_crumb(sprintf(__('Editing "%s"', 'docs'), $section->getVar('title'))); } else { RMBreadCrumb::get()->add_crumb(__('Create new section', 'docs')); } RMTemplate::get()->add_jquery(true); RMTemplate::get()->add_style('forms.css', 'docs'); RMTemplate::get()->add_script(XOOPS_URL . '/modules/docs/include/js/scripts.php?file=metas.js'); include RMEvents::get()->run_event('docs.template.formsections.front', RMTemplate::get()->get_template('rd_sec.php', 'module', 'docs')); include 'footer.php'; }
<?php // $Id: post_comment.php 825 2011-12-09 00:06:11Z i.bitcero $ // -------------------------------------------------------------- // Red México Common Utilities // A framework for Red México Modules // Author: Eduardo Cortés <*****@*****.**> // Email: i.bitcero@gmail.com // License: GPL 2.0 // -------------------------------------------------------------- include '../../mainfile.php'; $action = rmc_server_var($_REQUEST, 'action', ''); /** * This file handle comments from Common Utilties */ $rmc_config = RMFunctions::configs(); if (!$rmc_config['enable_comments']) { redirect_header(rmc_server_var($_REQUEST, 'comment_url', XOOPS_URL), 1, __('Sorry, comments has been disabled by administrator', 'rmcommon')); die; } if ($action == 'save') { if (!$xoopsSecurity->checkReferer()) { redirect_header(XOOPS_URL, 2, __('You are not allowed to do this action!', 'rmcommon')); die; } // Check if user is a Registered User if (!$xoopsUser) { $name = rmc_server_var($_POST, 'comment_name', ''); $email = rmc_server_var($_POST, 'comment_email', ''); $url = rmc_server_var($_POST, 'comment_url', ''); $xuid = 0;
/** * Decrypt a string * * @param strign Text to decrypt * @param bool Apply base64_decode? default true */ public function decrypt($string, $encode64 = true) { $rmc_config = RMFunctions::configs(); $crypt = new Crypt(Crypt::MODE_HEX, $rmc_config['secretkey']); $string = $crypt->decrypt($string); return $string; }
public function footer() { global $xoopsModule, $rmc_config, $xoopsConfig, $xoopsModuleConfig; $content = ob_get_clean(); ob_start(); $rmc_config = RMFunctions::configs(); $theme = isset($rmc_config['theme']) ? $rmc_config['theme'] : 'default'; if (!file_exists(RMCPATH . '/themes/' . $theme . '/admin_gui.php')) { $theme = 'default'; } $rm_theme_url = RMCURL . '/themes/' . $theme; // Check if there are redirect messages $rmc_messages = array(); if (isset($_SESSION['rmMsg'])) { foreach ($_SESSION['rmMsg'] as $msg) { $rmc_messages[] = $msg; } unset($_SESSION['rmMsg']); } include_once RMCPATH . '/themes/' . $theme . '/admin_gui.php'; $output = ob_get_clean(); $output = RMEvents::get()->run_event('rmcommon.admin.output', $output); echo $output; }
/** * @desc Formulario de creación o edición de figuras **/ function formFigures($edit = 0) { global $xoopsConfig, $xoopsTpl, $xoopsSecurity, $rmc_messages, $xoopsModuleConfig; define('DF_LOCATION', 'form'); $id = rmc_server_var($_GET, 'id', 0); $id_fig = rmc_server_var($_GET, 'fig', 0); $page = rmc_server_var($_GET, 'page', 0); $search = rmc_server_var($_GET, 'search', 0); $ruta = 'id=' . $id . '&page=' . $page . '&search=' . $search; $resource = new RDResource($id); if ($resource->isNew()) { redirectMsg('?' . $ruta, __('A Document has not been specified!', 'docs'), 1); die; } if ($edit) { //Comprueba que la figura sea válida if ($id_fig <= 0) { redirectMsg('./figures.php?' . $ruta, __('No figure has been specified', 'docs'), 1); die; } //Comprueba si existe la figura $fig = new RDFigure($id_fig); if ($fig->isNew()) { redirectMsg('./figures.php?' . $ruta, __('Sepecified figure does not exists', 'docs'), 1); die; } } RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.min.js'); RMTemplate::get()->add_script(RMCURL . '/include/js/jquery-ui.min.js'); $form = new RMForm($edit ? '' : '', 'frmfig', 'figures.php'); $theme_css = xoops_getcss(); $vars = $xoopsTpl->get_template_vars(); extract($vars); RMTemplate::get()->add_style('refs.css', 'docs'); RMTemplate::get()->add_style('figures.css', 'docs'); RMTemplate::get()->add_style('jquery.css', 'rmcommon'); $editor = new RMFormEditor('', 'content', '100%', '200px', $edit ? $fig->getVar('content', 'e') : ''); $rmc_config = RMFunctions::configs(); include RMTemplate::get()->get_template('rd_figures.php', 'module', 'docs'); }
function configure_rm_plugin() { $name = rmc_server_var($_GET, 'plugin', ''); if ($name == '') { redirectMsg('plugins.php', __('You must specify a existing plugin', 'rmcommon'), 1); die; } $plugin = new RMPlugin($name); if ($plugin->isNew()) { redirectMsg('plugins.php', __('Specified plugin is not installed yet!', 'rmcommon'), 1); die; } if (!$plugin->getVar('status')) { redirectMsg('plugins.php', __('Specified plugin is not active!', 'rmcommon'), 1); die; } $rmc_config = RMFunctions::configs(); $settings = RMFunctions::get()->plugin_settings($name, true); $form = new RMForm(sprintf(__('%s configuration', 'rmcommon'), $plugin->getVar('name')), 'frmconfig', 'plugins.php'); $form->addElement(new RMFormHidden('plugin', $plugin->getVar('dir'))); $form->addElement(new RMFormHidden('action', 'savesettings')); foreach ($plugin->options() as $config => $option) { if (isset($settings[$config])) { $option['value'] = $settings[$config]; } if (isset($option['separator']) && !empty($option['separator'])) { $form->addElement(new RMFormSubTitle($option['separator']['title'], 1, '', $option['separator']['desc'])); continue; } switch ($option['fieldtype']) { case 'checkbox_groups': case 'group_multi': $ele = new RMFormGroups($option['caption'], 'conf_' . $config, 1, 1, 3, $option['value']); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'radio_groups': $ele = new RMFormGroups($option['caption'], 'conf_' . $config, 0, 1, 3, $option['value']); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'group': case 'select_groups': $ele = new RMFormGroups($option['caption'], 'conf_' . $config, 0, 0, 3, $option['value']); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'select_groups_multi': $ele = new RMFormGroups($option['caption'], 'conf_' . $config, 1, 0, 3, $option['value']); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'editor': if ($rmc_config['editor_type'] == 'tiny') { $tiny = TinyEditor::getInstance(); $tiny->add_config('elements', 'conf_' . $config); } $ele = new RMFormEditor($option['caption'], 'conf_' . $config, is_numeric($option['size']) ? '90%' : $option['size'], '300px', $option['value'], '', 1, array('op')); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'theme': case 'select_theme': $ele = new RMFormTheme($option['caption'], 'conf_' . $config, 0, 0, $option['value'], 3); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'theme_multi': case 'select_theme_multi': $ele = new RMFormTheme($option['caption'], 'conf_' . $config, 0, 1, $option['value'], 3); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'checkbox_theme': $ele = new RMFormTheme($option['caption'], 'conf_' . $config, 1, 1, $option['value'], 4); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'select_theme_admin': $ele = new RMFormTheme($option['caption'], 'conf_' . $config, 0, 0, $option['value'], 3, 'GUI'); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'yesno': $ele = new RMFormYesNo($option['caption'], 'conf_' . $config, $option['value']); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'email': $ele = new RMFormText($option['caption'], 'conf_' . $config, $option['size'] > 0 ? $option['size'] : 50, null, $option['value']); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele, false, 'email'); break; case 'select': $ele = new RMFormSelect($option['caption'], 'conf_' . $config); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } foreach ($option['options'] as $op => $opvalue) { $ele->addOption($opvalue, $op, $opvalue == $option['value'] ? 1 : 0); } $form->addElement($ele); break; case 'select_multi': $ele = new RMFormSelect($option['caption'], 'conf_' . $config . '[]', 1, $option['value']); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } foreach ($option['options'] as $op => $opvalue) { $ele->addOption($opvalue, $op); } $form->addElement($ele); break; case 'language': case 'select_language': $ele = new RMFormLanguageField($option['caption'], 'conf_' . $config, 0, 0, $option['value'], 3); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'select_language_multi': $ele = new RMFormLanguageField($option['caption'], 'conf_' . $config, 1, 0, $option['value'], 3); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'checkbox_language': $ele = new RMFormLanguageField($option['caption'], 'conf_' . $config, 1, 1, $option['value'], 3); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'startpage': case 'select_modules': $ele = new RMFormModules($option['caption'], 'conf_' . $config, 0, 0, $option['value'], 3); $ele->setInserted(array('--' => __('None', 'rmcommon'))); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'select_modules_multi': $ele = new RMFormModules($option['caption'], 'conf_' . $config, 1, 0, $option['value'], 3); $ele->setInserted(array('--' => __('None', 'rmcommon'))); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'checkbox_modules': $ele = new RMFormModules($option['caption'], 'conf_' . $config, 1, 1, $option['value'], 3); $ele->setInserted(array('--' => __('None', 'rmcommon'))); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'radio_modules': $ele = new RMFormModules($option['caption'], 'conf_' . $config, 0, 1, $option['value'], 3); $ele->setInserted(array('--' => __('None', 'rmcommon'))); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'timezone': case 'select_timezone': $ele = new RMFormTimeZoneField($option['caption'], 'conf_' . $config, 0, 0, $option['value'], 3); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'select_timezone_multi': $ele = new RMFormTimeZoneField($option['caption'], 'conf_' . $config, 0, 1, $option['value'], 3); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'checkbox_timezone': $ele = new RMFormTimeZoneField($option['caption'], 'conf_' . $config, 1, 1, $option['value'], 3); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'radio_timezone': $ele = new RMFormTimeZoneField($option['caption'], 'conf_' . $config, 1, 0, $option['value'], 3); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'tplset': $ele = new RMFormSelect($option['caption'], 'conf_' . $config); $tplset_handler =& exm_gethandler('tplset'); $tplsetlist =& $tplset_handler->getList(); asort($tplsetlist); foreach ($tplsetlist as $key => $name) { $ele->addOption($key, $name, $option['value'] == $key ? 1 : 0); } $form->addElement($ele); break; case 'textarea': $ele = new RMFormTextArea($option['caption'], 'conf_' . $config, 5, $option['size'] > 0 ? $option['size'] : 50, $option['valuetype'] == 'array' ? $cleaner->htmlspecialchars(implode('|', $option['value'])) : $cleaner->htmlspecialchars($option['value'])); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'module_cache': $ele = new RMFormCacheModuleField($option['caption'], 'conf_' . $config, $option['value']); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'user_select': $ele = new RMFormUser($option['caption'], 'conf_' . $config, $form->getName(), $option['value'], 'select', $limit = '300', ''); $ele->setOnPage("document.forms[0].op.value='config';"); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele); break; case 'radio': $ele = new RMFormRadio($option['caption'], 'conf_' . $config, 1); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } foreach ($option['options'] as $op => $opvalue) { $ele->addOption($op, $opvalue, $opvalue == $option['value'] ? 1 : 0); } $form->addElement($ele); break; case 'font_select': $ele = new RMFormSelect($option['caption'], 'conf_' . $config, 0, array($option['value'])); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $fonts = EXMLists::getFileListAsArray(ABSPATH . '/rmcommon/fonts/'); foreach ($fonts as $font) { $info = pathinfo(ABSPATH . '/rmcommon/fonts/' . $font); if (strtoupper($info['extension']) != 'TTF') { continue; } $ele->addOption($font, $font); } $form->addElement($ele); break; case 'select_editor': $ele = new RMFormSelect($option['caption'], 'conf_' . $config, 0, array($option['value'])); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $ele->addOption('tiny', __('Visual Editor', 'rmcommon')); $ele->addOption('code', __('EXMCode Editor', 'rmcommon')); $ele->addOption('textarea', __('Simple Editor', 'rmcommon')); $ele->addOption('html', __('HTML Editor', 'rmcommon')); $form->addElement($ele); break; case 'textbox': case 'password': default: $ele = new RMFormText($option['caption'], 'conf_' . $config, $option['size'] > 0 ? $option['size'] : 50, null, $option['valuetype'] == 'array' ? implode('|', $option['value']) : $option['value'], $option['fieldtype'] == 'password' ? 1 : 0); if ($option['desc'] != '') { $ele->setDescription($option['desc']); } $form->addElement($ele, false, $option['valuetype'] == 'int' || $option['valuetype'] == 'float' ? 'num' : ''); break; } } $ele = new RMFormButtonGroup(); $ele->addButton('', __('Save Settings', 'rmcommon'), 'submit'); $ele->addButton('', __('Cancel', 'rmcommon'), 'button', 'onclick="history.go(-1);"'); $form->addElement($ele); // Other components can add items to database $form = RMEvents::get()->run_event("rmcommon.settings.form", $form, $plugin); RMFunctions::create_toolbar(); xoops_cp_header(); $form->display(); xoops_cp_footer(); }