public function __construct() { $this->iconsProviders['rmcommon'] = RMCPATH . '/icons'; $this->noIcon = '<span class="cu-icon">' . file_get_contents(RMCPATH . '/icons/noicon.svg') . '</span>'; $this->loadProviders(); // Add javascript support $jsProviders = array(); foreach ($this->iconsProviders as $provider => $path) { $jsProviders[$provider] = \RMUris::relative_url(str_replace(XOOPS_ROOT_PATH, XOOPS_URL, $path)); } \RMTemplate::get()->add_inline_script('var iconsProviders = ' . json_encode($jsProviders) . ';', 1); }
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 = RMUris::current_url(); $p = parse_url($url); $config = RMSettings::cu_settings(); /** * This event has added in order to add custom codes in a "semantic" way, but * the codes can be added from any pertinent place */ RMEvents::get()->run_event('rmcommon.load.codes'); if (substr($p['path'], -11) == 'backend.php' && $config->rss_enable) { include_once RMCPATH . '/rss.php'; die; } }
function get_modules_list() { $db = XoopsDatabaseFactory::getDatabaseConnection(); $sql = 'SELECT * FROM ' . $db->prefix('modules') . " ORDER BY mid, weight"; $result = $db->query($sql); $installed_mods = array(); while ($row = $db->fetchArray($result)) { $mod = new XoopsModule(); $mod->assignVars($row); $module_icon = $mod->getInfo('icon48') != '' ? XOOPS_URL . '/modules/' . $mod->getVar('dirname') . '/' . $mod->getInfo('icon48') : ''; $module_logo = XOOPS_URL . '/modules/' . $mod->getVar('dirname') . '/' . $mod->getInfo('image'); if ($mod->hasconfig()) { $config_link = $mod->getInfo('rmnative') ? XOOPS_URL . '/modules/rmcommon/settings.php?action=configure&mod=' . $mod->mid() : XOOPS_URL . '/modules/system/admin.php?fct=preferences&op=showmod&mod=' . $mod->mid(); } $this_module = array('name' => $mod->getVar('name'), 'dirname' => $mod->getVar('dirname'), 'real_name' => $mod->getInfo('name'), 'version' => is_array($mod->getInfo('rmversion')) ? RMModules::format_module_version($mod->getInfo('rmversion')) : $mod->getVar('version') / 100, 'icon' => $module_icon, 'logo' => $module_logo, 'admin' => $mod->getVar('hasadmin') ? XOOPS_URL . '/modules/' . $mod->getVar('dirname') . '/' . $mod->getInfo('adminindex') : '', 'main' => RMUris::anchor($mod->getVar('dirname')), 'updated' => RMTimeFormatter::get()->format($mod->getVar('last_update'), __('%d% %T% %Y%', 'rmcommon')), 'config' => isset($config_link) ? $config_link : '', 'description' => $mod->getInfo('description')); $installed_mods[] = (object) $this_module; } return $installed_mods; }
public function menuIcon($icon, $module) { global $cuIcons; /** * We need to verify that icon have the directory prefix */ // Relative or absolute url? $matches = array(); $absolute = preg_match("/^(http:\\/\\/|https:\\/\\/|ftp:\\/\\/|\\/\\/)/m", $icon, $matches, PREG_OFFSET_CAPTURE); if ($absolute) { return $cuIcons->getIcon($icon); } // Relative image url? $imageFormats = array('.jpg', '.gif', '.png', 'jpeg'); if (in_array(substr($icon, -4), $imageFormats)) { return $cuIcons->getIcon(\RMUris::relative_url(XOOPS_URL . '/modules/' . $module . '/' . $icon)); } return $cuIcons->getIcon($icon); }
/** * Class constructor for the <form> tag. This method accept a list of attributes and parameters that * could be inserted in form. * * The attributes could be any of html form tag accepted attributes like method, action, etc. The attributes * must be passed as an associative array: * * <pre>$form = new RMActiveForm(array( * 'action' => 'http://...', * 'method' => 'post', * 'data-something' => 'something', * ... * ));</pre> * <h3>Predefined attributes</h3> * There exists a list of predefined attributes for this class. Next is a list of them: * <ul> * <li> * <strong>action</strong>. [string] Default: current URL * </li> * <li> * <strong>method</strong>. [string:get|post] Default: post * </li> * </ul> * Additionally, there exists a list of parameters that can be passed in order to add other functionality to the * form: * * <ul> * <li> * <strong>id</strong>. <em>string</em> [optional]. A string with the id used in from tag. This id must * not contain spaces or invalid chars. * </li> * <li> * <strong>submit-via</strong>. <em>string</em> [optional:ajax|normal] Default: normal. A key with * validation method type, that could be <em>ajax</em> or <em>normal</em>. * </li> * <li> * <strong>validation</strong>. <em>string</em> [optional:local|remote] Default: local. Determines if the * form data is checked locally or remotely. * </li> * </ul> * * @param array $attributes <p>Array of attributes to be generated with/in the form</p> */ public function __construct($attributes = array()) { // Default 'method' is post if (!isset($attributes['method'])) { $attributes['method'] = 'post'; } // Default 'action' is the current URL if (!isset($attributes['action'])) { $attributes['action'] = RMUris::current_url(); } // Default submission method is normal if (!isset($attributes['submit-via'])) { $attributes['submit-via'] = 'normal'; } // Default validation is in local client if (!isset($attributes['validation'])) { $attributes['validation'] = 'local'; } $this->attributes = $attributes; }
/** * Class constructor for the <form> tag. This method accept a list of attributes and parameters that * could be inserted in form. * * The attributes could be any of html form tag accepted attributes like method, action, etc. The attributes * must be passed as an associative array: * * <pre>$form = new RMActiveForm(array( * 'action' => 'http://...', * 'method' => 'post', * 'data-something' => 'something', * ... * ));</pre> * <h3>Predefined attributes</h3> * There exists a list of predefined attributes for this class. Next is a list of them: * <ul> * <li> * <strong>action</strong>. [string] Default: current URL * </li> * <li> * <strong>method</strong>. [string:get|post] Default: post * </li> * </ul> * Additionally, there exists a list of parameters that can be passed in order to add other functionality to the * form: * * <ul> * <li> * <strong>id</strong>. <em>string</em> [optional]. A string with the id used in from tag. This id must * not contain spaces or invalid chars. * </li> * <li> * <strong>submit-via</strong>. <em>string</em> [optional:ajax|normal] Default: normal. A key with * validation method type, that could be <em>ajax</em> or <em>normal</em>. * </li> * <li> * <strong>validation</strong>. <em>string</em> [optional:local|remote] Default: local. Determines if the * form data is checked locally or remotely. * </li> * </ul> * * @param array $attributes <p>Array of attributes to be generated with/in the form</p> */ public function __construct($attributes = array()) { // Default 'method' is post if (!isset($attributes['method'])) { $attributes['method'] = 'post'; } // Default 'action' is the current URL if (!isset($attributes['action'])) { $attributes['action'] = RMUris::current_url(); } // Default submission method is normal if (!isset($attributes['submit-via'])) { $attributes['submit-via'] = 'normal'; } // Default validation is in local client if (!isset($attributes['validation'])) { $attributes['validation'] = 'local'; } if (array_key_exists('model', $attributes) && is_a($attributes['model'], 'RMActiveRecord')) { $this->model = $attributes['model']; unset($attributes['model']); } $this->attributes = $attributes; }
redirect_header(BB_URL, 2, __('Specified forum does not exists!', 'bxpress')); die; } /** * Check if module is inactive */ $isModerator = $xoopsUser && ($xoopsUser->isAdmin() || $forum->isModerator($xoopsUser->uid())); if (!$forum->active && !$isModerator) { RMUris::redirect_with_message(__('This forum is closed and you don\'t have permissions to view it', 'bxpress'), BX_URL, RMMSG_WARN); } /** * Comprobamos que el usuario actual tenga permisos * de acceso al foro */ if (!$forum->isAllowed($xoopsUser ? $xoopsUser->getGroups() : array(0, XOOPS_GROUP_ANONYMOUS), BXPRESS_PERM_VIEW)) { RMUris::redirect_with_message(__('You are not allowed to view this forum!', 'bxpress'), BX_URL, RMMSG_WARN); die; } /** * Cargamos los temas */ $tbl1 = $db->prefix("mod_bxpress_topics"); $tbl2 = $db->prefix("mod_bxpress_forumtopics"); $sql = "SELECT COUNT(*) FROM {$tbl1} WHERE id_forum='" . $forum->id() . "' AND approved='1'"; list($num) = $db->fetchRow($db->queryF($sql)); $page = isset($_REQUEST['pag']) ? $_REQUEST['pag'] : ''; $limit = $xoopsModuleConfig['topicperpage'] > 0 ? $xoopsModuleConfig['topicperpage'] : 15; if ($page > 0) { $page -= 1; } $start = $page * $limit;
private function response($method) { if ($method == 'ajax') { self::prepare_ajax_response(); self::ajax_response(__('You don\'t have required rights to do this action!', 'rmcommon'), 1, 0, array('goto' => XOOPS_URL)); } else { RMUris::redirect_with_message(__('You don\'t have required rights to do this action!', 'rmcommon'), XOOPS_URL, RMMSG_WARN, 'fa fa-warning'); } }
/** * RSS Management */ public function eventCoreIncludeCommonEnd() { global $xoopsOption; if (defined('RMC_CHECK_UPDATES') && $xoopsOption['pagetype'] == 'admin') { global $xoopsSecurity, $rmTpl; $rmTpl->add_head_script('var xoToken = "' . $xoopsSecurity->createToken() . '";'); } // Process notifications $current = explode("?", RMUris::relative_url(RMUris::current_url())); if ($current[0] == '/notifications.php') { $page = RMHttpRequest::post('page', 'string', ''); if ('cu-notification-subscribe' == $page) { include RMCPATH . '/include/notifications.php'; } $page = RMHttpRequest::get('page', 'string', ''); if ('cu-notification-list' == $page) { include RMCPATH . '/include/notifications.php'; } } RMEvents::get()->run_event('rmcommon.xoops.common.end'); }
public function add_fontawesome() { global $cuSettings; if (isset($this->tpl_styles['fontawesome'])) { return true; } if ($cuSettings->cdn_fa) { $this->tpl_styles['fontawesome'] = array('url' => $cuSettings->cdn_fa_url, 'type' => 'text/css', 'footer' => 0); return true; } $this->tpl_styles['fontawesome'] = array('url' => RMUris::relative_url(RMCURL . '/css/font-awesome.min.css'), 'type' => 'text/css', 'footer' => 0); return true; }
$event = $events->event('newtopic')->parameters($forum->id())->permissions(array('users' => $forum->moderators(), 'groups' => array(XOOPS_GROUP_ADMIN))); // Notificar cuando se crea un tema if ($create) { $notifications->notify($event, array('forum' => $forum, 'topic' => $topic, 'post' => $post)); } // Notificar cuando se envía un mensaje en el foro $event = $events->event('forum-newpost')->parameters($forum->id())->permissions(array('users' => $forum->moderators(), 'groups' => array(XOOPS_GROUP_ADMIN))); if (!$create) { $notifications->notify($event, array('forum' => $forum, 'topic' => $topic, 'post' => $post)); } // Notificar cuando una respuesta es enviada en un tema $permissions = $forum->permissions(); $event = $events->event('reply')->parameters($topic->id())->permissions(array('groups' => in_array(0, $permissions['view']) ? array() : $permissions['view'])); $notifications->notify($event, array('forum' => $forum, 'topic' => $topic, 'post' => $post)); // Redirect to topic RMUris::redirect_with_message($errors == '' ? __('Your posts has been sent!', 'bxpress') : __('Message posted, however some errors ocurred while sending!', 'bxpress'), 'topic.php?pid=' . $post->id() . '#p' . $post->id(), $errors == '' ? RMMSG_SUCCESS : RMMSG_ERROR); break; default: $xoopsOption['template_main'] = "bxpress-postform.tpl"; $xoopsOption['module_subpage'] = "post"; include 'header.php'; bXFunctions::makeHeader(); $form = new RMForm($tid > 0 ? __('Reply', 'bxpress') : __('Create New Topic', 'bxpress'), 'frmTopic', 'post.php'); $form->addElement(new RMFormSubTitle(__('Write your post and send it', 'bxpress'), 1, 'even')); if (!$xoopsUser) { $form->addElement(new RMFormText(__('Your name:', 'bxpress'), 'name', 50, 255), true); $form->addElement(new RMFormText(__('Your email:', 'bxpress'), 'email', 50, 255), true, 'email'); } if ($create) { $form->addElement(new RMFormText(__('Topic subject:', 'bxpress'), 'subject', 50, 255, $tid > 0 ? $topic->title() : ''), true); }
_e('Recent Comments', 'rmcommon'); ?> </h3> </div> <div class="box-content"> <ul class="comments"> <?php foreach ($comments as $comment) { ?> <li> <p><?php echo $comment->text; ?> </p> <cite><a href="<?php echo RMUris::relative_url('/userinfo.php?uid=' . $comment->poster->id); ?> ">— <?php echo $comment->poster->name; ?> </a></cite> <time><?php echo $comment->date; ?> </time> <span><a href="<?php echo $comment->item_url; ?> "><?php _e('View', 'rmcommon'); ?>
/** * Make the JS code * @return string */ public function render_js() { $options = '{'; foreach ($this->defaults as $name => $value) { $options .= $name . ': ' . (is_string($value) ? '"' . $value . '",' : $value . ';'); } $options .= '}'; /* * Create plugins */ $plugins = '{'; foreach ($this->enabled_plugins as $id => $data) { if (is_array($data) && !empty($data)) { $plugins .= '{' == $plugins ? '' : ','; $plugins .= $id . ': {file: "' . $id . '.js", path: "' . $data['path'] . '"}'; } else { $plugins .= '{' == $plugins ? '' : ','; $plugins .= $id . ': {file: "plugin.js", path: "' . RMUris::relative_url(RMCURL . '/api/editors/markdown/plugins/' . $id) . '"}'; } } $plugins .= '}'; $script = '<script>function initMD(id){$(document).ready( function() { mdEditor.init(id, ' . $options . ',' . $plugins . '); } );} initMD("' . $this->id . '");</script>'; return $script; }
<hr> <div class="cu-notifications panel panel-default" id="notification-<?php echo $this::$index; ?> "> <div class="panel-heading"> <?php _e('Notifications', 'rmcommon'); ?> </div> <form name="frmnotifications" id="notification-form-<?php echo $this::$index; ?> " method="post" action="<?php echo RMUris::relative_url(RMUris::current_url()); ?> "> <div class="panel-body"> <?php foreach ($items as $item) { ?> <div class="checkbox"> <label> <input type="checkbox" value="<?php echo $item['params']; ?> " name="notifications[<?php echo $item['event']; ?>
/** * Save user data * * @param bool Indicates when is a edit */ function save_data($edit = false) { global $xoopsSecurity, $xoopsDB; $q = ''; // Query String foreach ($_POST as $k => $v) { ${$k} = $v; if ($k == 'XOOPS_TOKEN_REQUEST' || $k == 'sbt' || $k == 'action' || $k == 'password' || $k == 'passwordc') { continue; } $q .= $q == '' ? "{$k}=" . urlencode($v) : "&{$k}=" . urlencode($v); } if (!$xoopsSecurity->check()) { redirectMsg('users.php?action=' . ($edit ? 'edit' : 'new') . '&' . $q, __('Sorry, you don\'t have permission to add users.', 'rmcommon'), 1); die; } if ($edit) { if ($uid <= 0) { redirectMsg('users.php', __('The specified user is not valid!', 'rmcommon'), 1); die; } $user = new RMUser($uid); if ($user->isNew()) { redirectMsg('users.php', __('The specified user does not exists!', 'rmcommon'), 1); die; } } else { $user = new RMUser(); } // Check uname, password and passwordc if ($uname == '' || $email == '' || !$edit && ($password == '' || $passwordc == '')) { redirectMsg('users.php?action=' . ($edit ? 'edit' : 'new') . '&' . $q, __('Please fill all required fields and try again!', 'rmcommon'), 1); die; } // Check passwords if ($password != $passwordc) { redirectMsg('users.php?action=' . ($edit ? 'edit' : 'new') . '&' . $q, __('Passwords doesn\'t match. Please chek them.', 'rmcommon'), 1); die; } // Check if user exists $sql = "SELECT COUNT(*) FROM " . $xoopsDB->prefix("users") . " WHERE (uname = '{$uname}' OR email = '{$email}')" . ($edit ? " AND uid != " . $user->uid : ''); list($exists) = $xoopsDB->fetchRow($xoopsDB->query($sql)); if ($exists > 0) { RMUris::redirect_with_message(__('Another user with same username or email already exists!', 'rmcommon'), 'users.php?action=' . ($edit ? 'edit' : 'new') . '&' . $q, RMMSG_ERROR); } // Save user data $user->setVar('name', $name); $user->setVar('uname', $uname); $user->setVar('display_name', $display_name); $user->setVar('email', $email); if (!$edit) { $user->assignVar('user_regdate', time()); } if ($password != '') { $user->assignVar('pass', md5($password)); } $user->setVar('level', 1); $user->setVar('timezone_offset', $timezone); $user->setVar('url', $url); /** * If "All" has been selected then we need to get all * groups ID's */ if (in_array(0, $groups)) { $groups = array(); $result = $xoopsDB->query("SELECT groupid FROm " . $xoopsDB->prefix("groups")); while ($row = $xoopsDB->fetchArray($result)) { $groups[] = $row['groupid']; } unset($result); } /** * If no group has been selected, then we add user to * Anonymous group */ if (empty($groups)) { $groups = array(XOOPS_GROUP_ANONYMOUS); } $user->setGroups($groups); // Plugins and modules can save metadata. // Metadata are generated by other dynamical fields $user = RMEvents::get()->run_event('rmcommon.add.usermeta.4save', $user); if ($user->save()) { $user = RMEvents::get()->run_event($edit ? 'rmcommon.user.edited' : 'rmcommon.user.created', $user); redirectMsg('users.php', __('Database updated successfully!', 'rmcommon'), 0); } else { redirectMsg('users.php?action=' . ($edit ? 'edit' : 'new') . '&' . $q, __('The users could not be saved. Please try again!', 'rmcommon') . '<br />' . $user->errors(), 1); } }
<?php // $Id: index.php 901 2012-01-03 07:08:22Z i.bitcero $ // -------------------------------------------------------------- // MyWords // Complete Blogging System // Author: BitC3R0 <*****@*****.**> // Email: i.bitcero@gmail.com // License: GPL 2.0 // -------------------------------------------------------------- include "../../mainfile.php"; $path = parse_url(RMUris::current_url()); //$request = str_replace(XOOPS_URL, '', RMUris::current_url()); $request = rtrim($path['path'], '/') . (isset($path['query']) ? '/' . $path['query'] : ''); $request .= isset($path['anchor']) != '' ? '#' . $path['anchor'] : ''; $request = str_replace(RMUris::relative_url("/modules/mywords/"), '', $request); if ($xoopsModuleConfig['permalinks'] > 1 && $xoopsModuleConfig['basepath'] != '/' && $request != 'index.php') { $request = str_replace(rtrim($xoopsModuleConfig['basepath'], '/') . '/', '', rtrim($request, '/') . '/'); } $yesquery = false; if (substr($request, 0, 1) == '?') { $request = substr($request, 1); $yesquery = true; } if ($request == '' || $request == 'index.php') { require 'home.php'; die; } $params = explode("/", $request); if ($params[0] == 'page') { require 'home.php';
protected function logged() { global $xoopsUser; if ($xoopsUser) { return true; } RMUris::redirect_with_message(__('This area requires user login!', 'rmcommon'), XOOPS_URL . '/user.php', RMMSG_INFO); return null; }
/** * Install specified theme */ function xt_install_theme() { global $xoopsConfig, $xtFunctions, $xtAssembler; $current = $xtAssembler->theme()->getInfo('dir'); $dir = RMHttpRequest::get('dir', 'string', ''); if ($dir == '') { redirectMsg('themes.php', __('No theme has been specified!', 'xthemes'), RMMSG_ERROR); } $theme_dir = XOOPS_THEME_PATH . '/' . $dir; if (!is_file($theme_dir . '/theme.html')) { redirectMsg('themes.php', __('Specified directory does not contain a valid theme!', 'xthemes'), RMMSG_WARN); } $db = XoopsDatabaseFactory::getDatabaseConnection(); if (is_file($theme_dir . '/assemble/' . $dir . '.theme.php')) { // Install a xThemes Theme include_once $theme_dir . '/assemble/' . $dir . '.theme.php'; $class = ucfirst($dir); if (!class_exists($class)) { redirectMsg('themes.php', __('Specified theme is not a valid xThemes theme!', 'xthemes'), RMMSG_WARN); } $theme = new $class(); $theme->setVar('date', time()); if (!$theme->on_install()) { RMUris::redirect_with_message(__('Theme could not be activated!', 'xthemes') . '<br>' . implode('<br>', $theme->errors()), 'themes.php', RMMSG_ERROR); } if (!$theme->save() && $theme->isNew()) { redirectMsg('themes.php', __('Sorry, theme could not be installed!', 'xthemes') . $theme->errors(), RMMSG_ERROR); } // Notify to current theme $xtFunctions->notify_deactivation($current); // Configuration options if (!$xtFunctions->insertOptions($theme)) { redirectMsg('themes.php', __('Sorry, theme could not be installed!', 'xthemes') . $theme->errors(), RMMSG_ERROR); } // Create blocks positions if (!$xtFunctions->insertPositions($theme)) { showMessage(__('The blocks positions could not be installed.', 'xthemes'), 'themes.php', RMMSG_WARN); } } $sql = "UPDATE " . $db->prefix("config") . " SET conf_value='{$dir}' WHERE conf_modid=0 AND conf_catid=1 AND conf_name='theme_set'"; if (!$db->queryF($sql)) { redirectMsg('themes.php', __('Theme could not be activated', 'xthemes') . $db->getError(), RMMSG_ERROR); } $sql = "UPDATE " . $db->prefix("config") . " SET conf_value='" . serialize(array($dir)) . "' WHERE conf_modid=0 AND conf_catid=1 AND conf_name='theme_set_allowed'"; $db->queryF($sql); redirectMsg('themes.php', __('Theme installed and activated successfully!', 'xthemes'), RMMSG_SUCCESS); }
/** * Returns the current url * @deprecated * @return string */ public function current_url() { trigger_error(sprintf(__('Method %s is deprecated. Use %s::%s instead.', 'rmcommon'), __METHOD__, 'RMUris', 'current_url'), E_USER_DEPRECATED); return RMUris::current_url(); }
function activate_position($status) { global $xoopsSecurity, $xoopsDB; if (!$xoopsSecurity->check()) { RMUris::redirect_with_message(__('Session token is not valid!', 'rmcommon'), 'blocks.php', RMMSG_ERROR); } $ids = RMHttpRequest::post('ids', 'array', array()); if (!is_array($ids) || empty($ids)) { RMUris::redirect_with_message(__('No position id has been provided', 'rmcommon'), 'blocks.php', RMMSG_WARN); } $sql = "UPDATE " . $xoopsDB->prefix("mod_rmcommon_blocks_positions") . " SET active = " . ($status == 'active' ? 1 : 0) . "\n WHERE id_position IN (" . implode(',', $ids) . ")"; if ($xoopsDB->queryF($sql)) { RMUris::redirect_with_message(__('Database updated successully!', 'rmcommon'), 'blocks.php', RMMSG_SUCCESS); } else { RMUris::redirect_with_message(__('Errors ocurrs while trying to update data:', 'rmcommon') . $xoopsDB->error(), 'blocks.php', RMMSG_ERROR); } }
/** * Stores data for new categories */ function save_category($edit = 0) { global $xoopsDB, $xoopsModuleConfig, $xoopsModule; $q = 'images.php?action=' . ($edit ? 'editcat' : 'newcat'); foreach ($_POST as $k => $v) { if ($k == 'action' || $k == 'XOOPS_TOKEN_REQUEST') { continue; } if (is_array($v)) { $q .= '&' . RMFunctions::urlencode_array($v, $k); } else { $q .= '&' . $k . '=' . urlencode($v); } } extract($_POST); if ($edit) { if ($id <= 0) { redirectMsg('images.php?action=showcats', __('Specify a valid category id', 'rmcommon'), 1); die; } $cat = new RMImageCategory($id); if ($cat->isNew()) { redirectMsg('images.php?action=showcats', __('Specified category does not exists!', 'rmcommon'), 1); die; } } else { $cat = new RMImageCategory(); } if ($name == '') { redirectMsg($q, __('Please specify a category name', 'rmcommon'), 1); die; } if (empty($read)) { $read = array(0); } if (empty($write)) { $write = array(0); } // Check if resize data is correct $schecked = array(); foreach ($sizes as $size) { if (trim($size['name']) == '') { continue; } if ($size['type'] != 'none' && $size['width'] <= 0 && $size['height'] <= 0) { continue; } $schecked[] = $size; } if (empty($schecked)) { redirectMsg($q, __('You must create one size for this category at least!', 'rmcommon'), 1); die; } // Check if there are a category with same name $num = RMFunctions::get_num_records('mod_rmcommon_images_categories', "name='{$name}'" . ($edit ? " AND id_cat<>'" . $cat->id() . "'" : '')); if ($num > 0) { redirectMsg($q, __('There is already a category with the same name!', 'rmcommon'), 1); die; } $cat->setVar('name', $name); $cat->setVar('status', $status); $cat->setVar('groups', array('write' => $write, 'read' => $read)); $cat->setVar('sizes', $schecked); $cat->setVar('filesize', $filesize <= 0 ? '50' : $filesize); $cat->setVar('sizeunit', $sizeunit <= 0 ? '1024' : $sizeunit); if ($cat->save()) { RMUris::redirect_with_message(__($edit ? 'Category updated successfully!' : 'Category saved successfully!', 'rmcommon'), 'images.php?action=showcats', RMMSG_SUCCESS); } else { RMUris::redirect_with_message(__('There were some erros while trying to save this category.', 'rmcommon') . '<br />' . $cat->errors(), $q, RMMSG_ERROR); } }
/** * @deprecated * @param string $url Pgina en la que se mostrar el error * @param string $msg Mensaje de Error * @param int $level Indicates the level of the message (error, info, warn, etc.) You can use the constants RMMSG_INFO, RMMSG_WARN... or you can specify your own level number * @param string $icon URL for an icon to show in message. This value is used by templates. */ function redirectMsg($url, $msg = '', $level = 5, $icon = '') { RMUris::redirect_with_message($msg, $url, $level, $icon); }
<?php // $Id: submit.php 824 2011-12-08 23:50:30Z i.bitcero $ // -------------------------------------------------------------- // MyWords // Blogging System // Author: Eduardo Cortés <*****@*****.**> // Email: i.bitcero@gmail.com // License: GPL 2.0 // -------------------------------------------------------------- require '../../mainfile.php'; global $xoopsUser, $xoopsOption, $xoopsModuleConfig, $xoopsConfig, $rmTpl, $xoopsSecurity; if (!$xoopsModuleConfig['submit']) { RMUris::redirect_with_message(__('Posts submission is currently disabled', 'mywords'), XOOPS_URL, RMMSG_INFO); } if (!$xoopsUser) { redirect_header(MWFunctions::get_url(), 1, __('You are not allowed to do this action!', 'mywords')); die; } // Check if user is a editor $author = new MWEditor(); if (!$author->from_user($xoopsUser->uid()) && !$xoopsUser->isAdmin()) { redirect_header(MWFunctions::get_url(), 1, __('You are not allowed to do this action!', 'mywords')); die; } RMTemplate::get()->add_jquery(); $edit = isset($edit) ? $edit : 0; if ($edit > 0) { $id = $edit; if ($id <= 0) { redirect_header(MWFunctions::get_url(), __('Please, specify a valid post ID', 'mywords'), 1);
$xoopsMailer->setToGroups($group); $xoopsMailer->setFromEmail($mailConfig['from']); $xoopsMailer->setFromName($mailConfig['fromname']); $xoopsMailer->setSubject(sprintf(__('New comment sent in %s', 'rmcommon'), $xoopsConfig['sitename'])); if (isset($controller)) { $item = array('name' => $controller->get_item($params, $comment), 'url' => $uri); } else { $item = array('name' => $xoopsConfig['sitename'], 'url' => $uri); } ob_start(); include RMTemplate::get()->get_template('mail/rmc-comment-notify.php'); $body = ob_get_clean(); $xoopsMailer->setBody($body); $xoopsMailer->send(); } RMUris::redirect_with_message(__('Comment posted successfully!', 'rmcommon'), $uri . '#comment-' . $comment->id(), RMMSG_SUCCESS); } elseif ($action == 'edit') { if (rmc_server_var($_GET, 'ret', '') == '') { redirect_header(XOOPS_URL, 2, __('Invalid operation', 'rmcommon')); die; } // Check if user is allowed to edit this comment if (!$xoopsUser) { redirect_header(rmc_server_var($_REQUEST, 'comment_url', XOOPS_URL), 1, __('You are not allowed to edit this comment!', 'rmcommon')); die; } $id = rmc_server_var($_GET, 'id', 0); if ($id <= 0) { redirect_header(rmc_server_var($_REQUEST, 'ret', XOOPS_URL), 1, __('Please specify a comment', 'rmcommon')); die; }
$response->prepare_ajax_response(); $result = RMNotifications::get()->subscribe(); if (FALSE === $result) { $response->ajax_response(__('Sorry, your request could not be processed.', 'rmcommon'), 1, 0); } $message = 'subscribed' == $result->status ? __('Subscribed', 'rmcommon') : __('Subscription cancelled', 'rmcommon'); $response->ajax_response($message, 0, 0, $event); } elseif ('cu-notification-list' == $page) { // Show subscriptions list global $xoopsUser, $cuSettings; if (!$xoopsUser) { RMUris::redirect_with_message(__('You need to register/login to view this page.', 'rmcommon'), XOOPS_URL, RMMSG_WARN); } $subscriptions = RMNotifications::get()->subscriptions(); if (empty($subscriptions)) { RMUris::redirect_with_message(__('You are not subscribed to any notification event.', 'rmcommon'), XOOPS_URL, RMMSG_WARN); } $elements = array(); $items = array(); $tf = new RMTimeFormatter(0, __('%M% %d%, %Y%', 'rmcommon')); $crypt = new Crypt(null, $cuSettings->secretkey); foreach ($subscriptions as $item) { $class = ucfirst($item->element . '_Notifications'); if (!class_exists($class)) { // Include controller file if ('plugin' == $event->type) { $file = XOOPS_ROOT_PATH . '/modules/rmcommon/plugins/' . $item->element . '/class/' . strtolower($item->element) . '.notifications.class.php'; } elseif ('theme' == $event->type) { $file = XOOPS_ROOT_PATH . '/themes/' . $item->element . '/class/' . strtolower($item->element) . '.notifications.class.php'; } else { $file = XOOPS_ROOT_PATH . '/modules/' . $item->element . '/class/' . strtolower($item->element) . '.notifications.class.php';
<h4 class="menu-heading modules-menu-head"> <a href="#menu-modules"><?php _e('Modules', 'rmcommon'); ?> </a> </h4> <?php if (!empty($activeModules)) { ?> <ul id="menu-modules"> <?php foreach ($activeModules as $module) { ?> <li> <a href="<?php echo RMUris::anchor($module->directory); ?> "<?php if (!empty($module->menu)) { ?> data-submenu="yes"<?php } ?> > <?php echo $xoFunc->menuIcon($module->icon, $module->directory); ?> <?php echo $module->name; ?> <?php
/** * @desc Almacena los camobios realizados en el orden de las categorías **/ function updateOrderCatego() { global $xoopsSecurity; $orders = isset($_POST['orders']) ? $_POST['orders'] : array(); if (!$xoopsSecurity->check()) { RMUris::redirect_with_message(__('Token session expired. Try again.', 'bxpress'), 'categories.php', RMMSG_ERROR); } $errors = ''; foreach ($orders as $k => $v) { //Verificamos que la categoría sea válida if ($k <= 0) { $errors .= sprintf(__('Category ID is not valid: %s', 'bxpress'), $k); continue; } //Verificamos que categoría exista $cat = new bXCategory($k); if ($cat->isNew()) { $errors .= sprintf(__('Category with ID %u does not exists.', 'bxpress'), $k); continue; } //Actualizamos el orden $cat->setOrder($v); if (!$cat->save()) { $errors .= sprintf(__('Category %s could not be saved.', 'bxpress'), $k); } } if ($errors != '') { RMUris::redirect_with_message(__('Errors ocurred while trying to update categories order', 'bxpress') . $errors, './categories.php', RMMSG_ERROR); } else { RMUris::redirect_with_message(__('Database updated successfully!', 'bxpress'), './categories.php', RMMSG_SUCCESS); } }
?> XOOPS.org </a> </li> <li> <a href="http://www.xoopsmexico.net" target="_blank"> <?php echo $cuIcons->getIcon('svg-rmcommon-xoopsmexico'); ?> XOOPSMexico.net </a> </li> <li class="divider"></li> <li> <a href="<?php echo RMUris::relative_url(XOOPS_URL . '/user.php?op=logout'); ?> "> <?php echo $cuIcons->getIcon('svg-rmcommon-power-off text-danger'); ?> <?php _e('Close Session', 'helium'); ?> </a> </li> </ul> </li> <?php if (!empty($helpLinks)) {
</div> <!--// Categories --> <div class="cu-content-footer"> <div class="row"> <div class="col-lg-12 text-right"> <button type="button" class="btn btn-default" onclick="<?php if ($is_popup) { ?> $('#cu-settings-form').modal('hide');<?php } else { ?> window.location.href='<?php echo RMUris::anchor($module->getVar('dirname')); ?> ';<?php } ?> "><?php _e('Cancel', 'rmcommon'); ?> </button> <button type="submit" class="btn btn-primary"><?php _e('Save Changes', 'rmcommon'); ?> </button> </div> </div> </div>
/** * @desc Activa o desactiva un foro */ function bx_activate_forums($status = 1) { global $xoopsDB, $xoopsSecurity; if (!$xoopsSecurity->check()) { RMUris::redirect_with_message(__('Session token expired! Try again.', 'bxpress'), 'forums.php', RMMSG_ERROR); } $forums = RMHttpRequest::post('ids', 'array', null); if (!is_array($forums) || empty($forums)) { RMUris::redirect_with_message(__('No forum has been selected.', 'bxpress'), 'forums.php', RMMSG_ERROR); } $sql = "UPDATE " . $xoopsDB->prefix("mod_bxpress_forums") . " SET active='{$status}' WHERE "; $sql1 = ''; foreach ($forums as $k => $v) { $sql1 .= $sql1 == '' ? "id_forum='{$v}' " : "OR id_forum='{$v}' "; } $xoopsDB->queryF($sql . $sql1); RMUris::redirect_with_message(__('Database updated successfully!', 'bxpress'), 'forums.php', RMMSG_INFO); }