Exemplo n.º 1
0
 protected function populateState($ordering = null, $direction = null)
 {
     $app = JFactory::getApplication();
     $rootCategory = JUDirectoryFrontHelperCategory::getRootCategory();
     $catId = $app->input->getInt('id', $rootCategory->id);
     $this->setState('category.id', $catId);
     $params = JUDirectoryHelper::getParams($catId);
     $this->setState('params', $params);
     if ($this->context) {
         $listingPagination = $params->get('listing_pagination', 10);
         $limitArray = JUDirectoryFrontHelper::customLimitBox();
         if (is_array($limitArray) && count($limitArray)) {
             $limit = $app->input->getUint('limit', null);
             if (is_null($limit) || in_array($limit, $limitArray)) {
                 $limit = $app->getUserStateFromRequest($this->context . '.list.limit', 'limit', $listingPagination, 'uint');
             } else {
                 $limit = $listingPagination;
             }
         } else {
             $limit = $app->getUserStateFromRequest($this->context . '.list.limit', 'limit', $listingPagination, 'uint');
         }
         $this->setState('list.limit', $limit);
         $this->setState('list.start', $app->input->getUint('limitstart', 0));
         $orderCol = $app->getUserStateFromRequest($this->context . '.list.ordering', 'filter_order', '', 'string');
         $this->setState('list.ordering', $orderCol);
         $listOrder = $app->getUserStateFromRequest($this->context . '.list.direction', 'filter_order_Dir', '', 'cmd');
         $this->setState('list.direction', $listOrder);
     } else {
         $this->setState('list.start', 0);
         $this->state->set('list.limit', 0);
     }
 }
Exemplo n.º 2
0
 public function display($tpl = null)
 {
     $this->model = $this->getModel();
     $this->state = $this->get('State');
     $this->params = $this->state->get('params');
     $user = JFactory::getUser();
     $uri = JUri::getInstance();
     $this->items = $this->get('Items');
     foreach ($this->items as $item) {
         $item->report_link = JRoute::_(JUDirectoryHelperRoute::getReportListingRoute($item->id));
         $item->claim_link = JRoute::_(JUDirectoryHelperRoute::getClaimListingRoute($item->id));
         if ($item->checked_out > 0 && $item->checked_out != $user->get('id')) {
             if (JUDirectoryFrontHelperPermission::canCheckInListing($item->id)) {
                 $item->checkin_link = JRoute::_('index.php?option=com_judirectory&task=forms.checkin&id=' . $item->id . '&' . JSession::getFormToken() . '=1' . '&return=' . base64_encode(urlencode($uri)));
             }
         } else {
             $item->edit_link = JRoute::_('index.php?option=com_judirectory&task=form.edit&id=' . $item->id . '&Itemid=' . JUDirectoryHelperRoute::findItemIdOfListing($item->id));
             if ($item->published == 1) {
                 $item->editstate_link = JRoute::_('index.php?option=com_judirectory&task=forms.unpublish&id=' . $item->id . '&return=' . base64_encode(urlencode($uri)) . '&' . JSession::getFormToken() . '=1&Itemid=' . JUDirectoryHelperRoute::findItemIdOfListing($item->id));
             } else {
                 $item->editstate_link = JRoute::_('index.php?option=com_judirectory&task=forms.publish&id=' . $item->id . '&return=' . base64_encode(urlencode($uri)) . '&' . JSession::getFormToken() . '=1&Itemid=' . JUDirectoryHelperRoute::findItemIdOfListing($item->id));
             }
         }
         $item->delete_link = JRoute::_('index.php?option=com_judirectory&task=forms.delete&id=' . $item->id . '&return=' . base64_encode(urlencode($uri)) . '&' . JSession::getFormToken() . '=1&Itemid=' . JUDirectoryHelperRoute::findItemIdOfListing($item->id));
         $dispatcher = JDispatcher::getInstance();
         JPluginHelper::importPlugin('content');
         $item->event = new stdClass();
         $context = 'com_judirectory.listing_list';
         $results = $dispatcher->trigger('onContentAfterTitle', array($context, &$this->item, &$this->params, 0));
         $item->event->afterDisplayTitle = trim(implode("\n", $results));
         $results = $dispatcher->trigger('onContentBeforeDisplay', array($context, &$this->item, &$this->params, 0));
         $item->event->beforeDisplayContent = trim(implode("\n", $results));
         $results = $dispatcher->trigger('onContentAfterDisplay', array($context, &$this->item, &$this->params, 0));
         $item->event->afterDisplayContent = trim(implode("\n", $results));
     }
     $this->pagination = $this->get('Pagination');
     $this->token = JSession::getFormToken();
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     $this->show_feed = JUDIRPROVERSION ? $this->params->get('rss_display_icon', 1) : 0;
     $app = JFactory::getApplication();
     $rootCategory = JUDirectoryFrontHelperCategory::getRootCategory();
     $this->categoryId = $app->input->getInt('id', $rootCategory->id);
     $this->fetchAllSubCat = $app->input->getInt('all', 0);
     $rssLink = JRoute::_(JUDirectoryHelperRoute::getFeaturedRoute($this->categoryId, $this->fetchAllSubCat, false, true));
     $this->rss_link = JRoute::_($rssLink, false);
     $this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx'));
     $this->_prepareData();
     $this->_prepareDocument();
     $this->_setBreadcrumb();
     parent::display($tpl);
 }
Exemplo n.º 3
0
 public function cancel($key = null)
 {
     parent::cancel($key = null);
     $app = JFactory::getApplication();
     $rootCat = JUDirectoryFrontHelperCategory::getRootCategory();
     $parent_cat_id = $app->input->getInt('parent_id', $rootCat->id);
     $cat_id = $app->input->getInt('id', 0);
     if ($cat_id) {
         $parent_cat_id = JUDirectoryHelper::getCategoryById($cat_id)->parent_id;
     }
     $this->setRedirect("index.php?option=com_judirectory&view=listcats&cat_id=" . $parent_cat_id);
 }
Exemplo n.º 4
0
 public function back()
 {
     $app = JFactory::getApplication();
     $listing_id = $app->input->getInt('listing_id', 0);
     $cat_id = JUDirectoryFrontHelperCategory::getRootCategory()->id;
     if ($listing_id) {
         $listingObj = JUDirectoryHelper::getListingById($listing_id);
         if (isset($listingObj->cat_id) && $listingObj->cat_id) {
             $cat_id = $listingObj->cat_id;
         }
     }
     $this->setRedirect("index.php?option=com_judirectory&view=listcats&cat_id={$cat_id}");
 }
    public function getInput()
    {
        $categories = JUDirectoryHelper::getCatsByLevel(1);
        $rootCategory = JUDirectoryFrontHelperCategory::getRootCategory();
        $document = JFactory::getDocument();
        $script = 'jQuery(document).ready(function($){
			$("#cat-' . $rootCategory->id . '").change(function(){
				if($(this).is(":checked")){
					$(this).parent().parent().find(".category-checkbox").attr("disabled", true).prop("checked", true);
				}else{
					$(this).parent().parent().find(".category-checkbox").attr("disabled", false).prop("checked", false);
				}
			});
		});';
        $document->addScriptDeclaration($script);
        $relCatIds = array();
        if ($this->form->getValue('id')) {
            $db = JFactory::getDbo();
            $query = $db->getQuery(true);
            $query->select('c.id');
            $query->from('#__judirectory_categories AS c');
            $query->join('', '#__judirectory_emails_xref AS exref ON (exref.cat_id = c.id)');
            $query->join('', '#__judirectory_emails AS e ON (exref.email_id = e.id)');
            $query->where('exref.email_id = ' . $this->form->getValue('id'));
            $db->setQuery($query);
            $relCatIds = $db->loadColumn();
        }
        $html = '<div id="categoriestoassignemail" class="categoriestoassignemail">';
        $html .= '<ul id="' . $this->id . '" class="nav">';
        $html .= '<li>';
        $html .= '<input id="cat-' . $rootCategory->id . '" name="' . $this->name . '[]"  value = "' . $rootCategory->id . '" ' . (in_array($rootCategory->id, $relCatIds) ? 'checked="checked"' : '') . ' class="input" type="checkbox" />';
        $html .= '<label for="cat-' . $rootCategory->id . '">' . str_repeat('<span class="gi">|—</span>', $rootCategory->level) . $rootCategory->title . '</label>';
        $html .= '</li>';
        if ($categories) {
            foreach ($categories as $category) {
                $html .= '<li>';
                $attr = '';
                if (in_array($rootCategory->id, $relCatIds)) {
                    $attr = 'checked="checked" disabled="disabled"';
                } elseif (in_array($category->id, $relCatIds)) {
                    $attr = 'checked="checked"';
                }
                $html .= '<input id="cat-' . $category->id . '" class="input category-checkbox" type="checkbox" name="' . $this->name . '[]" value = "' . $category->id . '" ' . $attr . '/>';
                $html .= '<label for="cat-' . $category->id . '">' . str_repeat('<span class="gi">|—</span>', $category->level) . $category->title . '</label>';
                $html .= '</li>';
            }
        }
        $html .= '</ul></div>';
        return $html;
    }
Exemplo n.º 6
0
 public function resetDefault()
 {
     JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
     $rootCat = JUDirectoryFrontHelperCategory::getRootCategory();
     $defaultConfig = '{"activate_maintenance":"0","maintenance_message":"Directory area is down for maintenance.<br \\/> Please check back again soon.","number_rating_stars":5,"rating_star_width":16,"split_star":"2","enable_listing_rate":"1","enable_listing_rate_in_comment_form":"1","require_listing_rate_in_comment_form":"1","rating_interval":86400,"only_calculate_last_rating":"0","rating_explanation":"1:Bad\\r\\n3:Poor\\r\\n5:Fair\\r\\n7:Good\\r\\n9:Excellent","rating_statistic":"","min_rates_to_show_rating":0,"min_rates_for_top_rated":0,"listing_report_subjects":"Broken link\\r\\nCopyright infringement\\r\\nWrong category","comment_report_subjects":"Spam\\r\\nInappropriate","listing_owner_use_captcha_when_report":"0","collection_allow_vote":"1","collection_allow_vote_down":"1","collection_allow_owner_vote":"0","collection_allow_guest_vote":"1","collection_desc_limit":500,"log_events_for_guest":"0","captcha_width":155,"captcha_height":50,"captcha_length":6,"captcha_color":"#050505","captcha_bg_color":"#ffffff","captcha_line_color":"#707070","captcha_noise_color":"#707070","captcha_num_lines":5,"captcha_noise_level":2,"captcha_perturbation":5,"captcha_font":"AHGBold.ttf","map_api_key":"","map_center":"62.323907,-150.109291","map_zoom":"2","map_fitbound_maxzoom":"13","map_language":"","map_region":"ar","edit_account_details":"1","public_user_dashboard":"0","searchword_min_length":"3","searchword_max_length":"30","limit_string":"5,10,15,20,25,30,50","plugin_support":"0","activate_subscription_by_email":"1","field_attachment_directory":"media\\/com_judirectory\\/field_attachments\\/","category_fields_listview_ordering":{"title":"2","id":"2","alias":"0","parent_id":"0","rel_cats":"0","access":"0","lft":"0","fieldgroup_id":"0","criteriagroup_id":"0","featured":"0","published":"0","show_item":"0","description":"0","intro_image":"0","detail_image":"0","publish_up":"0","publish_down":"0","created_by":"0","created":"0","modified_by":"0","modified":"0","style_id":"0","layout":"0","metatitle":"0","metakeyword":"0","metadescription":"0","metadata":"0","total_categories":"0","total_listings":"0"},"template_upload_limit":"2","template_image_formats":"gif,bmp,jpg,jpeg,png","template_source_formats":"txt,less,ini,xml,js,php,css","template_font_formats":"woff,ttf,otf","template_compressed_formats":"zip","allow_add_listing_to_root":"0","reset_listing_alias_when_approving":"1","listing_owner_can_view_unpublished_listing":"0","listing_owner_can_edit_listing_auto_approval":"1","auto_approval_listing_threshold":0,"listing_owner_can_edit_state_listing":"0","listing_owner_can_report_listing":"1","claim_type":"groups","claim_groups":["8"],"claim_users":"","max_recently_viewed_listings":12,"required_fields_to_mark_listing_as_updated":"","can_change_main_category":"1","can_change_secondary_categories":"1","max_cats_per_listing":10,"max_images_per_listing":8,"max_tags_per_listing":10,"submit_listing_interval":30,"assign_itemid_to_submit_link":"currentItemid","predefined_itemid_for_submit_link":0,"max_related_listings":12,"related_listings_ordering":"listingrel.ordering","related_listings_direction":"ASC","imagequality":90,"customfilters":"","sharpen":"0","canvastransparency":"1","canvascolour":"#ffffff","listing_small_image_width":100,"listing_small_image_height":100,"listing_small_image_zoomcrop":"1","listing_small_image_alignment":"c","listing_big_image_width":600,"listing_big_image_height":600,"listing_big_image_zoomcrop":"3","listing_big_image_alignment":"c","use_watermark":"0","watermark_image":"","watermark_text":"","watermark_font":"arial.ttf","watermark_fontsize":14,"watermark_fontcolor":"#ffffff","watermark_backgroundcolor":"#144274","watermark_halign":"0","watermark_valign":"0","watermark_offsetx":0,"watermark_offsety":0,"watermark_opacity":"0.8","watermark_rotate":0,"image_min_width":50,"image_min_height":50,"image_max_width":1024,"image_max_height":1024,"image_max_size":400,"listing_default_image":"-1","listing_image_width":100,"listing_image_height":100,"listing_image_zoomcrop":"1","listing_image_alignment":"c","category_intro_image_width":200,"category_intro_image_height":200,"category_intro_image_zoomcrop":"1","category_intro_image_alignment":"c","category_detail_image_width":200,"category_detail_image_height":200,"category_detail_image_zoomcrop":"1","category_detail_image_alignment":"c","avatar_source":"juavatar","default_avatar":"default-avatar.png","avatar_width":120,"avatar_height":120,"avatar_zoomcrop":"1","avatar_alignment":"c","collection_default_icon":"-1","collection_icon_width":100,"collection_icon_height":100,"collection_icon_zoomcrop":"1","collection_icon_alignment":"c","listing_image_filename_rule":"{image_name}","listing_original_image_directory":"media\\/com_judirectory\\/images\\/gallery\\/original\\/","listing_small_image_directory":"media\\/com_judirectory\\/images\\/gallery\\/small\\/","listing_big_image_directory":"media\\/com_judirectory\\/images\\/gallery\\/big\\/","listing_image_directory":"media\\/com_judirectory\\/images\\/listing\\/","category_image_filename_rule":"{category}","category_intro_image_directory":"media\\/com_judirectory\\/images\\/category\\/intro\\/","category_detail_image_directory":"media\\/com_judirectory\\/images\\/category\\/detail\\/","avatar_directory":"media\\/com_judirectory\\/images\\/avatar\\/","collection_icon_directory":"media\\/com_judirectory\\/images\\/collection\\/","comment_system":"default","disqus_username":"","show_comment_direction":"1","comment_ordering":"cm.created","comment_direction":"DESC","show_comment_pagination":"0","comment_pagination":10,"filter_comment_rating":"1","filter_comment_language":"0","max_comment_level":5,"auto_link_url_in_comment":"1","nofollow_link_in_comment":"1","trim_long_url_in_comment":0,"front_portion_url_in_comment":0,"back_portion_url_in_comment":0,"auto_embed_youtube_in_comment":"0","auto_embed_vimeo_in_comment":"0","video_width_in_comment":360,"video_height_in_comment":240,"comment_interval":60,"comment_interval_in_same_listing":60,"auto_approval_comment_threshold":0,"auto_approval_comment_reply_threshold":0,"allow_edit_comment_within":600,"unpublish_comment_by_reporting_threshold":10,"allow_vote_comment":"1","allow_vote_down_comment":"1","can_reply_own_comment":"0","can_vote_own_comment":"0","can_subscribe_own_comment":"1","can_report_own_comment":"1","delete_own_comment":"0","listing_owner_can_comment":"0","listing_owner_can_comment_many_times":"0","listing_owner_auto_approval_when_comment":"0","listing_owner_can_reply_comment":"1","listing_owner_auto_approval_when_reply_comment":"0","listing_owner_use_captcha_when_comment":"1","listing_owner_can_vote_comment":"1","listing_owner_can_report_comment":"1","website_field_in_comment_form":"0","comment_form_editor":"wysibb","min_comment_characters":20,"max_comment_characters":1000,"bb_bold_tag":"Bold","bb_italic_tag":"Italic","bb_underline_tag":"Underline","bb_img_tag":"Picture","bb_link_tag":"Link","bb_video_tag":"Video","bb_color_tag":"Colors","bb_smilebox_tag":"Smilebox","bb_fontsize_tag":"Fontsize","bb_bulleted_list":"Bulleted-list","bb_numeric_list":"Numeric-list","bb_quote_tag":"Quotes","bb_readmore_tag":"Readmore","bb_code_tag":"Code","bb_align_left":"alignleft","bb_align_center":"aligncenter","bb_align_right":"alignright","userid_blacklist":"","forbidden_names":"","forbidden_words":"","forbidden_words_replaced_by":"***","block_ip":"0","ip_whitelist":"","ip_blacklist":"","top_comment_level":"all","top_comments_limit":100,"email_attachment_directory":"media\\/com_judirectory\\/email_attachments\\/","email_upload_maxsize":10240,"email_upload_legal_extensions":"bmp,csv,doc,gif,ico,jpg,jpeg,odg,odp,ods,odt,pdf,png,ppt,swf,txt,xcf,xls,zip,rar","email_check_mime":"0","email_image_legal_extensions":"bmp,gif,jpg,png","email_ignored_extensions":"","email_upload_legal_mime":"image\\/jpeg,image\\/gif,image\\/png,image\\/bmp,application\\/x-shockwave-flash,application\\/msword,application\\/excel,application\\/pdf,application\\/powerpoint,text\\/plain,application\\/zip","email_embedded_files":"0","email_charset":"UTF-8","enable_mailq":"0","use_mailq_default":"0","send_mailqs_on_pageload":"0","total_mailqs_sent_each_time":5,"mailq_max_attempts":5,"delete_error_mailq":"0","all_categories_show_category_title":"1","all_categories_subcategory_level":"-1","all_categories_show_empty_category":"1","all_categories_show_total_subcategories":"1","all_categories_show_total_listings":"1","all_categories_columns":2,"all_categories_column_class":"","all_categories_row_class":"","show_featured_label":"1","show_hot_label":"1","num_hit_per_day_to_be_hot":100,"show_new_label":"1","num_day_to_show_as_new":10,"show_updated_label":"1","num_day_to_show_as_updated":10,"show_empty_field":"0","submit_form_show_tab_related":"0","submit_form_show_tab_plugin_params":"0","submit_form_show_tab_publishing":"0","submit_form_show_tab_style":"0","submit_form_show_tab_meta_data":"0","submit_form_show_tab_params":"0","submit_form_show_tab_permissions":"0","show_header_sort":"1","listing_pagination":10,"show_pagination":"1","default_view_mode":"2","allow_user_select_view_mode":"1","listing_columns":2,"listing_column_class":"","listing_row_class":"","show_compare_btn_in_listview":"0","list_alpha":"0-9,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z","top_listings_limit":100,"show_submit_listing_btn_in_category":"1","category_show_description":"1","category_desc_limit":0,"category_show_image":"1","category_image_width":200,"category_image_height":200,"related_category_ordering":"crel.ordering","related_category_direction":"ASC","show_empty_related_category":"1","show_total_subcats_of_relcat":"0","show_total_listings_of_relcat":"0","related_category_show_introtext":"1","related_category_introtext_character_limit":500,"related_category_show_intro_image":"1","related_category_intro_image_width":200,"related_category_intro_image_height":200,"related_category_columns":2,"related_category_column_class":"","related_category_row_class":"","subcategory_ordering":"title","subcategory_direction":"ASC","show_empty_subcategory":"1","show_total_subcats_of_subcat":"0","show_total_listings_of_subcat":"0","subcategory_show_introtext":"1","subcategory_introtext_character_limit":500,"subcategory_show_intro_image":"1","subcategory_intro_image_width":200,"subcategory_intro_image_height":200,"subcategory_columns":2,"subcategory_column_class":"","subcategory_row_class":"","display_params":{"listing":{"show_comment":"1","fields":{"title":{"details_view":"1"},"created":{"details_view":"1"},"author":{"details_view":"1"},"cat_id":{"details_view":"1"},"rating":{"details_view":"1"}}},"cat":{"show_description":"1"}},"seo_replace_title_option":"replace","seo_replace_description_option":"replace","seo_replace_keywords_option":"replace","seo_title_length":64,"seo_description_length":160,"seo_keywords_length":160,"seo_user_title":"{user_name}","seo_user_description":"{meta_description}","seo_user_keywords":"{meta_keywords}","seo_collection_title":"{collection_title}","seo_collection_description":"{meta_description}","seo_collection_keywords":"{meta_keywords}","seo_listing_title":"{listing_title}","seo_listing_description":"{meta_description}","seo_listing_keywords":"{meta_keywords}","seo_category_title":"{cat_title}","seo_category_description":"{meta_description}","seo_category_keywords":"{meta_keywords}","seo_field_title":"{field_title}","seo_field_description":"{meta_description}","seo_field_keywords":"{meta_keywords}","seo_tag_title":"{tag_title}","seo_tag_description":"{meta_description}","seo_tag_keywords":"{meta_keywords}","sef_category_full_path":"0","sef_listing_full_path":"0","sef_categories":"categories","sef_tree":"tree","sef_featured":"featured","sef_list_all":"list-all","sef_list_alpha":"list-alpha","sef_tags":"tags","sef_tag":"tag","sef_collections":"collections","sef_collection":"collection","sef_custom_list":"custom-list","sef_advanced_search":"advsearch","sef_search":"search","sef_searchby":"searchby","sef_guest_subscribe":"guest-subscribe","sef_maintenance":"maintenance","sef_listings":"modal-listings","sef_contact":"contact","sef_claim":"claim","sef_compare":"compare","sef_comment_tree":"comment-tree","sef_top_comments":"top-comments","sef_top_listings_latest":"latest-listings","sef_top_listings_featured":"top-featured-listings","sef_top_listings_recent_modified":"recent-modified-listings","sef_top_listings_recent_updated":"recent-updated-listings","sef_top_listings_popular":"popular-listings","sef_top_listings_most_rated":"most-rated-listings","sef_top_listings_top_rated":"top-rated-listings","sef_top_listings_latest_rated":"latest-rated-listings","sef_top_listings_most_commented":"most-commented-listings","sef_top_listings_latest_commented":"latest-commented-listings","sef_top_listings_recently_viewed":"recent-viewed-listings","sef_top_listings_alpha_ordered":"alpha-ordered-listings","sef_top_listings_random":"random-listings","sef_top_listings_random_fast":"random-fast-listings","sef_top_listings_random_featured":"random-featured-listings","sef_add":"add","sef_edit":"edit","sef_delete":"delete","sef_publish":"publish","sef_unpublish":"unpublish","sef_checkin":"checkin","sef_approve":"approve","sef_subscribe":"subscribe","sef_unsubscribe":"unsubscribe","sef_activate_subscription":"activate-subscription","sef_print":"print","sef_download_email_attachment":"download-attachment","sef_remove_compare":"remove-compare","sef_remove_compare_all":"all","sef_redirect_url":"redirect-url","sef_dashboard":"dashboard","sef_profile":"profile","sef_user_listings":"listings","sef_published":"published","sef_unpublished":"unpublished","sef_pending":"pending","sef_user_subscriptions":"subscriptions","sef_user_comments":"comments","sef_mod_listings":"mod-listings","sef_mod_comments":"mod-comments","sef_mod_comment":"mod-comment","sef_mod_pending_listings":"mod-pending-listings","sef_mod_pending_listing":"mod-pending-listing","sef_mod_pending_comments":"mod-pending-comments","sef_mod_pending_comment":"mod-pending-comment","sef_mod_permissions":"mod-permissions","sef_mod_permission":"mod-permission","sef_root_cat":"root","sef_rss":"rss","sef_report":"report","sef_layout":"layout","sef_page":"page-","sef_all":"all","sef_new_listing":"new-listing","sef_comment":"comment","sef_component":"component","sef_file":"file","sef_raw_data":"raw-data","sef_space":"-","rss_display_icon":"1","rss_number_items_in_feed":10,"rss_show_thumbnail":"1","rss_thumbnail_source":"image","rss_thumbnail_alignment":"left","rss_email":"none","load_jquery":"2","load_jquery_ui":"2"}';
     $db = JFactory::getDbo();
     $query = 'UPDATE #__judirectory_categories SET config_params=' . $db->quote($defaultConfig) . ' WHERE id = ' . $rootCat->id;
     $db->setQuery($query);
     if ($db->execute()) {
         $this->setRedirect("index.php?option=com_judirectory&view=globalconfig&layout=edit", JText::_('COM_JUDIRECTORY_GLOBAL_CONFIG_RESET_DEFAULT_SUCCESS'));
     } else {
         $this->setRedirect("index.php?option=com_judirectory&view=globalconfig&layout=edit", JText::_('COM_JUDIRECTORY_GLOBAL_CONFIG_RESET_DEFAULT_FAILED'));
     }
 }
