Example #1
0
 /**
  * Validates the username.
  *
  * @since	1.0
  * @access	public
  * @param	null
  * @return	JSON	A jsong encoded string.
  *
  * @author	Jason Rey <*****@*****.**>
  */
 public function isValid()
 {
     // Render the ajax lib.
     $ajax = FD::getInstance('Ajax');
     // Get the userid
     $userid = JRequest::getInt('userid', 0);
     // Get the event
     $event = JRequest::getString('event');
     // Set the current username
     $current = '';
     if (!empty($userid)) {
         $user = FD::user($userid);
         $current = $user->username;
     }
     // Get the provided username that the user has typed.
     $username = JRequest::getVar('username', '');
     // Username is required, check if username is empty
     if (JString::strlen($username) < $this->params->get('min')) {
         return $ajax->reject(JText::sprintf('PLG_FIELDS_JOOMLA_USERNAME_MIN_CHARACTERS', $this->params->get('min')));
     }
     // Test if username is allowed (by pass for adminedit).
     if ($event !== 'onAdminEdit' && !SocialFieldsUserJoomlaUsernameHelper::allowed($username, $this->params)) {
         return $ajax->reject(JText::_('PLG_FIELDS_JOOMLA_USERNAME_NOT_ALLOWED'));
     }
     // Test if username exists.
     if (SocialFieldsUserJoomlaUsernameHelper::exists($username, $current)) {
         return $ajax->reject(JText::_('PLG_FIELDS_JOOMLA_USERNAME_NOT_AVAILABLE'));
     }
     // Test if the username is valid
     if (!SocialFieldsUserJoomlaUsernameHelper::isValid($username, $this->params)) {
         return $ajax->reject(JText::_('PLG_FIELDS_JOOMLA_USERNAME_IS_INVALID'));
     }
     $text = JText::_('PLG_FIELDS_JOOMLA_USERNAME_AVAILABLE');
     return $ajax->resolve($text);
 }
Example #2
0
 /**
  * Delete's the location from the database.
  *
  * @since	1.0
  * @access	public
  */
 public function delete()
 {
     // Check for valid token
     FD::checkToken();
     // Guest users shouldn't be allowed to delete any location at all.
     FD::requireLogin();
     $my = FD::user();
     $id = JRequest::getInt('id');
     $view = FD::getInstance('View', 'Location', false);
     $location = FD::table('Location');
     $location->load($id);
     // If id is invalid throw errors.
     if (!$location->id) {
         $view->setErrors(JText::_('COM_EASYSOCIAL_LOCATION_INVALID_ID'));
     }
     // If user do not own item, throw errors.
     if ($my->id !== $location->user_id) {
         $view->setErrors(JText::_('COM_EASYSOCIAL_LOCATION_ERROR_YOU_ARE_NOT_OWNER'));
     }
     // Try to delete location.
     if (!$location->delete()) {
         $view->setErrors($location->getError());
     }
     return $view->delete();
 }
Example #3
0
 public function deleteFilter()
 {
     // Check for request forgeries.
     FD::checkToken();
     // In order to access the dashboard apps, user must be logged in.
     FD::requireLogin();
     $view = FD::view('Stream', false);
     $my = FD::user();
     $id = JRequest::getInt('id', 0);
     if (!$id) {
         FD::getInstance('Info')->set(JText::_('Invalid filter id - ' . $id), 'error');
         $view->setError(JText::_('Invalid filter id.'));
         return $view->call(__FUNCTION__);
     }
     $filter = FD::table('StreamFilter');
     // make sure the user is the filter owner before we delete.
     $filter->load(array('id' => $id, 'uid' => $my->id, 'utype' => 'user'));
     if (!$filter->id) {
         FD::getInstance('Info')->set(JText::_('Filter not found - ' . $id), 'error');
         $view->setError(JText::_('Filter not found. Action aborted.'));
         return $view->call(__FUNCTION__);
     }
     $filter->deleteItem();
     $filter->delete();
     $view->setMessage(JText::_('COM_EASYSOCIAL_STREAM_FILTER_DELETED'), SOCIAL_MSG_SUCCESS);
     return $view->call(__FUNCTION__);
 }
