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; } }
/** * 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; }
<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']; ?>
/** * 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'); }
/** * Get the requested controller. * A controller is determined by getting the _GET['s] paramater. This parameter is a string passed trough * URL as follow: * * <pre>controller/action</pre> * * This means that the well formed URL must have the next structure: * * <pre>http://my-site/modules/module/index.php?s=controller/action</pre> * * or * * <pre>http://my-site/module/<strong>controller</strong>/<strong>action</strong>/</pre> * * This method will obtain controller and will call as follow: * <pre>Controller::action()</pre> * * All logic must be added in action() method. * * If a the corresponding class is not found, then an 404 status error will be send to browser. */ protected function launch() { // Get data from URL $parameters = RMUris::current_url(); $parameters = trim(str_replace($this->get_url(), '', $parameters), '/'); $parameters = preg_replace("/(.*)\\?.*?\$/", '$1', $parameters); if ($parameters == '') { $controller_name = $this->default_controller; $action = $this->default_action; } else { $parameters = explode("/", trim($parameters, "/")); $controller_name = $parameters[0]; $action = count($parameters) > 1 ? $parameters[1] : 'index'; } $action = str_replace("-", "_", $action); $class = ucfirst($this->directory) . '_' . ucfirst($controller_name) . '_' . (defined('XOOPS_CPFUNC_LOADED') ? 'Admin_' : '') . 'Controller'; $file = $this->path . '/' . (defined('XOOPS_CPFUNC_LOADED') ? 'admin/controllers' : 'controllers') . '/' . strtolower($controller_name) . '.php'; if (!file_exists($file)) { return $this->send_status(404, $controller_name, $action); } include_once $file; if (!class_exists($class)) { return $this->send_status(404, $controller_name, $action); } if (is_array($parameters) && count($parameters) > 2) { $parameters = array_slice($parameters, 2); } else { $parameters = array(); } $controller = new $class(); $controller->parent = $this; $controller->settings = $this->settings; $controller->tpl = $GLOBALS['rmTpl']; $controller->module = $this->module; $this->parameters = $parameters; if (!method_exists($controller, $action)) { return $this->send_status(404, $controller_name, $action); } $this->controller = $controller_name; $this->action = strtolower($action); return $controller->{$action}(); }
/** * 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(); }
<?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';