Beispiel #1
0
                    ?>
');"><?php 
                    echo JText::_('REMOVE COMMENT');
                    ?>
</a></span>
					<?php 
                }
                ?>
					<p><?php 
                echo $row->comment;
                ?>
</p>
				</div>
				<?php 
            }
            if (ActivityComments::hasMoreComments($act->id)) {
                ?>
				<div class="wallcmt small" id="activity-comment-more-<?php 
                echo $act->id;
                ?>
">
					<div><a href="javascript:void(0);" onclick="activityMoreComments('<?php 
                echo $act->id;
                ?>
');"><?php 
                echo JText::_('MORE COMMENTS');
                ?>
</a></div>
				</div>
				<?php 
            }
Beispiel #2
0
 */
defined('_JEXEC') or die('Restricted access');
JPlugin::loadLanguage('plg_activitycomment', JPATH_ADMINISTRATOR);
require_once JPATH_PLUGINS . DS . 'community' . DS . 'activitycomment' . DS . 'helper.php';
$current = JRequest::getInt('userid');
$task = JRequest::getVar('func');
if ($task == 'activities,ajaxGetActivities') {
    return;
}
if (empty($current)) {
    $current = CFactory::getRequestUser();
    $current = $current->id;
}
$o = JRequest::getVar('option');
$task = JRequest::getVar('task');
$params = ActivityComments::getParams();
$view = JRequest::getVar('view', 'frontpage');
if (!$params->get('sharefrontpage', 1) && $view == 'frontpage' && ($o == 'com_community' || $o == 'community')) {
    return false;
}
if (!$params->get('shareprofile', 1) && $view == 'profile' && ($o == 'com_community' || $o == 'community')) {
    return false;
}
if ($my->id != 0 && $my->id == $current && ($o == 'com_community' || $o == 'community')) {
    ?>
<script type="text/javascript">
joms.jQuery(document).ready( function(){
	
	if( joms.jQuery('#activity-share-note').length )
	{
		activityshareshow('message');
Beispiel #3
0
    function savecomment($response, $id, $value)
    {
        require_once JPATH_PLUGINS . DS . 'community' . DS . 'activitycomment' . DS . 'helper.php';
        JPlugin::loadLanguage('plg_activitycomment', JPATH_ADMINISTRATOR);
        $my =& CFactory::getUser();
        if ($my->id == 0) {
            return 'invalid';
        }
        if (empty($value)) {
            $response->addScriptCall(ActivityComments::getjs() . '("#activity-' . $id . '-comment-errors").html("' . JText::_('COMMENT CANNOT BE EMPTY') . '").css("color","red");');
            return $response->sendResponse();
        }
        $my =& CFactory::getUser();
        require_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'models' . DS . 'wall.php';
        $wall =& JTable::getInstance('Wall', 'CTable');
        CFactory::load('helpers', 'linkgenerator');
        $params = ActivityComments::getParams();
        $value = strip_tags($value);
        $value = cGenerateURILinks($value, true, $params->get('shareurltarget'));
        // Get current date
        $date =& JFactory::getDate();
        $now = $date->toMySQL();
        $wall->type = 'activity';
        $wall->contentid = $id;
        $wall->post_by = $my->id;
        $wall->comment = $value;
        $wall->date = $now;
        $wall->published = 1;
        $wall->ip = $_SERVER['REMOTE_ADDR'];
        $wall->store();
        $params = ActivityComments::getParams();
        $sendEmail = $params->get('notifycomment', 0);
        $db =& JFactory::getDBO();
        if ($sendEmail == 1) {
            $query = 'select actor from #__community_activities where id=' . $db->Quote($id);
            $db->setQuery($query);
            $actorId = $db->loadResult();
            if ($actorId != $my->id) {
                $actor =& CFactory::getUser($actorId);
                CFactory::load('libraries', 'notification');
                $notification = new CNotificationLibrary();
                $current = CRoute::emailLink(ActivityComments::getCurrent(), false) . '#profile-newsfeed-item' . $id;
                $notification->add('profile.activity.comment', $my->id, $actorId, JText::sprintf('SOMEONE COMMENTED MAIL SUBJECT', $my->getDisplayName()), JText::sprintf('SOMEONE COMMENTED MAIL CONTENT', $actor->getDisplayName(), $my->getDisplayName(), $current));
            }
        }
        // send emails to subscribers
        $a = 'select * from #__activity_subscribe where ' . '`activity_id`=' . $db->Quote($id) . ' ' . 'and `type`=' . $db->Quote('profile');
        $db->setQuery($a);
        $subscribers = $db->loadObjectList();
        if ($subscribers) {
            $emails = array();
            foreach ($subscribers as $subscriber) {
                $emails[] = $subscriber->user_id;
            }
            CFactory::load('libraries', 'notification');
            $notification = new CNotificationLibrary();
            $current = CRoute::emailLink(ActivityComments::getCurrent(), false) . '#profile-newsfeed-item' . $id;
            $notification->add('profile.activity.comment', $my->id, $emails, JText::sprintf('SUBSCRIBE SOMEONE COMMENTED MAIL SUBJECT', $my->getDisplayName()), JText::sprintf('SUBSCRIBE SOMEONE COMMENTED MAIL CONTENT', $my->getDisplayName(), $current));
        }
        $joomla = JFactory::getConfig();
        $offset = $my->getParam('timezone', $joomla->getValue('offset'));
        $config = CFactory::getConfig();
        $date->setOffset($offset + $config->get('daylightsavingoffset'));
        ob_start();
        ?>
		<div class="wallcmt small" id="activity-comment-item-<?php 
        echo $wall->id;
        ?>
">
			<a href="<?php 
        echo CRoute::_('index.php?option=com_community&view=profile&userid=' . $my->id);
        ?>
"><img class="wall-coc-avatar" src="<?php 
        echo $my->getThumbAvatar();
        ?>
"/></a>
			<a href="<?php 
        echo CRoute::_('index.php?option=com_community&view=profile&userid=' . $my->id);
        ?>
" class="wall-coc-author"><?php 
        echo $my->getDisplayName();
        ?>
</a> <?php 
        echo JText::_('POST ON');
        ?>
			<span class="wall-coc-date"><?php 
        echo $date->toFormat(JText::_('DATE_FORMAT_LC2'));
        ?>
</span>
					<?php 
        if (ActivityComments::isSiteAdmin()) {
            ?>
					 | <span class="coc-remove"><a href="javascript:void(0);" onclick="jax.call('community','plugins,activitycomment,removecomment','<?php 
            echo $wall->id;
            ?>
');"><?php 
            echo JText::_('REMOVE COMMENT');
            ?>
</a></span>
					<?php 
        }
        ?>
			<p><?php 
        echo $wall->comment;
        ?>
</p>
		</div>
	<?php 
        $contents = ob_get_contents();
        ob_end_clean();
        $closeComment = $params->get('autoclose', 0);
        if ($closeComment) {
            $response->addScriptCall('activityHideComment', $id);
        }
        $response->addScriptCall(ActivityComments::getjs() . '("#activity-' . $id . '-comment-errors").html("' . JText::_('COMMENT ADDED') . '").css("color","green");');
        $response->addScriptCall('activityInsertComment', $id, $contents, $params->get('commentordering', 'asc'));
        return $response->sendResponse();
    }
Beispiel #4
0
 function hasMoreComments($id)
 {
     $db =& JFactory::getDBO();
     $params = ActivityComments::getParams();
     $limit = $params->get('commentlimit', '5');
     $query = 'select count(*) from #__community_wall AS a ';
     $query .= 'inner join #__users AS b ON a.post_by=b.id ';
     $query .= 'where contentid=' . $db->Quote($id) . ' and type=' . $db->Quote('activity') . ' ';
     $query .= 'and b.block=0';
     $db->setQuery($query);
     if ($limit == 0) {
         return false;
     }
     $total = $db->loadResult();
     if ($total > $limit) {
         return true;
     }
     return false;
 }