Example #4
0
 /**
  * Renders the user group tree listing.
  *
  * @since	1.0
  * @access	public
  * @param	object	The object to check against.
  * @param	string	The controller to be called.
  * @param	string	The key for the object.
  *
  * @author	Mark Lee <*****@*****.**>
  */
 public static function groups($name = 'gid', $selected = '', $exclude = array(), $checkSuperAdmin = false)
 {
     static $count;
     $count++;
     // If selected value is a string, we assume that it's a json object.
     if (is_string($selected)) {
         $json = FD::json();
         $selected = $json->decode($selected);
     }
     $version = FD::getInstance('Version')->getVersion();
     if ($version >= '1.6') {
         $groups = self::getGroups();
         $theme = FD::themes();
         $selected = FD::makeArray($selected);
         $isSuperAdmin = JFactory::getUser()->authorise('core.admin');
         $theme->set('name', $name);
         $theme->set('checkSuperAdmin', $checkSuperAdmin);
         $theme->set('isSuperAdmin', $isSuperAdmin);
         $theme->set('selected', $selected);
         $theme->set('count', $count);
         $theme->set('groups', $groups);
         return $theme->output('admin/html/tree.groups');
     }
     return JHTML::_('select.genericlist', JFactory::getAcl()->get_group_children_tree(null, 'USERS', false), 'gid', 'size="10"', 'value', 'text', $selected);
 }
Example #5
0
 /**
  * Loads a set of configuration given the type.
  *
  * @since	1.0
  * @access	public
  * @param	string		The unique type of configuration.
  * @return
  */
 public function load($key)
 {
     // Specifically if the key is 'joomla' , we only want to use JConfig.
     if ($key == 'joomla') {
         $codeName = FD::getInstance('Version')->getCodeName();
         $helper = dirname(__FILE__) . '/helpers/' . $codeName . '.php';
         require_once $helper;
         $className = 'SocialConfig' . $codeName;
         $config = new $className();
     } else {
         // Object construct happens here
         $default = SOCIAL_ADMIN . '/defaults/' . $key . '.json';
         $defaultData = '';
         // Read the default data.
         $defaultData = JFile::read($default);
         $json = FD::json();
         // Load a new copy of Registry
         $config = FD::registry($defaultData);
         if (!defined('SOCIAL_COMPONENT_CLI')) {
             // @task: Now we need to get the user defined configuration that is stored in the database.
             $model = FD::model('Config');
             $storedConfig = $model->getConfig($key);
             // Get stored config
             if ($storedConfig) {
                 $storedConfig = FD::registry($storedConfig->value);
                 // Merge configurations
                 $config->mergeObjects($storedConfig->getRegistry());
             }
         }
     }
     $this->configs[$key] = $config;
 }
Example #6
0
 public function archive()
 {
     $errors = $this->getErrors();
     // @TODO: Process errors here.
     if ($errors) {
     }
     FD::getInstance('AJAX')->success();
 }
Example #7
0
 public function __construct()
 {
     $version = FD::getInstance('Version');
     $name = $version->getCodeName();
     $name = strtolower($name);
     require_once dirname(__FILE__) . '/helpers/' . $name . '.php';
     $className = 'SocialInstallerHelper' . ucfirst($name);
     $this->helper = new $className();
 }
Example #8
0
 public function __construct()
 {
     $codeName = FD::getInstance('Version')->getCodeName();
     $fileName = strtolower($codeName);
     $helperFile = dirname(__FILE__) . '/helpers/' . $fileName . '.php';
     require_once $helperFile;
     $className = 'SocialDBHelper' . ucfirst($codeName);
     $this->db = new $className();
 }
Example #9
0
 /**
  * Obtains the application output when a user clicks on a bookmark item.
  *
  * @since	1.0
  * @access	public
  * @param
  *
  * @return
  */
 public function renderBookmark()
 {
     $id = JRequest::getInt('id');
     $app = FD::table('Application');
     $app->load($id);
     $lib = FD::getInstance('Apps');
     $output = $lib->render('bookmark', $app->element, $app->group);
     // Return the JSON output.
     $ajax = FD::getInstance('Ajax');
     $ajax->success($output);
 }
