예제 #1
0
 public function __construct()
 {
     // Define Joomla's app
     $this->app = JFactory::getApplication();
     $this->input = $this->app->input;
     // Load configuration object.
     $config = FD::config();
     $jConfig = FD::jconfig();
     // Define the current logged in user or guest
     if (is_null(self::$user)) {
         self::$user = FD::user();
     }
     // Define the current logged in user's access.
     if (is_null(self::$userAccess)) {
         self::$userAccess = FD::access();
     }
     if (is_null(self::$tmplMode)) {
         self::$tmplMode = $this->input->get('tmpl', '', 'default');
     }
     // Get the current access
     $this->my = self::$user;
     $this->access = self::$userAccess;
     // Define our own configuration
     $this->config = $config;
     // Define template's own configuration
     if (is_null(self::$templateConfig)) {
         self::$templateConfig = $this->getConfig();
     }
     $this->template = self::$templateConfig;
     // Define Joomla's configuration so the world can use it.
     $this->jConfig = $jConfig;
     // Determine if the current request has tmpl=xxx
     $this->tmpl = self::$tmplMode;
 }
예제 #2
0
 /**
  * Default method to display the registration page.
  *
  * @since	1.0
  * @access	public
  * @author	Mark Lee <*****@*****.**>
  */
 function item($tpl = null)
 {
     // Check for user profile completeness
     FD::checkCompleteProfile();
     $config = FD::config();
     if (!$config->get('badges.enabled')) {
         return $this->redirect(FRoute::dashboard(array(), false));
     }
     // Get id of badge
     $id = JRequest::getInt('id');
     $badge = FD::table('Badge');
     $badge->load($id);
     if (!$id || !$badge->id) {
         FD::info()->set(JText::_('COM_EASYSOCIAL_BADGES_INVALID_BADGE_ID_PROVIDED'), SOCIAL_MSG_ERROR);
         $this->redirect(FRoute::badges());
         $this->close();
     }
     // Load the badge language
     $badge->loadLanguage();
     // Set the page title
     FD::page()->title($badge->get('title'));
     // Set the page breadcrumb
     FD::page()->breadcrumb(JText::_('COM_EASYSOCIAL_PAGE_TITLE_BADGES'), FRoute::badges());
     FD::page()->breadcrumb($badge->get('title'));
     // Get the badges model
     $options = array('start' => 0, 'limit' => FD::themes()->getConfig()->get('achieverslimit', 50));
     $achievers = $badge->getAchievers($options);
     $totalAchievers = $badge->getTotalAchievers();
     $this->set('totalAchievers', $totalAchievers);
     $this->set('achievers', $achievers);
     $this->set('badge', $badge);
     parent::display('site/badges/default.item');
 }
예제 #3
0
 public function __construct($client, $callback = '')
 {
     // Get the path to the consumer file.
     $file = dirname(__FILE__) . '/clients/' . strtolower($client) . '/consumer.php';
     jimport('joomla.filesystem.file');
     // If file doesn't exist, just quit.
     if (!JFile::exists($file)) {
         return false;
     }
     if (empty($callback)) {
         $callback = rtrim(JURI::root(), '/') . JRoute::_('index.php?option=com_easysocial&controller=oauth&task=grant&client=' . $client, false);
     }
     require_once $file;
     // All adapters classes should have the same naming convention
     $consumerClass = 'SocialConsumer' . ucfirst($client);
     if (!class_exists($consumerClass)) {
         return false;
     }
     $config = FD::config();
     // All oauth clients should have a key and secret.
     $key = $config->get('oauth.' . strtolower($client) . '.app');
     $secret = $config->get('oauth.' . strtolower($client) . '.secret');
     // Let's try to create instance of consumer.
     $this->client = new $consumerClass($key, $secret, $callback);
 }
예제 #4
0
 /**
  * Dialog to confirm a report.
  *
  * @since	1.0
  * @access	public
  */
 public function confirmReport()
 {
     $ajax = FD::ajax();
     // Determine if the user is a guest
     $my = FD::user();
     $config = FD::config();
     if (!$my->id) {
         if (!$config->get('reports.guests', false)) {
             return;
         }
     } else {
         // Check if user is really allowed to submit any reports.
         $access = FD::access();
         if (!$access->allowed('reports.submit')) {
             $this->setMessage(JText::_('COM_EASYSOCIAL_REPORTS_NOT_ALLOWED_TO_SUBMIT_REPORTS'), SOCIAL_MSG_ERROR);
             return $ajax->reject($this->getMessage());
         }
     }
     $title = JRequest::getVar('title', JText::_('COM_EASYSOCIAL_REPORTS_DIALOG_TITLE'));
     $description = JRequest::getVar('description', '');
     $theme = FD::themes();
     $theme->set('title', $title);
     $theme->set('description', $description);
     $html = $theme->output('site/reports/dialog.form');
     return $ajax->resolve($html);
 }
