Exemple #1
0
 /**
  * Return friends html block
  */
 function _getFriendsHTML()
 {
     $tmpl = new CTemplate();
     $friendsModel = CFactory::getModel('friends');
     $my = CFactory::getUser();
     $user = CFactory::getRequestUser();
     $params = $user->getParams();
     // site visitor
     $relation = 10;
     // site members
     if ($my->id != 0) {
         $relation = 20;
     }
     // friends
     if (CFriendsHelper::isConnected($my->id, $user->id)) {
         $relation = 30;
     }
     // mine
     if (COwnerHelper::isMine($my->id, $user->id)) {
         $relation = 40;
     }
     // @todo: respect privacy settings
     if ($relation >= $params->get('privacyFriendsView')) {
         $friends =& $friendsModel->getFriends($user->id, 'latest', false, '', PROFILE_MAX_FRIEND_LIMIT + PROFILE_MAX_FRIEND_LIMIT);
         // randomize the friend count
         if ($friends) {
             shuffle($friends);
         }
         $tmpl->setRef('friends', $friends);
         $tmpl->set('total', $user->getFriendCount());
         $tmpl->setRef('user', $user);
         return $tmpl->fetch('profile.friends');
     }
 }
Exemple #2
0
 function onProfileDisplay()
 {
     if (!self::kunenaOnline()) {
         return;
     }
     //Load Language file.
     JPlugin::loadLanguage('plg_community_mykunena', JPATH_ADMINISTRATOR);
     $document = JFactory::getDocument();
     $document->addStyleSheet(JURI::base() . 'plugins/community/mykunena/style.css');
     $items = array();
     $user = CFactory::getRequestUser();
     if ($user->id) {
         require_once KPATH_SITE . '/funcs/latestx.php';
         $obj = new CKunenaLatestX('userposts', 0);
         $obj->user = JFactory::getUser($user->id);
         $obj->threads_per_page = $this->params->get('count', 5);
         $obj->embedded = 1;
         $obj->getUserPosts();
         $items = $obj->customreply;
     }
     $caching = $this->params->get('cache', 1);
     if ($caching) {
         $app = JFactory::getApplication();
         $caching = $app->getCfg('caching');
     }
     $cache = JFactory::getCache('plgCommunityMyKunena');
     $cache->setCaching($caching);
     $callback = array('plgCommunityMyKunena', '_getMyKunenaHTML');
     $content = $cache->call($callback, $user, $items);
     return $content;
 }
Exemple #3
0
 /**
  * Ajax function to save a new wall entry
  *
  * @param message    A message that is submitted by the user
  * @param uniqueId    The unique id for this group
  *
  **/
 function onProfileDisplay()
 {
     JPlugin::loadLanguage('plg_community_myvideos', JPATH_ADMINISTRATOR);
     $mainframe = JFactory::getApplication();
     $document = JFactory::getDocument();
     $user = CFactory::getRequestUser();
     $userid = $user->id;
     $this->loadUserParams();
     $def_limit = $this->params->get('count', 10);
     $limit = JRequest::getVar('limit', $def_limit, 'REQUEST');
     $limitstart = JRequest::getVar('limitstart', 0, 'REQUEST');
     $row = $this->getVideos($userid, $limitstart, $limit);
     $total = count($row);
     if ($this->params->get('hide_empty', 0) && !$total) {
         return '';
     }
     $caching = $this->params->get('cache', 1);
     if ($caching) {
         $caching = $mainframe->getCfg('caching');
     }
     $cache = JFactory::getCache('plgCommunityMyVideos');
     $cache->setCaching($caching);
     $callback = array('plgCommunityMyVideos', '_getLatestVideosHTML');
     $count = $this->userparams->get('count', $def_limit);
     $dbg = "<!--DEFLIMIT {$def_limit} USERPARAMLIMIT {$count}-->";
     $content = $dbg . $cache->call($callback, $userid, $count, $limitstart, $row, $total);
     return $content;
 }
Exemple #4
0
 function onProfileDisplay()
 {
     JPlugin::loadLanguage('plg_community_mygoogleads', JPATH_ADMINISTRATOR);
     $config = CFactory::getConfig();
     $config = CFactory::getConfig();
     $this->loadUserParams();
     $uri = JURI::base();
     $user = CFactory::getRequestUser();
     $document = JFactory::getDocument();
     $css = $uri . 'plugins/community/mygoogleads/mygoogleads/style.css';
     $document->addStyleSheet($css);
     $googleCode = $this->userparams->get('googleCode');
     $content = '';
     if (!empty($googleCode)) {
         $mainframe = JFactory::getApplication();
         $caching = $this->params->get('cache', 1);
         if ($caching) {
             $caching = $mainframe->getCfg('caching');
         }
         $cache = JFactory::getCache('plgCommunityMyGoogleAds');
         $cache->setCaching($caching);
         $callback = array('plgCommunityMyGoogleAds', '_getGoogleAdsHTML');
         $content = $cache->call($callback, $googleCode, $user->id);
     } else {
         // $content = "<div class=\"icon-nopost\"><img src=\"".JURI::base()."components/com_community/assets/error.gif\" alt=\"\" /></div>";
         $content .= "<div class=\"content-nopost\">" . JText::_('PLG_GOOGLE_ADS_NOT_SET') . "</div>";
     }
     return $content;
 }
Exemple #5
0
 /**
  * Ajax function to save a new wall entry
  *
  * @param message	A message that is submitted by the user
  * @param uniqueId	The unique id for this group
  *
  **/
 function onProfileDisplay()
 {
     JPlugin::loadLanguage('plg_community_mytaggedvideos', JPATH_ADMINISTRATOR);
     $mainframe = JFactory::getApplication();
     // Attach CSS
     $document = JFactory::getDocument();
     // $css		= JURI::base() . 'plugins/community/myvideos/style.css';
     // $document->addStyleSheet($css);
     $user = CFactory::getRequestUser();
     $userid = $user->id;
     $this->loadUserParams();
     $def_limit = $this->params->get('count', 10);
     $limit = JRequest::getVar('limit', $def_limit, 'REQUEST');
     $limitstart = JRequest::getVar('limitstart', 0, 'REQUEST');
     $row = $this->getVideos($userid);
     $total = count($row);
     if ($this->params->get('hide_empty', 0) && !$total) {
         return '';
     }
     $caching = $this->params->get('cache', 1);
     if ($caching) {
         $caching = $mainframe->getCfg('caching');
     }
     $cache = JFactory::getCache('plgCommunityMyTaggedVideos');
     $cache->setCaching($caching);
     $callback = array('plgCommunityMyTaggedVideos', '_getLatestVideosHTML');
     $content = $cache->call($callback, $userid, $this->userparams->get('count', 5), $limitstart, $row, $total);
     return $content;
 }
Exemple #6
0
 /**
  * Ajax function to save a new wall entry
  *
  * @param message	A message that is submitted by the user
  * @param uniqueId	The unique id for this group
  *
  * */
 function onProfileDisplay()
 {
     //Load language file.
     JPlugin::loadLanguage('plg_community_myarticles', JPATH_ADMINISTRATOR);
     // Attach CSS
     $document = JFactory::getDocument();
     $css = JURI::base() . 'plugins/community/myarticles/myarticles/style.css';
     $document->addStyleSheet($css);
     if (JRequest::getVar('task', '', 'REQUEST') == 'app') {
         $app = 1;
     } else {
         $app = 0;
     }
     $user = CFactory::getRequestUser();
     $userid = $user->id;
     $def_limit = $this->params->get('count', 10);
     $limit = JRequest::getVar('limit', $def_limit, 'REQUEST');
     $limitstart = JRequest::getVar('limitstart', 0, 'REQUEST');
     $row = $this->getArticle($userid, $limitstart, $limit, $this->section);
     $cat = $this->getCatAlias();
     $total = $this->countArticle($userid, $this->section);
     if ($this->params->get('hide_empty', 0) && !$total) {
         return '';
     }
     $mainframe = JFactory::getApplication();
     $caching = $this->params->get('cache', 1);
     if ($caching) {
         $caching = $mainframe->getCfg('caching');
     }
     $cache = JFactory::getCache('plgCommunityMyArticles');
     $cache->setCaching($caching);
     $callback = array('plgCommunityMyArticles', '_getArticleHTML');
     $content = $cache->call($callback, $userid, $limit, $limitstart, $row, $app, $total, $cat, $this->params);
     return $content;
 }