Exemplo n.º 7
0
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     $levelOptions = array();
     $levelOptions[] = JHtml::_('select.option', 1, 1);
     $levelOptions[] = JHtml::_('select.option', 5, 5);
     $levelOptions[] = JHtml::_('select.option', 10, 10);
     $levelOptions[] = JHtml::_('select.option', 15, 15);
     $levelOptions[] = JHtml::_('select.option', 20, 20);
     $levelOptions[] = JHtml::_('select.option', 25, 25);
     $levelOptions[] = JHtml::_('select.option', 30, 30);
     $this->levelOptions = $levelOptions;
     $boolean = array();
     $boolean[] = JHtml::_('select.option', 0, JText::_('JNO'));
     $boolean[] = JHtml::_('select.option', 1, JText::_('JYES'));
     $this->boolean = $boolean;
     $this->layout = $this->getLayout();
     if ($this->layout == 'rebuildrating' || $this->layout == 'resizeimages') {
         $categoryList = $this->get('CategoryList');
         foreach ($categoryList as $key => $value) {
             $categoryList[$key]->id = $value->id;
             $categoryList[$key]->title = '|— ' . $value->title;
         }
         $rootCat = JUDirectoryFrontHelperCategory::getRootCategory();
         array_unshift($categoryList, array('id' => $rootCat->id, 'title' => 'Root'));
         $this->categoryList = $categoryList;
     }
     if ($this->layout == 'rebuildrating') {
         $this->criteriaGroups = $this->get("CriteriaGroups");
     }
     $errors = $app->getUserState("import_file_errors");
     if (isset($errors)) {
         $this->errors = $errors;
         $app->setUserState("import_file_errors", null);
     }
     $this->addToolBar();
     if ($this->getLayout() == "rebuildrating") {
         $app->setUserState("cats", null);
         $app->setUserState('criteria_groups', null);
         $app->setUserState('total_listings', null);
     }
     parent::display($tpl);
     $this->setDocument();
 }
 protected function getInput()
 {
     $fieldgroup_id = $this->form->getValue('id');
     $rootCategory = JUDirectoryFrontHelperCategory::getRootCategory();
     $categoryTree = JUDirectoryHelper::getCategoryTree($rootCategory->id);
     $html = "<div id=\"categoriestoassignfieldgroup\" class=\"categoriestoassignfieldgroup\">";
     if ($this->form->getValue('id') == 1) {
         $html .= '<input type="text" class="readonly" readonly="readonly" value="' . JText::_('JALL') . '"/>';
     } else {
         $select_cat_class = 'select-cat';
         $html .= '<div class="btn-group pull-left">';
         $html .= '<button type="button" class="btn btn-mini" onclick="jQuery(\'.' . $select_cat_class . '\').each(function(el) { jQuery(this).prop(\'checked\', !jQuery(this).is(\':checked\')); });">' . JText::_('JGLOBAL_SELECTION_INVERT') . '</button>';
         $html .= '<button type="button" class="btn btn-mini" onclick="jQuery(\'.' . $select_cat_class . '\').each(function(el) { jQuery(this).prop(\'checked\', false); });">' . JText::_('JGLOBAL_SELECTION_NONE') . '</button>';
         $html .= '<button type="button" class="btn btn-mini" onclick="jQuery(\'.' . $select_cat_class . '\').each(function(el) {  jQuery(this).prop(\'checked\', true); });">' . JText::_('JGLOBAL_SELECTION_ALL') . '</button>';
         $html .= '</div>';
         $html .= "<ul id=\"" . $this->id . "\" class=\"nav\">";
         $html .= "<li>";
         $html .= "<input id=\"catid-" . $rootCategory->id . "\" type=\"checkbox\" value=\"" . $rootCategory->id . "\" disabled=\"true\" />";
         $html .= "<label for=\"catid-" . $rootCategory->id . "\">" . str_repeat('<span class="gi">|—</span>', $rootCategory->level) . $rootCategory->title . "</label>";
         $html .= "</li>";
         foreach ($categoryTree as $category) {
             if ($category->id == $rootCategory->id) {
                 continue;
             }
             $link_edit_fieldgroup = '';
             $html .= "<li>";
             if ($category->selected_fieldgroup == -1 && $category->fieldgroup_id > 0) {
                 $html .= "<span class=\"inherited-value\"  title=\"" . JText::_("COM_JUDIRECTORY_INHERIT") . "\">" . JText::_('COM_JUDIRECTORY_INHERIT') . "</span>";
             } elseif ($category->fieldgroup_id == $fieldgroup_id) {
                 $html .= "<input class =\"" . $select_cat_class . "\" id=\"catid-" . $category->id . "\" type=\"checkbox\" value=\"" . $category->id . "\" checked=\"checked\" name=\"" . $this->name . "[]\"/>";
             } elseif ($category->fieldgroup_id > 0) {
                 $link_edit_fieldgroup = "<span><a href=\"index.php?option=com_judirectory&task=fieldgroup.edit&id=" . $category->fieldgroup_id . "\" title=\"" . $this->getFieldGroupName($category->fieldgroup_id) . "\" >[" . $this->getFieldGroupName($category->fieldgroup_id) . "]</a></span>";
                 $html .= "<input id=\"catid-" . $category->id . "\" type=\"checkbox\" checked=\"checked\" value=\"" . $category->id . "\" disabled=\"true\" />";
             } else {
                 $html .= "<input class =\"" . $select_cat_class . "\" id=\"catid-" . $category->id . "\" type=\"checkbox\" value=\"" . $category->id . "\" name=\"" . $this->name . "[]\"/>";
             }
             $html .= "<label for=\"catid-" . $category->id . "\">" . str_repeat('<span class="gi">|—</span>', $category->level) . $category->title . "</label>";
             $html .= $link_edit_fieldgroup;
             $html .= "</li>";
         }
         $html .= "</ul>";
     }
     $html .= "</div>";
     return $html;
 }
Exemplo n.º 9
0
 public static function getRootPathway()
 {
     $app = JFactory::getApplication();
     $menus = $app->getMenu('site');
     $categoryRoot = JUDirectoryFrontHelperCategory::getRootCategory();
     $needles = array('tree' => array((int) $categoryRoot->id));
     $findMenuTreeRoot = JUDirectoryHelperRoute::findItemId($needles, true);
     $rootPathway = new stdClass();
     if ($findMenuTreeRoot) {
         $menuTreeRoot = $menus->getItem($findMenuTreeRoot);
         $rootPathway->name = $menuTreeRoot->title;
         $rootPathway->link = JRoute::_($menuTreeRoot->link);
     } else {
         $rootPathway->name = html_entity_decode(JText::_('COM_JUDIRECTORY_ROOT'), ENT_COMPAT, 'UTF-8');
         $rootPathway->link = JUDirectoryHelperRoute::getTreeRoute($categoryRoot->id);
     }
     return $rootPathway;
 }
Exemplo n.º 10
0
 public function display($tpl = null)
 {
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     $this->form = $this->get('Form');
     $this->item = $this->get('Item');
     $this->model = $this->getModel();
     $this->app = JFactory::getApplication();
     $cat_id = $this->item->cat_id ? $this->item->cat_id : $this->app->input->get('cat_id');
     $this->params = JUDirectoryHelper::getParams(null, $this->item->id);
     if ($cat_id == JUDirectoryFrontHelperCategory::getRootCategory()->id && !$this->params->get('allow_add_listing_to_root', 0)) {
         JError::raiseError(500, JText::_('COM_JUDIRECTORY_CAN_NOT_ADD_LISTING_TO_ROOT_CATEGORY'));
         return false;
     }
     if ($tempListing = JUDirectoryHelper::getTempListing($this->item->id)) {
         $editPendingListingLink = '<a href="index.php?option=com_judirectory&task=document.edit&approve=1&id=' . $tempListing->id . '">' . $tempListing->title . '</a>';
         JError::raiseNotice('', JText::sprintf('COM_JUDIRECTORY_THIS_LISTING_HAS_PENDING_LISTING_X_PLEASE_APPROVE_PENDING_LISTING_FIRST', $editPendingListingLink));
     }
     if ($this->item->approved < 0) {
         $oriListingId = abs($this->item->approved);
         $oriListingObj = JUDirectoryHelper::getListingById($oriListingId);
         $editOriDocLink = '<a href="index.php?option=com_judirectory&task=document.edit&id=' . $oriListingId . '">' . $oriListingObj->title . '</a>';
         JError::raiseNotice('', JText::sprintf('COM_JUDIRECTORY_ORIGINAL_LISTING_X', $editOriDocLink));
     }
     $this->script = $this->get('Script');
     $this->plugins = $this->get('Plugins');
     $this->fieldLocations = $this->get('FieldLocations');
     $this->fieldsetDetails = $this->model->getCoreFields('details');
     $this->fieldsetPublishing = $this->model->getCoreFields('publishing');
     $this->fieldsetTemplateStyleAndLayout = $this->model->getCoreFields('template_style');
     $this->fieldsetMetadata = $this->model->getCoreFields('metadata');
     $this->fieldCatid = JUDirectoryFrontHelperField::getField('cat_id', $this->item);
     $this->fieldGallery = $this->get('GalleryField');
     $this->extraFields = $this->get('ExtraFields');
     $this->fieldsData = $this->app->getUserState("com_judirectory.edit.listing.fieldsdata", array());
     $this->relatedListings = $this->get('RelatedListings');
     $this->canDo = JUDirectoryHelper::getActions('com_judirectory', 'category', $this->item->cat_id);
     $this->addToolBar();
     $this->setDocument();
     parent::display($tpl);
 }
