Ejemplo n.º 1
0
 public static function _getMutualFriendsHTML($userid = null)
 {
     $my = CFactory::getUser();
     if ($my->id == $userid) {
         return;
     }
     $friendsModel = CFactory::getModel('Friends');
     $friends = $friendsModel->getFriends($userid, 'latest', false, 'mutual');
     $html = "<ul class='joms-list--friend single-column'>";
     if (sizeof($friends)) {
         foreach ($friends as $friend) {
             $html .= "<li class='joms-list__item'>";
             $html .= "<div class='joms-list__avatar'>";
             $html .= '<div class="joms-avatar ' . CUserHelper::onlineIndicator($friend) . '"><a href="' . CRoute::_('index.php?option=com_community&view=profile&userid=' . $friend->id) . '">';
             $html .= '<img src="' . $friend->getThumbAvatar() . '" data-author="' . $friend->id . '" />';
             $html .= "</a></div></div>";
             $html .= "<div class='joms-list__body'>";
             $html .= CFriendsHelper::getUserCog($friend->id, null, null, true);
             $html .= CFriendsHelper::getUserFriendDropdown($friend->id);
             $html .= '<a href="' . CRoute::_('index.php?option=com_community&view=profile&userid=' . $friend->id) . '">';
             $html .= '<h4 class="joms-text--username">' . $friend->getDisplayName() . '</h4></a>';
             $html .= '<span class="joms-text--title">' . JText::sprintf('COM_COMMUNITY_TOTAL_MUTUAL_FRIENDS', CFriendsHelper::getTotalMutualFriends($friend->id)) . '</span>';
             $html .= "</div></li>";
         }
         $html .= "</ul>";
     } else {
         $html .= JText::_('COM_COMMUNITY_NO_MUTUAL_FRIENDS');
     }
     return $html;
 }
Ejemplo n.º 2
0
 /**
  * This method should handle any login logic and report back to the subject
  * For Joomla 1.6, onLoginUser is now onUserLogin
  *
  * @access	public
  * @param 	array 	holds the user data
  * @param 	array    extra options
  * @return	boolean	True on success
  * @since	1.6
  */
 public function onUserLogin($user, $options)
 {
     $app = JFactory::getApplication();
     $cUser = CFactory::getUser(CUserHelper::getUserId($user['username']));
     if ($cUser->block) {
         $app->setUserState('users.login.form.return', 'index.php?option=com_users&view=profile');
     }
     return $this->onLoginUser($user, $options);
 }
Ejemplo n.º 3
0
 public function _buildQuery()
 {
     $db = JFactory::getDBO();
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $actor = $jinput->get('actor', '', 'NONE');
     //JRequest::getVar( 'actor' , '' );
     $archived = JRequest::getInt('archived', 0);
     $app = $jinput->get('app', 'none', 'NONE');
     //JRequest::getVar( 'app' , 'none' );
     $where = array();
     $userId = 0;
     if (!empty($actor)) {
         $userId = CUserHelper::getUserId($actor);
     }
     if ($userId != 0) {
         $where[] = 'actor=' . $db->Quote($userId) . ' ';
     }
     if ($archived != 0) {
         $archived = $archived - 1;
         $where[] = 'archived=' . $db->Quote($archived) . ' ';
     }
     if ($app != 'none') {
         $where[] = 'app=' . $db->Quote($app);
     }
     $query = 'SELECT * FROM ' . $db->quoteName('#__community_activities');
     if (!empty($where)) {
         for ($i = 0; $i < count($where); $i++) {
             if ($i == 0) {
                 $query .= ' WHERE ';
             } else {
                 $query .= ' AND ';
             }
             $query .= $where[$i];
         }
     }
     $query .= ' ORDER BY created DESC';
     return $query;
 }
Ejemplo n.º 4
0
 public function _updateFirstLastName($user, $profileType = COMMUNITY_DEFAULT_PROFILE)
 {
     $profileModel = CFactory::getModel('profile');
     $filter = array('fieldcode' => 'FIELD_FAMILYNAME');
     $fields = $profileModel->getAllFields($filter, $profileType);
     if (!empty($fields)) {
         $isUseFirstLastName = CUserHelper::isUseFirstLastName();
         if ($isUseFirstLastName) {
             $tmpUserModel = CFactory::getModel('register');
             $mySess = JFactory::getSession();
             $tmpUser = $tmpUserModel->getTempUser($mySess->get('JS_REG_TOKEN', ''));
             $fullname = array();
             $fullname[$profileModel->getFieldId('FIELD_GIVENNAME')] = $tmpUser->firstname;
             $fullname[$profileModel->getFieldId('FIELD_FAMILYNAME')] = $tmpUser->lastname;
             $pModel = $this->getModel('profile');
             $pModel->saveProfile($user->id, $fullname);
         }
     }
 }
Ejemplo n.º 5
0
 public function ajaxeditComment($id, $value, $photoId = 0)
 {
     $config = CFactory::getConfig();
     $my = CFactory::getUser();
     $actModel = CFactory::getModel('activities');
     $objResponse = new JAXResponse();
     $json = array();
     if ($my->id == 0) {
         $this->blockUnregister();
     }
     $wall = JTable::getInstance('wall', 'CTable');
     $wall->load($id);
     $cid = isset($wall->contentid) ? $wall->contentid : null;
     $activity = $actModel->getActivity($cid);
     $ownPost = $my->id == $wall->post_by;
     $targetPost = $activity->target == $my->id;
     $allowEdit = COwnerHelper::isCommunityAdmin() || ($ownPost || $targetPost) && !empty($my->id);
     $value = trim($value);
     if (empty($value)) {
         $json['error'] = JText::_('COM_COMMUNITY_CANNOT_EDIT_COMMENT_ERROR');
     } else {
         if ($config->get('wallediting') && $allowEdit) {
             $params = new CParameter($wall->params);
             //if photo id is not 0, this wall is appended with a picture
             if ($photoId > 0 && $params->get('attached_photo_id') != $photoId) {
                 //lets check if the photo belongs to the uploader
                 $photo = JTable::getInstance('Photo', 'CTable');
                 $photo->load($photoId);
                 if ($photo->creator == $my->id && $photo->albumid == '-1') {
                     $params->set('attached_photo_id', $photoId);
                     //sets the status to ready so that it wont be deleted on cron run
                     $photo->status = 'ready';
                     $photo->store();
                 }
             } else {
                 if ($photoId == -1) {
                     //if there is nothing, remove the param if applicable
                     //delete from db and files
                     $photoModel = CFactory::getModel('photos');
                     $photoTable = $photoModel->getPhoto($params->get('attached_photo_id'));
                     $photoTable->delete();
                     $params->set('attached_photo_id', 0);
                 }
             }
             $wall->params = $params->toString();
             $wall->comment = $value;
             $wall->store();
             $CComment = new CComment();
             $value = $CComment->stripCommentData($value);
             // Need to perform basic formatting here
             // 1. support nl to br,
             // 2. auto-link text
             $CTemplate = new CTemplate();
             $value = $origValue = $CTemplate->escape($value);
             $value = CStringHelper::autoLink($value);
             $value = nl2br($value);
             $value = CUserHelper::replaceAliasURL($value);
             $value = CStringHelper::getEmoticon($value);
             $json['comment'] = $value;
             $json['originalComment'] = $origValue;
             // $objResponse->addScriptCall("joms.jQuery('div[data-commentid=" . $id . "] .cStream-Content span.comment').html", $value);
             // $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] [data-type=stream-comment-editor] textarea").val', $origValue);
             // $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] [data-type=stream-comment-editor] textarea").removeData', 'initialized');
             // if ($photoId == -1) {
             //     $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] .joms-stream-thumb").parent().remove', '');
             //     $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] .joms-stream-attachment").css("display", "none").attr("data-no_thumb", 1);');
             //     $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] .joms-thumbnail").html', '<img/>');
             // } else if ($photoId != 0) {
             //     $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] .joms-fetch-wrapper").remove', '');
             //     $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] .joms-stream-thumb").parent().remove', '');
             //     $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] [data-type=stream-comment-content] .cStream-Meta").before', '<div style="padding: 5px 0"><img class="joms-stream-thumb" src="' . JUri::root(true) ."/". $photo->thumbnail . '" /></div>');
             //     $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] .joms-stream-attachment").css("display", "block").removeAttr("data-no_thumb");');
             //     $objResponse->addScriptCall('joms.jQuery("div[data-commentid=' . $id . '] .joms-thumbnail img").attr("src", "' . JUri::root(true) ."/". $photo->thumbnail . '").attr("data-photo_id", "0").data("photo_id", 0);');
             // }
         } else {
             $json['error'] = JText::_('COM_COMMUNITY_NOT_ALLOWED_TO_EDIT');
         }
     }
     if (!isset($json['error'])) {
         $json['success'] = true;
     }
     die(json_encode($json));
 }
