Exemple #1
1
 /**
  * Do a batch send
  */
 function send($total = 100)
 {
     $mailqModel = CFactory::getModel('mailq');
     $userModel = CFactory::getModel('user');
     $mails = $mailqModel->get($total);
     $jconfig = JFactory::getConfig();
     $mailer = JFactory::getMailer();
     $config = CFactory::getConfig();
     $senderEmail = $jconfig->getValue('mailfrom');
     $senderName = $jconfig->getValue('fromname');
     if (empty($mails)) {
         return;
     }
     CFactory::load('helpers', 'string');
     foreach ($mails as $row) {
         // @rule: only send emails that is valid.
         // @rule: make sure recipient is not blocked!
         $userid = $userModel->getUserFromEmail($row->recipient);
         $user = CFactory::getUser($userid);
         if (!$user->isBlocked() && !JString::stristr($row->recipient, 'foo.bar')) {
             $mailer->setSender(array($senderEmail, $senderName));
             $mailer->addRecipient($row->recipient);
             $mailer->setSubject($row->subject);
             $tmpl = new CTemplate();
             $raw = isset($row->params) ? $row->params : '';
             $params = new JParameter($row->params);
             $base = $config->get('htmlemail') ? 'email.html' : 'email.text';
             if ($config->get('htmlemail')) {
                 $row->body = JString::str_ireplace(array("\r\n", "\r", "\n"), '<br />', $row->body);
                 $mailer->IsHTML(true);
             } else {
                 //@rule: Some content might contain 'html' tags. Strip them out since this mail should never contain html tags.
                 $row->body = CStringHelper::escape(strip_tags($row->body));
             }
             $tmpl->set('content', $row->body);
             $tmpl->set('template', rtrim(JURI::root(), '/') . '/components/com_community/templates/' . $config->get('template'));
             $tmpl->set('sitename', $config->get('sitename'));
             $row->body = $tmpl->fetch($base);
             // Replace any occurences of custom variables within the braces scoe { }
             if (!empty($row->body)) {
                 preg_match_all("/{(.*?)}/", $row->body, $matches, PREG_SET_ORDER);
                 foreach ($matches as $val) {
                     $replaceWith = $params->get($val[1], null);
                     //if the replacement start with 'index.php', we can CRoute it
                     if (strpos($replaceWith, 'index.php') === 0) {
                         $replaceWith = CRoute::getExternalURL($replaceWith);
                     }
                     if (!is_null($replaceWith)) {
                         $row->body = JString::str_ireplace($val[0], $replaceWith, $row->body);
                     }
                 }
             }
             unset($tmpl);
             $mailer->setBody($row->body);
             $mailer->send();
         }
         $mailqModel->markSent($row->id);
         $mailer->ClearAllRecipients();
     }
 }
Exemple #2
0
 public function getThumbnail($obj)
 {
     $config = CFactory::getConfig();
     $file = $obj->thumb;
     // Site origin
     if (JString::substr($file, 0, 4) == 'http') {
         $uri = $file;
         return $uri;
     }
     // Remote storage
     if ($obj->storage != 'file') {
         $storage = CStorage::getStorage($obj->storage);
         $uri = $storage->getURI($file);
         return $uri;
     }
     // Default thumbnail
     if (empty($file) || !JFile::exists(JPATH_ROOT . '/' . $file)) {
         $template = new CTemplateHelper();
         $asset = $template->getTemplateAsset('video_thumb.png', 'images');
         $uri = $asset->url;
         return $uri;
     }
     // Strip cdn path if exists.
     // Note: At one point, cdn path was stored along with the thumbnail path
     //       in the db which is the mistake we are trying to rectify here.
     $file = str_ireplace($config->get('videocdnpath'), '', $file);
     // CDN or local
     $baseUrl = $config->get('videobaseurl') or $baseUrl = JURI::root();
     $uri = str_replace('\\', '/', rtrim($baseUrl, '/') . '/' . ltrim($file, '/'));
     return $uri;
 }
Exemple #3
0
 function onProfileCreate($user)
 {
     // Upon registering, users should get 4 default photo albums:
     // Fiskeplasser, Fangstrapporter, Turer, and Klekker (Spots/Catches/Trips/Hatches)
     $config = CFactory::getConfig();
     CFactory::load('models', 'photos');
     $albumNames = array('Fiskeplasser', 'Fangstrapporter', 'Turer', 'Klekker');
     foreach ($albumNames as $album_name) {
         $album =& JTable::getInstance('Album', 'CTable');
         $album->creator = $user->id;
         $album->name = $album_name;
         $album->description = "";
         $album->type = "user";
         $album->created = gmdate('Y-m-d H:i:s');
         $params = $user->getParams();
         $album->permissions = $params->get('privacyPhotoView');
         $album->permanent = 1;
         // don't let users delete default albums
         $storage = JPATH_ROOT . DS . $config->getString('photofolder');
         $albumPath = $storage . DS . 'photos' . DS . $user->id . DS;
         $albumPath = JString::str_ireplace(JPATH_ROOT . DS, '', $albumPath);
         $albumPath = JString::str_ireplace('\\', '/', $albumPath);
         $album->path = $albumPath;
         $album->store();
     }
 }