예제 #5
0
 public function __construct()
 {
     $this->app = JFactory::getApplication();
     $this->input = $this->app->input;
     $this->config = FD::config();
     parent::__construct();
 }
예제 #6
0
 public function create_report()
 {
     $app = JFactory::getApplication();
     $msg = $app->input->get('message', '', 'STRING');
     $title = $app->input->get('user_title', '', 'STRING');
     $item_id = $app->input->get('itemId', 0, 'INT');
     $log_user = $this->plugin->get('user')->id;
     $data = array();
     $data['message'] = $msg;
     $data['uid'] = $item_id;
     $data['type'] = 'stream';
     $data['title'] = $title;
     $data['extension'] = 'com_easysocial';
     //build share url use for share post through app
     $sharing = FD::get('Sharing', array('url' => FRoute::stream(array('layout' => 'item', 'id' => $item_id, 'external' => true, 'xhtml' => true)), 'display' => 'dialog', 'text' => JText::_('COM_EASYSOCIAL_STREAM_SOCIAL'), 'css' => 'fd-small'));
     $url = $sharing->url;
     $data['url'] = $url;
     // Get the reports model
     $model = FD::model('Reports');
     // Determine if this user has the permissions to submit reports.
     $access = FD::access();
     // Determine if this user has exceeded the number of reports that they can submit
     $total = $model->getCount(array('created_by' => $log_user));
     if ($access->exceeded('reports.limit', $total)) {
         $final_result['message'] = "Limit exceeds";
         $final_result['status'] = true;
         return $final_result;
     }
     // Create the report
     $report = FD::table('Report');
     $report->bind($data);
     // Set the creator id.
     $report->created_by = $log_user;
     // Set the default state of the report to new
     $report->state = 0;
     // Try to store the report.
     $state = $report->store();
     // If there's an error, throw it
     if (!$state) {
         $final_result['message'] = "Can't save report";
         $final_result['status'] = true;
         return $final_result;
     }
     // @badge: reports.create
     // Add badge for the author when a report is created.
     $badge = FD::badges();
     $badge->log('com_easysocial', 'reports.create', $log_user, JText::_('COM_EASYSOCIAL_REPORTS_BADGE_CREATED_REPORT'));
     // @points: reports.create
     // Add points for the author when a report is created.
     $points = FD::points();
     $points->assign('reports.create', 'com_easysocial', $log_user);
     // Determine if we should send an email
     $config = FD::config();
     if ($config->get('reports.notifications.moderators')) {
         $report->notify();
     }
     $final_result['message'] = "Report logged successfully!";
     $final_result['status'] = true;
     return $final_result;
 }
예제 #7
0
 /**
  * Displays the field input for user when they register their account.
  *
  * @since	1.0
  * @access	public
  * @param	array	The post data
  * @param	SocialTableRegistration
  * @return	string	The html output.
  */
 public function onRegister(&$post)
 {
     $config = FD::config();
     $value = isset($post['group_type']) ? $post['group_type'] : $this->params->get('default');
     $this->set('value', $value);
     return $this->display();
 }
예제 #8
0
 public function onPrepareStoryPanel($story)
 {
     if ($story->clusterType != SOCIAL_TYPE_GROUP) {
         return;
     }
     $params = $this->getParams();
     // Determine if we should attach ourselves here.
     if (!$params->get('story_event', true)) {
         return;
     }
     if (!FD::config()->get('events.enabled')) {
         return;
     }
     // Create plugin object
     $plugin = $story->createPlugin('event', 'panel');
     // Get the theme class
     $theme = FD::themes();
     // Get the available event category
     $categories = FD::model('EventCategories')->getCreatableCategories(FD::user()->getProfile()->id);
     $theme->set('categories', $categories);
     $plugin->button->html = $theme->output('apps/user/events/story/panel.button');
     $plugin->content->html = $theme->output('apps/user/events/story/panel.content');
     $script = FD::get('Script');
     $plugin->script = $script->output('apps:/user/events/story');
     return $plugin;
 }