Exemplo n.º 11
0
 public function display($tpl = null)
 {
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     $app = JFactory::getApplication();
     $rootCat = JUDirectoryFrontHelperCategory::getRootCategory();
     $fastAddError = $app->getUserState('com_judirectory.categories.fastadderror');
     $fastAddSuccess = $app->getUserState('com_judirectory.categories.fastaddsuccess');
     $this->cat_id = $app->input->getInt('cat_id', $rootCat->id);
     $this->params = JUDirectoryHelper::getParams($this->cat_id);
     $this->canDoCat = JUDirectoryHelper::getActions('com_judirectory', 'category', $this->cat_id);
     $this->rootCat = JUDirectoryFrontHelperCategory::getRootCategory();
     $this->allowAddListing = $this->params->get('allow_add_listing_to_root', 0) && $this->cat_id == $this->rootCat->id || $this->cat_id != $this->rootCat->id;
     $this->listingGroupCanDoManage = $this->groupCanDoCatManage = JUDirectoryHelper::checkGroupPermission("listing.edit");
     $this->listingGroupCanDoDelete = $this->groupCanDoCatDelete = JUDirectoryHelper::checkGroupPermission("listings.delete");
     $this->catGroupCanDoManage = $this->groupCanDoCatManage = JUDirectoryHelper::checkGroupPermission("category.edit");
     $this->catGroupCanDoDelete = $this->groupCanDoCatDelete = JUDirectoryHelper::checkGroupPermission("categories.delete");
     //
     if ($fastAddSuccess) {
         $app->enqueueMessage($fastAddSuccess);
         $app->setUserState('com_judirectory.categories.fastaddsuccess', '');
     }
     if ($fastAddError) {
         $app->enqueueMessage($fastAddError, 'error');
         $app->setUserState('com_judirectory.categories.fastadderror', '');
     }
     $this->pagination = $this->get('Pagination');
     $this->state = $this->get('State');
     $this->items = $this->get('Items');
     $this->model = $this->getModel();
     $this->addToolBar();
     $this->setDocument();
     parent::display($tpl);
 }
Exemplo n.º 12
0
 public static function getParams($catId = null, $listingId = null)
 {
     // If set listingId but don't set catId -> get catId by listingId
     if (!$catId && $listingId) {
         $listingObj = self::getListingById($listingId);
         if ($listingObj) {
             $catId = $listingObj->cat_id;
         }
     }
     // Only override if cat existed, override by params of top level cat
     // Find the top level category, assign to $catId if top level cat is found
     if ($catId) {
         $path = self::getCategoryPath($catId);
         $rootCat = $path[0];
     } else {
         $rootCat = JUDirectoryFrontHelperCategory::getRootCategory();
     }
     $catIdToGetParams = $rootCat->id;
     // Cache by catId
     $storeId = md5(__METHOD__ . "::{$catIdToGetParams}");
     // Set params by top level catId(or root) if it has not already set
     if (!isset(self::$cache[$storeId])) {
         // Get global config params(of root cat) by default
         $registry = new JRegistry();
         $registry->loadString($rootCat->config_params);
         // Override params from active menu if is a menu of component(Use merge to ignore empty string and null param value)
         $app = JFactory::getApplication();
         $activeMenu = $app->getMenu()->getActive();
         if ($activeMenu && $activeMenu->component == 'com_judirectory') {
             $registry->merge($activeMenu->params);
         }
         self::$cache[$storeId] = $registry;
     }
     return self::$cache[$storeId];
 }
Exemplo n.º 13
0
 protected function getListQuery()
 {
     $app = JFactory::getApplication();
     $rootCategory = JUDirectoryFrontHelperCategory::getRootCategory();
     $categoryId = $this->getState('category.id', $rootCategory->id);
     $getAllNestedCategories = $app->input->getInt('all', 0);
     $catFilter = true;
     if ($categoryId == 1 && $getAllNestedCategories == 1) {
         $catFilter = false;
     }
     if ($catFilter) {
         $categoryIdArray = array();
         if ($getAllNestedCategories == 1) {
             $nestedCategories = JUDirectoryFrontHelperCategory::getCategoriesRecursive($categoryId, true, true);
             if (count($nestedCategories) > 0) {
                 foreach ($nestedCategories as $categoryObj) {
                     $categoryIdArray[] = $categoryObj->id;
                 }
             }
         }
         array_unshift($categoryIdArray, $categoryId);
         $categoryString = implode(",", $categoryIdArray);
     }
     $ordering = $this->getState('list.ordering', '');
     $direction = $this->getState('list.direction', 'ASC');
     $user = JFactory::getUser();
     $levels = $user->getAuthorisedViewLevels();
     $levelsStr = implode(',', $levels);
     $db = JFactory::getDbo();
     $nullDate = $db->getNullDate();
     $nowDate = JFactory::getDate()->toSql();
     $query = $db->getQuery(true);
     $query->select('listing.*');
     $query->from('#__judirectory_listings AS listing');
     JUDirectoryFrontHelper::optimizeListListingQuery($query);
     if ($catFilter) {
         $query->join('', '#__judirectory_listings_xref AS listingxref ON listing.id = listingxref.listing_id');
         $query->join('', '#__judirectory_categories AS c ON c.id = listingxref.cat_id');
         $query->where('c.id IN(' . $categoryString . ')');
         $query->group('listing.id');
     }
     $query->where('listing.approved = 1');
     $query->where('listing.published = 1');
     $query->where('(listing.publish_up = ' . $db->quote($nullDate) . ' OR listing.publish_up <= ' . $db->quote($nowDate) . ')');
     $query->where('(listing.publish_down = ' . $db->quote($nullDate) . ' OR listing.publish_down >= ' . $db->quote($nowDate) . ')');
     if ($user->get('guest')) {
         $query->where('listing.access IN (' . $levelsStr . ')');
     } else {
         $query->where('(listing.access IN (' . $levelsStr . ') OR (listing.created_by = ' . $user->id . '))');
     }
     $query->where('listing.featured = 1');
     $app = JFactory::getApplication();
     $tag = JFactory::getLanguage()->getTag();
     if ($app->getLanguageFilter()) {
         $query->where('listing.language IN (' . $db->quote($tag) . ',' . $db->quote('*') . ',' . $db->quote('') . ')');
     }
     $categoryRoot = JUDirectoryFrontHelperCategory::getRootCategory();
     JUDirectoryFrontHelperField::appendFieldOrderingPriority($query, $categoryRoot->id, $ordering, $direction);
     return $query;
 }
Exemplo n.º 14
0
 public static function getCurrentTemplateStyle($view = '', $id = null)
 {
     $app = JFactory::getApplication();
     $jInput = $app->input;
     if (!$view) {
         $view = $jInput->getString('view', '');
     }
     if ($jInput->getString('option', '') != 'com_judirectory') {
         $view = '';
     }
     if (!$id) {
         switch ($view) {
             case 'form':
                 $id = $jInput->getInt('id', 0);
                 $rootCategory = JUDirectoryFrontHelperCategory::getRootCategory();
                 $cat_id = $jInput->getInt('cat_id', $rootCategory->id);
                 break;
             case 'listing':
                 $id = $jInput->getInt('id', 0);
                 break;
             case 'category':
                 $rootCategory = JUDirectoryFrontHelperCategory::getRootCategory();
                 $id = $jInput->getInt('id', $rootCategory->id);
                 break;
         }
     }
     switch ($view) {
         case 'form':
             if ($id) {
                 $templateStyleObject = self::getTemplateStyleOfListing($id);
                 $listingObject = JUDirectoryHelper::getListingById($id);
                 $templateStyleObject->params = self::getTemplateStyleParams($templateStyleObject->id, $listingObject->template_params);
             } else {
                 $templateStyleObject = self::getTemplateStyleOfCategory($cat_id);
                 $categoryObject = JUDirectoryHelper::getCategoryById($cat_id);
                 $templateStyleObject->params = self::getTemplateStyleParams($templateStyleObject->id, $categoryObject->template_params);
             }
             break;
         case 'listing':
             $templateStyleObject = self::getTemplateStyleOfListing($id);
             $listingObject = JUDirectoryHelper::getListingById($id);
             $templateStyleObject->params = self::getTemplateStyleParams($templateStyleObject->id, $listingObject->template_params);
             break;
         case 'category':
             $templateStyleObject = self::getTemplateStyleOfCategory($id);
             $categoryObject = JUDirectoryHelper::getCategoryById($id);
             $templateStyleObject->params = self::getTemplateStyleParams($templateStyleObject->id, $categoryObject->template_params);
             break;
         default:
             $templateStyleObject = self::getDefaultTemplateStyle();
             $templateStyleObject->params = self::getTemplateStyleParams($templateStyleObject->id);
             break;
     }
     return $templateStyleObject;
 }