Exemple #7
0
 function onProfileDisplay()
 {
     $config = CFactory::getConfig();
     $this->loadUserParams();
     $uri = JURI::base();
     //$user		= CFactory::getActiveProfile();
     $user = CFactory::getRequestUser();
     $document = JFactory::getDocument();
     $css = $uri . 'plugins/community/groups/style.css';
     $document->addStyleSheet($css);
     $view = $this->params->get('fabrik_view');
     $id = $this->params->get('fabrik_view_id');
     $rowid = $this->params->get('fabrik_row_id');
     $usekey = $this->params->get('fabrik_usekey');
     $layout = $this->params->get('fabrik_layout');
     $additional = $this->params->get('fabrik_additional');
     $element = $this->params->get('fabrik_element');
     if (!empty($view) && !empty($id)) {
         $cache = JFactory::getCache('plgCommunityFabrik');
         $cache->setCaching($this->params->get('cache', 1));
         $className = 'plgCommunityFabrik';
         $callback = array($className, '_getFabrikHTML');
         $content = $cache->call($callback, $view, $id, $rowid, $usekey, $layout, $element, $additional, $this->userparams, $user->id);
     } else {
         $content = "<div class=\"icon-nopost\"><img src='" . JURI::base() . "components/com_community/assets/error.gif' alt=\"\" /></div>";
         $content .= "<div class=\"content-nopost\">" . JText::_('Fabrik view details not set.') . "</div>";
     }
     return $content;
 }
 /**
  * Ajax function to save a new wall entry
  *
  * @param message	A message that is submitted by the user
  * @param uniqueId	The unique id for this group
  * @return type
  */
 public function onProfileDisplay()
 {
     $this->loadLanguage();
     $this->loadUserParams();
     $mainframe = JFactory::getApplication();
     // Attach CSS
     $document = JFactory::getDocument();
     $user = CFactory::getRequestUser();
     $userid = $user->id;
     $def_limit = $this->userparams->get('count', $this->params->get('count', 10));
     $limit = JRequest::getVar('limit', $def_limit, 'REQUEST');
     $limitstart = JRequest::getVar('limitstart', 0, 'REQUEST');
     $row = $this->getPhotos($userid, $limitstart, $limit);
     $total = count($row);
     if ($this->params->get('hide_empty', 0) && !count($row)) {
         return '';
     }
     $caching = $this->params->get('cache', 1);
     if ($caching) {
         $caching = $mainframe->getCfg('caching');
     }
     $cache = JFactory::getCache('plgCommunityMyLatestPhotos');
     $cache->setCaching($caching);
     $callback = array('plgCommunityMyLatestPhotos', '_getLatestPhotoHTML');
     $content = $cache->call($callback, $userid, $limit, $limitstart, $row, $total);
     return $content;
 }
Exemple #9
0
 function onProfileDisplay()
 {
     JPlugin::loadLanguage('plg_community_events', JPATH_ADMINISTRATOR);
     $config = CFactory::getConfig();
     if (!$config->get('enableevents')) {
         return JText::_('PLG_EVENTS_EVENT_DISABLED');
     }
     $document = JFactory::getDocument();
     $mainframe = JFactory::getApplication();
     $user = CFactory::getRequestUser();
     $caching = $this->params->get('cache', 1);
     $model = CFactory::getModel('Events');
     $my = CFactory::getUser();
     $this->loadUserParams();
     //CFactory::load( 'helpers' , 'event' );
     $event = JTable::getInstance('Event', 'CTable');
     $handler = CEventHelper::getHandler($event);
     $events = $model->getEvents(null, $user->id, $this->params->get('sorting', 'latest'), null, true, false, null, null, $handler->getContentTypes(), $handler->getContentId(), $this->userparams->get('count', 5));
     if ($this->params->get('hide_empty', 0) && !count($events)) {
         return '';
     }
     if ($caching) {
         $caching = $mainframe->getCfg('caching');
     }
     $creatable = $my->canCreateEvents();
     $cache = JFactory::getCache('plgCommunityEvents');
     $cache->setCaching($caching);
     $callback = array($this, '_getEventsHTML');
     $content = $cache->call($callback, true, $events, $user, $config, $model->getEventsCount($user->id), $creatable);
     return $content;
 }
Exemple #10
0
 function onProfileDisplay()
 {
     JPlugin::loadLanguage('plg_twitter', JPATH_ADMINISTRATOR);
     $user = CFactory::getRequestUser();
     $document =& JFactory::getDocument();
     $css = JURI::base() . 'plugins/community/twitter/style.css';
     $document->addStyleSheet($css);
     $my = CFactory::getUser();
     $oauth =& JTable::getInstance('Oauth', 'CTable');
     if (!$oauth->load($user->id, 'twitter')) {
         return JText::_('PLG_TWITTER NOT SET');
     }
     return $this->_getTwitterHTML($user->id);
 }
