本文整理汇总了PHP中JRequest::set方法的典型用法代码示例。如果您正苦于以下问题:PHP JRequest::set方法的具体用法?PHP JRequest::set怎么用?PHP JRequest::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JRequest
的用法示例。
在下文中一共展示了JRequest::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onAfterRoute
function onAfterRoute()
{
$app = JFactory::getApplication();
// No remember me for admin
if ($app->isAdmin()) {
return;
}
// Get the full current URI.
$uri = JURI::getInstance();
$current = $uri->toString(array('path'));
$pieces = explode("/", $current);
$keyword = array_pop($pieces);
$keywordCat = array_pop($pieces);
//var_dump($keywordCat);
if (!isset($keyword) || $keyword == '') {
return;
}
$params = JRequest::get('GET');
//var_dump($keyword);
if (strpos($keyword, 'hotels-') === 0) {
//var_dump("found_region");
$params = $this->getHotelRegionParams($keyword, $params);
} else {
if (strpos($keyword, 'hotel-') === 0) {
//var_dump("found_hotel");
$params = $this->getHotelParams($keyword, $params);
} else {
if (strpos($keyword, 'hotelarrangement-') === 0) {
//var_dump("found_offer");
$params = $this->getHotelOfferParams($keyword, $params);
} else {
if (strpos($keywordCat, 'hotelarrangement') === 0) {
$params = $this->getHotelCityOffersParams($keyword, $params);
} else {
if (strpos($keyword, 'type-') === 0) {
//var_dump("found_offer");
$params = $this->getHotelTypeParams($keyword, $params);
} else {
if (strpos($keyword, 'theme-') === 0) {
//var_dump("found_offer");
$params = $this->getHotelThemeParams($keyword, $params);
} else {
//var_dump($keyword);
$params = $this->getVoucherParams($keyword, $params);
if (empty($params["voucher"])) {
$params = $this->getHotelCityParams($keyword, $params);
}
}
}
}
}
}
}
//var_dump($params);
//exit;
JRequest::set($params, 'get', true);
}
示例2: route
/**
* Proxy the application route() method
*/
public function route()
{
// get the full request URI
$uri = clone JURI::getInstance();
$router =& $this->getRouter();
$result = $router->parse($uri);
JRequest::set($result, 'get', true);
parent::route();
}
示例3: onAfterRoute
/**
* Shows the Admin Tools custom block message
*/
public function onAfterRoute()
{
$session = JFactory::getSession();
if ($session->get('block', false, 'com_admintools')) {
// This is an underhanded way to short-circuit Joomla!'s internal router.
$this->input->set('option', 'com_admintools');
if (class_exists('JRequest')) {
JRequest::set(array('option' => 'com_admintools'), 'get', true);
}
}
}
示例4: _actionRoute
/**
* Parses the route.
*
* @param KCommandContext $context Command chain context
*
* @return bool
*/
protected function _actionRoute(KCommandContext $context)
{
//route the application
$url = clone KRequest::url();
$this->_application->getRouter()->parse($url);
JRequest::set($url->query, 'get', false);
// trigger the onAfterRoute events
$this->_application->triggerEvent('onAfterRoute');
$url->query = KRequest::get('get', 'raw');
//globally set ItemId
global $Itemid;
$Itemid = KRequest::get('get.Itemid', 'int', 0);
//set the request
$this->getRequest()->append($url->query);
$component = substr($this->_request->option, 4);
$this->setComponent($component);
}
示例5: search
function search()
{
$session =& JFactory::getSession();
if (JRequest::checkToken()) {
$params = array('key_search' => JRequest::getVar('key_search', ''), 'Itemid' => JRequest::getInt('Itemid', 0), 'town_id' => JRequest::getInt('town_id', 0), 'area_id' => JRequest::getInt('area_id', 0));
$session->set('params', $params, 'jea_search');
} else {
$app =& JFactory::getApplication();
$router =& $app->getRouter();
// force the default to layout on search result
$router->setVar('layout', 'default');
}
$params = $session->get('params', array(), 'jea_search');
// Bug correction on search pagination
if ($limit = JRequest::getInt('limit', 0)) {
$params['limit'] = $limit;
$session->set('params', $params, 'jea_search');
}
JRequest::set($params, 'POST');
$this->display();
}
示例6: process
/**
* do the plugin action
* @param object parameters
* @param object table model
* @return string message
*/
function process(&$params, &$model)
{
$ids = JRequest::getVar('ids', array(), 'method', 'array');
$item = $model->getTable();
$formModel = $model->getFormModel();
$origPost = JRequest::get('post', 2);
JRequest::set(array(), 'post');
foreach ($ids as $id) {
$formModel->_rowId = $id;
$row = $formModel->getData();
$row['Copy'] = '1';
$row['fabrik_copy_from_table'] = 1;
foreach ($row as $key => $val) {
JRequest::setVar($key, $val, 'post');
}
$formModel->setFormData();
$formModel->_formDataWithTableName = $formModel->_formData;
$formModel->processToDB();
}
JRequest::set(array(), 'post');
JRequest::set($origPost, 'post', true);
return true;
}
示例7: update
/**
* Updates the group
*
* @since 1.2
* @access public
* @param string
* @return
*/
public function update()
{
// Check for request forgeries
FD::checkToken();
// Only registered members allowed
FD::requireLogin();
// Get the current view
$view = $this->getCurrentView();
// Get the group
$id = JRequest::getInt('id');
$group = FD::group($id);
$my = FD::user();
if (!$group->id || !$id) {
$view->setMessage(JText::_('COM_EASYSOCIAL_GROUPS_INVALID_ID_PROVIDED'), SOCIAL_MSG_ERROR);
return $view->call(__FUNCTION__);
}
// Only allow user to edit if they have access
if (!$group->isAdmin() && !$my->isSiteAdmin()) {
$view->setMessage(JText::_('COM_EASYSOCIAL_GROUPS_NO_ACCESS'), SOCIAL_MSG_ERROR);
return $view->call(__FUNCTION__, $group);
}
// Get post data.
$post = JRequest::get('POST');
// Get all published fields apps that are available in the current form to perform validations
$fieldsModel = FD::model('Fields');
// Only fetch relevant fields for this user.
$options = array('group' => SOCIAL_TYPE_GROUP, 'uid' => $group->getCategory()->id, 'data' => true, 'dataId' => $group->id, 'dataType' => SOCIAL_TYPE_GROUP, 'visible' => SOCIAL_PROFILES_VIEW_EDIT);
$fields = $fieldsModel->getCustomFields($options);
// Load json library.
$json = FD::json();
// Initialize default registry
$registry = FD::registry();
// Get disallowed keys so we wont get wrong values.
$disallowed = array(FD::token(), 'option', 'task', 'controller');
// Process $_POST vars
foreach ($post as $key => $value) {
if (!in_array($key, $disallowed)) {
if (is_array($value)) {
$value = $json->encode($value);
}
$registry->set($key, $value);
}
}
// Convert the values into an array.
$data = $registry->toArray();
// Perform field validations here. Validation should only trigger apps that are loaded on the form
// @trigger onRegisterValidate
$fieldsLib = FD::fields();
// Get the general field trigger handler
$handler = $fieldsLib->getHandler();
// Build arguments to be passed to the field apps.
$args = array(&$data, &$group);
// Ensure that there is no errors.
// @trigger onEditValidate
$errors = $fieldsLib->trigger('onEditValidate', SOCIAL_FIELDS_GROUP_GROUP, $fields, $args, array($handler, 'validate'));
// If there are errors, we should be exiting here.
if (is_array($errors) && count($errors) > 0) {
$view->setMessage(JText::_('COM_EASYSOCIAL_GROUPS_PROFILE_SAVE_ERRORS'), SOCIAL_MSG_ERROR);
// We need to set the proper vars here so that the es-wrapper contains appropriate class
JRequest::setVar('view', 'groups', 'POST');
JRequest::setVar('layout', 'edit', 'POST');
// We need to set the data into the post again because onEditValidate might have changed the data structure
JRequest::set($data, 'post');
return $view->call('edit', $errors, $data);
}
// @trigger onEditBeforeSave
$errors = $fieldsLib->trigger('onEditBeforeSave', SOCIAL_FIELDS_GROUP_GROUP, $fields, $args, array($handler, 'beforeSave'));
if (is_array($errors) && count($errors) > 0) {
$view->setMessage(JText::_('COM_EASYSOCIAL_PROFILE_ERRORS_IN_FORM'), SOCIAL_MSG_ERROR);
// We need to set the proper vars here so that the es-wrapper contains appropriate class
JRequest::setVar('view', 'groups');
JRequest::setVar('layout', 'edit');
// We need to set the data into the post again because onEditValidate might have changed the data structure
JRequest::set($data, 'post');
return $view->call('edit', $errors);
}
// Save the group now
$group->save();
// @points: groups.update
// Add points to the user that updated the group
$my = FD::user();
$points = FD::points();
$points->assign('groups.update', 'com_easysocial', $my->id);
// Reconstruct args
$args = array(&$data, &$group);
// @trigger onEditAfterSave
$fieldsLib->trigger('onEditAfterSave', SOCIAL_FIELDS_GROUP_GROUP, $fields, $args);
// Bind custom fields for the user.
$group->bindCustomFields($data);
// Reconstruct args
$args = array(&$data, &$group);
// @trigger onEditAfterSaveFields
//.........这里部分代码省略.........
示例8: stripslashes
$ipnval= stripslashes($ipnval);
}
if(!eregi("^[_0-9a-z-]{1,30}$", $ipnkey) || !strcasecmp($ipnkey, 'cmd')) {
// ^ Antidote to potential variable injection and poisoning
unset($ipnkey);
unset($ipnval);
}
// Eliminate the above
// Remove empty keys (not values)
if(@ $ipnkey != '') {
//unset ($_POST); // Destroy the original ipn post array, sniff...
$workstring .= '&'.@ $ipnkey.'='.urlencode(@ $ipnval);
}
$post_msg .= "key ".$i++.": $ipnkey, value: $ipnval<br />";
}
JRequest :: set($_POST, 'post');
$oseMscConfig= oseRegistry :: call('msc')->getConfig(null, 'obj');
$paypal_mode = oseObject::getValue($oseMscConfig,'paypal_mode','paypal_express');
$apiEmail= oseRegistry :: call('member')->getInstance('email');
$paypal_email= $oseMscConfig->paypal_email;
$test_mode= $oseMscConfig->paypal_testmode;
$config= new JConfig();
$mailfrom= $config->mailfrom;
$fromname= $config->fromname;
$process= new oseMscIpnPaypal($paypal_email,$paypal_mode);
$remote_hostname= gethostbyaddr($_SERVER['REMOTE_ADDR']);
/*if(oseObject::getValue($oseMscConfig,'paypal_ipvalidate',false))
{
// Get the list of IP addresses for www.paypal.com and notify.paypal.com
$paypal_iplist= gethostbynamel('www.paypal.com');
示例9: update
/**
* Update an event
*
* @since 1.3
* @access public
* @param string
* @return
*/
public function update()
{
// Check for request forgeries
FD::checkToken();
// Ensure that the user is logged in
FD::requireLogin();
// Get the event data
$id = $this->input->get('id', 0, 'int');
// Load up the event
$event = FD::event($id);
if (empty($event) || empty($event->id)) {
$this->view->setMessage(JText::_('COM_EASYSOCIAL_EVENTS_INVALID_EVENT_ID'), SOCIAL_MSG_ERROR);
return $this->view->call(__FUNCTION__);
}
if (!$event->isPublished()) {
$this->view->setMessage(JText::_('COM_EASYSOCIAL_EVENTS_EVENT_UNAVAILABLE'), SOCIAL_MSG_ERROR);
return $this->view->call(__FUNCTION__);
}
$guest = $event->getGuest($this->my->id);
if (!$this->my->isSiteAdmin() && !$guest->isOwner() && !$event->isAdmin() && (!$event->isGroupEvent() || $event->isGroupEvent() && !$event->getGroup()->isOwner())) {
$this->view->setMessage(JText::_('COM_EASYSOCIAL_EVENTS_NOT_ALLOWED_TO_EDIT_EVENT'), SOCIAL_MSG_ERROR);
return $this->view->call(__FUNCTION__, $event);
}
$post = JRequest::get('POST');
$json = FD::json();
$data = array();
$disallowed = array(FD::token(), 'option', 'task', 'controller');
foreach ($post as $key => $value) {
if (in_array($key, $disallowed)) {
continue;
}
if (is_array($value)) {
$value = $json->encode($value);
}
$data[$key] = $value;
}
$fieldsModel = FD::model('Fields');
$fields = FD::model('Fields')->getCustomFields(array('group' => SOCIAL_TYPE_EVENT, 'uid' => $event->getCategory()->id, 'visible' => SOCIAL_EVENT_VIEW_EDIT, 'data' => true, 'dataId' => $event->id, 'dataType' => SOCIAL_TYPE_EVENT));
$fieldsLib = FD::fields();
$args = array(&$data, &$event);
$errors = $fieldsLib->trigger('onEditValidate', SOCIAL_FIELDS_GROUP_EVENT, $fields, $args, array($fieldsLib->getHandler(), 'validate'));
if (!empty($errors)) {
$this->view->setMessage(JText::_('COM_EASYSOCIAL_EVENTS_ERRORS_IN_FORM'), SOCIAL_MSG_ERROR);
JRequest::setVar('view', 'events', 'POST');
JRequest::setVar('layout', 'edit', 'POST');
JRequest::set($data, 'POST');
return $this->view->call('edit', $errors);
}
$errors = $fieldsLib->trigger('onEditBeforeSave', SOCIAL_FIELDS_GROUP_EVENT, $fields, $args, array($fieldsLib->getHandler(), 'beforeSave'));
if (!empty($errors)) {
$this->view->setMessage(JText::_('COM_EASYSOCIAL_EVENTS_ERRORS_IN_FORM'), SOCIAL_MSG_ERROR);
JRequest::setVar('view', 'events', 'POST');
JRequest::setVar('layout', 'edit', 'POST');
JRequest::set($data, 'POST');
return $this->view->call('edit', $errors);
}
$event->save();
FD::points()->assign('events.update', 'com_easysocial', $this->my->id);
$fieldsLib->trigger('onEditAfterSave', SOCIAL_FIELDS_GROUP_EVENT, $fields, $args);
$event->bindCustomFields($data);
$fieldsLib->trigger('onEditAfterSaveFields', SOCIAL_FIELDS_GROUP_EVENT, $fields, $args);
// Only create if applyRecurring is false or event is not a child
// applyRecurring && parent = true
// applyRecurring && child = false
// !applyRecurring && parent = true
// !applyRecurring && child = true
if (empty($data['applyRecurring']) || !$event->isRecurringEvent()) {
$event->createStream('update', $this->my->id, SOCIAL_TYPE_USER);
}
$this->view->setMessage(JText::_('COM_EASYSOCIAL_EVENTS_UPDATED_SUCCESSFULLY'), SOCIAL_MSG_SUCCESS);
return $this->view->call(__FUNCTION__, $event);
}
示例10: setRequestOption
private function setRequestOption($key, $value)
{
JRequest::set(array($key => $value), 'GET');
JRequest::set(array($key => $value), 'POST');
}
示例11: parse
/**
* Short description for 'parse'
*
* Long description (if any) ...
*
* @param object &$uri Parameter description (if any) ...
* @return array Return description (if any) ...
*/
function parse(&$uri)
{
$vars = array();
// Get the application
$app = JFactory::getApplication();
if ($app->getCfg('force_ssl') == 2 && strtolower($uri->getScheme()) != 'https') {
//forward to https
$uri->setScheme('https');
$app->redirect($uri->toString());
}
// Get the path
$path = $uri->getPath();
//Remove the suffix
if ($this->_mode == JROUTER_MODE_SEF) {
// Get the application
$app = JFactory::getApplication();
if ($app->getCfg('sef_suffix') && !(substr($path, -9) == 'index.php' || substr($path, -1) == '/')) {
if ($suffix = pathinfo($path, PATHINFO_EXTENSION)) {
$path = str_replace('.' . $suffix, '', $path);
$vars['format'] = $suffix;
}
}
}
//Remove basepath
$path = substr_replace($path, '', 0, strlen(JURI::base(true)));
//Remove prefix
$path = str_replace('index.php', '', $path);
//Set the route
$uri->setPath(trim($path, '/'));
$vars += parent::parse($uri);
/* HUBzero Extensions Follow to force registration and email confirmation */
$juser = JFactory::getUser();
if (!$juser->get('guest')) {
$session = JFactory::getSession();
$registration_incomplete = $session->get('registration.incomplete');
if ($registration_incomplete) {
if ($vars['option'] == 'com_user') {
if ($vars['view'] == 'logout' || $vars['task'] == 'logout') {
return $vars;
}
}
if ($vars['option'] == 'com_members' && (isset($vars['controller']) && $vars['controller'] == 'register' || isset($vars['view']) && $vars['view'] == 'register')) {
return $vars;
}
if ($uri->getPath() != 'legal/terms') {
$vars = array();
/*
$vars['option'] = 'com_members';
$vars['controller'] = 'register';
if ($juser->get('tmp_user'))
$vars['task'] = 'create';
else
$vars['task'] = 'update';
$vars['act'] = '';
*/
$vars['option'] = 'com_members';
$vars['id'] = $juser->get("id");
$vars['active'] = 'profile';
$this->setVars($vars);
JRequest::set($vars, 'get', true);
// overwrite existing
return $vars;
}
}
$xprofile = \Hubzero\User\User::oneOrNew($juser->get('id'));
if (is_object($xprofile) && $xprofile->get('activation') != 1 && $xprofile->get('activation') != 3) {
if ($vars['option'] == 'com_user') {
if ($vars['view'] == 'logout' || $vars['task'] == 'logout') {
return $vars;
}
} else {
if ($uri->getPath() == 'legal/terms') {
return $vars;
} else {
if ($vars['option'] == 'com_members' && (isset($vars['controller']) && $vars['controller'] == 'register' || isset($vars['view']) && $vars['view'] == 'register')) {
if (!empty($vars['task'])) {
if ($vars['task'] == 'unconfirmed' || $vars['task'] == 'change' || $vars['task'] == 'resend' || $vars['task'] == 'confirm') {
return $vars;
}
}
}
}
}
$vars = array();
$vars['option'] = 'com_members';
$vars['controller'] = 'register';
$vars['task'] = 'unconfirmed';
$this->setVars($vars);
JRequest::set($vars, 'get', true);
// overwrite existing
//.........这里部分代码省略.........
示例12: process
/**
* do the plugin action
* @param object parameters
* @param object table model
* @return string message
*/
function process(&$params, &$model)
{
$ids = JRequest::getVar('ids', array(), 'method', 'array');
$table =& $model->getTable();
$formModel =& $model->getForm();
$origPost = JRequest::get('post', 2);
JRequest::set(array(), 'post');
foreach ($ids as $id) {
$formModel->_rowId = $id;
$row = $formModel->getData();
$row['Copy'] = '1';
$row['fabrik_copy_from_table'] = 1;
foreach ($row as $key => $val) {
JRequest::setVar($key, $val, 'post');
}
$formModel->setFormData();
$formModel->_formDataWithTableName = $formModel->_formData;
//set the repeat group count for processing joined data
$repeatCounts = array();
if (array_key_exists('join', $row)) {
$aPreProcessedJoins =& $model->preProcessJoin();
foreach ($row['join'] as $joinid => $joinData) {
foreach ($aPreProcessedJoins as $aPreProcessedJoin) {
$oJoin = $aPreProcessedJoin['join'];
if ($oJoin->id == $joinid) {
$keys = array_keys($joinData);
$repeatCounts[$oJoin->group_id] = count($joinData[$keys[0]]);
}
}
}
}
JRequest::setVar('fabrik_repeat_group', $repeatCounts, 'post');
//submit the form.
$formModel->processToDB();
}
JRequest::set(array(), 'post');
JRequest::set($origPost, 'post', true);
return true;
}
示例13: updateAddToCart
/**
* Used whenever an attribute selection is changed,
* to update the price and/or attribute selectlists
*
* @return unknown_type
*/
function updateAddToCart()
{
$response = array();
$response['msg'] = '';
$response['error'] = '';
// get elements from post
$elements = json_decode(preg_replace('/[\\n\\r]+/', '\\n', JRequest::getVar('elements', '', 'post', 'string')));
// convert elements to array that can be binded
Tienda::load('TiendaHelperBase', 'helpers._base');
$helper = TiendaHelperBase::getInstance();
$values = $helper->elementsToArray($elements);
// merge current elements with post
$request_arr = JRequest::get();
unset($request_arr['elements']);
JRequest::setVar('elements', null);
$values = array_merge($values, $request_arr);
JRequest::set($values, 'POST');
if (empty($values['product_id'])) {
$values['product_id'] = JRequest::getInt('product_id', 0);
}
// now get the summary
$this->display_cartbutton = true;
Tienda::load('TiendaHelperProduct', 'helpers.product');
$html = TiendaHelperProduct::getCartButton($values['product_id'], 'viewproduct_addtocart', $values);
$response['msg'] = $html;
// encode and echo (need to echo to send back to browser)
echo json_encode($response);
return;
}
示例14: MijopollsParseRoute
function MijopollsParseRoute($segments)
{
$vars = array();
//Get the active menu item if there is a menu link to polls view
$menu =& JSite::getMenu();
$item =& $menu->getActive();
// Count route segments
$count = count($segments);
//if item is not set, there is no menu linking to this view - poll
if (!isset($item)) {
$vars['view'] = 'poll';
$vars['id'] = $segments[$count - 1];
return $vars;
}
//if there is a menu to polls view ->
$vars['view'] = 'poll';
$vars['id'] = $segments[$count - 1];
if (MijopollsHelper::is30()) {
JRequest::set($vars, 'get');
}
return $vars;
}
示例15: onAfterRoute
function onAfterRoute()
{
/** @var JSite $app */
$app = JFactory::getApplication();
if ($app->isAdmin()) {
// don't use MobileJoomla in backend
return;
}
$is_joomla15 = $this->isJoomla15();
// don't filter RSS and non-html
/** @var JDocument $document */
$document = JFactory::getDocument();
$format = $document->getType();
$doctype = JRequest::getVar('type', false);
if ($doctype == 'rss' || $doctype == 'atom' || $format !== 'html' && $format !== 'raw') {
//reset mobile content-type header
$headers = JResponse::getHeaders();
JResponse::clearHeaders();
foreach ($headers as $header) {
if (strtolower($header['name']) != 'content-type') {
JResponse::setHeader($header['name'], $header['value']);
}
}
return;
}
//be last registered onAfterRender event
$app->registerEvent('onAfterRender', 'plgSystemMobileBot_onAfterRenderLast');
// Load config
$MobileJoomla_Settings =& MobileJoomla::getConfig();
$MobileJoomla_Device =& MobileJoomla::getDevice();
jimport('joomla.environment.browser');
$browser = JBrowser::getInstance();
if (version_compare(JVERSION, '3.0', '<')) {
$browser->set('_mobile', $MobileJoomla_Device['markup'] !== false);
} else {
$refObj = new ReflectionObject($browser);
$refProp = $refObj->getProperty('mobile');
$refProp->setAccessible(true);
$refProp->setValue($browser, $MobileJoomla_Device['markup'] !== false);
}
JPluginHelper::importPlugin('mobile');
$app->triggerEvent('onMobileAfterRoute', array(&$MobileJoomla_Settings, &$MobileJoomla_Device));
$this->filterExtensions($MobileJoomla_Settings, $MobileJoomla_Device);
// "Vary" header for proxy
JResponse::setHeader('Vary', 'User-Agent');
if ($MobileJoomla_Device['markup'] === false) {
$pcpage = $MobileJoomla_Settings['pcpage'];
if ($pcpage && $pcpage !== 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']) {
$app->redirect($pcpage);
}
return;
}
define('_MJ', 1);
/** @var MobileJoomla $MobileJoomla */
$MobileJoomla = MobileJoomla::getInstance();
if (!$is_joomla15 && isset($app->registeredurlparams)) {
$registeredurlparams = $app->registeredurlparams;
$this->setRequestVar('mjurlkey', null);
unset($registeredurlparams->mjurlkey);
$app->registeredurlparams = $registeredurlparams;
}
$app->triggerEvent('onMobile', array(&$MobileJoomla, &$MobileJoomla_Settings, &$MobileJoomla_Device));
$template = $MobileJoomla->getParam('template');
$homepage = $MobileJoomla->getParam('homepage');
$gzip = $MobileJoomla->getParam('gzip');
//Set template
if (!empty($template)) {
if ($is_joomla15) {
$app->setUserState('setTemplate', $template);
$app->setTemplate($template);
} else {
$db = JFactory::getDBO();
$query = "SELECT params FROM #__template_styles WHERE client_id = 0 AND template = " . $db->Quote($template) . " ORDER BY id LIMIT 1";
$db->setQuery($query);
$params_data = $db->loadResult();
if (empty($params_data)) {
$params_data = '{}';
}
if (version_compare(JVERSION, '1.7', '>=')) {
$app->setTemplate($template, $params_data);
} elseif (version_compare(JVERSION, '1.6', '>=')) {
$app->setTemplate($template);
$template_obj = $app->getTemplate(true);
$template_obj->params->loadJSON($params_data);
}
}
}
// JHtml overrides
if (version_compare(JVERSION, '3.0', '<')) {
jimport('joomla.html.html');
JHtml::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_mobilejoomla/override/html');
if (@is_dir($dir = JPATH_THEMES . '/' . $template . '/override/html')) {
JHtml::addIncludePath($dir);
}
} else {
// load email.php only (workaround for new J!3 class loader)
if (@is_file($path = JPATH_THEMES . '/' . $template . '/override/html/email.php')) {
JLoader::register('JHtmlEmail', $path, true);
} else {
JLoader::register('JHtmlEmail', JPATH_ADMINISTRATOR . '/components/com_mobilejoomla/override/html/email.php', true);
//.........这里部分代码省略.........