/** * Execute a request */ public function execute($task = '') { global $mainframe; $document =& JFactory::getDocument(); $my =& JFactory::getUser(); $pathway =& $mainframe->getPathway(); $menus =& JSite::getMenu(); $menuitem =& $menus->getActive(); $userId = JRequest::getInt('userid', '', 'GET'); $tmpl = JRequest::getVar('tmpl', '', 'REQUEST'); $format = JRequest::getVar('format', '', 'REQUEST'); $nohtml = JRequest::getVar('no_html', '', 'REQUEST'); if ($tmpl != 'component' && $format != 'feed' && $format != 'ical' && $nohtml != 1 && $format != 'raw') { // This is to fix MSIE that has incorrect user agent because jquery doesn't detect correctly. $ieFix = "<!--[if IE 6]><script type=\"text/javascript\">var jomsIE6 = true;</script><![endif]-->"; $document->addCustomTag($ieFix); } // Add custom css for the specific view if needed. $config = CFactory::getConfig(); $viewName = JString::strtolower(JRequest::getVar('view', '', 'REQUEST')); jimport('joomla.filesystem.file'); if ($config->get('enablecustomviewcss')) { CTemplate::addStylesheet($viewName); } $env = CTemplate::getTemplateEnvironment(); $html = '<div id="community-wrap" class="on-' . $env->joomlaTemplate . ' ' . $document->direction . '">'; // Build the component menu module ob_start(); CTemplate::renderModules('js_top'); $moduleHTML = ob_get_contents(); ob_end_clean(); $html .= $moduleHTML; // Build the content HTML CFactory::load('helpers', 'azrul'); $inbox =& $this->getModel('inbox'); $unread = $inbox->countUnRead(array('user_id' => $my->id)); $param = array('inbox' => $unread); if (!empty($task) && method_exists($this, $task)) { ob_start(); if (method_exists($this, '_viewEnabled') && !$this->_viewEnabled()) { echo property_exists($this, '_disabledMessage') ? $this->_disabledMessage : JText::_('Function is disabled'); } else { $this->{$task}(); } $output = ob_get_contents(); ob_end_clean(); } else { ob_start(); $this->display(); $output = ob_get_contents(); ob_end_clean(); } // Build toolbar HTML ob_start(); $view =& $this->getView(JRequest::getCmd('view', 'frontpage')); $view->showToolbar($param); // Header title will use view->title. If not specified, we will // use current page title $headerTitle = !empty($view->title) ? $view->title : $document->getTitle(); $view->showHeader($headerTitle, $this->_icon); $header = ob_get_contents(); ob_end_clean(); $html .= $header; // @rule: Super admin should always be allowed regardless of their block status // block member to access profile owner details CFactory::load('helpers', 'owner'); CFactory::load('libraries', 'block'); $getBlockStatus = new blockUser(); $blocked = $getBlockStatus->isUserBlocked($userId, $viewName); if ($blocked) { if (COwnerHelper::isCommunityAdmin()) { $mainframe =& JFactory::getApplication(); $mainframe->enqueueMessage(JText::_('CC YOU ARE BLOCKED BY USER', 'error')); } else { $tmpl = new CTemplate(); $output .= $tmpl->fetch('block.denied'); } } // Build the component bottom module ob_start(); CTemplate::renderModules('js_bottom'); $moduleHTML = ob_get_contents(); ob_end_clean(); $html .= $output . $moduleHTML . '</div>'; CFactory::load('helpers', 'string'); $html = CStringHelper::replaceThumbnails($html); $html = JString::str_ireplace(array('{error}', '{warning}', '{info}'), '', $html); // Trigger onModuleDisplay() CFactory::load('libraries', 'apps'); $appsLib = CAppPlugins::getInstance(); $appsLib->loadApplications(); $moduleHTML = $appsLib->triggerEvent('onModuleRender'); $mods = array(); foreach ($moduleHTML as $modules) { foreach ($modules as $position => $content) { if (empty($mods[$position])) { $mods[$position] = ''; } $mods[$position] .= $content; } } foreach ($mods as $position => $module) { $html = str_replace('<!-- ' . $position . ' -->', $module, $html); } // Display viewType switcher // $browser = CBrowser::getInstance(); // if( $browser->_mobile ) // { // CFactory::load('libraries', 'mobile'); // ob_start(); // CMobile::showSwitcher(); // $switcherHTML = ob_get_contents(); // ob_end_clean(); // $html .= $switcherHTML; // } echo $html; }
/** * @todo: check permission and message ownership */ public function ajaxCompose($id) { $filter = JFilterInput::getInstance(); $id = $filter->clean($id, 'int'); if (!COwnerHelper::isRegisteredUser()) { return $this->ajaxBlockUnregister(); } $objResponse = new JAXResponse(); $config = CFactory::getConfig(); $user = CFactory::getUser($id); $my = CFactory::getUser(); if ($my->id == 0) { return $this->ajaxBlockUnregister(); } //CFactory::load( 'helpers' , 'owner' ); //CFactory::load( 'libraries' , 'block' ); $getBlockStatus = new blockUser(); // Block banned users if ($getBlockStatus->isUserBlocked($id, 'inbox') && !COwnerHelper::isCommunityAdmin()) { $this->ajaxblock(); } $inboxModel = $this->getModel('inbox'); $lastSent = $inboxModel->getLastSentTime($my->id); $dateNow = new JDate(); // We need to make sure that this guy are not spamming other people inbox // by checking against his last message time. Make sure it doesn't exceed // pmFloodLimit config (in seconds). if ($dateNow->toUnix() - $lastSent->toUnix() < $config->get('floodLimit') && !COwnerHelper::isCommunityAdmin()) { $json = array(); $json['title'] = JText::_('COM_COMMUNITY_NOTICE'); $json['error'] = JText::sprintf('COM_COMMUNITY_PLEASE_WAIT_BEFORE_SENDING_MESSAGE', $config->get('floodLimit')); die(json_encode($json)); } // Check if user exceeded daily limit. $maxSent = $config->get('pmperday'); $totalSent = $inboxModel->getTotalMessageSent($my->id); if ($totalSent >= $maxSent && $maxSent != 0) { $json = array(); $json['title'] = JText::_('COM_COMMUNITY_NOTICE'); $json['error'] = JText::_('COM_COMMUNITY_PM_LIMIT_REACHED'); die(json_encode($json)); } //==================================== $tmpl = new CTemplate(); $tmpl->set('user', $user); $json = array('title' => JText::_('COM_COMMUNITY_INBOX_TITLE_WRITE'), 'html' => $tmpl->fetch('inbox.ajaxcompose'), 'btnSend' => JText::_('COM_COMMUNITY_SEND_BUTTON'), 'btnCancel' => JText::_('COM_COMMUNITY_CANCEL_BUTTON')); die(json_encode($json)); }
/** * Un Ban member or friend (for ajax remove only) */ public function unBlockUser() { $my = CFactory::getUser(); $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; if ($my->id == 0) { return $this->blockUnregister(); } $userId = JRequest::getInt('userid', ''); $layout = $jinput->get->get('layout', '', 'STRING'); //JRequest::getVar('layout','','GET'); CFactory::load('libraries', 'block'); $blockUser = new blockUser(); $blockUser->unBlock($userId, $layout); }
</div> <?php } ?> <div class="joms-list--message joms-comment--inbox joms-js--inbox"><?php echo $htmlContent; ?> </div> <div class="joms-gap"></div> <div class="joms-relative joms-js--inbox-reply joms-js--pm-message"> <?php // if the conversation is just with 1 other person and at least one blocked another, disable textarea $readonly = 0; if (count($recipient) == 1) { $getBlockStatus = new blockUser(); if ($getBlockStatus->isUserBlocked($recipient[0]->msg_from, 'inbox') && !COwnerHelper::isCommunityAdmin()) { $readonly = 1; } if ($getBlockStatus->isUserBlocked($recipient[0]->to, 'inbox') && !COwnerHelper::isCommunityAdmin()) { $readonly = 1; } } if (!$readonly) { ?> <div class="joms-textarea__wrapper"> <div class="joms-textarea joms-textarea__beautifier"></div> <textarea class="joms-textarea" value="" placeholder="<?php echo JText::_('COM_COMMUNITY_REPLY_MESSAGE'); ?>
/** * Add receipient */ public function addReceipient($msgObj, $recepientId) { $getBlockStatus = new blockUser(); if ($getBlockStatus->isUserBlocked($recepientId, 'inbox')) { return $this; } $db = $this->getDBO(); $my = CFactory::getUser(); $recepient = new stdClass(); $recepient->msg_id = $msgObj->id; $recepient->msg_parent = $msgObj->parent; $recepient->msg_from = $msgObj->from; $recepient->to = $recepientId; if ($my->id != $recepientId) { $db->insertObject('#__community_msg_recepient', $recepient); } if ($db->getErrorNum()) { JError::raiseError(500, $db->stderr()); } return $this; }
/** * Execute a request */ public function execute($task) { $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $document = JFactory::getDocument(); $my = CFactory::getUser(); $pathway = $mainframe->getPathway(); $menus = $mainframe->getMenu(); $menuitem = $menus->getActive(); $userId = $jinput->get->get('userid', '', 'INT'); $tmpl = $jinput->request->get('tmpl', '', 'STRING'); $format = $jinput->request->get('format', '', 'STRING'); $nohtml = $jinput->request->get('no_html', '', 'STRING'); if ($tmpl != 'component' && $format != 'feed' && $format != 'ical' && $nohtml != 1 && $format != 'raw') { // This is to fix MSIE that has incorrect user agent because jquery doesn't detect correctly. $ieFix = "<!--[if IE 6]><script type=\"text/javascript\">var jomsIE6 = true;</script><![endif]-->"; $document->addCustomTag($ieFix); } // Add custom css for the specific view if needed. $config = CFactory::getConfig(); $viewName = JString::strtolower($jinput->request->get('view', '', 'STRING')); jimport('joomla.filesystem.file'); if ($config->get('enablecustomviewcss')) { CTemplate::addStylesheet($viewName); } $template = JFactory::getApplication()->getTemplate(); // echo var_dump(CTemplate::addStylesheet('beez2')); if ($template == 'beez_20' && JVERSION > 2 && JVERSION < 3) { CTemplate::addStylesheet('beez2'); } $env = CTemplate::getTemplateEnvironment(); $svgFile = CFactory::getPath('template://assets/icon/joms-icon.svg'); // non ajax-prefixed tasks that should avoid svg $excludeSvgList = array('changeAvatar', 'multiUpload', 'uploadvideo'); // exclude svg file from ajax response if ($svgFile && substr($task, 0, 4) != 'ajax' && !in_array($task, $excludeSvgList)) { include_once $svgFile; } $html = '<div id="community-wrap" class="jomsocial-wrapper on-' . $env->joomlaTemplate . ' ' . $document->direction . ' c' . ucfirst($viewName) . '">'; $html .= '<div class="jomsocial">'; // Build the component menu module ob_start(); $tmpl = new CTemplate(); $tmpl->renderModules('js_top'); $moduleHTML = ob_get_contents(); ob_end_clean(); $html .= $moduleHTML; // Build the content HTML //CFactory::load( 'helpers' , 'azrul' ); if (!empty($task) && method_exists($this, $task)) { ob_start(); if (method_exists($this, '_viewEnabled') && !$this->_viewEnabled()) { echo property_exists($this, '_disabledMessage') ? $this->_disabledMessage : JText::_('COM_COMMUNITY_CONTROLLER_FUNCTION_DISABLED_WARNING'); } else { $this->{$task}(); } $output = ob_get_contents(); ob_end_clean(); } else { ob_start(); $this->display(); $output = ob_get_contents(); ob_end_clean(); } // Build toolbar HTML ob_start(); $view = $this->getView(JString::strtolower($jinput->get('view', 'frontpage', 'STRING'))); // Do not rely on the toolbar to include necessary css or javascripts. $view->attachHeaders(); // Display the site's toolbar. $view->showToolbar(); // Header title will use view->title. If not specified, we will // use current page title $headerTitle = !empty($view->title) ? $view->title : $document->getTitle(); $view->showHeader($headerTitle, $this->_icon); $header = ob_get_contents(); ob_end_clean(); $html .= $header; // @rule: Super admin should always be allowed regardless of their block status // block member to access profile owner details //CFactory::load( 'helpers' , 'owner' ); //CFactory::load( 'libraries' , 'block' ); $getBlockStatus = new blockUser(); $blocked = $getBlockStatus->isUserBlocked($userId, $viewName); if ($blocked) { if (COwnerHelper::isCommunityAdmin()) { $mainframe = JFactory::getApplication(); $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_YOU_ARE_BLOCKED_BY_USER', 'error')); } else { $tmpl = new CTemplate(); $view->showToolbar(); echo $tmpl->fetch('block.denied'); return; $block = true; } } // Build the component bottom module ob_start(); $tmpl = new CTemplate(); $tmpl->renderModules('js_bottom'); $moduleHTML = ob_get_contents(); ob_end_clean(); $html .= $output . $moduleHTML . '</div></div>'; //CFactory::load( 'helpers' , 'string' ); $html = CStringHelper::replaceThumbnails($html); $html = CString::str_ireplace(array('{error}', '{warning}', '{info}'), '', $html); // Trigger onModuleDisplay() //CFactory::load( 'libraries' , 'apps' ); $appsLib = CAppPlugins::getInstance(); $appsLib->loadApplications(); $moduleHTML = $appsLib->triggerEvent('onModuleRender'); $mods = array(); if (is_array($moduleHTML)) { foreach ($moduleHTML as $modules) { if (is_array($modules)) { foreach ($modules as $position => $content) { if (empty($mods[$position])) { $mods[$position] = ''; } $mods[$position] .= $content; } } } } foreach ($mods as $position => $module) { $html = str_replace('<!-- ' . $position . ' -->', $module, $html); } echo $html; // Fix UI quirks. echo PHP_EOL; echo '<script>window.joms && joms.fixUI && joms.fixUI();</script>'; echo PHP_EOL; }
public function modProfileUserinfo() { jimport('joomla.utilities.arrayhelper'); $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $my = CFactory::getUser(); $userid = $jinput->get('userid', $my->id, 'INT'); $user = CFactory::getUser($userid); $params = $user->getParams(); $userModel = CFactory::getModel('user'); $profileModel = CFactory::getModel('profile'); //Reassign needed variable $data = new stdClass(); $data->user = $user; $data->profile = $profileModel->getViewableProfile($userid, $user->getProfileType()); $data->videoid = $params->get('profileVideo', 0); CFactory::load('libraries', 'messaging'); $isMine = COwnerHelper::isMine($my->id, $user->id); // Get the admin controls HTML data $adminControlHTML = ''; $tmpl = new CTemplate(); // get how many unread message $filter = array(); $inboxModel = CFactory::getModel('inbox'); $filter['user_id'] = $my->id; $unread = $inboxModel->countUnRead($filter); // get how many pending connection $friendModel = CFactory::getModel('friends'); $pending = $friendModel->countPending($my->id); $profile = JArrayHelper::toObject($data->profile); $profile->largeAvatar = $user->getAvatar(); $profile->defaultAvatar = $user->isDefaultAvatar(); $profile->status = $user->getStatus(); $profile->defaultCover = $user->isDefaultCover(); $profile->cover = $user->getCover(); $profile->coverPostion = $params->get('coverPosition', ''); if (strpos($profile->coverPostion, '%') === false) { $profile->coverPostion = 0; } $groupmodel = CFactory::getModel('groups'); $profile->_groups = $groupmodel->getGroupsCount($profile->id); $eventmodel = CFactory::getModel('events'); $profile->_events = $eventmodel->getEventsCount($profile->id); $profile->_friends = $user->_friendcount; $videoModel = CFactory::getModel('Videos'); $profile->_videos = $videoModel->getVideosCount($profile->id); $photosModel = CFactory::getModel('photos'); $profile->_photos = $photosModel->getPhotosCount($profile->id); if ($profile->status !== '') { $postedOn = new JDate($user->_posted_on); $postedOn = CActivityStream::_createdLapse($postedOn); $profile->posted_on = $user->_posted_on == '0000-00-00 00:00:00' ? '' : $postedOn; } else { $profile->posted_on = ''; } /* is featured */ $modelFeatured = CFactory::getModel('Featured'); $profile->featured = $modelFeatured->isExists(FEATURED_USERS, $profile->id); // Assign videoId $profile->profilevideo = $data->videoid; $video = JTable::getInstance('Video', 'CTable'); $video->load($profile->profilevideo); $profile->profilevideoTitle = $video->getTitle(); $addbuddy = "joms.api.friendAdd('{$profile->id}')"; $sendMsg = CMessaging::getPopup($profile->id); $config = CFactory::getConfig(); $jConfig = JFactory::getConfig(); $lastLogin = JText::_('COM_COMMUNITY_PROFILE_NEVER_LOGGED_IN'); if ($user->lastvisitDate != '0000-00-00 00:00:00') { $userLastLogin = new JDate($user->lastvisitDate); $lastLogin = CActivityStream::_createdLapse($userLastLogin); } // @todo : beside checking the owner, maybe we want to check for a cookie, // say every few hours only the hit get increment by 1. if (!$isMine) { $user->viewHit(); } // @rule: myblog integrations $showBlogLink = false; $myblog = CMyBlog::getInstance(); if ($config->get('enablemyblogicon') && $myblog) { if ($myblog->userCanPost($user->id)) { $showBlogLink = true; } $tmpl->set('blogItemId', $myblog->getItemId()); } $photoEnabled = $config->get('enablephotos') ? true : false; $eventEnabled = $config->get('enableevents') ? true : false; $groupEnabled = $config->get('enablegroups') ? true : false; $videoEnabled = $config->get('enablevideos') ? true : false; $isSEFEnabled = $jConfig->get('sef') ? true : false; $multiprofile = JTable::getInstance('MultiProfile', 'CTable'); $multiprofile->load($user->getProfileType()); CFactory::load('libraries', 'like'); $like = new Clike(); $isLikeEnabled = $like->enabled('profile') && $params->get('profileLikes', 1) ? 1 : 0; $isUserLiked = $like->userLiked('profile', $user->id, $my->id); /* likes count */ $likes = $like->getLikeCount('profile', $user->id); /* User status */ $status = new CUserStatus($user->id, 'profile'); //respect wall setting if ($my->id && (!$config->get('lockprofilewalls') || $config->get('lockprofilewalls') && CFriendsHelper::isConnected($my->id, $profile->id)) || COwnerHelper::isCommunityAdmin()) { // Add default status box CUserHelper::addDefaultStatusCreator($status); } //$isblocked = $user->isBlocked(); $isMine = COwnerHelper::isMine($my->id, $user->id); $isCommunityAdmin = COwnerHelper::isCommunityAdmin($user->id); // Check if user is blocked $getBlockStatus = new blockUser(); $isblocked = $getBlockStatus->isUserBlocked($user->id, 'profile'); // Get block user html //$blockUserHTML = $isMine || $isCommunityAdmin ? '' : CUserHelper::getBlockUserHTML($user->id, $isBlocked); $isMine = COwnerHelper::isMine($my->id, $user->id); $isCommunityAdmin = COwnerHelper::isCommunityAdmin($user->id); // Get reporting html $report = new CReportingLibrary(); $reportsHTML = $isMine ? '' : $report->getReportingHTML(JText::_('COM_COMMUNITY_REPORT_USER'), 'profile,reportProfile', array($user->id)); $tmpl = new CTemplate(); echo $tmpl->set('karmaImgUrl', CUserPoints::getPointsImage($user))->set('reportsHTML', $reportsHTML)->set('isMine', $isMine)->set('lastLogin', $lastLogin)->set('addBuddy', $addbuddy)->set('sendMsg', $sendMsg)->set('config', $config)->set('multiprofile', $multiprofile)->set('showBlogLink', $showBlogLink)->set('isFriend', CFriendsHelper::isConnected($user->id, $my->id) && $user->id != $my->id)->set('isWaitingApproval', CFriendsHelper::isWaitingApproval($my->id, $user->id))->set('isWaitingResponse', CFriendsHelper::isWaitingApproval($user->id, $my->id))->set('isBlocked', $isblocked)->set('profile', $profile)->set('unread', $unread)->set('pending', $pending)->set('registerDate', $user->registerDate)->set('adminControlHTML', $adminControlHTML)->set('userstatus', $status)->set('user', $user)->set('isUserLiked', $isUserLiked)->set('likes', $likes)->set('isLikeEnabled', $isLikeEnabled)->set('photoEnabled', $photoEnabled)->set('eventEnabled', $eventEnabled)->set('groupEnabled', $groupEnabled)->set('videoEnabled', $videoEnabled)->set('about', $this->_getProfileHTML($data->profile))->set('isSEFEnabled', $isSEFEnabled)->set('blocked', $user->isBlocked())->fetch('profile/focus'); }
/** * Block user */ public function blockUser() { $my = CFactory::getUser(); if ($my->id == 0) { return $this->blockUnregister(); } $userId = JRequest::getVar('fid', '', 'GET'); CFactory::load('libraries', 'block'); $blockUser = new blockUser(); $blockUser->block($userId); }
/** * Do block user * @param type $userId * @return boolean */ public function blockUser($userId, $type) { $block = new blockUser(); return $block->block($userId, $type); }
/** * @todo: check permission and message ownership */ function ajaxCompose($id) { if (!COwnerHelper::isRegisteredUser()) { return $this->ajaxBlockUnregister(); } $objResponse = new JAXResponse(); $config = CFactory::getConfig(); $user = CFactory::getUser($id); $my = CFactory::getUser(); if ($my->id == 0) { return $this->ajaxBlockUnregister(); } CFactory::load('helpers', 'owner'); CFactory::load('libraries', 'block'); $getBlockStatus = new blockUser(); // Block banned users if ($getBlockStatus->isUserBlocked($id, 'inbox') && !COwnerHelper::isCommunityAdmin()) { $this->ajaxblock(); } CFactory::load('helpers', 'time'); $inboxModel =& $this->getModel('inbox'); $lastSent = $inboxModel->getLastSentTime($my->id); $dateNow = new JDate(); CFactory::load('helpers', 'owner'); // We need to make sure that this guy are not spamming other people inbox // by checking against his last message time. Make sure it doesn't exceed // pmFloodLimit config (in seconds) if ($dateNow->toUnix() - $lastSent->toUnix() < $config->get('floodLimit') && !COwnerHelper::isCommunityAdmin()) { $html = '<dl id="system-message"><dt class="notice">Notice</dt><dd class="notice message"><ul><li>'; $html .= JText::sprintf('CC PLEASE WAIT BEFORE SENDING MESSAGE', $config->get('floodLimit')); $html .= '</li></ul></dd></dl>'; $objResponse->addAssign('cWindowContent', 'innerHTML', $html); $objResponse->addScriptCall('cWindowResize', '120'); $action = '<button class="button" onclick="cWindowHide();" name="cancel">' . JText::_('CC BUTTON CLOSE') . '</button>'; $objResponse->addScriptCall('cWindowActions', $action); return $objResponse->sendResponse(); } $tmpl = new CTemplate(); $tmpl->set('user', $user); $html = $tmpl->fetch('inbox.ajaxcompose'); $action = '<button class="button" onclick="javascript:return joms.messaging.send();" name="send">' . JText::_('CC BUTTON SEND') . '</button> '; $action .= '<button class="button" onclick="javascript:cWindowHide();" name="cancel">' . JText::_('CC BUTTON CANCEL') . '</button>'; // Change cWindow title $objResponse->addAssign('cwin_logo', 'innerHTML', JText::_('CC TITLE COMPOSE')); $objResponse->addAssign('cWindowContent', 'innerHTML', $html); $objResponse->addScriptCall('cWindowActions', $action); $objResponse->addScriptCall('cWindowResize', 230); return $objResponse->sendResponse(); }
public function singleActivity($activity) { // we will determine all the user settings based on the activity viewed $my = CFactory::getUser(); $userId = $activity->actor; if ($activity->id == 0 || empty($activity->id)) { //redirect this to error : no activity found JError::raiseWarning(404, JText::_('COM_COMMUNITY_ERROR_ACTIVITY_NOT_FOUND')); } $document = JFactory::getDocument(); $document->setTitle(JHTML::_('string.truncate', $activity->title, 75)); CHeadHelper::setDescription(JHTML::_('string.truncate', $activity->title, 300, true)); //see if the user has blocked each other $getBlockStatus = new blockUser(); $blocked = $getBlockStatus->isUserBlocked($userId, 'profile'); if ($blocked && !COwnerHelper::isCommunityAdmin()) { JError::raiseWarning(404, JText::_('COM_COMMUNITY_ERROR_ACTIVITY_NOT_FOUND')); } //everything is fine, lets get to the activity echo $this->_getNewsfeedHTML(); }
/** * Block user */ public function blockUser() { $my = CFactory::getUser(); $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; if ($my->id == 0) { return $this->blockUnregister(); } $userId = $jinput->get->get('fid', '', 'INT'); CFactory::load('libraries', 'block'); $blockUser = new blockUser(); $blockUser->block($userId); }
/** * @todo: check permission and message ownership */ public function ajaxCompose($id) { $filter = JFilterInput::getInstance(); $id = $filter->clean($id, 'int'); if (!COwnerHelper::isRegisteredUser()) { return $this->ajaxBlockUnregister(); } $objResponse = new JAXResponse(); $config = CFactory::getConfig(); $user = CFactory::getUser($id); $my = CFactory::getUser(); if ($my->id == 0) { return $this->ajaxBlockUnregister(); } CFactory::load('helpers', 'owner'); CFactory::load('libraries', 'block'); $getBlockStatus = new blockUser(); // Block banned users if ($getBlockStatus->isUserBlocked($id, 'inbox') && !COwnerHelper::isCommunityAdmin()) { $this->ajaxblock(); } CFactory::load('helpers', 'time'); $inboxModel =& $this->getModel('inbox'); $lastSent = $inboxModel->getLastSentTime($my->id); $dateNow = new JDate(); CFactory::load('helpers', 'owner'); // We need to make sure that this guy are not spamming other people inbox // by checking against his last message time. Make sure it doesn't exceed // pmFloodLimit config (in seconds) if ($dateNow->toUnix() - $lastSent->toUnix() < $config->get('floodLimit') && !COwnerHelper::isCommunityAdmin()) { $html = '<dl id="system-message"><dt class="notice">' . JText::_('COM_COMMUNITY_NOTICE') . '</dt><dd class="notice message"><ul><li>'; $html .= JText::sprintf('COM_COMMUNITY_PLEASE_WAIT_BEFORE_SENDING_MESSAGE', $config->get('floodLimit')); $html .= '</li></ul></dd></dl>'; $actions = '<button class="button" onclick="cWindowHide();" name="cancel">' . JText::_('COM_COMMUNITY_BUTTON_CLOSE_BUTTON') . '</button>'; $objResponse->addScriptCall('cWindowAddContent', $html, $actions); return $objResponse->sendResponse(); } // @rule: Check if user exceeded daily limit $maxSent = $config->get('pmperday'); $totalSent = $inboxModel->getTotalMessageSent($my->id); if ($totalSent >= $maxSent && $maxSent != 0) { $html = '<dl id="system-message"><dt class="notice">' . JText::_('COM_COMMUNITY_NOTICE') . '</dt><dd class="notice message"><ul><li>'; $html .= JText::_('COM_COMMUNITY_PM_LIMIT_REACHED'); $html .= '</li></ul></dd></dl>'; $actions = '<button class="button" onclick="cWindowHide();" name="cancel">' . JText::_('COM_COMMUNITY_BUTTON_CLOSE_BUTTON') . '</button>'; $objResponse->addScriptCall('cWindowAddContent', $html, $actions); return $objResponse->sendResponse(); } //==================================== $tmpl = new CTemplate(); $tmpl->set('user', $user); $html = $tmpl->fetch('inbox.ajaxcompose'); $actions = '<button class="button" onclick="javascript:return joms.messaging.send();" name="send">' . JText::_('COM_COMMUNITY_SEND_BUTTON') . '</button> '; $actions .= '<button class="button" onclick="javascript:cWindowHide();" name="cancel">' . JText::_('COM_COMMUNITY_CANCEL_BUTTON') . '</button>'; // Change cWindow title $objResponse->addAssign('cwin_logo', 'innerHTML', JText::_('COM_COMMUNITY_INBOX_TITLE_WRITE')); $objResponse->addScriptCall('cWindowAddContent', $html, $actions); return $objResponse->sendResponse(); }