Exemple #11
0
 /**
  * Return groups html block
  * @since 2.4
  */
 public function modGetGroupsHTML($userid = null)
 {
     $html = '';
     $my = CFactory::getUser($userid);
     $user = CFactory::getRequestUser();
     $params = $user->getParams();
     // site visitor
     $relation = 10;
     // site members
     if ($my->id != 0) {
         $relation = 20;
     }
     // friends
     if (CFriendsHelper::isConnected($my->id, $user->id)) {
         $relation = 30;
     }
     // mine
     if (COwnerHelper::isMine($my->id, $user->id)) {
         $relation = 40;
     }
     // Respect privacy settings
     if ($relation < $params->get('privacyGroupsView')) {
         return '';
     }
     $tmpl = new CTemplate();
     $model = CFactory::getModel('groups');
     $userid = JRequest::getVar('userid', $my->id);
     $user = CFactory::getUser($userid);
     $groups = $model->getGroups($user->id);
     $total = count($groups);
     // Randomize groups
     if ($groups) {
         shuffle($groups);
     }
     CFactory::load('helpers', 'url');
     // Load the groups as proper CTableGroup object
     foreach ($groups as &$gr) {
         $groupTable = JTable::getInstance('Group', 'CTable');
         $groupTable->load($gr->id);
         $gr = $groupTable;
     }
     for ($i = 0; $i < count($groups); $i++) {
         $row =& $groups[$i];
         $row->avatar = $row->getThumbAvatar();
         $row->link = CUrl::build('groups', 'viewgroup', array('groupid' => $row->id), true);
     }
     $html = $tmpl->set('user', $user)->set('total', $total)->set('groups', $groups)->fetch('profile.groups');
     return $html;
 }
 function _getquick2cartstoreHTML()
 {
     jimport('joomla.filesystem.file');
     if (JFile::exists(JPATH_SITE . '/components/com_quick2cart/quick2cart.php')) {
         $lang = JFactory::getLanguage();
         $lang->load('com_quick2cart', JPATH_SITE);
         $path = JPATH_SITE . DS . 'components' . DS . 'com_quick2cart' . DS . 'helper.php';
         if (!class_exists('comquick2cartHelper')) {
             //require_once $path;
             JLoader::register('comquick2cartHelper', $path);
             JLoader::load('comquick2cartHelper');
         }
         // Load assets
         comquick2cartHelper::loadQuicartAssetFiles();
         $product_path = JPATH_SITE . DS . 'components' . DS . 'com_quick2cart' . DS . 'helpers' . DS . 'product.php';
         if (!class_exists('productHelper')) {
             //require_once $path;
             JLoader::register('productHelper', $product_path);
             JLoader::load('productHelper');
         }
         $params = $this->params;
         $no_of_stores = $params->get('no_of_stores', '2');
         //Get profile id
         $user = CFactory::getRequestUser();
         $model = new productHelper();
         $target_data = $model->getUserStores($user->_userid, $no_of_stores);
         if (!empty($target_data)) {
             $html = "\n\t\t\t\t<div class='techjoomla-bootstrap' >\n\t\t\t\t\t<div  class='row-fluid'>\n\t\t\t\t\t<ul class='thumbnails'  >\n\t\t\t\t\t";
             foreach ($target_data as $data) {
                 $path = JPATH_SITE . DS . 'components' . DS . 'com_quick2cart' . DS . 'views' . DS . 'vendor' . DS . 'tmpl' . DS . 'thumbnail.php';
                 //@TODO  condition vise mod o/p
                 ob_start();
                 include $path;
                 $html .= ob_get_contents();
                 ob_end_clean();
             }
             $html .= "\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t</div>\n\t\t\t\t</div>";
             return $html;
         }
     }
 }
 /**
  * Ajax function to save a new wall entry
  *
  * @param message	A message that is submitted by the user
  * @param uniqueId	The unique id for this group
  *
  **/
 function onProfileDisplay()
 {
     JPlugin::loadLanguage('plg_community_mytaggedvideos', JPATH_ADMINISTRATOR);
     $mainframe = JFactory::getApplication();
     // Attach CSS
     $document = JFactory::getDocument();
     // $css		= JURI::base() . 'plugins/community/myvideos/style.css';
     // $document->addStyleSheet($css);
     $user = CFactory::getRequestUser();
     $userid = $user->id;
     $this->loadUserParams();
     $limit = $this->params->get('count', 6);
     $limitstart = JRequest::getVar('limitstart', 0, 'REQUEST');
     $row = $this->getVideos($userid);
     $total = count($row);
     //we must filter the results
     $results = array();
     $limitCount = 0;
     foreach ($row as $result) {
         if (!CPrivacy::isAccessAllowed($this->_my->id, $userid, 'custom', $result->permissions)) {
             continue;
         }
         $results[] = $result;
         if (++$limit == $limitCount) {
             break;
         }
     }
     if ($this->params->get('hide_empty', 0) && !$total) {
         return '';
     }
     $caching = $this->params->get('cache', 1);
     if ($caching) {
         $caching = $mainframe->getCfg('caching');
     }
     $cache = JFactory::getCache('plgCommunityMyTaggedVideos');
     $cache->setCaching($caching);
     $callback = array('plgCommunityMyTaggedVideos', '_getLatestVideosHTML');
     $content = $cache->call($callback, $userid, $this->userparams->get('count', 5), $limitstart, $results, $total);
     return $content;
 }
Exemple #14
0
 function onProfileDisplay()
 {
     JPlugin::loadLanguage('plg_community_feeds', JPATH_ADMINISTRATOR);
     // Attach CSS
     $document = JFactory::getDocument();
     $css = JURI::base() . 'plugins/community/feeds/feeds/style.css';
     $document->addStyleSheet($css);
     $model = CFactory::getModel('profile');
     $my = CFactory::getUser();
     $user = CFactory::getRequestUser();
     $this->loadUserParams();
     $mainframe = JFactory::getApplication();
     $data = $model->getViewableProfile($user->id);
     $path = $this->userparams->get('path', '');
     $limit = $this->userparams->get('count', '');
     $cacheable = $this->params->get('cache', 1);
     $cacheable = $cacheable ? $mainframe->getCfg('caching') : $cacheable;
     $cache = JFactory::getCache('community');
     $cache->setCaching($cacheable);
     $content = $cache->call(array($this, '_getFeedHTML'), $path, $limit, $this->getLayout());
     return $content;
 }
Exemple #15
0
 /**
  * Return true if can view my group
  * @param type $userId
  * @return boolean
  */
 public static function groupsMyView($userId)
 {
     $config = CFactory::getConfig();
     $requestUser = CFactory::getRequestUser();
     if ($userId == 0 && $requestUser->_cparams->get('privacyGroupsView') > 0) {
         CAccess::setError('blockUnregister');
         return false;
     } else {
         if (!$config->get('enablegroups')) {
             CAccess::setError(JText::_('COM_COMMUNITY_GROUPS_DISABLE'));
             return false;
         } else {
             return true;
         }
     }
 }
Exemple #16
0
 /**
  *
  * @param type $filter
  * @param type $userId
  * @param type $view
  * @param type $showMore
  * @return type
  */
 public static function getActivitiesByFilter($filter = 'all', $userId = 0, $view = '', $showMore = true, $filters = array())
 {
     jimport('joomla.utilities.date');
     $config = CFactory::getConfig();
     $act = new CActivityStream();
     if ($userId == 0) {
         // Legacy code, some module might still use the old code
         $user = CFactory::getRequestUser();
     } else {
         $user = CFactory::getUser($userId);
     }
     $memberSince = CTimeHelper::getDate($user->registerDate);
     $friendIds = $user->getFriendIds();
     /**
      * Filter
      * @todo This's applied into the old code we need improve it later
      */
     switch ($filter) {
         case 'photo':
         case 'group':
         case 'status':
         case 'video':
         case 'event':
             //$html = $act->getHTML('', '', null, 0, $view, '', true, $showMore, null, false, 'all', 0);
             break;
         case "active-profile":
             $target = array($user->id);
             $params = $user->getParams();
             $actLimit = $view == 'profile' ? $params->get('activityLimit', $config->get('maxactivities')) : $config->get('maxactivities');
             $html = $act->getHTML($user->id, $target, '', $actLimit, $view, '', true, $showMore, null, false, 'active-profile');
             break;
         case "me-and-friends":
             $user = JFactory::getUser();
             $html = $act->getHTML($user->id, $friendIds, $memberSince, 0, $view, '', true, $showMore, null, false, 'me-and-friends');
             break;
         case "active-user-and-friends":
         case "active-profile-and-friends":
             $params = $user->getParams();
             $actLimit = $view == 'profile' ? $params->get('activityLimit', $config->get('maxactivities')) : $config->get('maxactivities');
             $html = $act->getHTML($user->id, $friendIds, $memberSince, $actLimit, $view, '', true, $showMore, null, false, 'active-profile-and-friends');
             break;
         case "all":
         default:
             $html = $act->getHTML('', '', null, 0, $view, '', true, $showMore, null, false, 'all', 0, $filters);
             break;
     }
     return $html;
 }