Example #10
0
 /**
  * Initializes javascript on the head of the page.
  *
  * @since	1.0
  * @access	public
  */
 public function initScripts()
 {
     if (self::$scriptsLoaded) {
         return;
     }
     $configuration = FD::getInstance('Configuration');
     $configuration->attach();
     // TODO: Find a better place to define map language code this.
     $document = JFactory::getDocument();
     $document->addCustomTag('<meta name="foundry:location:language" content="' . FD::config()->get('general.location.language', 'en') . '" />');
     self::$scriptsLoaded = true;
 }
Example #11
0
 /**
  * Class constructor
  *
  * @since	1.0
  * @access	public
  * @param	null
  */
 public function __construct()
 {
     // Determine the code name
     $name = FD::getInstance('Version')->getCodename();
     $file = dirname(__FILE__) . '/helpers/' . strtolower($name) . '.php';
     // If helper is not exist, we need to prevent any fatal errors.
     if (!JFile::exists($file)) {
         return;
     }
     require_once $file;
     $className = 'SocialParser' . ucfirst($name);
     $this->helper = new $className();
 }
Example #12
0
 /**
  * Deletes a note.
  *
  * @since	1.0
  * @access	public
  * @param	null
  * @author	Mark Lee <*****@*****.**>
  */
 public function delete()
 {
     $my = FD::user();
     $id = JRequest::getInt('noteid');
     $note = $this->table('Note');
     $note->load($id);
     if (!$note->delete()) {
         FD::getInstance('Info')->set($note->getError(), 'error');
         return $this->redirect('index.php?option=com_easysocial&view=dashboard');
     }
     FD::getInstance('Info')->set('Note deleted successfully', 'success');
     $this->redirect('index.php?option=com_easysocial&view=dashboard#app-notes');
 }
Example #13
0
 /**
  * Class constructor
  *
  * @since	1.0
  * @access	public
  * @param	string		The registry's raw data.
  */
 public function __construct($data = '')
 {
     // Load our helpers
     $name = FD::getInstance('Version')->getCodename();
     $path = dirname(__FILE__) . '/helpers/' . $name . '.php';
     require_once $path;
     $className = 'SocialRegistry' . ucfirst($name);
     $this->helper = new $className('');
     // Always use our own load methods.
     if (!empty($data)) {
         $this->load($data);
     }
     return $this;
 }
Example #14
0
 /**
  * Responsible to output the application contents.
  *
  * @since	1.0
  * @access	public
  * @param	SocialAppTable	The application ORM.
  */
 public function getAppContents($app)
 {
     $ajax = FD::ajax();
     // If there's an error throw it back to the caller.
     if ($this->hasErrors()) {
         return $ajax->reject($this->getMessage());
     }
     // Get the current logged in user.
     $my = FD::user();
     // Load the library.
     $lib = FD::getInstance('Apps');
     $contents = $lib->renderView(SOCIAL_APPS_VIEW_TYPE_EMBED, 'dashboard', $app, array('userId' => $my->id));
     // Return the contents
     return $ajax->resolve($contents);
 }
Example #15
0
 /**
  * Retrieves a list of custom fields on the site.
  *
  * @since	1.0
  * @access	public
  */
 public function getFields()
 {
     $lib = FD::fields();
     // TODO: Enforce that group be a type of user , groups only.
     $group = JRequest::getWord('group', SOCIAL_FIELDS_GROUP_USER);
     // Get a list of fields
     $model = FD::model('Apps');
     $fields = $model->getApps(array('type' => SOCIAL_APPS_TYPE_FIELDS));
     // We might need this? Not sure.
     $data = array();
     // Trigger: onSample
     $lib->trigger('onSample', $group, $fields, $data);
     // Once done, pass this back to the view.
     $view = FD::getInstance('View', 'Fields');
     $view->call(__FUNCTION__, $fields);
 }
Example #16
0
 public function load($contents = '', $isFile = false)
 {
     $this->version = FD::getInstance('version')->getVersion();
     $parser = '';
     if ($this->version >= '3.0') {
         $parser = JFactory::getXML($contents, $isFile);
     } else {
         $parser = JFactory::getXMLParser('Simple');
         if ($isFile) {
             $parser->loadFile($contents);
         } else {
             $parser->loadString($contents);
         }
     }
     $this->parser = $parser;
     return $this->parser;
 }