예제 #9
0
 /**
  * Responsible to generate the activity contents.
  *
  * @since	1.0
  * @access	public
  * @param	object	$params		A standard object with key / value binding.
  *
  * @return	none
  */
 public function onPrepareActivityLog(SocialStreamItem &$item, $includePrivacy = true)
 {
     if ($item->context != 'shares') {
         return;
     }
     // Get the context id.
     $id = $item->contextId;
     // Get the actor
     $actor = $item->actor;
     // Set the actor for the themes.
     $this->set('actor', $actor);
     // Load the profiles table.
     $share = FD::table('Share');
     $state = $share->load($id);
     if (!$state) {
         return false;
     }
     $source = explode('.', $share->element);
     $element = $source[0];
     $group = $source[1];
     $config = FD::config();
     $file = dirname(__FILE__) . '/helpers/' . $element . '.php';
     if (JFile::exists($file)) {
         require_once $file;
         // Get class name.
         $className = 'SocialSharesHelper' . ucfirst($element);
         // Instantiate the helper object.
         $helper = new $className($item, $share);
         $item->content = $helper->getContent();
         $item->title = $helper->getTitle();
     }
     $item->display = SOCIAL_STREAM_DISPLAY_MINI;
 }
예제 #10
0
 /**
  * Displays the registration request
  *
  * @since   1.3
  * @access  public
  * @param   string
  * @return
  */
 public function request()
 {
     $id = $this->input->getInt('id');
     $table = JTable::getInstance('Module');
     $table->load($id);
     FD::language()->load('mod_easysocial_registration_requester', JPATH_SITE);
     $params = FD::registry($table->params);
     $profileId = $params->get('profile_id');
     // If there's no profile id, then we automatically assign the default profile id
     if (empty($profileId)) {
         $profileModel = FD::model('profiles');
         $defaultProfile = $profileModel->getDefaultProfile();
         $profileId = $defaultProfile->id;
     }
     $fieldsModel = FD::model('fields');
     $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);
     }
     $theme = FD::themes();
     $theme->set('params', $params);
     $theme->set('config', FD::config());
     $theme->set('fields', $fields);
     $output = $theme->output('site/registration/dialog.request');
     return $this->ajax->resolve($output);
 }
예제 #11
0
 public function display()
 {
     // Get the configuration objects
     $config = FD::config();
     $jConfig = FD::config('joomla');
     // Get the stream library
     $stream = FD::stream();
     $stream->get();
     // Get the result in an array form
     $result = $stream->toArray();
     // Set the document properties
     $doc = JFactory::getDocument();
     $doc->link = FRoute::dashboard();
     FD::page()->title(JText::_('COM_EASYSOCIAL_STREAM_FEED_TITLE'));
     $doc->setDescription(JText::sprintf('COM_EASYSOCIAL_STREAM_FEED_DESC', $jConfig->getValue('sitename')));
     if ($result) {
         $useEmail = $jConfig->getValue('feed_email');
         foreach ($result as $row) {
             $item = new JFeedItem();
             $item->title = $row->title;
             $item->link = FRoute::stream(array('id' => $row->uid));
             $item->description = $row->content;
             $item->date = $row->created->toMySQL();
             $item->author = $row->actor->getName();
             if ($useEmail != 'none') {
                 $item->authorEmail = $jConfig->getValue('mailfrom');
                 if ($useEmail == 'author') {
                     $item->authorEmail = $row->actor->email;
                 }
             }
             $doc->addItem($item);
         }
     }
 }
예제 #12
0
 /**
  * Uploads the given file to a temporary location on the site.
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return	string	The path to the uploaded item.
  */
 public function upload($file, $hash, $userId)
 {
     // Check if file exists on the server
     if (!isset($file['tmp_name']) || empty($file)) {
         $this->setError(JText::_('COM_EASYSOCIAL_UPLOADER_FILE_NOT_FOUND'));
         return false;
     }
     // Lets figure out the storage path.
     $config = FD::config();
     // Test if the folder exists for this upload type.
     $path = JPATH_ROOT . '/' . FD::cleanPath($config->get('uploader.storage.container'));
     if (!FD::makeFolder($path)) {
         $this->setError(JText::sprintf('COM_EASYSOCIAL_UPLOADER_UNABLE_TO_CREATE_DESTINATION_FOLDER', $path));
         return false;
     }
     // Let's finalize the storage path.
     $storage = $path . '/' . $userId;
     if (!FD::makeFolder($storage)) {
         $this->setError(JText::sprintf('COM_EASYSOCIAL_UPLOADER_UNABLE_TO_CREATE_DESTINATION_FOLDER', $storage));
         return false;
     }
     // Once the script reaches here, we assume everything is good now.
     // Copy the files over.
     jimport('joomla.filesystem.file');
     $absolutePath = $storage . '/' . $hash;
     if (!JFile::copy($file['tmp_name'], $absolutePath)) {
         $this->setError(JText::sprintf('COM_EASYSOCIAL_UPLOADER_UNABLE_TO_COPY_TO_DESTINATION_FOLDER', $absolutePath));
         return false;
     }
     return $absolutePath;
 }