Exemple #17
0
        function onProfileDisplay()
        {
            $mainframe =& JFactory::getApplication();
            JPlugin::loadLanguage('plg_walls', JPATH_ADMINISTRATOR);
            $document =& JFactory::getDocument();
            $my = CFactory::getUser();
            $config = CFactory::getConfig();
            // Load libraries
            CFactory::load('libraries', 'wall');
            CFactory::load('helpers', 'friends');
            $user = CFactory::getRequestUser();
            $friendModel = CFactory::getModel('friends');
            $avatarModel = CFactory::getModel('avatar');
            $isMe = $my->id == $user->id && $my->id != 0;
            $isGuest = $my->id == 0 ? true : false;
            $isConnected = CFriendsHelper::isConnected($my->id, $user->id);
            CFactory::load('helpers', 'owner');
            $isSuperAdmin = isCommunityAdmin();
            // @rule: Limit should follow Joomla's list limit
            $jConfig =& JFactory::getConfig();
            $limit = JRequest::getVar('limit', $jConfig->getValue('list_limit'), 'REQUEST');
            $limitstart = JRequest::getVar('limitstart', 0, 'REQUEST');
            if (JRequest::getVar('task', '', 'REQUEST') == 'app') {
                $cache =& JFactory::getCache('plgCommunityWalls_fullview');
            } else {
                $cache =& JFactory::getCache('plgCommunityWalls');
            }
            $caching = $this->params->get('cache', 1);
            if ($caching) {
                $caching = $mainframe->getCfg('caching');
            }
            $cache->setCaching($caching);
            $callback = array('plgCommunityWalls', '_getWallHTML');
            $allowPosting = ($isMe || !$config->get('lockprofilewalls') || $config->get('lockprofilewalls') && $isConnected || $isSuperAdmin) && !$isGuest;
            $allowRemoval = $isMe || $isSuperAdmin;
            $maxchar = $this->params->get('charlimit', 0);
            if (!empty($maxchar)) {
                $this->characterLimitScript($maxchar);
            }
            //$cache_id = JCacheCallback::_makeId(array('plgCommunityWalls', '_getWallHTML'), array($user->id, $limit, $limitstart , $allowPosting , $allowRemoval));
            //get cache id
            $callback_args = array($user->id, $limit, $limitstart, $allowPosting, $allowRemoval);
            $cache_id = md5(serialize(array($callback, $callback_args)));
            $javascript = <<<SHOWJS
\t\t\t\t\t\t\tfunction getCacheId()
\t\t\t\t\t\t \t{
\t\t\t\t\t\t\t\tvar cache_id = "'.{$cache_id}.'";
\t\t\t\t\t\t\t\treturn cache_id;
\t\t\t\t\t\t\t}
SHOWJS;
            $document->addScriptDeclaration($javascript);
            $content = $cache->call($callback, $user->id, $limit, $limitstart, $allowPosting, $allowRemoval);
            return $content;
        }
 function plgCommunityMutualFriends(&$subject, $config)
 {
     $this->_user = CFactory::getRequestUser();
     parent::__construct($subject, $config);
 }
 /**
  *
  */
 function onProfileDisplay()
 {
     JPlugin::loadLanguage('plg_community_myfriendslocation', JPATH_ADMINISTRATOR);
     $lang = JFactory::getLanguage();
     $lang->load('com_community.country');
     $config = CFactory::getConfig();
     // Attach CSS
     $document = JFactory::getDocument();
     $css = JURI::base() . 'plugins/community/myfriendslocation/myfriendslocation/style.css';
     $document->addStyleSheet($css);
     $user = CFactory::getRequestUser();
     $userid = $user->id;
     $def_limit = $this->params->get('count', 0);
     $mapkey = $this->params->get('mapkey', '');
     $width = $this->params->get('width', '480');
     // @todo: remove
     $height = $this->params->get('height', '340');
     $show_karma = 0;
     if ($config->get('enablekarma')) {
         $show_karma = $this->params->get('show_karma', '1');
     }
     $mouse_scroll_zoom = $this->params->get('mouse_scroll_zoom', '1');
     $continuous_zoom = $this->params->get('continuous_zoom', '1');
     $address_field_id = $this->params->get("address_field_code");
     $zip_field_id = $this->params->get("zip_field_code");
     $town_field_id = $this->params->get("town_field_code");
     $state_field_id = $this->params->get("state_field_code");
     $country_field_id = $this->params->get("country_field_code");
     if (!empty($town_field_id) || !empty($state_field_id) || !empty($country_field_id) || !empty($zip_field_id) || !empty($address_field_id)) {
         $mainframe = JFactory::getApplication();
         $caching = $this->params->get('cache', 1);
         if ($caching) {
             $caching = $mainframe->getCfg('caching');
         }
         $layout = $this->getLayout();
         $cache = JFactory::getCache('plgCommunityMyFriendsLocation');
         $cache->setCaching($caching);
         $content = $this->_getFriendsLocationHTML($mapkey, $width, $height, $show_karma, $town_field_id, $state_field_id, $country_field_id, $zip_field_id, $address_field_id, $userid, $def_limit, $layout);
     } else {
         $content = "<div>" . JText::_("PLG_COMMUNITY_MYFRIENDSLOCATION_FIELD_CODE_NOT_FOUND") . "</div>";
     }
     return $content;
 }
Exemple #20
0
 public function getUploadVideoHtml($creatorType = VIDEO_USER_TYPE, $contextid = 0)
 {
     $filter = JFilterInput::getInstance();
     $creatorType = $filter->clean($creatorType, 'string');
     $contextid = $filter->clean($contextid, 'int');
     $my = CFactory::getUser();
     $user = CFactory::getRequestUser();
     $params = $user->getParams();
     $permissions = $params->get('privacyVideoView');
     $model = CFactory::getModel('videos');
     $category = $model->getAllCategories();
     $cTree = CCategoryHelper::getCategories($category);
     $categories = CCategoryHelper::getSelectList('videos', $cTree, null, true);
     $config = CFactory::getConfig();
     $uploadLimit = $config->get('maxvideouploadsize', ini_get('upload_max_filesize'));
     list($totalVideos, $videoUploadLimit) = $this->_getParameter($creatorType, $config);
     $tmpl = new CTemplate();
     $tmpl->set('categories', $categories);
     $tmpl->set('uploadLimit', $uploadLimit);
     $tmpl->set('creatorType', $creatorType);
     $tmpl->set('groupid', $creatorType == VIDEO_GROUP_TYPE ? $contextid : '');
     $tmpl->set('eventid', $creatorType == VIDEO_EVENT_TYPE ? $contextid : '');
     $tmpl->set('permissions', $permissions);
     $tmpl->set('videoUploaded', $totalVideos);
     $tmpl->set('videoUploadLimit', $videoUploadLimit);
     $tmpl->set('enableLocation', $config->get('videosmapdefault'));
     $html = $tmpl->fetch('videos.upload');
     return $html;
 }
Exemple #21
0
 * @license		GNU/GPL
 * ActivityComment is free software. This version may have been modified pursuant to the
 * GNU General Public License, and as distributed it includes or is derivative
 * of works licensed under the GNU General Public License or other free or open
 * source software licenses.
 */