Exemple #4
0
 public function _displayEditLayout($tpl)
 {
     // Load frontend language file.
     $lang = JFactory::getLanguage();
     $lang->load('com_community', JPATH_ROOT);
     // Set the titlebar text
     JToolBarHelper::title(JText::_('COM_COMMUNITY_GROUPS'), 'groups');
     // Add the necessary buttons
     JToolBarHelper::back('Back', 'index.php?option=com_community&view=groups');
     JToolBarHelper::divider();
     JToolBarHelper::save();
     $group = JTable::getInstance('Group', 'CTable');
     $group->load(JRequest::getInt('groupid'));
     $post = JRequest::get('POST');
     $group->bind($post);
     $categories = $this->get('Categories');
     $config = CFactory::getConfig();
     $editorType = $config->get('allowhtml') ? $config->get('htmleditor', 'none') : 'none';
     $editor = new CEditor($editorType);
     $this->assignRef('categories', $categories);
     $this->assignRef('group', $group);
     $this->assignRef('editor', $editor);
     $document = JFactory::getDocument();
     JHTML::_('behavior.modal', 'a.modal');
     $this->url = 'index.php?option=com_users&amp;view=users&amp;layout=modal&amp;tmpl=component&amp;field=jform_user_id_to';
     parent::display($tpl);
 }
 /**
  * Method is called during the status update triggers.
  **/
 public function onProfileStatusUpdate($userid, $oldMessage, $newMessage)
 {
     $config = CFactory::getConfig();
     $my = CFactory::getUser();
     if ($config->get('fbconnectpoststatus')) {
         //CFactory::load( 'libraries' , 'facebook' );
         $facebook = new CFacebook();
         if ($facebook) {
             $fbuserid = $facebook->getUser();
             $connectModel = CFactory::getModel('Connect');
             $connectTable = JTable::getInstance('Connect', 'CTable');
             $connectTable->load($fbuserid);
             // Make sure the FB session match the user session
             if ($connectTable->userid == $my->id) {
                 /**
                  * Check post status to facebook settings
                  */
                 //echo "posting to facebook"; exit;
                 $targetUser = CFactory::getUser($my->id);
                 $userParams = $targetUser->getParams();
                 if ($userParams->get('postFacebookStatus')) {
                     $result = $facebook->postStatus($newMessage);
                     //print_r($result); exit;
                 }
             }
         }
     }
 }
Exemple #6
0
 public static function isSingular($num)
 {
     $config = CFactory::getConfig();
     $singularnumbers = $config->get('singularnumber');
     $singularnumbers = explode(',', $singularnumbers);
     return in_array($num, $singularnumbers);
 }
Exemple #7
0
 function onProfileDisplay()
 {
     $config = CFactory::getConfig();
     $this->loadUserParams();
     $uri = JURI::base();
     //$user		= CFactory::getActiveProfile();
     $user = CFactory::getRequestUser();
     $document = JFactory::getDocument();
     $css = $uri . 'plugins/community/groups/style.css';
     $document->addStyleSheet($css);
     $view = $this->params->get('fabrik_view');
     $id = $this->params->get('fabrik_view_id');
     $rowid = $this->params->get('fabrik_row_id');
     $usekey = $this->params->get('fabrik_usekey');
     $layout = $this->params->get('fabrik_layout');
     $additional = $this->params->get('fabrik_additional');
     $element = $this->params->get('fabrik_element');
     if (!empty($view) && !empty($id)) {
         $cache = JFactory::getCache('plgCommunityFabrik');
         $cache->setCaching($this->params->get('cache', 1));
         $className = 'plgCommunityFabrik';
         $callback = array($className, '_getFabrikHTML');
         $content = $cache->call($callback, $view, $id, $rowid, $usekey, $layout, $element, $additional, $this->userparams, $user->id);
     } else {
         $content = "<div class=\"icon-nopost\"><img src='" . JURI::base() . "components/com_community/assets/error.gif' alt=\"\" /></div>";
         $content .= "<div class=\"content-nopost\">" . JText::_('Fabrik view details not set.') . "</div>";
     }
     return $content;
 }