Example #17
0
 /**
  * Attaches stylesheet on the site.
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function attach($minified = null, $allowOverride = true)
 {
     // Get configuration
     $config = FD::getInstance('Configuration');
     $environment = $config->environment;
     $mode = $config->mode;
     // If caller did not specify whether or not
     // to attach compressed stylesheets.
     if (is_null($minified)) {
         // Then decide from configuration mode
         $minified = $mode == 'compressed';
     }
     // Default settings
     $build = false;
     // If we're in a development environment,
     // always cache compile stylesheet and
     // attached uncompressed stylesheets.
     if ($environment == 'development') {
         $build = true;
         // Never attached minified stylesheet while in development mode.
         $minified = false;
         // Only super developers can build admin stylesheets.
         if ($this->location == 'admin') {
             $build = false;
         }
         // Do not build if stylesheet has not been compiled before.
         $cacheFolder = $this->folder('cache');
         if (!JFolder::exists($cacheFolder)) {
             $build = false;
         }
         // Always build for superdevs
         $super = FD::config()->get('general.super');
         if ($super) {
             $build = true;
         }
     }
     // Rebuild stylesheet on page load if necessary
     if ($build) {
         $task = $this->build($environment);
         // This generates build log in the browser console.
         $script = FD::script();
         $script->set('task', $task);
         $script->attach('themes:/admin/stylesheet/log');
     }
     parent::attach($minified, $allowOverride);
 }
Example #18
0
 public function remove()
 {
     // Check for valid token
     FD::checkToken();
     // Ensure that the user is logged in
     FD::requireLogin();
     $sId = JRequest::getVar('id');
     if (empty($sId)) {
         FD::getInstance('View', 'Subscriptions', false)->setErrors(JText::_('COM_EASYSOCIAL_ERROR_UNABLE_TO_LOCATE_ID'));
         return FD::getInstance('View', 'Subscriptions', false)->remove();
     }
     $state = FD::get('Subscriptions')->remove($sId);
     if (!$state) {
         FD::getInstance('View', 'Subscriptions', false)->setErrors(JText::_('COM_EASYSOCIAL_SUBSCRIPTION_FAILED_TO_UNSUBSCRIBE'));
         return FD::getInstance('View', 'Subscriptions', false)->remove();
     }
     return FD::getInstance('View', 'Subscriptions', false)->remove();
 }
Example #19
0
 /**
  * to hide the stream
  *
  * @since	1.0
  * @access	public
  * @param
  * @return	string
  */
 public function store()
 {
     FD::checkToken();
     FD::requireLogin();
     $post = JRequest::get('POST');
     $my = FD::user();
     $state = false;
     if (isset($post['privacy'])) {
         $model = FD::model('Privacy');
         $state = $model->updatePrivacy($my->id, $post['privacy'], 'user');
     }
     if (!$state) {
         // FD::getInstance( 'View' , 'Privacy' , false )->setErrors( JText::_( 'COM_EASYSOCIAL_PRIVACY_UPDATE_FAILED' ) );
         FD::getInstance('Info')->set(JText::_('COM_EASYSOCIAL_PRIVACY_UPDATE_FAILED'), 'error');
         return FD::getInstance('View', 'Privacy', false)->display();
     }
     FD::getInstance('Info')->set(JText::_('COM_EASYSOCIAL_PRIVACY_UPDATED'), 'success');
     return FD::getInstance('View', 'Privacy', false)->display();
     exit;
 }
Example #20
0
 /**
  * Attaches foundry framework to the document header
  *
  * @since	1.2
  * @access	public
  * @param	string
  * @return
  */
 public function attach()
 {
     // If foundry framework is already attached, we can skip this.
     if (self::$attached) {
         return;
     }
     // Load up the parent to attach scripts
     parent::attach();
     if ($this->environment !== "development") {
         // Get resources
         $compiler = FD::getInstance('Compiler');
         $resource = $compiler->getResources();
         // Attach resources
         if (!empty($resource)) {
             $scriptTag = $this->createScriptTag($resource["uri"]);
             $document = JFactory::getDocument();
             $document->addCustomTag($scriptTag);
         }
     }
     self::$attached = true;
 }
