コード例 #1
0
 function beforeFilter()
 {
     # These should be called in each controller where they are required instead of globally
     $this->_db = cmsFramework::getDB();
     $this->_user = cmsFramework::getUser();
     # Overcome host restrictions
     $query = "SET SQL_BIG_SELECTS=1";
     $this->_db->setQuery($query);
     $this->_db->query();
     # Fix Joomla bug when language filter is active with default language code hidden in url
     if (isset($this->params['lang'])) {
         $this->params['lang'] = cmsFramework::getUrlLanguageCode();
     }
     # Init Access
     if (isset($this->Access)) {
         $this->Access->init($this->Config);
     }
     App::import('Component', 'theming', 'jreviews');
     $this->Theming = ClassRegistry::getClass('ThemingComponent');
     $this->Theming->startup($this);
     # Set pagination vars
     // First check url, then menu parameter. Otherwise the limit list in pagination doesn't respond b/c menu params always wins
     $this->limit = Sanitize::getInt($this->params, 'limit', Sanitize::getInt($this->data, 'limit_special', Sanitize::getInt($this->data, 'limit')));
     //		$this->passedArgs['limit'] = $this->limit;
     $this->page = Sanitize::getInt($this->data, 'page', Sanitize::getInt($this->params, 'page', 1));
     if (!$this->limit) {
         if (Sanitize::getVar($this->params, 'action') == 'myreviews') {
             $this->limit = Sanitize::getInt($this->params, 'limit', $this->Config->user_limit);
             $this->params['default_limit'] = $this->Config->user_limit;
         } else {
             $this->limit = Sanitize::getInt($this->params, 'limit', $this->Config->list_limit);
             $this->params['default_limit'] = $this->Config->list_limit;
         }
     }
     if (Sanitize::getVar($this->params, 'action') == 'myreviews') {
         $this->params['default_limit'] = $this->Config->user_limit;
     } else {
         $this->params['default_limit'] = $this->Config->list_limit;
     }
     // Set a hard code limit to prevent abuse
     $this->limit = max(min($this->limit, 50), 1);
     // Need to normalize the limit var for modules
     if (isset($this->params['module'])) {
         $module_limit = Sanitize::getInt($this->params['module'], 'module_limit', 5);
     } else {
         $module_limit = 5;
     }
     $this->module_limit = Sanitize::getInt($this->data, 'module_limit', $module_limit);
     $this->module_page = Sanitize::getInt($this->data, 'module_page', 1);
     $this->module_page = $this->module_page === 0 ? 1 : $this->module_page;
     $this->module_offset = (int) ($this->module_page - 1) * $this->module_limit;
     if ($this->module_offset < 0) {
         $this->module_offset = 0;
     }
     $this->page = $this->page === 0 ? 1 : $this->page;
     $this->offset = (int) ($this->page - 1) * $this->limit;
     if ($this->offset < 0) {
         $this->offset = 0;
     }
     # Required further below for Community Model init
     if (!isset($this->Menu)) {
         App::import('Model', 'menu', 'jreviews');
         $this->Menu = ClassRegistry::getClass('MenuModel');
     }
     if (!$this->ajaxRequest) {
         if (!($menu_id = Configure::read('_public_menu_id'))) {
             # Find and set one public Itemid to use for Ajax requests
             $menu_id = '';
             $menu_id = $this->Menu->get('jreviews_public');
             $menu_id = $menu_id != '' ? $menu_id : 99999;
             Configure::write('_public_menu_id', $menu_id);
         }
         if (!($search_itemid = Configure::read('_search_itemid'))) {
             // Set search menu Itemid used in several of the controllers
             $option = Sanitize::getString($this->params, 'option');
             $auto_itemid = Sanitize::getBool($this->Config, 'search_itemid', false);
             $hc_itemid = Sanitize::getInt($this->Config, 'search_itemid_hc', '');
             $search_menuid = $this->Menu->get('jr_advsearch');
             $search_itemid = '';
             switch ($option) {
                 case 'com_jreviews':
                     // page Itemid is enabled
                     if (!$auto_itemid && $hc_itemid > 0) {
                         $search_itemid = $hc_itemid;
                     } elseif (!$auto_itemid & $search_menuid > 0) {
                         $search_itemid = $search_menuid;
                     }
                     break;
                 default:
                     // Non-JReviews pages - can't use current page Itemid
                     if ($hc_itemid > 0) {
                         $search_itemid = $hc_itemid;
                     } else {
                         $search_itemid = $search_menuid;
                     }
                     break;
             }
             $search_itemid == '' and $option == 'com_jreviews' and $search_itemid = Sanitize::getString($this->params, 'Itemid');
             Configure::write('_search_itemid', $search_itemid);
         }
         $this->set(array('search_itemid' => $search_itemid, 'public_menu_id' => $menu_id));
     }
     if (!defined('MVC_GLOBAL_JS_VARS') && !$this->ajaxRequest && $this->action != '_save') {
         # Add global javascript variables
         $this->assets['head-top'][] = '<script type="text/javascript">
         /* <![CDATA[ */
         var s2AjaxUri = "' . getAjaxUri() . '",
             jrLanguage = new Array(),
             jrVars = new Array(),
             datePickerImage = "' . $this->viewImages . 'calendar.gif",
             jrPublicMenu = ' . $menu_id . ';
         jrLanguage["cancel"] = "' . __t("Cancel", true) . '";
         jrLanguage["submit"] = "' . __t("Submit", true) . '";
         jrLanguage["clearDate"] = "' . __t("Clear", true) . '";
         jrLanguage["field.select"] = "' . __t("-- Select --", true) . '";
         jrLanguage["field.select_field"] = "' . __t("-- Select %s --", true) . '";
         jrLanguage["field.no_results"] = "' . __t("No results found, try a different spelling.", true) . '";
         jrLanguage["field.ui_help"] = "' . __t("Start typing for suggestions", true) . '";
         jrLanguage["field.ui_add"] = "' . __t("Add", true) . '";
         jrLanguage["compare.heading"] = "' . __t("Compare", true) . '";
         jrLanguage["compare.compare_all"] = "' . __t("Compare All", true) . '";
         jrLanguage["compare.remove_all"] = "' . __t("Remove All", true) . '";
         jrLanguage["compare.select_more"] = "' . __t("You need to select more than one listing for comparison.", true) . '";
         jrLanguage["compare.select_max"] = "' . __t("You selected maximum number of listings for comparison.", true) . '";
         jrVars["locale"] = "' . cmsFramework::getLocale() . '";
         /* ]]> */
         </script>';
         if ($item_id = Sanitize::getInt($this->params, 'Itemid')) {
             $menu = $this->Menu->getMenuParams($item_id);
             $meta_desc = Sanitize::getString($menu, 'menu-meta_description');
             $meta_keys = Sanitize::getString($menu, 'menu-meta_keywords');
             $meta_desc != '' and cmsFramework::meta('description', $meta_desc);
             $meta_keys != '' and cmsFramework::meta('keywords', $meta_keys);
         }
         define('MVC_GLOBAL_JS_VARS', 1);
     }
     # Dynamic Community integration loading
     $community_extension = Configure::read('Community.extension');
     $community_extension = $community_extension != '' ? $community_extension : 'community_builder';
     App::import('Model', $community_extension, 'jreviews');
     $this->Community = new CommunityModel();
     # Init plugin system
     $this->_initPlugins();
 }