Exemple #8
0
 public function _displayEditLayout($tpl)
 {
     JToolBarHelper::title(JText::_('COM_COMMUNITY_CONFIGURATION_MULTIPROFILES'), 'multiprofile');
     // Add the necessary buttons
     JToolBarHelper::back('Back', 'index.php?option=com_community&view=multiprofile');
     JToolBarHelper::divider();
     JToolBarHelper::apply();
     JToolBarHelper::save();
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $postedFields = $jinput->get('fields', '', 'NONE');
     $id = $jinput->request->get('id', '', 'INT');
     //JRequest::getVar( 'id' , '' , 'REQUEST' );
     $multiprofile = JTable::getInstance('MultiProfile', 'CTable');
     $multiprofile->load($id);
     $post = JRequest::get('POST');
     $multiprofile->bind($post);
     $profile = $this->getModel('Profiles');
     $fields = $profile->getFields();
     $config = CFactory::getConfig();
     $this->assignRef('multiprofile', $multiprofile);
     $this->assignRef('fields', $fields);
     $this->assignRef('config', $config);
     $this->assignRef('postedFields', $postedFields);
     parent::display($tpl);
 }
Exemple #9
0
 function _displayEditLayout($tpl)
 {
     // Load frontend language file.
     $lang =& JFactory::getLanguage();
     $lang->load('com_community', JPATH_ROOT);
     $userId = JRequest::getVar('id', '', 'REQUEST');
     $user = CFactory::getUser($userId);
     // Set the titlebar text
     JToolBarHelper::title($user->username, 'users');
     // Add the necessary buttons
     JToolBarHelper::back('Back', 'index.php?option=com_community&view=users');
     JToolBarHelper::divider();
     JToolBarHelper::cancel('removeavatar', JText::_('CC REMOVE AVATAR'));
     JToolBarHelper::save();
     $model = CFactory::getModel('Profile');
     $profile = $model->getEditableProfile($user->id, $user->getProfileType());
     $config =& CFactory::getConfig();
     $params = $user->getParams();
     $userDST = $params->get('daylightsavingoffset');
     $offset = !empty($userDST) ? $userDST : $config->get('daylightsavingoffset');
     $counter = -4;
     $options = array();
     for ($i = 0; $i <= 8; $i++, $counter++) {
         $options[] = JHTML::_('select.option', $counter, $counter);
     }
     $offsetList = JHTML::_('select.genericlist', $options, 'daylightsavingoffset', 'class="inputbox" size="1"', 'value', 'text', $offset);
     $user->profile =& $profile;
     $this->assignRef('user', $user);
     $this->assignRef('params', $user->getParameters(true));
     $this->assignRef('offsetList', $offsetList);
     parent::display($tpl);
 }
Exemple #10
0
 static function getActivityContentHTML($act)
 {
     // Ok, the activity could be an upload OR a wall comment. In the future, the content should
     // indicate which is which
     $html = '';
     $param = new CParameter($act->params);
     $action = $param->get('action', false);
     $count = $param->get('count', false);
     $config = CFactory::getConfig();
     switch ($action) {
         case CAdminstreamsAction::TOP_USERS:
             $model = CFactory::getModel('user');
             $members = $model->getPopularMember($count);
             $html = '';
             //Get Template Page
             $tmpl = new CTemplate();
             $html = $tmpl->set('members', $members)->fetch('activity.members.popular');
             return $html;
             break;
         case CAdminstreamsAction::TOP_PHOTOS:
             $model = CFactory::getModel('photos');
             $photos = $model->getPopularPhotos($count, 0);
             $tmpl = new CTemplate();
             $html = $tmpl->set('photos', $photos)->fetch('activity.photos.popular');
             return $html;
             break;
         case CAdminstreamsAction::TOP_VIDEOS:
             $model = CFactory::getModel('videos');
             $videos = $model->getPopularVideos($count);
             $tmpl = new CTemplate();
             $html = $tmpl->set('videos', $videos)->fetch('activity.videos.popular');
             return $html;
             break;
     }
 }