defined('_JEXEC') or die('Restricted access');
JPlugin::loadLanguage('plg_activitycomment', JPATH_ADMINISTRATOR);
require_once JPATH_PLUGINS . DS . 'community' . DS . 'activitycomment' . DS . 'helper.php';
$current = JRequest::getInt('userid');
$task = JRequest::getVar('func');
if ($task == 'activities,ajaxGetActivities') {
    return;
}
if (empty($current)) {
    $current = CFactory::getRequestUser();
    $current = $current->id;
}
$o = JRequest::getVar('option');
$task = JRequest::getVar('task');
$params = ActivityComments::getParams();
$view = JRequest::getVar('view', 'frontpage');
if (!$params->get('sharefrontpage', 1) && $view == 'frontpage' && ($o == 'com_community' || $o == 'community')) {
    return false;
}
if (!$params->get('shareprofile', 1) && $view == 'profile' && ($o == 'com_community' || $o == 'community')) {
    return false;
}
if ($my->id != 0 && $my->id == $current && ($o == 'com_community' || $o == 'community')) {
    ?>
<script type="text/javascript">
Exemple #22
0
 /**
  * Method to display video
  * @return void
  */
 public function video()
 {
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $document = JFactory::getDocument();
     $config = CFactory::getConfig();
     $my = CFactory::getUser();
     $requestUser = CFactory::getRequestUser();
     $videoId = $jinput->get('videoid', '', 'INT');
     $task = $jinput->getCmd('task');
     // Get show video location map by default
     $videoMapsDefault = $config->get('videosmapdefault');
     // Load window library
     CWindow::load();
     $video = JTable::getInstance('Video', 'CTable');
     if (empty($videoId)) {
         if ($jinput->get('videoid', '', 'INT')) {
             $videoId = $jinput->get('videoid', '', 'INT');
         } else {
             $url = CRoute::_('index.php?option=com_community&view=videos', false);
             $mainframe->redirect($url, JText::_('COM_COMMUNITY_VIDEOS_ID_ERROR'), 'warning');
         }
     }
     if (!$video->load($videoId)) {
         $url = CRoute::_('index.php?option=com_community&view=videos', false);
         $mainframe->redirect($url, JText::_('COM_COMMUNITY_VIDEOS_NOT_AVAILABLE'), 'warning');
     }
     if ($video->groupid) {
         JRequest::setVar('groupid', $video->groupid);
     } elseif ($video->eventid) {
         JRequest::setVar('eventid', $video->eventid);
     }
     // Setting up the sub menu
     if (COwnerHelper::isCommunityAdmin() || $my->id == $video->creator && $my->id != 0) {
         $this->addSubmenuItem('', JText::_('COM_COMMUNITY_VIDEOS_FETCH_THUMBNAIL'), "joms.api.videoFetchThumbnail('" . $video->id . "');", true);
         // Only add the set as profile video for video owner
         if ($my->id == $video->creator && $config->get('enableprofilevideo')) {
             $this->addSubmenuItem('', JText::_('COM_COMMUNITY_VIDEOS_SET_AS_PROFILE'), "joms.api.videoLinkToProfile('" . $video->id . "');", true);
         }
         $redirectUrl = CRoute::getURI(false);
         $this->addSubmenuItem('', JText::_('COM_COMMUNITY_EDIT'), "joms.api.videoEdit('" . $video->id . "');", true);
         $this->addSubmenuItem('', JText::_('COM_COMMUNITY_DELETE'), "joms.api.videoRemove('" . $video->id . "');", true);
     }
     $this->_addSubmenu();
     // Show the mini header when viewing other's photos
     if ($video->creator_type == VIDEO_USER_TYPE && $my->id != $video->creator) {
         // $this->attachMiniHeaderUser($video->creator);
     }
     // Check permission
     $user = CFactory::getUser($video->creator);
     $blocked = $user->isBlocked();
     if ($blocked && !COwnerHelper::isCommunityAdmin()) {
         $tmpl = new CTemplate();
         echo $tmpl->fetch('profile.blocked');
         return;
     }
     $sorted = $jinput->get('sort', 'latest', 'STRING');
     $limit = $jinput->get('limitstart', 6, 'INT');
     $permissions = $my->id == 0 ? 0 : 20;
     $cat_id = $jinput->get('cat_id', '', 'INT');
     $model = CFactory::getModel('videos');
     /* We get groupid from video table instead user input */
     $groupId = $video->groupid;
     if ($video->creator_type == VIDEO_GROUP_TYPE) {
         if (!CGroupHelper::allowViewMedia($groupId)) {
             /**
              * Opengraph
              */
             CHeadHelper::setType('website', JText::_('COM_COMMUNITY_RESTRICTED_ACCESS'));
             $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_RESTRICTED_ACCESS', 'notice'));
             echo JText::_('COM_COMMUNITY_GROUPS_VIDEO_MEMBER_PERMISSION');
             return;
         }
         $group = JTable::getInstance('Group', 'CTable');
         $group->load($groupId);
         // Set pathway
         $pathway = $mainframe->getPathway();
         $pathway->addItem(JText::_('COM_COMMUNITY_GROUPS'), CRoute::_('index.php?option=com_community&view=groups'));
         $pathway->addItem($group->name, CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $groupId));
         $pathway->addItem(JText::_('COM_COMMUNITY_VIDEOS'), CRoute::_('index.php?option=com_community&view=videos&task=display&groupid=' . $groupId));
         $pathway->addItem($video->getTitle(), '');
         $otherVideos = $model->getGroupVideos($groupId, $cat_id, $limit);
     } else {
         if (!$this->isPermitted($my->id, $video->creator, $video->permissions)) {
             /**
              * Opengraph
              */
             CHeadHelper::setType('website', JText::_('COM_COMMUNITY_RESTRICTED_ACCESS'));
             $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_RESTRICTED_ACCESS', 'notice'));
             switch ($video->permissions) {
                 case '40':
                     $this->noAccess(JText::_('COM_COMMUNITY_VIDEOS_OWNER_ONLY', 'notice'));
                     break;
                 case '30':
                     $owner = CFactory::getUser($video->creator);
                     $this->noAccess(JText::sprintf('COM_COMMUNITY_VIDEOS_FRIEND_PERMISSION_MESSAGE', $owner->getDisplayName()));
                     break;
                 default:
                     $this->noAccess();
                     break;
             }
             return;
         }
         // Set pathway
         $pathway = $mainframe->getPathway();
         $pathway->addItem('Video', CRoute::_('index.php?option=com_community&view=videos'));
         $pathway->addItem($video->getTitle(), '');
         $filters = array('status' => 'ready', 'category_id' => $cat_id, 'creator' => $user->id, 'permissions' => $permissions, 'or_group_privacy' => 0, 'sorting' => $sorted, 'limit' => $limit);
         $otherVideos = $model->getVideos($filters);
     }
     // Set the current user's active profile
     CFactory::setActiveProfile($video->creator);
     // Hit counter + 1
     $video->hit();
     // Get reporting html
     $reportHTML = '';
     $report = new CReportingLibrary();
     if ($user->id != $my->id) {
         $reportHTML = $report->getReportingHTML(JText::_('COM_COMMUNITY_VIDEOS_REPORT_VIDEOS'), 'videos,reportVideo', array($video->id));
     }
     // Get bookmark html
     $bookmarks = new CBookmarks($video->getPermalink());
     $bookmarksHTML = $bookmarks->getHTML();
     // Get the walls
     $wallContent = CWallLibrary::getWallContents('videos', $video->id, COwnerHelper::isCommunityAdmin() || $my->id == $video->creator && $my->id != 0, $config->get('stream_default_comments'), 0, 'wall/content', 'videos,video');
     $wallCount = CWallLibrary::getWallCount('videos', $video->id);
     $viewAllLink = CRoute::_('index.php?option=com_community&view=videos&task=app&videoid=' . $video->id . '&app=walls');
     $wallViewAll = '';
     if ($wallCount > $config->get('stream_default_comments')) {
         $wallViewAll = CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount);
     }
     $wallForm = '';
     if ($this->isPermitted($my->id, $video->creator, PRIVACY_FRIENDS) || !$config->get('lockvideoswalls')) {
         $wallForm = CWallLibrary::getWallInputForm($video->id, 'videos,ajaxSaveWall', 'videos,ajaxRemoveWall', $viewAllLink);
     }
     $redirectUrl = CRoute::getURI(false);
     // Get like information.
     $like = new CLike();
     $likeCount = $like->getLikeCount('videos', $video->id);
     $likeLiked = $like->userLiked('videos', $video->id, $my->id) === COMMUNITY_LIKE;
     $tmpl = new CTemplate();
     if ($video->creator_type == VIDEO_GROUP_TYPE) {
         $group = JTable::getInstance('Group', 'CTable');
         $group->load($groupId);
         $document = JFactory::getDocument();
         $document->addHeadLink($group->getThumbAvatar(), 'image_src', 'rel');
     }
     if ($video->location !== '' && $videoMapsDefault) {
         $zoomableMap = CMapping::drawZoomableMap($video->location, 220, 150, $video->longitude, $video->latitude);
     } else {
         $zoomableMap = "";
     }
     //friend list for video tag
     $tagging = new CVideoTagging();
     $taggedList = $tagging->getTaggedList($video->id);
     for ($t = 0; $t < count($taggedList); $t++) {
         $tagItem = $taggedList[$t];
         $tagUser = CFactory::getUser($tagItem->userid);
         $canRemoveTag = 0;
         // 1st we check the tagged user is the video owner.
         //	If yes, canRemoveTag == true.
         //	If no, then check on user is the tag creator or not.
         //	If yes, canRemoveTag == true
         //	If no, then check on user whether user is being tagged
         if (COwnerHelper::isMine($my->id, $video->creator) || COwnerHelper::isMine($my->id, $tagItem->created_by) || COwnerHelper::isMine($my->id, $tagItem->userid)) {
             $canRemoveTag = 1;
         }
         $tagItem->user = $tagUser;
         $tagItem->canRemoveTag = $canRemoveTag;
     }
     if ($video->type == "file") {
         $storage = CStorage::getStorage($video->storage);
         $video->path = $storage->getURI($video->path);
     }
     $config = CFactory::getConfig();
     $canSearch = 1;
     if ($my->id == 0 && !$config->get('enableguestsearchvideos')) {
         $canSearch = 0;
     }
     CHeadHelper::addOpengraph('og:image', JUri::root() . $video->thumb, true);
     CHeadHelper::setType('website', $video->title);
     $video->tagged = $taggedList;
     echo $tmpl->setMetaTags('video', $video)->set('user', $user)->set('zoomableMap', $zoomableMap)->set('likeCount', $likeCount)->set('canSearch', $canSearch)->set('likeLiked', $likeLiked)->set('redirectUrl', $redirectUrl)->set('wallContent', $wallContent)->set('wallForm', $wallForm)->set('wallCount', $wallCount)->set('wallViewAll', $wallViewAll)->set('bookmarksHTML', $bookmarksHTML)->set('reportHTML', $reportHTML)->set('video', $video)->set('otherVideos', $otherVideos)->set('videoMapsDefault', $videoMapsDefault)->set('wallCount', $wallCount)->set('isGroup', $groupId ? true : false)->set('groupId', $groupId ? $groupId : null)->set('submenu', $this->showSubmenu(false))->fetch('videos/single');
 }