예제 #13
0
 public function hasActivityLog()
 {
     $config = FD::config();
     if (!$config->get('followers.enabled')) {
         return false;
     }
     return true;
 }
예제 #14
0
 /**
  * Determines if this feature is enabled
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function isEnabled()
 {
     $config = FD::config();
     if ($config->get('followers.enabled')) {
         return true;
     }
     return false;
 }
예제 #15
0
 public function __construct()
 {
     // key is optional for this case
     $key = FD::config()->get('location.maps.api');
     if (!empty($key)) {
         $this->setQuery('key', $key);
     }
 }
예제 #16
0
 /**
  * Display groups as a widget
  *
  * @since	1.2
  * @access	public
  * @param	Socialuser
  * @return
  */
 public function sidebarBottom($user)
 {
     $config = FD::config();
     $params = $this->getParams();
     if ($params->get('widget_profile', true) && $config->get('groups.enabled')) {
         echo $this->getGroups($user, $params);
     }
 }
예제 #17
0
 public function __construct()
 {
     $key = FD::config()->get('location.places.api');
     if (empty($key)) {
         return $this->setError(JText::_('COM_EASYSOCIAL_LOCATION_PROVIDERS_PLACES_MISSING_APIKEY'));
     }
     $this->setQuery('key', $key);
 }
예제 #18
0
 public function getItems($options = array())
 {
     $db = FD::db();
     $sql = $db->sql();
     $sql->select('#__social_clusters_nodes', 'a');
     $sql->column('a.*');
     $sql->leftjoin('#__users', 'b');
     $sql->on('a.uid', 'b.id');
     if (FD::config()->get('users.blocking.enabled') && !JFactory::getUser()->guest) {
         $sql->leftjoin('#__social_block_users', 'bus');
         $sql->on('b.id', 'bus.user_id');
         $sql->on('bus.target_id', JFactory::getUser()->id);
         $sql->isnull('bus.id');
     }
     $sql->where('b.block', 0);
     if (!empty($options['groupid'])) {
         $sql->where('cluster_id', $options['groupid']);
     }
     if (isset($options['state'])) {
         $sql->where('state', $state);
     }
     if (isset($options['admin'])) {
         $sql->where('admin', $options['admin']);
     }
     $ordering = $this->getState('ordering');
     if (!empty($ordering)) {
         $direction = $this->getState('direction');
         if ($ordering == 'username') {
             $sql->order('b.username', $direction);
         } elseif ($ordering == 'name') {
             $sql->order('b.name', $direction);
         } else {
             $sql->order($ordering, $direction);
         }
     }
     $limit = $this->getState('limit');
     if ($limit > 0) {
         $this->setState('limit', $limit);
         // Get the limitstart.
         $limitstart = $this->getUserStateFromRequest('limitstart', 0);
         $limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0;
         $this->setState('limitstart', $limitstart);
         // Set the total number of items.
         $this->setTotal($sql->getTotalSql());
         // Get the list of users
         $result = parent::getData($sql->getSql());
     } else {
         $db->setQuery($sql);
         $result = $db->loadObjectList();
     }
     $members = array();
     foreach ($result as $row) {
         $member = FD::table('GroupMember');
         $member->bind($row);
         $members[] = $member;
     }
     return $members;
 }
예제 #19
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');
 }
예제 #20
0
 /**
  * Determines if the two factor authentication should be enabled
  *
  * @since	1.3
  * @access	public
  * @param	string
  * @return
  */
 public static function isEnabled()
 {
     $config = FD::config();
     $enabled = JPluginHelper::isEnabled('twofactorauth', 'totp');
     if (!$enabled || !$config->get('general.site.twofactor')) {
         return false;
     }
     return true;
 }
예제 #21
0
 public function __construct()
 {
     $this->doc = JFactory::getDocument();
     $this->config = FD::config();
     $this->app = JFactory::getApplication();
     $this->input = FD::request();
     $this->my = FD::user();
     $this->access = FD::access();
 }