Exemple #11
0
 /**
 	get field value of $userId accordimg to $fieldCode
 */
 public function getInfo($userId, $fieldCode)
 {
     // Run Query to return 1 value
     $db = JFactory::getDBO();
     $query = 'SELECT b.* FROM ' . $db->nameQuote('#__community_fields') . ' AS a ' . 'INNER JOIN ' . $db->nameQuote('#__community_fields_values') . ' AS b ' . 'ON b.' . $db->nameQuote('field_id') . '=a.' . $db->nameQuote('id') . ' ' . 'AND b.' . $db->nameQuote('user_id') . '=' . $db->Quote($userId) . ' ' . 'INNER JOIN ' . $db->nameQuote('#__community_users') . ' AS c ' . 'ON c.' . $db->nameQuote('userid') . '= b.' . $db->nameQuote('user_id') . 'WHERE a.' . $db->nameQuote('fieldcode') . ' =' . $db->Quote($fieldCode);
     $db->setQuery($query);
     $result = $db->loadObject();
     $field = JTable::getInstance('FieldValue', 'CTable');
     $field->bind($result);
     if ($db->getErrorNum()) {
         JError::raiseError(500, $db->stderr());
     }
     $config = CFactory::getConfig();
     // @rule: Only trigger 3rd party apps whenever they override extendeduserinfo configs
     if ($config->getBool('extendeduserinfo')) {
         CFactory::load('libraries', 'apps');
         $apps = CAppPlugins::getInstance();
         $apps->loadApplications();
         $params = array();
         $params[] = $fieldCode;
         $params[] =& $field->value;
         $apps->triggerEvent('onGetUserInfo', $params);
     }
     // Respect privacy settings.
     if (!XIPT_JOOMLA_15) {
         $my = CFactory::getUser();
         CFactory::load('libraries', 'privacy');
         if (!CPrivacy::isAccessAllowed($my->id, $userId, 'custom', $field->access)) {
             return false;
         }
     }
     return $field->value;
 }
Exemple #12
0
 public function showGroupMiniHeader($groupId)
 {
     CMiniHeader::load();
     $option = JRequest::getVar('option', '', 'REQUEST');
     JFactory::getLanguage()->load('com_community');
     CFactory::load('models', 'groups');
     $group =& JTable::getInstance('Group', 'CTable');
     $group->load($groupId);
     $my = CFactory::getUser();
     // @rule: Test if the group is unpublished, don't display it at all.
     if (!$group->published) {
         return '';
     }
     if (!empty($group->id) && $group->id != 0) {
         $isMember = $group->isMember($my->id);
         $config = CFactory::getConfig();
         $tmpl = new CTemplate();
         $tmpl->set('my', $my);
         $tmpl->set('group', $group);
         $tmpl->set('isMember', $isMember);
         $tmpl->set('config', $config);
         $showMiniHeader = $option == 'com_community' ? $tmpl->fetch('groups.miniheader') : '<div id="community-wrap" style="min-height:50px;">' . $tmpl->fetch('groups.miniheader') . '</div>';
         return $showMiniHeader;
     }
 }
Exemple #13
0
 public static function exceedDaily($view, $userId = null, $returnRemaining = false)
 {
     $my = CFactory::getUser($userId);
     // Guests shouldn't be even allowed here.
     if ($my->id == 0) {
         return true;
     }
     $view = JString::strtolower($view);
     // We need to include the model first before using ReflectionClass so that the model file is included.
     $model = CFactory::getModel($view);
     // Since the model will always return a CCachingModel which is a proxy,
     // for the real model, we can't really test what type of object it is.
     $modelClass = 'CommunityModel' . ucfirst($view);
     $reflection = new ReflectionClass($modelClass);
     if (!$reflection->implementsInterface('CLimitsInterface')) {
         return false;
     }
     $config = CFactory::getConfig();
     $total = $model->getTotalToday($my->id);
     $max = $config->getInt('limit_' . $view . '_perday');
     if ($returnRemaining) {
         return $max - $total;
     }
     return $total >= $max && $max != 0;
 }
Exemple #14
0
 function onProfileDisplay()
 {
     JPlugin::loadLanguage('plg_community_events', JPATH_ADMINISTRATOR);
     $config = CFactory::getConfig();
     if (!$config->get('enableevents')) {
         return JText::_('PLG_EVENTS_EVENT_DISABLED');
     }
     $document = JFactory::getDocument();
     $mainframe = JFactory::getApplication();
     $user = CFactory::getRequestUser();
     $caching = $this->params->get('cache', 1);
     $model = CFactory::getModel('Events');
     $my = CFactory::getUser();
     $this->loadUserParams();
     //CFactory::load( 'helpers' , 'event' );
     $event = JTable::getInstance('Event', 'CTable');
     $handler = CEventHelper::getHandler($event);
     $events = $model->getEvents(null, $user->id, $this->params->get('sorting', 'latest'), null, true, false, null, null, $handler->getContentTypes(), $handler->getContentId(), $this->userparams->get('count', 5));
     if ($this->params->get('hide_empty', 0) && !count($events)) {
         return '';
     }
     if ($caching) {
         $caching = $mainframe->getCfg('caching');
     }
     $creatable = $my->canCreateEvents();
     $cache = JFactory::getCache('plgCommunityEvents');
     $cache->setCaching($caching);
     $callback = array($this, '_getEventsHTML');
     $content = $cache->call($callback, true, $events, $user, $config, $model->getEventsCount($user->id), $creatable);
     return $content;
 }
