Beispiel #1
0
 /**
  * Displays the application output in the canvas.
  *
  * @param   int   The user id that is currently being viewed.
  * @param   string   layout path
  * @since   1.0
  * @access  public
  */
 public function display($userId = null, $docType = null)
 {
     // Get the user params
     $params = $this->getUserParams($userId);
     // Get the app params
     $appParams = $this->app->getParams();
     // Get the blog model
     $total = (int) $params->get('total', $appParams->get('total', 5));
     $pin_width = (int) $appParams->get('pin_width', 145);
     $pin_padding = (int) $appParams->get('pin_padding', 3);
     // Get list of all products created by the user on the site.
     $input = JFactory::getApplication()->input;
     $storeid = $input->get('storeid', '', 'INT');
     $model = $this->getModel('q2cmyproducts');
     $products = $model->getItems($userId, $total, $storeid);
     $productsCount = $model->getProductsCount($userId, $storeid);
     $user = Foundry::user($userId);
     // Get store list of user
     require_once JPATH_ROOT . '/components/com_quick2cart/helpers/storeHelper.php';
     $storeHelper = new storeHelper();
     $storelist = $storeHelper->getUserStore($userId);
     $this->set('user', $user);
     $this->set('userId', $userId);
     $this->set('total', $total);
     $this->set('pin_width', $pin_width);
     $this->set('pin_padding', $pin_padding);
     $this->set('products', $products);
     $this->set('productsCount', $productsCount);
     $this->set('storelists', $storelist);
     echo parent::display('profile/default');
 }
 function onPromoteData($id)
 {
     $db = JFactory::getDBO();
     $Itemid = JRequest::getInt('Itemid');
     $eschk = $this->_chkextension();
     if (!empty($eschk)) {
         /*$query = "SELECT cf.id FROM #__community_fields as cf
         				LEFT JOIN #__community_fields_values AS cfv ON cfv.field_id=cf.id
         				WHERE cf.name like '%About me%' AND cfv.user_id=".$id;
         		$db->setQuery($query);
         		$fieldid = $db->loadresult();
         		*/
         $query = "SELECT u.name AS title\n\t\t\t\t\t\tFROM #__users AS u\n\t\t\t\t\t\tWHERE u.id =" . $id;
         $db->setQuery($query);
         $previewdata = $db->loadobjectlist();
         //if($fieldid)
         //$query .= " AND cfv.field_id=".$fieldid;
         require_once JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/foundry.php';
         $user = Foundry::user($id);
         //easysocial data for user
         $activitysocialintegrationprofiledata = new activitysocialintegrationprofiledata();
         $img_path = $activitysocialintegrationprofiledata->getUserAvatar('EasySocial', JFactory::getUser($id));
         $link = $activitysocialintegrationprofiledata->getUserProfileUrl('EasySocial', $id);
         $previewdata[0]->image = $img_path;
         $previewdata[0]->url = JUri::root() . substr(JRoute::_($link, false), strlen(JUri::base(true)) + 1);
         $previewdata[0]->bodytext = '';
         return $previewdata;
     } else {
         return '';
     }
 }
Beispiel #3
0
 /**
  * Allows user to activate their account.
  *
  * @since	1.0
  * @access	public
  */
 public function activate()
 {
     $my = FD::user();
     // Get current view.
     $view = $this->getCurrentView();
     // Get the id from the request
     $id = JRequest::getInt('userid');
     $currentUser = FD::user($id);
     // If user is already logged in, redirect to the dashboard.
     if ($my->isLoggedIn()) {
         return $view->call(__FUNCTION__, $currentUser);
     }
     $token = JRequest::getVar('token', '');
     // If token is empty, warn the user.
     if (empty($token) || strlen($token) !== 32) {
         $view->setMessage(JText::_('COM_EASYSOCIAL_REGISTRATION_ACTIVATION_TOKEN_INVALID'), SOCIAL_MSG_ERROR);
         return $view->call(__FUNCTION__, $currentUser);
     }
     // Retrieve registration model
     $model = FD::model('Registration');
     // Activate the token.
     $user = $model->activate($token);
     if ($user === false) {
         $view->setMessage($model->getError(), SOCIAL_MSG_ERROR);
         return $view->call(__FUNCTION__, $currentUser);
     }
     // @points: user.register
     // Assign points when user registers on the site.
     $points = Foundry::points();
     $points->assign('user.registration', 'com_easysocial', $this->id);
     // @badge: registration.create
     // Assign badge for the person that initiated the friend request.
     $badge = FD::badges();
     $badge->log('com_easysocial', 'registration.create', $user->id, JText::_('COM_EASYSOCIAL_REGISTRATION_BADGE_REGISTERED'));
     // Get configuration object.
     $config = FD::config();
     // Add activity logging when a uer registers on the site.
     // Get the application params
     $app = FD::table('App');
     $app->load(array('element' => 'profiles', 'group' => SOCIAL_TYPE_USER));
     $params = $app->getParams();
     // If not allowed, we will not want to proceed here.
     if ($params->get('stream_register', true)) {
         $stream = FD::stream();
         $streamTemplate = $stream->getTemplate();
         // Set the actor
         $streamTemplate->setActor($user->id, SOCIAL_TYPE_USER);
         // Set the context
         $streamTemplate->setContext($user->id, SOCIAL_TYPE_PROFILES);
         // Set the verb
         $streamTemplate->setVerb('register');
         // set sitewide
         $streamTemplate->setSiteWide();
         $streamTemplate->setAccess('core.view');
         // Add stream template.
         $stream->add($streamTemplate);
     }
     $view->setMessage(JText::_('COM_EASYSOCIAL_REGISTRATION_ACTIVATION_COMPLETED_SUCCESS'), SOCIAL_MSG_SUCCESS);
     return $view->call(__FUNCTION__, $user);
 }
Beispiel #4
0
 /**
  * Shares a story through 3rd party oauth clients
  *
  * @param	TableBlog	$blog	A blog table object
  * @param	string		$type	The type of oauth client
  *
  * @return	boolean		True on success and false otherwise.
  **/
 public function getHTML($bloggerid = "")
 {
     $html = '';
     $my = JFactory::getUser();
     $config = EasyBlogHelper::getConfig();
     if ($config->get('main_jomsocial_messaging') && $my->id != $bloggerid) {
         $file_core = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'core.php';
         $file_messaging = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'messaging.php';
         if (file_exists($file_core) && file_exists($file_messaging)) {
             require_once $file_core;
             require_once $file_messaging;
             CMessaging::load();
             $html = '<a href="javascript:void(0);" onclick="' . CMessaging::getPopup($bloggerid) . '" class="author-message" title="' . JText::_('COM_EASYBLOG_MESSAGE_AUTHOR') . '"><span>' . JText::_('COM_EASYBLOG_MESSAGE_AUTHOR') . '</span></a>';
         }
     }
     $easysocial = EasyBlogHelper::getHelper('EasySocial');
     if ($config->get('integrations_easysocial_conversations') && $easysocial->exists() && $my->id != $bloggerid) {
         $easysocial->init();
         $user = Foundry::user($bloggerid);
         $theme = new CodeThemes();
         $theme->set('user', $user);
         $html = $theme->fetch('easysocial.conversation.php');
     }
     return $html;
 }
 public function getLink()
 {
     $user = Foundry::user($this->profile->id);
     if ($this->komentoprofile) {
         return JRoute::_('index.php?option=com_komento&view=profile&id=' . $this->profile->id);
     }
     return $user->getPermalink();
 }
Beispiel #6
0
 /**
  * Responsible to display the generic login form.
  *
  * @since	1.0
  * @access	public
  */
 public function display($tpl = null)
 {
     $my = FD::user();
     // If user is already logged in, they should not see this page.
     if ($my->id > 0) {
         return $this->redirect(FRoute::dashboard(array(), false));
     }
     // Add page title
     FD::page()->title(JText::_('COM_EASYSOCIAL_LOGIN_PAGE_TITLE'));
     // Add breadcrumb
     FD::page()->breadcrumb(JText::_('COM_EASYSOCIAL_LOGIN_PAGE_BREADCRUMB'));
     // Facebook codes.
     $facebook = FD::oauth('Facebook');
     $config = FD::config();
     $loginMenu = $config->get('general.site.login');
     // Get any callback urls.
     $return = FD::getCallback();
     // If return value is empty, always redirect back to the dashboard
     if (!$return) {
         // Determine if there's a login redirection
         $urlFromCaller = FD::input()->getVar('return', '');
         if ($urlFromCaller) {
             $return = $urlFromCaller;
         } else {
             if ($loginMenu != 'null') {
                 $return = FRoute::getMenuLink($loginMenu);
             } else {
                 $return = FRoute::dashboard(array(), false);
             }
             $return = base64_encode($return);
         }
     } else {
         $return = base64_encode($return);
     }
     if ($config->get('registrations.enabled')) {
         $profileId = $config->get('registrations.mini.profile', 'default');
         if ($profileId === 'default') {
             $profileId = Foundry::model('profiles')->getDefaultProfile()->id;
         }
         $options = array('visible' => SOCIAL_PROFILES_VIEW_MINI_REGISTRATION, 'profile_id' => $profileId);
         $fieldsModel = Foundry::model('fields');
         $fields = $fieldsModel->getCustomFields($options);
         if (!empty($fields)) {
             FD::language()->loadAdmin();
             $fieldsLib = FD::fields();
             $session = JFactory::getSession();
             $registration = FD::table('Registration');
             $registration->load($session->getId());
             $data = $registration->getValues();
             $args = array(&$data, &$registration);
             $fieldsLib->trigger('onRegisterMini', SOCIAL_FIELDS_GROUP_USER, $fields, $args);
             $this->set('fields', $fields);
         }
     }
     $this->set('return', $return);
     $this->set('facebook', $facebook);
     return parent::display('site/login/default');
 }