Exemple #23
0
        public function _getMyFriendsHTML($userid = null)
        {
            $document = JFactory::getDocument();
            $this->loadUserParams();
            $count = $this->userparams->get('count', $this->params->get('count', 10));
            $is_rtl = $document->direction == 'rtl' ? 'dir="rtl"' : '';
            $html = '';
            $friendsModel = CFactory::getModel('friends');
            $my = CFactory::getUser($userid);
            $user = CFactory::getRequestUser();
            $params = $user->getParams();
            // site visitor
            $relation = 10;
            // site members
            if ($my->id != 0) {
                $relation = 20;
            }
            // friends
            if (CFriendsHelper::isConnected($my->id, $user->id)) {
                $relation = 30;
            }
            // mine
            if (COwnerHelper::isMine($my->id, $user->id)) {
                $relation = 40;
            }
            // @todo: respect privacy settings
            if ($relation >= $params->get('privacyFriendsView')) {
                $friends = $friendsModel->getFriends($user->id, 'latest', false, '', $count + $count);
                // randomize the friend count
                if ($friends) {
                    shuffle($friends);
                }
                $total = $user->getFriendCount();
                if ($this->params->get('hide_empty', 0) && !$total) {
                    return '';
                }
                ob_start();
                ?>

                    <?php 
                if ($friends) {
                    ?>
                            <ul class='joms-list--thumbnail'>
                                <?php 
                    for ($i = 0; $i < count($friends); $i++) {
                        if ($i >= $count) {
                            break;
                        }
                        $friend =& $friends[$i];
                        ?>
                                        <li class='joms-list__item'>
                                            <div class="joms-avatar <?php 
                        echo CUserHelper::onlineIndicator($friend);
                        ?>
">
                                                <a href="<?php 
                        echo CRoute::_('index.php?option=com_community&view=profile&userid=' . $friend->id);
                        ?>
" >
                                                    <img alt="<?php 
                        echo $friend->getDisplayName();
                        ?>
"
                                                         title="<?php 
                        echo $friend->getTooltip();
                        ?>
"
                                                         src="<?php 
                        echo $friend->getThumbAvatar();
                        ?>
"
                                                         data-author="<?php 
                        echo $friend->id;
                        ?>
"
                                                         />
                                                </a>
                                            </div>
                                        </li>
                                    <?php 
                    }
                    ?>
                            </ul>
                        <?php 
                } else {
                    ?>
                            <div class="cEmpty"><?php 
                    echo JText::_('COM_COMMUNITY_NO_FRIENDS_YET');
                    ?>
</div>
                    <?php 
                }
                if ($total > $count) {
                    ?>

                    <div class="joms-gap"></div>

                    <a href="<?php 
                    echo CRoute::_('index.php?option=com_community&view=friends&userid=' . $user->id);
                    ?>
">
                        <span><?php 
                    echo JText::_('COM_COMMUNITY_FRIENDS_VIEW_ALL');
                    ?>
</span>
                        <span <?php 
                    echo $is_rtl;
                    ?>
 > (<?php 
                    echo $total;
                    ?>
)</span>
                    </a>
                        <?php 
                }
                ?>

                    <?php 
                $html = ob_get_contents();
                ob_end_clean();
            }
            return $html;
        }