コード例 #2
0
ファイル: my_controller.php プロジェクト: bizanto/Hooked
 function beforeFilter()
 {
     # Init Access
     if (isset($this->Access)) {
         $this->Access->init($this->Config);
     }
     # Dynamic Community integration loading
     $community_extension = Configure::read('Community.extension');
     $community_extension = $community_extension != '' ? $community_extension : 'community_builder';
     App::import('Model', $community_extension, 'jreviews');
     $this->Community = new CommunityModel();
     # Set Theme
     $this->viewTheme = $this->Config->template;
     $this->viewImages = S2Paths::get('jreviews', 'S2_THEMES_URL') . 'default' . _DS . 'theme_images' . _DS;
     # Set template type for lists and template suffix
     $this->__initTemplating();
     # Set pagination vars
     // First check url, then menu parameter. Otherwise the limit list in pagination doesn't respond b/c menu params always wins
     $this->limit = Sanitize::getInt($this->params, 'limit', Sanitize::getInt($this->data, 'limit_special', Sanitize::getInt($this->data, 'limit')));
     //		$this->passedArgs['limit'] = $this->limit;
     $this->page = Sanitize::getInt($this->data, 'page', Sanitize::getInt($this->params, 'page', 1));
     if (!$this->limit) {
         if (Sanitize::getVar($this->params, 'action') == 'myreviews') {
             $this->limit = Sanitize::getInt($this->params, 'limit', $this->Config->user_limit);
         } else {
             $this->limit = Sanitize::getInt($this->params, 'limit', $this->Config->list_limit);
         }
     }
     // Set a hard code limit to prevent abuse
     $this->limit = max(min($this->limit, 50), 1);
     // Need to normalize the limit var for modules
     if (isset($this->params['module'])) {
         $module_limit = Sanitize::getInt($this->params['module'], 'module_limit', 5);
     } else {
         $module_limit = 5;
     }
     $this->module_limit = Sanitize::getInt($this->data, 'module_limit', $module_limit);
     $this->module_page = Sanitize::getInt($this->data, 'module_page', 1);
     $this->module_page = $this->module_page === 0 ? 1 : $this->module_page;
     $this->module_offset = (int) ($this->module_page - 1) * $this->module_limit;
     if ($this->module_offset < 0) {
         $this->module_offset = 0;
     }
     $this->page = $this->page === 0 ? 1 : $this->page;
     $this->offset = (int) ($this->page - 1) * $this->limit;
     if ($this->offset < 0) {
         $this->offset = 0;
     }
     # Add global javascript variables
     if (!defined('MVC_GLOBAL_JS_VARS') && !$this->ajaxRequest && $this->action != '_save') {
         cmsFramework::addScript('<script type="text/javascript">
         //<![CDATA[
         var xajaxUri = "' . getXajaxUri() . '";
         //]]>
         </script>');
         cmsFramework::addScript('<script type="text/javascript">
         //<![CDATA[
         var s2AjaxUri = "' . getAjaxUri() . '";
         //]]>
         </script>');
         cmsFramework::addScript('<script type="text/javascript">
             var jr_translate= new Array();
             jr_translate["cancel"] = "' . __t("Cancel", true) . '";
             jr_translate["submit"] = "' . __t("Submit", true) . '";
         </script>');
         $javascriptcode = '<script type="text/javascript">%s</script>';
         # Set calendar image
         cmsFramework::addScript(sprintf($javascriptcode, 'var datePickerImage = "' . $this->viewImages . 'calendar.gif";'));
         # Find and set one public Itemid to use for Ajax requests
         $menu_id = '';
         if (!defined('MVC_FRAMEWORK_ADMIN')) {
             App::import('Model', 'menu', 'jreviews');
             $MenuModel = RegisterClass::getInstance('MenuModel');
             $menu_id = $MenuModel->get('jreviews_public');
             $menu_id = $menu_id != '' ? $menu_id : 99999;
             $this->set('public_menu_id', $menu_id);
         }
         # Set JReviews public menu
         cmsFramework::addScript(sprintf($javascriptcode, 'var jr_publicMenu = ' . $menu_id . ';'));
         define('MVC_GLOBAL_JS_VARS', 1);
     }
     # Init plugin system
     $this->_initPlugins();
 }
コード例 #3
0
ファイル: basics.php プロジェクト: atikahmed/joomla-probid
function displayAjaxUri($app = 'jreviews')
{
    echo getAjaxUri($app);
}
コード例 #4
0
 function beforeFilter()
 {
     # These should be called in each controller where they are required instead of globally
     $this->_db = cmsFramework::getDB();
     $this->_user = cmsFramework::getUser();
     # Init Access
     if (isset($this->Access)) {
         $this->Access->init($this->Config);
     }
     App::import('Component', 'theming', 'jreviews');
     $this->Theming = ClassRegistry::getClass('ThemingComponent');
     $this->Theming->startup($this);
     # Set pagination vars
     // First check url, then menu parameter. Otherwise the limit list in pagination doesn't respond b/c menu params always wins
     $this->limit = Sanitize::getInt($this->params, 'limit', Sanitize::getInt($this->data, 'limit_special', Sanitize::getInt($this->data, 'limit')));
     //		$this->passedArgs['limit'] = $this->limit;
     $this->page = Sanitize::getInt($this->data, 'page', Sanitize::getInt($this->params, 'page', 1));
     if (!$this->limit) {
         if (Sanitize::getVar($this->params, 'action') == 'myreviews') {
             $this->limit = Sanitize::getInt($this->params, 'limit', $this->Config->user_limit);
         } else {
             $this->limit = Sanitize::getInt($this->params, 'limit', $this->Config->list_limit);
         }
     }
     // Set a hard code limit to prevent abuse
     $this->limit = max(min($this->limit, 50), 1);
     // Need to normalize the limit var for modules
     if (isset($this->params['module'])) {
         $module_limit = Sanitize::getInt($this->params['module'], 'module_limit', 5);
     } else {
         $module_limit = 5;
     }
     $this->module_limit = Sanitize::getInt($this->data, 'module_limit', $module_limit);
     $this->module_page = Sanitize::getInt($this->data, 'module_page', 1);
     $this->module_page = $this->module_page === 0 ? 1 : $this->module_page;
     $this->module_offset = (int) ($this->module_page - 1) * $this->module_limit;
     if ($this->module_offset < 0) {
         $this->module_offset = 0;
     }
     $this->page = $this->page === 0 ? 1 : $this->page;
     $this->offset = (int) ($this->page - 1) * $this->limit;
     if ($this->offset < 0) {
         $this->offset = 0;
     }
     # Required further below for Community Model init
     if (!isset($this->Menu)) {
         App::import('Model', 'menu', 'jreviews');
         $this->Menu = ClassRegistry::getClass('MenuModel');
     }
     if (!defined('MVC_GLOBAL_JS_VARS') && !$this->ajaxRequest && $this->action != '_save') {
         # Find and set one public Itemid to use for Ajax requests
         $menu_id = '';
         $menu_id = $this->Menu->get('jreviews_public');
         $menu_id = $menu_id != '' ? $menu_id : 99999;
         $this->set('public_menu_id', $menu_id);
         # Add global javascript variables
         $this->assets['head-top'][] = '<script type="text/javascript">
         /* <![CDATA[ */
         var s2AjaxUri = "' . getAjaxUri() . '",
             jrLanguage = new Array(),
             jrVars = new Array(),
             datePickerImage = "' . $this->viewImages . 'calendar.gif",
             jrPublicMenu = ' . $menu_id . ';
         jrLanguage["cancel"] = "' . __t("Cancel", true) . '";
         jrLanguage["submit"] = "' . __t("Submit", true) . '";
         jrLanguage["field.select"] = "' . __t("-- Select --", true) . '";
         jrLanguage["field.select_field"] = "' . __t("-- Select %s --", true) . '";
         jrLanguage["field.no_results"] = "' . __t("No results found, try a different spelling.", true) . '";
         jrLanguage["field.ui_help"] = "' . __t("Start typing for suggestions", true) . '";
         jrLanguage["field.ui_add"] = "' . __t("Add", true) . '";
         jrLanguage["compare.heading"] = "' . __t("Compare", true) . '";
         jrLanguage["compare.compare_all"] = "' . __t("Compare All", true) . '";
         jrLanguage["compare.remove_all"] = "' . __t("Remove All", true) . '";
         jrLanguage["compare.select_more"] = "' . __t("You need to select more than one listing for comparison.", true) . '";
         jrLanguage["compare.select_max"] = "' . __t("You selected maximum number of listings for comparison.", true) . '";
         jrLanguage["geomaps.no_streeview"] = "' . __t("Street view not available for this address.", true) . '";
         jrLanguage["geomaps.cannot_geocode"] = "' . __t("Address could not be geocoded. Modify the address and click on the Geocode Address button to try again.", true) . '";
         jrLanguage["geomaps.drag_marker"] = "' . __t("Drag the marker to fine-tune the geographic location on the map.", true) . '";
         jrLanguage["geomaps.directions_bad_address"] = "' . __t("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.", true) . '";
         jrLanguage["geomaps.directions_request_error"] = "' . __t("The was an error processing the request.", true) . '";
         jrVars["locale"] = "' . cmsFramework::getLocale() . '";
         /* ]]> */
         </script>';
         if ($item_id = Sanitize::getInt($this->params, 'Itemid')) {
             $menu = $this->Menu->getMenuParams($item_id);
             $meta_desc = Sanitize::getString($menu, 'menu-meta_description');
             $meta_keys = Sanitize::getString($menu, 'menu-meta_keywords');
             $meta_desc != '' and cmsFramework::meta('description', $meta_desc);
             $meta_keys != '' and cmsFramework::meta('keywords', $meta_keys);
         }
         define('MVC_GLOBAL_JS_VARS', 1);
     }
     # Dynamic Community integration loading
     $community_extension = Configure::read('Community.extension');
     $community_extension = $community_extension != '' ? $community_extension : 'community_builder';
     App::import('Model', $community_extension, 'jreviews');
     $this->Community = new CommunityModel();
     # Init plugin system
     $this->_initPlugins();
 }