Ejemplo n.º 6
0
                    if (!is_array($users)) {
                        $users = array_reverse(explode(',', $users));
                    }
                    $user = CFactory::getUser($users[0]);
                    $date = JFactory::getDate($act->created);
                    if ($config->get('activitydateformat') == "lapse") {
                        $createdTime = CTimeHelper::timeLapse($date);
                    } else {
                        $createdTime = $date->format($config->get('profileDateFormat'));
                    }
                    $isPhotoModal = $config->get('album_mode') == 1;
                    ?>

<div class="joms-stream__header">
    <div class= "joms-avatar--stream <?php 
                    echo CUserHelper::onlineIndicator($user);
                    ?>
">
        <?php 
                    if (count($users) > 1 && false) {
                        // added false for now because we have to show the last user avatar
                        ?>
            <svg class="joms-icon" viewBox="0 0 16 16">
                <use xlink:href="<?php 
                        echo CRoute::getURI();
                        ?>
#joms-icon-users"></use>
            </svg>
        <?php 
                    } else {
                        ?>
Ejemplo n.º 7
0
 public function renderComment($cmtObj)
 {
     $my = CFactory::getUser();
     $user = CFactory::getUser($cmtObj->creator);
     // Process the text
     CFactory::load('helpers', 'string');
     $cmtObj->text = nl2br(CStringHelper::escape($cmtObj->text));
     //format the date
     $dateObject = CTimeHelper::getDate($cmtObj->date);
     $date = C_JOOMLA_15 == 1 ? $dateObject->toFormat(JText::_('DATE_FORMAT_LC2')) : $dateObject->Format(JText::_('DATE_FORMAT_LC2'));
     $html = '';
     $html .= '<div class="cComment">';
     CFactory::load('helpers', 'user');
     $html .= CUserHelper::getThumb($user->id, 'wall-coc-avatar');
     CFactory::load('helpers', 'string');
     $html = CStringHelper::replaceThumbnails($html);
     $html .= '<a class="wall-coc-author" href="' . CRoute::_('index.php?option=com_community&view=profile&userid=' . $user->id) . '">' . $user->getDisplayName() . '</a> ';
     $html .= JText::sprintf('COM_COMMUNITY_COMMENT_POSTED_ON', '<span class="wall-coc-date">' . $date . '</span>');
     CFactory::load('helpers', 'owner');
     if ($my->id == $user->id || COwnerHelper::isCommunityAdmin()) {
         $html .= ' | <a class="coc-remove coc-' . $cmtObj->creator . '" onclick="joms.comments.remove(this);" href="javascript:void(0)">' . JText::_('COM_COMMUNITY_REMOVE') . '</a>';
     }
     $html .= '<p>' . $cmtObj->text . '</p>';
     $html .= '</div>';
     return $html;
 }
Ejemplo n.º 8
0
function getBlockUserHTML($userId, $isBlocked)
{
    return CUserHelper::getBlockUserHTML($userId, $isBlocked);
}
Ejemplo n.º 9
0
    ?>
        </div>

        <!-- Group's Members @ Sidebar -->
        <?php 
    if ($members) {
        ?>
            <div id="joms-group--members" class="joms-tab__content">

                <ul class="joms-list--photos clearfix">
                    <?php 
        foreach ($members as $member) {
            ?>
                        <li class="joms-list__item">
                            <div class="joms-avatar <?php 
            echo CUserHelper::onlineIndicator($member);
            ?>
">
                                <a href="<?php 
            echo CUrlHelper::userLink($member->id);
            ?>
">
                                    <img
                                        src="<?php 
            echo $member->getThumbAvatar();
            ?>
"
                                        title="<?php 
            echo CTooltip::cAvatarTooltip($member);
            ?>
"
Ejemplo n.º 10
0
/**
 * Deprecated since 1.8
 * Use CUserHelper::replaceAliasURL instead.
 */
function cGenerateUserAliasLinks($message)
{
    return CUserHelper::replaceAliasURL($message);
}
Ejemplo n.º 11
0
 /**
  * Edits a user details
  *
  * @access	public
  * @param	array  An associative array to display the editing of the fields
  */
 function editDetails(&$data)
 {
     $mainframe =& JFactory::getApplication();
     // access check
     CFactory::setActiveProfile();
     if (!$this->accessAllowed('registered')) {
         return;
     }
     $my = CFactory::getUser();
     $config = CFactory::getConfig();
     $pathway =& $mainframe->getPathway();
     $pathway->addItem(JText::_($my->getDisplayName()), CRoute::_('index.php?option=com_community&view=profile&userid=' . $my->id));
     $pathway->addItem(JText::_('CC EDIT DETAILS'), '');
     $document =& JFactory::getDocument();
     $document->setTitle(JText::_('CC EDIT DETAILS'));
     $js = 'assets/validate-1.5';
     $js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js';
     CAssets::attach($js, 'js');
     $this->showSubmenu();
     $connectModel = CFactory::getModel('Connect');
     $associated = $connectModel->isAssociated($my->id);
     CFactory::load('helpers', 'owner');
     CFactory::load('libraries', 'facebook');
     $fbHtml = '';
     if ($config->get('fbconnectkey') && $config->get('fbconnectsecret')) {
         CFactory::load('libraries', 'facebook');
         $facebook = new CFacebook();
         $fbHtml = $facebook->getLoginHTML();
     }
     // If FIELD_GIVENNAME & FIELD_FAMILYNAME is in use
     CFactory::load('helpers', 'user');
     $isUseFirstLastName = CUserHelper::isUseFirstLastName();
     $jConfig =& JFactory::getConfig();
     CFactory::load('libraries', 'apps');
     $app =& CAppPlugins::getInstance();
     $appFields = $app->triggerEvent('onFormDisplay', array('jsform-profile-editdetails'));
     $beforeFormDisplay = CFormElement::renderElements($appFields, 'before');
     $afterFormDisplay = CFormElement::renderElements($appFields, 'after');
     $tmpl = new CTemplate();
     $tmpl->set('beforeFormDisplay', $beforeFormDisplay);
     $tmpl->set('afterFormDisplay', $afterFormDisplay);
     $tmpl->set('fbHtml', $fbHtml);
     $tmpl->set('jConfig', $jConfig);
     $tmpl->set('params', $data->params);
     $tmpl->set('user', $my);
     $tmpl->set('config', $config);
     $tmpl->set('associated', $associated);
     $tmpl->set('isAdmin', COwnerHelper::isCommunityAdmin());
     $tmpl->set('offsetList', $data->offsetList);
     $tmpl->set('isUseFirstLastName', $isUseFirstLastName);
     echo $tmpl->fetch('profile.edit.details');
 }
    //break if it has more than 3
    ?>
                <li class="joms-list__item">
                    <a  href="<?php 
    echo CRoute::_('index.php?option=com_community&view=groups&task=viewdiscussion&groupid=' . $disc->groupid . '&topicid=' . $disc->id);
    ?>
">
                        <?php 
    echo $disc->title;
    ?>
                    </a>
                    <?php 
    if ($disc->lastmessage != null) {
        ?>
                    <span class="joms-block"><?php 
        echo JHTML::_('string.truncate', CUserHelper::replaceAliasURL($disc->lastmessage, false, true), 150);
        ?>
</span>
                    <?php 
    }
    ?>
                    <div class="joms-text--light joms-text--small">
                        <a href="<?php 
    echo CRoute::_('index.php?option=com_community&view=groups&task=viewdiscussion&groupid=' . $disc->groupid . '&topicid=' . $disc->id);
    ?>
">
                            <?php 
    echo JText::sprintf(CStringHelper::isPlural($disc->count) ? 'COM_COMMUNITY_TOTAL_REPLIES_MANY' : 'COM_COMMUNITY_GROUPS_DISCUSSION_REPLY_COUNT', $disc->count);
    ?>
                        </a>
Ejemplo n.º 13
0
 /**
  * Frontpage display
  * @param type $tpl
  */
 public function display($tpl = null)
 {
     /**
      * Init variables
      */
     $config = CFactory::getConfig();
     $document = JFactory::getDocument();
     $usersConfig = JComponentHelper::getParams('com_users');
     $my = CFactory::getUser();
     $model = CFactory::getModel('user');
     /**
      * Opengraph
      */
     CHeadHelper::setType('website', JText::sprintf('COM_COMMUNITY_FRONTPAGE_TITLE', $config->get('sitename')));
     /**
      * Init document
      */
     $feedLink = CRoute::_('index.php?option=com_community&view=frontpage&format=feed');
     $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('COM_COMMUNITY_SUBSCRIBE_RECENT_ACTIVITIES_FEED') . '" href="' . $feedLink . '"/>';
     $document->addCustomTag($feed);
     // Process headers HTML output
     $headerHTML = '';
     $tmpl = new CTemplate();
     $alreadyLogin = 0;
     /* User is logged */
     if ($my->id != 0) {
         $headerHTML = $tmpl->fetch('frontpage.members');
         $alreadyLogin = 1;
     } else {
         /* User is not logged */
         $uri = CRoute::_('index.php?option=com_community&view=' . $config->get('redirect_login'), false);
         $uri = base64_encode($uri);
         $fbHtml = '';
         /* Facebook login */
         if ($config->get('fbconnectkey') && $config->get('fbconnectsecret') && !$config->get('usejfbc')) {
             $facebook = new CFacebook();
             $fbHtml = $facebook->getLoginHTML();
         }
         /* Joomla! Facebook Connect */
         if ($config->get('usejfbc')) {
             if (class_exists('JFBCFactory')) {
                 $providers = JFBCFactory::getAllProviders();
                 foreach ($providers as $p) {
                     $fbHtml .= $p->loginButton();
                 }
             }
         }
         //hero image
         $heroImage = JURI::root() . 'components/com_community/assets/frontpage-image-default.jpg';
         if (file_exists(COMMUNITY_PATH_ASSETS . 'frontpage-image.jpg')) {
             $heroImage = JURI::root() . 'components/com_community/assets/frontpage-image.jpg';
         } else {
             if (file_exists(COMMUNITY_PATH_ASSETS . 'frontpage-image.png')) {
                 $heroImage = JURI::root() . 'components/com_community/assets/frontpage-image.png';
             }
         }
         //add the hero image as the image metatdata
         $imgMeta = '<meta property="og:image" content="' . $heroImage . '"/>';
         $document->addCustomTag($imgMeta);
         $themeModel = CFactory::getModel('theme');
         $settings = $themeModel->getSettings();
         /* Generate header HTML for guest */
         if ($settings['general']['enable-frontpage-login']) {
             $headerHTML = $tmpl->set('allowUserRegister', $usersConfig->get('allowUserRegistration'))->set('heroImage', $heroImage)->set('fbHtml', $fbHtml)->set('useractivation', $usersConfig->get('useractivation'))->set('return', $uri)->set('settings', $settings)->fetch('frontpage/guest');
         } else {
             $headerHTML = '';
         }
     }
     /* Get site members count */
     $totalMembers = $model->getMembersCount();
     $latestActivitiesData = $this->showLatestActivities();
     $latestActivitiesHTML = $latestActivitiesData['HTML'];
     $tmpl = new CTemplate();
     $tmpl->set('totalMembers', $totalMembers)->set('my', $my)->set('alreadyLogin', $alreadyLogin)->set('header', $headerHTML)->set('userActivities', $latestActivitiesHTML)->set('config', $config)->set('customActivityHTML', $this->getCustomActivityHTML());
     $status = new CUserStatus();
     if ($my->authorise('community.view', 'frontpage.statusbox')) {
         // Add default status box
         CUserHelper::addDefaultStatusCreator($status);
         if (COwnerHelper::isCommunityAdmin() && $config->get('custom_activity')) {
             $template = new CTemplate();
             $template->set('customActivities', CActivityStream::getCustomActivities());
             $creator = new CUserStatusCreator('custom');
             $creator->title = JText::_('COM_COMMUNITY_CUSTOM');
             $creator->html = $template->fetch('status.custom');
             $status->addCreator($creator);
         }
     }
     /**
      * Misc variables
      * @since 3.3
      * Move out variable init in side template into view
      */
     $moduleCount = count(JModuleHelper::getModules('js_side_frontpage')) + count(JModuleHelper::getModules('js_side_top')) + count(JModuleHelper::getModules('js_side_bottom')) + count(JModuleHelper::getModules('js_side_frontpage_top')) + count(JModuleHelper::getModules('js_side_frontpage_bottom')) + count(JModuleHelper::getModules('js_side_frontpage_stacked')) + count(JModuleHelper::getModules('js_side_top_stacked')) + count(JModuleHelper::getModules('js_side_bottom_stacked')) + count(JModuleHelper::getModules('js_side_frontpage_top_stacked')) + count(JModuleHelper::getModules('js_side_frontpage_bottom_stacked'));
     $jinput = JFactory::getApplication()->input;
     /**
      * @todo 3.3
      * All of these code must be provided in object. DO NOT PUT ANY CODE LOGIC HERE !
      */
     $cconfig = CFactory::getConfig();
     $filter = $jinput->get('filter');
     $filterValue = $jinput->get('value', 'default_value', 'RAW');
     $filterText = JText::_("COM_COMMUNITY_FILTERBAR_ALL");
     $filterHashtag = false;
     $filterKeyword = false;
     if ($filter == 'apps') {
         switch ($filterValue) {
             case 'profile':
                 $filterText = JText::_("COM_COMMUNITY_FILTERBAR_TYPE_STATUS");
                 break;
             case 'photo':
                 $filterText = JText::_("COM_COMMUNITY_FILTERBAR_TYPE_PHOTO");
                 break;
             case 'video':
                 $filterText = JText::_("COM_COMMUNITY_FILTERBAR_TYPE_VIDEO");
                 break;
             case 'group':
                 $filterText = JText::_("COM_COMMUNITY_FILTERBAR_TYPE_GROUP");
                 break;
             case 'event':
                 $filterText = JText::_("COM_COMMUNITY_FILTERBAR_TYPE_EVENT");
                 break;
         }
     } else {
         if ($filter == 'hashtag') {
             $filterText = JText::_("COM_COMMUNITY_FILTERBAR_TYPE_HASHTAG") . ' #' . $filterValue;
             $filterHashtag = true;
         } else {
             if ($filter == 'keyword') {
                 $filterText = JText::_("COM_COMMUNITY_FILTERBAR_TYPE_KEYWORD") . ' ' . $filterValue;
                 $filterKeyword = true;
             } else {
                 switch ($filterValue) {
                     case 'me-and-friends':
                         $filterText = JText::_("COM_COMMUNITY_FILTERBAR_RELATIONSHIP_ME_AND_FRIENDS");
                         break;
                 }
             }
         }
     }
     echo $tmpl->set('userstatus', $status)->set('moduleCount', $moduleCount)->set('class', $moduleCount > 0 ? 'span8' : 'span12')->set('filterKey', $filter)->set('filter', $filter)->set('filterText', $filterText)->set('filterHashtag', $filterHashtag)->set('filterKeyword', $filterKeyword)->set('filterValue', $filterValue)->fetch('frontpage/base');
 }
							<?php 
        echo $discussion['created_interval'];
        ?>
						</small>
					</span>
				</div>
			</div>
			<div class="joms-stream__body">
				<?php 
        // Escape content
        $discussion['comment'] = CTemplate::escape($discussion['comment']);
        $discussion['comment'] = CStringHelper::autoLink($discussion['comment']);
        $discussion['comment'] = nl2br($discussion['comment']);
        $discussion['comment'] = CStringHelper::getEmoticon($discussion['comment']);
        $discussion['comment'] = CStringHelper::converttagtolink($discussion['comment']);
        $discussion['comment'] = CUserHelper::replaceAliasURL($discussion['comment']);
        echo substr($discussion['comment'], 0, 250);
        if (strlen($discussion['comment']) > 250) {
            echo ' ...';
        }
        // @TODO: DRY
        $video = JTable::getInstance('Video', 'CTable');
        if ($video->init($params->get('url'))) {
            $video->isValid();
        } else {
            $video = false;
        }
        if (is_object($video)) {
            ?>
                    <div class="joms-media--video joms-js--video"
                            data-type="<?php 
Ejemplo n.º 15
0
 /**
  * Update the status of current user
  */
 public function ajaxUpdate($message = '')
 {
     $filter = JFilterInput::getInstance();
     $message = $filter->clean($message, 'string');
     $cache = CFactory::getFastCache();
     $cache->clean(array('activities'));
     if (!COwnerHelper::isRegisteredUser()) {
         return $this->ajaxBlockUnregister();
     }
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $objResponse = new JAXResponse();
     //@rule: In case someone bypasses the status in the html, we enforce the character limit.
     $config = CFactory::getConfig();
     if (JString::strlen($message) > $config->get('statusmaxchar')) {
         $message = JHTML::_('string.truncate', $message, $config->get('statusmaxchar'));
     }
     //trim it here so that it wun go into activities stream.
     $message = JString::trim($message);
     $my = CFactory::getUser();
     $status = $this->getModel('status');
     // @rule: Spam checks
     if ($config->get('antispam_akismet_status')) {
         //CFactory::load( 'libraries' , 'spamfilter' );
         $filter = CSpamFilter::getFilter();
         $filter->setAuthor($my->getDisplayName());
         $filter->setMessage($message);
         $filter->setEmail($my->email);
         $filter->setURL(CRoute::_('index.php?option=com_community&view=profile&userid=' . $my->id));
         $filter->setType('message');
         $filter->setIP($_SERVER['REMOTE_ADDR']);
         if ($filter->isSpam()) {
             $objResponse->addAlert(JText::_('COM_COMMUNITY_STATUS_MARKED_SPAM'));
             return $objResponse->sendResponse();
         }
     }
     $status->update($my->id, $message);
     //set user status for current session.
     $today = JFactory::getDate();
     $message2 = empty($message) ? ' ' : $message;
     $my->set('_status', $message2);
     $my->set('_posted_on', $today->toSql());
     $profileid = $jinput->get->get('userid', 0, 'INT');
     //JRequest::getVar('userid' , 0 , 'GET');
     if (COwnerHelper::isMine($my->id, $profileid)) {
         $objResponse->addScriptCall("joms.jQuery('#profile-status span#profile-status-message').html('" . addslashes($message) . "');");
     }
     //CFactory::load( 'helpers' , 'string' );
     // $message		= CStringHelper::escape( $message );
     if (!empty($message)) {
         $act = new stdClass();
         $act->cmd = 'profile.status.update';
         $act->actor = $my->id;
         $act->target = $my->id;
         //CFactory::load( 'helpers' , 'linkgenerator' );
         // @rule: Autolink hyperlinks
         $message = CLinkGeneratorHelper::replaceURL($message);
         // @rule: Autolink to users profile when message contains @username
         $message = CUserHelper::replaceAliasURL($message);
         $privacyParams = $my->getParams();
         $act->title = $message;
         $act->content = '';
         $act->app = 'profile';
         $act->cid = $my->id;
         $act->access = $privacyParams->get('privacyProfileView');
         $act->comment_id = CActivities::COMMENT_SELF;
         $act->comment_type = 'profile.status';
         $act->like_id = CActivities::LIKE_SELF;
         $act->like_type = 'profile.status';
         //add user points
         //CFactory::load( 'libraries' , 'userpoints' );
         if (CUserPoints::assignPoint('profile.status.update')) {
             //only assign act if user points is set to true
             CActivityStream::add($act);
         }
         //now we need to reload the activities streams (since some report regarding update status from hello me we disabled update the stream, cuz hellome usually called  out from jomsocial page)
         $friendsModel = CFactory::getModel('friends');
         $memberSince = CTimeHelper::getDate($my->registerDate);
         $friendIds = $friendsModel->getFriendIds($my->id);
         //include_once(JPATH_COMPONENT .'/libraries/activities.php');
         $act = new CActivityStream();
         $params = $my->getParams();
         $limit = !empty($params) ? $params->get('activityLimit', '') : '';
         //$html	= $act->getHTML($my->id, $friendIds, $memberSince, $limit );
         $status = $my->getStatus();
         $status = str_replace(array("\r\n", "\n", "\r"), "", $status);
         $status = addslashes($status);
         // also update hellome module if available
         $script = "joms.jQuery('.joms-js--mod-hellome-label').html('" . $status . "');";
         $script .= "joms.jQuery('.joms-js--mod-hellome-loading').hide();";
         $objResponse->addScriptCall($script);
     }
     return $objResponse->sendResponse();
 }
Ejemplo n.º 16
0
" 
                        alt=""
                        <?php 
            echo $params->get('show_image', 2) == 1 ? 'data-author="' . $comment->post_by . '"' : '';
            ?>
                         />
                    </a>
                </div>
            <?php 
        }
        ?>


                <div class="joms-stream__meta">
                    "<?php 
        echo CUserHelper::replaceAliasURL(CStringHelper::escape($comment->comment), false, true);
        ?>
" by
                    <a href="<?php 
        echo CRoute::_('index.php?option=com_community&view=profiles&userid=' . $comment->post_by);
        ?>
"><?php 
        echo CFactory::getUser($comment->post_by)->getDisplayName();
        ?>
</a>
                    <div class="joms-text--light"><small><?php 
        echo $createdTime;
        ?>
</small></div>

                </div>
Ejemplo n.º 17
0
        ?>
            <li class="joms-list__item">
                <?php 
        if (in_array($row->user->id, $featuredList)) {
            ?>
                <div class="joms-ribbon__wrapper">
                    <span class="joms-ribbon"><?php 
            echo JText::_('COM_COMMUNITY_FEATURED');
            ?>
</span>
                </div>
                <?php 
        }
        ?>
                <div class="joms-list__avatar <?php 
        echo CUserHelper::onlineIndicator($row->user);
        ?>
">
                    <a href="<?php 
        echo $row->user->profileLink;
        ?>
" class="joms-avatar">
                        <img data-author="<?php 
        echo $row->user->id;
        ?>
" src="<?php 
        echo $row->user->getThumbAvatar();
        ?>
" alt="<?php 
        echo $row->user->getDisplayName();
        ?>
Ejemplo n.º 18
0
 public function ajaxRemoveUserTag($id, $type = 'comment')
 {
     $my = CFactory::getUser();
     if ($my->id == 0) {
         $this->ajaxBlockUnregister();
     }
     // Remove tag.
     $updatedMessage = CApiActivities::removeUserTag($id, $type);
     $origValue = $updatedMessage;
     $value = CStringHelper::autoLink($origValue);
     $value = nl2br($value);
     $value = CUserHelper::replaceAliasURL($value);
     $value = CStringHelper::getEmoticon($value);
     $json = array('success' => true, 'unparsed' => $origValue, 'data' => $value);
     die(json_encode($json));
 }
Ejemplo n.º 19
0
* The PHP code portions are distributed under the GPL license. If not otherwise stated, all images, manuals, cascading style sheets, and included JavaScript *are NOT GPL, and are released under the IJOOMLA Proprietary Use License v1.0
* More info at https://www.jomsocial.com/license-agreement
*/
defined('_JEXEC') or die;
?>
<div class="joms-js--member-module">
    <div class="joms-gap"></div>
    <ul class="joms-list--thumbnail clearfix">

        <?php 
if (count($members) > 0) {
    foreach ($members as $member) {
        ?>
                    <li class="joms-list__item">
                        <div class="joms-avatar <?php 
        echo $filter == 4 ? 'joms-online' : CUserHelper::onlineIndicator($member);
        ?>
">
                            <a href="<?php 
        echo CRoute::_('index.php?option=com_community&view=profile&userid=' . $member->id);
        ?>
">
                                <img src="<?php 
        echo $member->getThumbAvatar();
        ?>
"
                                     title="<?php 
        echo CTooltip::cAvatarTooltip($member);
        ?>
"
                                     alt="<?php 
Ejemplo n.º 20
0
    echo $stream->actor->getThumbAvatar();
    ?>
" alt="<?php 
    echo $stream->actor->getDisplayName();
    ?>
">
        </a>
    </div>

<?php 
} else {
    ?>

<div class="joms-stream__header">
    <div class="joms-avatar--stream <?php 
    echo CUserHelper::onlineIndicator($stream->actor);
    ?>
">
        <img src="components/com_community/assets/user-Male-thumb.png" alt="male" data-author="<?php 
    echo $stream->actor->id;
    ?>
" />
    </div>

<?php 
}
?>

    <div class="joms-stream__meta">
        <?php 
echo $stream->headline;
Ejemplo n.º 21
0
 function _getWallHTML($wall, $wallComments, $appType, $isOwner, $processFunc, $templateFile)
 {
     CFactory::load('helpers', 'url');
     CFactory::load('helpers', 'user');
     CFactory::load('helpers', 'videos');
     CFactory::load('libraries', 'comment');
     CFactory::load('helpers', 'owner');
     CFactory::load('helpers', 'time');
     $user = CFactory::getUser($wall->post_by);
     $date = CTimeHelper::getDate($wall->date);
     $config = CFactory::getConfig();
     // @rule: for site super administrators we want to allow them to view the remove link
     $isOwner = COwnerHelper::isCommunityAdmin() ? true : $isOwner;
     $isEditable = CWall::isEditable($processFunc, $wall->id);
     // Apply any post processing on the content
     $wall->comment = CWallLibrary::_processWallContent($wall->comment);
     $commentsHTML = '';
     $comment = new CComment();
     // If the wall post is a user wall post (in profile pages), we
     // add wall comment feature
     if ($appType == 'user' || $appType == 'groups' || $appType == 'events') {
         $commentsHTML = $comment->getHTML($wallComments, 'wall-cmt-' . $wall->id, CWall::canComment($wall->type, $wall->contentid));
     }
     $avatarHTML = CUserHelper::getThumb($wall->post_by, 'avatar');
     //var_dump($avatarHTML);exit;
     // @rule: We only allow editing of wall in 15 minutes
     $now = JFactory::getDate();
     $interval = CTimeHelper::timeIntervalDifference($wall->date, $now->toMySQL());
     $interval = COMMUNITY_WALLS_EDIT_INTERVAL - abs($interval);
     $editInterval = round($interval / 60);
     // Create new instance of the template
     $tmpl = new CTemplate();
     $tmpl->set('id', $wall->id);
     $tmpl->set('author', $user->getDisplayName());
     $tmpl->set('avatarHTML', $avatarHTML);
     $tmpl->set('authorLink', CUrlHelper::userLink($user->id));
     $tmpl->set('created', $date->toFormat(JText::_('DATE_FORMAT_LC2')));
     $tmpl->set('content', $wall->comment);
     $tmpl->set('commentsHTML', $commentsHTML);
     $tmpl->set('avatar', $user->getThumbAvatar());
     $tmpl->set('isMine', $isOwner);
     $tmpl->set('isEditable', $isEditable);
     $tmpl->set('editInterval', $editInterval);
     $tmpl->set('processFunc', $processFunc);
     $tmpl->set('config', $config);
     return $tmpl->fetch($templateFile);
 }
Ejemplo n.º 22
0
 /**
  * Show the message reading window
  */
 public function read($data)
 {
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     if (!$this->accessAllowed('registered')) {
         return;
     }
     $config = CFactory::getConfig();
     if (!$config->get('enablepm')) {
         echo JText::_('COM_COMMUNITY_PRIVATE_MESSAGING_DISABLED');
         return;
     }
     //page title
     $document = JFactory::getDocument();
     $inboxModel = CFactory::getModel('inbox');
     $my = CFactory::getUser();
     $msgid = $jinput->request->get('msgid', 0, 'INT');
     if (!$inboxModel->canRead($my->id, $msgid)) {
         $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_PERMISSION_DENIED_WARNING'), 'error');
         return;
     }
     $pathway = $mainframe->getPathway();
     $pathway->addItem($this->escape(JText::_('COM_COMMUNITY_INBOX_TITLE')), CRoute::_('index.php?option=com_community&view=inbox'));
     $parentData = '';
     $html = '';
     $messageHeading = '';
     $recipient = array();
     $parentData = $inboxModel->getMessage($msgid);
     if (!empty($data->messages)) {
         $document = JFactory::getDocument();
         $pathway->addItem($this->escape(htmlspecialchars_decode($parentData->subject)));
         $document->setTitle(htmlspecialchars_decode($parentData->subject));
         require_once COMMUNITY_COM_PATH . '/libraries/apps.php';
         $appsLib = CAppPlugins::getInstance();
         $appsLib->loadApplications();
         $config = CFactory::getConfig();
         $pagination = intval($config->get('stream_default_comments', 5));
         $count = count($data->messages);
         $hide = true;
         foreach ($data->messages as $row) {
             $count--;
             if ($count < $pagination) {
                 $hide = false;
             }
             // onMessageDisplay Event trigger
             $args = array();
             $originalBodyContent = $row->body;
             $row->body = new JRegistry($row->body);
             if ($row->body == '{}') {
                 //backward compatibility, save the old data into content parameter if needed
                 $newParam = new CParameter();
                 $newParam->set('content', $originalBodyContent);
                 $table = JTable::getInstance('Message', 'CTable');
                 $table->load($row->id);
                 $table->body = $newParam->toString();
                 $table->store();
                 $row->body = new CParameter($table->body);
             }
             // Escape content
             $content = $originalContent = $row->body->get('content');
             $content = CTemplate::escape($content);
             $content = CStringHelper::autoLink($content);
             $content = nl2br($content);
             $content = CStringHelper::getEmoticon($content);
             $content = CStringHelper::converttagtolink($content);
             $content = CUserHelper::replaceAliasURL($content);
             $params = $row->body;
             $args[] = $row;
             $appsLib->triggerEvent('onMessageDisplay', $args);
             $user = CFactory::getUser($row->from);
             //construct the delete link
             $deleteLink = CRoute::_('index.php?option=com_community&view=inbox&task=remove&msgid=' . $row->id);
             $authorLink = CRoute::_('index.php?option=com_community&view=profile&userid=' . $user->id);
             //get thumbnail if available
             $photoThumbnail = '';
             if ($params->get('attached_photo_id')) {
                 $photo = JTable::getInstance('Photo', 'CTable');
                 $photo->load($params->get('attached_photo_id'));
                 $photoThumbnail = $photo->getThumbURI();
             }
             $tmpl = new CTemplate();
             $html .= $tmpl->set('user', $user)->set('msg', $row)->set('hide', $hide)->set('originalContent', $originalContent)->set('content', $content)->set('params', $params)->set('isMine', COwnerHelper::isMine($my->id, $user->id))->set('removeLink', $deleteLink)->set('authorLink', $authorLink)->set('photoThumbnail', $photoThumbnail)->fetch('inbox.message');
         }
         $myLink = CRoute::_('index.php?option=com_community&view=profile&userid=' . $my->id);
         $recipient = $inboxModel->getRecepientMessage($msgid);
         $recepientCount = count($recipient);
         $textOther = $recepientCount > 1 ? 'COM_COMMUNITY_MSG_OTHER' : 'COM_COMMUNITY_MSG_OTHER_SINGULAR';
         $messageHeading = JText::sprintf('COM_COMMUNITY_MSG_BETWEEN_YOU_AND_USER', $myLink, '#', JText::sprintf($textOther, $recepientCount));
     } else {
         $html = '<div class="text">' . JText::_('COM_COMMUNITY_INBOX_MESSAGE_EMPTY') . '</div>';
     }
     //end if
     $tmplMain = new CTemplate();
     echo $tmplMain->set('messageHeading', $messageHeading)->set('recipient', $recipient)->set('limit', $pagination)->set('messages', $data->messages)->set('parentData', $parentData)->set('htmlContent', $html)->set('my', $my)->set('submenu', $this->showSubmenu(false))->fetch('inbox.read');
 }
Ejemplo n.º 23
0
 /**
  * Ajax function to save a new wall entry
  *
  * @param message    A message that is submitted by the user
  * @param uniqueId    The unique id for this group
  *
  * */
 public function ajaxSaveWall($message, $uniqueId, $appId = null, $photoId = 0)
 {
     $filter = JFilterInput::getInstance();
     $message = $filter->clean($message, 'string');
     $uniqueId = $filter->clean($uniqueId, 'int');
     $appId = $filter->clean($appId, 'int');
     $photoId = $filter->clean($photoId, 'int');
     if (!COwnerHelper::isRegisteredUser()) {
         return $this->ajaxBlockUnregister();
     }
     $json = array();
     $my = CFactory::getUser();
     $config = CFactory::getConfig();
     $message = strip_tags($message);
     $photo = JTable::getInstance('Photo', 'CTable');
     $photo->load($uniqueId);
     $album = JTable::getInstance('Album', 'CTable');
     $album->load($photo->albumid);
     $handler = $this->_getHandler($album);
     if (!$handler->isWallsAllowed($photo->id)) {
         echo JText::_('COM_COMMUNITY_NOT_ALLOWED_TO_POST_COMMENT');
         return;
     }
     // If the content is false, the message might be empty.
     if (empty($message) && $photoId == 0) {
         $json['error'] = JText::_('COM_COMMUNITY_WALL_EMPTY_MESSAGE');
     } else {
         // @rule: Spam checks
         if ($config->get('antispam_akismet_walls')) {
             $filter = CSpamFilter::getFilter();
             $filter->setAuthor($my->getDisplayName());
             $filter->setMessage($message);
             $filter->setEmail($my->email);
             $filter->setURL(CRoute::_('index.php?option=com_community&view=photos&task=photo&albumid=' . $photo->albumid) . '&photoid=' . $photo->id);
             $filter->setType('message');
             $filter->setIP($_SERVER['REMOTE_ADDR']);
             if ($filter->isSpam()) {
                 $json['error'] = JText::_('COM_COMMUNITY_WALLS_MARKED_SPAM');
                 die(json_encode($json));
             }
         }
         $wall = CWallLibrary::saveWall($uniqueId, $message, 'photos', $my, $my->id == $photo->creator, 'photos,photo', 'wall/content', 0, $photoId);
         $url = $photo->getRawPhotoURI();
         $param = new CParameter('');
         $param->set('photoid', $uniqueId);
         $param->set('action', 'wall');
         $param->set('wallid', $wall->id);
         $param->set('url', $url);
         // Get the album type
         $app = $album->type;
         // Add activity logging based on app's type
         $permission = $this->_getAppPremission($app, $album);
         /**
          * We don't need to check for permission to create activity
          * Activity will follow album privacy
          * @since 3.2
          */
         if ($app == 'user' || $app == 'group') {
             $group = JTable::getInstance('Group', 'CTable');
             $group->load($album->groupid);
             $event = null;
             $this->_addActivity('photos.wall.create', $my->id, 0, '', $message, 'photos.comment', $uniqueId, $group, $event, $param->toString(), $permission);
         }
         // Add notification
         $params = new CParameter('');
         $params->set('url', $photo->getRawPhotoURI());
         $params->set('message', CUserHelper::replaceAliasURL($message));
         $params->set('photo', JText::_('COM_COMMUNITY_SINGULAR_PHOTO'));
         $params->set('photo_url', $url);
         // @rule: Send notification to the photo owner.
         if ($my->id !== $photo->creator) {
             CNotificationLibrary::add('photos_submit_wall', $my->id, $photo->creator, JText::sprintf('COM_COMMUNITY_PHOTO_WALL_EMAIL_SUBJECT'), '', 'photos.wall', $params);
         } else {
             //for activity reply action
             //get relevent users in the activity
             $wallModel = CFactory::getModel('wall');
             $users = $wallModel->getAllPostUsers('photos', $photo->id, $photo->creator);
             if (!empty($users)) {
                 CNotificationLibrary::add('photos_reply_wall', $my->id, $users, JText::sprintf('COM_COMMUNITY_PHOTO_WALLREPLY_EMAIL_SUBJECT'), '', 'photos.wallreply', $params);
             }
         }
         //email and add notification if user are tagged
         $info = array('type' => 'image-comment', 'album_id' => $album->id, 'image_id' => $photo->id);
         CUserHelper::parseTaggedUserNotification($message, CFactory::getUser($photo->creator), $wall, $info);
         // Add user points
         CUserPoints::assignPoint('photos.wall.create');
         // Log user engagement
         CEngagement::log('photo.comment', $my->id);
         $json['success'] = true;
         $json['html'] = $wall->content;
     }
     $this->cacheClean(array(COMMUNITY_CACHE_TAG_ACTIVITIES));
     die(json_encode($json));
 }
Ejemplo n.º 24
0
        public function _getMyFriendsHTML($userid = null)
        {
            $document = JFactory::getDocument();
            $this->loadUserParams();
            $count = $this->userparams->get('count', $this->params->get('count', 10));
            $is_rtl = $document->direction == 'rtl' ? 'dir="rtl"' : '';
            $html = '';
            $friendsModel = CFactory::getModel('friends');
            $my = CFactory::getUser($userid);
            $user = CFactory::getRequestUser();
            $params = $user->getParams();
            // site visitor
            $relation = 10;
            // site members
            if ($my->id != 0) {
                $relation = 20;
            }
            // friends
            if (CFriendsHelper::isConnected($my->id, $user->id)) {
                $relation = 30;
            }
            // mine
            if (COwnerHelper::isMine($my->id, $user->id)) {
                $relation = 40;
            }
            // @todo: respect privacy settings
            if ($relation >= $params->get('privacyFriendsView')) {
                $friends = $friendsModel->getFriends($user->id, 'latest', false, '', $count + $count);
                // randomize the friend count
                if ($friends) {
                    shuffle($friends);
                }
                $total = $user->getFriendCount();
                if ($this->params->get('hide_empty', 0) && !$total) {
                    return '';
                }
                ob_start();
                ?>

                    <?php 
                if ($friends) {
                    ?>
                            <ul class='joms-list--thumbnail'>
                                <?php 
                    for ($i = 0; $i < count($friends); $i++) {
                        if ($i >= $count) {
                            break;
                        }
                        $friend =& $friends[$i];
                        ?>
                                        <li class='joms-list__item'>
                                            <div class="joms-avatar <?php 
                        echo CUserHelper::onlineIndicator($friend);
                        ?>
">
                                                <a href="<?php 
                        echo CRoute::_('index.php?option=com_community&view=profile&userid=' . $friend->id);
                        ?>
" >
                                                    <img alt="<?php 
                        echo $friend->getDisplayName();
                        ?>
"
                                                         title="<?php 
                        echo $friend->getTooltip();
                        ?>
"
                                                         src="<?php 
                        echo $friend->getThumbAvatar();
                        ?>
"
                                                         data-author="<?php 
                        echo $friend->id;
                        ?>
"
                                                         />
                                                </a>
                                            </div>
                                        </li>
                                    <?php 
                    }
                    ?>
                            </ul>
                        <?php 
                } else {
                    ?>
                            <div class="cEmpty"><?php 
                    echo JText::_('COM_COMMUNITY_NO_FRIENDS_YET');
                    ?>
</div>
                    <?php 
                }
                if ($total > $count) {
                    ?>

                    <div class="joms-gap"></div>

                    <a href="<?php 
                    echo CRoute::_('index.php?option=com_community&view=friends&userid=' . $user->id);
                    ?>
">
                        <span><?php 
                    echo JText::_('COM_COMMUNITY_FRIENDS_VIEW_ALL');
                    ?>
</span>
                        <span <?php 
                    echo $is_rtl;
                    ?>
 > (<?php 
                    echo $total;
                    ?>
)</span>
                    </a>
                        <?php 
                }
                ?>

                    <?php 
                $html = ob_get_contents();
                ob_end_clean();
            }
            return $html;
        }
Ejemplo n.º 25
0
 /**
  * Automatically link username in the provided message when message contains @username
  * 
  * @param	$message	A string of message that may or may not contain @username
  *
  * return	$message	A modified copy of the message with the proper hyperlinks.
  **/
 public static function replaceAliasURL($message)
 {
     $pattern = '/@(("(.*)")|([A-Z0-9][A-Z0-9_-]+)([A-Z0-9][A-Z0-9_-]+))/i';
     preg_match_all($pattern, $message, $matches);
     if (isset($matches[0]) && !empty($matches[0])) {
         CFactory::load('helpers', 'user');
         CFactory::load('helpers', 'linkgenerator');
         $usernames = $matches[0];
         for ($i = 0; $i < count($usernames); $i++) {
             $username = $usernames[$i];
             $username = CString::str_ireplace('"', '', $username);
             $username = explode('@', $username);
             $username = $username[1];
             $id = CUserHelper::getUserId($username);
             if ($id != 0) {
                 $message = CString::str_ireplace($username, CLinkGeneratorHelper::getUserURL($id, $username), $message);
             }
         }
     }
     return $message;
 }
Ejemplo n.º 26
0
            $groupname = CStringHelper::escape($groupPost[0]->groupname);
            $grouplink = CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $groupId);
            ?>

    	    <h4><?php 
            echo $groupname;
            ?>
</h4>

            	<?php 
            foreach ($groupPost as $post_info) {
                $user = CFactory::getUser($post_info->actor);
                $comment = CComment::stripCommentData($post_info->title);
                $comment = JString::substr($comment, 0, $charactersCount);
                $comment .= $charactersCount > JString::strlen($comment) ? '' : '...';
                $comment = CUserHelper::replaceAliasURL($comment);
                ?>
            	<div class="joms-stream__header wide ">
            		<div class= "joms-avatar--stream">
                        <a title="<?php 
                echo $user->getDisplayName();
                ?>
" href="<?php 
                echo CRoute::_('index.php?option=com_community&view=profile&userid=' . $user->id);
                ?>
">
            				<img src="<?php 
                echo $user->getThumbAvatar();
                ?>
" alt="<?php 
                echo $groupname;
Ejemplo n.º 27
0
 /**
  * Return formatted comment given the wall item
  */
 public static function formatComment($wall)
 {
     $config = CFactory::getConfig();
     $my = CFactory::getUser();
     $actModel = CFactory::getModel('activities');
     $like = new CLike();
     $likeCount = $like->getLikeCount('comment', $wall->id);
     $isLiked = $like->userLiked('comment', $wall->id, $my->id);
     $user = CFactory::getUser($wall->post_by);
     // Censor if the user is banned
     if ($user->block) {
         $wall->comment = $origComment = JText::_('COM_COMMUNITY_CENSORED');
     } else {
         // strip out the comment data
         $CComment = new CComment();
         $wall->comment = $CComment->stripCommentData($wall->comment);
         // Need to perform basic formatting here
         // 1. support nl to br,
         // 2. auto-link text
         $CTemplate = new CTemplate();
         $wall->comment = $origComment = $CTemplate->escape($wall->comment);
         $wall->comment = CStringHelper::autoLink($wall->comment);
     }
     $commentsHTML = '';
     $commentsHTML .= '<div class="cComment wall-coc-item" id="wall-' . $wall->id . '"><a href="' . CUrlHelper::userLink($user->id) . '"><img src="' . $user->getThumbAvatar() . '" alt="" class="wall-coc-avatar" /></a>';
     $date = new JDate($wall->date);
     $commentsHTML .= '<a class="wall-coc-author" href="' . CUrlHelper::userLink($user->id) . '">' . $user->getDisplayName() . '</a> ';
     $commentsHTML .= $wall->comment;
     $commentsHTML .= '<span class="wall-coc-time">' . CTimeHelper::timeLapse($date);
     $cid = isset($wall->contentid) ? $wall->contentid : null;
     $activity = $actModel->getActivity($cid);
     $ownPost = $my->id == $wall->post_by;
     $allowRemove = $my->authorise('community.delete', 'walls', $wall);
     $canEdit = $config->get('wallediting') && $my->id == $wall->post_by || COwnerHelper::isCommunityAdmin();
     // only poster can edit
     if ($allowRemove) {
         $commentsHTML .= ' <span class="wall-coc-remove-link">&#x2022; <a href="#removeComment">' . JText::_('COM_COMMUNITY_WALL_REMOVE') . '</a></span>';
     }
     $commentsHTML .= '</span>';
     $commentsHTML .= '</div>';
     $editHTML = '';
     if ($config->get('wallediting') && $ownPost || COwnerHelper::isCommunityAdmin()) {
         $editHTML .= '<a href="javascript:" class="joms-button--edit">';
         $editHTML .= '<svg viewBox="0 0 16 16" class="joms-icon"><use xlink:href="' . CRoute::getURI() . '#joms-icon-pencil"></use></svg>';
         $editHTML .= '<span>' . JText::_('COM_COMMUNITY_EDIT') . '</span>';
         $editHTML .= '</a>';
     }
     $removeHTML = '';
     if ($allowRemove) {
         $removeHTML .= '<a href="javascript:" class="joms-button--remove">';
         $removeHTML .= '<svg viewBox="0 0 16 16" class="joms-icon"><use xlink:href="' . CRoute::getURI() . '#joms-icon-remove"></use></svg>';
         $removeHTML .= '<span>' . JText::_('COM_COMMUNITY_WALL_REMOVE') . '</span>';
         $removeHTML .= '</a>';
     }
     $removeTagHTML = '';
     if (CActivitiesHelper::hasTag($my->id, $wall->comment)) {
         $removeTagHTML = '<span><a data-action="remove-tag" data-id="' . $wall->id . '" href="javascript:">' . JText::_('COM_COMMUNITY_WALL_REMOVE_TAG') . '</a></span>';
     }
     /* user deleted */
     if ($user->guest == 1) {
         $userLink = '<span class="cStream-Author">' . $user->getDisplayName() . '</span> ';
     } else {
         $userLink = '<a class="cStream-Avatar cStream-Author cFloat-L" href="' . CUrlHelper::userLink($user->id) . '"> <img class="cAvatar" src="' . $user->getThumbAvatar() . '"> </a> ';
     }
     $params = $wall->params;
     $paramsHTML = '';
     $image = (array) $params->get('image');
     $photoThumbnail = false;
     if ($params->get('attached_photo_id') > 0) {
         $photo = JTable::getInstance('Photo', 'CTable');
         $photo->load($params->get('attached_photo_id'));
         $photoThumbnail = $photo->getThumbURI();
         $paramsHTML .= '<div style="padding: 5px 0"><img class="joms-stream-thumb" src="' . $photoThumbnail . '" /></div>';
     } else {
         if ($params->get('title')) {
             $video = self::detectVideo($params->get('url'));
             if (is_object($video)) {
                 $paramsHTML .= '<div class="joms-media--video joms-js--video"';
                 $paramsHTML .= ' data-type="' . $video->type . '"';
                 $paramsHTML .= ' data-id="' . $video->id . '"';
                 $paramsHTML .= ' data-path="' . ($video->type === 'file' ? JURI::root(true) . '/' : '') . $video->path . '"';
                 $paramsHTML .= ' style="margin-top:10px;">';
                 $paramsHTML .= '<div class="joms-media__thumbnail">';
                 $paramsHTML .= '<img src="' . $video->getThumbnail() . '">';
                 $paramsHTML .= '<a href="javascript:" class="mejs-overlay mejs-layer mejs-overlay-play joms-js--video-play joms-js--video-play-' . $wall->id . '">';
                 $paramsHTML .= '<div class="mejs-overlay-button"></div>';
                 $paramsHTML .= '</a>';
                 $paramsHTML .= '</div>';
                 $paramsHTML .= '<div class="joms-media__body">';
                 $paramsHTML .= '<h4 class="joms-media__title">' . JHTML::_('string.truncate', $video->title, 50, true, false) . '</h4>';
                 $paramsHTML .= '<p class="joms-media__desc">' . JHTML::_('string.truncate', $video->description, $config->getInt('streamcontentlength'), true, false) . '</p>';
                 $paramsHTML .= '</div>';
                 $paramsHTML .= '</div>';
             } else {
                 $paramsHTML .= '<div class="joms-gap"></div>';
                 $paramsHTML .= '<div class="joms-media--album joms-relative joms-js--comment-preview">';
                 if ($user->id == $my->id || COwnerHelper::isCommunityAdmin()) {
                     $paramsHTML .= '<span class="joms-media__remove" data-action="remove-preview" onClick="joms.api.commentRemovePreview(\'' . $wall->id . '\');"><svg viewBox="0 0 16 16" class="joms-icon"><use xlink:href="#joms-icon-remove"></use></svg></span>';
                 }
                 if ($params->get('image')) {
                     $paramsHTML .= $params->get('link');
                     $paramsHTML .= '<div class="joms-media__thumbnail">';
                     $paramsHTML .= '<a href="' . $params->get('link') ? $params->get('link') : '#' . '">';
                     $paramsHTML .= '<img src="' . array_shift($image) . '" />';
                     $paramsHTML .= '</a>';
                     $paramsHTML .= '</div>';
                 }
                 $url = $params->get('url') ? $params->get('url') : '#';
                 $paramsHTML .= '<div class="joms-media__body">';
                 $paramsHTML .= '<a href="' . $url . '">';
                 $paramsHTML .= '<h4 class="joms-media__title">' . $params->get('title') . '</h4>';
                 $paramsHTML .= '<p class="joms-media__desc reset-gap">' . CStringHelper::trim_words($params->get('description')) . '</p>';
                 if ($params->get('link')) {
                     $paramsHTML .= '<span class="joms-text--light"><small>' . preg_replace('#^https?://#', '', $params->get('link')) . '</small></span>';
                 }
                 $paramsHTML .= '</a></div></div>';
             }
         }
     }
     if (!$params->get('title') && $params->get('url')) {
         $paramsHTML .= '<div class="joms-gap"></div>';
         $paramsHTML .= '<div class="joms-media--album">';
         $paramsHTML .= '<a href="' . $params->get('url') . '">';
         $paramsHTML .= '<img class="joms-stream-thumb" src="' . $params->get('url') . '" />';
         $paramsHTML .= '</a>';
         $paramsHTML .= '</div>';
     }
     $wall->comment = nl2br($wall->comment);
     $wall->comment = CUserHelper::replaceAliasURL($wall->comment);
     $wall->comment = CStringHelper::getEmoticon($wall->comment);
     $wall->comment = CStringHelper::converttagtolink($wall->comment);
     // convert to hashtag
     $template = new CTemplate();
     $template->set('wall', $wall)->set('originalComment', $origComment)->set('date', $date)->set('isLiked', $isLiked)->set('likeCount', $likeCount)->set('canRemove', $allowRemove)->set('canEdit', $canEdit)->set('canRemove', $allowRemove)->set('user', $user)->set('photoThumbnail', $photoThumbnail)->set('paramsHTML', $paramsHTML);
     $commentsHTML = $template->fetch('stream/single-comment');
     return $commentsHTML;
 }
Ejemplo n.º 28
0
 public function send($vars)
 {
     $db = $this->getDBO();
     $my = CFactory::getUser();
     // @todo: user db table later on
     //$cDate = JFactory::getDate(gmdate('Y-m-d H:i:s'), $mainframe->getCfg('offset'));//get the current date from system.
     //$date	= cGetDate();
     $date = JFactory::getDate();
     //get the time without any offset!
     $cDate = $date->toSql();
     $obj = new stdClass();
     $obj->id = null;
     $obj->from = $my->id;
     $obj->posted_on = $date->toSql();
     $obj->from_name = $my->name;
     $obj->subject = $vars['subject'];
     $obj->body = $vars['body'];
     $body = new JRegistry();
     $body->set('content', CUserHelper::replaceAliasURL($obj->body));
     // photo attachment
     if (isset($vars['photo'])) {
         $photoId = $vars['photo'];
         if ($photoId > 0) {
             //lets check if the photo belongs to the uploader
             $photo = JTable::getInstance('Photo', 'CTable');
             $photo->load($photoId);
             if ($photo->creator == $my->id && $photo->albumid == '-1') {
                 $body->set('attached_photo_id', $photoId);
                 //sets the status to ready so that it wont be deleted on cron run
                 $photo->status = 'ready';
                 $photo->store();
             }
         }
     }
     /**
      * @since 3.2.1
      * Message URL fetching
      */
     if (preg_match("/\\b(?:(?:https?|ftp):\\/\\/|www\\.)[-a-z0-9+&@#\\/%?=~_|!:,.;]*[-a-z0-9+&@#\\/%=~_|]/i", $obj->body)) {
         $graphObject = CParsers::linkFetch($obj->body);
         if ($graphObject) {
             $graphObject->merge($body);
             $obj->body = $graphObject->toString();
         }
     } else {
         $obj->body = $body->toString();
     }
     // Don't add message if user is sending message to themselve
     if ($vars['to'] != $my->id) {
         $db->insertObject('#__community_msg', $obj, 'id');
         // Update the parent
         $obj->parent = $obj->id;
         $db->updateObject('#__community_msg', $obj, 'id');
     }
     if (is_array($vars['to'])) {
         //multiple recepint
         foreach ($vars['to'] as $sToId) {
             if ($vars['to'] != $my->id) {
                 $this->addReceipient($obj, $sToId);
             }
         }
     } else {
         //single recepient
         if ($vars['to'] != $my->id) {
             $this->addReceipient($obj, $vars['to']);
         }
     }
     return $obj->id;
 }
Ejemplo n.º 29
0
    echo JText::_('COM_COMMUNITY_CREATE_GROUP_ANNOUNCEMENT');
    ?>
</button>
    <?php 
}
?>
    <div>

        <?php 
if ($bulletins) {
    for ($i = 0; $i < count($bulletins); $i++) {
        $row =& $bulletins[$i];
        ?>
                    <div class="joms-stream__container joms-stream--discussion">
                        <div class="joms-stream__header <?php 
        echo CUserHelper::onlineIndicator($row->creator);
        ?>
">
                            <div class="joms-avatar--stream">
                                <a href="<?php 
        echo CUrlHelper::userLink($row->creator->id);
        ?>
">
                                    <img data-author="<?php 
        echo $row->creator->id;
        ?>
"
                                         src="<?php 
        echo $row->creator->getThumbAvatar();
        ?>
"
Ejemplo n.º 30
0
$wall->originalComment = preg_replace('/<br\\s*\\/>/i', "\n", $wall->originalComment);
?>

<div class="joms-comment__item joms-js--comment joms-js--comment-<?php 
echo $wall->id;
?>
" data-id="<?php 
echo $wall->id;
?>
" data-parent="<?php 
echo $wall->contentid;
?>
">
    <div class="joms-comment__header">
        <div class="joms-avatar--comment <?php 
echo CUserHelper::onlineIndicator(CFactory::getUser($wall->post_by));
?>
">
            <?php 
echo $avatarHTML;
?>
        </div>
        <div class="joms-comment__body joms-js--comment-body">
            <a class="joms-comment__user" href="<?php 
echo $authorLink;
?>
"><?php 
echo $author;
?>
</a>
            <span class="joms-js--comment-content"><?php