Пример #1
0
 function __construct()
 {
     parent::__construct();
     switch ($this->integrationMode) {
         case 'groups':
             // The primary key for categories
             switch (getCmsVersion()) {
                 case CMS_JOOMLA10:
                 case CMS_MAMBO46:
                     $this->categoryPrimaryKey = 'group_id';
                     break;
                 case CMS_JOOMLA15:
                     $this->categoryPrimaryKey = 'id';
                     break;
             }
             $this->joins = array('Total' => "LEFT JOIN #__jreviews_listing_totals AS Totals ON Totals.listing_id = Listing.id AND Totals.extension = 'com_comprofiler'", "LEFT JOIN #__core_acl_aro_groups AS Category ON Listing.gid = Category.{$this->categoryPrimaryKey}", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Listing.gid = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_comprofiler'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id', 'LEFT JOIN #__comprofiler AS CommunityBuilder ON Listing.id = CommunityBuilder.id', "LEFT JOIN #__users AS User ON User.id = Listing.id");
             $this->joinsReviews = array("LEFT JOIN #__users AS Listing ON Review.pid = Listing.id", "LEFT JOIN #__core_acl_aro_groups AS Category ON Listing.gid = Category.{$this->categoryPrimaryKey}", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Listing.gid = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_comprofiler'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id');
             break;
         case 'fields':
             $this->fields = array('Listing.id AS `Listing.listing_id`', 'Listing.username AS `Listing.title`', 'CommunityBuilder.avatar AS `Listing.images`', 'CommunityBuilder.avatarapproved AS `Listing.images_approved`', "'com_comprofiler' AS `Listing.extension`", 'JreviewsCategory.id AS `Listing.cat_id`', 'Category.fieldtitle AS `Category.title`', 'JreviewsCategory.id AS `Category.cat_id`', 'Criteria.id AS `Criteria.criteria_id`', 'Criteria.criteria AS `Criteria.criteria`', 'Criteria.tooltips AS `Criteria.tooltips`', 'Criteria.weights AS `Criteria.weights`', 'Criteria.required AS `Criteria.required`', 'Criteria.state AS `Criteria.state`');
             $this->joins = array('INNER JOIN #__comprofiler AS CommunityBuilder ON Listing.id = CommunityBuilder.id', "LEFT JOIN #__comprofiler_field_values AS Category ON CommunityBuilder.{$this->cbCustomField} = Category.fieldtitle", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Category.fieldvalueid = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_comprofiler'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id');
             $this->joinsReviews = array('INNER JOIN #__comprofiler AS CommunityBuilder ON Review.pid = CommunityBuilder.id', "LEFT JOIN #__comprofiler_field_values AS Category ON CommunityBuilder.{$this->cbCustomField} = Category.fieldtitle", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Category.fieldvalueid = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_comprofiler'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id');
             break;
     }
     $this->tag = __t("COMMUNITY_BUILDER_TAG", true);
     // Used in MyReviews page to differentiate from other component reviews
     $this->fields[] = "'{$this->tag}' AS `Listing.tag`";
 }
Пример #2
0
 function __construct()
 {
     parent::__construct();
     Configure::write('Community.profileUrl', $this->profileUrl);
     if (file_exists(PATH_ROOT . 'components' . _DS . 'com_community' . _DS . 'community.php')) {
         $this->community = true;
         $Menu = ClassRegistry::getClass('MenuModel');
         $this->menu_id = $Menu->getComponentMenuId('com_community&view=frontpage');
         if (!$this->menu_id) {
             $this->menu_id = $Menu->getComponentMenuId('com_community&view=profile');
         }
         if (!$this->menu_id) {
             $this->menu_id = $Menu->getComponentMenuId('com_community');
         }
         // For JomSocial <= 2.1
         if (!file_exists(PATH_ROOT . 'components/com_community/assets/user_thumb.png')) {
             $this->default_thumb = 'components/com_community/assets/default_thumb.jpg';
         }
         $cache_key = 'jomsocial_config_' . md5(cmsFramework::getConfig('secret'));
         $JSConfig = S2Cache::read($cache_key);
         if (false == $JSConfig) {
             // Read the JomSocial configuration to determine the storage location for avatars
             $JSConfig = json_decode($this->query("SELECT params FROM #__community_config WHERE name = 'config'", 'loadResult'), true);
             $JSConfigForJReviews = array('user_avatar_storage' => $JSConfig['user_avatar_storage'], 'storages3bucket' => $JSConfig['storages3bucket']);
             S2Cache::write($cache_key, $JSConfigForJReviews);
         }
         $this->avatar_storage = $JSConfig['user_avatar_storage'];
         $this->s3_bucket = $JSConfig['storages3bucket'];
         Configure::write('Community.register_url', sprintf($this->registerUrl, $this->menu_id));
     }
 }