Exemplo n.º 15
0
    protected function getInput()
    {
        $document = JFactory::getDocument();
        $db = JFactory::getDbo();
        $query = $db->getQuery(true);
        $query->select('cat_id_related');
        $query->from('#__judirectory_categories_relations');
        $query->where('cat_id = ' . (int) $this->form->getValue('id'));
        $query->order("ordering ASC");
        $db->setQuery($query);
        $relcategories = $db->loadColumn();
        $script = '
		jQuery(document).ready(function($){
			$(".category_list").dragsort({ dragSelector: "li", dragEnd: saveOrder, placeHolderTemplate: "<li class=\'placeHolder\'></li>", dragSelectorExclude: "input, textarea, span, a.removeitem"});

            function saveOrder() {
                var data = $("#gallery li").map(function() { return $(this).data("itemid"); }).get();
            };

			$(".category_list").on("click","a.removeitem", function(event){
				event.preventDefault();
				$(this).closest("li").remove();
			});

			$(".browse_cat").bind("dblclick",function(){
				var id = $(this).find("option:selected").val();
				$.ajax({
			  		type: "POST",
			  		url:"index.php?option=com_judirectory&task=categories.loadcategories",
			  		data: {id : id, type : "category"}
				}).done(function(data){
					data = $.parseJSON(data);
					$(".browse_cat").html(data.html);
					$(".active_pathway").html(data.path);
				});
			});

			$(".change_categories").click(function(){
				$(".category_selection").slideToggle(400);
			});

			$("#add_related_categories").click(function(event){
    			event.preventDefault();
    			var has_element = [];
				var current_cat = ' . JFactory::getApplication()->input->get('id', 0) . ';
				$.each( $("option:selected",".browse_cat"), function(key, value ) {
					if($(this).data("noselect")){
						return;
					}

					var selectedValue = $(this).val();
					var selectedText = $(this).text();

  					if(current_cat == selectedValue){
						alert("' . JText::_('COM_JUDIRECTORY_CAN_NOT_ADD_CATEGORY_ITSELF_AS_RELATED_CATEGORY') . '");
						return;
					}
  					if($(".category_list > li[id=\'category-"+selectedValue+"\']").length <= 0){
  						var path = $(".active_pathway").text() + " > " + selectedText;
  						$("<li id=\\"category-"+selectedValue+"\\"><a class=\\"drag-icon\\"></a><span>"+path+"</span><input type=\\"hidden\\" name=\\"relcategories[]\\" value=\\""+selectedValue+"\\" /> <a href=\\"#\\" class=\\"removeitem\\" ><i class=\\"icon-minus\\"></i> ' . JText::_('COM_JUDIRECTORY_REMOVE') . '</a></li>").appendTo(".category_list");
   					}else{
  						has_element.push(selectedText);
  					}
				});

                if(has_element.length == 1){
                    alert("' . JText::_('COM_JUDIRECTORY_CATEGORY_X_ALREADY_EXISTED') . '".replace("%s", has_element[0]));
				}else if(has_element.length > 1){
				    alert("' . JText::_('COM_JUDIRECTORY_CATEGORIES_X_ALREADY_EXISTED') . '".replace("%s", has_element.join(", ")));
				}
				return false;
			});
		});';
        $document->addScriptDeclaration($script);
        $html = "";
        $html .= "<div class=\"categories\">";
        $html .= "<ul class=\"category_list nav clearfix\">";
        if ($relcategories) {
            foreach ($relcategories as $key => $relcategory) {
                $path = JUDirectoryHelper::generateCategoryPath($relcategory);
                $html .= '<li id="category-' . $relcategory . '">';
                $html .= '<a class="drag-icon"></a>';
                $html .= '<span>' . $path . '</span>';
                $html .= '<input type="hidden" name="relcategories[]" value="' . $relcategory . '" />';
                $html .= '<a class="removeitem" href="#"><i class="icon-minus"></i> ' . JText::_('COM_JUDIRECTORY_REMOVE') . '</a>';
                $html .= "</li>";
            }
        }
        $html .= '</ul>';
        $catId = $this->form->getValue('id', 0);
        $catParentId = !$catId ? JUDirectoryFrontHelperCategory::getRootCategory()->id : JUDirectoryHelper::getCategoryByID($catId)->parent_id;
        $query = $db->getQuery(true);
        $query->SELECT('title, id, published, parent_id');
        $query->FROM('#__judirectory_categories');
        $query->WHERE('parent_id = ' . $catParentId);
        $query->ORDER('lft');
        $db->setQuery($query);
        $categoryList = $db->loadObjectList();
        foreach ($categoryList as $key => $cat) {
            if ($cat->published != 1) {
                $cat->title = "[" . $cat->title . "]";
            }
        }
        if ($catParentId != 0) {
            $catParent = JUDirectoryHelper::getCategoryByID($catParentId);
            array_unshift($categoryList, JHtml::_('select.option', $catParent->parent_id, JText::_('COM_JUDIRECTORY_BACK_TO_PARENT_CATEGORY'), 'id', 'title'));
        }
        $html .= "<a href='#' class='change_categories' onclick='return false;'><i class=\"icon-folder\"></i> " . JText::_('COM_JUDIRECTORY_ADD_RELATED_CATEGORIES') . "</a>";
        $html .= '<div class="category_selection" style="display: none;">';
        $html .= '<div class="active_pathway">' . JUDirectoryHelper::generateCategoryPath($catParentId, 'li') . '</div>';
        $html .= JHtml::_('select.genericlist', $categoryList, 'browse_cat', 'class="inputbox browse_cat" multiple="multiple" size="8"', 'id', 'title', '', "");
        $html .= '<div class="cat_action clearfix">';
        $html .= "<button id='add_related_categories' class='btn btn-mini btn-primary'>" . JText::_('COM_JUDIRECTORY_ADD_RELATED_CATEGORIES') . "</button>";
        $html .= "<input type='hidden' name='cat_id_related' id='cat_id_related' value='" . $this->value . "' />";
        $html .= "</div>";
        $html .= "</div>";
        $html .= '</div>';
        return $html;
    }
Exemplo n.º 16
0
 public static function getCurrentCatId()
 {
     $app = JFactory::getApplication();
     $option = $app->input->getString('option', '');
     $view = $app->input->getString('view', '');
     $catId = JUDirectoryFrontHelperCategory::getRootCategory()->id;
     if ($option == 'com_judirectory' && $view) {
         if ($view == 'listing') {
             $listingId = $app->input->getInt('id', 0);
             if ($listingId > 0) {
                 $catId = JUDirectoryFrontHelperCategory::getMainCategoryId($listingId);
             }
         } elseif ($view == 'category' || $view == 'categories') {
             $catId = $app->input->getInt('id', 0);
         }
     }
     return $catId;
 }
Exemplo n.º 17
0
 protected function getAllCategoryOptions()
 {
     $rootCat = JUDirectoryFrontHelperCategory::getRootCategory();
     JTable::addIncludePath(JPATH_ADMINISTRATOR . "/components/com_judirectory/tables");
     $categoryTable = JTable::getInstance('Category', 'JUDirectoryTable');
     $categoryTree = $categoryTable->getTree($rootCat->id);
     foreach ($categoryTree as $key => $cat) {
         $canSubmitListing = JUDirectoryFrontHelperPermission::canSubmitListing($cat->id);
         // Unset category that user can not submit listing
         if (!$canSubmitListing) {
             unset($categoryTree[$key]);
             continue;
         }
         // Unpublished category wrap by []
         if ($cat->published != 1) {
             $categoryTree[$key]->title = "[" . $cat->title . "]";
         }
         $categoryTree[$key]->title = str_repeat('|—', $cat->level) . $categoryTree[$key]->title;
     }
     // getParams by cat_id if possible
     if (isset($this->listing) && $this->listing->cat_id) {
         $params = JUDirectoryHelper::getParams($this->listing->cat_id);
     } else {
         $params = JUDirectoryHelper::getParams(null, $this->listing_id);
     }
     if ($params->get('allow_add_listing_to_root', 0)) {
         array_unshift($categoryTree, JHtml::_('select.option', $rootCat->id, JText::_('COM_JUDIRECTORY_ROOT'), 'id', 'title'));
     }
     return $categoryTree;
 }
Exemplo n.º 18
0
 public function getListingsForRating(array $cats, array $criteriaGroups, $limit, $start)
 {
     $listingsCats = array();
     $db = $this->getDbo();
     $rootCat = JUDirectoryFrontHelperCategory::getRootCategory();
     $query = $db->getQuery(true);
     $query->select('id');
     $query->from('#__judirectory_criterias_groups');
     $query->where('published != 1');
     $db->setQuery($query);
     $criteriaGroupsUnpublished = $db->loadColumn();
     if (empty($cats[0]) || in_array($rootCat->id, $cats)) {
         $query = $db->getQuery(true);
         $query->select('id AS cat_id, parent_id, lft, rgt, level, selected_criteriagroup');
         $query->from('#__judirectory_categories');
         if (!empty($criteriaGroups) && !empty($criteriaGroups[0])) {
             $query->where('criteriagroup_id IN (' . implode(',', $criteriaGroups) . ')');
         }
         if (!empty($criteriaGroupsUnpublished)) {
             $query->where('criteriagroup_id NOT IN (' . implode(',', $criteriaGroupsUnpublished) . ')');
         }
         $db->setQuery($query);
         $groupCats = $db->loadObjectList();
         if (!empty($groupCats)) {
             foreach ($groupCats as $group) {
                 $listingsCats[] = $group->cat_id;
             }
         }
     } else {
         foreach ($cats as $cat) {
             $query = $db->getQuery(true);
             $query->select('lft, rgt');
             $query->from('#__judirectory_categories');
             $query->where('id = ' . $cat);
             $db->setQuery($query);
             $left_rigth = $db->loadObject();
             if ($left_rigth) {
                 $query = $db->getQuery(true);
                 $query->select('id');
                 $query->from('#__judirectory_categories');
                 $query->where('lft >= ' . $left_rigth->lft);
                 $query->where('rgt <= ' . $left_rigth->rgt);
                 if (!empty($criteriaGroups) && !empty($criteriaGroups[0])) {
                     $query->where('criteriagroup_id IN (' . implode(',', $criteriaGroups) . ')');
                 }
                 if (!empty($criteriaGroupsUnpublished)) {
                     $query->where('criteriagroup_id NOT IN (' . implode(',', $criteriaGroupsUnpublished) . ')');
                 }
                 $db->setQuery($query);
                 $subCats = $db->loadColumn();
                 if (!empty($subCats)) {
                     $listingsCats = array_merge($listingsCats, $subCats);
                 }
             }
         }
     }
     if (!empty($listingsCats)) {
         $query = "SELECT listing_id FROM #__judirectory_listings_xref WHERE cat_id IN (" . implode(',', $listingsCats) . ") ORDER BY listing_id";
         if ($start == 0) {
             $db->setQuery($query);
             $allListings = $db->loadColumn();
             $app = JFactory::getApplication();
             $app->setUserState('total_listings', count($allListings));
         }
         $query .= " LIMIT {$start},{$limit}";
         $db->setQuery($query);
         $listingIds = $db->loadColumn();
         return $listingIds;
     } else {
         return array();
     }
 }
Exemplo n.º 19
0
 public function delete()
 {
     $app = JFactory::getApplication();
     $listingid = $app->input->post->get('listingid', array(), 'array');
     $app->input->set('cid', $listingid);
     $_POST['cid'] = $listingid;
     $rootCat = JUDirectoryFrontHelperCategory::getRootCategory();
     $cat_id = $app->input->getInt('cat_id', $rootCat->id);
     parent::delete();
     $this->setRedirect("index.php?option=com_judirectory&view={$this->view_list}&cat_id={$cat_id}");
 }
Exemplo n.º 20
0
 public static function appendFieldOrderingPriority(&$query = null, $catIds = null, $ordering = null, $direction = null)
 {
     if (!$catIds) {
         $catIds = JUDirectoryFrontHelperCategory::getRootCategory()->id;
     }
     $storeId = md5(__METHOD__ . "::" . serialize($catIds) . "::{$ordering}");
     if (!isset(self::$cache[$storeId])) {
         $db = JFactory::getDbo();
         $nullDate = $db->getNullDate();
         $nowDate = JFactory::getDate()->toSql();
         $priority_query = $db->getQuery(true);
         $priority_query->select("field.*");
         $priority_query->from("#__judirectory_fields AS field");
         $priority_query->select("plg.folder");
         $priority_query->join("", "#__judirectory_plugins AS plg ON field.plugin_id = plg.id ");
         $priority_query->join("", "#__judirectory_fields_groups AS field_group ON field.group_id = field_group.id");
         $priority_query->join("", "#__judirectory_categories AS c ON (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tc.fieldgroup_id = field_group.id AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tc.published = 1 AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tc.publish_up <= " . $db->quote($nowDate) . " AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(c.publish_down = " . $db->quote($nullDate) . " OR c.publish_down > " . $db->quote($nowDate) . ")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t) OR field.group_id = 1\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t )");
         $where = array();
         $where[] = 'field.published = 1';
         $where[] = 'field.publish_up <= ' . $db->quote($nowDate);
         $where[] = '(field.publish_down = ' . $db->quote($nullDate) . ' OR field.publish_down > ' . $db->quote($nowDate) . ')';
         if (is_array($catIds)) {
             $where[] = "(c.id IN (" . implode(",", $catIds) . ") OR field.group_id = 1)";
         } else {
             $where[] = "(c.id = {$catIds} OR field.group_id = 1)";
         }
         $where[] = 'field.allow_priority = 1';
         $where[] = 'field_group.published = 1';
         $priority_query->where("(" . implode(" AND ", $where) . ")", "OR");
         if ($ordering) {
             $where = array();
             $where[] = "field.id = '{$ordering}'";
             $app = JFactory::getApplication();
             if ($app->isSite()) {
                 $where[] = "field.frontend_ordering = 1";
             } else {
                 $where[] = "field.backend_list_view >= 1";
             }
             $where[] = "field.published = 1";
             $where[] = "field.publish_up <= " . $db->quote($nowDate);
             $where[] = "(field.publish_down = " . $db->quote($nullDate) . " OR field.publish_down >= " . $db->quote($nowDate) . ")";
             $priority_query->where("(" . implode(" AND ", $where) . ")", "OR");
         }
         $priority_query->group('field.id');
         $priority_query->order('field.priority ASC');
         $db->setQuery($priority_query);
         self::$cache[$storeId] = $db->loadObjectList();
     }
     $priorityFields = self::$cache[$storeId];
     $priority_order = array();
     $_ordering = "";
     foreach ($priorityFields as $priorityField) {
         $field = JUDirectoryFrontHelperField::getField($priorityField);
         if ($field) {
             $priority = $field->orderingPriority($query);
             if ($ordering && $field->id == $ordering && $priority) {
                 $_ordering = $priority['ordering'];
             } elseif ($priority) {
                 $priority_order[] = $priority['ordering'] . ' ' . $priority['direction'];
             }
         }
     }
     $priority_str = "";
     if ($priority_order) {
         $priority_str = implode(", ", $priority_order);
     }
     if ($_ordering) {
         $ordering_str = $_ordering . " " . $direction;
         if ($priority_str) {
             $priority_str = $ordering_str . ", " . $priority_str;
         }
     }
     if ($priority_str) {
         $query->order($priority_str);
     }
     return $priority_str;
 }
Exemplo n.º 21
0
 * ------------------------------------------------------------------------
 *
 * @copyright      Copyright (C) 2010-2015 JoomUltra Co., Ltd. All Rights Reserved.
 * @license        GNU General Public License version 2 or later; see LICENSE.txt
 * @author         JoomUltra Co., Ltd
 * @website        http://www.joomultra.com
 * @----------------------------------------------------------------------@
 */
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
JHtml::_('behavior.modal');
$app = JFactory::getApplication();
$db = JFactory::getDbo();
$user = JFactory::getUser();
$userId = $user->id;
$rootCat = JUDirectoryFrontHelperCategory::getRootCategory();
$cat_id = $app->input->getInt('cat_id', $rootCat->id);
$listOrder_cat = $this->escape($this->state->get('filter.ordering_cat'));
$listDirn_cat = $this->escape($this->state->get('filter.direction_cat'));
$search_cat = $this->escape($this->state->get('filter.search_cat'));
$saveOrder_cat = $listOrder_cat == 'lft' && $this->canDoCat->get('judir.category.edit.state');
$model = $this->getModel();
$list_cat = $model->getListCategory($cat_id, $listOrder_cat, $listDirn_cat);
$ordering = $listOrder_cat == 'lft';
$this->ordering = array();
$intro_image_path = JUri::root(true) . "/" . JUDirectoryFrontHelper::getDirectory("category_intro_image_directory", "media/com_judirectory/images/category/intro/");
$detail_image_path = JUri::root(true) . "/" . JUDirectoryFrontHelper::getDirectory("category_detail_image_directory", "media/com_judirectory/images/category/detail/");
foreach ($list_cat as $cat) {
    $this->ordering[] = $cat->id;
}
$originalOrders = array();
Exemplo n.º 22
0
 public function display($tpl = null)
 {
     $model = $this->getModel();
     $this->model = $model;
     $this->state = $this->get('State');
     $params = $this->state->params;
     $this->params = $params;
     $this->token = JSession::getFormToken();
     $this->root_category = JUDirectoryFrontHelperCategory::getRootCategory();
     $categoryId = $this->state->get('category.id', $this->root_category->id);
     if (count($errors = $this->get('Errors'))) {
         JError::raiseWarning(500, implode("\n", $errors));
         return false;
     }
     $error = array();
     if (!JUDirectoryFrontHelperPermission::canDoCategory($categoryId, true, $error)) {
         $user = JFactory::getUser();
         if ($user->id) {
             return JError::raiseError($error['code'], $error['message']);
         } else {
             $uri = JUri::getInstance();
             $loginUrl = JRoute::_('index.php?option=com_users&view=login&return=' . base64_encode($uri), false);
             $app = JFactory::getApplication();
             $app->redirect($loginUrl, JText::_('COM_JUDIRECTORY_YOU_ARE_NOT_AUTHORIZED_TO_ACCESS_THIS_PAGE'), 'warning');
             return false;
         }
     }
     $topLevelCats = JUDirectoryHelper::getCatsByLevel(1, $categoryId);
     if (is_array($topLevelCats) && count($topLevelCats) > 0) {
         $this->tl_catid = $topLevelCats[0]->id;
     }
     $this->category = JUDirectoryFrontHelperCategory::getCategory($categoryId);
     $this->show_feed = JUDIRPROVERSION ? $this->params->get('rss_display_icon', 1) : 0;
     $this->rss_link = JRoute::_(JUDirectoryHelperRoute::getCategoryRoute($this->category->id, null, true));
     if (isset($this->category->images) && !empty($this->category->images) && !empty($this->category->images->detail_image)) {
         $this->category->images->detail_image_src = JUri::root(true) . '/' . JUDirectoryFrontHelper::getDirectory('category_detail_image_directory', 'media/com_judirectory/images/category/detail/', true) . $this->category->images->detail_image;
     }
     $this->category->images->detail_image_width = (int) $this->params->get('category_image_width', 200);
     $this->category->images->detail_image_height = (int) $this->params->get('category_image_height', 200);
     if ($this->params->get('category_show_description', 1)) {
         $this->category->description = $this->category->introtext . $this->category->fulltext;
     } else {
         $this->category->description = $this->category->fulltext;
     }
     $categoryDescLimit = (int) $this->params->get('category_desc_limit', 0);
     if ($categoryDescLimit > 0) {
         $this->category->description = JUDirectoryFrontHelperString::truncateHtml($this->category->description, $categoryDescLimit);
     }
     if ($this->params->get('plugin_support', 0)) {
         $this->category->description = JHtml::_('content.prepare', $this->category->description, '', 'com_judirectory.category');
     }
     $this->category->class_sfx = htmlspecialchars($this->category->class_sfx);
     $relatedCatOrdering = $this->params->get('related_category_ordering', 'crel.ordering');
     $relatedCatDirection = $this->params->get('related_category_direction', 'ASC');
     $this->related_cats = $model->getRelatedCategories($this->category->id, $relatedCatOrdering, $relatedCatDirection);
     if (is_array($this->related_cats) && count($this->related_cats) > 0) {
         foreach ($this->related_cats as $relatedCategory) {
             if (isset($relatedCategory->images->intro_image) && !empty($relatedCategory->images->intro_image)) {
                 $relatedCategory->images->intro_image_src = JUri::root(true) . '/' . JUDirectoryFrontHelper::getDirectory('category_intro_image_directory', 'media/com_judirectory/images/category/intro/', true) . $relatedCategory->images->intro_image;
             }
             $relatedCategory->images->intro_image_width = (int) $this->params->get('related_category_intro_image_width', 200);
             $relatedCategory->images->intro_image_height = (int) $this->params->get('related_category_intro_image_height', 200);
             if ($this->params->get('related_category_show_introtext', 1)) {
                 $relatedCategoryDescLimit = (int) $this->params->get('related_category_introtext_character_limit', 500);
                 if ($relatedCategoryDescLimit > 0) {
                     $relatedCategory->introtext = JUDirectoryFrontHelperString::truncateHtml($relatedCategory->introtext, $relatedCategoryDescLimit);
                 }
                 if ($params->get('plugin_support', 0)) {
                     $relatedCategory->introtext = JHtml::_('content.prepare', $relatedCategory->introtext, '', 'com_judirectory.category');
                 }
             } else {
                 $relatedCategory->introtext = '';
             }
         }
     }
     $subCatOrdering = $this->params->get('subcategory_ordering', 'title');
     $subCatDirection = $this->params->get('subcategory_direction', 'ASC');
     $this->subcategories = $model->getSubCategories($this->category->id, $subCatOrdering, $subCatDirection);
     if (is_array($this->subcategories) && count($this->subcategories) > 0) {
         foreach ($this->subcategories as $subCategory) {
             if (isset($subCategory->images->intro_image) && !empty($subCategory->images->intro_image)) {
                 $subCategory->images->intro_image_src = JUri::root(true) . '/' . JUDirectoryFrontHelper::getDirectory('category_intro_image_directory', 'media/com_judirectory/images/category/intro/', true) . $subCategory->images->intro_image;
             }
             $subCategory->images->intro_image_width = (int) $this->params->get('subcategory_intro_image_width', 200);
             $subCategory->images->intro_image_height = (int) $this->params->get('subcategory_intro_image_height', 200);
             if ($this->params->get('subcategory_show_introtext', 1)) {
                 $subCategoryDescLimit = (int) $this->params->get('subcategory_introtext_character_limit', 500);
                 if ($subCategoryDescLimit > 0) {
                     $subCategory->introtext = JUDirectoryFrontHelperString::truncateHtml($subCategory->introtext, $subCategoryDescLimit);
                 }
                 if ($this->params->get('plugin_support', 0)) {
                     $subCategory->introtext = JHtml::_('content.prepare', $subCategory->introtext, '', 'com_judirectory.category');
                 }
             } else {
                 $subCategory->introtext = '';
             }
         }
     }
     $this->category->can_submit_listing = JUDirectoryFrontHelperPermission::canSubmitListing($this->category->id);
     if ($this->category->can_submit_listing && $this->params->get('show_submit_listing_btn_in_category', 1)) {
         $this->category->submit_listing_link = JUDirectoryFrontHelperListing::getAddListingLink($this->category->id);
     }
     $this->items = array();
     if ($this->category->show_item) {
         $user = JFactory::getUser();
         $uri = JUri::getInstance();
         $this->items = $this->get('Items');
         foreach ($this->items as $item) {
             $item->report_link = JRoute::_(JUDirectoryHelperRoute::getReportListingRoute($item->id));
             $item->claim_link = JRoute::_(JUDirectoryHelperRoute::getClaimListingRoute($item->id));
             if ($item->checked_out > 0 && $item->checked_out != $user->get('id')) {
                 if (JUDirectoryFrontHelperPermission::canCheckInListing($item->id)) {
                     $item->checkin_link = JRoute::_('index.php?option=com_judirectory&task=forms.checkin&id=' . $item->id . '&' . JSession::getFormToken() . '=1' . '&return=' . base64_encode(urlencode($uri)));
                 }
             } else {
                 $item->edit_link = JRoute::_('index.php?option=com_judirectory&task=form.edit&id=' . $item->id . '&Itemid=' . JUDirectoryHelperRoute::findItemIdOfListing($item->id));
                 if ($item->published == 1) {
                     $item->editstate_link = JRoute::_('index.php?option=com_judirectory&task=forms.unpublish&id=' . $item->id . '&return=' . base64_encode(urlencode($uri)) . '&' . JSession::getFormToken() . '=1&Itemid=' . JUDirectoryHelperRoute::findItemIdOfListing($item->id));
                 } else {
                     $item->editstate_link = JRoute::_('index.php?option=com_judirectory&task=forms.publish&id=' . $item->id . '&return=' . base64_encode(urlencode($uri)) . '&' . JSession::getFormToken() . '=1&Itemid=' . JUDirectoryHelperRoute::findItemIdOfListing($item->id));
                 }
             }
             $item->delete_link = JRoute::_('index.php?option=com_judirectory&task=forms.delete&id=' . $item->id . '&return=' . base64_encode(urlencode($uri)) . '&' . JSession::getFormToken() . '=1&Itemid=' . JUDirectoryHelperRoute::findItemIdOfListing($item->id));
             $dispatcher = JDispatcher::getInstance();
             JPluginHelper::importPlugin('content');
             $item->event = new stdClass();
             $context = 'com_judirectory.listing_list';
             $results = $dispatcher->trigger('onContentAfterTitle', array($context, &$item, &$item->params, 0));
             $item->event->afterDisplayTitle = trim(implode("\n", $results));
             $results = $dispatcher->trigger('onContentBeforeDisplay', array($context, &$item, &$item->params, 0));
             $item->event->beforeDisplayContent = trim(implode("\n", $results));
             $results = $dispatcher->trigger('onContentAfterDisplay', array($context, &$item, &$item->params, 0));
             $item->event->afterDisplayContent = trim(implode("\n", $results));
         }
         $this->pagination = $this->get('Pagination');
         //print_r($this->pagination);
     }
     $this->locations = JUDirectoryFrontHelper::getLocations($this->items);
     //print_r($this->locations);
     $this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx'));
     $this->_prepareData();
     $this->_prepareDocument();
     $this->_setBreadcrumb();
     parent::display($tpl);
 }
Exemplo n.º 23
0
 public function parse(&$segments)
 {
     $total = count($segments);
     $vars = array();
     for ($i = 0; $i < $total; $i++) {
         $segments[$i] = preg_replace('/:/', '-', $segments[$i], 1);
     }
     $params = JUDirectoryHelper::getParams();
     $app = JFactory::getApplication('site');
     $menu = $app->getMenu();
     $activeMenu = $menu->getActive();
     $indexLastSegment = $total - 1;
     $endSegment = end($segments);
     $searchViewApproveComment = array_search(JApplication::stringURLSafe('mod-comment'), $segments);
     if ($searchViewApproveComment !== false) {
         $vars['view'] = 'modcomment';
         if (isset($segments[$searchViewApproveComment + 1])) {
             $vars['id'] = (int) $segments[$searchViewApproveComment + 1];
         }
         if (isset($segments[$searchViewApproveComment + 2])) {
             if ($segments[$searchViewApproveComment + 2] == JApplication::stringURLSafe('approve')) {
                 $vars['approve'] = 1;
             }
         }
         $previousIndexSegment = $total - 1;
         if (isset($segments[$previousIndexSegment])) {
             $isLayout = JUDirectoryHelperRoute::parseLayout($segments[$previousIndexSegment], $vars, $params);
             if ($isLayout) {
                 $previousIndexSegment -= 1;
             }
         }
         return $vars;
     }
     if (isset($segments[0]) && $segments[0] == JApplication::stringURLSafe('comment')) {
         if (isset($segments[2])) {
             switch ($segments[2]) {
                 case JApplication::stringURLSafe('edit'):
                     $vars['task'] = 'modcomment.edit';
                     if (isset($segments[1])) {
                         $vars['id'] = (int) $segments[1];
                     }
                     break;
                 case JApplication::stringURLSafe('approve'):
                     $vars['task'] = 'modpendingcomment.edit';
                     if (isset($segments[1])) {
                         $vars['id'] = (int) $segments[1];
                     }
                     break;
                 case JApplication::stringURLSafe('subscribe'):
                     $vars['task'] = 'subscribe.save';
                     if (isset($segments[1])) {
                         $vars['comment_id'] = (int) $segments[1];
                     }
                     break;
                 case JApplication::stringURLSafe('unsubscribe'):
                     $vars['task'] = 'subscribe.remove';
                     if (isset($segments[3])) {
                         $vars['sub_id'] = (int) $segments[3];
                     }
                     if (isset($segments[4])) {
                         $vars['code'] = $segments[4];
                     }
                     break;
                 case JApplication::stringURLSafe('delete'):
                     $vars['task'] = 'listing.deleteComment';
                     if (isset($segments[1])) {
                         $vars['comment_id'] = (int) $segments[1];
                     }
                     break;
                 default:
                     break;
             }
             if (isset($vars['task'])) {
                 return $vars;
             }
         }
     }
     $searchViewReportComment = array_search(JApplication::stringURLSafe('comment'), $segments);
     if ($searchViewReportComment !== false) {
         $validArrayIndex = array(0, 1);
         if (in_array($searchViewReportComment, $validArrayIndex)) {
             if (isset($segments[$searchViewReportComment + 2])) {
                 if ($segments[$searchViewReportComment + 2] == JApplication::stringURLSafe('report')) {
                     $vars['view'] = 'report';
                     if (isset($segments[$searchViewReportComment + 1])) {
                         $vars['comment_id'] = (int) $segments[$searchViewReportComment + 1];
                     }
                     $previousIndexSegment = $total - 1;
                     if (isset($segments[$previousIndexSegment])) {
                         $isLayout = JUDirectoryHelperRoute::parseLayout($segments[$previousIndexSegment], $vars, $params);
                         if ($isLayout) {
                             $previousIndexSegment -= 1;
                         }
                     }
                     return $vars;
                 }
             }
         }
     }
     $searchViewModeratorPermission = array_search(JApplication::stringURLSafe('mod-permission'), $segments);
     if ($searchViewModeratorPermission !== false) {
         $validArrayIndex = array(0, 1);
         if (in_array($searchViewModeratorPermission, $validArrayIndex)) {
             $vars['view'] = 'modpermission';
             if (isset($segments[$searchViewModeratorPermission + 1])) {
                 $vars['id'] = (int) $segments[$searchViewModeratorPermission + 1];
             }
             $previousIndexSegment = $total - 1;
             if (isset($segments[$previousIndexSegment])) {
                 $isLayout = JUDirectoryHelperRoute::parseLayout($segments[$previousIndexSegment], $vars, $params);
                 if ($isLayout) {
                     $previousIndexSegment -= 1;
                 }
             }
             return $vars;
         }
     }
     $searchViewCustomList = array_search(JApplication::stringURLSafe('custom-list'), $segments);
     if ($searchViewCustomList !== false) {
         $validArrayIndex = array(0, 1);
         if (in_array($searchViewCustomList, $validArrayIndex)) {
             $vars['view'] = 'customlist';
             if (isset($segments[$searchViewCustomList + 1])) {
                 $vars['id'] = (int) $segments[$searchViewCustomList + 1];
             }
             $previousIndexSegment = $total - 1;
             $isPaged = JUDirectoryHelperRoute::parsePagination($vars, $segments, $params);
             if ($isPaged) {
                 $previousIndexSegment -= 1;
             }
             if (isset($segments[$previousIndexSegment])) {
                 if ($segments[$previousIndexSegment] == JApplication::stringURLSafe('rss')) {
                     $vars['format'] = 'feed';
                     $previousIndexSegment -= 1;
                 }
             }
             if (isset($segments[$previousIndexSegment])) {
                 $isLayout = JUDirectoryHelperRoute::parseLayout($segments[$previousIndexSegment], $vars, $params);
                 if ($isLayout) {
                     $previousIndexSegment -= 1;
                 }
             }
             return $vars;
         }
     }
     $searchViewCompare = array_search(JApplication::stringURLSafe('compare'), $segments);
     if ($searchViewCompare !== false) {
         $validArrayIndex = array(0, 1);
         if (in_array($searchViewCompare, $validArrayIndex)) {
             $vars['view'] = 'compare';
             $previousIndexSegment = $total - 1;
             if (isset($segments[$previousIndexSegment])) {
                 $isLayout = JUDirectoryHelperRoute::parseLayout($segments[$previousIndexSegment], $vars, $params);
                 if ($isLayout) {
                     $previousIndexSegment -= 1;
                 }
             }
             return $vars;
         }
     }
     if (isset($segments[0]) && $segments[0] == JApplication::stringURLSafe('user-subscriptions')) {
         if (isset($segments[2])) {
             if ($segments[2] == JApplication::stringURLSafe('unsubscribe')) {
                 $vars['task'] = 'usersubscriptions.unsubscribe';
                 if (isset($segments[1])) {
                     $vars['sub_id'] = (int) $segments[1];
                 }
                 return $vars;
             }
         }
     }
     if (isset($segments[0]) && $segments[0] == JApplication::stringURLSafe('email')) {
         if (isset($segments[1]) && $segments[1] == JApplication::stringURLSafe('download-attachment')) {
             $vars['task'] = 'email.downloadattachment';
             if (isset($segments[2])) {
                 $vars['mail_id'] = (int) $segments[2];
             }
             if (isset($segments[3])) {
                 $vars['file'] = $segments[3];
             }
             if (isset($segments[4])) {
                 $vars['code'] = $segments[4];
             }
         }
         return $vars;
     }
     $searchViewModeratorPermissions = array_search(JApplication::stringURLSafe('mod-permissions'), $segments);
     if ($searchViewModeratorPermissions !== false) {
         $validArrayIndex = array(0, 1);
         if (in_array($searchViewModeratorPermissions, $validArrayIndex)) {
             $vars['view'] = 'modpermissions';
             $previousIndexSegment = $total - 1;
             if (isset($segments[$previousIndexSegment])) {
                 $isLayout = JUDirectoryHelperRoute::parseLayout($segments[$previousIndexSegment], $vars, $params);
                 if ($isLayout) {
                     $previousIndexSegment -= 1;
                 }
             }
             return $vars;
         }
     }
     $searchViewProfile = array_search(JApplication::stringURLSafe('profile'), $segments);
     if ($searchViewProfile !== false) {
         $validArrayIndex = array(0, 1, 2);
         if (in_array($searchViewProfile, $validArrayIndex)) {
             $vars['view'] = 'profile';
             $previousIndexSegment = $total - 1;
             if (isset($segments[$previousIndexSegment])) {
                 $isLayout = JUDirectoryHelperRoute::parseLayout($segments[$previousIndexSegment], $vars, $params);
                 if ($isLayout) {
                     $previousIndexSegment -= 1;
                 }
             }
             return $vars;
         }
     }
     $searchViewModeratorPendingListings = array_search(JApplication::stringURLSafe('mod-pending-listings'), $segments);
     if ($searchViewModeratorPendingListings !== false) {
         $validArrayIndex = array(0, 1, 2);
         if (in_array($searchViewModeratorPendingListings, $validArrayIndex)) {
             $vars['view'] = 'modpendinglistings';
             $previousIndexSegment = $total - 1;
             $isPaged = JUDirectoryHelperRoute::parsePagination($vars, $segments, $params);
             if ($isPaged) {
                 $previousIndexSegment -= 1;
             }
             if (isset($segments[$previousIndexSegment])) {
                 $isLayout = JUDirectoryHelperRoute::parseLayout($segments[$previousIndexSegment], $vars, $params);
                 if ($isLayout) {
                     $previousIndexSegment -= 1;
                 }
             }
             return $vars;
         }
     }
     $searchViewModeratorPendingComments = array_search(JApplication::stringURLSafe('mod-pending-comments'), $segments);
     if ($searchViewModeratorPendingComments !== false) {
         $validArrayIndex = array(0, 1, 2);
         if (in_array($searchViewModeratorPendingComments, $validArrayIndex)) {
             $vars['view'] = 'modpendingcomments';
             $previousIndexSegment = $total - 1;
             $isPaged = JUDirectoryHelperRoute::parsePagination($vars, $segments, $params);
             if ($isPaged) {
                 $previousIndexSegment -= 1;
             }
             if (isset($segments[$previousIndexSegment])) {
                 $isLayout = JUDirectoryHelperRoute::parseLayout($segments[$previousIndexSegment], $vars, $params);
                 if ($isLayout) {
                     $previousIndexSegment -= 1;
                 }
             }
             return $vars;
         }
     }
     $searchViewModeratorComments = array_search(JApplication::stringURLSafe('mod-comments'), $segments);
     if ($searchViewModeratorComments !== false) {
         $validArrayIndex = array(0, 1, 2);
         if (in_array($searchViewModeratorComments, $validArrayIndex)) {
             $vars['view'] = 'modcomments';
             $previousIndexSegment = $total - 1;
             $isPaged = JUDirectoryHelperRoute::parsePagination($vars, $segments, $params);
             if ($isPaged) {
                 $previousIndexSegment -= 1;
             }
             if (isset($segments[$previousIndexSegment])) {
                 $isLayout = JUDirectoryHelperRoute::parseLayout($segments[$previousIndexSegment], $vars, $params);
                 if ($isLayout) {
                     $previousIndexSegment -= 1;
                 }
             }
             return $vars;
         }
     }
     $searchViewModeratorListings = array_search(JApplication::stringURLSafe('mod-listings'), $segments);
     if ($searchViewModeratorListings !== false) {
         $validArrayIndex = array(0, 1, 2);
         if (in_array($searchViewModeratorListings, $validArrayIndex)) {
             $vars['view'] = 'modlistings';
             $previousIndexSegment = $total - 1;
             $isPaged = JUDirectoryHelperRoute::parsePagination($vars, $segments, $params);
             if ($isPaged) {
                 $previousIndexSegment -= 1;
             }
             if (isset($segments[$previousIndexSegment])) {
                 $isLayout = JUDirectoryHelperRoute::parseLayout($segments[$previousIndexSegment], $vars, $params);
                 if ($isLayout) {
                     $previousIndexSegment -= 1;
                 }
             }
             return $vars;
         }
     }
     if (isset($segments[0]) && $segments[0] == JApplication::stringURLSafe('subscribe')) {
         if (isset($segments[1]) && $segments[1] == JApplication::stringURLSafe('activate')) {
             $vars['task'] = 'subscribe.activate';
             if (isset($segments[2])) {
                 $vars['code'] = $segments[2];
             }
             if (isset($segments[3])) {
                 $vars['id'] = (int) $segments[3];
             }
             if (isset($segments[4])) {
                 $vars['listing_id'] = (int) $segments[4];
             }
             return $vars;
         }
     }
     $searchViewSearch = array_search(JApplication::stringURLSafe('search'), $segments);
     if ($searchViewSearch !== false) {
         $validArrayIndex = array(0, 1, 2, 3);
         if (in_array($searchViewSearch, $validArrayIndex)) {
             $vars['view'] = 'search';
             if (isset($segments[$searchViewSearch - 1])) {
                 if ($segments[$searchViewSearch - 1] == JApplication::stringURLSafe('all')) {
                     $vars['sub_cat'] = 1;
                     if (isset($segments[$searchViewSearch - 2])) {
                         $vars['cat_id'] = (int) $segments[$searchViewSearch - 2];
                     }
                 } else {
                     $vars['cat_id'] = (int) $segments[$searchViewSearch - 1];
                 }
             }
             $previousIndexSegment = $total - 1;
             $isPaged = JUDirectoryHelperRoute::parsePagination($vars, $segments, $params);
             if ($isPaged) {
                 $previousIndexSegment -= 1;
             }
             if (isset($segments[$previousIndexSegment])) {
                 $isLayout = JUDirectoryHelperRoute::parseLayout($segments[$previousIndexSegment], $vars, $params);
                 if ($isLayout) {
                     $previousIndexSegment -= 1;
                 }
             }
             if (isset($segments[$previousIndexSegment]) && $previousIndexSegment > $searchViewSearch) {
                 $vars['searchword'] = $segments[$previousIndexSegment];
                 $previousIndexSegment -= 1;
             }
             return $vars;
         }
     }
     $searchViewCategories = array_search(JApplication::stringURLSafe('categories'), $segments);
     if ($searchViewCategories !== false) {
         $validArrayIndex = array(0, 1);
         if (in_array($searchViewCategories, $validArrayIndex)) {
             $vars['view'] = 'categories';
             if (isset($segments[$searchViewCategories + 1])) {
                 $vars['id'] = (int) $segments[$searchViewCategories + 1];
             }
             if (isset($segments[$searchViewCategories + 2])) {
                 JUDirectoryHelperRoute::parseLayout($segments[$searchViewCategories + 2], $vars, $params);
             }
             return $vars;
         }
     }
     $searchViewAdvancedSearch = array_search(JApplication::stringURLSafe('advanced-search'), $segments);
     if ($searchViewAdvancedSearch !== false) {
         $validArrayIndex = array(0, 1, 2);
         if (in_array($searchViewAdvancedSearch, $validArrayIndex)) {
             $vars['view'] = 'advsearch';
             $previousIndexSegment = $total - 1;
             $isPaged = JUDirectoryHelperRoute::parsePagination($vars, $segments, $params);
             if ($isPaged) {
                 $previousIndexSegment -= 1;
             }
             if (isset($segments[$previousIndexSegment])) {
                 $isLayout = JUDirectoryHelperRoute::parseLayout($segments[$previousIndexSegment], $vars, $params);
                 if ($isLayout) {
                     $previousIndexSegment -= 1;
                 }
             }
             return $vars;
         }
     }
     $searchViewCommentTree = array_search(JApplication::stringURLSafe('comment-tree'), $segments);
     if ($searchViewCommentTree !== false) {
         $validArrayIndex = array(0, 1, 2);
         if (in_array($searchViewCommentTree, $validArrayIndex)) {
             $vars['view'] = 'commenttree';
             if (isset($segments[$searchViewCommentTree + 1])) {
                 $vars['id'] = (int) $segments[$searchViewCommentTree + 1];
             }
             $previousIndexSegment = $total - 1;
             if (isset($segments[$previousIndexSegment])) {
                 $isLayout = JUDirectoryHelperRoute::parseLayout($segments[$previousIndexSegment], $vars, $params);
                 if ($isLayout) {
                     $previousIndexSegment -= 1;
                 }
             }
             return $vars;
         }
     }
     $searchViewListings = array_search(JApplication::stringURLSafe('modal-listings'), $segments);
     if ($searchViewListings !== false) {
         $validArrayIndex = array(0, 1, 2);
         if (in_array($searchViewListings, $validArrayIndex)) {
             $vars['view'] = 'listings';
             if (isset($segments[$searchViewListings + 1])) {
                 $vars['tmpl'] = $segments[$searchViewListings + 1];
             }
             if (isset($segments[$searchViewListings + 2])) {
                 $vars['function'] = $segments[$searchViewListings + 2];
             }
             $previousIndexSegment = $total - 1;
             $isPaged = JUDirectoryHelperRoute::parsePagination($vars, $segments, $params);
             if ($isPaged) {
                 $previousIndexSegment -= 1;
             }
             if (isset($segments[$previousIndexSegment])) {
                 $isLayout = JUDirectoryHelperRoute::parseLayout($segments[$previousIndexSegment], $vars, $params);
                 if ($isLayout) {
                     $previousIndexSegment -= 1;
                 }
             }
             return $vars;
         }
     }
     $searchViewMaintenance = array_search(JApplication::stringURLSafe('maintenance'), $segments);
     if ($searchViewMaintenance !== false) {
         $validArrayIndex = array(0, 1);
         if (in_array($searchViewMaintenance, $validArrayIndex)) {
             $vars['view'] = 'maintenance';
             $previousIndexSegment = $total - 1;
             if (isset($segments[$previousIndexSegment])) {
                 $isLayout = JUDirectoryHelperRoute::parseLayout($segments[$previousIndexSegment], $vars, $params);
                 if ($isLayout) {
                     $previousIndexSegment -= 1;
                 }
             }
             return $vars;
         }
     }
     $searchViewSearchBy = array_search(JApplication::stringURLSafe('search-by'), $segments);
     if ($searchViewSearchBy !== false) {
         $validArrayIndex = array(0, 1, 2);
         if (in_array($searchViewSearchBy, $validArrayIndex)) {
             $vars['view'] = 'searchby';
             if (isset($segments[$searchViewSearchBy + 1])) {
                 $vars['field_id'] = (int) $segments[$searchViewSearchBy + 1];
             }
             if (isset($segments[$searchViewSearchBy + 2])) {
                 $vars['value'] = $segments[$searchViewSearchBy + 2];
             }
             $previousIndexSegment = $total - 1;
             $isPaged = JUDirectoryHelperRoute::parsePagination($vars, $segments, $params);
             if ($isPaged) {
                 $previousIndexSegment -= 1;
             }
             if (isset($segments[$previousIndexSegment])) {
                 $isLayout = JUDirectoryHelperRoute::parseLayout($segments[$previousIndexSegment], $vars, $params);
                 if ($isLayout) {
                     $previousIndexSegment -= 1;
                 }
             }
             return $vars;
         }
     }
     $searchViewTag = array_search(JApplication::stringURLSafe('tag'), $segments);
     if ($searchViewTag !== false) {
         $validArrayIndex = array(0, 1, 2);
         if (in_array($searchViewTag, $validArrayIndex)) {
             $vars['view'] = 'tag';
             if (isset($segments[$searchViewTag + 1])) {
                 $vars['id'] = (int) $segments[$searchViewTag + 1];
             }
             $previousIndexSegment = $total - 1;
             $isPaged = JUDirectoryHelperRoute::parsePagination($vars, $segments, $params);
             if ($isPaged) {
                 $previousIndexSegment -= 1;
             }
             if (isset($segments[$previousIndexSegment])) {
                 if ($segments[$previousIndexSegment] == JApplication::stringURLSafe('rss')) {
                     $vars['format'] = 'feed';
                     $previousIndexSegment -= 1;
                 }
             }
             if (isset($segments[$previousIndexSegment])) {
                 $isLayout = JUDirectoryHelperRoute::parseLayout($segments[$previousIndexSegment], $vars, $params);
                 if ($isLayout) {
                     $previousIndexSegment -= 1;
                 }
             }
             return $vars;
         }
     }
     $searchViewTags = array_search(JApplication::stringURLSafe('tags'), $segments);
     if ($searchViewTags !== false) {
         $validArrayIndex = array(0, 1);
         if (in_array($searchViewTags, $validArrayIndex)) {
             $vars['view'] = 'tags';
             $previousIndexSegment = $total - 1;
             $isPaged = JUDirectoryHelperRoute::parsePagination($vars, $segments, $params);
             if ($isPaged) {
                 $previousIndexSegment -= 1;
             }
             if (isset($segments[$previousIndexSegment])) {
                 $isLayout = JUDirectoryHelperRoute::parseLayout($segments[$previousIndexSegment], $vars, $params);
                 if ($isLayout) {
                     $previousIndexSegment -= 1;
                 }
             }
             return $vars;
         }
     }
     $searchViewTopComments = array_search(JApplication::stringURLSafe('top-comments'), $segments);
     if ($searchViewTopComments !== false) {
         $validArrayIndex = array(0, 1);
         if (in_array($searchViewTopComments, $validArrayIndex)) {
             $vars['view'] = 'topcomments';
             $previousIndexSegment = $total - 1;
             $isPaged = JUDirectoryHelperRoute::parsePagination($vars, $segments, $params);
             if ($isPaged) {
                 $previousIndexSegment -= 1;
             }
             if (isset($segments[$previousIndexSegment])) {
                 $isLayout = JUDirectoryHelperRoute::parseLayout($segments[$previousIndexSegment], $vars, $params);
                 if ($isLayout) {
                     $previousIndexSegment -= 1;
                 }
             }
             return $vars;
         }
     }
     $searchViewTree = array_search(JApplication::stringURLSafe('tree'), $segments);
     if ($searchViewTree !== false) {
         $validArrayIndex = array(0, 1);
         if (in_array($searchViewTree, $validArrayIndex)) {
             $vars['view'] = 'tree';
             $previousIndexSegment = $total - 1;
             $isPaged = JUDirectoryHelperRoute::parsePagination($vars, $segments, $params);
             if ($isPaged) {
                 $previousIndexSegment -= 1;
             }
             if (isset($segments[$previousIndexSegment])) {
                 if ($segments[$previousIndexSegment] == JApplication::stringURLSafe('rss')) {
                     $vars['format'] = 'feed';
                     $previousIndexSegment -= 1;
                 }
             }
             if (isset($segments[$previousIndexSegment])) {
                 $isLayout = JUDirectoryHelperRoute::parseLayout($segments[$previousIndexSegment], $vars, $params);
                 if ($isLayout) {
                     $previousIndexSegment -= 1;
                 }
             }
             if (isset($segments[$previousIndexSegment])) {
                 if ($segments[$previousIndexSegment] == JApplication::stringURLSafe('root')) {
                     $rootCategory = JUDirectoryFrontHelperCategory::getRootCategory();
                     $vars['id'] = $rootCategory->id;
                 } else {
                     $vars['id'] = (int) $segments[$previousIndexSegment];
                 }
                 $previousIndexSegment -= 1;
             } else {
                 if ($activeMenu && isset($activeMenu->query) && isset($activeMenu->query['view']) && isset($activeMenu->query['id']) && $activeMenu->query['view'] == 'tree') {
                     $vars['id'] = $activeMenu->query['id'];
                 }
             }
             return $vars;
         }
     }
     $orderTypeTopListings = array();
     $orderTypeTopListings[] = JApplication::stringURLSafe('latest-listings');
     $orderTypeTopListings[] = JApplication::stringURLSafe('top-featured-listings');
     $orderTypeTopListings[] = JApplication::stringURLSafe('recent-modified-listings');
     $orderTypeTopListings[] = JApplication::stringURLSafe('recent-updated-listings');
     $orderTypeTopListings[] = JApplication::stringURLSafe('popular-listings');
     $orderTypeTopListings[] = JApplication::stringURLSafe('most-rated-listings');
     $orderTypeTopListings[] = JApplication::stringURLSafe('top-rated-listings');
     $orderTypeTopListings[] = JApplication::stringURLSafe('latest-rated-listings');
     $orderTypeTopListings[] = JApplication::stringURLSafe('most-commented-listings');
     $orderTypeTopListings[] = JApplication::stringURLSafe('latest-commented-listings');
     $orderTypeTopListings[] = JApplication::stringURLSafe('recent-viewed-listings');
     $orderTypeTopListings[] = JApplication::stringURLSafe('alpha-ordered-listings');
     $orderTypeTopListings[] = JApplication::stringURLSafe('random-listings');
     $orderTypeTopListings[] = JApplication::stringURLSafe('random-fast-listings');
     $orderTypeTopListings[] = JApplication::stringURLSafe('random-featured-listings');
     if (!empty($orderTypeTopListings)) {
         foreach ($orderTypeTopListings as $orderTypeTopListingItem) {
             $searchViewTopListings = array_search($orderTypeTopListingItem, $segments);
             if ($searchViewTopListings !== false) {
                 break;
             }
         }
         if ($searchViewTopListings !== false) {
             $validArrayIndex = array(0, 1, 2);
             if (in_array($searchViewTopListings, $validArrayIndex)) {
                 $vars['view'] = 'toplistings';
                 switch ($segments[$searchViewTopListings]) {
                     case JApplication::stringURLSafe('latest-listings'):
                         $vars['ordertype'] = 'new';
                         break;
                     case JApplication::stringURLSafe('top-featured-listings'):
                         $vars['ordertype'] = 'featured';
                         break;
                     case JApplication::stringURLSafe('recent-modified-listings'):
                         $vars['ordertype'] = 'recent_modified';
                         break;
                     case JApplication::stringURLSafe('recent-updated-listings'):
                         $vars['ordertype'] = 'recent_updated';
                         break;
                     case JApplication::stringURLSafe('popular-listings'):
                         $vars['ordertype'] = 'popular';
                         break;
                     case JApplication::stringURLSafe('most-rated-listings'):
                         $vars['ordertype'] = 'most_rated';
                         break;
                     case JApplication::stringURLSafe('top-rated-listings'):
                         $vars['ordertype'] = 'top_rated';
                         break;
                     case JApplication::stringURLSafe('latest-rated-listings'):
                         $vars['ordertype'] = 'latest_rated';
                         break;
                     case JApplication::stringURLSafe('most-commented-listings'):
                         $vars['ordertype'] = 'most_commented';
                         break;
                     case JApplication::stringURLSafe('latest-commented-listings'):
                         $vars['ordertype'] = 'latest_commented';
                         break;
                     case JApplication::stringURLSafe('recent-viewed-listings'):
                         $vars['ordertype'] = 'recently_viewed';
                         break;
                     case JApplication::stringURLSafe('alpha-ordered-listings'):
                         $vars['ordertype'] = 'alpha_ordered';
                         break;
                     case JApplication::stringURLSafe('random-listings'):
                         $vars['ordertype'] = 'random';
                         break;
                     case JApplication::stringURLSafe('random-fast-listings'):
                         $vars['ordertype'] = 'random_fast';
                         break;
                     case JApplication::stringURLSafe('random-featured-listings'):
                         $vars['ordertype'] = 'random_featured';
                         break;
                     default:
                         $vars['ordertype'] = 'new';
                         break;
                 }
                 if (isset($segments[$searchViewTopListings - 1])) {
                     if ($segments[$searchViewTopListings - 1] == JApplication::stringURLSafe('root')) {
                         $rootCategory = JUDirectoryFrontHelperCategory::getRootCategory();
                         $vars['id'] = $rootCategory->id;
                     } else {
                         $vars['id'] = (int) $segments[$searchViewTopListings - 1];
                     }
                 } else {
                     if ($activeMenu && isset($activeMenu->query) && isset($activeMenu->query['view']) && isset($activeMenu->query['id']) && $activeMenu->query['view'] == 'tree') {
                         $vars['id'] = $activeMenu->query['id'];
                     }
                 }
                 if (isset($segments[$searchViewTopListings + 1])) {
                     if ($segments[$searchViewTopListings + 1] == JApplication::stringURLSafe('all')) {
                         $vars['all'] = 1;
                     }
                 }
                 $previousIndexSegment = $total - 1;
                 $isPaged = JUDirectoryHelperRoute::parsePagination($vars, $segments, $params);
                 if ($isPaged) {
                     $previousIndexSegment -= 1;
                 }
                 if (isset($segments[$previousIndexSegment])) {
                     if ($segments[$previousIndexSegment] == JApplication::stringURLSafe('rss')) {
                         $vars['format'] = 'feed';
                         $previousIndexSegment -= 1;
                     }
                 }
                 if (isset($segments[$previousIndexSegment])) {
                     $isLayout = JUDirectoryHelperRoute::parseLayout($segments[$previousIndexSegment], $vars, $params);
                     if ($isLayout) {
                         $previousIndexSegment -= 1;
                     }
                 }
                 return $vars;
             }
         }
     }
     $searchSefRedirectUrl = array_search(JApplication::stringURLSafe('redirect-url'), $segments);
     if ($searchSefRedirectUrl !== false) {
         $vars['task'] = 'listing.redirecturl';
         if (isset($segments[$searchSefRedirectUrl - 1])) {
             $vars['field_id'] = (int) $segments[$searchSefRedirectUrl - 1];
         }
         if (isset($segments[$searchSefRedirectUrl - 2])) {
             $vars['listing_id'] = (int) $segments[$searchSefRedirectUrl - 2];
         }
         return $vars;
     }
     $searchSefTaskRawData = array_search(JApplication::stringURLSafe('raw-data'), $segments);
     if ($searchSefTaskRawData !== false) {
         $vars['task'] = 'rawdata';
         if (isset($segments[$searchSefTaskRawData - 1])) {
             $vars['field_id'] = (int) $segments[$searchSefTaskRawData - 1];
         }
         if (isset($segments[$searchSefTaskRawData - 2])) {
             $vars['listing_id'] = (int) $segments[$searchSefTaskRawData - 2];
         }
         return $vars;
     }
     $searchSefCollection = array_search(JApplication::stringURLSafe('collection'), $segments);
     if ($searchSefCollection !== false) {
         if (isset($segments[$searchSefCollection + 1])) {
             if ($segments[$searchSefCollection + 1] == JApplication::stringURLSafe('add')) {
                 $vars['task'] = 'collection.add';
                 return $vars;
             }
         }
     }
     $searchSefCollection = array_search(JApplication::stringURLSafe('collection'), $segments);
     if ($searchSefCollection !== false) {
         if (isset($segments[$searchSefCollection + 2])) {
             if ($segments[$searchSefCollection + 2] == JApplication::stringURLSafe('edit')) {
                 if (isset($segments[$searchSefCollection - 1])) {
                     $vars['user_id'] = (int) $segments[$searchSefCollection - 1];
                 }
                 $vars['id'] = (int) $segments[$searchSefCollection + 1];
                 $vars['task'] = 'collection.edit';
                 return $vars;
             }
         }
     }
     $searchSefCollection = array_search(JApplication::stringURLSafe('collection'), $segments);
     if ($searchSefCollection !== false) {
         if (isset($segments[$searchSefCollection + 2])) {
             if ($segments[$searchSefCollection + 2] == JApplication::stringURLSafe('delete')) {
                 $vars['cid'] = (int) $segments[$searchSefCollection + 1];
                 $vars['task'] = 'collections.delete';
                 return $vars;
             }
         }
     }
     $searchSefCollection = array_search(JApplication::stringURLSafe('collection'), $segments);
     if ($searchSefCollection !== false) {
         if (isset($segments[$searchSefCollection + 1])) {
             if ($segments[$searchSefCollection + 1] == JApplication::stringURLSafe('new-collection')) {
                 $vars['id'] = 0;
                 $vars['view'] = 'collection';
                 JUDirectoryHelperRoute::parseLayout($segments[$searchSefCollection + 2], $vars, $params);
                 return $vars;
             }
         }
     }
     $searchSefCollection = array_search(JApplication::stringURLSafe('collection'), $segments);
     if ($searchSefCollection !== false) {
         $validArrayIndex = array(0, 1, 2);
         if (in_array($searchSefCollection, $validArrayIndex)) {
             $vars['view'] = 'collection';
             if (isset($segments[$searchSefCollection - 1])) {
                 if ($segments[$searchSefCollection - 1] != 'root') {
                     $vars['user_id'] = (int) $segments[$searchSefCollection - 1];
                 }
             }
             if (isset($segments[$searchSefCollection + 1])) {
                 $vars['id'] = (int) $segments[$searchSefCollection + 1];
             }
             $previousIndexSegment = $total - 1;
             $isPaged = JUDirectoryHelperRoute::parsePagination($vars, $segments, $params);
             if ($isPaged) {
                 $previousIndexSegment -= 1;
             }
             if (isset($segments[$previousIndexSegment])) {
                 if ($segments[$previousIndexSegment] == JApplication::stringURLSafe('rss')) {
                     $vars['format'] = 'feed';
                     $previousIndexSegment -= 1;
                 }
             }
             if (isset($segments[$previousIndexSegment])) {
                 $isLayout = JUDirectoryHelperRoute::parseLayout($segments[$previousIndexSegment], $vars, $params);
                 if ($isLayout) {
                     $previousIndexSegment -= 1;
                 }
             }
             return $vars;
         }
     }
     $searchSefClaimListing = array_search(JApplication::stringURLSafe('claim'), $segments);
     if ($searchSefClaimListing !== false) {
         $vars['view'] = 'claim';
         if (isset($segments[$searchSefClaimListing - 1])) {
             $vars['listing_id'] = (int) $segments[$searchSefClaimListing - 1];
         }
         $previousIndexSegment = $total - 1;
         if (isset($segments[$previousIndexSegment])) {
             $isLayout = JUDirectoryHelperRoute::parseLayout($segments[$previousIndexSegment], $vars, $params);
             if ($isLayout) {
                 $previousIndexSegment -= 1;
             }
         }
         return $vars;
     }
     $searchSefReportListing = array_search(JApplication::stringURLSafe('report'), $segments);
     if ($searchSefReportListing !== false) {
         $vars['view'] = 'report';
         if (isset($segments[$searchSefReportListing - 1])) {
             $vars['listing_id'] = (int) $segments[$searchSefReportListing - 1];
         }
         $previousIndexSegment = $total - 1;
         if (isset($segments[$previousIndexSegment])) {
             $isLayout = JUDirectoryHelperRoute::parseLayout($segments[$previousIndexSegment], $vars, $params);
             if ($isLayout) {
                 $previousIndexSegment -= 1;
             }
         }
         return $vars;
     }
     $searchSefRemoveCompare = array_search(JApplication::stringURLSafe('remove-compare'), $segments);
     if ($searchSefRemoveCompare !== false) {
         $vars['task'] == 'listing.removeCompare';
         if (isset($segments[$searchSefRemoveCompare + 1])) {
             if ($segments[$searchSefRemoveCompare + 1] == JApplication::stringURLSafe('all')) {
                 $vars['all'] = 1;
                 return $vars;
             }
         }
         if (isset($segments[$searchSefRemoveCompare - 1])) {
             $vars['listing_id'] = (int) $segments[$searchSefRemoveCompare - 1];
             return $vars;
         }
         return $vars;
     }
     $searchSefSubscribeListingForGuest = array_search(JApplication::stringURLSafe('guest-subscribe'), $segments);
     if ($searchSefSubscribeListingForGuest !== false) {
         $vars['view'] = 'subscribe';
         if (isset($segments[$searchSefSubscribeListingForGuest - 1])) {
             $vars['listing_id'] = (int) $segments[$searchSefSubscribeListingForGuest - 1];
         }
         $previousIndexSegment = $total - 1;
         if (isset($segments[$previousIndexSegment])) {
             $isLayout = JUDirectoryHelperRoute::parseLayout($segments[$previousIndexSegment], $vars, $params);
             if ($isLayout) {
                 $previousIndexSegment -= 1;
             }
         }
         return $vars;
     }
     $searchSefListAll = array_search('list-all', $segments);
     if ($searchSefListAll !== false) {
         $validArrayIndex = array(0, 1, 2);
         if (in_array($searchSefListAll, $validArrayIndex)) {
             $vars['view'] = 'listall';
             if (isset($segments[$searchSefListAll - 1])) {
                 if ($segments[$searchSefListAll - 1] == JApplication::stringURLSafe('root')) {
                     $rootCategory = JUDirectoryFrontHelperCategory::getRootCategory();
                     $vars['id'] = $rootCategory->id;
                 } else {
                     $vars['id'] = (int) $segments[$searchSefListAll - 1];
                 }
             } else {
                 if ($activeMenu && isset($activeMenu->query) && isset($activeMenu->query['view']) && isset($activeMenu->query['id']) && $activeMenu->query['view'] == 'tree') {
                     $vars['id'] = $activeMenu->query['id'];
                 }
             }
             $previousIndexSegment = $total - 1;
             $isPaged = JUDirectoryHelperRoute::parsePagination($vars, $segments, $params);
             if ($isPaged) {
                 $previousIndexSegment -= 1;
             }
             if (isset($segments[$previousIndexSegment])) {
                 if ($segments[$previousIndexSegment] == JApplication::stringURLSafe('rss')) {
                     $vars['format'] = 'feed';
                     $previousIndexSegment -= 1;
                 }
             }
             if (isset($segments[$previousIndexSegment])) {
                 $isLayout = JUDirectoryHelperRoute::parseLayout($segments[$previousIndexSegment], $vars, $params);
                 if ($isLayout) {
                     $previousIndexSegment -= 1;
                 }
             }
             return $vars;
         }
     }
     $searchSefListAlpha = array_search(JApplication::stringURLSafe('list-alpha'), $segments);
     if ($searchSefListAlpha !== false) {
         $validArrayIndex = array(0, 1, 2);
         if (in_array($searchSefListAlpha, $validArrayIndex)) {
             $vars['view'] = 'listalpha';
             if (isset($segments[$searchSefListAlpha - 1])) {
                 if ($segments[$searchSefListAlpha - 1] == JApplication::stringURLSafe('root')) {
                     $rootCategory = JUDirectoryFrontHelperCategory::getRootCategory();
                     $vars['id'] = $rootCategory->id;
                 } else {
                     $vars['id'] = (int) $segments[$searchSefListAlpha - 1];
                 }
             } else {
                 if ($activeMenu && isset($activeMenu->query) && isset($activeMenu->query['view']) && isset($activeMenu->query['id']) && $activeMenu->query['view'] == 'tree') {
                     $vars['id'] = $activeMenu->query['id'];
                 }
             }
             $previousIndexSegment = $total - 1;
             $isPaged = JUDirectoryHelperRoute::parsePagination($vars, $segments, $params);
             if ($isPaged) {
                 $previousIndexSegment -= 1;
             }
             if (isset($segments[$previousIndexSegment])) {
                 if ($segments[$previousIndexSegment] == JApplication::stringURLSafe('rss')) {
                     $vars['format'] = 'feed';
                     $previousIndexSegment -= 1;
                 }
             }
             if (isset($segments[$previousIndexSegment])) {
                 $isLayout = JUDirectoryHelperRoute::parseLayout($segments[$previousIndexSegment], $vars, $params);
                 if ($isLayout) {
                     $previousIndexSegment -= 1;
                 }
             }
             if (isset($segments[$previousIndexSegment])) {
                 if ($previousIndexSegment > $searchSefListAlpha) {
                     $vars['alpha'] = $segments[$previousIndexSegment];
                 }
             }
             return $vars;
         }
     }
     $searchSefFeatured = array_search(JApplication::stringURLSafe('featured'), $segments);
     if ($searchSefFeatured !== false) {
         $validArrayIndex = array(0, 1, 2);
         if (in_array($searchSefFeatured, $validArrayIndex)) {
             $vars['view'] = 'featured';
             if (isset($segments[$searchSefFeatured - 1])) {
                 if ($segments[$searchSefFeatured - 1] == JApplication::stringURLSafe('root')) {
                     $rootCategory = JUDirectoryFrontHelperCategory::getRootCategory();
                     $vars['id'] = $rootCategory->id;
                 } else {
                     $vars['id'] = (int) $segments[$searchSefFeatured - 1];
                 }
             } else {
                 if ($activeMenu && isset($activeMenu->query) && isset($activeMenu->query['view']) && isset($activeMenu->query['id']) && $activeMenu->query['view'] == 'tree') {
                     $vars['id'] = $activeMenu->query['id'];
                 }
             }
             if (isset($segments[$searchSefFeatured + 1])) {
                 if ($segments[$searchSefFeatured + 1] == JApplication::stringURLSafe('all')) {
                     $vars['all'] = 1;
                 }
             }
             $previousIndexSegment = $total - 1;
             $isPaged = JUDirectoryHelperRoute::parsePagination($vars, $segments, $params);
             if ($isPaged) {
                 $previousIndexSegment -= 1;
             }
             if (isset($segments[$previousIndexSegment])) {
                 if ($segments[$previousIndexSegment] == JApplication::stringURLSafe('rss')) {
                     $vars['format'] = 'feed';
                     $previousIndexSegment -= 1;
                 }
             }
             if (isset($segments[$previousIndexSegment])) {
                 $isLayout = JUDirectoryHelperRoute::parseLayout($segments[$previousIndexSegment], $vars, $params);
             }
             return $vars;
         }
     }
     $searchSefCollections = array_search(JApplication::stringURLSafe('collections'), $segments);
     if ($searchSefCollections !== false) {
         $validArrayIndex = array(0, 1, 2);
         if (in_array($searchSefCollections, $validArrayIndex)) {
             $vars['view'] = 'collections';
             if (isset($segments[$searchSefCollections - 1])) {
                 if ($segments[$searchSefCollections - 1] != JApplication::stringURLSafe('root')) {
                     $vars['id'] = (int) $segments[$searchSefCollections - 1];
                 }
             }
             $previousIndexSegment = $total - 1;
             $isPaged = JUDirectoryHelperRoute::parsePagination($vars, $segments, $params);
             if ($isPaged) {
                 $previousIndexSegment -= 1;
             }
             if (isset($segments[$previousIndexSegment])) {
                 if ($segments[$previousIndexSegment] == JApplication::stringURLSafe('rss')) {
                     $vars['format'] = 'feed';
                     $previousIndexSegment -= 1;
                 }
             }
             if (isset($segments[$previousIndexSegment])) {
                 $isLayout = JUDirectoryHelperRoute::parseLayout($segments[$previousIndexSegment], $vars, $params);
             }
             return $vars;
         }
     }
     $searchSefDashboard = array_search(JApplication::stringURLSafe('dashboard'), $segments);
     if ($searchSefDashboard !== false) {
         $validArrayIndex = array(0, 1, 2);
         if (in_array($searchSefDashboard, $validArrayIndex)) {
             $vars['view'] = 'dashboard';
             if (isset($segments[$searchSefDashboard - 1])) {
                 if ($segments[$searchSefDashboard - 1] != JApplication::stringURLSafe('root')) {
                     $vars['id'] = (int) $segments[$searchSefDashboard - 1];
                 }
             }
             $previousIndexSegment = $total - 1;
             $isPaged = JUDirectoryHelperRoute::parsePagination($vars, $segments, $params);
             if ($isPaged) {
                 $previousIndexSegment -= 1;
             }
             if (isset($segments[$previousIndexSegment])) {
                 $isLayout = JUDirectoryHelperRoute::parseLayout($segments[$previousIndexSegment], $vars, $params);
             }
             return $vars;
         }
     }
     $searchSefUserComments = array_search(JApplication::stringURLSafe('comments'), $segments);
     if ($searchSefUserComments !== false) {
         $validArrayIndex = array(0, 1, 2);
         if (in_array($searchSefUserComments, $validArrayIndex)) {
             $vars['view'] = 'usercomments';
             if (isset($segments[$searchSefUserComments - 1])) {
                 if ($segments[$searchSefUserComments - 1] != JApplication::stringURLSafe('root')) {
                     $vars['id'] = (int) $segments[$searchSefUserComments - 1];
                 }
             }
             $previousIndexSegment = $total - 1;
             $isPaged = JUDirectoryHelperRoute::parsePagination($vars, $segments, $params);
             if ($isPaged) {
                 $previousIndexSegment -= 1;
             }
             if (isset($segments[$previousIndexSegment])) {
                 $isLayout = JUDirectoryHelperRoute::parseLayout($segments[$previousIndexSegment], $vars, $params);
             }
             return $vars;
         }
     }
     $searchSefUserListings = array_search(JApplication::stringURLSafe('listings'), $segments);
     if ($searchSefUserListings !== false) {
         $validArrayIndex = array(0, 1, 2);
         if (in_array($searchSefUserListings, $validArrayIndex)) {
             $vars['view'] = 'userlistings';
             if (isset($segments[$searchSefUserListings - 1])) {
                 if ($segments[$searchSefUserListings - 1] != JApplication::stringURLSafe('root')) {
                     $vars['id'] = (int) $segments[$searchSefUserListings - 1];
                 }
             }
             if (isset($segments[$searchSefUserListings + 1])) {
                 if ($segments[$searchSefUserListings + 1] == JApplication::stringURLSafe('published')) {
                     $vars['filter'] = 'published';
                 } elseif ($segments[$searchSefUserListings + 1] == JApplication::stringURLSafe('unpublished')) {
                     $vars['filter'] = 'unpublished';
                 } elseif ($segments[$searchSefUserListings + 1] == JApplication::stringURLSafe('pending')) {
                     $vars['filter'] = 'pending';
                 }
             }
             $previousIndexSegment = $total - 1;
             $isPaged = JUDirectoryHelperRoute::parsePagination($vars, $segments, $params);
             if ($isPaged) {
                 $previousIndexSegment -= 1;
             }
             if (isset($segments[$previousIndexSegment])) {
                 if ($segments[$previousIndexSegment] == JApplication::stringURLSafe('rss')) {
                     $vars['format'] = 'feed';
                     $previousIndexSegment -= 1;
                 }
             }
             if (isset($segments[$previousIndexSegment])) {
                 $isLayout = JUDirectoryHelperRoute::parseLayout($segments[$previousIndexSegment], $vars, $params);
             }
             return $vars;
         }
     }
     $searchSefUserSubscriptions = array_search(JApplication::stringURLSafe('user-subscriptions'), $segments);
     if ($searchSefUserSubscriptions !== false) {
         $validArrayIndex = array(0, 1, 2);
         if (in_array($searchSefUserSubscriptions, $validArrayIndex)) {
             $vars['view'] = 'usersubscriptions';
             if (isset($segments[$searchSefUserSubscriptions - 1])) {
                 if ($segments[$searchSefUserSubscriptions - 1] != JApplication::stringURLSafe('root')) {
                     $vars['id'] = (int) $segments[$searchSefUserSubscriptions - 1];
                 }
             }
             $previousIndexSegment = $total - 1;
             $isPaged = JUDirectoryHelperRoute::parsePagination($vars, $segments, $params);
             if ($isPaged) {
                 $previousIndexSegment -= 1;
             }
             if (isset($segments[$previousIndexSegment])) {
                 $isLayout = JUDirectoryHelperRoute::parseLayout($segments[$previousIndexSegment], $vars, $params);
             }
             return $vars;
         }
     }
     $searchSefSearchBy = array_search(JApplication::stringURLSafe('search-by'), $segments);
     if ($searchSefSearchBy !== false) {
         $validArrayIndex = array(0, 1);
         if (in_array($searchSefSearchBy, $validArrayIndex)) {
             $vars['view'] = 'searchby';
             if (isset($segments[$searchSefSearchBy + 1])) {
                 $vars['field_id'] = (int) $segments[$searchSefSearchBy + 1];
             }
             if (isset($segments[$searchSefSearchBy + 2])) {
                 $vars['value'] = $segments[$searchSefSearchBy + 2];
             }
             $previousIndexSegment = $total - 1;
             $isPaged = JUDirectoryHelperRoute::parsePagination($vars, $segments, $params);
             if ($isPaged) {
                 $previousIndexSegment -= 1;
             }
             if (isset($segments[$previousIndexSegment])) {
                 $isLayout = JUDirectoryHelperRoute::parseLayout($segments[$previousIndexSegment], $vars, $params);
             }
             return $vars;
         }
     }
     $searchSefContact = array_search(JApplication::stringURLSafe('contact'), $segments);
     if ($searchSefContact !== false) {
         if ($searchSefContact == $indexLastSegment || $searchSefContact == $indexLastSegment - 1) {
             $vars['view'] = 'contact';
             if (isset($segments[$searchSefContact - 1])) {
                 $vars['listing_id'] = (int) $segments[$searchSefContact - 1];
             }
             $previousIndexSegment = $total - 1;
             if (isset($segments[$previousIndexSegment])) {
                 $isLayout = JUDirectoryHelperRoute::parseLayout($segments[$previousIndexSegment], $vars, $params);
             }
             return $vars;
         }
     }
     $searchSefCheckIn = array_search(JApplication::stringURLSafe('checkin'), $segments);
     if ($searchSefCheckIn !== false) {
         $vars['task'] = 'forms.checkin';
         if (isset($segments[$searchSefCheckIn - 1])) {
             $vars['id'] = (int) $segments[$searchSefCheckIn - 1];
         }
         return $vars;
     }
     $searchSefAdd = array_search(JApplication::stringURLSafe('add'), $segments);
     if ($searchSefAdd !== false) {
         $vars['task'] = 'form.add';
         if (isset($segments[$searchSefAdd - 1])) {
             $vars['cat_id'] = (int) $segments[$searchSefAdd - 1];
         }
         return $vars;
     }
     $searchSefEdit = array_search(JApplication::stringURLSafe('edit'), $segments);
     if ($searchSefEdit !== false) {
         $vars['task'] = 'form.edit';
         if (isset($segments[$searchSefEdit - 1])) {
             $vars['id'] = (int) $segments[$searchSefEdit - 1];
         }
         return $vars;
     }
     $searchSefDelete = array_search(JApplication::stringURLSafe('delete'), $segments);
     if ($searchSefDelete !== false) {
         $vars['task'] = 'forms.delete';
         if (isset($segments[$searchSefDelete - 1])) {
             $vars['id'] = (int) $segments[$searchSefDelete - 1];
         }
         return $vars;
     }
     $searchNewListing = array_search(JApplication::stringURLSafe('new-listing'), $segments);
     if ($searchNewListing !== false) {
         $vars['view'] = 'form';
         $vars['layout'] = 'edit';
         if (isset($segments[$searchNewListing - 1])) {
             $vars['cat_id'] = (int) $segments[$searchNewListing - 1];
         }
         return $vars;
     }
     $searchSefApprove = array_search(JApplication::stringURLSafe('approve'), $segments);
     if ($searchSefApprove !== false) {
         if ($searchSefApprove == $indexLastSegment) {
             $vars['task'] = 'modpendinglisting.edit';
             $vars['approve'] = 1;
         } else {
             $vars['view'] = 'form';
             $vars['layout'] = 'edit';
             $vars['approve'] = 1;
         }
         if (isset($segments[$searchSefApprove - 1])) {
             $vars['id'] = (int) $segments[$searchSefApprove - 1];
         }
         return $vars;
     }
     $searchSefPublish = array_search(JApplication::stringURLSafe('publish'), $segments);
     if ($searchSefPublish !== false) {
         $vars['task'] = 'forms.publish';
         if (isset($segments[$searchSefPublish - 1])) {
             $vars['id'] = (int) $segments[$searchSefPublish - 1];
         }
         return $vars;
     }
     $searchSefUnPublish = array_search(JApplication::stringURLSafe('unpublish'), $segments);
     if ($searchSefUnPublish !== false) {
         $vars['task'] = 'forms.unpublish';
         if (isset($segments[$searchSefUnPublish - 1])) {
             $vars['id'] = (int) $segments[$searchSefUnPublish - 1];
         }
         return $vars;
     }
     $searchSefSubscribe = array_search(JApplication::stringURLSafe('subscribe'), $segments);
     if ($searchSefSubscribe !== false) {
         $vars['task'] = 'subscribe.save';
         if (isset($segments[$searchSefSubscribe - 1])) {
             $vars['listing_id'] = (int) $segments[$searchSefSubscribe - 1];
         }
         return $vars;
     }
     $searchSefUnSubscribe = array_search(JApplication::stringURLSafe('unsubscribe'), $segments);
     if ($searchSefUnSubscribe !== false) {
         $vars['task'] = 'subscribe.remove';
         if (isset($segments[$searchSefUnSubscribe + 1])) {
             $vars['sub_id'] = (int) $segments[$searchSefUnSubscribe + 1];
         }
         if (isset($segments[$searchSefUnSubscribe + 2])) {
             $vars['code'] = $segments[$searchSefUnSubscribe + 2];
         }
         return $vars;
     }
     $previousIndexSegment = $indexLastSegment;
     if (isset($segments[$previousIndexSegment])) {
         $isPaged = preg_match('/' . preg_quote(JApplication::stringURLSafe('page') . '-') . '[0-9]*+/', $segments[$previousIndexSegment]);
         if ($isPaged) {
             if ($indexLastSegment == 0) {
                 if (is_object($activeMenu) && $activeMenu->component == 'com_judirectory') {
                     $vars = $activeMenu->query;
                     JUDirectoryHelperRoute::parsePagination($vars, $segments, $params);
                     return $vars;
                 }
             }
             $previousIndexSegment -= 1;
         }
     }
     if (isset($segments[$previousIndexSegment])) {
         $isFeed = $segments[$previousIndexSegment] == JApplication::stringURLSafe('rss') ? true : false;
         if ($isFeed) {
             $vars['format'] = 'feed';
             if ($indexLastSegment == 0) {
                 if (is_object($activeMenu) && $activeMenu->component == 'com_judirectory') {
                     $vars = $activeMenu->query;
                     $vars['format'] = 'feed';
                     return $vars;
                 }
             }
             $previousIndexSegment -= 1;
         }
     }
     if (isset($segments[$previousIndexSegment])) {
         $isLayout = JUDirectoryHelperRoute::parseLayout($segments[$previousIndexSegment], $vars, $params);
         if ($isLayout) {
             $previousIndexSegment -= 1;
         }
     }
     if (!empty($segments)) {
         $reverseSegments = array_reverse($segments);
         foreach ($reverseSegments as $segmentItemKey => $segmentItem) {
             if (preg_match('/^\\d+\\-.+/', $segmentItem)) {
                 $indexAlias = $indexLastSegment - $segmentItemKey;
                 break;
             }
         }
         if (isset($indexAlias) && isset($segments[$indexAlias])) {
             if (strpos($segments[$indexAlias], '-') === false) {
                 $itemId = (int) $segments[$indexAlias];
                 $itemAlias = substr($segments[$indexAlias], strlen($itemId) + 1);
             } else {
                 list($itemId, $itemAlias) = explode('-', $segments[$indexAlias], 2);
             }
             if (is_numeric($itemId)) {
                 $categoryObject = JUDirectoryHelper::getCategoryById($itemId);
                 if (is_object($categoryObject) && isset($categoryObject->alias) && $categoryObject->alias == $itemAlias) {
                     $vars['view'] = 'category';
                     $vars['id'] = $itemId;
                     JUDirectoryHelperRoute::parsePagination($vars, $segments, $params);
                     return $vars;
                 }
                 $listingObject = JUDirectoryHelper::getListingById($itemId);
                 if (is_object($listingObject) && isset($listingObject->alias) && $listingObject->alias == $itemAlias) {
                     $vars['id'] = $itemId;
                     if (isset($vars['layout'])) {
                         if ($vars['layout'] == 'edit') {
                             $vars['view'] = 'form';
                         } else {
                             $vars['view'] = 'listing';
                         }
                     }
                     if (!isset($vars['view'])) {
                         $vars['view'] = 'listing';
                     }
                     if ($vars['view'] == 'listing') {
                         if (isset($segments[$indexAlias + 1])) {
                             if ($segments[$indexAlias + 1] == JApplication::stringURLSafe('print')) {
                                 $vars['print'] = 1;
                                 $vars['tmpl'] = 'component';
                                 $vars['layout'] = 'print';
                             }
                         }
                     }
                     JUDirectoryHelperRoute::parsePagination($vars, $segments, $params);
                     return $vars;
                 }
                 if (is_object($categoryObject) && isset($categoryObject->id) && $categoryObject->id) {
                     $vars['view'] = 'category';
                     $vars['id'] = $itemId;
                     JUDirectoryHelperRoute::parsePagination($vars, $segments, $params);
                     return $vars;
                 }
                 if (is_object($listingObject) && isset($listingObject->id) && $listingObject->id) {
                     $vars['id'] = $itemId;
                     if (isset($vars['layout'])) {
                         if ($vars['layout'] == 'edit') {
                             $vars['view'] = 'form';
                         } else {
                             $vars['view'] = 'listing';
                         }
                     }
                     if (!isset($vars['view'])) {
                         $vars['view'] = 'listing';
                     }
                     if ($vars['view'] == 'listing') {
                         if (isset($segments[$indexAlias + 1])) {
                             if ($segments[$indexAlias + 1] == JApplication::stringURLSafe('print')) {
                                 $vars['print'] = 1;
                                 $vars['tmpl'] = 'component';
                                 $vars['layout'] = 'print';
                             } elseif ($segments[$indexAlias + 1] == JApplication::stringURLSafe('changelogs')) {
                                 $vars['layout'] = 'changelogs';
                             } elseif ($segments[$indexAlias + 1] == JApplication::stringURLSafe('versions')) {
                                 $vars['layout'] = 'versions';
                             }
                         }
                     }
                     JUDirectoryHelperRoute::parsePagination($vars, $segments, $params);
                     return $vars;
                 }
             }
         }
     }
     if (is_object($activeMenu) && $activeMenu->component == 'com_judirectory') {
         $vars = $activeMenu->query;
     }
     return $vars;
 }
Exemplo n.º 24
0
 public function checkin()
 {
     $app = JFactory::getApplication();
     parent::checkin();
     $rootCat = JUDirectoryFrontHelperCategory::getRootCategory();
     $cat_id = $app->input->getInt('cat_id', $rootCat->id);
     if ($app->input->getString('view', 'listcats') == 'treestructure') {
         $this->setRedirect("index.php?option=com_judirectory&view=treestructure");
     } else {
         $this->setRedirect("index.php?option=com_judirectory&view={$this->view_list}&cat_id={$cat_id}");
     }
 }
Exemplo n.º 25
0
 public static function getMenuItemIdArrayOfViewCategoryTreeLevel0And1()
 {
     $menuItemIdsOfViewCategoryTree = self::getMenuItemIdArrayOfViewCategoryTree();
     $menuItemIds = array();
     $categoryObjectListLevel1 = JUDirectoryHelper::getCatsByLevel();
     if ($categoryObjectListLevel1) {
         foreach ($categoryObjectListLevel1 as $categoryObjectLevel1) {
             if (isset($menuItemIdsOfViewCategoryTree[$categoryObjectLevel1->id])) {
                 $menuItemIds[$categoryObjectLevel1->id] = $menuItemIdsOfViewCategoryTree[$categoryObjectLevel1->id];
             }
         }
         $categoryRoot = JUDirectoryFrontHelperCategory::getRootCategory();
         if (isset($menuItemIdsOfViewCategoryTree[$categoryRoot->id])) {
             $menuItemIds[$categoryRoot->id] = $menuItemIdsOfViewCategoryTree[$categoryRoot->id];
         }
     }
     return $menuItemIds;
 }
Exemplo n.º 26
0
 public function cancel($key = null)
 {
     JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
     $app = JFactory::getApplication();
     $listing_id = $app->input->getInt('id', 0);
     if ($listing_id) {
         $listingObject = JUDirectoryHelper::getListingById($listing_id);
         $cat_id = $listingObject->cat_id;
     } else {
         $fieldCategory = JUDirectoryFrontHelperField::getField('cat_id');
         $fieldsData = $app->input->post->get('fields', array(), 'array');
         $cat_id = $fieldsData[$fieldCategory->id]['main'];
     }
     if (!$cat_id) {
         $rootCategory = JUDirectoryFrontHelperCategory::getRootCategory();
         $cat_id = $rootCategory->id;
     }
     $context = $this->option . ".edit." . $this->context;
     $app->setUserState($context . '.data', null);
     $app->setUserState($context . '.fieldsdata', null);
     $app->setUserState($context . '.related_listings', null);
     if ($listing_id) {
         $db = JFactory::getDbo();
         $query = "SELECT cat_id FROM #__judirectory_listings_xref WHERE listing_id = {$listing_id} AND main = 1";
         $db->setQuery($query);
         $cat_id = $db->loadResult();
     }
     parent::cancel($key = null);
     if ($this->view_list == "pendinglistings") {
         $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend(), false));
     } else {
         $this->setRedirect("index.php?option=com_judirectory&view=listcats&cat_id={$cat_id}");
     }
 }