Exemple #15
0
 public static function &getFields()
 {
     $model = CFactory::getModel('profile');
     $filters = array('searchable' => '1');
     $fields = $model->getAllFields($filters);
     JFactory::getLanguage()->load(COM_USER_NAME, JPATH_ROOT);
     // we need to get the user name / email seprately as these data did not
     // exists in custom profile fields.
     $config = CFactory::getConfig();
     $nameOptGroup = new stdClass();
     $nameOptGroup->type = "group";
     $nameOptGroup->published = 1;
     $nameOptGroup->name = JText::_('COM_COMMUNITY_ADVANCEDSEARCH_NAME');
     $nameOptGroup->visible = 1;
     $fields[JText::_('COM_COMMUNITY_ADVANCEDSEARCH_NAME')] = $nameOptGroup;
     $obj = new stdClass();
     $obj->type = "text";
     $obj->searchable = true;
     $obj->published = 1;
     $obj->name = JText::_('COM_COMMUNITY_ADVANCEDSEARCH_NAME');
     $obj->visible = 1;
     $obj->fieldcode = "username";
     $fields[$nameOptGroup->name]->fields[] = $obj;
     if ($config->get('privacy_search_email') != 2) {
         $obj = new stdClass();
         $obj->type = "email";
         $obj->searchable = true;
         $obj->published = 1;
         $obj->name = JText::_('COM_COMMUNITY_ADVANCEDSEARCH_EMAIL');
         $obj->visible = 1;
         $obj->fieldcode = "useremail";
         $fields[$nameOptGroup->name]->fields[] = $obj;
     }
     return $fields;
 }
Exemple #16
0
 function onProfileDisplay()
 {
     JPlugin::loadLanguage('plg_community_mygoogleads', JPATH_ADMINISTRATOR);
     $config = CFactory::getConfig();
     $config = CFactory::getConfig();
     $this->loadUserParams();
     $uri = JURI::base();
     $user = CFactory::getRequestUser();
     $document = JFactory::getDocument();
     $css = $uri . 'plugins/community/mygoogleads/mygoogleads/style.css';
     $document->addStyleSheet($css);
     $googleCode = $this->userparams->get('googleCode');
     $content = '';
     if (!empty($googleCode)) {
         $mainframe = JFactory::getApplication();
         $caching = $this->params->get('cache', 1);
         if ($caching) {
             $caching = $mainframe->getCfg('caching');
         }
         $cache = JFactory::getCache('plgCommunityMyGoogleAds');
         $cache->setCaching($caching);
         $callback = array('plgCommunityMyGoogleAds', '_getGoogleAdsHTML');
         $content = $cache->call($callback, $googleCode, $user->id);
     } else {
         // $content = "<div class=\"icon-nopost\"><img src=\"".JURI::base()."components/com_community/assets/error.gif\" alt=\"\" /></div>";
         $content .= "<div class=\"content-nopost\">" . JText::_('PLG_GOOGLE_ADS_NOT_SET') . "</div>";
     }
     return $content;
 }
Exemple #17
0
 /**
  * Get coords by user IP
  * @return type
  */
 public function ajaxGetCoordsByIp()
 {
     $objResponse = new JAXResponse();
     $config = CFactory::getConfig();
     $curl = new CCurl();
     /* Because this function is called by ajax. We can't detect real vistor IP in this function than we need to get it from session */
     $ip = JFactory::getSession()->get('jomsocial_userip');
     /**
      * We do request to 3rd service with our IP to get coords than return ajax to update current coords
      * We can use many method here to get fews of coords. Just update it into our javascript
      * @todo We can allow extend via addon files ?
      */
     /**
      * @url http://www.ipinfodb.com/ip_location_api.php
      */
     $ipinfodbAPIKey = $config->get('geolocation_ipinfodb_key', '40955706fc1ec858891c0a7e1c76672d02c766cf7cee9b3e3bf00bcb1575d252');
     $ipinfodbRequestUrl = 'http://api.ipinfodb.com/v3/ip-city/?key=' . $ipinfodbAPIKey . '&format=json';
     if ($ip) {
         $ipinfodbRequestUrl .= '&ip=' . $ip;
     }
     $response = $curl->post($ipinfodbRequestUrl);
     $body = $response->getBody();
     if ($body) {
         $body = json_decode($body);
         /* We'll response data as much as we have */
         if ($body->latitude != 0 && $body->longitude != 0) {
             $coords['coords'] = $body;
             $objResponse->addScriptCall('joms.location.updateCoords', $coords);
         }
     }
     return $objResponse->sendResponse();
 }