Beispiel #7
0
 function _getAvatar($profile)
 {
     $easysocial = EasyBlogHelper::getHelper('EasySocial');
     $easysocial->init();
     $user = Foundry::user($profile->id);
     $avatar = new stdClass();
     $avatar->link = $user->getAvatar();
     return $avatar;
 }
Beispiel #8
0
 public function getAvatar($profile)
 {
     $easysocial = EB::easysocial();
     if (!$easysocial->exists()) {
         return false;
     }
     // Load the user
     $user = Foundry::user($profile->id);
     return $user->getAvatar();
 }
Beispiel #9
0
 public function isValidNode()
 {
     if (!$this->group->id) {
         $this->lib->setError(JText::_('Sorry, but the group id provided is not a valid group id.'));
         return false;
     }
     if (Foundry::user()->id != $this->group->creator_uid) {
         if (FD::user()->isBlockedBy($this->group->creator_uid)) {
             return JError::raiseError(404, JText::_('COM_EASYSOCIAL_GROUPS_GROUP_NOT_FOUND'));
         }
     }
     return true;
 }
 public function main()
 {
     $db = Foundry::db();
     $sql = $db->sql();
     $query = "update `#__social_stream` as a";
     $query .= ' inner join `#__social_clusters` as b on a.`cluster_id` = b.`id`';
     $query .= ' set a.`cluster_access` = b.`type`';
     $query .= ' where a.`cluster_id` != 0 and a.`cluster_access` = 1';
     $sql->raw($query);
     $db->setQuery($sql);
     $state = $db->query();
     return $state;
 }
Beispiel #11
0
 /**
  * Responsible to display the generic login form via ajax
  *
  * @since	1.0
  * @access	public
  */
 public function form($tpl = null)
 {
     $ajax = FD::ajax();
     $my = FD::user();
     // If user is already logged in, they should not see this page.
     if ($my->id > 0) {
         $this->setMessage(JText::_('COM_EASYSOCIAL_LOGIN_ALREADY_LOGGED_IN'), SOCIAL_MSG_ERROR);
         return $ajax->reject($this->getMessage());
     }
     // Facebook codes.
     $facebook = FD::oauth('Facebook');
     // Get any callback urls.
     $return = FD::getCallback();
     // If return value is empty, always redirect back to the dashboard
     if (!$return) {
         $return = FRoute::dashboard(array(), false);
     }
     // Determine if there's a login redirection
     $config = FD::config();
     $loginMenu = $config->get('general.site.login');
     if ($loginMenu != 'null') {
         $return = FD::get('toolbar')->getRedirectionUrl($loginMenu);
     }
     $return = base64_encode($return);
     $this->set('return', $return);
     $this->set('facebook', $facebook);
     if ($config->get('registrations.enabled')) {
         $profileId = $config->get('registrations.mini.profile', 'default');
         if ($profileId === 'default') {
             $profileId = Foundry::model('profiles')->getDefaultProfile()->id;
         }
         $options = array('visible' => SOCIAL_PROFILES_VIEW_MINI_REGISTRATION, 'profile_id' => $profileId);
         $fieldsModel = FD::model('Fields');
         $fields = $fieldsModel->getCustomFields($options);
         if (!empty($fields)) {
             FD::language()->loadAdmin();
             $fieldsLib = FD::fields();
             $session = JFactory::getSession();
             $registration = FD::table('Registration');
             $registration->load($session->getId());
             $data = $registration->getValues();
             $args = array(&$data, &$registration);
             $fieldsLib->trigger('onRegisterMini', SOCIAL_FIELDS_GROUP_USER, $fields, $args);
             $this->set('fields', $fields);
         }
     }
     $contents = parent::display('site/login/dialog.login');
     return $ajax->resolve($contents);
 }
 public function getHTML($bloggerid = "")
 {
     $config = EB::config();
     $html = '';
     $easysocial = EB::easysocial();
     if ($config->get('integrations_easysocial_badges') && $easysocial->exists()) {
         $easysocial->init();
         $user = Foundry::user($bloggerid);
         $badges = $user->getBadges();
         $theme = EB::template();
         $theme->set('badges', $badges);
         $html = $theme->output('site/easysocial/achievements');
     }
     return $html;
 }
Beispiel #13
0
 public function getHTML($bloggerid = "")
 {
     $config = EasyBlogHelper::getConfig();
     $html = '';
     $easysocial = EasyBlogHelper::getHelper('EasySocial');
     if ($config->get('integrations_easysocial_badges') && $easysocial->exists()) {
         $easysocial->init();
         $user = Foundry::user($bloggerid);
         $badges = $user->getBadges();
         $theme = new CodeThemes();
         $theme->set('badges', $badges);
         $html = $theme->fetch('easysocial.achievements.php');
     }
     return $html;
 }
    public function getProductsCount($userId, $storeid = '')
    {
        $db = Foundry::db();
        $sql = $db->sql();
        $sql = 'SELECT COUNT(i.item_id)
		 FROM `#__kart_items` as i, `#__kart_store` as s
		 WHERE s.id = i.store_id
		 AND i.state = 1
		 AND `owner` = ' . $userId;
        if ($storeid) {
            $sql .= ' AND i.store_id = ' . $storeid;
        }
        $sql .= " AND i.parent = 'com_quick2cart'";
        $db->setQuery($sql);
        $result = $db->loadResult();
        return $result;
    }
Beispiel #15
0
 /**
  * Display the list of photos a user has uploaded
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function getAlbums($user)
 {
     $params = $this->getUserParams($user->id);
     $appParam = $this->app->getParams();
     $albums = array();
     // Load up albums model
     $model = FD::model('Albums');
     $sorting = $params->get('ordering', $appParam->get('ordering', 'latest'));
     $options = array('order' => 'assigned_date', 'direction' => $sorting == 'latest' ? 'desc' : 'asc');
     $options['excludeblocked'] = 1;
     // privacy lib
     $privacy = Foundry::privacy(Foundry::user()->id);
     $results = $model->getAlbums($user->id, SOCIAL_TYPE_USER, $options);
     if ($results) {
         foreach ($results as $item) {
             // we need to check the photo's album privacy to see if user allow to view or not.
             if ($privacy->validate('albums.view', $item->id, SOCIAL_TYPE_ALBUM, $item->user_id)) {
                 $albums[] = $item;
             }
         }
     }
     if (empty($albums)) {
         return;
     }
     // If sorting is set to random, then we shuffle the albums
     if ($sorting == 'random') {
         shuffle($albums);
     }
     // since we are getting all albums belong to user,
     // we do not need to run another query to count the albums.
     // just do array count will be fine.
     // $total		= $model->getTotalAlbums($options);
     $total = count($albums);
     $limit = $params->get('limit', $appParam->get('limit', 10));
     $this->set('total', $total);
     $this->set('appParams', $appParam);
     $this->set('params', $params);
     $this->set('user', $user);
     $this->set('albums', $albums);
     $this->set('limit', $limit);
     $this->set('privacy', $privacy);
     return parent::display('widgets/profile/albums');
 }
Beispiel #16
0
 /**
  * Installs a new theme
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function install($file)
 {
     $source = $file['tmp_name'];
     $fileName = md5($file['name'] . Foundry::date()->toMySQL());
     $fileExtension = '_themes_install.zip';
     $destination = JPATH_ROOT . '/tmp/' . $fileName . $fileExtension;
     // Upload the zip archive
     $state = JFile::upload($source, $destination);
     if (!$state) {
         $this->setError(JText::_('COM_EASYBLOG_THEMES_INSTALLER_ERROR_COPY_FROM_PHP'));
         return false;
     }
     // Extract the zip
     $extracted = dirname($destination) . '/' . $fileName . '_themes_install';
     $state = JArchive::extract($destination, $extracted);
     // Once it is extracted, delete the zip file
     JFile::delete($destination);
     // Get the configuration file.
     $manifest = $extracted . '/config/template.json';
     $manifest = JFile::read($manifest);
     // Get the theme object
     $theme = json_decode($manifest);
     // Move it to the appropriate folder
     $themeDestination = EBLOG_THEMES . '/' . strtolower($theme->element);
     $exists = JFolder::exists($themeDestination);
     // If folder exists, overwrite it. For now, just throw an error.
     if ($exists) {
         // Delete teh etracted folder
         JFolder::delete($extracted);
         $this->setError(JText::sprintf('COM_EASYBLOG_THEMES_INSTALLER_ERROR_SAME_THEME_FOLDER_EXISTS', $theme->element));
         return false;
     }
     // Move extracted folder
     $state = JFolder::move($extracted, $themeDestination);
     if (!$state) {
         // Delete the etracted folder
         JFolder::delete($extracted);
         $this->setError(JText::_('COM_EASYBLOG_THEMES_INSTALLER_ERROR_MOVING_FOLDER_TO_THEMES_FOLDER'));
         return false;
     }
     return true;
 }
 /**
  *
  *
  * @since	1.2
  * @access	public
  * @param	string
  * @return
  */
 public function execute($item)
 {
     // Get comment participants
     $model = FD::model('Comments');
     $users = $model->getParticipants($item->uid, $item->context_type);
     // Include the actor of the stream item as the recipient
     // Exclude myself from the list of users.
     // Ensure that the values are unique
     $users[] = $item->actor_id;
     $users = array_values(array_unique(array_diff($users, array(Foundry::user()->id))));
     // Convert the names to stream-ish
     $names = Foundry::string()->namesToNotifications($users);
     $plurality = count($users) > 1 ? '_PLURAL' : '_SINGULAR';
     // By default content is always empty;
     $content = '';
     // Only show the content when there is only 1 item
     if (count($users) == 1 && !empty($item->content)) {
         $content = JString::substr(strip_tags($item->content), 0, 30);
         if (JString::strlen($item->content) > 30) {
             $content .= JText::_('COM_EASYSOCIAL_ELLIPSES');
         }
     }
     // Load the milestone
     $milestone = FD::table('Milestone');
     $state = $milestone->load($item->uid);
     if (!$state) {
         return;
     }
     // We need to generate the notification message differently for the author of the item and the recipients of the item.
     if ($milestone->owner_id == $item->target_id && $item->target_type == SOCIAL_TYPE_USER) {
         $item->title = JText::sprintf('APP_GROUP_TASKS_USER_COMMENTED_ON_YOUR_MILESTONE', $names);
         return $item;
     }
     if ($milestone->owner_id == $item->actor_id && count($users) == 1) {
         $item->title = JText::sprintf('APP_GROUP_TASKS_USER_COMMENTED_ON_THEIR_MILESTONE', $names);
         return $item;
     }
     // This is for 3rd party viewers
     $item->title = JText::sprintf('APP_GROUP_TASKS_USER_COMMENTED_ON_USERS_MILESTONE', $names, Foundry::user($milestone->owner_id)->getName());
     return $item;
 }
