/** * 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; }
/** * Triggered when user logs into the site * * @since 1.0 * @access public * @return */ public function onUserLogin($user, $options = array()) { // Include main file. jimport('joomla.filesystem.file'); $path = JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/foundry.php'; if (!JFile::exists($path)) { return; } // Include the foundry engine require_once $path; // Load the language string. Foundry::language()->load('plg_user_easysocial', JPATH_ADMINISTRATOR); // Check if Foundry exists if (!Foundry::exists()) { Foundry::language()->loadSite(); echo JText::_('COM_EASYSOCIAL_FOUNDRY_DEPENDENCY_MISSING'); return; } if (isset($user['status']) && $user['status'] && $user['type'] == 'Joomla') { //successful logged in. $my = JUser::getInstance(); if ($id = intval(JUserHelper::getUserId($user['username']))) { $my->load($id); } $config = Foundry::config(); $app = Foundry::table('App'); $app->load(array('element' => 'users', 'group' => SOCIAL_TYPE_USER)); $appParams = $app->getParams(); $addStream = false; if ($appParams->get('stream_login', true)) { $addStream = true; } // do not add stream when user login from backend. $mainframe = JFactory::getApplication(); // If this is the admin area, skip this. if ($mainframe->isAdmin()) { return; } // Only proceed if we need to add the stream if ($addStream) { $model = Foundry::model('Users'); // Get the last login time the user previously logged in. $lastLogin = $model->getLastLogin($my->id); if ($lastLogin) { $lastLogin->count = Foundry::isJoomla25() ? $lastLogin->count + 1 : $lastLogin->count; if ($lastLogin->count >= 2 && $lastLogin->limit < $lastLogin->time) { $addStream = false; } } } if ($addStream) { $myUser = Foundry::user($my->id); $stream = Foundry::stream(); $template = $stream->getTemplate(); $template->setActor($my->id, SOCIAL_TYPE_USER); $template->setContext($my->id, SOCIAL_TYPE_USERS); $template->setVerb('login'); // Set the stream to be public $template->setAccess('core.view'); // Add the new template. $stream->add($template); } } }
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; }
function display($tpl = null) { $juri = JURI::Base(); $jinput = JFactory::getApplication()->input; $this->id = $jinput->get('contentid', null, 'int'); $this->latitude = $jinput->get('latitude'); $this->longitude = $jinput->get('longitude'); $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(); $naming = $config->get('users.displayName'); // username or realname if ($naming == 'realname') { $naming = 'name'; } $cparams = JComponentHelper::getParams('com_geommunity3es'); $profile_itemid = $cparams->get('profile_itemid'); $group_itemid = $cparams->get('group_itemid'); $this->infowindow = $this->get('Groupinfowindow'); $infowindow = $this->infowindow; $this->username = $infowindow->username; if ($naming == 'realname') { $this->naming = $infowindow->name; } else { $this->naming = $this->username; } $this->small = $infowindow->small; $this->medium = $infowindow->medium; $this->title = $infowindow->title; $this->alias = $infowindow->titlealias; $this->creator_uid = $infowindow->creator_uid; $this->cattitle = $infowindow->cattitle; $this->catid = $infowindow->category_id; $this->cover = $infowindow->cover; $this->x = $infowindow->x; $this->y = $infowindow->y; $this->memberscount = $infowindow->memberscount; if (strlen($infowindow->description) > 50) { $this->description = substr($infowindow->description, 0, 47) . '...'; } else { $this->description = $infowindow->description; } $this->hits = $infowindow->hits; $this->type = $infowindow->type; $this->profile_url = JRoute::_('index.php?option=com_easysocial&view=profile&id=' . $this->creator_uid . ':' . $this->username . '&Itemid=' . $profile_itemid); $this->group_url = JRoute::_('index.php?option=com_easysocial&view=groups&id=' . $this->id . ':' . $this->alias . '&layout=item&Itemid=' . $group_itemid); if (!$this->small) { $this->avatar = $juri . 'media/com_easysocial/defaults/avatars/group/small.png'; } else { $this->avatar = $juri . 'media/com_easysocial/avatars/group/' . $this->id . '/' . $this->medium; } if (!$this->cover) { $this->cover = $juri . 'media/com_easysocial/defaults/covers/user/default.jpg'; } else { $this->cover = $juri . $this->cover; } parent::display($tpl); }
public function onRegisterOAuthBeforeSave(&$post, &$client) { if (empty($post['username'])) { $post['username'] = $post[Foundry::config()->get('oauth.facebook.username', 'email')]; } }
* @package EasySocial * @copyright Copyright (C) 2010 - 2013 Stack Ideas Sdn Bhd. All rights reserved. * @license GNU/GPL, see LICENSE.php * EasySocial 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. * See COPYRIGHT.php for copyright notices and details. */ defined('_JEXEC') or die('Unauthorized Access'); ?> <div class="es-location <?php echo $classname; ?> " data-language="<?php echo Foundry::config()->get('general.location.language'); ?> "> <div class="es-location-textbox"> <input type="text" value="<?php echo $location->address; ?> " placeholder="<?php echo JText::_('COM_EASYSOCIAL_WHERE_ARE_YOU_NOW'); ?> " autocomplete="off" data-location-textField disabled /> </div> <div class="es-location-buttons">
public function onPrepareStoryPanel($story) { $config = Foundry::config(); if (!$config->get('photos.enabled')) { return; } // Get current logged in user. $my = Foundry::user(); // Get user access $access = Foundry::access($my->id, SOCIAL_TYPE_USER); $plugin = $story->createPlugin("photos", "panel"); $theme = Foundry::get('Themes'); // check max photos upload here. if ($access->exceeded('photos.uploader.max', $my->getTotalPhotos())) { $theme->set('exceeded', JText::sprintf('COM_EASYSOCIAL_PHOTOS_EXCEEDED_MAX_UPLOAD', $access->get('photos.uploader.max'))); } // check max photos upload daily here. if ($access->exceeded('photos.uploader.maxdaily', $my->getTotalPhotos(true))) { $theme->set('exceeded', JText::sprintf('COM_EASYSOCIAL_PHOTOS_EXCEEDED_DAILY_MAX_UPLOAD', $access->get('photos.uploader.maxdaily'))); } $plugin->button->html = $theme->output('themes:/apps/user/photos/story/panel.button'); $plugin->content->html = $theme->output('themes:/apps/user/photos/story/panel.content'); $script = Foundry::get('Script'); $script->set('maxFileSize', $access->get('photos.uploader.maxsize') . 'M'); $plugin->script = $script->output('apps:/user/photos/story'); return $plugin; }
function display($tpl = null) { $jinput = JFactory::getApplication()->input; $this->id = $jinput->get('contentid', null, 'int'); $this->latitude = $jinput->get('latitude'); $this->longitude = $jinput->get('longitude'); $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(); $naming = $config->get('users.displayName'); // username or realname if ($naming == 'realname') { $naming = 'name'; } $this->storage_photos = $config->get('storage.photos'); $this->amazon_bucket = $config->get('storage.amazon.bucket'); $this->amazon_ssl = $config->get('storage.amazon.ssl'); $this->amazon_region = $config->get('storage.amazon.region'); $cparams = JComponentHelper::getParams('com_geommunity3es'); $photo_itemid = $cparams->get('photo_itemid'); $this->infowindow = $this->get('Photoinfowindow'); $infowindow = $this->infowindow; $this->username = $infowindow->username; if ($naming == 'realname') { $this->naming = $infowindow->name; } else { $this->naming = $this->username; } $this->title = $infowindow->title; if (strlen($infowindow->caption) > 50) { $this->caption = substr($infowindow->caption, 0, 47) . '...'; } else { $this->caption = $infowindow->caption; } //$this->thumb = JURI::Base().$infowindow->thumb; $this->thumb = $infowindow->thumb; if ($this->storage_photos == 'joomla') { if (strpos($this->thumb, 'media/com_easysocial/photos') !== false) { $this->thumb = $juri . $this->thumb; } else { $this->thumb = $juri . 'media/com_easysocial/photos' . $this->thumb; } } elseif ($this->storage_photos == 'amazon') { // amazon s3 storage for user cover if ($this->amazon_ssl) { $thumb = 'https://'; } else { $thumb = 'http://'; } $thumb .= 's3-' . $this->amazon_region; $thumb .= '.amazonaws.com/' . $this->amazon_bucket . '/media/com_easysocial/photos'; $thumb .= $this->thumb; $this->thumb = $thumb; } $this->user_id = $infowindow->user_id; $this->album_id = $infowindow->album_id; $this->albumname = $infowindow->albumname; $this->album_url = JRoute::_('index.php?option=com_easysocial&view=albums&id=' . $this->album_id . ':' . JFilterOutput::stringURLSafe($this->albumname) . '&layout=item&uid=' . $this->user_id . ':' . $this->naming . '&type=user&Itemid=' . $photo_itemid); $this->photo_url = JRoute::_('index.php?option=com_easysocial&view=photos&layout=item&id=' . $this->id . ':' . JFilterOutput::stringURLSafe($this->title) . '&type=user&uid=' . $this->user_id . ':' . $this->naming . '&Itemid=' . $photo_itemid); parent::display($tpl); }
/** * Saves a configuration item * * @since 1.0 * @access public * @param string The key to save * @param mixed The data to save * @return */ public function updateConfig($key, $value) { $this->foundry(); $config = Foundry::config(); $config->set($key, $value); $jsonString = $config->toString(); $configTable = Foundry::table('Config'); if (!$configTable->load('site')) { $configTable->type = 'site'; } $configTable->set('value', $jsonString); $configTable->store(); }
$lang = JFactory::getLanguage(); $lang->load('com_geommunity3es', JPATH_SITE, '', false); $file = JPATH_ROOT . '/administrator/components/com_easysocial/includes/foundry.php'; jimport('joomla.filesystem.file'); if (!JFile::exists($file)) { return; } require_once $file; // Include main Easysocial engine $modules = Foundry::modules('mod_easysocial_toolbar'); $modules->loadComponentScripts(); if (!Foundry::exists()) { echo JText::_('COM_EASYSOCIAL_FOUNDRY_DEPENDENCY_MISSING'); return; } $config = Foundry::config(); $naming = $config->get('users.displayName'); // username or realname if ($naming == 'realname') { $naming = 'name'; } if (JFactory::getApplication()->input->get('option') != 'com_easysocial') { $doc->addStyleSheet($juri . 'components/com_easysocial/themes/wireframe/styles/base.min.css'); $doc->addStyleSheet($juri . 'components/com_easysocial/themes/wireframe/styles/style.min.css'); $doc->addStyleSheet($juri . 'components/com_easysocial/themes/wireframe/styles/more.min.css'); } // component params $cparams = JComponentHelper::getParams('com_geommunity3es'); $visitor_addressfield = $cparams->get('visitor_addressfield', '12'); $unitsystem = $cparams->get('unitsystem', 'METRIC'); $js_apikey = $cparams->get('js_apikey');
protected function getAlias($user) { $config = \Foundry::config(); // Default permalink to use. $name = $config->get('users.aliasName') === 'realname' ? $user->name : $user->username; $name = $user->user_id . ':' . $name; // Check if the permalink is set if ($user->permalink !== null and $user->permalink !== '') { $name = $user->permalink; } // If alias exists and permalink doesn't we use the alias if (!$user->permalink and ($user->alias !== null and $user->alias !== '')) { $name = $user->alias; } // Ensure that the name is a safe url. $name = \JFilterOutput::stringURLSafe($name); return $name; }
function display($tpl = null) { $juri = JURI::Base(); $jinput = JFactory::getApplication()->input; $this->id = $jinput->get('contentid', null, 'int'); $this->latitude = $jinput->get('latitude'); $this->longitude = $jinput->get('longitude'); $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(); $naming = $config->get('users.displayName'); // username or realname if ($naming == 'realname') { $naming = 'name'; } // $this->storage_avatars = $config->get( 'storage.avatars' ); $this->storage_photos = $config->get('storage.photos'); $this->amazon_bucket = $config->get('storage.amazon.bucket'); $this->amazon_ssl = $config->get('storage.amazon.ssl'); $this->amazon_region = $config->get('storage.amazon.region'); $cparams = JComponentHelper::getParams('com_geommunity3es'); $profile_itemid = $cparams->get('profile_itemid'); $event_itemid = $cparams->get('event_itemid'); $this->infowindow = $this->get('Eventinfowindow'); $infowindow = $this->infowindow; $this->username = $infowindow->username; if ($naming == 'name') { $this->naming = $infowindow->name; } else { $this->naming = $this->username; } $this->small = $infowindow->small; $this->medium = $infowindow->medium; $this->title = $infowindow->title; $this->alias = $infowindow->titlealias; $this->creator_uid = $infowindow->creator_uid; $this->cattitle = $infowindow->cattitle; $this->catid = $infowindow->category_id; $this->start = $infowindow->start; $this->end = $infowindow->end; $this->attendees = $infowindow->attendees; $this->cover = $infowindow->cover; $this->x = $infowindow->x; $this->y = $infowindow->y; if (strlen($infowindow->description) > 50) { $this->description = substr($infowindow->description, 0, 47) . '...'; } else { $this->description = $infowindow->description; } $this->hits = $infowindow->hits; $this->type = $infowindow->type; $this->profile_url = JRoute::_('index.php?option=com_easysocial&view=profile&id=' . $this->creator_uid . ':' . $this->username . '&Itemid=' . $profile_itemid); $this->event_url = JRoute::_('index.php?option=com_easysocial&view=events&id=' . $this->id . ':' . $this->alias . '&layout=item&Itemid=' . $event_itemid); $this->storage_photos; if (!$this->medium) { $this->avatar = $juri . 'media/com_easysocial/defaults/avatars/event/small.png'; } elseif ($this->storage_photos == 'joomla') { $this->avatar = $juri . 'media/com_easysocial/avatars/event/' . $this->id . '/' . $this->medium; } elseif ($this->storage_photos == 'amazon') { // amazon s3 storage for user cover if ($this->amazon_ssl) { $avatar = 'https://'; } else { $avatar = 'http://'; } $avatar .= 's3-' . $this->amazon_region; $avatar .= '.amazonaws.com/' . $this->amazon_bucket . '/media/com_easysocial/avatars/event/'; $avatar .= $this->id . '/' . $this->medium; $this->avatar = $avatar; } if (!$this->cover) { $this->cover = $juri . 'media/com_easysocial/defaults/covers/user/default.jpg'; } elseif ($this->storage_photos == 'joomla') { if (strpos($this->cover, 'media/com_easysocial/photos') !== false) { $this->cover = $juri . $this->cover; } else { $this->cover = $juri . 'media/com_easysocial/photos' . $this->cover; } } elseif ($this->storage_photos == 'amazon') { // amazon s3 storage for user cover if ($this->amazon_ssl) { $cover = 'https://'; } else { $cover = 'http://'; } $cover .= $this->amazon_bucket . '.s3-' . $this->amazon_region; $cover .= '.amazonaws.com/media/com_easysocial/photos'; $cover .= $this->cover; $this->cover = $cover; } parent::display($tpl); }
public static function getUserProfileLink($user_id, $source = '') { if ($source == 'easysocial') { if (JFile::exists(JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/foundry.php')) { require_once JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/foundry.php'; $suser = Foundry::user($user_id); $sconfig = Foundry::config(); $link = ''; $name = $sconfig->get('users.aliasName') == 'realname' ? $suser->name : $suser->username; $name = $user_id . ':' . $name; // Check if the permalink is set if ($suser->permalink && !empty($suser->permalink)) { $name = $suser->permalink; } // If alias exists and permalink doesn't we use the alias if ($suser->alias && !empty($suser->alias) && !$suser->permalink) { $name = $suser->alias; } // Ensure that the name is a safe url. $name = JFilterOutput::stringURLSafe($name); $options = array('id' => $name); $link = FRoute::profile($options); } } else { if ($source == 'joomsocial') { if (JFile::exists(JPATH_ROOT . '/components/com_community/libraries/core.php')) { include_once JPATH_ROOT . '/components/com_community/libraries/core.php'; $link = CRoute::_('index.php?option=com_community&view=profile&userid=' . $user_id); } } else { if ($source == 'cb') { global $_CB_framework, $mainframe; if (defined('JPATH_ADMINISTRATOR')) { if (!file_exists(JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php')) { echo 'CB not installed!'; return; } include_once JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php'; } else { if (!file_exists($mainframe->getCfg('absolute_path') . '/administrator/components/com_comprofiler/plugin.foundation.php')) { echo 'CB not installed!'; return; } include_once $mainframe->getCfg('absolute_path') . '/administrator/components/com_comprofiler/plugin.foundation.php'; } $cbUser =& CBuser::getInstance($user_id); if ($cbUser) { $xhtml = ''; $link = cbSef('index.php?option=com_comprofiler&task=userProfile&user=' . $user_id . getCBprofileItemid(), $xhtml); } } } } return $link; }
/** * Displays the guest view for the dashboard * * @since 1.0 * @access public * @param string * @return */ public function displayGuest() { $config = Foundry::config(); // stream filter $filter = 'everyone'; // Determine if the current request is for "tags" $hashtag = $this->input->get('tag', ''); $hashtagAlias = $hashtag; if (!empty($hashtag)) { $filter = 'hashtag'; } // Get the layout to use. $stream = FD::stream(); $stream->getPublicStream($config->get('stream.pagination.pagelimit', 10), 0, $hashtag); // Get any callback urls. $return = FD::getCallback(); // In guests view, there shouldn't be an app id $appId = $this->input->get('appId', '', 'default'); if ($appId) { return JError::raiseError(404, JText::_('COM_EASYSOCIAL_PAGE_IS_NOT_AVAILABLE')); } // If return value is empty, always redirect back to the dashboard if (!$return) { $return = FRoute::dashboard(array(), false); } $return = base64_encode($return); $facebook = FD::oauth('Facebook'); $this->set('filter', $filter); $this->set('facebook', $facebook); $this->set('hashtag', $hashtag); $this->set('hashtagAlias', $hashtagAlias); $this->set('stream', $stream); $this->set('return', $return); if ($config->get('registrations.enabled')) { $fieldsModel = FD::model('fields'); $config = FD::config(); $profileId = $config->get('registrations.mini.profile', 'default'); if ($profileId === 'default') { $profileId = FD::model('profiles')->getDefaultProfile()->id; } $options = array('visible' => SOCIAL_PROFILES_VIEW_MINI_REGISTRATION, 'profile_id' => $profileId); $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); } } echo parent::display('site/dashboard/default.guests'); }