Example #21
0
 /**
  * Internal function to update the database with the necessary columns
  *
  * @since	1.0
  * @access	public
  * @author	Mark
  */
 public function update()
 {
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     // Lookup for sql files.
     $path = SOCIAL_ADMIN . '/updates';
     $files = JFolder::files($path, '.json$', true, true);
     $info = FD::getInstance('Info');
     if (!$files) {
         $info->set('Nothing to update');
         return $this->setRedirect('index.php?option=com_easysocial');
     }
     foreach ($files as $file) {
         $contents = JFile::read($path . '/' . $file);
         $db = FD::db();
         $db->setQuery($contents);
         $db->Query();
     }
     $str = implode(',', $files);
     $info->set('Files ' . $str . ' executed.');
     $this->setRedirect('index.php?option=com_easysocial');
 }
Example #22
0
						<?php 
    echo $html;
    ?>
					</div>

					<br /><br /><br /><br />
				</div>
			</div>


		</div>
	<?php 
} else {
    ?>

		<?php 
    echo FD::getInstance('Info')->toHTML();
    ?>

		<?php 
    echo $html;
    ?>

	<?php 
}
?>


</div>
Example #23
0
 /**
  * Responsible to add / upate user privacy on an object
  *
  * @since	3.0
  * @access	public
  * @param	int		The user id.
  * @param	int 	The unique id form the object.
  * @param 	string 	The type of object.
  * @param	string	The privacy value from user.
  * @param	string	The custom user id.
  *
  */
 public function update($userId, $pid, $uId, $uType, $value, $custom = '')
 {
     // lets check if this user already has the record or not.
     // if not, we will add it here.
     // if exists, we will update the record.
     $db = FD::db();
     // check if user selected custom but there is no userids, then we do not do anything.
     if ($value == 'custom' && empty($custom)) {
         return false;
     }
     $query = 'select `id` from `#__social_privacy_items`';
     $query .= ' where `user_id` = ' . $db->Quote($userId);
     $query .= ' and `uid` = ' . $db->Quote($uId);
     $query .= ' and `type` = ' . $db->Quote($uType);
     $db->setQuery($query);
     $result = $db->loadResult();
     $privacy = FD::privacy($userId);
     $valueInInt = $privacy->toValue($value);
     $tbl = FD::table('PrivacyItems');
     if ($result) {
         // record exist. update here.
         $tbl->load($result);
         $tbl->value = $valueInInt;
     } else {
         // record not found. add new here.
         $tbl->user_id = $userId;
         $tbl->privacy_id = $pid;
         $tbl->uid = $uId;
         $tbl->type = $uType;
         $tbl->value = $valueInInt;
     }
     if (!$tbl->store()) {
         return false;
     }
     //clear the existing customized privacy data.
     $sql = FD::sql();
     $sql->delete('#__social_privacy_customize');
     $sql->where('uid', $tbl->id);
     $sql->where('utype', SOCIAL_PRIVACY_TYPE_ITEM);
     $db->setQuery($sql);
     $db->query();
     // if there is custom userids.
     if ($value == 'custom' && !empty($custom)) {
         $customList = explode(',', $custom);
         for ($i = 0; $i < count($customList); $i++) {
             $customUserId = $customList[$i];
             if (empty($customUserId)) {
                 continue;
             }
             $tblCustom = FD::table('PrivacyCustom');
             $tblCustom->uid = $tbl->id;
             $tblCustom->utype = SOCIAL_PRIVACY_TYPE_ITEM;
             $tblCustom->user_id = $customUserId;
             $tblCustom->store();
         }
     }
     // need to update the stream's ispublic flag.
     if ($uType != SOCIAL_TYPE_FIELD) {
         $context = $uType;
         $column = 'context_id';
         $updateId = $uId;
         $isPublic = $valueInInt == SOCIAL_PRIVACY_PUBLIC ? 1 : 0;
         $updateQuery = 'update #__social_stream set ispublic = ' . $db->Quote($isPublic);
         switch ($context) {
             case SOCIAL_TYPE_ACTIVITY:
                 $updateQuery .= ' where `id` = ( select `uid` from `#__social_stream_item` where `id` = ' . $db->Quote($uId) . ')';
                 break;
             case SOCIAL_TYPE_STORY:
             case SOCIAL_TYPE_LINKS:
                 $updateQuery .= ' where `id` = ' . $db->Quote($uId);
                 break;
             default:
                 $updateQuery .= ' where `id` IN ( select `uid` from `#__social_stream_item` where `context_type` = ' . $db->Quote($context) . ' and `context_id` = ' . $db->Quote($uId) . ')';
                 break;
         }
         $sql->clear();
         $sql->raw($updateQuery);
         $db->setQuery($sql);
         $db->query();
     }
     // lets trigger the onPrivacyChange event here so that apps can handle their items accordingly.
     $obj = new stdClass();
     $obj->user_id = $userId;
     $obj->privacy_id = $pid;
     $obj->uid = $uId;
     $obj->utype = $uType;
     $obj->value = $valueInInt;
     $obj->custom = $custom;
     // Get apps library.
     $apps = FD::getInstance('Apps');
     // Try to load user apps
     $state = $apps->load(SOCIAL_APPS_GROUP_USER);
     if ($state) {
         // Only go through dispatcher when there is some apps loaded, otherwise it's pointless.
         $dispatcher = FD::dispatcher();
         // Pass arguments by reference.
         $args = array($obj);
         // @trigger: onPrepareStream for the specific context
         $result = $dispatcher->trigger(SOCIAL_APPS_GROUP_USER, 'onPrivacyChange', $args, $uType);
     }
     return true;
 }