Exemple #18
0
 /**
  * Load up all published moods on startup
  */
 public function __construct()
 {
     $this->enabled = CFactory::getConfig()->get("enablemood");
     $db = JFactory::getDBO();
     $sql = 'SELECT * FROM ' . $db->quoteName('#__community_moods') . ' ORDER BY ' . $db->quoteName('ordering') . ' ASC';
     $db->setQuery($sql);
     $result = $db->loadObjectList();
     // build and pre-parse assoc result array
     foreach ($result as $mood) {
         // legacy - predefined (non-custom) moods use untraslated mood strings as identifiers
         if (!$mood->custom) {
             $mood->id = $mood->title;
             $mood->title = JText::_('COM_COMMUNITY_MOOD_SHORT_' . strtoupper($mood->title));
         }
         // apply description translations for frontend
         $mood->description = JText::_($mood->description);
         if ($mood->custom) {
             $mood->title = JText::_($mood->title);
             $filename = "mood_" . $mood->id . "." . $mood->image;
             if (file_exists(COMMUNITY_PATH_ASSETS . $filename)) {
                 $mood->image = JUri::root() . str_replace(JPATH_ROOT, '', COMMUNITY_PATH_ASSETS) . $filename;
             } else {
                 $mood->image = '';
             }
         }
         $this->moods[$mood->id] = $mood;
     }
     unset($result);
 }
Exemple #19
0
 function display($data = null)
 {
     $mainframe = JFactory::getApplication();
     $config = CFactory::getConfig();
     $document =& JFactory::getDocument();
     $document->setTitle(JText::sprintf('CC FRONTPAGE TITLE', $config->get('sitename')));
     $document->setLink(CRoute::_('index.php?option=com_community'));
     $my = CFactory::getUser();
     CFactory::load('libraries', 'activities');
     CFactory::load('helpers', 'string');
     $act = new CActivityStream();
     $rows = $act->getFEED('', '', null, $mainframe->getCfg('feed_limit'));
     if ($config->get('showactivitystream') == COMMUNITY_SHOW || $config->get('showactivitystream') == COMMUNITY_MEMBERS_ONLY && $my->id != 0) {
         foreach ($rows->data as $row) {
             if ($row->type != 'title') {
                 // load individual item creator class
                 $item = new JFeedItem();
                 // cannot escape the title. it's already formated. we should
                 // escape it during CActivityStream::add
                 //$item->title 		= CStringHelper::escape($row->title);
                 $item->title = $row->title;
                 $item->link = CRoute::_('index.php?option=com_community&view=profile&userid=' . $row->actor);
                 $item->description = "<img src=\"{$row->favicon}\" alt=\"\"/>&nbsp;" . $row->title;
                 $item->date = $row->createdDate;
                 $item->category = '';
                 //$row->category;
                 // Make sure url is absolute
                 $item->description = JString::str_ireplace('href="/', 'href="' . JURI::base(), $item->description);
                 // loads item info into rss array
                 $document->addItem($item);
             }
         }
     }
 }
Exemple #20
0
 /**
  * The default method that will display the output of this view which is called by
  * Joomla
  * 
  * @param	string template	Template file name
  **/
 public function display($tpl = null)
 {
     $document = JFactory::getDocument();
     $config =& CFactory::getConfig();
     // Get required data's
     $events = $this->get('Events');
     $categories = $this->get('Categories');
     $pagination = $this->get('Pagination');
     $mainframe =& JFactory::getApplication();
     $filter_order = $mainframe->getUserStateFromRequest("com_community.events.filter_order", 'filter_order', 'a.title', 'cmd');
     $filter_order_Dir = $mainframe->getUserStateFromRequest("com_community.events.filter_order_Dir", 'filter_order_Dir', '', 'word');
     $search = $mainframe->getUserStateFromRequest("com_community.events.search", 'search', '', 'string');
     // table ordering
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     // We need to assign the users object to the groups listing to get the users name.
     for ($i = 0; $i < count($events); $i++) {
         $row =& $events[$i];
         $row->user = JFactory::getUser($row->creator);
         // Truncate the description
         CFactory::load('helpers', 'string');
         $row->description = CStringHelper::truncate($row->description, $config->get('tips_desc_length'));
     }
     $catHTML = $this->_getCategoriesHTML($categories);
     $this->assignRef('events', $events);
     $this->assignRef('categories', $catHTML);
     $this->assignRef('search', $search);
     $this->assignRef('lists', $lists);
     $this->assignRef('pagination', $pagination);
     parent::display($tpl);
 }