예제 #22
0
 public function __construct($uid, $type)
 {
     $config = FD::config();
     $this->uid = $uid;
     $this->type = $type;
     require_once dirname(__FILE__) . '/hooks/' . $this->type . '.php';
     $class = 'SocialExplorerHook' . ucfirst($this->type);
     $this->adapter = new $class($this->uid, $this->type);
 }
예제 #23
0
 /**
  * Determines if exif is available on the system.
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return	bool
  */
 public function isAvailable()
 {
     $config = FD::config();
     if (!$config->get('photos.import.exif')) {
         return false;
     }
     $state = function_exists('exif_read_data');
     return $state;
 }
예제 #24
0
 public function loadProvider($provider = null)
 {
     // If no provider is given, then we load the default one from the settings
     if (empty($provider)) {
         $provider = FD::config()->get('location.provider', 'fallback');
     }
     $this->provider = $this->getProvider($provider);
     return $this->provider;
 }
예제 #25
0
 /**
  * Logs a user action.
  *
  * Example:
  * <code>
  * <?php
  * $badges 	= FD::badges();
  * $my 		= FD::user();
  *
  * $badges->log( 'com_easyblog' , 'blog.create' , $my->id , 'Created a new blog post Hello World');
  *
  * ?>
  * </code>
  *
  * @since	1.0
  * @access	public
  * @param	string		The unique extension name.
  * @param	string		The unique command string.
  */
 public function log($extension, $command, $userId, $message)
 {
     // If user id is not provided we shouldn't log anything
     if (!$userId) {
         return false;
     }
     // Check if badges is enabled
     $config = FD::config();
     if (!$config->get('badges.enabled')) {
         return;
     }
     $badge = FD::table('Badge');
     // Try to load the badge rule for this extension
     $state = $badge->load(array('extension' => $extension, 'command' => $command));
     // If the extension / command does not exist, quit this.
     if (!$state) {
         return false;
     }
     // Badge needs to be published.
     if (!$badge->state) {
         return false;
     }
     // Load badges model
     $model = FD::model('Badges');
     // Check if the user reached the specified frequency already or not.
     $achieving = $model->hasReachedFrequency($badge->id, $userId);
     $achieved = $model->hasAchieved($badge->id, $userId);
     // If the frequency of the badge is only 1, the achieving will not return anything.
     if ($badge->frequency == 1 && !$achieved) {
         $achieving = true;
     }
     $log = FD::table('BadgeHistory');
     $log->badge_id = $badge->id;
     $log->user_id = $userId;
     $log->achieved = $achieving && !$achieved;
     // Try to store the history action.
     $state = $log->store();
     // Only add a badge for this user when they have never achieved it before.
     if ($achieving && !$achieved) {
         // Create the new badge maps
         $user = FD::user($userId);
         $state = $this->create($badge, $user);
         // Only announce to the world when the badge is really achieved.
         if ($state) {
             // @notifications: Send a notification to the user when they achieved a badge.
             $this->sendNotification($badge, $user->id);
             // @stream: Log stream here that the user achieved a new badge.
             $this->addStream($badge, $user->id);
             // Add points for the user when they achieve a badge.
             $points = FD::points();
             $points->assign('badges.achieve', 'com_easysocial', $user->id);
         }
     }
     if (!$state) {
         return false;
     }
 }
예제 #26
0
 public function main()
 {
     $db = FD::db();
     $sql = $db->sql();
     $config = FD::config();
     $relative = rtrim($config->get('photos.storage.container'), '/') . '/';
     // lets get the paths that need to be updated.
     $query = "select `value` from `#__social_photos_meta`";
     $query .= " where `group` = 'path'";
     $query .= " and `value` not like '{$relative}%'";
     $query .= ' limit 1';
     // $query .= " and `photo_id` in ( select id from `#__social_photos` where `user_id` = '84' and `album_id` = '229' )";
     $sql->raw($query);
     $db->setQuery($sql);
     $results = $db->loadObjectList();
     $paths = array();
     if ($results) {
         // foreach ($results as $item) {
         $item = $results[0];
         //$pattern = '/.*\/\D*\//i';
         $pattern = '/\\/.*\\//i';
         preg_match($pattern, $item->value, $matches);
         if ($matches) {
             // we do not want the [albumid]/[photoid] segments.
             $path = $matches[0];
             $path = rtrim($path, '/');
             $path = ltrim($path, '/');
             $segments = explode('/', $path);
             // remove the last two elements since we knwo that is the album id and photo id.
             array_pop($segments);
             array_pop($segments);
             //now we glue the segments back
             $segmentPath = implode('/', $segments);
             //now we need to add back the leading / and ending /
             $segmentPath = '/' . $segmentPath . '/';
             if (!in_array($segmentPath, $paths)) {
                 $paths[] = $segmentPath;
             }
         }
         // } //end foreach
     }
     //end if
     // if found, lets replace these paths to the one admin configured.
     if ($paths) {
         foreach ($paths as $pitem) {
             $query = "UPDATE `#__social_photos_meta` SET `value` = replace(`value`, '{$pitem}' , '{$relative}')";
             $query .= " WHERE `group`= 'path'";
             $query .= " and `value` like '{$pitem}%'";
             $sql->clear();
             $sql->raw($query);
             $db->setQuery($sql);
             $db->Query();
         }
     }
     return true;
 }
