function getJReviews_Rating($listing_id, $tmpl_suffix = '') { # Populate $params array with module settings $JreParams['data']['extension'] = 'com_joomla_lms'; $JreParams['data']['tmpl_suffix'] = $tmpl_suffix; $JreParams['data']['controller'] = 'everywhere'; $JreParams['data']['action'] = 'category'; $JreParams['data']['listing_id'] = $listing_id; // Load dispatch class $Dispatcher = new S2Dispatcher('jreviews'); $jreCategory = $Dispatcher->dispatch($JreParams); $rating = false; if ($jreCategory) { $rating = $jreCategory['output']; } return $rating; }
function xajaxDispatch() { # MVC initalization script if (!defined('MVC_FRAMEWORK')) { require dirname(dirname(__FILE__)) . DS . 'com_jreviews' . DS . 'jreviews' . DS . 'framework.php'; } $objResponse = new xajaxResponse(); # Debug if (S2_DEBUG == 0) { error_reporting(0); } # Function parameters $args = func_get_args(); $controllerName = (string) array_shift($args); $action = (string) array_shift($args); $app = isset($args[0]) && is_string($args[0]) ? array_shift($args) : 'jreviews'; App::import('Controller', $controllerName, $app); # remove admin path from controller name $controllerClass = inflector::camelize(str_replace(MVC_ADMIN . _DS, '', $controllerName)) . 'Controller'; $controller = new $controllerClass($app); $controller->app = $app; $controller->passedArgs = array(); if (isset($args[0])) { $post = S2Dispatcher::parseParamsAjax($args[0]); if (isset($post['data'])) { // pass form inputs to controller variable $rawData = $post['data']; $data = Sanitize::clean($post['data']); $data['__raw'] = $rawData; $controller->data = $data; } $controller->passedArgs = $post; $controller->params = $post; } $controller->name = $controllerName; $controller->action = $action; $controller->autoLayout = false; $controller->autoRender = false; $controller->xajaxRequest = true; $controller->__initComponents(); if (method_exists($controller, 'beforeFilter')) { $controller->beforeFilter(); } $objResponse->loadCommands($controller->{$action}($args)); return $objResponse; }
/** * Calls a controller's method from any location. * * @param string $url URL in the form of Cake URL ("/controller/method/parameter") * @param array $extra if array includes the key "return" it sets the AutoRender to true. * @return mixed Success (true/false) or contents if 'return' is set in $extra * @access public */ function requestAction($url, $extra = array()) { $app = Sanitize::getString($extra, 'app', 'jreviews'); unset($extra['app']); if (empty($url)) { return false; } if (!class_exists('S2Dispatcher')) { require S2_FRAMEWORK . DS . 'dispatcher.php'; } if (in_array('return', $extra, true)) { $extra = array_merge($extra, array('return' => 0, 'autoRender' => 1)); } $params = array_merge(array('token' => cmsFramework::formIntegrityToken($extra, array('module', 'module_id', 'form', 'data'), false), 'autoRender' => 0, 'return' => 1, 'bare' => 1, 'requested' => 1), $extra); $disable404 = true; $dispatcher = new S2Dispatcher($app, null, $disable404); return $dispatcher->dispatch($url, $params); }
function _getPage($userId, $params, $cacheSetting) { if (!$cacheSetting) { # MVC initalization script if (!defined('DS')) { define('DS', DIRECTORY_SEPARATOR); } require 'components' . DS . 'com_jreviews' . DS . 'jreviews' . DS . 'framework.php'; } Configure::write('Libraries.disableJS', array('jquery')); # Populate $params array with module settings $eParams['page'] = 1; $eParams['user'] = $userId; $eParams['module'] = stringToArray($params->_raw); $eParams['module']['community'] = true; $eParams['module_id'] = 'plugin_myfavorites' . $userId; $eParams['page'] = 1; $eParams['data']['module'] = true; $eParams['data']['controller'] = 'community_listings'; $eParams['data']['action'] = 'favorites'; $eParams['data']['module_limit'] = $params->get('limit', 10); $Dispatcher = new S2Dispatcher('jreviews', true, false); return $Dispatcher->dispatch($eParams); }
$url = str_replace('menu', '', $url); $db = cmsFramework::getDB(); $query = "SELECT * FROM #__menu WHERE id = " . $menu_id; $db->setQuery($query); $menu = end($db->loadObjectList()); $mparams = getCmsVersion() == CMS_JOOMLA16 ? json_decode($menu->params, true) : stringToArray($menu->params); if (isset($mparams['action'])) { $action = paramsRoute((int) $mparams['action']); $_REQUEST['Itemid'] = $_GET['Itemid'] = $menu->id; // For default - home page menu unset($mparams['action']); $menu_params['data'] = $mparams; $filters = array('dir' => 'dirid', 'section' => 'sectionid', 'cat' => 'catid', 'criteria' => 'criteriaid'); foreach ($filters as $key => $key2) { $menu_params[$key] = Sanitize::getVar($mparams, $key2); is_array($menu_params[$key]) and $menu_params[$key] = implode(',', $menu_params[$key]); } // $menu_params['url'] = 'menu'; $menu_params['data']['component_menu'] = true; $menu_params['data']['controller'] = $action[0]; $menu_params['data']['action'] = $action[1]; } } $Dispatcher = new S2Dispatcher('jreviews'); echo $Dispatcher->dispatch($menu_params); unset($db, $User, $menu, $Dispatcher); function paramsRoute($action) { $a = array("100" => "m", "0" => array('directories', 'index'), "1" => array('categories', 'section'), "2" => array('categories', 'category'), "3" => array('listings', 'create'), "4" => array('categories', 'toprated'), "5" => array('categories', 'topratededitor'), "6" => array('categories', 'latest'), "7" => array('categories', 'popular'), "8" => array('categories', 'mostreviews'), "9" => array('categories', 'featured'), "10" => array('reviews', 'myreviews'), "11" => array('search', 'index'), "12" => array('categories', 'mylistings'), "13" => array('categories', 'favorites'), "14" => array('reviews', 'latest'), "15" => array('reviews', 'latest_user'), "16" => array('reviews', 'latest_editor'), "17" => array('discussions', 'latest'), "18" => array('reviews', 'rankings'), "19" => array('paidlistings', 'myaccount'), "20" => array('paidlistings_plans', 'index'), "21" => array('categories', 'custom')); return $a[$action]; }
<?php /** * jReviews - Reviews Extension * Copyright (C) 2006 ClickFWD LLC * This is not free software, do not distribute it. * For licencing information visit http://www.reviewsforjoomla.com * or contact sales@reviewsforjoomla.com **/ defined('_VALID_MOS') || defined('_JEXEC') or die('Direct Access to this location is not allowed.'); # MVC initalization script require JPATH_SITE . DS . 'components' . DS . 'com_jreviews' . DS . 'jreviews' . DS . 'framework.php'; # Populate $params array with module settings $module_params = isset($params->_raw) ? stringToArray($params->_raw) : $params->toArray(); $moduleParams['module'] = $module_params; $moduleParams['module_id'] = $module->id; $moduleParams['page'] = 1; $moduleParams['data']['module'] = true; $moduleParams['data']['controller'] = 'module_totals'; $moduleParams['data']['action'] = 'index'; $moduleParams['token'] = cmsFramework::formIntegrityToken($moduleParams, array('module', 'module_id', 'form', 'data'), false); $Dispatcher = new S2Dispatcher('jreviews'); echo $Dispatcher->dispatch($moduleParams); unset($Dispatcher);
function onPrepareContent(&$article, &$params) { if (!class_exists('cmsFramework')) { return; } // Check whether to perform the replacement or not $option = Sanitize::getString($_REQUEST, 'option', ''); $view = Sanitize::getString($_REQUEST, 'view', ''); $layout = Sanitize::getString($_REQUEST, 'layout', ''); $id = Sanitize::getInt($_REQUEST, 'id'); if ($option == 'com_content' && in_array($view, array('article', 'category', 'section', 'frontpage')) && ($layout != '' || in_array($view, array('article', 'frontpage')))) { $row =& $article; if ((isset($row->params) || isset($row->parameters)) && isset($row->id) && isset($row->catid) && isset($row->sectionid) && $row->id > 0 && $row->catid > 0 && $row->sectionid > 0) { $Dispatcher = new S2Dispatcher('jreviews', true); if ($option == 'com_content' && $view == 'article' & $id > 0) { $_GET['url'] = 'com_content/com_content_view'; } elseif ($option == 'com_content' && (($layout == 'blog' || $layout == 'blogfull') && ($view == 'category' || $view == 'section') || $view == 'frontpage')) { $_GET['url'] = 'com_content/com_content_blog'; } $passedArgs = array('params' => $params, 'row' => $row, 'component' => 'com_content'); $passedArgs['cat'] = $row->catid; $passedArgs['section'] = $row->sectionid; $passedArgs['listing_id'] = $row->id; $output = $Dispatcher->dispatch($passedArgs); if ($output) { $row =& $output['row']; $params =& $output['params']; } /** * Store a copy of the $listing and $crumbs arrays in memory for use in the onBeforeDisplayContent method */ $_this =& cmsFramework::getInstance(); $_this->listing =& $output['listing']; $_this->crumbs =& $output['crumbs']; // Destroy pathway if (isset($_this->crumbs) && !empty($_this->crumbs)) { cmsFramework::setPathway(array()); } unset($Dispatcher); } } }
<?php /** * jReviews - Reviews Extension * Copyright (C) 2006 Alejandro Schmeichler * This is not free software, do not distribute it. * For licencing information visit http://www.reviewsforjoomla.com * or contact sales@reviewsforjoomla.com **/ defined('_VALID_MOS') || defined('_JEXEC') or die('Direct Access to this location is not allowed.'); # MVC initalization script if (!defined('DS')) { define('DS', DIRECTORY_SEPARATOR); } if (defined('JPATH_SITE')) { $root = JPATH_SITE . DS; } else { global $mainframe; $root = $mainframe->getCfg('absolute_path') . DS; } require $root . 'components' . DS . 'com_jreviews' . DS . 'jreviews' . DS . 'framework.php'; # Populate $params array with module settings $moduleParams['module'] = stringToArray($params->_raw); $moduleParams['module_id'] = $module->id; $moduleParams['data']['module'] = true; $moduleParams['data']['controller'] = 'module_geomaps'; $moduleParams['data']['action'] = 'listings'; $Dispatcher = new S2Dispatcher('jreviews', false); echo $Dispatcher->dispatch($moduleParams);
set_time_limit(2000); } $install_bypass = isset($_GET['bypass']) ? true : false; if ($install_bypass === false) { jimport('joomla.filesystem.file'); jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.archive'); jimport('joomla.filesystem.path'); $adapter = JArchive::getAdapter('zip'); $result = @$adapter->extract($package, $target); } if (file_exists($target . 'jreviews' . DS . 'index.php')) { // If extracted, run installer @unlink($path_app_admin . 'jreviews.s2'); require $path_root . DS . 'components' . DS . 'com_jreviews' . DS . 'jreviews' . DS . 'framework.php'; $Dispatcher = new S2Dispatcher('jreviews'); $Dispatcher->dispatch('install/index', array()); } } else { // Can't install app ?> <div style="font-size:12px;border:1px solid #000;background-color:#FBFBFB;padding:10px;"> There was a problem extracting the jReviews. <br /> 1) Locate the jreviews.s2 file in the component installation package you just tried to install.<br /> 2) Rename it to jreviews.zip and extract it to your hard drive<br /> 3) Upload it to the frontend /components/com_jreviews/ directory. </div> <?php } } function adminGetCmsVersion()
/** * Calls a controller's method from any location. * * @param string $url URL in the form of Cake URL ("/controller/method/parameter") * @param array $extra if array includes the key "return" it sets the AutoRender to true. * @return mixed Success (true/false) or contents if 'return' is set in $extra * @access public */ function requestAction($url, $extra = array()) { $app = Sanitize::getString($extra, 'app', 'jreviews'); $xajax = Sanitize::getVar($extra, 'xajax', false); unset($extra['app']); unset($extra['xajax']); if (empty($url)) { return false; } if (!class_exists('S2Dispatcher')) { require S2_FRAMEWORK . DS . 'dispatcher.php'; } if (in_array('return', $extra, true)) { $extra = array_merge($extra, array('return' => 0, 'autoRender' => 1)); } $params = array_merge(array('autoRender' => 0, 'return' => 1, 'bare' => 1, 'requested' => 1), $extra); $disable404 = true; $dispatcher = new S2Dispatcher($app, $xajax, $disable404); return $dispatcher->dispatch($url, $params); }
function xajaxDispatch() { $objResponse = new xajaxResponse(); # Debug if (Configure::read('System.debug', 0) === 0) { error_reporting(0); } # Function parameters $args = func_get_args(); $controllerName = (string) array_shift($args); $action = (string) array_shift($args); $app = isset($args[0]) && is_string($args[0]) ? array_shift($args) : 'jreviews'; $Router =& S2Router::getInstance(); $Router->app = $app; App::import('Controller', $controllerName, $app); # remove admin path from controller name $controllerClass = inflector::camelize(str_replace(MVC_ADMIN . _DS, '', $controllerName)) . 'Controller'; $controller = new $controllerClass($app); $controller->passedArgs = array(); $controller->params = array(); if (isset($args[0])) { $post = S2Dispatcher::parseParamsAjax($args[0]); if (isset($post['data'])) { // pass form inputs to controller variable $rawData = $post['data']; $data = Sanitize::clean($post['data']); $data['__raw'] = $rawData; $controller->data = $data; } $controller->passedArgs = $post; $controller->params = $post; } $controller->name = $controllerName; $controller->action = $action; $controller->autoLayout = false; $controller->autoRender = false; $controller->xajaxRequest = true; $controller->__initComponents(); $controller->beforeFilter(); $objResponse->loadCommands($controller->{$action}($args)); return $objResponse; }
$url = str_replace('menu', '', $url); $cms = new stdClass(); cmsFramework::init($cms); $query = "SELECT * FROM #__menu WHERE id = " . $menu_id; $cms->_db->setQuery($query); $menu = end($cms->_db->loadObjectList()); $mparams = getCmsVersion() == CMS_JOOMLA16 ? json_decode($menu->params, true) : stringToArray($menu->params); if (isset($mparams['action'])) { $action = paramsRoute((int) $mparams['action']); $_REQUEST['Itemid'] = $_GET['Itemid'] = $menu->id; // For default - home page menu unset($mparams['action']); $menu_params['data'] = $mparams; $menu_params['dir'] = $mparams['dirid']; $menu_params['section'] = $mparams['sectionid']; $menu_params['cat'] = $mparams['catid']; $menu_params['criteria'] = $mparams['criteriaid']; // $menu_params['url'] = 'menu'; $menu_params['data']['component_menu'] = true; $menu_params['data']['controller'] = $action[0]; $menu_params['data']['action'] = $action[1]; } } $Dispatcher = new S2Dispatcher('jreviews', $xajax); echo $Dispatcher->dispatch($menu_params); unset($cms, $menu, $Dispatcher); function paramsRoute($action) { $a = array("100" => "m", "0" => array('directories', 'index'), "1" => array('categories', 'section'), "2" => array('categories', 'category'), "3" => array('listings', 'create'), "4" => array('categories', 'toprated'), "5" => array('categories', 'topratededitor'), "6" => array('categories', 'latest'), "7" => array('categories', 'popular'), "8" => array('categories', 'mostreviews'), "9" => array('categories', 'featured'), "10" => array('reviews', 'myreviews'), "11" => array('search', 'index'), "12" => array('categories', 'mylistings'), "13" => array('categories', 'favorites'), "14" => array('reviews', 'latest'), "15" => array('reviews', 'latest_user'), "16" => array('reviews', 'latest_editor'), "17" => array('discussions', 'latest'), "18" => array('reviews', 'rankings'), "19" => array('paidlistings', 'myaccount'), "20" => array('paidlistings_plans', 'index')); return $a[$action]; }
function _getPage($userId, $params, $cacheSetting) { if (!$cacheSetting) { # MVC initalization script if (!defined('DS')) { define('DS', DIRECTORY_SEPARATOR); } require 'components' . DS . 'com_jreviews' . DS . 'jreviews' . DS . 'framework.php'; } Configure::write('Libraries.disableJS', array('jquery')); # Populate $params array with module settings $eParams['data']['extension'] = $params->get('integration', 'com_community_access'); // Access | Field $eParams['data']['tmpl_suffix'] = ''; $eParams['data']['controller'] = 'everywhere'; $eParams['data']['action'] = 'index'; $eParams['data']['listing_id'] = $userId; $eParams['data']['limit_special'] = $params->get('list_limit', 10); // Load dispatch class $Dispatcher = new S2Dispatcher('jreviews', true); $eDetail = $Dispatcher->dispatch($eParams); if ($eDetail) { $form = $eDetail['output']; return $form; } }