Exemple #21
0
 public function ajaxTogglePublish($id, $type, $eventName = false)
 {
     // Send email notification to owner when a group is published.
     $config = CFactory::getConfig();
     $event = JTable::getInstance('Event', 'CTable');
     $event->load($id);
     // Added published = 2 for new created event under moderation.
     if ($type == 'published' && $event->published == 2) {
         $lang = JFactory::getLanguage();
         $lang->load('com_community', JPATH_ROOT);
         $my = CFactory::getUser();
         // Add notification
         //CFactory::load('libraries', 'notification');
         //CFactory::load('helpers', 'event');
         if ($event->type == CEventHelper::GROUP_TYPE && $event->contentid != 0) {
             $url = 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id . '&groupid=' . $event->contentid;
         } else {
             $url = 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id;
         }
         //Send notification email to owner
         $params = new CParameter('');
         $params->set('url', 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id);
         $params->set('event', $event->title);
         $params->set('event_url', 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id);
         CNotificationLibrary::add('events_notify_creator', $my->id, $event->creator, JText::_('COM_COMMUNITY_EVENTS_PUBLISHED_MAIL_SUBJECT'), '', 'events.notifycreator', $params);
         //CFactory::load('libraries', 'events');
         // Add activity stream for new created event.
         $event->published = 1;
         // by pass published checking.
         CEvents::addEventStream($event);
         // send notification email to group's member for new created event.
         CEvents::addGroupNotification($event);
     }
     return parent::ajaxTogglePublish($id, $type, 'events');
 }
Exemple #22
0
 function getComments($id, $getMore = false)
 {
     $db =& JFactory::getDBO();
     $params = ActivityComments::getParams();
     $order = $params->get('commentordering', 'asc');
     $limit = $params->get('commentlimit', '5');
     $query = 'select a.* from #__community_wall AS a ';
     $query .= 'inner join #__users AS b on a.post_by=b.id ';
     $query .= 'where a.contentid=' . $db->Quote($id) . ' and a.type=' . $db->Quote('activity');
     $query .= 'and b.block=0';
     $query .= ' order by a.id ' . $order;
     if ($limit != 0 && !$getMore) {
         $query .= ' LIMIT 0 ,' . $limit;
     }
     if ($getMore) {
         $total = ActivityComments::getTotalComments($id);
         $query .= ' LIMIT ' . $limit . ',' . $total;
     }
     //echo $query;exit;
     $db->setQuery($query);
     $rows = $db->loadObjectList();
     $config = JFactory::getConfig();
     $my = JFactory::getUser();
     $offset = $my->getParam('timezone', $config->getValue('offset'));
     $config = CFactory::getConfig();
     //Format date
     foreach ($rows as $row) {
         $date = JFactory::getDate($row->date);
         $date->setOffset($offset + $config->get('daylightsavingoffset'));
         $row->date = $date->toMySQL(true);
     }
     return $rows;
 }
Exemple #23
0
 /**
  * Return true if the user can view the frontpage statusbox
  */
 public static function frontpageStatusboxView($userid)
 {
     $config = CFactory::getConfig();
     if ($userid && ($config->get('showactivitystream') == '1' || $config->get('showactivitystream') == '2')) {
         return true;
     }
     return false;
 }
Exemple #24
0
 /**
  * Returns a text representation of the invite body. Determins whether
  * to use html or text mode.	 
  * 
  * @return	String	HTML or raw text for the email content.
  **/
 public function getContent()
 {
     $config = CFactory::getConfig();
     if ($config->get('htmlemail')) {
         return $this->html;
     }
     return $this->text;
 }
Exemple #25
0
 protected function _isEnabled()
 {
     $config = CFactory::getConfig();
     if (!$config->get('antispam_akismet_key') || !$config->get('antispam_enable')) {
         return false;
     }
     return true;
 }
Exemple #26
0
 public function ajaxInvite()
 {
     CFactory::load('libraries', 'facebook');
     $facebook = new CFacebook();
     $config = CFactory::getConfig();
     $tmpl = new CTemplate();
     echo $tmpl->set('facebook', $facebook)->set('config', $config)->set('sitename', $config->get('sitename'))->fetch('facebook.inviteframe');
 }
Exemple #27
0
 function check()
 {
     $config = CFactory::getConfig();
     $safeHtmlFilter = CFactory::getInputFilter($config->get('allowhtml'));
     $this->title = $safeHtmlFilter->clean($this->title);
     $this->message = $safeHtmlFilter->clean($this->message);
     return true;
 }