Пример #3
0
 function __construct()
 {
     parent::__construct();
     if ($this->cmsVersion == CMS_JOOMLA15) {
         $this->fields = array('Category.id AS `Category.cat_id`', 'Category.section AS `Category.section_id`', 'Category.title AS `Category.title`', 'Category.alias AS `Category.slug`', 'Category.image AS `Category.image`', 'Category.image_position AS `Category.image_position`', 'Category.description AS `Category.description`', 'Category.access AS `Category.access`', 'Category.published AS `Category.published`', 'Directory.id AS `Category.dir_id`', 'JreviewsCategory.criteriaid AS `Category.criteria_id`', 'JreviewsCategory.tmpl AS `Category.tmpl`', 'JreviewsCategory.tmpl_suffix AS `Category.tmpl_suffix`', 'Directory.id AS `Directory.dir_id`', 'Directory.desc AS `Directory.title`', 'Directory.title AS `Directory.slug`', 'ListingType.config AS `ListingType.config`');
     }
 }
Пример #4
0
 function __construct()
 {
     parent::__construct();
     $this->tag = __t("K2_TAG", true);
     // Used in MyReviews page to differentiate from other component reviews
     //		$this->fields[] = "'{$this->tag }' AS `Listing.tag`";
 }
 function __construct()
 {
     parent::__construct();
     $cms_version = getCmsVersion();
     switch ($this->integrationMode) {
         case 'groups':
             $this->fields['Category.title'] = 'Category.title AS `Category.title`';
             $this->joins = array('Total' => "LEFT JOIN #__jreviews_listing_totals AS Totals ON Totals.listing_id = Listing.id AND Totals.extension = 'com_comprofiler'", 'CategoryMap' => "LEFT JOIN #__user_usergroup_map AS CategoryMap ON Listing.id = CategoryMap.user_id", 'JreviewsCategory' => "INNER JOIN #__jreviews_categories AS JreviewsCategory ON CategoryMap.group_id = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_comprofiler'", 'Category' => "LEFT JOIN #__usergroups AS Category ON CategoryMap.group_id = Category.{$this->categoryPrimaryKey}", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id', 'LEFT JOIN #__comprofiler AS CommunityBuilder ON Listing.id = CommunityBuilder.id', "LEFT JOIN #__users AS User ON User.id = Listing.id");
             $this->group[] = 'Listing.id';
             $this->joinsReviews = array("LEFT JOIN #__users AS Listing ON Review.pid = Listing.id", 'CategoryMap' => "LEFT JOIN #__user_usergroup_map AS CategoryMap ON Listing.id = CategoryMap.user_id", 'JreviewsCategory' => "INNER JOIN #__jreviews_categories AS JreviewsCategory ON CategoryMap.group_id = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_comprofiler'", 'Category' => "LEFT JOIN #__usergroups AS Category ON CategoryMap.group_id = Category.{$this->categoryPrimaryKey}", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id');
             if ($cms_version == CMS_JOOMLA15) {
                 unset($this->group);
                 $this->fields['Category.title'] = 'Category.name AS `Category.title`';
                 $this->joins = array('Total' => "LEFT JOIN #__jreviews_listing_totals AS Totals ON Totals.listing_id = Listing.id AND Totals.extension = 'com_comprofiler'", 'Category' => "LEFT JOIN #__core_acl_aro_groups AS Category ON Listing.gid = Category.{$this->categoryPrimaryKey}", 'JreviewsCategory' => "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Listing.gid = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_comprofiler'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id', 'LEFT JOIN #__comprofiler AS CommunityBuilder ON Listing.id = CommunityBuilder.id', "LEFT JOIN #__users AS User ON User.id = Listing.id");
                 $this->joinsReviews = array("LEFT JOIN #__users AS Listing ON Review.pid = Listing.id", "LEFT JOIN #__core_acl_aro_groups AS Category ON Listing.gid = Category.{$this->categoryPrimaryKey}", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Listing.gid = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_comprofiler'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id');
             }
             break;
         case 'fields':
             $this->fields = array('Listing.id AS `Listing.listing_id`', 'Listing.title' => 'Listing.username AS `Listing.title`', 'CommunityBuilder.avatar AS `Listing.images`', 'CommunityBuilder.avatarapproved AS `Listing.images_approved`', "'com_comprofiler' AS `Listing.extension`", 'JreviewsCategory.id AS `Listing.cat_id`', 'Category.fieldtitle AS `Category.title`', 'JreviewsCategory.id AS `Category.cat_id`', 'Criteria.id AS `Criteria.criteria_id`', 'Criteria.criteria AS `Criteria.criteria`', 'Criteria.tooltips AS `Criteria.tooltips`', 'Criteria.weights AS `Criteria.weights`', 'Criteria.required AS `Criteria.required`', 'Criteria.state AS `Criteria.state`');
             $this->joins = array('INNER JOIN #__comprofiler AS CommunityBuilder ON Listing.id = CommunityBuilder.id', "LEFT JOIN #__comprofiler_field_values AS Category ON CommunityBuilder.{$this->cbCustomField} = Category.fieldtitle", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Category.fieldvalueid = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_comprofiler'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id');
             $this->joinsReviews = array('INNER JOIN #__comprofiler AS CommunityBuilder ON Review.pid = CommunityBuilder.id', "LEFT JOIN #__comprofiler_field_values AS Category ON CommunityBuilder.{$this->cbCustomField} = Category.fieldtitle", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Category.fieldvalueid = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_comprofiler'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id');
             break;
     }
     $this->tag = __t("COMMUNITY_BUILDER_TAG", true);
     // Used in MyReviews page to differentiate from other component reviews
     $this->fields[] = "'{$this->tag}' AS `Listing.tag`";
     # Use name or username based on JReviews config
     $Config = Configure::read('JreviewsSystem.Config');
     if ($Config->name_choice == 'realname') {
         $this->fields['Listing.title'] = 'Listing.name AS `Listing.title`';
     }
     unset($Config);
 }
 function __construct()
 {
     parent::__construct();
     // Used in MyReviews page to differentiate from other component reviews
     $this->tag = __t("EZREALTY_PROFILE_TAG", true);
     // Uncomment line below to show tag in My Reviews page
     //		$this->fields[] = "'{$this->tag }' AS `Listing.tag`";
 }
Пример #7
0
 function __construct()
 {
     parent::__construct();
     $this->tag = __t("SOBI2_TAG", true);
     // Used in MyReviews page to differentiate from other component reviews
     $this->fields[] = "'{$this->tag}' AS `Listing.tag`";
     // Comment this line to hide the tag from the output
 }
 function __construct()
 {
     parent::__construct();
     $this->joins = array('INNER JOIN #__comprofiler AS CommunityBuilder ON Listing.id = CommunityBuilder.id', "LEFT JOIN #__comprofiler_field_values AS Category ON CommunityBuilder.{$this->customField} = Category.fieldtitle", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Category.fieldvalueid = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_comprofiler'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id');
     $this->joinsReviews = array('INNER JOIN #__comprofiler AS CommunityBuilder ON Review.pid = CommunityBuilder.id', "LEFT JOIN #__comprofiler_field_values AS Category ON CommunityBuilder.{$this->customField} = Category.fieldtitle", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Category.fieldvalueid = JreviewsCategory.id AND JreviewsCategory.`option` = 'com_comprofiler'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id');
     $this->tag = __t("COMMUNITY_BUILDER_TAG", true);
     // Used in MyReviews page to differentiate from other component reviews
     $this->fields[] = "'{$this->tag}' AS `Listing.tag`";
 }
Пример #9
0
 function __construct()
 {
     parent::__construct();
     /*		if(getCmsVersion() == CMS_JOOMLA15) {
     			// Add listing, category aliases to fields
     			$this->fields[] = 'CASE WHEN CHAR_LENGTH(Section.alias) THEN Section.alias ELSE Section.title END AS `Section.slug`';
     		} else {
     			$this->fields[] = 'Section.name AS `Section.slug`';
     		}		*/
 }
Пример #10
0
 function __construct()
 {
     parent::__construct();
     // Used in MyReviews page to differentiate from other component reviews
     $this->tag = __t("MYBLOG_TAG", true);
     // Uncomment line below to show tag in My Reviews page
     $this->fields[] = "'{$this->tag}' AS `Listing.tag`";
     // Set default WHERE statement
     $this->conditions = array('Listing.state = 1', '( Listing.publish_up = "' . NULL_DATE . '" OR Listing.publish_up <= "' . _CURRENT_SERVER_TIME . '" )', '( Listing.publish_down = "' . NULL_DATE . '" OR Listing.publish_down >= "' . _CURRENT_SERVER_TIME . '" )', 'Listing.access <= ' . $this->_user->gid, 'Listing.catid > 0');
 }
Пример #11
0
 function __construct()
 {
     parent::__construct();
     Configure::write('Community.profileUrl', $this->profileUrl);
     if (file_exists(PATH_ROOT . 'components' . _DS . 'com_kunena' . _DS . 'kunena.php')) {
         $this->community = true;
         $Menu = registerClass::getInstance('MenuModel');
         $this->menu_id = $Menu->getComponentMenuId('com_kunena');
     }
 }
Пример #12
0
 function __construct()
 {
     parent::__construct();
     Configure::write('Community.profileUrl', $this->profileUrl);
     if (file_exists(PATH_ROOT . 'components' . _DS . 'com_comprofiler' . _DS . 'comprofiler.php')) {
         $this->community = true;
         $Menu = ClassRegistry::getClass('MenuModel');
         $this->menu_id = $Menu->getComponentMenuId('com_comprofiler', true);
         // 2nd parameter forces a LIKE '%com_comprofiler' query to find only the profile menu
         Configure::write('Community.register_url', sprintf($this->registerUrl, $this->menu_id));
     }
 }
Пример #13
0
 function __construct()
 {
     parent::__construct();
     Configure::write('Community.profileUrl', $this->profileUrl);
     if (file_exists(PATH_ROOT . 'components' . _DS . 'com_socialengine' . _DS . 'socialengine.php')) {
         $this->community = true;
         $Menu = registerClass::getInstance('MenuModel');
         $this->menu_id = $Menu->getComponentMenuId('index.php?option=com_socialengine&view=person');
         if (!$this->menu_id) {
             $this->menu_id = $Menu->getComponentMenuId('com_socialengine');
         }
     }
 }
Пример #14
0
 function __construct()
 {
     parent::__construct();
     Configure::write('Community.profileUrl', $this->profileUrl);
     if (file_exists(PATH_ROOT . 'components' . _DS . 'com_community' . _DS . 'community.php')) {
         $this->community = true;
         $Menu = registerClass::getInstance('MenuModel');
         $this->menu_id = $Menu->getComponentMenuId('com_community&view=profile');
         if (!$this->menu_id) {
             $this->menu_id = $Menu->getComponentMenuId('com_community');
         }
         Configure::write('Community.register_url', sprintf($this->registerUrl, $this->menu_id));
     }
 }
 function __construct()
 {
     parent::__construct();
     // The primary key for categories
     switch (getCmsVersion()) {
         case CMS_JOOMLA10:
         case CMS_MAMBO46:
             $this->categoryPrimaryKey = 'group_id';
             break;
         case CMS_JOOMLA15:
             $this->categoryPrimaryKey = 'id';
             break;
     }
     $this->joins = array('Total' => "LEFT JOIN #__jreviews_listing_totals AS Totals ON Totals.listing_id = Listing.id AND Totals.extension = '{$this->extension_alias}'", "LEFT JOIN #__core_acl_aro_groups AS Category ON Listing.gid = Category.{$this->categoryPrimaryKey}", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Listing.gid = JreviewsCategory.id AND JreviewsCategory.`option` = '{$this->extension_alias}'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id', 'LEFT JOIN #__community_users AS Community ON Listing.id = Community.userid', "LEFT JOIN #__users AS User ON User.id = Listing.id");
     $this->joinsReviews = array("LEFT JOIN #__users AS Listing ON Review.pid = Listing.id", "LEFT JOIN #__core_acl_aro_groups AS Category ON Listing.gid = Category.{$this->categoryPrimaryKey}", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Listing.gid = JreviewsCategory.id AND JreviewsCategory.`option` = '{$this->extension_alias}'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id');
     $this->tag = __t("JOMSOCIAL_TAG", true);
     // Used in MyReviews page to differentiate from other component reviews
     $this->fields[] = "'{$this->tag}' AS `Listing.tag`";
 }
 function __construct()
 {
     parent::__construct();
     $User =& cmsFramework::getUser();
     // Used in MyReviews page to differentiate from other component reviews
     $this->tag = __t("MYBLOG_TAG", true);
     // Uncomment line below to show tag in My Reviews page
     $this->fields[] = "'{$this->tag}' AS `Listing.tag`";
     // Set default WHERE statement
     $this->conditions = array('Listing.state = 1', '( Listing.publish_up = "' . NULL_DATE . '" OR Listing.publish_up <= "' . _CURRENT_SERVER_TIME . '" )', '( Listing.publish_down = "' . NULL_DATE . '" OR Listing.publish_down >= "' . _CURRENT_SERVER_TIME . '" )', 'Listing.catid > 0');
     if (!defined('MVC_FRAMEWORK_ADMIN')) {
         # Shows only links users can access
         $Access = Configure::read('JreviewsSystem.Access');
         if ($this->cmsVersion == CMS_JOOMLA15) {
             $this->conditions[] = 'Listing.access <= ' . $User->gid;
         } else {
             $this->conditions[] = 'Listing.access IN ( ' . $Access->getAccessLevels() . ')';
         }
     }
 }
Пример #17
0
 function __construct()
 {
     parent::__construct();
     Configure::write('Community.profileUrl', $this->profileUrl);
     if (file_exists(PATH_ROOT . 'components' . _DS . 'com_community' . _DS . 'community.php')) {
         $this->community = true;
         $Menu = ClassRegistry::getClass('MenuModel');
         $this->menu_id = $Menu->getComponentMenuId('com_community&view=frontpage');
         if (!$this->menu_id) {
             $this->menu_id = $Menu->getComponentMenuId('com_community&view=profile');
         }
         if (!$this->menu_id) {
             $this->menu_id = $Menu->getComponentMenuId('com_community');
         }
         // For JomSocial <= 2.1
         if (!file_exists(PATH_ROOT . 'components/com_community/assets/user_thumb.png')) {
             $this->default_thumb = 'components/com_community/assets/default_thumb.jpg';
         }
         Configure::write('Community.register_url', sprintf($this->registerUrl, $this->menu_id));
     }
 }
Пример #18
0
 function __construct()
 {
     parent::__construct();
     $this->tag = __t("Listing", true);
     // Used in MyReviews page to differentiate from other component reviews
     // Uncomment line below to show tag in My Reviews page
     //		$this->fields[] = "'{$this->tag }' AS `Listing.tag`";
     if (getCmsVersion() == CMS_JOOMLA15) {
         // Add listing, category aliases to fields
         $this->fields[] = 'Listing.alias AS `Listing.slug`';
         $this->fields[] = 'Category.alias AS `Category.slug`';
         $this->fields[] = 'Section.alias AS `Section.slug`';
     } else {
         $this->fields[] = 'Listing.title_alias AS `Listing.slug`';
         $this->fields[] = 'Category.name AS `Category.slug`';
         $this->fields[] = 'Section.name AS `Section.slug`';
     }
     // PaidListings integration - when completing review info needs to be triggered here
     if (class_exists('PaidListingsComponent')) {
         PaidListingsComponent::applyBeforeFindListingChanges($this);
     }
     $this->Routes = RegisterClass::getInstance('RoutesHelper');
 }
 function __construct()
 {
     if (getCmsVersion() == CMS_JOOMLA15) {
         $this->fields[] = 'Listing.sectionid AS `Listing.section_id`';
         $this->fields[] = 'Section.id AS `Section.section_id`';
         $this->fields[] = 'Section.title AS `Section.title`';
         $this->fields[] = 'Section.alias AS `Section.slug`';
         $this->fields[] = 'Category.image AS `Listing.category_image`';
         unset($this->fields['cat_params'], $this->joins['ParentCategory']);
     } else {
         unset($this->joins['Section']);
     }
     parent::__construct();
     $this->tag = __t("Listing", true);
     // Used in MyReviews page to differentiate from other component reviews
     // Uncomment line below to show tag in My Reviews page
     //		$this->fields[] = "'{$this->tag }' AS `Listing.tag`";
     // PaidListings integration - when completing review info needs to be triggered here
     if (class_exists('PaidListingsComponent')) {
         PaidListingsComponent::applyBeforeFindListingChanges($this);
     }
     $this->Routes = ClassRegistry::getClass('RoutesHelper');
 }
 function __construct()
 {
     parent::__construct();
     $this->groups_table = $this->cmsVersion == CMS_JOOMLA15 ? '#__core_acl_aro_groups' : '#__usergroups';
     $this->groups_title_col = $this->cmsVersion == CMS_JOOMLA15 ? 'name' : 'title';
     $this->fields['cat_name'] = "Category.{$this->groups_title_col} AS `Category.title`";
     if ($this->cmsVersion == CMS_JOOMLA15) {
         $this->joins = array('Total' => "LEFT JOIN #__jreviews_listing_totals AS Totals ON Totals.listing_id = Listing.id AND Totals.extension = '{$this->extension_alias}'", "LEFT JOIN {$this->groups_table} AS Category ON Listing.gid = Category.{$this->categoryPrimaryKey}", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Listing.gid = JreviewsCategory.id AND JreviewsCategory.`option` = '{$this->extension_alias}'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id', 'LEFT JOIN #__community_users AS Community ON Listing.id = Community.userid', "LEFT JOIN #__users AS User ON User.id = Listing.id");
         $this->joinsReviews = array("LEFT JOIN #__users AS Listing ON Review.pid = Listing.id", "LEFT JOIN {$this->groups_table} AS Category ON Listing.gid = Category.{$this->categoryPrimaryKey}", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Listing.gid = JreviewsCategory.id AND JreviewsCategory.`option` = '{$this->extension_alias}'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id');
     } else {
         $this->joins = array('Total' => "LEFT JOIN #__jreviews_listing_totals AS Totals ON Totals.listing_id = Listing.id AND Totals.extension = '{$this->extension_alias}'", "INNER JOIN #__user_usergroup_map AS UserGroupMap ON UserGroupMap.user_id = Listing.id", "LEFT JOIN {$this->groups_table} AS Category ON UserGroupMap.group_id = Category.{$this->categoryPrimaryKey}", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Category.{$this->categoryPrimaryKey} = JreviewsCategory.id AND JreviewsCategory.`option` = '{$this->extension_alias}'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id', 'LEFT JOIN #__community_users AS Community ON Listing.id = Community.userid', "LEFT JOIN #__users AS User ON User.id = Listing.id");
         $this->joinsReviews = array("LEFT JOIN #__users AS Listing ON Review.pid = Listing.id", "INNER JOIN #__user_usergroup_map AS UserGroupMap ON UserGroupMap.user_id = Listing.id", "LEFT JOIN {$this->groups_table} AS Category ON UserGroupMap.group_id = Category.{$this->categoryPrimaryKey}", "INNER JOIN #__jreviews_categories AS JreviewsCategory ON Category.{$this->categoryPrimaryKey} = JreviewsCategory.id AND JreviewsCategory.`option` = '{$this->extension_alias}'", 'LEFT JOIN #__jreviews_criteria AS Criteria ON JreviewsCategory.criteriaid = Criteria.id');
     }
     $this->group[] = "Listing.id";
     $this->tag = __t("JOMSOCIAL_TAG", true);
     // Used in MyReviews page to differentiate from other component reviews
     $this->fields[] = "'{$this->tag}' AS `Listing.tag`";
     # Use name or username based on JReviews config
     $Config = Configure::read('JreviewsSystem.Config');
     if ($Config->name_choice == 'realname') {
         $this->fields['Listing.title'] = 'Listing.name AS `Listing.title`';
     }
     unset($Config);
 }
Пример #21
0
 function __construct()
 {
     parent::__construct();
     $menuList = array();
     switch (getCmsVersion()) {
         case CMS_JOOMLA15:
             $select = 'SELECT id,name,link AS menu_type,link,componentid,params,access,published';
             $type = "\n AND type = 'component'";
             $link = "\n AND ( \n                    link LIKE '%option=com_content&view=section%' OR\n                    link LIKE '%option=com_content&view=section&layout=blog%' OR\n                    link LIKE '%option=com_content&view=category\\%' OR\n                    link LIKE '%option=com_content&view=category&layout=blog%' OR\n                    link LIKE '%option=com_content&view=article%'                \n                )";
             break;
         case CMS_JOOMLA16:
             $select = "\n                    SELECT \n                        id, \n                        alias AS name,\n                        link AS menu_type,\n                        link,\n                        component_id AS componentid,\n                        params,\n                        access,\n                        published\n                ";
             $type = "\n AND type = 'component'";
             $link = "\n AND ( \n                    link LIKE '%option=com_content&view=section%' OR\n                    link LIKE '%option=com_content&view=section&layout=blog%' OR\n                    link LIKE '%option=com_content&view=category\\%' OR\n                    link LIKE '%option=com_content&view=category&layout=blog%' OR\n                    link LIKE '%option=com_content&view=article%'                \n                )";
             break;
     }
     // Get all com_content category/section menus and jReviews menus
     $sql = $select . "\n FROM #__menu" . "\n WHERE published = 1" . (getCmsVersion() == CMS_MAMBO46 ? "\n ORDER BY link ASC" : "\n ORDER BY link DESC");
     # Check for cached version
     $cache_prefix = 'menu_model';
     $cache_key = $sql;
     if ($cache = S2cacheRead($cache_prefix, $cache_key)) {
         $menuList = $cache;
     }
     if (empty($menuList)) {
         // Mambo4.6, as opposed to Mambo4.5, does not allow using other components Itemids so jReviews
         // Sections and category lists cannot use the section/category table or blog list menu Itemids
         $this->_db->setQuery($sql);
         $menuList = $this->_db->loadObjectList();
         # Send to cache
         S2cacheWrite($cache_prefix, $cache_key, $menuList);
     }
     // Get itemid for each menu link and store it
     if (is_array($menuList)) {
         foreach ($menuList as $menu) {
             $this->menues[$menu->id] = $menu;
             $params = stringToArray($menu->params);
             $paramsArray = explode("\n", $menu->params);
             if (Sanitize::getVar($params, 'sef_name') != '') {
                 $m_name = Sanitize::getVar($params, 'sef_name');
             } else {
                 $m_name = $menu->name;
             }
             if (function_exists("sefEncode")) {
                 $m_name = sefEncode($m_name);
             }
             $m_action = Sanitize::getVar($params, 'action');
             $m_dir_id = str_replace(",", "-", Sanitize::getVar($params, 'dirid'));
             $m_cat_id = str_replace(",", "-", Sanitize::getVar($params, 'catid'));
             $m_section_id = str_replace(",", "-", Sanitize::getVar($params, 'sectionid'));
             $m_criteria_id = str_replace(",", "-", Sanitize::getVar($params, 'criteriaid'));
             // Create a variable to get Menu Name from Itemid
             $this->set('jr_itemid_' . $menu->id, $m_name);
             $this->set('jr_menu_' . $m_name, $menu->id);
             # Fix for change in menu structure in J1.5
             if (getCmsVersion() == CMS_JOOMLA15) {
                 if (strpos($menu->menu_type, 'option=com_content&view=section&id=') || strpos($menu->menu_type, 'option=com_content&view=section&layout=blog&id=')) {
                     $menu->componentid = end(explode('id=', $menu->menu_type));
                     $menu->menu_type = 'content_section';
                 } elseif (strpos($menu->menu_type, 'option=com_content&view=category&id=') || strpos($menu->menu_type, 'option=com_content&view=category&layout=blog&id=')) {
                     $menu->componentid = end(explode('id=', $menu->menu_type));
                     $menu->menu_type = 'content_category';
                 } elseif (strpos($menu->menu_type, 'option=com_content&view=article&id=') || strpos($menu->menu_type, 'option=com_content&task=view&id=')) {
                     $menu->componentid = end(explode('id=', $menu->menu_type));
                     $menu->menu_type = 'content_item_link';
                 }
             }
             switch ($menu->menu_type) {
                 case 'content_section':
                 case 'content_blog_section':
                     if ($menu->componentid) {
                         // Only one section id
                         $this->set('core_section_menu_id_' . $menu->componentid, $menu->id);
                         //                                $this->set('jr_section_menu_id_'.$menu->componentid,$menu->id);
                     } else {
                         $section_ids = explode(",", Sanitize::getVar($params, 'sectionid'));
                         $this->set('jr_manyIds_' . $menu->id, 1);
                         foreach ($section_ids as $section_id) {
                             $this->set('core_section_menu_id_' . $section_id, $menu->id);
                             //                                    $this->set('jr_section_menu_id_'.$section_id,$menu->id);
                         }
                     }
                     break;
                 case 'content_category':
                 case 'content_blog_category':
                     if ($menu->componentid) {
                         // Only one category id
                         $this->set('core_category_menu_id_' . $menu->componentid, $menu->id);
                         //                            $this->set('jr_category_menu_id_'.$menu->componentid,$menu->id);
                     } else {
                         $cat_ids = explode(",", Sanitize::getVar($params, 'categoryid'));
                         $this->set('jr_manyIds_' . $menu->id, 1);
                         foreach ($cat_ids as $cat_id) {
                             $this->set('core_category_menu_id_' . $cat_id, $menu->id);
                             //                                    $this->set('jr_category_menu_id_'.$cat_id,$menu->id);
                         }
                     }
                     break;
                 case 'content_item_link':
                     $this->set('core_content_menu_id_' . $menu->componentid, $menu->id);
                     break;
                 default:
                     if ($menu->link == 'index.php?option=' . S2Paths::get('jreviews', 'S2_CMSCOMP')) {
                         // It's a jReviews menu
                         // Get a jReviews menu with public access to use in xajax requests
                         if ($menu->access == 0 && $menu->published == 1) {
                             $this->set('jreviews_public', $menu->id);
                         }
                         $menuParams = array();
                         foreach ($paramsArray as $parameter) {
                             $menuParams[current(explode('=', $parameter))] = end(explode('=', $parameter));
                         }
                         $this->set('jr_menu_action_' . $m_dir_id, $m_action);
                         $this->set('menu_params_' . $menu->id, $menuParams);
                         switch ($m_action) {
                             case '0':
                                 // Directory menu
                                 $this->set('jr_directory_menu_id_' . $m_dir_id, $menu->id);
                                 break;
                             case '1':
                                 // Section menu
                                 $this->set('jr_section_menu_id_' . $m_section_id, $menu->id);
                                 break;
                             case '2':
                                 // Category menu
                                 $this->set('jr_category_menu_id_' . $m_cat_id, $menu->id);
                                 break;
                             case '10':
                                 $this->set('jr_myreviews', $menu->id);
                                 break;
                             case '11':
                                 $m_criteria_id && $this->set('jr_advsearch_' . $m_criteria_id, $menu->id);
                                 !$m_criteria_id && $this->set('jr_advsearch', $menu->id);
                                 break;
                             case '12':
                                 $this->set('jr_mylistings', $menu->id);
                                 break;
                             case '18':
                                 $this->set('jr_reviewers', $menu->id);
                                 break;
                             default:
                                 $this->set('jr_menu_id_action_' . $m_action, $menu->id);
                                 break;
                         }
                     }
                     break;
             }
         }
     }
     //        prx($this->___menu_data);
 }
Пример #22
0
 function __construct()
 {
     parent::__construct();
 }
Пример #23
0
 function __construct()
 {
     parent::__construct();
     # Check for cached version
     $cache_file = 'jreviews_menu_' . cmsFramework::locale() . '_' . md5(cmsFramework::getConfig('secret'));
     if ($cache = S2Cache::read($cache_file)) {
         $this->___menu_data = $cache['___menu_data'];
         return;
     }
     $menuList = array();
     switch ($this->cmsVersion) {
         case CMS_JOOMLA15:
             $select = "\n                    SELECT \n                        id,\n                        name,\n                        link AS menu_type,\n                        link,\n                        componentid,\n                        params,\n                        access,\n                        published\n                ";
             break;
         case CMS_JOOMLA16:
             $select = "\n                    SELECT \n                        id, \n                        title AS name,\n                        link AS menu_type,\n                        link,\n                        component_id AS componentid,\n                        params,\n                        access,\n                        published\n                ";
             break;
     }
     // Get all com_content category/section menus and JReviews menus
     $sql = $select . "\n            FROM #__menu\n            WHERE published = 1\n            ORDER BY link DESC\n        ";
     $this->_db->setQuery($sql);
     $menuList = $this->_db->loadObjectList();
     // Get itemid for each menu link and store it
     if (!empty($menuList)) {
         foreach ($menuList as $menu) {
             $params = stringToArray($menu->params);
             $m_name = Sanitize::getVar($params, 'sef_name') != '' ? Sanitize::getVar($params, 'sef_name') : $menu->name;
             function_exists("sefEncode") and $m_name = sefEncode($m_name);
             $m_action = Sanitize::getVar($params, 'action');
             $m_dir_id = str_replace(",", "-", Sanitize::getVar($params, 'dirid'));
             $m_cat_id = str_replace(",", "-", Sanitize::getVar($params, 'catid'));
             $m_section_id = str_replace(",", "-", Sanitize::getVar($params, 'sectionid'));
             $m_criteria_id = str_replace(",", "-", Sanitize::getVar($params, 'criteriaid'));
             // Create a variable to get Menu Name from Itemid
             $this->set('jr_itemid_' . $menu->id, $m_name);
             $this->set('jr_menu_' . $m_name, $menu->id);
             if (strpos($menu->menu_type, 'option=com_content&view=section&id=') || strpos($menu->menu_type, 'option=com_content&view=section&layout=blog&id=')) {
                 $menu->componentid = end(explode('id=', $menu->menu_type));
                 $menu->menu_type = 'content_section';
             } elseif (strpos($menu->menu_type, 'option=com_content&view=category&id=') || strpos($menu->menu_type, 'option=com_content&view=category&layout=blog&id=')) {
                 $menu->componentid = end(explode('id=', $menu->menu_type));
                 $menu->menu_type = 'content_category';
             } elseif (strpos($menu->menu_type, 'option=com_content&view=article&id=') || strpos($menu->menu_type, 'option=com_content&task=view&id=')) {
                 $menu->componentid = end(explode('id=', $menu->menu_type));
                 $menu->menu_type = 'content_item_link';
             }
             switch ($menu->menu_type) {
                 case 'content_section':
                 case 'content_blog_section':
                     if ($menu->componentid) {
                         // Only one section id
                         $this->set('core_section_menu_id_' . $menu->componentid, $menu->id);
                     } else {
                         $section_ids = explode(",", Sanitize::getVar($params, 'sectionid'));
                         $this->set('jr_manyIds_' . $menu->id, 1);
                         foreach ($section_ids as $section_id) {
                             $this->set('core_section_menu_id_' . $section_id, $menu->id);
                         }
                     }
                     break;
                 case 'content_category':
                 case 'content_blog_category':
                     if ($menu->componentid) {
                         // Only one category id
                         $this->set('core_category_menu_id_' . $menu->componentid, $menu->id);
                     } else {
                         $cat_ids = explode(",", Sanitize::getVar($params, 'categoryid'));
                         $this->set('jr_manyIds_' . $menu->id, 1);
                         foreach ($cat_ids as $cat_id) {
                             $this->set('core_category_menu_id_' . $cat_id, $menu->id);
                         }
                     }
                     break;
                 case 'content_item_link':
                     $this->set('core_content_menu_id_' . $menu->componentid, $menu->id);
                     break;
                 default:
                     if ($menu->componentid > 0 && strstr($menu->link, 'index.php?option=' . S2Paths::get('jreviews', 'S2_CMSCOMP'))) {
                         // It's a JReviews menu
                         $access = $this->cmsVersion == CMS_JOOMLA15 ? 0 : 1;
                         // Get a JReviews menu with public access to use in ajax requests
                         if ($menu->access == $access && $menu->published == 1) {
                             $this->set('jreviews_public', $menu->id);
                         }
                         $this->set('jr_menu_action_' . $m_dir_id, $m_action);
                         $this->set('menu_params_' . $menu->id, $params);
                         switch ($m_action) {
                             case '0':
                                 // Directory menu
                                 $this->set('jr_directory_menu_id_' . $m_dir_id, $menu->id);
                                 break;
                             case '1':
                                 // Section menu
                                 $this->set('jr_section_menu_id_' . $m_section_id, $menu->id);
                                 break;
                             case '2':
                                 // Category menu
                                 $this->set('jr_category_menu_id_' . $m_cat_id, $menu->id);
                                 break;
                             case '10':
                                 $this->set('jr_myreviews', $menu->id);
                                 break;
                             case '11':
                                 $m_criteria_id && $this->set('jr_advsearch_' . $m_criteria_id, $menu->id);
                                 !$m_criteria_id && $this->set('jr_advsearch', $menu->id);
                                 break;
                             case '12':
                                 $this->set('jr_mylistings', $menu->id);
                                 break;
                             case '18':
                                 $this->set('jr_reviewers', $menu->id);
                                 break;
                             default:
                                 $this->set('jr_menu_id_action_' . $m_action, $menu->id);
                                 break;
                         }
                     }
                     break;
             }
         }
         S2Cache::write($cache_file, array('___menu_data' => $this->___menu_data));
     }
     //        prx($this->___menu_data);exit;
 }