Exemple #24
0
 /**
  *
  */
 function onProfileDisplay()
 {
     JPlugin::loadLanguage('plg_community_friendslocation', JPATH_ADMINISTRATOR);
     $config = CFactory::getConfig();
     // Attach CSS
     $document = JFactory::getDocument();
     $css = JURI::base() . 'plugins/community/friendslocation/friendslocation/style.css';
     $document->addStyleSheet($css);
     $user = CFactory::getRequestUser();
     $userid = $user->id;
     $def_limit = $this->params->get('count', 0);
     $mapkey = $this->params->get('mapkey', '');
     $width = $this->params->get('width', '480');
     // @todo: remove
     $height = $this->params->get('height', '340');
     $show_karma = 0;
     if ($config->get('enablekarma')) {
         $show_karma = $this->params->get('show_karma', '1');
     }
     $mouse_scroll_zoom = $this->params->get('mouse_scroll_zoom', '1');
     $continuous_zoom = $this->params->get('continuous_zoom', '1');
     $column = $this->_getLocationFieldId($this->params->get("town_field_code", "FIELD_CITY"), $this->params->get("state_field_code", "FIELD_STATE"), $this->params->get("country_field_code", "FIELD_COUNTRY"));
     $town_field_id = "";
     $country_field_id = "";
     foreach ($column as $field) {
         switch ($field->fieldcode) {
             case $this->params->get("town_field_code", "FIELD_CITY"):
                 $town_field_id = $field->id;
                 break;
             case $this->params->get("country_field_code", "FIELD_COUNTRY"):
                 $country_field_id = $field->id;
                 break;
             case $this->params->get("state_field_code", "FIELD_STATE"):
                 $state_field_id = $field->id;
                 break;
             default:
                 break;
         }
     }
     if (!empty($town_field_id) && !empty($state_field_id) && !empty($country_field_id)) {
         $mainframe = JFactory::getApplication();
         $caching = $this->params->get('cache', 1);
         if ($caching) {
             $caching = $mainframe->getCfg('caching');
         }
         $layout = $this->getLayout();
         $cache = JFactory::getCache('plgCommunityFriendsLocation');
         $cache->setCaching($caching);
         $content = $this->_getFriendsLocationHTML($mapkey, $width, $height, $show_karma, $town_field_id, $state_field_id, $country_field_id, $userid, $def_limit, $layout);
     } else {
         $content = "<div>" . JText::_("PLG_FRIENDSLOCATION_FIELD_CODE_NOT_FOUND") . "</div>";
     }
     return $content;
 }
            ?>
                                        </a>
                                        <?php 
            if ($isCommunityAdmin || $video->isOwner()) {
                ?>
                                            <a title="<?php 
                echo JText::_('COM_COMMUNITY_DELETE');
                ?>
" href="javascript:void(0);" onclick="joms.videos.deleteVideo('<?php 
                echo $video->getId();
                ?>
', '<?php 
                echo $currentTask;
                ?>
', '<?php 
                echo CFactory::getRequestUser()->id;
                ?>
');">
                                                <i class="com-icon-block"></i>
                                            <?php 
                // echo JText::_('COM_COMMUNITY_DELETE')
                ?>
                                            </a>
                                        <?php 
            }
            ?>
                                        <?php 
            if ($isCommunityAdmin && !$groupVideo && $showFeatured && $video->permissions == 0) {
                if (!in_array($video->id, $featuredList)) {
                    ?>
                                                <a id="featured-<?php 
Exemple #26
0
 /**
  * Display the new album form
  **/
 public function newalbum()
 {
     $config = CFactory::getConfig();
     $document = JFactory::getDocument();
     $document->setTitle(JText::_('COM_COMMUNITY_PHOTOS_CREATE_NEW_ALBUM_TITLE'));
     $this->addPathway(JText::_('COM_COMMUNITY_PHOTOS'), CRoute::_('index.php?option=com_community&view=photos'));
     $this->addPathway(JText::_('COM_COMMUNITY_PHOTOS_CREATE_NEW_ALBUM_TITLE'));
     $js = 'assets/validate-1.5' . ($config->getBool('usepackedjavascript') ? '.pack.js' : '.js');
     CAssets::attach($js, 'js');
     $handler = $this->_getHandler();
     $type = $handler->getType();
     $user = CFactory::getRequestUser();
     $params = $user->getParams();
     $this->showSubmenu();
     $album =& JTable::getInstance('Album', 'CTable');
     // Added to maintain user input value if there is save error
     $album->name = JRequest::getVar('name', '', 'POST');
     $album->location = JRequest::getVar('location', '', 'POST');
     $album->description = JRequest::getVar('description', '', 'POST');
     $album->permissions = JRequest::getVar('permissions', $params->get('privacyPhotoView'), 'POST');
     $album->type = JRequest::getVar('type', '', 'POST');
     CFactory::load('libraries', 'apps');
     $app =& CAppPlugins::getInstance();
     $appFields = $app->triggerEvent('onFormDisplay', array('jsform-photos-newalbum'));
     $beforeFormDisplay = CFormElement::renderElements($appFields, 'before');
     $afterFormDisplay = CFormElement::renderElements($appFields, 'after');
     CFactory::load('libraries', 'privacy');
     $tmpl = new CTemplate();
     echo $tmpl->set('beforeFormDisplay', $beforeFormDisplay)->set('afterFormDisplay', $afterFormDisplay)->set('permissions', $album->permissions)->set('type', $type)->set('album', $album)->set('referrer', '')->set('enableLocation', $config->get('enable_photos_location'))->fetch('photos.editalbum');
 }
Exemple #27
0
        public function _getMyGroupsHTML($userid = null)
        {
            $document = JFactory::getDocument();
            $is_rtl = $document->direction == 'rtl' ? 'dir="rtl"' : '';
            $html = '';
            $groupsModel = CFactory::getModel('groups');
            $my = CFactory::getUser($userid);
            $user = CFactory::getRequestUser();
            $this->loadUserParams();
            $params = $user->getParams();
            // site visitor
            $relation = 10;
            // site members
            if ($my->id != 0) {
                $relation = 20;
            }
            // friends
            if (CFriendsHelper::isConnected($my->id, $user->id)) {
                $relation = 30;
            }
            // mine
            if (COwnerHelper::isMine($my->id, $user->id)) {
                $relation = 40;
            }
            if ($relation >= $params->get('privacyGroupsView')) {
                // count the groups
                $groups = $groupsModel->getGroups($user->id, 'latest', false);
                $total = count($groups);
                if ($this->params->get('hide_empty', 0) && !$total) {
                    return '';
                }
                $count = $this->userparams->get('count', $this->params->get('count', 10));
                $groupsModel->setState('limit', $count);
                $groups = $groupsModel->getGroups($user->id, 'latest', false);
                if ($groups) {
                    shuffle($groups);
                }
                ob_start();
                ?>

                <?php 
                if ($groups) {
                    $i = 0;
                    ?>
                    <?php 
                    foreach ($groups as $group) {
                        if ($i >= $count) {
                            break;
                        }
                        $table = JTable::getInstance('Group', 'CTable');
                        $table->load($group->id);
                        if ($table->unlisted && !$groupsModel->isMember($my->id, $table->id)) {
                            continue;
                        }
                        $i++;
                        ?>
                        <div class="joms-stream__header">

                            <div class="joms-avatar--stream">
                                <a href="<?php 
                        echo CRoute::_('index.php?option=com_community&view=groups&groupid=' . $group->id . '&task=viewgroup');
                        ?>
">
                                    <img src="<?php 
                        echo $table->getThumbAvatar();
                        ?>
" alt="<?php 
                        echo CStringHelper::escape($group->name);
                        ?>
" >
                                </a>
                            </div>


                            <div class="joms-stream__meta">
                                <a class="joms-text--title" href="<?php 
                        echo CRoute::_('index.php?option=com_community&view=groups&groupid=' . $group->id . '&task=viewgroup');
                        ?>
">
                                    <?php 
                        echo $group->name;
                        ?>
                                </a>

                                <a href="<?php 
                        echo CRoute::_("index.php?option=com_community&view=groups&task=viewmembers&groupid=" . $group->id);
                        ?>
" class="joms-block"><small>
                                        <?php 
                        echo JText::sprintf(!CStringHelper::isSingular($group->membercount) ? 'COM_COMMUNITY_GROUPS_MEMBERS_MANY' : 'COM_COMMUNITY_GROUPS_MEMBERS_SINGULAR', $group->membercount);
                        ?>
                                    </small></a>

                            </div>
                        </div>

                    <?php 
                    }
                    ?>

                <?php 
                } else {
                    ?>
                    <div><?php 
                    echo JText::_('COM_COMMUNITY_NO_GROUPS_YET');
                    ?>
</div>
                <?php 
                }
                if ($i < $total) {
                    ?>
                    <div class="joms-gap"></div>
                    <a href="<?php 
                    echo CRoute::_('index.php?option=com_community&view=groups&task=mygroups&userid=' . $userid);
                    ?>
">
                        <span><?php 
                    echo JText::_('PLG_MYGROUPS_VIEWALL_GROUPS');
                    ?>
</span>
                        <span>(<?php 
                    echo $total;
                    ?>
)</span>
                    </a>
                <?php 
                }
                ?>

                <?php 
                $html = ob_get_contents();
                ob_end_clean();
            }
            return $html;
        }
Exemple #28
0
 function onProfileDisplay()
 {
     JPlugin::loadLanguage('plg_community_kunena', JPATH_ADMINISTRATOR);
     $files = JPATH_ROOT . '/components/com_kunena/class.kunena.php';
     // for the newest kunena version
     $files2 = JPATH_ROOT . '/components/com_kunena/kunena.php';
     if (JFile::exists($files) || JFile::exists($files2)) {
         $config = CFactory::getConfig();
         /*
                             if (!$config->get('enablegroups')) {
                                 return JText::_('PLG_KUNENA_GROUP_DISABLED');
                             }*/
         $uri = JURI::base();
         $document = JFactory::getDocument();
         // Attach CSS
         //$css		= JURI::base() . 'plugins/community/kunena/style.css';
         //$document->addStyleSheet($css);
         $css = 'plugins/community/kunena/kunena/';
         CFactory::attach('style.css', 'css', $css);
         //CFactory::load('helpers', 'time');
         $groupsModel = CFactory::getModel('groups');
         $avatarModel = CFactory::getModel('avatar');
         $user = CFactory::getRequestUser();
         $userName = $user->getDisplayName();
         $groups = $groupsModel->getGroups($user->id);
         $my = JFactory::getUser();
         $username = $this->params->get('username');
         $password = $this->params->get('password');
         $db = JFactory::getDBO();
         // Get forum user info:
         $sql = 'SELECT a.*, b.* FROM ' . $db->quoteName('#__' . $this->db_prefix . '_users') . ' as a ' . 'LEFT JOIN ' . $db->quoteName('#__users') . ' AS b on b.' . $db->quoteName('id') . '=a.' . $db->quoteName('userid') . 'WHERE a.' . $db->quoteName('userid') . '=' . $db->Quote($user->id);
         $db->setQuery($sql);
         $userinfo = $db->loadObject();
         if ($userinfo) {
             $usr_info = 1;
             //print_r($userinfo);
             $maxPost = intval($userinfo->posts);
             // Get latest forum topics
             // Search only within allowed group
             $query = 'SELECT b.' . $db->quoteName('group_id') . ' as gid' . ' FROM ' . $db->quoteName('#__users') . ' as a, ' . $db->quoteName('#__user_usergroup_map') . ' as b' . ' WHERE a.' . $db->quoteName('id') . '= b.' . $db->quoteName('user_id') . ' AND a.' . $db->quoteName('id') . '=' . $db->Quote($my->id);
             $db->setQuery($query);
             $db->query();
             $dse_groupid = $db->loadObjectList();
             if (count($dse_groupid)) {
                 $group_id = $dse_groupid[0]->gid;
             } else {
                 $group_id = 0;
             }
             $maxCount = $this->params->get('count', 5);
             $query = 'SELECT a.* , b.' . $db->quoteName('id') . ' as category, b.' . $db->quoteName('name') . ' as catname, c.' . $db->quoteName('hits') . ' AS threadhits' . ' FROM ' . $db->quoteName('#__' . $this->db_prefix . '_messages') . ' AS a, ' . $db->quoteName('#__' . $this->db_prefix . '_categories') . ' AS b, ' . $db->quoteName('#__' . $this->db_prefix . '_messages') . ' AS c, ' . $db->quoteName('#__' . $this->db_prefix . '_messages_text') . ' AS d' . ' WHERE a.' . $db->quoteName('catid') . '     = b.' . $db->quoteName('id') . ' AND a.' . $db->quoteName('thread') . '      = c.' . $db->quoteName('id') . ' AND a.' . $db->quoteName('id') . '          = d.' . $db->quoteName('mesid') . ' AND a.' . $db->quoteName('hold') . '        = ' . $db->Quote('0') . ' AND b.' . $db->quoteName('published') . '   = ' . $db->Quote('1') . ' AND a.' . $db->quoteName('userid') . '      =' . $db->Quote($user->id) . ' AND (b.' . $db->quoteName('pub_access') . ' <=' . $db->Quote($group_id) . ')' . ' ORDER BY ' . $db->quoteName('time') . ' DESC' . ' LIMIT 0, ' . $maxCount;
             $db->setQuery($query);
             $items = $db->loadObjectList();
         } else {
             $usr_info = 0;
             $userId = "";
             $userName = "";
             $items = "";
         }
         $fbItemid = '&amp;Itemid=' . $this->getItemid();
         $mainframe = JFactory::getApplication();
         $caching = $this->params->get('cache', 1);
         if ($caching) {
             $caching = $mainframe->getCfg('caching');
         }
         $cache = JFactory::getCache('plgCommunityKunena');
         $cache->setCaching($caching);
         $callback = array('plgCommunityKunena', '_getKunenaHTML');
         $content = $cache->call($callback, $usr_info, $user->id, $userName, $items, $fbItemid);
     } else {
         //$content = "<div class=\"icon-nopost\"><img src='".JURI::base()."components/com_community/assets/error.gif' alt=\"\" /></div>";
         //$content .= "<div class=\"content-nopost\" style=\"height:100%;\">".JText::_('PLG_KUNENA_NOT_INSTALLED')."</div>";
         $content = "<div>" . JText::_('PLG_KUNENA_NOT_INSTALLED') . "</div>";
     }
     return $content;
 }
Exemple #29
0
 /**
  * Display the new album form
  * */
 public function newalbum()
 {
     $config = CFactory::getConfig();
     /**
      * Opengraph
      */
     CHeadHelper::setType('website', JText::_('COM_COMMUNITY_PHOTOS_CREATE_NEW_ALBUM_TITLE'));
     $this->addPathway(JText::_('COM_COMMUNITY_PHOTOS'), CRoute::_('index.php?option=com_community&view=photos'));
     $this->addPathway(JText::_('COM_COMMUNITY_PHOTOS_CREATE_NEW_ALBUM_TITLE'));
     // $js = 'assets/validate-1.5.min.js';
     // CFactory::attach($js, 'js');
     $handler = $this->_getHandler();
     $type = $handler->getType();
     $user = CFactory::getRequestUser();
     $params = $user->getParams();
     $album = JTable::getInstance('Album', 'CTable');
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     // Added to maintain user input value if there is save error
     $album->name = $jinput->post->get('name', '', 'STRING');
     //JRequest::getVar('name', '', 'POST');
     $album->location = $jinput->post->get('location', '', 'STRING');
     //JRequest::getVar('location', '', 'POST');
     $album->description = $jinput->post->get('description', '', 'STRING');
     //JRequest::getVar('description', '', 'POST');
     $album->permissions = $jinput->post->get('permissions', $params->get('privacyPhotoView'), 'NONE');
     //JRequest::getVar('permissions', $params->get( 'privacyPhotoView' ), 'POST');
     $album->type = $jinput->post->get('type', '', 'NONE');
     //JRequest::getVar('type', '', 'POST');
     $album->groupid = $jinput->get('groupid', '', 'NONE');
     $app = CAppPlugins::getInstance();
     $appFields = $app->triggerEvent('onFormDisplay', array('jsform-photos-newalbum'));
     $beforeFormDisplay = CFormElement::renderElements($appFields, 'before');
     $afterFormDisplay = CFormElement::renderElements($appFields, 'after');
     $tmpl = new CTemplate();
     echo $tmpl->set('beforeFormDisplay', $beforeFormDisplay)->set('afterFormDisplay', $afterFormDisplay)->set('permissions', $album->permissions)->set('type', $type)->set('album', $album)->set('referrer', '')->set('enableLocation', $config->get('enable_photos_location'))->set('submenu', $this->showSubmenu(false))->fetch('photos.editalbum');
 }
Exemple #30
0
 /**
  *
  * @param type $filter
  * @param type $userId
  * @param type $view
  * @param type $showMore
  * @return type 
  */
 public function getActivitiesByFilter($filter = 'all', $userId = 0, $view = '', $showMore = true)
 {
     $config = CFactory::getConfig();
     $act = new CActivityStream();
     if ($userId == 0) {
         // Legacy code, some module might still use the old code
         $user = CFactory::getRequestUser();
     } else {
         $user = CFactory::getUser($userId);
     }
     jimport('joomla.utilities.date');
     $friendsModel = CFactory::getModel('friends');
     $memberSince = CTimeHelper::getDate($user->registerDate);
     //$friendIds = $friendsModel->getFriendIds($user->id);
     $friendIds = $user->getFriendIds();
     switch ($filter) {
         case "active-profile":
             $target = array($user->id);
             $params =& $user->getParams();
             $actLimit = $view == 'profile' ? $params->get('activityLimit', $config->get('maxactivities')) : $config->get('maxactivities');
             $html = $act->getHTML($user->id, $target, '', $actLimit, $view, '', true, $showMore, null, false, 'active-profile');
             break;
         case "me-and-friends":
             $user =& JFactory::getUser();
             $html = $act->getHTML($user->id, $friendIds, $memberSince, 0, $view, '', true, $showMore, null, false, 'me-and-friends');
             break;
         case "active-user-and-friends":
         case "active-profile-and-friends":
             $params =& $user->getParams();
             $actLimit = $view == 'profile' ? $params->get('activityLimit', $config->get('maxactivities')) : $config->get('maxactivities');
             $html = $act->getHTML($user->id, $friendIds, $memberSince, $actLimit, $view, '', true, $showMore, null, false, 'active-profile-and-friends');
             break;
         case "all":
         default:
             $html = $act->getHTML('', '', null, 0, $view, '', true, $showMore);
             break;
     }
     return $html;
 }