Beispiel #18
0
 /**
  * Get the message
  * @return string The message to be displayed to the user
  */
 static function getUserinfowindow()
 {
     $user = JFactory::getUser();
     $db = JFactory::getDBO();
     $jinput = JFactory::getApplication()->input;
     $userid = $jinput->get('contentid', null, 'int');
     $file = JPATH_ROOT . '/administrator/components/com_easysocial/includes/foundry.php';
     jimport('joomla.filesystem.file');
     if (!JFile::exists($file)) {
         return;
     }
     require_once $file;
     $config = Foundry::config();
     $photos_enabled = $config->get('photos.enabled');
     //$videos_enabled = $config->get( 'videos.enabled' );
     $points_enabled = $config->get('points.enabled');
     $followers_enabled = $config->get('followers.enabled');
     // u , sa , sc , sp , spm , sf
     $q = "SELECT u.name, u.username , u.lastvisitDate \r\n\t\t, spm.value AS cover \r\n\t\t, sc.photo_id , sc.x , sc.y  \r\n\t\t, sf.state as isfriend \r\n\t\t, (SELECT COUNT(*) FROM #__session WHERE userid=u.id AND client_id='0') AS onlinestatus ";
     if ($photos_enabled) {
         $q .= " , (SELECT COUNT(*) FROM #__social_albums WHERE user_id=u.id AND type='user' AND core='0') AS photoalbumscount ";
     }
     if ($points_enabled) {
         $q .= " , (SELECT SUM(points) FROM #__social_points_history WHERE user_id=u.id AND state='1') AS points ";
     }
     if ($followers_enabled) {
         $q .= " , (SELECT COUNT(*) FROM #__social_subscriptions WHERE uid=u.id AND type='user.user') AS followerscount ";
     }
     $q .= " , (SELECT COUNT(*) FROM #__social_friends WHERE (actor_id=u.id OR  target_id=u.id ) AND state='1') AS friendscount ";
     //if($videos_enabled)
     //$q .= " , (SELECT COUNT(*) FROM #__social_videos WHERE user_id=u.id AND type='user' AND state='1') AS videoscount ";
     $q .= " FROM #__users u  \r\n\t\tLEFT JOIN #__social_covers sc ON sc.uid=u.id AND sc.type='user' \r\n\t\tLEFT JOIN #__social_photos_meta spm ON spm.photo_id=sc.photo_id AND spm.property='large' \r\n\t\tLEFT JOIN #__social_friends sf ON (sf.actor_id ='" . $user->id . "' AND sf.target_id=u.id AND sf.state='-1') OR (sf.actor_id ='" . $user->id . "' AND sf.target_id=u.id AND sf.state='1') OR  (sf.actor_id =u.id AND sf.target_id='" . $user->id . "' AND sf.state='1')\r\n\t\tWHERE u.id='" . $userid . "'";
     $db->setQuery($q);
     $infowindow = $db->loadObject();
     //echo $infowinfow["medium"]  = Foundry::user( $user->id )->getAvatar();
     //$infowinfow->medium  = Foundry::user( $user->id )->getAvatar();
     //$infowinfow->offsetSet("medium",Foundry::user( $user->id )->getAvatar() );
     //var_dump($infowindow);
     return $infowindow;
 }
Beispiel #19
0
 public function getHTML($bloggerid = "")
 {
     $html = '';
     $my = JFactory::getUser();
     $config = EasyBlogHelper::getConfig();
     // We don't want to show the link to the same user
     if ($my->id == $bloggerid) {
         return;
     }
     if ($config->get('main_jomsocial_friends')) {
         $file_core = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'core.php';
         $file_messaging = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'friends.php';
         jimport('joomla.filesystem.file');
         if (JFile::exists($file_core) && JFile::exists($file_messaging)) {
             require_once $file_core;
             require_once $file_messaging;
             $user = CFactory::getUser();
             $model = CFactory::getModel('Friends');
             $friends = $model->getFriendIds($bloggerid);
             if (!in_array($my->id, $friends)) {
                 CFriends::load();
                 $html = '<a href="javascript:void(0);" onclick="' . CFriends::getPopup($bloggerid) . '" class="author-friend"><span>' . JText::_('COM_EASYBLOG_ADD_FRIEND') . '</span></a>';
             }
         }
     }
     $easysocial = EasyBlogHelper::getHelper('EasySocial');
     if ($config->get('integrations_easysocial_friends') && $easysocial->exists()) {
         $user = Foundry::user($bloggerid);
         // Check if the user is friends with the current viewer.
         if ($user->isFriends($my->id)) {
             return;
         }
         $easysocial->init();
         $theme = new CodeThemes();
         $theme->set('id', $bloggerid);
         $html = $theme->fetch('easysocial.friends.php');
     }
     return $html;
 }
Beispiel #20
0
 public function getHTML($bloggerid = "")
 {
     $html = '';
     $my = JFactory::getUser();
     $config = EasyBlogHelper::getConfig();
     // We don't want to show the link to the same user
     if ($my->id == $bloggerid) {
         return;
     }
     $easysocial = EasyBlogHelper::getHelper('EasySocial');
     if ($config->get('integrations_easysocial_followers') && $easysocial->exists()) {
         $user = Foundry::user($bloggerid);
         $followed = $user->isFollowed($my->id);
         if ($followed) {
             return;
         }
         $easysocial->init();
         $theme = new CodeThemes();
         $theme->set('id', $bloggerid);
         $html = $theme->fetch('easysocial.followers.php');
     }
     return $html;
 }
Beispiel #21
0
 public static function location($location, $options = '')
 {
     $uid = uniqid();
     $classname = 'es-location-' . $uid;
     $selector = '.' . $classname;
     if (empty($location)) {
         $location = Foundry::table('Location');
     }
     $theme = Foundry::get('Themes');
     $theme->set('uid', $uid);
     $theme->set('classname', $classname);
     $theme->set('selector', $selector);
     $theme->set('location', $location);
     return $theme->output('admin/html/grid.location');
 }
Beispiel #22
0
 public function onUserAfterSave($user, $isnew, $success, $msg)
 {
     if ($isnew) {
         // Initialise EasySocial's Foundry Framework
         // Include main file.
         jimport('joomla.filesystem.file');
         $path = JPATH_ROOT . '/administrator/components/com_easysocial/includes/foundry.php';
         if (!JFile::exists($path)) {
             return false;
         }
         // Include the foundry engine
         require_once $path;
         $success = true;
         // Check if Foundry exists
         if (!Foundry::exists()) {
             Foundry::language()->loadSite();
             echo JText::_('COM_EASYSOCIAL_FOUNDRY_DEPENDENCY_MISSING');
             return;
         }
         if (!$success) {
             return false;
         }
         // Things that need to do here
         // 1. Insert user record into #__social_users
         // 2. Get the default profile
         // 3. Insert mapping into #__social_profiles_maps
         $userTable = Foundry::table('users');
         $state = $userTable->load($user['id']);
         // If no user is found in #__social_users, then only we insert
         // If user is found, means the registration is coming from EasySocial itself.
         // The purpose here is to insert the user data if the registration is handled by other services
         if (!$state) {
             // Assign the user id
             $userTable->user_id = $user['id'];
             // Filter the username so that it becomes a valid alias
             $alias = JFilterOutput::stringURLSafe($user['username']);
             // Check if the alias exists.
             $userModel = Foundry::model('Users');
             // Keep the original state of the alias
             $tmp = $alias;
             while ($userModel->aliasExists($alias, $user['id'])) {
                 // Generate a new alias for the user.
                 $alias = $tmp . '-' . rand(1, 150);
             }
             $userTable->alias = $alias;
             $userTable->state = $user['block'] === SOCIAL_JOOMLA_USER_BLOCKED ? SOCIAL_USER_STATE_PENDING : SOCIAL_USER_STATE_ENABLED;
             $userTable->type = 'joomla';
             $userTable->store();
             $profileModel = Foundry::model('Profiles');
             $defaultProfile = $profileModel->getDefaultProfile();
             if ($defaultProfile) {
                 $defaultProfile->addUser($user['id']);
             }
             $controller = JRequest::getCmd('controller', '');
             if ($controller != 'registration') {
                 // if this user saving is coming from registration, then we dont add the user into finder. let the registration controller do the job.
                 // Get the user object now
                 $esUser = Foundry::user($user['id']);
                 // Sync the index
                 $esUser->syncIndex();
             }
         }
     }
     return true;
 }