Exemple #28
0
 public static function getActivities($filters = array())
 {
     jimport('joomla.utilities.date');
     $config = CFactory::getConfig();
     $jinput = JFactory::getApplication()->input;
     $defFilter = array('actid' => $jinput->get('actid', null, 'INT'));
     $filters = array_merge($defFilter, $filters);
 }
 /**
  * Add default items for status box
  */
 static function addDefaultStatusCreator(&$status)
 {
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $my = CFactory::getUser();
     $userid = $jinput->get('userid', $my->id, 'INT');
     //JRequest::getVar('userid', $my->id);
     $user = CFactory::getUser($userid);
     $config = CFactory::getConfig();
     $template = new CTemplate();
     $isMine = COwnerHelper::isMine($my->id, $user->id);
     /* Message creator */
     $creator = new CUserStatusCreator('message');
     $creator->title = JText::_('COM_COMMUNITY_STATUS');
     $creator->html = $template->fetch('status.message');
     $status->addCreator($creator);
     if ($isMine) {
         if ($config->get('enablephotos')) {
             /* Photo creator */
             $creator = new CUserStatusCreator('photo');
             $creator->title = JText::_('COM_COMMUNITY_SINGULAR_PHOTO');
             $creator->html = $template->fetch('status.photo');
             $status->addCreator($creator);
         }
         if ($config->get('enablevideos')) {
             /* Video creator */
             $creator = new CUserStatusCreator('video');
             $creator->title = JText::_('COM_COMMUNITY_SINGULAR_VIDEO');
             $creator->html = $template->fetch('status.video');
             $status->addCreator($creator);
         }
         if ($config->get('enableevents') && ($config->get('createevents') || COwnerHelper::isCommunityAdmin())) {
             /* Event creator */
             //CFactory::load( 'helpers' , 'event' );
             $dateSelection = CEventHelper::getDateSelection();
             $model = CFactory::getModel('events');
             $categories = $model->getCategories();
             // Load category tree
             $cTree = CCategoryHelper::getCategories($categories);
             $lists['categoryid'] = CCategoryHelper::getSelectList('events', $cTree);
             $template->set('startDate', $dateSelection->startDate);
             $template->set('endDate', $dateSelection->endDate);
             $template->set('startHourSelect', $dateSelection->startHour);
             $template->set('endHourSelect', $dateSelection->endHour);
             $template->set('startMinSelect', $dateSelection->startMin);
             $template->set('repeatEnd', $dateSelection->endDate);
             $template->set('enableRepeat', $my->authorise('community.view', 'events.repeat'));
             $template->set('endMinSelect', $dateSelection->endMin);
             $template->set('startAmPmSelect', $dateSelection->startAmPm);
             $template->set('endAmPmSelect', $dateSelection->endAmPm);
             $template->set('lists', $lists);
             $creator = new CUserStatusCreator('event');
             $creator->title = JText::_('COM_COMMUNITY_SINGULAR_EVENT');
             $creator->html = $template->fetch('status.event');
             $status->addCreator($creator);
         }
     }
 }
        /**
         *
         * @param type $userid
         * @param type $limit
         * @param type $limitstart
         * @param type $row
         * @param type $total
         * @return type
         */
        public static function _getLatestPhotoHTML($userid, $limit, $limitstart, $row, $total)
        {
            $config = CFactory::getConfig();
            $photo = JTable::getInstance('Photo', 'CTable');
            $isPhotoModal = $config->get('album_mode') == 1;
            ob_start();
            if (!empty($row)) {
                ?>

                    <ul class="joms-list--thumbnail">
                    <?php 
                $i = 0;
                foreach ($row as $data) {
                    $photo->load($data->id);
                    if ($isPhotoModal) {
                        $link = 'javascript:" onclick="joms.api.photoOpen(\'' . $photo->albumid . '\', \'' . $photo->id . '\');';
                    } else {
                        $link = plgCommunityMyLatestPhotos::buildLink($photo->albumid, $data->id);
                    }
                    $thumbnail = $photo->getThumbURI();
                    ?>
                        <li class="joms-list__item">
                            <a href="<?php 
                    echo $link;
                    ?>
">
                                <img title="<?php 
                    echo CTemplate::escape($photo->caption);
                    ?>
" src="<?php 
                    echo $thumbnail;
                    ?>
">
                            </a>
                        </li>
                        <?php 
                }
                // end foreach
                ?>
                    </ul>

                <?php 
            } else {
                ?>
                <div><?php 
                echo JText::_('PLG_COMMUNITY_MYLATESTPHOTOS_NO_PHOTO');
                ?>
</div>
                <?php 
            }
            ?>

            <?php 
            $contents = ob_get_contents();
            @ob_end_clean();
            $html = $contents;
            return $html;
        }