public function eventRmcommonAdditionalOptions($settings) { $settings['categories']['helium'] = __('Control Panel', 'helium'); $af_available = RMFunctions::plugin_installed('advform'); $settings['config'][] = array('name' => 'helium_logo', 'title' => __('Logo to use', 'rmcommon'), 'description' => __('You can specify a logo as bitmap but SVG is recommended. The logo will be resize to 29 pixels of height.', 'helium'), 'formtype' => $af_available ? 'image-url' : 'textbox', 'valuetype' => 'text', 'default' => RMCURL . '/themes/helium/images/logo-he.svg', 'category' => 'helium'); return $settings; }
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'); }
/** * Get blocks */ public function construct_blocks() { global $xoopsConfig, $xoopsModule, $xoopsUser, $xoopsOption; $sides = array(); foreach (self::block_positions() as $id => $row) { $sides[$id] = $row['tag']; $blocks[$row['tag']] = array(); } $startMod = $xoopsConfig['startpage'] == '--' ? 'system' : $xoopsConfig['startpage']; if (@is_object($xoopsModule)) { list($mid, $dirname) = array($xoopsModule->getVar('mid'), $xoopsModule->getVar('dirname')); $isStart = substr($_SERVER['PHP_SELF'], -9) == 'index.php' && $xoopsConfig['startpage'] == $dirname; } else { $sys = RMFunctions::load_module('system'); list($mid, $dirname) = array($sys->getVar('mid'), 'system'); $isStart = !@empty($GLOBALS['xoopsOption']['show_cblock']); } $groups = @is_object($xoopsUser) ? $xoopsUser->getGroups() : array(XOOPS_GROUP_ANONYMOUS); $subpage = isset($xoopsOption['module_subpage']) ? $xoopsOption['module_subpage'] : ''; $barray = array(); // Array of retrieved blocks $barray = self::get_blocks($groups, $mid, $isStart, XOOPS_BLOCK_VISIBLE, '', 1, $subpage); foreach ($barray as $block) { $side = $sides[$block->getVar('canvas')]; if ($content = self::buildBlock($block)) { $blocks[$side][$content['id']] = $content; } } unset($side, $sides, $content, $subpage, $barray, $groups, $startMod); return $blocks; }
function show_available_updates() { global $rmTpl, $rmEvents, $updfile, $xoopsSecurity; $rmFunc = RMFunctions::get(); $rmUtil = RMUtilities::get(); $tf = new RMTimeFormatter('', '%T% %d%, %Y% at %h%:%i%'); if (is_file($updfile)) { $updates = unserialize(base64_decode(file_get_contents($updfile))); } $rmTpl->add_style('updates.css', 'rmcommon'); $rmTpl->add_script('updates.js', 'rmcommon'); $rmTpl->add_head_script('var xoToken = "' . $xoopsSecurity->createToken() . '";'); $rmTpl->add_head_script('var langUpdated = "' . __('Item updated!', 'rmcommon') . '";'); $rmTpl->add_help(__('Updates Help', 'rmcommon'), 'http://www.xoopsmexico.net/docs/common-utilities/actualizaciones-automaticas/standalone/1/'); $ftpserver = parse_url(XOOPS_URL); $ftpserver = $ftpserver['host']; $pathinfo = parse_url(XOOPS_URL); $ftpdir = str_replace($pathinfo['scheme'] . '://' . $pathinfo['host'], '', XOOPS_URL); unset($pathinfo); RMBreadCrumb::get()->add_crumb(__('Available Updates', 'rmcommon')); $rmTpl->assign('xoops_pagetitle', __('Available Updates', 'rmcommon')); xoops_cp_header(); include $rmTpl->get_template('rmc-updates.php', 'module', 'rmcommon'); xoops_cp_footer(); }
/** * 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); }
/** * This function allows to other modules or plugins get gravatars * by passing an email address and other options */ public function eventRmcommonGetAvatar($email, $size = 0, $default = '') { $config = RMFunctions::get()->plugin_settings('avatars', true); $size = $size <= 0 ? $size = $config['size'] : $size; $default = $default == '' ? $config['default'] : $default; $avatar = "http://www.gravatar.com/avatar/" . md5($email) . "?s=" . $size . '&d=' . $default; return $avatar; }
public function check() { $config = RMFunctions::get()->plugin_settings('recaptcha', true); include_once RMCPATH . '/plugins/recaptcha/recaptchalib.php'; $privatekey = $config['private']; $resp = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); return $resp->is_valid; }
public function settings($name = '') { $settings = empty($this->settings) ? RMFunctions::get()->plugin_settings($this->get_info('dir'), true) : $this->settings; if (isset($settings[$name])) { return $settings[$name]; } return $settings; }
function dt_block_categories($options) { include_once XOOPS_ROOT_PATH . '/modules/dtransport/class/dtcategory.class.php'; $rmu = RMUtilities::get(); $rmf = RMFunctions::get(); $mc = $rmu->module_config('dtransport'); $url = $rmf->current_url(); $rpath = parse_url($url); $xpath = parse_url(XOOPS_URL); if ($mc['permalinks']) { $params = trim(str_replace($xpath['path'] . '/' . trim($mc['htbase'], '/'), '', rtrim($rpath['path'], "/")), '/'); $search = array('category', 'publisher', 'recents', 'popular', 'rated', 'updated'); if ($params == '') { $params = array(); } else { $params = explode("/", trim($params)); } if (!empty($params) && $params[0] == 'category') { $db = XoopsDatabaseFactory::getDatabaseConnection(); $params = explode("page", implode("/", array_slice($params, 1))); $path = explode("/", $params[0]); foreach ($path as $k) { if ($k == '') { continue; } $category = new DTCategory(); $sql = "SELECT * FROM " . $db->prefix("dtrans_categos") . " WHERE nameid='{$k}' AND parent='{$idp}'"; $result = $db->query($sql); if ($db->getRowsNum($result) > 0) { $row = $db->fetchArray($result); $idp = $row['id_cat']; $category->assignVars($row); } else { $dtfunc->error_404(); } } } else { $category = new DTCategory(); } } $tpl = RMTemplate::get(); $tpl->add_xoops_style('blocks.css', 'dtransport'); include_once XOOPS_ROOT_PATH . '/modules/dtransport/class/dtfunctions.class.php'; $categories = array(); $dtfunc = new DTFunctions(); $dtfunc->getCategos($categories, 0, $category->id(), array(), false, 1); $block = array(); foreach ($categories as $cat) { if ($cat['jumps'] > $options[0] - 1 && $options[0] > 0) { continue; } $block['categories'][] = $cat; } if (!$category->isNew()) { $block['parent'] = array('name' => $category->name(), 'link' => $category->permalink()); } return $block; }
private function get_html() { $config = RMFunctions::get()->plugin_settings('ayah', true); self::set_config(); require_once RMCPATH . '/plugins/ayah/include/ayah.php'; $ayah = new AYAH(); $ayah->debug_mode($config['debug']); return $ayah->getPublisherHTML(); }
public function check() { $config = RMFunctions::get()->plugin_settings('recaptcha', true); $this->set_config(); include_once RMCPATH . '/plugins/ayah/include/ayah.php'; $ayah = new AYAH(); $ayah->debug_mode($config['debug']); $resp = $ayah->scoreResult(); return $resp; }
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); if (substr($p['path'], -11) == 'backend.php') { include_once RMCPATH . '/rss.php'; die; } }
public function eventRmcommonCaptchaCheck($value) { global $xoopsUser; $config = RMFunctions::get()->plugin_settings('recaptcha', true); if ($xoopsUser && $xoopsUser->isAdmin() && !$config['show']) { return $value; } include_once RMCPATH . '/plugins/recaptcha/recaptchalib.php'; $privatekey = $config['private']; $resp = recaptcha_check_answer($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); return $resp->is_valid; }
public function eventRmcommonGetFeedsList($feeds) { load_mod_locale('galleries'); include_once XOOPS_ROOT_PATH . '/modules/galleries/class/gsfunctions.class.php'; $module = RMFunctions::load_module('galleries'); $config = RMUtilities::module_config('galleries'); $data = array('title' => $module->name(), 'url' => GSFunctions::get_url(), 'module' => 'galleries'); $options[] = array('title' => __('All Recent Pictures', 'galleries'), 'params' => 'show=pictures', 'description' => __('Show all recent pictures', 'galleries')); $options[] = array('title' => __('All Recent Albums', 'galleries'), 'params' => 'show=albums', 'description' => __('Show all recent albums', 'galleries')); $feed = array('data' => $data, 'options' => $options); $feeds[] = $feed; return $feeds; }
/** * To prevent errors when upload images with closed site */ public function eventCoreIncludeCommonLanguage() { global $xoopsConfig; if (RMFunctions::current_url() == RMCURL . '/include/upload.php' && $xoopsConfig['closesite']) { $security = rmc_server_var($_POST, 'rmsecurity', 0); $data = TextCleaner::getInstance()->decrypt($security, true); $data = explode("|", $data); // [0] = referer, [1] = session_id(), [2] = user, [3] = token $xoopsUser = new XoopsUser($data[0]); if ($xoopsUser->isAdmin()) { $xoopsConfig['closesite'] = 0; } } }
/** * @param string $caption Texto del campo * @param string $name Nombre de este campo * @param string $width Ancho del campo. Puede ser el valor en formato pixels (300px) o en porcentaje (100%) * @param string $height Alto de campo. El valor debe ser pasado en formato pixels (300px). * @param string $default Texto incial al cargar el campo. POr defecto se muestra vaco. * @param string $type Tipo de Editor. Posibles valores: FCKeditor, DHTML */ function __construct($caption, $name, $width = '100%', $height = '300px', $default = '', $type = '', $change = 1, $ele = array('op')) { $rmc_config = RMFunctions::get()->configs(); $tcleaner = TextCleaner::getInstance(); $this->setCaption($caption); $this->setName($name); $this->_width = $width; $this->_height = $height; $this->_default = isset($_REQUEST[$name]) ? $tcleaner->stripslashes($_REQUEST[$name]) : $tcleaner->stripslashes($default); $this->_type = $type == '' ? $rmc_config['editor_type'] : $type; $this->_type = strtolower($this->_type); $this->_change = $change; $this->_eles = $ele; }
function show_rm_blocks() { global $xoopsModule, $xoopsConfig, $wid_globals, $xoopsSecurity; $db = Database::getInstance(); $modules = RMFunctions::get_modules_list(1); // ** API Event ** // Allows other methods to add o modify the list of available widgets $modules = RMEvents::get()->run_event('rmcommon.blocks.modules', $modules); // Cargamos los grupos $sql = "SELECT groupid, name FROM " . $db->prefix("groups") . " ORDER BY name"; $result = $db->query($sql); $groups = array(); while ($row = $db->fetchArray($result)) { $groups[] = array('id' => $row['groupid'], 'name' => $row['name']); } // Cargamos las posiciones de bloques $bpos = RMBlocksFunctions::block_positions(); $sql = createSQL(); $result = $db->query($sql); $blocks = array(); $used_blocks = array(); while ($row = $db->fetchArray($result)) { $mod = RMFunctions::load_module($row['element']); if (!$mod) { continue; } $used_blocks[] = array('id' => $row['bid'], 'title' => $row['name'], 'module' => array('id' => $mod->mid(), 'dir' => $mod->dirname(), 'name' => $mod->name()), 'canvas' => $bpos[$row['canvas']], 'weight' => $row['weight'], 'visible' => $row['visible'], 'type' => $row['type'], 'options' => $row['edit_func'] != '' ? 1 : 0, 'description' => $row['description']); } // ** API ** // Event for manege the used widgets list $used_blocks = RMEvents::get()->run_event('rmcommon.used.blocks.list', $used_blocks); $positions = array(); foreach ($bpos as $row) { $positions[] = array('id' => $row['id_position'], 'name' => $row['name']); } $positions = RMEvents::get()->run_event('rmcommon.block.positions.list', $positions); xoops_cp_location('<a href="./">' . $xoopsModule->getVar('name') . '</a> » ' . __('Blocks', 'rmcommon')); RMTemplate::get()->add_style('blocks.css', 'rmcommon'); RMTemplate::get()->add_local_script('blocks.js', 'rmcommon', 'include'); RMTemplate::get()->add_local_script('jkmenu.js', 'rmcommon', 'include'); RMTemplate::get()->add_style('forms.css', 'rmcommon'); RMTemplate::get()->add_local_script('jquery-ui.min.js', 'rmcommon', 'include'); xoops_cp_header(); // Available Widgets $blocks = RMBlocksFunctions::get_available_list($modules); // Position $the_position = isset($_GET['pos']) ? intval($_GET['pos']) : ''; include RMTemplate::get()->get_template("rmc_blocks.php", 'module', 'rmcommon'); xoops_cp_footer(); }
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); }
public function eventRmcommonGetStyles($styles) { $rmf = RMFunctions::get(); $config = $rmf->plugin_settings('minifier', true); if (!$config['enable']) { return $styles; } $mini = array(); foreach ($styles as $id => $style) { $url = parse_url($style['url']); $info = pathinfo($url['path']); $path = str_replace($info['basename'], '', $url['path']); $identifier = sprintf("%u", crc32($path . $style['media'])); $add = !isset($mini[$identifier]) ? RMCURL . '/plugins/minifier/min/f=' . $url['path'] : $mini[$identifier]['url'] . ',' . $url['path']; $mini[$identifier] = array('url' => $add, 'type' => $style['type'], 'media' => $style['media'], 'rel' => 'stylesheet'); } return $mini; }
/** * This method is designed specially for MyWords */ public function eventMywordsViewPost($post_data, MWPost $post) { $config = RMFunctions::get()->plugin_settings('metaseo', true); if (!$config['meta']) { $metas = '<meta name="description" content="' . TextCleaner::truncate($post->content(true), $config['len']) . '" />'; $tags = array(); foreach ($post->tags() as $tag) { $tags[] = $tag['tag']; } $tags = implode(',', $tags); $metas .= '<meta name="keywords" content="' . $tags . '" />'; } else { $metas = '<meta name="description" content="' . $post->get_meta($config['meta_name'], false) . '" />'; $metas = '<meta name="description" content="' . $post->get_meta($config['meta_keys'], false) . '" />'; } RMTemplate::get()->add_head($metas); return $post_data; }
/** * @des Visualiza todas las pantallas existentes **/ function showScreens() { global $xoopsModule, $xoopsSecurity, $tpl, $functions, $xoopsModule, $xoopsModuleConfig, $xoopsUser, $xoopsConfig; define('RMCSUBLOCATION', 'screenshots'); if ($xoopsConfig['closesite']) { showMessage(__('Screenshop uploader does not work when site is closed. Before to start uploding, please change this configuration.', 'rmcommon'), RMMSG_WARN); } $db = XoopsDatabaseFactory::getDatabaseConnection(); $tc = TextCleaner::getInstance(); $item = rmc_server_var($_REQUEST, 'item', 0); if ($item <= 0) { redirectMsg('items.php', __('Download item ID not provided!', 'dtransport'), RMMSG_WARN); } $sw = new DTSoftware($item); $sql = "SELECT * FROM " . $db->prefix('dtrans_screens') . " WHERE id_soft={$item}"; $result = $db->queryF($sql); while ($rows = $db->fetchArray($result)) { $sc = new DTScreenshot(); $sc->assignVars($rows); $screens[] = array('id' => $sc->id(), 'title' => $sc->title(), 'desc' => substr($tc->clean_disabled_tags($sc->desc()), 0, 80) . "...", 'image' => XOOPS_UPLOAD_URL . '/screenshots/' . date('Y', $sc->date()) . '/' . date('m', $sc->date()) . '/ths/' . $sc->image()); } // CSS Styles $tpl->add_style('admin.css', 'dtransport'); $tpl->add_style('screens.css', 'dtransport'); $tpl->add_style('uploadify.css', 'rmcommon'); // Javascripts $tpl->add_local_script('swfobject.js', 'rmcommon', 'include'); $tpl->add_local_script('jquery.uploadify.js', 'rmcommon', 'include'); $tpl->add_local_script('screens.js', 'dtransport'); $tc = TextCleaner::getInstance(); $rmf = RMFunctions::get(); ob_start(); include DT_PATH . '/js/screenshots.js'; $script = ob_get_clean(); $tpl->add_head_script($script); $functions->toolbar(); xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » <a href='items.php'>" . __('Downloads', 'dtransport') . "</a> » " . __('Screenshots Management', 'dtransport')); $tpl->assign('xoops_pagetitle', sprintf(__("%s Screenshots", 'dtransport'), $sw->getVar('name'))); include DT_PATH . '/include/js_strings.php'; xoops_cp_header(); include $tpl->get_template('admin/dtrans_screens.php', 'module', 'dtransport'); xoops_cp_footer(); }
/** * This event check spam in comments, posts and other contents for modules * * @param array All params to check (blogurl, name, email, url, text, permalink) * @return bool */ public function eventRmcommonCheckPostSpam($params) { $config = RMFunctions::get()->plugin_settings('akismet', true); if ($config['key'] == '') { return; } extract($params); $akismet = new Akismet($blogurl, $config['key']); $akismet->setCommentAuthor($name); $akismet->setCommentAuthorEmail($email); $akismet->setCommentAuthorURL($url); $akismet->setCommentContent($text); $akismet->setPermalink($permalink); $akismet->setUserIP($_SERVER['REMOTE_ADDR']); if ($akismet->isCommentSpam()) { return false; } return true; }
/** * Get the available widgets list * * @return array */ public function get_available_list($mods = null) { $db =& Database::getInstance(); if ($mods == null || empty($mods)) { $mods = RMFunctions::get_modules_list(); } $list = array(); // Block list to return foreach ($mods as $mod) { if (!file_exists(XOOPS_ROOT_PATH . '/modules/' . $mod['dirname'] . '/xoops_version.php')) { continue; } load_mod_locale($mod['dirname']); $module = new XoopsModule(); $module->loadInfoAsVar($mod['dirname']); $list[$mod['dirname']] = array('name' => $mod['name'], 'blocks' => $module->getInfo('blocks')); } // Event generated to modify the available widgets list $list = RMEvents::get()->run_event('rmcommon.available.widgets', $list); return $list; }
function show_dashboard() { global $xoopsModule; RMFunctions::create_toolbar(); $db = Database::getInstance(); $sql = 'SELECT * FROM ' . $db->prefix('modules'); $result = $db->query($sql); $installed_mods = array(); while ($row = $db->fetchArray($result)) { $installed_mods[] = $row['dirname']; } require_once XOOPS_ROOT_PATH . "/class/xoopslists.php"; $dirlist = XoopsLists::getModulesList(); $available_mods = array(); $module_handler =& xoops_gethandler('module'); $i = 0; foreach ($dirlist as $file) { if ($i > 5) { break; } clearstatcache(); $file = trim($file); if (!in_array($file, $installed_mods)) { $module =& $module_handler->create(); if (!$module->loadInfo($file, false)) { continue; } $available_mods[] = $module; } $i++; } xoops_cp_header(); RMTemplate::get()->add_style('dashboard.css', 'rmcommon'); RMTemplate::get()->add_script(RMCURL . '/include/js/dashboard.js'); RMTemplate::get()->add_style('pagenav.css', 'rmcommon'); RMTemplate::get()->set_help('http://redmexico.com.mx/docs/common-utilities'); include RMTemplate::get()->get_template('rmc_dashboard.php', 'module', 'rmcommon'); xoops_cp_footer(); }
/** * @desc Formulario para la creación de una nueva publicación **/ function formPublish() { global $xoopsModuleConfig, $xoopsUser, $xoopsTpl, $xoopsConfig; include 'header.php'; //Verificamos si existen permisos para crear un nuevo recurso if (!$xoopsModuleConfig['createres']) { redirect_header(RDFunctions::url(), 1, __('The creation of new Documents has been disabled by administrator.', 'docs')); die; } //Verificamos si usuario tiene permisos de crear nuevo recurso $res = new RDResource(); if (!RDFunctions::new_resource_allowed($xoopsUser ? $xoopsUser->getGroups() : array(XOOPS_GROUP_ANONYMOUS))) { redirect_header(RDFunctions::url(), 1, __('You can not create Documents.', 'docs')); die; } $xoopsTpl->assign('xoops_pagetitle', __('Create Document', 'docs')); $form = new RMForm(__('Create Document', 'docs'), 'frmres', RMFunctions::current_url()); $form->setExtra("enctype='multipart/form-data'"); $form->addElement(new RMFormText(__('Document title', 'docs'), 'title', 50, 150), true); $form->addElement(new RMFormTextArea(__('Description', 'docs'), 'desc', 5, 50), true); //editores de la publicación $form->addElement(new RMFormUser(__('Editors', 'docs'), 'editors', 1, $xoopsUser ? array($xoopsUser->uid()) : array(), 30)); //Grupos con permiso de acceso $form->addElement(new RMFormGroups(__('Groups that can read Document', 'docs'), 'groups', 1, 1, 1, array(1, 2)), true); $form->addElement(new RMFormYesno(__('Quick index', 'docs'), 'quick')); $form->addElement(new RMFormYesno(__('Show index to restricted users', 'docs'), 'showindex')); $form->addElement(new RMFormYesno(__('Show content in a single page', 'docs'), 'single')); $form->addElement(new RMFormLabel(__('Approved', 'docs'), $xoopsModuleConfig['approved'] ? __('Inmediatly', 'docs') : __('Wait for approval', 'docs'))); $buttons = new RMFormButtonGroup(); $buttons->addButton('sbt', __('Publish Document'), 'submit'); $buttons->addButton('cancel', _CANCEL, 'button', 'onclick="history.go(-1);"'); $form->addElement($buttons); $form->addElement(new RMFormHidden('action', 'save')); $form->display(); RMTemplate::get()->add_style('forms.css', 'docs'); include 'footer.php'; }
/** * Shows existing groups */ function show_groups_list() { global $xoopsDB; define('RMCSUBLOCATION', 'allgroups'); list($total) = $xoopsDB->fetchRow($xoopsDB->query("SELECT COUNT(*) FROM " . $xoopsDB->prefix("groups_users_link"))); $navigation = new RMPageNav($total, 20, RMHttpRequest::get('page', 'integer', 1)); $navigation->target_url(RMCURL . '/users.php?action=groups&page={PAGE_NUM}'); $sql = "SELECT g.*, (SELECT COUNT(*) FROM " . $xoopsDB->prefix("groups_users_link") . "\n WHERE groupid = g.groupid) as total_users FROM " . $xoopsDB->prefix("groups") . " as g ORDER BY g.name\n LIMIT " . $navigation->start() . ", 20"; $result = $xoopsDB->query($sql); $groups = array(); while ($row = $xoopsDB->fetchArray($result)) { $groups[] = (object) $row; } $bc = RMBreadCrumb::get(); $bc->add_crumb(__('Users Management', 'rmcommon'), RMCURL . '/users.php'); $bc->add_crumb(__('Groups', 'rmcommon')); RMTemplate::get()->assign('xoops_pagetitle', __('Groups Management', 'rmcommon')); RMFunctions::get()->create_toolbar(); RMTemplate::get()->add_script('cu-groups.js', 'rmcommon', array('footer' => 1)); include RMCPATH . '/js/cu-js-language.php'; RMTemplate::get()->header(); include RMTemplate::get()->get_template('rmc-groups.php', 'module', 'rmcommon'); RMTemplate::get()->footer(); }
public function render() { $script = "<script type='text/javascript'>\n"; $script .= "var lburl = '" . RMCURL . "/plugins/lightbox';\n"; $config = RMFunctions::get()->plugin_settings('lightbox', true); $params = "{"; $params .= "transition:'{$config['transition']}'"; $params .= ",speed:{$config['speed']}"; $params .= $config['width'] != '' ? ",maxWidth:'{$config['width']}'" : ''; $params .= $config['height'] != '' ? ",maxHeight:'{$config['height']}'" : ''; $params .= ",scalePhotos:{$config['scale']}"; $params .= ",loop:" . ($config['loop'] ? 'true' : 'false'); if ($config['slideshow']) { $params .= ",slideshow:true"; $params .= ",slideshowSpeed:" . $config['slspeed']; $params .= ",slideshowStart:'" . __('Start Slideshow', 'lightbox') . "'"; $params .= ",slideshowStop:'" . __('Stop Slideshow', 'lightbox') . "'"; } $params .= $config['configs'] != '' ? ",{$config['configs']}" : ''; $params .= "}"; $script .= "var lb_params = " . $params . ";\n"; if (!defined('RM_LB_PARAMS')) { define('RM_LB_PARAMS', 1); } $script .= "\$(function(){\n"; if (is_array($this->elements)) { foreach ($this->elements as $element) { $script .= "\$(\"{$element}\").colorbox(lb_params);\n"; } } else { $script .= "\$(\"{$this->elements}\").colorbox(lb_params);\n"; } $script .= "});\n</script>\n"; RMTemplate::get()->add_local_script('jquery.colorbox-min.js', 'rmcommon', 'plugins/lightbox'); return $script; }
function cache_delete_expired() { global $xoopsSecurity; if (!$xoopsSecurity->check()) { redirectMsg('plugins.php?p=booster&action=view', __('Session token expired!', 'booster'), 1); die; } $plugin = RMFunctions::get()->load_plugin('booster'); $items = XoopsLists::getFileListAsArray(XOOPS_CACHE_PATH . '/booster/files'); $files = array(); foreach ($items as $file) { $tmp = explode('.', $file); if ($tmp[1] != 'meta') { continue; } $content = json_decode(file_get_contents(XOOPS_CACHE_PATH . '/booster/files/' . $file), true); if (time() - $content['created'] >= $plugin->get_config('time')) { @unlink(XOOPS_CACHE_PATH . '/booster/files/' . $file); @unlink(XOOPS_CACHE_PATH . '/booster/files/' . $tmp[0] . '.html'); } } redirectMsg('plugins.php?p=booster&action=view', __('Expired pages deleted successfully', 'boost'), 0); die; }
/** * Elimina un artículo de la base de datos */ function deletePost() { global $xoopsSecurity; $posts = rmc_server_var($_POST, 'posts', array()); if (empty($posts)) { redirectMsg('posts.php', __('Select one post at least!', 'mywords'), 1); die; } if (!$xoopsSecurity->check()) { redirectMsg('posts.php', __('Session token expired!', 'mywords'), 1); die; } $db = XoopsDatabaseFactory::getDatabaseConnection(); $sql = "SELECT * FROM " . $db->prefix("mod_mywords_posts") . " WHERE id_post IN (" . implode(",", $posts) . ")"; $result = $db->query($sql); while ($row = $db->fetchArray($result)) { $post = new MWPost(); $post->assignVars($row); if (!$post->delete()) { showMessage(sprintf(__('Errors ocurred while deleting "%s"', 'mw_categories'), $post->getVar('title')), 1); } RMFunctions::delete_comments('mywords', urlencode('post=' . $post->id())); } redirectMsg('posts.php', __('Database updated!', 'mw_categories'), 0); }