Exemplo n.º 27
0
 public function listingChangeCategory()
 {
     $app = JFactory::getApplication();
     if ($app->input->get('action', '') == 'update-maincat') {
         $ori_cat_id = $app->input->getInt('ori_cat_id', 0);
         $ori_cat = JUDirectoryHelper::getCategoryById($ori_cat_id);
         $data['ori_field_group_id'] = 0;
         $data['new_field_group_id'] = 0;
         $data['new_field_group_name'] = "";
         $data['path'] = "";
         if ($ori_cat) {
             $data['ori_field_group_id'] = $ori_cat->fieldgroup_id;
         }
         $new_cat_id = $app->input->getInt('new_cat_id', 0);
         $rootCat = JUDirectoryFrontHelperCategory::getRootCategory();
         $params = JUDirectoryHelper::getParams();
         if ($rootCat->id == $new_cat_id && !$params->get('allow_add_listing_to_root', 0)) {
             return "";
         }
         $new_cat = JUDirectoryHelper::getCategoryById($new_cat_id);
         if ($new_cat) {
             $db = JFactory::getDbo();
             $query = "SELECT id, name FROM #__judirectory_fields_groups WHERE id = " . $new_cat->fieldgroup_id . " AND published = 1";
             $db->setQuery($query);
             $fieldgroup = $db->loadObject();
             if ($fieldgroup) {
                 $data['new_field_group_id'] = $fieldgroup->id;
                 $data['new_field_group_name'] = $fieldgroup->name;
             }
             $data['path'] = JUDirectoryHelper::generateCategoryPath($new_cat_id);
         }
         if ($data['ori_field_group_id'] != $data['new_field_group_id']) {
             $data['msg_field_group'] = JText::_('COM_JUDIRECTORY_CHANGE_MAIN_CATEGORY_CAUSE_CHANGE_FIELD_GROUP_WARNING');
         }
         $listingId = $app->input->getInt('id', 0);
         $data['message_style'] = JText::_('COM_JUDIRECTORY_INHERIT');
         if ($listingId) {
             $listingObject = JUDirectoryHelper::getListingById($listingId);
             if ($listingObject->style_id == -1) {
                 $oldStyleObject = JUDirectoryFrontHelperTemplate::getTemplateStyleOfCategory($listingId->cat_id);
                 $newStyleObject = JUDirectoryFrontHelperTemplate::getTemplateStyleOfCategory($new_cat->id);
                 if ($oldStyleObject->template_id != $newStyleObject->template_id) {
                     $data['msg_style'] = JText::_('COM_JUDIRECTORY_CHANGE_MAIN_CATEGORY_CAUSE_CHANGE_TEMPLATE_WARNING');
                 }
             }
             $newTemplateStyleObject = JUDirectoryFrontHelperTemplate::getTemplateStyleOfCategory($new_cat->id);
             $data['message_style'] = JText::_('COM_JUDIRECTORY_INHERIT') . ' (' . $newTemplateStyleObject->title . ' [' . $newTemplateStyleObject->template_title . ' ]' . ')';
         }
         return json_encode($data);
     } elseif ($app->input->getInt('action', '') == 'insert_secondary_cat') {
         $cat_id_str = $app->input->get('secondary_cat_id', '', 'string');
         $html = '';
         if (!empty($cat_id_str)) {
             $cat_id_arr = explode(",", $cat_id_str);
             foreach ($cat_id_arr as $key => $cat_id) {
                 $html .= "<li id=\"cat-" . $cat_id . "\"><a class=\"drag-icon\"></a><span>" . JUDirectoryHelper::generateCategoryPath($cat_id) . "</span><a href=\"#\" onclick=\"return false\" class=\"remove-secondary-cat\" ><i class=\"icon-minus fa fa-minus-circle\"></i> " . JText::_('COM_JUDIRECTORY_REMOVE') . "</a></li>";
             }
         }
         return $html;
     }
 }
 protected function getInput()
 {
     $db = JFactory::getDbo();
     $app = JFactory::getApplication();
     $style_id = $app->input->getInt('id', 0);
     $db->setQuery("SELECT id FROM #__judirectory_categories WHERE style_id = " . $style_id);
     $catIds = $db->loadColumn();
     $rootCategory = JUDirectoryFrontHelperCategory::getRootCategory();
     $categoryTree = JUDirectoryHelper::getCategoryTree($rootCategory->id);
     $html = "<div id=\"categoriestoassignstyle\" class=\"categoriestoassignstyle\">";
     $select_cat_class = 'select-cat';
     $html .= '<div class="btn-group pull-left">';
     $html .= '<button type="button" class="btn btn-mini" onclick="jQuery(\'.' . $select_cat_class . '\').each(function(el) { jQuery(this).prop(\'checked\', !jQuery(this).is(\':checked\')); });">' . JText::_('JGLOBAL_SELECTION_INVERT') . '</button>';
     $html .= '<button type="button" class="btn btn-mini" onclick="jQuery(\'.' . $select_cat_class . '\').each(function(el) { jQuery(this).prop(\'checked\', false); });">' . JText::_('JGLOBAL_SELECTION_NONE') . '</button>';
     $html .= '<button type="button" class="btn btn-mini" onclick="jQuery(\'.' . $select_cat_class . '\').each(function(el) {  jQuery(this).prop(\'checked\', true); });">' . JText::_('JGLOBAL_SELECTION_ALL') . '</button>';
     $html .= '</div>';
     $html .= "<ul class=\"nav\" id=\"" . $this->id . "\">";
     foreach ($categoryTree as $category) {
         $html .= "<li>";
         $cat_style_id = "";
         if ($category->id == 1) {
             $cat_style_id = $category->style_id;
             $inherit = "";
         } elseif ($category->style_id == $style_id) {
             $html .= "<input class =\"" . $select_cat_class . "\" id=\"catid-" . $category->id . "\" type='checkbox' name='" . $this->name . "[]' value = '" . $category->id . "' checked>";
             $cat_style_id = $style_id;
             $inherit = "";
         } elseif ($category->style_id == -1) {
             $html .= "<input class =\"" . $select_cat_class . "\" id=\"catid-" . $category->id . "\" type='checkbox' name='" . $this->name . "[]' value = '" . $category->id . "'";
             $db->setQuery("SELECT id FROM #__judirectory_categories WHERE lft <" . $category->lft . " AND rgt > " . $category->rgt);
             $parentCatIds = $db->loadColumn();
             $parentCatIds = array_reverse($parentCatIds);
             if (is_array($catIds) && !empty($catIds)) {
                 foreach ($parentCatIds as $parentCatId) {
                     if (in_array($parentCatId, $catIds)) {
                         $html .= " checked";
                     }
                 }
             }
             $html .= ">";
             foreach ($parentCatIds as $parentCatId) {
                 $styleId = $this->getStyleIdByCategoryId($parentCatId);
                 if ($styleId > -1 || $styleId == -2) {
                     $cat_style_id = $styleId;
                     break;
                 }
             }
             $inherit = "<span class=\"inherited-value\" title=\"" . JText::_("COM_JUDIRECTORY_INHERIT") . "\">" . JText::_("COM_JUDIRECTORY_INHERIT") . "</span>";
         } elseif ($category->style_id == -2) {
             $html .= "<input type='checkbox' name='" . $this->name . "[]' value = '" . $category->id . "'>";
             $inherit = "";
             $db->setQuery("SELECT id FROM #__judirectory_template_styles WHERE home = 1");
             $cat_style_id = $db->loadResult();
         } else {
             $html .= "<input class =\"" . $select_cat_class . "\" id=\"catid-" . $category->id . "\" type='checkbox' name='" . $this->name . "[]' value = '" . $category->id . "' />";
             $inherit = "";
             $cat_style_id = $category->style_id;
         }
         if ($cat_style_id == -2) {
             $style_title = $this->getStyleTitle(0, true);
         } else {
             $style_title = $this->getStyleTitle($cat_style_id);
         }
         $style_title = $style_title ? " [" . $style_title . "] " : "";
         $html .= "<label for=\"catid-" . $category->id . "\">" . str_repeat('<span class="gi">|—</span>', $category->level);
         if ($category->id == 1) {
             $html .= $category->title;
         } else {
             $html .= "<a href=\"" . JRoute::_('index.php?option=com_judirectory&task=category.edit&id=' . $category->id) . "\">" . $category->title . "</a>";
         }
         $html .= " <span class=\"style-title\">" . $style_title . "</span>" . $inherit . "</label>";
         $html .= "</li>";
     }
     $html .= "</ul>";
     $html .= "</div>";
     return $html;
 }