Example #24
0
 /**
  * List apps from the site.
  *
  * @since	1.0
  * @access	public
  */
 public function getApps()
 {
     // Get the current view object.
     $view = FD::getInstance('View', 'Apps');
     // Get dispatcher.
     $dispatcher = FD::getInstance('dispatcher');
     // Retrieves a list of filters.
     $filters = JRequest::getVar('filters', array());
     // Determine the trigger to be executed
     $trigger = JRequest::getString('trigger', '');
     // Get list of apps.
     $apps = FD::getInstance('apps');
     $items = $apps->getApps($filters['type']);
     // We need to format the ajax result with appropriate values.
     if ($items) {
         foreach ($items as &$item) {
             $item->app_id = $item->id;
             $item->config = $apps->getManifest($item, 'config', 'fields');
             $params = $apps->getManifest($item);
             $callback = array('setParams' => $params, 'setField' => $item, 'setElementName' => $item->element);
             $item->html = $dispatcher->trigger($item->type, $trigger, array(), $item->element, $callback);
         }
     }
     return $view->call(__FUNCTION__, $items);
 }
Example #25
0
 /**
  * Purges the less cache files on the site
  *
  * @since	1.0
  * @access	public
  * @param	string
  * @return
  */
 public function clearCache()
 {
     // Check for request forgeries
     FD::checkToken();
     // Get the current view
     $view = $this->getCurrentView();
     $purgeJS = JRequest::getBool('script-cache');
     if ($purgeJS) {
         // Clear javascript files
         $configuration = FD::getInstance('Configuration');
         $configuration->purge();
         $compiler = FD::getInstance('Compiler');
         $compiler->purgeResources();
     }
     $purgeLess = JRequest::getBool('stylesheet-cache');
     if ($purgeLess) {
         // Compile site themes
         $templates = JFolder::folders(EASYSOCIAL_SITE_THEMES);
         foreach ($templates as $template) {
             $task = FD::stylesheet('site', $template)->purge();
         }
         // Compile admin themes
         $templates = JFolder::folders(EASYSOCIAL_ADMIN_THEMES);
         foreach ($templates as $template) {
             $task = FD::stylesheet('admin', $template)->purge();
         }
         // Compile modules
         $modules = FD::stylesheet('module')->modules();
         foreach ($modules as $module) {
             $task = FD::stylesheet('module', $module)->purge();
         }
     }
     $message = JText::sprintf('COM_EASYSOCIAL_CACHE_PURGED_FROM_SITE');
     $view->setMessage($message, SOCIAL_MSG_SUCCESS);
     return $view->call(__FUNCTION__);
 }