예제 #27
0
 /**
  * Sends a new share to a user.
  *
  * @since	1.0
  * @access	public
  */
 public function send()
 {
     FD::checkToken();
     $token = JRequest::getString('token', '');
     $recipients = JRequest::getVar('recipients', array());
     $content = JRequest::getVar('content', '');
     // Get the current view.
     $view = $this->getCurrentView();
     // Cleaning
     if (is_string($recipients)) {
         $recipients = explode(',', FD::string()->escape($recipients));
     }
     if (is_array($recipients)) {
         foreach ($recipients as &$recipient) {
             $recipient = FD::string()->escape($recipient);
             if (!JMailHelper::isEmailAddress($recipient)) {
                 return $view->call(__FUNCTION__, false, JText::_('COM_EASYSOCIAL_SHARING_EMAIL_INVALID_RECIPIENT'));
             }
         }
     }
     $content = FD::string()->escape($content);
     // Check for valid data
     if (empty($recipients)) {
         return $view->call(__FUNCTION__, false, JText::_('COM_EASYSOCIAL_SHARING_EMAIL_NO_RECIPIENTS'));
     }
     if (empty($token)) {
         return $view->call(__FUNCTION__, false, JText::_('COM_EASYSOCIAL_SHARING_EMAIL_INVALID_TOKEN'));
     }
     $session = JFactory::getSession();
     $config = FD::config();
     $limit = $config->get('sharing.email.limit', 0);
     $now = FD::date()->toUnix();
     $time = $session->get('easysocial.sharing.email.time');
     $count = $session->get('easysocial.sharing.email.count');
     if (is_null($time)) {
         $session->set('easysocial.sharing.email.time', $now);
         $time = $now;
     }
     if (is_null($count)) {
         $session->set('easysocial.sharing.email.count', 0);
     }
     $diff = $now - $time;
     if ($diff <= 3600) {
         if ($limit > 0 && $count >= $limit) {
             return $view->call(__FUNCTION__, false, JText::_('COM_EASYSOCIAL_SHARING_EMAIL_SHARING_LIMIT_MAXED'));
         }
         $count++;
         $session->set('easysocial.sharing.email.count', $count);
     } else {
         $session->set('easysocial.sharing.email.time', $now);
         $session->set('easysocial.sharing.email.count', 1);
     }
     $library = FD::get('Sharing');
     $library->sendLink($recipients, $token, $content);
     $view->call(__FUNCTION__, true);
 }
예제 #28
0
 public function __construct()
 {
     // Load the current viewer
     $this->my = FD::user();
     // Load EasySocial's config
     $this->config = FD::config();
     // Get the app input
     $app = JFactory::getApplication();
     $this->input = FD::request();
 }
예제 #29
0
 /**
  * Returns the contents of this action.
  *
  * @since	1.0
  * @access	public
  * @return	string	The html codes for the comments.
  */
 public function getContents()
 {
     $config = FD::config();
     if (!$config->get('stream.comments.enabled')) {
         return false;
     }
     $obj = $this->getElementSource();
     $output = FD::comments($obj->uid, $obj->element, $this->item->verb, SOCIAL_APPS_GROUP_USER, array('url' => ''))->getHtml(array('hideEmpty' => true));
     return $output;
 }
예제 #30
0
 /**
  * Determines if the view should be visible on lockdown mode
  *
  * @since	1.0
  * @access	public
  * @return	bool
  */
 public function isLockDown()
 {
     $config = FD::config();
     $layout = $this->getLayout();
     // Allowed layouts on lockdown mode
     $allowed = array('auth');
     if (in_array($layout, $allowed)) {
         return false;
     }
     return true;
 }