Beispiel #23
0
 protected function getAlias()
 {
     $config = \Foundry::config();
     // Default permalink to use.
     $name = $config->get('users.aliasName') == 'realname' ? $this->name : $this->username;
     $name = $this->user_id . ':' . $name;
     // Check if the permalink is set
     if ($this->permalink && !empty($this->permalink)) {
         $name = $this->permalink;
     }
     // If alias exists and permalink doesn't we use the alias
     if ($this->alias && !empty($this->alias) && !$this->permalink) {
         $name = $this->alias;
     }
     // Ensure that the name is a safe url.
     $name = \JFilterOutput::stringURLSafe($name);
     return $name;
 }
Beispiel #24
0
 public function getProfileLink($defaultItemId = '')
 {
     static $instance = array();
     static $phpbbDB = null;
     static $phpbbpath = null;
     static $isBlogger = array();
     // since it's for avatar, we'll follow the avatar's integration
     $config = EasyBlogHelper::getConfig();
     $source = $config->get('layout_avatarIntegration');
     if (!$config->get('main_nonblogger_profile')) {
         // 1st check if this user a blogger or not.
         $showLink = false;
         if (isset($isBlogger[$this->id])) {
             $showLink = $isBlogger[$this->id];
         } else {
             $showLink = EasyBlogHelper::isBlogger($this->id);
             $isBlogger[$this->id] = $showLink;
         }
         if (!$showLink) {
             return 'javascript: void(0);';
         }
     }
     // phpbb case
     if ($source == 'phpbb' && $phpbbDB === null) {
         $phpbbpath = $config->get('layout_phpbb_path');
         $file = JPATH_ROOT . DIRECTORY_SEPARATOR . $phpbbpath . DIRECTORY_SEPARATOR . 'config.php';
         if (JFile::exists($file)) {
             require $file;
             $host = $dbhost;
             $user = $dbuser;
             $password = $dbpasswd;
             $database = $dbname;
             $prefix = $table_prefix;
             $driver = $dbms;
             $debug = 0;
             $options = array('driver' => $driver, 'host' => $host, 'user' => $user, 'password' => $password, 'database' => $database, 'prefix' => $prefix);
             $phpbbDB = JDatabase::getInstance($options);
         } else {
             $phpbbDB = false;
         }
     }
     if ($phpbbDB === false) {
         // can't get phpbb's config file, fallback to default profile link
         $source = 'default';
     }
     // Always use the core linking if user does not wants this.
     if (!$config->get('layout_avatar_link_name')) {
         $source = 'default';
     }
     // to ensure the passed in value is only a number
     $defaultItemId = str_replace('&Itemid=', '', $defaultItemId);
     // to ensure the uniqueness of the key
     $key = $source . '-' . $defaultItemId;
     // this is where the magic starts
     if (!isset($instance[$this->id][$key])) {
         $defaultItemId = !empty($defaultItemId) ? '&Itemid=' . $defaultItemId : '';
         $defaultLink = EasyBlogRouter::_('index.php?option=com_easyblog&view=blogger&layout=listings&id=' . $this->id . $defaultItemId);
         switch ($source) {
             case 'k2':
                 $file1 = JPATH_ROOT . '/components/com_k2/helpers/route.php';
                 $file2 = JPATH_ROOT . '/components/com_k2/helpers/utilities.php';
                 jimport('joomla.filesystem.file');
                 if (JFile::exists($file1) && JFile::exists($file2)) {
                     require_once $file1;
                     require_once $file2;
                     $ret = K2HelperRoute::getUserRoute($this->id);
                 } else {
                     $ret = $defaultLink;
                 }
                 break;
             case 'mightyregistration':
                 $ret = JRoute::_('index.php?option=com_community&view=profile&user_id=' . $this->id, false);
                 break;
             case 'communitybuilder':
                 $ret = JRoute::_('index.php?option=com_comprofiler&task=userProfile&user='******'easysocial':
                 $easysocial = EasyBlogHelper::getHelper('EasySocial');
                 $ret = '';
                 if ($easysocial->exists()) {
                     $easysocial->init();
                     $user = Foundry::user($this->id);
                     $ret = $user->getPermalink();
                 }
                 break;
             case 'jomsocial':
                 $file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'core.php';
                 $ret = JFile::exists($file) && (require_once $file) ? CRoute::_('index.php?option=com_community&view=profile&userid=' . $this->id) : '';
                 break;
             case 'kunena':
                 $ret = JRoute::_('index.php?option=com_kunena&func=fbprofile&userid=' . $this->id, false);
                 break;
             case 'phpbb':
                 $juser = JFactory::getUser($this->id);
                 $query = 'SELECT ' . $phpbbDB->nameQuote('user_id') . ' ' . 'FROM ' . $phpbbDB->nameQuote('#__users') . ' WHERE LOWER(' . $phpbbDB->nameQuote('username') . ') = LOWER(' . $phpbbDB->quote($juser->username) . ') ';
                 $phpbbDB->setQuery($query, 0, 1);
                 $phpbbuserid = $phpbbDB->loadResult();
                 $ret = $phpbbuserid ? JURI::root() . rtrim($phpbbpath, '/') . '/memberlist.php?mode=viewprofile&u=' . $phpbbuserid : '';
                 break;
             case 'anahita':
                 $person = KFactory::get('lib.anahita.se.person.helper')->getPerson($this->id);
                 $ret = $person->getURL();
                 break;
             case 'easydiscuss':
                 $file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_easydiscuss' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'router.php';
                 $ret = JFile::exists($file) && (require_once $file) ? DiscussRouter::_('index.php?option=com_easydiscuss&view=profile&id=' . $this->id, false) : '';
                 break;
             case 'gravatar':
             case 'default':
             default:
                 $ret = '';
                 break;
         }
         $instance[$this->id][$key] = $ret ? $ret : $defaultLink;
     }
     return $instance[$this->id][$key];
 }
Beispiel #25
0
 public function checkPrivacy($blog)
 {
     $obj = new stdClass();
     $obj->allowed = EasyBlogHelper::isLoggedIn();
     $obj->message = '';
     // If it is public or site amdin, always allow browser to access.
     if (!$blog->access || EasyBlogHelper::isSiteAdmin()) {
         $obj->allowed = true;
         return $obj;
     }
     $my = JFactory::getUser();
     $config = EasyBlogHelper::getConfig();
     $file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'core.php';
     $easysocial = EasyBlogHelper::getHelper('EasySocial');
     if ($config->get('integrations_easysocial_privacy') && $easysocial->exists()) {
         switch ($blog->access) {
             case '10':
                 $obj->allowed = EasyBlogHelper::isLoggedIn();
                 $obj->error = $obj->allowed ? '' : $this->getErrorHTML();
                 break;
             case '30':
                 // if user is the blog author, we always allow.
                 $obj->allowed = $my->id == $blog->created_by ? true : false;
                 if (!$obj->allowed) {
                     $obj->allowed = Foundry::user($my->id)->isFriends($blog->created_by);
                 }
                 $obj->error = $obj->allowed ? '' : $this->getErrorHTML('privacy.friends');
                 break;
             case '40':
                 $obj->allowed = $my->id == $blog->created_by;
                 $obj->error = $obj->allowed ? '' : $this->getErrorHTML('privacy.owner');
                 break;
         }
         return $obj;
     } else {
         if ($config->get('main_jomsocial_privacy') && JFile::exists($file)) {
             switch ($blog->access) {
                 case '20':
                     $obj->allowed = EasyBlogHelper::isLoggedIn();
                     $obj->error = $obj->allowed ? '' : $this->getErrorHTML();
                     break;
                 case '30':
                     require_once $file;
                     $obj->allowed = CFactory::getUser($my->id)->isFriendWith($blog->created_by);
                     $obj->error = $obj->allowed ? '' : $this->getErrorHTML('privacy.friends');
                     break;
                 case '40':
                     $obj->allowed = $my->id == $blog->created_by;
                     $obj->error = $obj->allowed ? '' : $this->getErrorHTML('privacy.owner');
                     break;
             }
             return $obj;
         }
     }
     if ($blog->access) {
         $obj->allowed = EasyBlogHelper::isLoggedIn();
         $obj->error = $obj->allowed ? '' : $this->getErrorHTML();
     }
     // If not integrated with any privacy providers, we assume that the blog
     // is private.
     return $obj;
 }
Beispiel #26
0
 /**
  * Creates a new discussion
  *
  * @since	1.2
  * @access	public
  * @param	string
  * @return
  */
 public function save()
 {
     // Check for request forgeriess
     FD::checkToken();
     // Ensure that the user is logged in.
     FD::requireLogin();
     // Load up ajax lib
     $ajax = FD::ajax();
     // Load the discussion
     $id = JRequest::getInt('id');
     $discussion = FD::table('Discussion');
     $discussion->load($id);
     // Get the current logged in user.
     $my = FD::user();
     // Get the group
     $groupId = JRequest::getInt('cluster_id', 0);
     $group = FD::group($groupId);
     // Only allow owner and admin to modify the
     if ($discussion->id) {
         if ($discussion->created_by != $my->id && !$group->isAdmin() && !$my->isSiteAdmin()) {
             return $this->redirect($group->getPermalink(false));
         }
     }
     // Check if the user is allowed to create a discussion
     if (!$group->isMember()) {
         FD::info()->set(JText::_('APP_GROUP_DISCUSSIONS_NOT_ALLOWED_CREATE'), SOCIAL_MSG_ERROR);
         // Perform a redirection
         return JFactory::getApplication()->redirect(FRoute::dashboard());
     }
     // Assign discussion properties
     $discussion->uid = $group->id;
     $discussion->type = SOCIAL_TYPE_GROUP;
     $discussion->title = JRequest::getVar('title', '');
     $discussion->content = JRequest::getVar('content', '', 'POST', 'none', JREQUEST_ALLOWRAW);
     // If discussion is edited, we don't want to modify the following items
     if (!$discussion->id) {
         $discussion->created_by = $my->id;
         $discussion->parent_id = 0;
         $discussion->hits = 0;
         $discussion->state = SOCIAL_STATE_PUBLISHED;
         $discussion->votes = 0;
         $discussion->lock = false;
     }
     $app = $this->getApp();
     // Ensure that the title is valid
     if (!$discussion->title) {
         Foundry::info()->set(JText::_('APP_GROUP_DISCUSSIONS_INVALID_TITLE'), SOCIAL_MSG_ERROR);
         // Get the redirection url
         $url = FRoute::apps(array('layout' => 'canvas', 'customView' => 'create', 'uid' => $group->getAlias(), 'type' => SOCIAL_TYPE_GROUP, 'id' => $app->getAlias()), false);
         return $this->redirect($url);
     }
     // Lock the discussion
     $state = $discussion->store();
     if (!$state) {
         FD::info()->set(JText::_('APP_GROUP_DISCUSSIONS_DISCUSSION_CREATED_FAILED'));
         // Get the redirection url
         $url = FRoute::apps(array('layout' => 'canvas', 'customView' => 'form', 'uid' => $group->getAlias(), 'type' => SOCIAL_TYPE_GROUP, 'id' => $app->getAlias()), false);
         return $this->redirect($url);
     }
     // Process any files that needs to be created.
     $discussion->mapFiles();
     // Get the app
     $app = $this->getApp();
     // If it is a new discussion, we want to run some other stuffs here.
     if (!$id) {
         // @points: groups.discussion.create
         // Add points to the user that updated the group
         $points = FD::points();
         $points->assign('groups.discussion.create', 'com_easysocial', $my->id);
         // Create a new stream item for this discussion
         $stream = FD::stream();
         // Get the stream template
         $tpl = $stream->getTemplate();
         // Someone just joined the group
         $tpl->setActor($my->id, SOCIAL_TYPE_USER);
         // Set the context
         $tpl->setContext($discussion->id, 'discussions');
         // Set the cluster
         $tpl->setCluster($group->id, SOCIAL_TYPE_GROUP, $group->type);
         // Set the verb
         $tpl->setVerb('create');
         // Set the params to cache the group data
         $registry = FD::registry();
         $registry->set('group', $group);
         $registry->set('discussion', $discussion);
         $tpl->setParams($registry);
         $tpl->setAccess('core.view');
         // Add the stream
         $stream->add($tpl);
         // Set info message
         FD::info()->set(false, JText::_('APP_GROUP_DISCUSSIONS_DISCUSSION_CREATED_SUCCESS'), SOCIAL_MSG_SUCCESS);
         // Send notification to group members only if it is new discussion
         $options = array();
         $options['permalink'] = FRoute::apps(array('layout' => 'canvas', 'customView' => 'item', 'uid' => $group->getAlias(), 'type' => SOCIAL_TYPE_GROUP, 'id' => $app->getAlias(), 'discussionId' => $discussion->id, 'external' => true), false);
         $options['discussionId'] = $discussion->id;
         $options['discussionTitle'] = $discussion->title;
         $options['discussionContent'] = $discussion->getContent();
         $options['userId'] = $discussion->created_by;
         $group->notifyMembers('discussion.create', $options);
     }
     // Get the redirection url
     $url = FRoute::apps(array('layout' => 'canvas', 'customView' => 'item', 'uid' => $group->getAlias(), 'type' => SOCIAL_TYPE_GROUP, 'id' => $app->getAlias(), 'discussionId' => $discussion->id), false);
     // Perform a redirection
     $this->redirect($url);
 }
Beispiel #27
0
 public function buildPrivacyQuery($alias = 'a')
 {
     $db = EasyBlogHelper::db();
     $my = JFactory::getUser();
     $config = EasyBlogHelper::getConfig();
     $my = JFactory::getUser();
     $esFriends = Foundry::model('Friends');
     $friends = $esFriends->getFriends($my->id, array('idonly' => true));
     if ($friends) {
         array_push($friends, $my->id);
     }
     $alias = $alias . '.';
     // Insert query here.
     $queryWhere = ' AND (';
     $queryWhere .= ' ( ' . $alias . '`private`= 0 ) OR';
     $queryWhere .= ' ( (' . $alias . '`private` = 10) AND (' . $db->Quote($my->id) . ' > 0 ) ) OR';
     if (empty($friends)) {
         $queryWhere .= ' ( ( ' . $alias . '`private` = 30 ) AND ( 1 = 2 ) ) OR';
     } else {
         $queryWhere .= ' ( ( ' . $alias . '`private` = 30) AND ( ' . $alias . EasyBlogHelper::getHelper('SQL')->nameQuote('created_by') . ' IN (' . implode(',', $friends) . ') ) ) OR';
     }
     $queryWhere .= ' ( (' . $alias . '`private` = 40) AND ( ' . $alias . EasyBlogHelper::getHelper('SQL')->nameQuote('created_by') . '=' . $my->id . ') )';
     $queryWhere .= ' )';
     return $queryWhere;
 }
Beispiel #28
0
 public static function getList($params)
 {
     $app = JFactory::getApplication();
     $lang = JFactory::getLanguage();
     $user = JFactory::getUser();
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     // Source
     $source = $params->get('source', 'categories');
     $exclude = $params->get('exclude', array());
     $articles_k2 = $params->get('articles_k2', array());
     $categories_k2 = $params->get('categories_k2', array());
     // General
     $readmore = $params->get('readmore', '');
     $ordering = $params->get('ordering', 'random');
     $item_counts = $params->get('item_counts', 5);
     $skip_counts = $params->get('skip_counts', 0);
     $limit_intro = $params->get('limit_intro', 200);
     // Display
     $show_date = $params->get('show_date', 1);
     $show_hits = $params->get('show_hits', 1);
     $show_tags = $params->get('show_tags', 1);
     $show_image = $params->get('show_image', 1);
     $show_intro = $params->get('show_intro', 1);
     $show_title = $params->get('show_title', 1);
     $show_author = $params->get('show_author', 1);
     $show_avatar = $params->get('show_avatar', 1);
     $show_rating = $params->get('show_rating', 1);
     $show_profile = $params->get('show_profile', 1);
     $show_category = $params->get('show_category', 1);
     $show_comments = $params->get('show_comments', 1);
     // Date
     $date_type = $params->get('date_type', 'created');
     $date_format = $params->get('date_format', 'd F Y');
     // Image
     $image_width = $params->get('image_width', 200);
     $image_height = $params->get('image_height', 100);
     $image_quality = $params->get('image_quality', 100);
     $image_link = $params->get('image_link', 'none');
     $image_title = $params->get('image_title', 1);
     $image_resize = $params->get('image_resize', 1);
     $image_source = $params->get('image_source', 'auto');
     // 3rd-party
     $avatar_width = $params->get('avatar_width', 60);
     $avatar_height = $params->get('avatar_height', 60);
     $avatar_system = $params->get('avatar_system', 'kunena');
     $profile_system = $params->get('profile_system', 'kunena');
     $comments_system = $params->get('comments_system', 'komento');
     // User access
     $authorised = implode(',', $user->getAuthorisedViewLevels());
     // Clean HTML tags
     $clean_intro = $params->get('clean_intro', 1);
     $allowed_tags = str_replace(' ', '', $params->get('allowed_tags'));
     $allowed_tags = "<" . str_replace(',', '><', $allowed_tags) . ">";
     // Content filtering
     $tags_k2 = $params->get('tags_k2', array());
     $author = $params->get('author', array());
     $featured = $params->get('featured', 0);
     // Featured label/ribbon
     $featured_label = $params->get('featured_label', 0);
     $featured_label_text = $params->get('featured_label_text', 'Featured');
     $featured_label_color = $params->get('featured_label_color', '#e52626');
     // Link
     $title_link = $params->get('title_link', 1);
     $category_link = $params->get('category_link', 1);
     if (JFile::exists(JPATH_SITE . '/components/com_k2/k2.php')) {
         if ($source == 'categories' && $categories_k2) {
             if ($categories_k2[0] != '') {
                 $categories_k2 = count($categories_k2) == 1 ? ' = ' . $categories_k2[0] . '' : 'IN (' . implode(',', $categories_k2) . ')';
                 $query->where('a.catid ' . $categories_k2);
             }
             $exclude ? $query->where('a.id NOT IN (' . $exclude . ')') : '';
         } else {
             if ($source == 'articles' && $articles_k2) {
                 $query->where('a.id IN (' . implode(',', $articles_k2) . ')');
             } else {
                 echo JText::_('MOD_GIANTCONTENT_ERROR_SOURCE');
                 return;
             }
         }
     } else {
         echo JText::_('MOD_GIANTCONTENT_ERROR_TYPE_K2');
         return;
     }
     // Ordering
     switch ($ordering) {
         case 'random':
             $orderBy = 'RAND()';
             break;
         case 'id_asc':
             $orderBy = 'a.id ASC';
             break;
         case 'id_desc':
             $orderBy = 'a.id DESC';
             break;
         case 'title_asc':
             $orderBy = 'a.title ASC';
             break;
         case 'title_desc':
             $orderBy = 'a.title DESC';
             break;
         case 'popular_last':
             $orderBy = 'a.hits ASC';
             break;
         case 'popular_first':
             $orderBy = 'a.hits DESC';
             break;
         case 'created_oldest':
             $orderBy = 'date ASC';
             break;
         case 'created_newest':
             $orderBy = 'date DESC';
             break;
         case 'most_rated':
             $orderBy = 'rating_total DESC, r.rating_count DESC';
             break;
         case 'least_rated':
             $orderBy = 'rating_total ASC, r.rating_count ASC';
             break;
         case 'most_commented':
             $orderBy = 'comments_count DESC, comments_date DESC';
             break;
         case 'latest_commented':
             $orderBy = 'comments_date DESC, date DESC';
             break;
     }
     // Content
     $query->select('a.id, a.title, a.alias, a.introtext, a.fulltext, a.hits');
     $query->from('#__k2_items AS a');
     // Category
     $query->select('a.catid AS category_id, c.name AS category_name, c.alias AS category_alias');
     $query->join('LEFT', '#__k2_categories AS c ON c.id = a.catid');
     // Join user
     $query->select('u.id AS user_id, u.email AS user_email, u.name AS user_name, a.created_by_alias AS user_alias');
     $query->join('LEFT', '#__users AS u ON u.id = a.created_by');
     // Join rating
     $query->select('ROUND(AVG(r.rating_sum / r.rating_count), 2) AS rating_average, r.rating_count');
     $query->join('LEFT', '#__k2_rating AS r ON r.itemID = a.id');
     // Select date
     if ($date_type !== 'created') {
         $query->select('CASE WHEN a.' . $date_type . ' = "0000-00-00 00:00:00" THEN a.created ELSE a.' . $date_type . ' END AS date');
     } else {
         $query->select('a.created AS date');
     }
     // Join avatar for author
     if ($show_avatar) {
         switch ($avatar_system) {
             // K2 avatar integration - http://getk2.org
             case 'k2':
                 if (JFile::exists(JPATH_SITE . '/components/com_k2/k2.php')) {
                     $query->select('ua.image AS avatar_user');
                     $query->join('LEFT', '#__k2_users AS ua ON ua.userID = u.id');
                     $avatar_path = 'media/k2/users/';
                 } else {
                     echo JText::_('MOD_GIANTCONTENT_ERROR_AVATAR_SYSTEM_K2');
                     return;
                 }
                 break;
                 // Kunena avatar integration - http://kunena.org
             // Kunena avatar integration - http://kunena.org
             case 'kunena':
                 if (JFile::exists(JPATH_SITE . '/components/com_kunena/kunena.php')) {
                     $query->select('ua.avatar AS avatar_user');
                     $query->join('LEFT', '#__kunena_users AS ua ON ua.userid = u.id');
                     $avatar_path = 'media/kunena/avatars/';
                 } else {
                     echo JText::_('MOD_GIANTCONTENT_ERROR_AVATAR_SYSTEM_KUNENA');
                     return;
                 }
                 break;
                 // JomSocial avatar integration - http://jomsocial.com
             // JomSocial avatar integration - http://jomsocial.com
             case 'jomsocial':
                 if (JFile::exists(JPATH_SITE . '/components/com_community/community.php')) {
                     $query->select("ua.avatar AS avatar_user");
                     $query->join('LEFT', '#__community_users AS ua ON ua.userid = u.id');
                     $avatar_path = '';
                 } else {
                     echo JText::_('MOD_GIANTCONTENT_ERROR_AVATAR_SYSTEM_JOMSOCIAL');
                     return;
                 }
                 break;
                 // Comprofiler avatar integration - http://joomlapolis.com
             // Comprofiler avatar integration - http://joomlapolis.com
             case 'comprofiler':
                 if (JFile::exists(JPATH_SITE . '/components/com_comprofiler/comprofiler.php')) {
                     $query->select('ua.avatar AS avatar_user');
                     $query->join('LEFT', '#__comprofiler AS ua ON ua.user_id = u.id');
                     $avatar_path = 'images/comprofiler/';
                 } else {
                     echo JText::_('MOD_GIANTCONTENT_ERROR_AVATAR_SYSTEM_COMPROFILER');
                     return;
                 }
                 break;
                 // EasyBlog avatar integration - http://stackideas.com
             // EasyBlog avatar integration - http://stackideas.com
             case 'easyblog':
                 if (JFile::exists(JPATH_SITE . '/components/com_easyblog/easyblog.php')) {
                     $query->select("ua.avatar AS avatar_user");
                     $query->join('LEFT', '#__easyblog_users AS ua ON ua.id = u.id');
                     $avatar_path = 'images/easyblog_avatar/';
                 } else {
                     echo JText::_('MOD_GIANTCONTENT_ERROR_AVATAR_SYSTEM_EASYBLOG');
                     return;
                 }
                 break;
                 // EasySocial avatar integration - http://stackideas.com
             // EasySocial avatar integration - http://stackideas.com
             case 'easysocial':
                 if (JFile::exists(JPATH_SITE . '/components/com_easysocial/easysocial.php')) {
                     $query->select("ua.large AS avatar_user");
                     $query->join('LEFT', '#__social_avatars AS ua ON ua.uid = u.id');
                     $avatar_path = 'media/com_easysocial/avatars/users/';
                 } else {
                     echo JText::_('MOD_GIANTCONTENT_ERROR_AVATAR_SYSTEM_EASYSOCIAL');
                     return;
                 }
                 break;
                 // EasyDiscuss avatar integration - http://stackideas.com
             // EasyDiscuss avatar integration - http://stackideas.com
             case 'easydiscuss':
                 if (JFile::exists(JPATH_SITE . '/components/com_easydiscuss/easydiscuss.php')) {
                     $query->select("ua.avatar AS avatar_user");
                     $query->join('LEFT', '#__discuss_users AS ua ON ua.id = u.id');
                     $avatar_path = 'images/discuss_avatar/';
                 } else {
                     echo JText::_('MOD_GIANTCONTENT_ERROR_AVATAR_SYSTEM_EASYDISCUSS');
                     return;
                 }
                 break;
         }
     }
     // Join comments for content
     if ($show_comments || $ordering == 'most_commented' || $ordering == 'latest_commented') {
         switch ($comments_system) {
             // Default comment system
             case 'default':
                 $query->select('COUNT(cm.id) AS comments_count, MAX(cm.commentDate) AS comments_date');
                 $query->join('LEFT', '#__k2_comments AS cm ON cm.itemID = a.id AND cm.published = 1');
                 $comments_link = '#itemCommentsAnchor';
                 break;
                 // Komento comment integration - http://stackideas.com
             // Komento comment integration - http://stackideas.com
             case 'komento':
                 if (JFile::exists(JPATH_SITE . '/components/com_komento/komento.php')) {
                     $query->select('COUNT(cm.id) AS comments_count, MAX(cm.created) AS comments_date');
                     $query->join('LEFT', '#__komento_comments AS cm ON cm.cid = a.id AND cm.component = "com_k2" AND cm.published = 1');
                     $comments_link = '#section-kmt';
                 } else {
                     echo JText::_('MOD_GIANTCONTENT_ERROR_COMMENTS_SYSTEM_KOMENTO');
                     return;
                 }
                 break;
                 // CComment comment integration - http://compojoom.com
             // CComment comment integration - http://compojoom.com
             case 'ccomment':
                 if (JFile::exists(JPATH_SITE . '/components/com_comment/comment.php')) {
                     $query->select('COUNT(cm.id) AS comments_count, MAX(cm.date) AS comments_date');
                     $query->join('LEFT', '#__comment AS cm ON cm.contentid = a.id AND cm.component = "com_k2" AND cm.published = 1');
                     $comments_link = '#!/ccomment';
                 } else {
                     echo JText::_('MOD_GIANTCONTENT_ERROR_COMMENTS_SYSTEM_CCOMMENT');
                     return;
                 }
                 break;
                 // JComments comment integration - http://joomlatune.com
             // JComments comment integration - http://joomlatune.com
             case 'jcomments':
                 if (JFile::exists(JPATH_SITE . '/components/com_jcomments/jcomments.php')) {
                     $query->select('COUNT(cm.id) AS comments_count, MAX(cm.date) AS comments_date');
                     $query->join('LEFT', '#__jcomments AS cm ON cm.object_id = a.id AND cm.object_group = "com_k2" AND cm.published = 1');
                     $comments_link = '#comments';
                 } else {
                     echo JText::_('MOD_GIANTCONTENT_ERROR_COMMENTS_SYSTEM_JCOMMENTS');
                     return;
                 }
                 break;
                 // JA Comment comment integration - http://joomlart.com
             // JA Comment comment integration - http://joomlart.com
             case 'jacomment':
                 if (JFile::exists(JPATH_SITE . '/components/com_jacomment/jacomment.php')) {
                     $query->select('COUNT(cm.id) AS comments_count, MAX(cm.date) AS comments_date');
                     $query->join('LEFT', '#__jacomment_items AS cm ON cm.contentid = a.id AND cm.option = "com_k2" AND cm.published = 1');
                     $comments_link = '#jac-wrapper';
                 } else {
                     echo JText::_('MOD_GIANTCONTENT_ERROR_COMMENTS_SYSTEM_JACOMMENT');
                     return;
                 }
                 break;
         }
     }
     // Filter tags
     if ($tags_k2) {
         $query->join('INNER', '#__k2_tags_xref AS t ON t.itemID = a.id');
         $query->where('t.tagID IN (' . implode(',', $tags_k2) . ')');
     }
     // Filter author
     if ($author) {
         $query->where('a.created_by IN (' . implode(',', $author) . ')');
     }
     // Filter featured
     if ($featured) {
         $query->where('a.featured = 1');
     }
     // Access or published
     $query->where('a.trash = 0 AND c.trash = 0 AND a.published = 1 AND c.published = 1 AND a.access IN (' . $authorised . ') AND c.access IN (' . $authorised . ') AND a.publish_up <= "' . JFactory::getDate() . '"');
     $query->group('a.id');
     $query->order($orderBy);
     $db->setQuery($query, $skip_counts, $item_counts);
     $items = $db->loadObjectList();
     $lists = array();
     foreach ($items as $i => &$item) {
         $lists[$i] = new stdClass();
         $lists[$i]->id = $item->id;
         $lists[$i]->date = '';
         $lists[$i]->hits = '';
         $lists[$i]->link = '';
         $lists[$i]->tags = '';
         $lists[$i]->intro = '';
         $lists[$i]->image = '';
         $lists[$i]->title = '';
         $lists[$i]->author = '';
         $lists[$i]->avatar = '';
         $lists[$i]->rating = '';
         $lists[$i]->featured = '';
         $lists[$i]->category = '';
         $lists[$i]->comments = '';
         $lists[$i]->readmore = '';
         $lists[$i]->fulltext = $item->fulltext;
         $lists[$i]->introtext = $item->introtext;
         $lists[$i]->category_id = $item->category_id;
         $lists[$i]->category_alias = $item->category_alias;
         // Content link
         $lists[$i]->link = JRoute::_(K2HelperRoute::getItemRoute($item->id . ':' . $item->alias, $item->category_id));
         // Readmore link
         $lists[$i]->readmore = $readmore ? '<a href="' . $lists[$i]->link . '"><span>' . $readmore . '</span></a>' : '';
         // Show content date
         $lists[$i]->date = $show_date ? JHtml::_('date', $item->date, $date_format) : '';
         // Show content hits
         $lists[$i]->hits = $show_hits ? '<span>' . $item->hits . '</span>' : '';
         // Show content image
         if ($show_image) {
             $img = array();
             $image = md5("Image" . $item->id);
             if (JFile::exists(JPATH_SITE . '/media/k2/items/src/' . $image . '.jpg')) {
                 $image = 'media/k2/items/src/' . $image . '.jpg';
             } else {
                 $image = '';
             }
             if ($image_source == 'auto') {
                 if (@$image) {
                     $img_source = 'media';
                 } else {
                     $img_source = 'content';
                 }
             } else {
                 $img_source = $image_source;
             }
             if ($img_source == 'media') {
                 if (@$image) {
                     $img['src'] = $image;
                     $img['alt'] = $item->title;
                     $img['ttl'] = $item->title;
                 }
             } else {
                 $pattern = '/<img[^>]+>/i';
                 preg_match($pattern, $item->introtext, $img_tag);
                 if (!count($img_tag)) {
                     preg_match($pattern, $item->fulltext, $img_tag);
                 }
                 if (count($img_tag)) {
                     preg_match_all('/(src|alt|title)\\s*=\\s*(["\'])(.*?)\\2/i', $img_tag[0], $img_elem);
                     $img_elem = array_combine($img_elem[1], $img_elem[3]);
                     if (@$img_elem['src']) {
                         $img['src'] = trim(@$img_elem['src']);
                         $img['alt'] = trim(@$img_elem['alt']);
                         $img['ttl'] = trim(@$img_elem['title']);
                         $item->introtext = preg_replace($pattern, '', $item->introtext, 1);
                     }
                 }
             }
             if (!@$img['src']) {
                 // Default image
                 $img['src'] = 'modules/mod_giantcontent/assets/images/default.png';
                 $img['alt'] = $item->title;
             }
             if ($img['src']) {
                 $img_src = $img_attr = $img_title = '';
                 // Use timthumb to resize image
                 if ($image_resize) {
                     $img_src = JURI::base(true) . '/modules/mod_giantcontent/assets/libraries/includes/timthumb.php?src=';
                     $img_attr = '&amp;w=' . $image_width . '&amp;h=' . $image_height . '&amp;q=' . $image_quality;
                 }
                 $img_src = $img_src && strncasecmp($img['src'], "http", 4) !== 0 ? $img_src . JURI::base(true) . '/' : $img_src;
                 $img['ttl'] = $image_title ? $item->title : @$img['ttl'];
                 $img_title = $img['ttl'] ? 'title="' . $img['ttl'] . '"' : '';
                 $lists[$i]->image = '<img src="' . @$img_src . @$img['src'] . @$img_attr . '" alt="' . @$img['alt'] . '" ' . @$img_title . ' />';
                 switch ($image_link) {
                     case 'none':
                         $lists[$i]->image = $lists[$i]->image;
                         break;
                     case 'content':
                         $lists[$i]->image = '<a href="' . $lists[$i]->link . '">' . $lists[$i]->image . '</a>';
                         break;
                     case 'shadowbox':
                         $lists[$i]->image = '<a href="' . @$img['src'] . '" rel="shadowbox" ' . @$img_title . '>' . $lists[$i]->image . '</a>';
                         break;
                 }
                 $lists[$i]->image_src = @$img['src'];
                 $lists[$i]->image_alt = @$img['alt'];
                 $lists[$i]->image_title = @$img['ttl'];
             }
         }
         // Show author profile
         if ($show_profile) {
             switch ($profile_system) {
                 // K2 profile integration - http://getk2.org
                 case 'k2':
                     if (JFile::exists(JPATH_SITE . '/components/com_k2/k2.php')) {
                         require_once JPATH_SITE . '/components/com_k2/helpers/route.php';
                         $profile_link = JRoute::_(K2HelperRoute::getUserRoute($item->user_id));
                     } else {
                         echo JText::_('MOD_GIANTCONTENT_ERROR_PROFILE_SYSTEM_K2');
                         return;
                     }
                     break;
                     // Kunena profile integration - http://kunena.org
                 // Kunena profile integration - http://kunena.org
                 case 'kunena':
                     if (JFile::exists(JPATH_SITE . '/components/com_kunena/kunena.php')) {
                         $profile_link = KunenaRoute::_('index.php?option=com_kunena&view=profile&userid=' . $item->user_id);
                     } else {
                         echo JText::_('MOD_GIANTCONTENT_ERROR_PROFILE_SYSTEM_KUNENA');
                         return;
                     }
                     break;
                     // JomSocial profile integration - http://jomsocial.com
                 // JomSocial profile integration - http://jomsocial.com
                 case 'jomsocial':
                     if (JFile::exists(JPATH_SITE . '/components/com_community/community.php')) {
                         require_once JPATH_SITE . '/components/com_community/libraries/core.php';
                         $profile_link = CRoute::_('index.php?option=com_community&view=profile&userid=' . $item->user_id);
                     } else {
                         echo JText::_('MOD_GIANTCONTENT_ERROR_PROFILE_SYSTEM_JOMSOCIAL');
                         return;
                     }
                     break;
                     // Comprofiler profile integration - http://joomlapolis.com
                 // Comprofiler profile integration - http://joomlapolis.com
                 case 'comprofiler':
                     if (JFile::exists(JPATH_SITE . '/components/com_comprofiler/comprofiler.php')) {
                         $profile_link = JRoute::_('index.php?option=com_comprofiler&task=userProfile&user='******'MOD_GIANTCONTENT_ERROR_PROFILE_SYSTEM_COMPROFILER');
                         return;
                     }
                     break;
                     // EasyBlog profile integration - http://stackideas.com
                 // EasyBlog profile integration - http://stackideas.com
                 case 'easyblog':
                     if (JFile::exists(JPATH_SITE . '/components/com_easyblog/easyblog.php')) {
                         require_once JPATH_SITE . '/components/com_easyblog/helpers/router.php';
                         $profile_link = EasyBlogRouter::_('index.php?option=com_easyblog&view=blogger&layout=listings&id=' . $item->user_id);
                     } else {
                         echo JText::_('MOD_GIANTCONTENT_ERROR_PROFILE_SYSTEM_EASYBLOG');
                         return;
                     }
                     break;
                     // EasySocial profile integration - http://stackideas.com
                 // EasySocial profile integration - http://stackideas.com
                 case 'easysocial':
                     if (JFile::exists(JPATH_SITE . '/components/com_easysocial/easysocial.php')) {
                         $profile_link = Foundry::user($item->user_id)->getPermalink();
                     } else {
                         echo JText::_('MOD_GIANTCONTENT_ERROR_PROFILE_SYSTEM_EASYSOCIAL');
                         return;
                     }
                     break;
                     // EasyDiscuss profile integration - http://stackideas.com
                 // EasyDiscuss profile integration - http://stackideas.com
                 case 'easydiscuss':
                     if (JFile::exists(JPATH_SITE . '/components/com_easydiscuss/easydiscuss.php')) {
                         require_once JPATH_SITE . '/components/com_easydiscuss/helpers/router.php';
                         $profile_link = DiscussHelper::getTable('Profile')->load($item->user_id)->getLink();
                     } else {
                         echo JText::_('MOD_GIANTCONTENT_ERROR_PROFILE_SYSTEM_EASYDISCUSS');
                         return;
                     }
                     break;
             }
         }
         // Show content intro
         if ($show_intro) {
             // Clean HTML tags
             if ($clean_intro) {
                 $item->introtext = strip_tags($item->introtext, $allowed_tags);
                 $item->introtext = str_replace('&nbsp;', ' ', $item->introtext);
                 $item->introtext = preg_replace('/\\s{2,}/u', ' ', trim($item->introtext));
             }
             $lists[$i]->intro = $limit_intro ? self::truncateText($item->introtext, $limit_intro) : $item->introtext;
         }
         // Show content title
         if ($show_title) {
             $lists[$i]->title_name = $item->title;
             $lists[$i]->title = $title_link ? '<a href="' . $lists[$i]->link . '">' . $lists[$i]->title_name . '</a>' : $lists[$i]->title_name;
         }
         // Show content category
         if ($show_category) {
             $lists[$i]->category_name = $item->category_name;
             $lists[$i]->category_link = JRoute::_(K2HelperRoute::getCategoryRoute($item->category_id . ':' . $item->category_alias));
             $lists[$i]->category = $category_link ? '<a href="' . $lists[$i]->category_link . '">' . $lists[$i]->category_name . '</a>' : $lists[$i]->category_name;
         }
         // Show content comments
         if ($show_comments) {
             $lists[$i]->comments_count = $item->comments_count;
             $lists[$i]->comments_link = $lists[$i]->link . $comments_link;
             $lists[$i]->comments = '<a href="' . $lists[$i]->comments_link . '">' . $item->comments_count . '</a>';
         }
         // Show content author
         if ($show_author) {
             $lists[$i]->author_name = $item->user_alias ? $item->user_alias : $item->user_name;
             $lists[$i]->author = $show_profile ? '<a href="' . $profile_link . '">' . $lists[$i]->author_name . '</a>' : $lists[$i]->author_name;
         }
         // Show profile avatar
         if ($show_avatar) {
             $avatar_src = 'modules/mod_giantcontent/assets/libraries/includes/timthumb.php?src=' . JURI::base(true) . '/';
             $avatar_attr = '&amp;w=' . $avatar_width . '&amp;h=' . $avatar_height;
             $avatar_default = '<img src="' . $avatar_src . '/modules/mod_giantcontent/assets/images/avatar.png' . $avatar_attr . '"  alt="' . $item->user_name . '" />';
             $lists[$i]->avatar_user = $item->avatar_user;
             if ($avatar_system == 'easysocial') {
                 $avatar_img = $avatar_path . $item->user_id . '/' . $item->avatar_user;
             } else {
                 $avatar_img = $avatar_path . $item->avatar_user;
             }
             if (JFile::exists($avatar_img)) {
                 $lists[$i]->avatar = '<img src="' . $avatar_src . $avatar_img . $avatar_attr . '" alt="' . $item->user_name . '" />';
                 $lists[$i]->avatar = $show_profile ? '<a href="' . $profile_link . '">' . $lists[$i]->avatar . '</a>' : $lists[$i]->avatar;
             } else {
                 $lists[$i]->avatar = $show_profile ? '<a href="' . $profile_link . '">' . $avatar_default . '</a>' : $avatar_default;
             }
         }
         // Show content rating
         if ($show_rating) {
             if ($item->rating_count > 0) {
                 $lists[$i]->rating_count = $item->rating_count;
                 $lists[$i]->rating_average = $item->rating_average;
             } else {
                 $lists[$i]->rating_count = 0;
                 $lists[$i]->rating_average = 0.0;
             }
             $rating_current = $item->rating_average * 20;
             $lists[$i]->rating = '<span class="gc-rating-list"><span style="width:' . $rating_current . '%;" class="gc-rating-current"></span></span>';
         }
         // Show content tags
         if ($show_tags) {
             $db = JFactory::getDbo();
             $query = $db->getQuery(true);
             $query->select('t.id, t.name AS title');
             $query->from('#__k2_tags AS t');
             $query->join('LEFT', '#__k2_tags_xref AS tm ON tm.tagID = t.id');
             $query->where('t.published = 1 AND tm.itemID = ' . $item->id);
             $db->setQuery($query);
             $tags = $db->loadObjectList();
             $list_tags = '';
             if ($tags) {
                 foreach ($tags as $tag) {
                     $link_tags = JRoute::_(K2HelperRoute::getTagRoute($tag->title));
                     $list_tags .= '<a class="gc-tag" href="' . $link_tags . '">' . $tag->title . '</a>';
                 }
             }
             $lists[$i]->tags = $list_tags;
         }
         // Show featured label
         if ($featured_label) {
             $db = JFactory::getDbo();
             $db->setQuery('SELECT * FROM #__k2_items WHERE id = ' . $item->id . ' AND featured = 1');
             $featured = $db->loadResult();
             if ($featured) {
                 $lists[$i]->featured = '<span class="gc-featured" style="background: ' . $featured_label_color . '">' . $featured_label_text . '</span>';
             }
         }
     }
     return $lists;
 }
Beispiel #29
0
 public function getPagination()
 {
     $htmlContent = '';
     if ($this->pagination) {
         $page = $this->pagination;
         $previousLink = '';
         $nextLink = '';
         //build the extra params into the url
         $params = $this->buildPaginationParams();
         if (!is_null($page['previous'])) {
             $previousLink = JRoute::_($params . '&limitstart=' . $page['previous']);
         }
         if (!is_null($page['next'])) {
             $nextLink = JRoute::_($params . '&limitstart=' . $page['next']);
         }
         $theme = Foundry::get('Themes');
         $theme->set('next', $nextLink);
         $theme->set('previous', $previousLink);
         $htmlContent = $theme->output('site/stream/pagination');
     }
     return $htmlContent;
 }
            } elseif ($visitor->thumb && $visitor->avatarapproved != '1') {
                $thumb = $juri . 'components/com_comprofiler/plugin/templates/default/images/avatar/pending_n.png';
            } else {
                $thumb = $juri . 'images/comprofiler/' . $visitor->thumb;
            }
            $profile_url = JRoute::_('index.php?option=com_comprofiler&task=userProfile&user='******'&Itemid=' . $app->input->get('Itemid', '', 'int'));
        } elseif ($profileman == 'js') {
            $visitor_naming = $visitor->{$js_naming};
            if (!$visitor->thumb) {
                $thumb = $juri . 'components/com_community/assets/user-Male-thumb.png';
            } else {
                $thumb = $juri_storage . $visitor->thumb;
            }
            $profile_url = JRoute::_('index.php?option=com_community&view=profile&userid=' . $visitor->visitor_userid . '&Itemid=' . $this->profileItemid);
        } elseif ($profileman == 'es') {
            $his = Foundry::user($visitor->visitor_userid);
            $thumb = $his->getAvatar(SOCIAL_AVATAR_MEDIUM);
            $visitor_naming = $his->getName();
            $profile_url = JRoute::_('index.php?option=com_easysocial&view=profile&id=' . $visitor->visitor_userid . ':' . $visitor->username . '&Itemid=' . $this->profileItemid);
        }
        echo '<div class="wvmp_visitor"  data-popbox="module://easysocial/profile/popbox" data-user-id="' . $visitor->visitor_userid . '">';
        if ($profileman != '0') {
            echo '<div class="wvmp_thumb">
			<a href="' . $profile_url . '" ><img src="' . $thumb . '" width="64" heigh="64" alt="thumb" /></a></div>';
        }
        echo '<div><a href="' . $profile_url . '" ><i class="vmv-icon-user"></i> ' . $visitor_naming . '</a></div>
		<div  title="' . JText::_('COM_VMVENDOR_PROFILEVISITS_LATESTVISIT') . '"><i class="vmv-icon-calendar"></i> ' . JHtml::date($visitor->date, $date_format, $tz = false) . '</div>
		</div>';
    }
    echo '</div>';
} else {