Example #26
0
 private function triggerBeforeGetStream(&$options)
 {
     if (!$options) {
         return;
     }
     $view = JRequest::getCmd('view', '');
     // Get apps library.
     $apps = FD::getInstance('Apps');
     // Determine the app group
     $group = SOCIAL_APPS_GROUP_USER;
     // If it is in the group view we should render the apps based on the appropriate group
     if ($view && ($view == 'groups' || $view == 'events' || $view == 'stream') && (isset($options['clusterType']) && $options['clusterType'])) {
         $group = $options['clusterType'];
     }
     // Try to load user apps
     $state = $apps->load($group);
     // By default return true.
     $result = true;
     if (!$state) {
         FD::logError(__FILE__, __LINE__, 'STREAMS: No applications loaded.');
         return false;
     }
     // Only go through dispatcher when there is some apps loaded, otherwise it's pointless.
     $dispatcher = FD::dispatcher();
     // Pass arguments by reference.
     $args = array(&$options, $view);
     $dispatcher->trigger($group, 'onBeforeGetStream', $args);
 }
Example #27
0
 /**
  * Toggle publish button
  *
  * @since	1.0
  * @access	public
  * @param	null
  */
 public function togglePublish()
 {
     JRequest::checkToken('get') or JRequest::checkToken() or die('Invalid token');
     $task = $this->getTask();
     $method = strtolower($task);
     $ids = JRequest::getVar('cid');
     $ids = FD::makeArray($ids);
     // Get the view object.
     $view = FD::getInstance('View', 'Mailer');
     // Test if there's any id's being passed in.
     if (empty($ids)) {
         $view->setError(JText::_('COM_EASYSOCIAL_ERRORS_MAILER_NO_ID'));
         return $view->call($task);
     }
     foreach ($ids as $id) {
         $mailer = FD::table('Mailer');
         $mailer->load($id);
         // When there's an error, just break out of the loop.
         if (!$mailer->{$method}()) {
             $view->setError($mailer->getError());
             return $view->call($task);
         }
     }
     $info = FD::getInstance('Info');
     $message = $task == 'publish' ? JText::_('COM_EASYSOCIAL_MAILER_ITEMS_MARKED_AS_SENT') : JText::_('COM_EASYSOCIAL_MAILER_ITEMS_MARKED_AS_PENDING');
     $info->set($message, SOCIAL_MSG_SUCCESS);
     return $view->call($method);
 }
Example #28
0
 /**
  * Alias for FD::getInstance('maintenance')
  *
  * @author Jason Rey <*****@*****.**>
  * @since  1.2
  * @access public
  * @return SocialMaintenance    Maintenance library
  */
 public static function maintenance()
 {
     return FD::getInstance('maintenance');
 }
Example #29
0
 /**
  * Purge js configuration files
  *
  * @since	1.3
  * @access	public
  * @param	string
  * @return
  */
 public static function purgeJavascriptResources()
 {
     // Purge configuration files
     $configuration = FD::getInstance('Configuration');
     $state = $configuration->purge();
     // Purge resources files
     $compiler = FD::getInstance('Compiler');
     $state = $compiler->purgeResources();
 }
Example #30
0
 /**
  * Responsible to output the application contents.
  *
  * @since   1.0
  * @access  public
  * @param   SocialAppTable  The application ORM.
  */
 public function getAppContents($app)
 {
     // If there's an error throw it back to the caller.
     if ($this->hasErrors()) {
         return $this->ajax->reject($this->getMessage());
     }
     // Get the current logged in user.
     $eventId = $this->input->get('eventId', 0, 'int');
     $event = FD::event($eventId);
     // Load the library.
     $lib = FD::getInstance('Apps');
     $contents = $lib->renderView(SOCIAL_APPS_VIEW_TYPE_EMBED, 'events', $app, array('eventId' => $event->id));
     // Return the contents
     return $this->ajax->resolve($contents);
 }