Exemplo n.º 29
0
 protected function populateState($ordering = null, $direction = null)
 {
     $rootCat = JUDirectoryFrontHelperCategory::getRootCategory();
     $cat_id = $this->getUserStateFromRequest($this->context . '.cat_id', 'cat_id', $rootCat->id);
     $this->setState('list.cat_id', $cat_id);
     $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
     $this->setState('filter.search', $search);
     $search = $this->getUserStateFromRequest($this->context . '.filter.search_cat', 'filter_search_cat');
     $this->setState('filter.search_cat', $search);
     $search = $this->getUserStateFromRequest($this->context . '.filter.simple_search', 'simple_search');
     $this->setState('filter.simple_search', $search);
     $search_in = $this->getUserStateFromRequest($this->context . '.filter.search_in', 'search_in', 'listings', 'none', false);
     $this->setState('filter.search_in', $search_in);
     $ordering = $this->getUserStateFromRequest($this->context . '.filter.ordering_cat', 'filter_order_cat');
     if (empty($ordering)) {
         $this->setState('filter.ordering_cat', 'lft');
     } else {
         $this->setState('filter.ordering_cat', $ordering);
     }
     $direction = $this->getUserStateFromRequest($this->context . '.filter.direction_cat', 'filter_order_Dir_cat');
     if (empty($direction)) {
         $this->setState('filter.direction_cat', 'asc');
     } else {
         $this->setState('filter.direction_cat', $direction);
     }
     parent::populateState($ordering, $direction);
 }