コード例 #1
0
 public function onGroupJoin($group, $userId)
 {
     //@rule: Clear existing invites fromt he invitation table once the user joined the group
     $groupInvite =& JTable::getInstance('GroupInvite', 'CTable');
     if ($groupInvite->load($group->id, $userId)) {
         $groupInvite->delete();
     }
     $member =& JTable::getInstance('GroupMembers', 'CTable');
     $member->load($userId, $group->id);
     $groupModel = CFactory::getModel('groups');
     $admins = $groupModel->getAdmins($group->id, null);
     $params = $group->getParams();
     //@rule: Send notification when necessary
     if ($params->get('joinrequestnotification') || $params->get('newmembernotification')) {
         $user = CFactory::getUser($userId);
         $subject = JText::sprintf('COM_COMMUNITY_GROUPS_EMAIL_NEW_MEMBER_JOINED_SUBJECT', $user->getDisplayName(), $group->name);
         if (!$member->approved) {
             $subject = JText::sprintf('COM_COMMUNITY_NEW_MEMBER_REQUESTED_TO_JOIN_GROUP_EMAIL_SUBJECT', $user->getDisplayName(), $group->name);
         }
         // Add notification
         CFactory::load('libraries', 'notification');
         $params = new CParameter('');
         $params->set('url', 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id);
         $params->set('group', $group->name);
         $params->set('user', $user->getDisplayName());
         $params->set('approved', $member->approved);
         foreach ($admins as $admin) {
             CNotificationLibrary::add('etype_groups_member_join', $user->id, $admin->id, $subject, '', 'groups.memberjoin', $params);
         }
     }
 }
コード例 #2
0
ファイル: events.php プロジェクト: Jougito/DynWeb
 public function ajaxTogglePublish($id, $type, $eventName = false)
 {
     // Send email notification to owner when a group is published.
     $config = CFactory::getConfig();
     $event = JTable::getInstance('Event', 'CTable');
     $event->load($id);
     // Added published = 2 for new created event under moderation.
     if ($type == 'published' && $event->published == 2) {
         $lang = JFactory::getLanguage();
         $lang->load('com_community', JPATH_ROOT);
         $my = CFactory::getUser();
         // Add notification
         //CFactory::load('libraries', 'notification');
         //CFactory::load('helpers', 'event');
         if ($event->type == CEventHelper::GROUP_TYPE && $event->contentid != 0) {
             $url = 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id . '&groupid=' . $event->contentid;
         } else {
             $url = 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id;
         }
         //Send notification email to owner
         $params = new CParameter('');
         $params->set('url', 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id);
         $params->set('event', $event->title);
         $params->set('event_url', 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id);
         CNotificationLibrary::add('events_notify_creator', $my->id, $event->creator, JText::_('COM_COMMUNITY_EVENTS_PUBLISHED_MAIL_SUBJECT'), '', 'events.notifycreator', $params);
         //CFactory::load('libraries', 'events');
         // Add activity stream for new created event.
         $event->published = 1;
         // by pass published checking.
         CEvents::addEventStream($event);
         // send notification email to group's member for new created event.
         CEvents::addGroupNotification($event);
     }
     return parent::ajaxTogglePublish($id, $type, 'events');
 }
コード例 #3
0
ファイル: events.php プロジェクト: Simarpreet05/joomla
 public static function sendCommentNotification(CTableWall $wall, $message)
 {
     CFactory::load('libraries', 'notification');
     $my = CFactory::getUser();
     $targetUser = CFactory::getUser($wall->post_by);
     $url = 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $wall->contentid;
     $params = $targetUser->getParams();
     $params = new CParameter('');
     $params->set('url', $url);
     $params->set('message', $message);
     CNotificationLibrary::add('etype_events_submit_wall_comment', $my->id, $targetUser->id, JText::sprintf('PLG_WALLS_WALL_COMMENT_EMAIL_SUBJECT', $my->getDisplayName()), '', 'events.wallcomment', $params);
     return true;
 }
コード例 #4
0
ファイル: bookmarks.php プロジェクト: Simarpreet05/joomla
 public function ajaxEmailPage($uri, $emails, $message = '')
 {
     $filter = JFilterInput::getInstance();
     $uri = $filter->clean($uri, 'string');
     $emails = $filter->clean($emails, 'string');
     $message = $filter->clean($message, 'string');
     $message = stripslashes($message);
     $mainframe =& JFactory::getApplication();
     $bookmarks = CFactory::getBookmarks($uri);
     $mailqModel = CFactory::getModel('mailq');
     $config = CFactory::getConfig();
     $response = new JAXResponse();
     if (empty($emails)) {
         $content = '<div>' . JText::_('COM_COMMUNITY_SHARE_INVALID_EMAIL') . '</div>';
         $actions = '<input type="button" class="button" onclick="joms.bookmarks.show(\'' . $uri . '\');" value="' . JText::_('COM_COMMUNITY_GO_BACK_BUTTON') . '"/>';
     } else {
         $emails = explode(',', $emails);
         $errors = array();
         // Add notification
         CFactory::load('libraries', 'notification');
         foreach ($emails as $email) {
             $email = JString::trim($email);
             CFactory::load('helpers', 'validate');
             if (!empty($email) && CValidateHelper::email($email)) {
                 $params = new CParameter('');
                 $params->set('uri', $uri);
                 $params->set('message', $message);
                 CNotificationLibrary::add('etype_system_bookmarks_email', '', $email, JText::sprintf('COM_COMMUNITY_SHARE_EMAIL_SUBJECT', $config->get('sitename')), '', 'bookmarks', $params);
             } else {
                 // If there is errors with email, inform the user.
                 $errors[] = $email;
             }
         }
         if ($errors) {
             $content = '<div>' . JText::_('COM_COMMUNITY_EMAILS_ARE_INVALID') . '</div>';
             foreach ($errors as $error) {
                 $content .= '<div style="font-weight:700;color: red;">' . $error . '</span>';
             }
             $actions = '<input type="button" class="button" onclick="joms.bookmarks.show(\'' . $uri . '\');" value="' . JText::_('COM_COMMUNITY_GO_BACK_BUTTON') . '"/>';
         } else {
             $content = '<div>' . JText::_('COM_COMMUNITY_EMAIL_SENT_TO_RECIPIENTS') . '</div>';
             $actions = '<input type="button" class="button" onclick="cWindowHide();" value="' . JText::_('COM_COMMUNITY_DONE_BUTTON') . '"/>';
         }
     }
     $response->addAssign('cwin_logo', 'innerHTML', JText::_('COM_COMMUNITY_SHARE_THIS'));
     $response->addScriptCall('cWindowAddContent', $content, $actions);
     return $response->sendResponse();
 }
コード例 #5
0
ファイル: profile.php プロジェクト: Jougito/DynWeb
 public static function sendCommentNotification(CTableWall $wall, $message)
 {
     //CFactory::load( 'libraries' , 'notification' );
     $my = CFactory::getUser();
     $targetUser = CFactory::getUser($wall->post_by);
     $url = 'index.php?option=com_community&view=profile&userid=' . $wall->contentid;
     $userParams = $targetUser->getParams();
     $params = new CParameter('');
     $params->set('url', $url);
     $params->set('message', $message);
     if ($my->id != $targetUser->id && $userParams->get('notifyWallComment')) {
         CNotificationLibrary::add('profile_submit_wall_comment', $my->id, $targetUser->id, JText::sprintf('PLG_WALLS_WALL_COMMENT_EMAIL_SUBJECT', $my->getDisplayName()), '', 'profile.wallcomment', $params);
         return true;
     }
     return false;
 }
コード例 #6
0
ファイル: bookmarks.php プロジェクト: Jougito/DynWeb
 public function ajaxEmailPage($uri, $emails, $message = '')
 {
     $filter = JFilterInput::getInstance();
     $uri = $filter->clean($uri, 'string');
     $emails = $filter->clean($emails, 'string');
     $message = $filter->clean($message, 'string');
     $message = stripslashes($message);
     $mainframe = JFactory::getApplication();
     $bookmarks = CFactory::getBookmarks($uri);
     $mailqModel = CFactory::getModel('mailq');
     $config = CFactory::getConfig();
     $response = new JAXResponse();
     $json = array();
     if (empty($emails)) {
         $json['error'] = JText::_('COM_COMMUNITY_SHARE_INVALID_EMAIL');
     } else {
         $emails = explode(',', $emails);
         $errors = array();
         // Add notification
         //CFactory::load( 'libraries' , 'notification' );
         foreach ($emails as $email) {
             $email = JString::trim($email);
             if (!empty($email) && CValidateHelper::email($email)) {
                 $params = new CParameter('');
                 $params->set('uri', $uri);
                 $params->set('message', $message);
                 CNotificationLibrary::add('system_bookmarks_email', '', $email, JText::sprintf('COM_COMMUNITY_SHARE_EMAIL_SUBJECT', $config->get('sitename')), '', 'bookmarks', $params);
             } else {
                 // If there is errors with email, inform the user.
                 $errors[] = $email;
             }
         }
         if ($errors) {
             $content = '<div>' . JText::_('COM_COMMUNITY_EMAILS_ARE_INVALID') . '</div>';
             foreach ($errors as $error) {
                 $content .= '<div style="font-weight:bold; color:red;">' . $error . '</div>';
             }
             $json['error'] = $content;
         } else {
             $content = JText::_('COM_COMMUNITY_EMAIL_SENT_TO_RECIPIENTS');
             $json['message'] = $content;
         }
     }
     die(json_encode($json));
 }
コード例 #7
0
ファイル: groups.php プロジェクト: Simarpreet05/joomla
 public function ajaxTogglePublish($id, $type)
 {
     // Send email notification to owner when a group is published.
     $config =& CFactory::getConfig();
     $group =& JTable::getInstance('Group', 'CTable');
     $group->load($id);
     if ($type == 'published' && $group->published == 0 && $config->get('moderategroupcreation')) {
         $lang =& JFactory::getLanguage();
         $lang->load('com_community', JPATH_ROOT);
         $my =& CFactory::getUser();
         // Add notification
         CFactory::load('libraries', 'notification');
         //Send notification email to owner
         $params = new CParameter('');
         $params->set('url', 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id);
         $params->set('groupName', $group->name);
         CNotificationLibrary::add('etype_groups_notify_creator', $my->id, $group->ownerid, JText::sprintf('COM_COMMUNITY_GROUPS_PUBLISHED_MAIL_SUBJECT', $group->name), '', 'groups.notifycreator', $params);
     }
     return parent::ajaxTogglePublish($id, $type, 'groups');
 }
コード例 #8
0
 public function onEventCreate($event)
 {
     $config = CFactory::getConfig();
     // Send an email notification to the site admin's when there is a new group created
     if ($config->get('event_moderation')) {
         $userModel = CFactory::getModel('User');
         $my = CFactory::getUser();
         $admins = $userModel->getSuperAdmins();
         // Add notification
         CFactory::load('libraries', 'notification');
         //Send notification email to administrators
         foreach ($admins as $row) {
             if ($row->sendEmail) {
                 $params = new CParameter('');
                 $params->set('url', JURI::root() . 'administrator/index.php?option=com_community&view=events');
                 $params->set('title', $event->title);
                 CNotificationLibrary::add('etype_events_notify_admin', $my->id, $row->id, JText::sprintf('COM_COMMUNITY_EVENTS_MODERATION_NOTICE', $event->title), '', 'events.notifyadmin', $params);
             }
         }
     }
 }
コード例 #9
0
 public function onEventCreate($event)
 {
     $config = CFactory::getConfig();
     // Send an email notification to the site admin's when there is a new group created
     if ($config->get('event_moderation')) {
         $userModel = CFactory::getModel('User');
         $my = CFactory::getUser();
         $admins = $userModel->getSuperAdmins();
         //Send notification email to administrators
         foreach ($admins as $row) {
             if ($event->type == CEventHelper::GROUP_TYPE && $event->contentid != 0) {
                 $event_url = 'index.php?option=com_community&view=events&task=viewevent&groupid=' . $event->contentid . '&eventid=' . $event->id;
             } else {
                 $event_url = 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id;
             }
             $params = new CParameter('');
             $params->set('url', JURI::root() . 'administrator/index.php?option=com_community&view=events');
             $params->set('title', $event->title);
             $params->set('event', $event->title);
             $params->set('event_url', JURI::root() . 'administrator/index.php?option=com_community&view=events');
             CNotificationLibrary::add('events_notify_admin', $my->id, $row->id, JText::sprintf('COM_COMMUNITY_EVENT_CREATION_MODERATION_EMAIL_SUBJECT'), '', 'events.notifyadmin', $params);
         }
     }
 }
コード例 #10
0
ファイル: friends.php プロジェクト: joshjim27/jobsglobal
 public function request($target, $friends = array())
 {
     // remove duplicate id
     $friends = array_unique($friends);
     $model = CFactory::getModel('friends');
     $targetUser = CFactory::getUser($target);
     $my = JFactory::getUser();
     $params = new CParameter('');
     $params->set('url', 'index.php?option=com_community&view=profile&userid=' . $targetUser->id);
     if ($target == 0 || empty($friends)) {
         return false;
     }
     foreach ($friends as $friendId) {
         $connection = count($model->getFriendConnection($target, $friendId));
         // If stanger id is not in connection and stranger id in not myId, do add
         if ($connection == 0 && $friendId != $my->id) {
             $model->addFriend($friendId, $target);
             CNotificationLibrary::add('friends_request_connection', $targetUser->id, $friendId, JText::sprintf('COM_COMMUNITY_FRIEND_ADD_REQUEST', $targetUser->getDisplayName()), '', 'friends/request-sent', $params);
         }
     }
     return true;
 }
コード例 #11
0
ファイル: photos.php プロジェクト: Jougito/DynWeb
 private function _createPhotoUploadStream($album, $jsonObj)
 {
     $obj = json_decode($jsonObj);
     $photoIds = array();
     $batchcount = count($obj->files);
     foreach ($obj->files as $file) {
         $photoIds[] = $file->photoId;
     }
     $photoTable = JTable::getInstance('Photo', 'cTable');
     $photoTable->load($photoIds[count($photoIds) - 1]);
     $my = CFactory::getUser();
     $handler = $this->_getHandler($album);
     // Generate activity stream
     $act = new stdClass();
     $act->cmd = 'photo.upload';
     $act->actor = $my->id;
     $act->access = $album->permissions;
     $act->target = 0;
     $act->title = '';
     // Empty title, auto-generated by stream
     $act->content = '';
     // Gegenerated automatically by stream. No need to add anything
     $act->app = 'photos';
     $act->cid = $album->id;
     $act->location = $album->location;
     // Store group info
     // I hate to load group here, but unfortunately, album does
     // not store group permission setting
     $group = JTable::getInstance('Group', 'CTable');
     $group->load($album->groupid);
     $act->groupid = $album->groupid;
     $act->group_access = $group->approvals;
     // Allow comment on the album
     $act->comment_type = 'photos';
     $act->comment_id = $photoTable->id;
     // Allow like on the album
     $act->like_type = 'photo';
     $act->like_id = $photoTable->id;
     $params = new CParameter('');
     $params->set('multiUrl', $handler->getAlbumURI($album->id, false));
     $params->set('photoid', $photoTable->id);
     $params->set('action', 'upload');
     $params->set('photo_url', $photoTable->getThumbURI());
     $params->set('style', COMMUNITY_STREAM_STYLE);
     // Get the upload count per session
     $session = JFactory::getSession();
     $uploadSessionCount = $session->get('album-' . $album->id . '-upload', 0);
     $params->set('count', $uploadSessionCount);
     $params->set('batchcount', $batchcount);
     $params->set('photosId', implode(',', $photoIds));
     // Add activity logging
     CActivityStream::add($act, $params->toString());
 }
コード例 #12
0
ファイル: activities.php プロジェクト: joshjim27/jobsglobal
 /**
  * AJAX method to add predefined activity
  * */
 public function ajaxAddPredefined($key, $message = '', $privacy = 0)
 {
     $objResponse = new JAXResponse();
     $my = CFactory::getUser();
     $filter = JFilterInput::getInstance();
     $key = $filter->clean($key, 'string');
     $message = $filter->clean($message, 'string');
     $privacy = $filter->clean($privacy, 'int');
     if (!COwnerHelper::isCommunityAdmin() || empty($message)) {
         return;
     }
     // Predefined system custom activity.
     $system = array('system.registered', 'system.populargroup', 'system.totalphotos', 'system.popularprofiles', 'system.popularphotos', 'system.popularvideos');
     $act = new stdClass();
     $act->actor = 0;
     //$my->id; System message should not capture actor. Otherwise the stream filter will be inaccurate
     $act->target = 0;
     $act->app = 'system';
     $act->access = !$privacy ? 0 : $privacy;
     $params = new CParameter('');
     if (in_array($key, $system)) {
         switch ($key) {
             case 'system.registered':
                 // $usersModel   = CFactory::getModel( 'user' );
                 // $now          = new JDate();
                 // $date         = CTimeHelper::getDate();
                 // $title        = JText::sprintf('COM_COMMUNITY_TOTAL_USERS_REGISTERED_THIS_MONTH_ACTIVITY_TITLE', $usersModel->getTotalRegisteredByMonth($now->format('Y-m')) , $date->_monthToString($now->format('m')));
                 $act->app = 'system.members.registered';
                 $act->cmd = 'system.registered';
                 $act->title = '';
                 $act->content = '';
                 $params->set('action', 'registered_users');
                 break;
             case 'system.populargroup':
                 // $groupsModel = CFactory::getModel('groups');
                 // $activeGroup = $groupsModel->getMostActiveGroup();
                 // $title       = JText::sprintf('COM_COMMUNITY_MOST_POPULAR_GROUP_ACTIVITY_TITLE', $activeGroup->name);
                 // $act->cmd    = 'groups.popular';
                 // $act->cid    = $activeGroup->id;
                 // $act->title  = $title;
                 $act->app = 'system.groups.popular';
                 $params->set('action', 'top_groups');
                 // $params->set('group_url', CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid='.$activeGroup->id));
                 break;
             case 'system.totalphotos':
                 // $photosModel = CFactory::getModel( 'photos' );
                 // $total       = $photosModel->getTotalSitePhotos();
                 $act->app = 'system.photos.total';
                 $act->cmd = 'photos.total';
                 $act->title = '';
                 //JText::sprintf('COM_COMMUNITY_TOTAL_PHOTOS_ACTIVITY_TITLE', $total);
                 $params->set('action', 'total_photos');
                 // $params->set('photos_url', CRoute::_('index.php?option=com_community&view=photos'));
                 break;
             case 'system.popularprofiles':
                 $act->app = 'system.members.popular';
                 $act->cmd = 'members.popular';
                 $act->title = '';
                 //JText::sprintf('COM_COMMUNITY_ACTIVITIES_TOP_PROFILES', 5);
                 $params->set('action', 'top_users');
                 // $params->set('count', 5);
                 break;
             case 'system.popularphotos':
                 $act->app = 'system.photos.popular';
                 $act->cmd = 'photos.popular';
                 $act->title = '';
                 //JText::sprintf('COM_COMMUNITY_ACTIVITIES_TOP_PHOTOS', 5);
                 $params->set('action', 'top_photos');
                 // $params->set('count', 5);
                 break;
             case 'system.popularvideos':
                 $act->app = 'system.videos.popular';
                 $act->cmd = 'videos.popular';
                 $act->title = '';
                 //JText::sprintf( 'COM_COMMUNITY_ACTIVITIES_TOP_VIDEOS', 5 );
                 $params->set('action', 'top_videos');
                 // $params->set('count', 5);
                 break;
         }
     } else {
         // For additional custom activities, we only take the content passed by them.
         if (!empty($message)) {
             $message = CStringHelper::escape($message);
             $app = explode('.', $key);
             $app = isset($app[0]) ? $app[0] : 'system';
             $act->app = 'system.message';
             $act->title = $message;
             $params->set('action', 'message');
         }
     }
     $this->cacheClean(array(COMMUNITY_CACHE_TAG_ACTIVITIES));
     // Allow comments on all these
     $act->comment_id = CActivities::COMMENT_SELF;
     $act->comment_type = $key;
     // Allow like for all admin activities
     $act->like_id = CActivities::LIKE_SELF;
     $act->like_type = $key;
     // Add activity logging
     CActivityStream::add($act, $params->toString());
     $objResponse->addAssign('activity-stream-container', 'innerHTML', $this->_getActivityStream());
     $objResponse->addScriptCall("joms.jQuery('.jomTipsJax').addClass('jomTips');");
     $objResponse->addScriptCall('joms.tooltip.setup();');
     return $objResponse->sendResponse();
 }
コード例 #13
0
ファイル: activities.php プロジェクト: Jougito/DynWeb
 /**
  * Function to share status
  * @param [Int] $activityId [description]
  * @param [JSON] $attachment [description]
  */
 public static function addShare($activityId, $attachment)
 {
     $my = CFactory::getUser();
     $params = new CParameter('');
     $attachment = json_decode($attachment);
     $act = new stdClass();
     $act->cmd = 'profile.status.share';
     $act->actor = $my->id;
     $act->target = $my->id;
     $act->title = $attachment->msg;
     $act->content = '';
     $act->app = 'profile.status.share';
     $act->verb = 'share';
     $act->cid = $my->id;
     $act->comment_id = CActivities::COMMENT_SELF;
     $act->comment_type = 'profile.status.share';
     $act->like_id = CActivities::LIKE_SELF;
     $act->like_type = 'profile.status.share';
     $act->access = $attachment->privacy;
     $params->set('activityId', $activityId);
     $act->params = $params->toString();
     return self::add($act);
 }
コード例 #14
0
ファイル: user.php プロジェクト: joshjim27/jobsglobal
 /**
  * @param $message
  * @param $actor
  * @param $object
  * @param array $info
  * @return bool
  */
 static function parseTaggedUserNotification($message, $actor, $object = null, $info = array())
 {
     $pattern = '/@\\[\\[(\\d+):([a-z]+):([^\\]]+)\\]\\]/';
     preg_match_all($pattern, $message, $matches);
     if (isset($matches[1]) && count($matches[1]) > 0) {
         //lets count total recipients and blast notifications
         $taggedIds = array();
         foreach ($matches[1] as $uid) {
             $taggedIds[] = CFactory::getUser($uid)->get('id') != 0 ? $uid : null;
         }
         if ($info['type'] == 'discussion-comment') {
             //link to lead the user to the discussion
             $url = CRoute::emailLink('index.php?option=com_community&view=groups&task=viewdiscussion&groupid=' . $info['group_id'] . '&topicid=' . $info['discussion_id'] . '#activity-stream-container');
             $params = new CParameter();
             $params->set('url', $url);
             $params->set('content', $message);
             $params->set('discussion', '<a href="' . $url . '">' . JText::_('COM_COMMUNITY_DISCUSSION') . '</a>');
             $emailSubject = JText::sprintf('COM_COMMUNITY_DISCUSSION_USER_TAGGED_EMAIL_SUBJECT');
             $emailContent = JText::sprintf('COM_COMMUNITY_USER_TAGGED_COMMENT_EMAIL_CONTENT', $url);
             $notificationMessage = JText::_('COM_COMMUNITY_NOTIFICATION_DISCUSSION_USER_TAGGED');
         } else {
             if ($info['type'] == 'album-comment') {
                 //link to lead the user to the album
                 $url = CRoute::emailLink('index.php?option=com_community&view=photos&task=album&userid=' . $info['album_creator_id'] . '&albumid=' . $info['album_id'] . '#activity-stream-container');
                 $params = new CParameter();
                 $params->set('url', $url);
                 $params->set('content', $message);
                 $params->set('album', '<a href="' . $url . '">' . JText::_('COM_COMMUNITY_SINGULAR_ALBUM') . '</a>');
                 $emailSubject = JText::sprintf('COM_COMMUNITY_ALBUM_USER_TAGGED_EMAIL_SUBJECT');
                 $emailContent = JText::sprintf('COM_COMMUNITY_USER_TAGGED_COMMENT_EMAIL_CONTENT', $url);
                 $notificationMessage = JText::_('COM_COMMUNITY_NOTIFICATION_ALBUM_USER_TAGGED');
             } else {
                 if ($info['type'] == 'video-comment') {
                     //link to lead the user to the video
                     $url = CRoute::emailLink('index.php?option=com_community&view=videos&task=video&userid=' . $actor->id . '&videoid=' . $info['video_id'] . '#activity-stream-container');
                     $params = new CParameter();
                     $params->set('url', $url);
                     $params->set('content', $message);
                     $params->set('video', '<a href="' . $url . '">' . JText::_('COM_COMMUNITY_SINGULAR_PHOTO') . '</a>');
                     $emailSubject = JText::sprintf('COM_COMMUNITY_VIDEO_USER_TAGGED_EMAIL_SUBJECT');
                     $emailContent = JText::sprintf('COM_COMMUNITY_USER_TAGGED_COMMENT_EMAIL_CONTENT', $url);
                     $notificationMessage = JText::_('COM_COMMUNITY_NOTIFICATION_VIDEO_USER_TAGGED');
                 } else {
                     if ($info['type'] == 'image-comment') {
                         //link to lead the user to the picture
                         $url = CRoute::emailLink('index.php?option=com_community&view=photos&task=photo&userid=' . $actor->id . '&albumid=' . $info['album_id'] . '&photoid=' . $info['image_id'] . '#activity-stream-container');
                         $params = new CParameter();
                         $params->set('url', $url);
                         $params->set('content', $message);
                         $params->set('photo', '<a href="' . $url . '">' . JText::_('COM_COMMUNITY_SINGULAR_PHOTO') . '</a>');
                         $emailSubject = JText::sprintf('COM_COMMUNITY_PHOTO_USER_TAGGED_EMAIL_SUBJECT');
                         $emailContent = JText::sprintf('COM_COMMUNITY_USER_TAGGED_COMMENT_EMAIL_CONTENT', $url);
                         $notificationMessage = JText::_('COM_COMMUNITY_NOTIFICATION_PHOTO_USER_TAGGED');
                     } else {
                         if ($info['type'] == 'post-comment' && $object != null) {
                             //default notification, and object is activity
                             //set parameter to be replaced in the template
                             $url = CRoute::emailLink('index.php?option=com_community&view=profile&userid=' . $object->actor . '&actid=' . $object->id . '#activity-stream-container');
                             $params = new CParameter();
                             $params->set('url', $url);
                             $params->set('content', $message);
                             $params->set('post', '<a href="' . $url . '">' . JText::_('COM_COMMUNITY_SINGULAR_POST') . '</a>');
                             $emailSubject = JText::sprintf('COM_COMMUNITY_PROFILE_USER_TAGGED_EMAIL_SUBJECT');
                             $emailContent = JText::sprintf('COM_COMMUNITY_PROFILE_USER_TAGGED_COMMENT_EMAIL_CONTENT', $url);
                             $notificationMessage = JText::_('COM_COMMUNITY_NOTIFICATION_USER_TAGGED');
                         } else {
                             return false;
                         }
                     }
                 }
             }
         }
         //add to notifications
         CNotificationLibrary::add('users_tagged', $actor->id, $taggedIds, $emailSubject, $emailContent, '', $params, true, '', $notificationMessage);
         return true;
     }
     return false;
 }
コード例 #15
0
ファイル: walls.php プロジェクト: Simarpreet05/joomla
        /**
         * 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
         * 
         **/
        function ajaxSaveWall($response, $message, $uniqueId, $cache_id = "")
        {
            $my = CFactory::getUser();
            $user = CFactory::getUser($uniqueId);
            $config = CFactory::getConfig();
            JPlugin::loadLanguage('plg_walls', JPATH_ADMINISTRATOR);
            // Load libraries
            CFactory::load('models', 'photos');
            CFactory::load('libraries', 'wall');
            CFactory::load('helpers', 'url');
            CFactory::load('libraries', 'activities');
            $message = JString::trim($message);
            $message = strip_tags($message);
            if (empty($message)) {
                $response->addAlert(JText::_('PLG_WALLS_PLEASE_ADD_MESSAGE'));
            } else {
                $maxchar = $this->params->get('charlimit', 0);
                if (!empty($maxchar)) {
                    $msglength = strlen($message);
                    if ($msglength > $maxchar) {
                        $message = substr($message, 0, $maxchar);
                    }
                }
                // @rule: Spam checks
                if ($config->get('antispam_akismet_walls')) {
                    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=' . $user->id));
                    $filter->setType('message');
                    $filter->setIP($_SERVER['REMOTE_ADDR']);
                    if ($filter->isSpam()) {
                        $response->addAlert(JText::_('COM_COMMUNITY_WALLS_MARKED_SPAM'));
                        return $response->sendResponse();
                    }
                }
                $wall = CWallLibrary::saveWall($uniqueId, $message, 'user', $my, $my->id == $user->id, 'profile,profile');
                CFactory::load('libraries', 'activities');
                CFactory::load('helpers', 'videos');
                $matches = cGetVideoLinkMatches($message);
                $activityParams = '';
                // We only want the first result of the video to be in the activity
                if ($matches) {
                    $videoLink = $matches[0];
                    CFactory::load('libraries', 'videos');
                    $videoLib = new CVideoLibrary();
                    $provider = $videoLib->getProvider($videoLink);
                    $activityParams .= 'videolink=' . $videoLink . "\r\n";
                    if ($provider->isValid()) {
                        $activityParams .= 'url=' . $provider->getThumbnail();
                    }
                }
                $act = new stdClass();
                $act->cmd = 'profile.wall.create';
                $act->actor = $my->id;
                $act->target = $uniqueId;
                $act->title = JText::_('COM_COMMUNITY_ACTIVITIES_WALL_POST_PROFILE');
                $act->content = '';
                $act->app = 'walls';
                $act->cid = $wall->id;
                // Allow comments on all these
                $act->comment_id = CActivities::COMMENT_SELF;
                $act->comment_type = 'walls';
                CActivityStream::add($act, $activityParams);
                // @rule: Send notification to the profile user.
                if ($my->id != $user->id) {
                    CFactory::load('libraries', 'notification');
                    $params = new CParameter('');
                    $params->set('url', 'index.php?option=com_community&view=profile&userid=' . $user->id);
                    $params->set('message', $message);
                    CNotificationLibrary::add('etype_profile_submit_wall', $my->id, $user->id, JText::sprintf('PLG_WALLS_NOTIFY_EMAIL_SUBJECT', $my->getDisplayName()), '', 'profile.wall', $params);
                }
                //add user points
                CFactory::load('libraries', 'userpoints');
                CUserPoints::assignPoint('profile.wall.create');
                $response->addScriptCall('joms.walls.insert', $wall->content);
                $response->addScriptCall('if(joms.jQuery(".content-nopost").length){
											joms.jQuery("#wall-empty-container").remove();
										}');
                $cache =& JFactory::getCache('plgCommunityWalls');
                $cache->remove($cache_id);
                $cache =& JFactory::getCache('plgCommunityWalls_fullview');
                $cache->remove($cache_id);
            }
            return $response;
        }
コード例 #16
0
ファイル: group.php プロジェクト: Jougito/DynWeb
 /**
  * In 2.4, wall is removed and converted to stream data
  * On first load, import old wall to stream data
  */
 public function upgradeWallToStream()
 {
     $params = new CParameter($this->params);
     if ($params->get('stream') != 1) {
         $this->groupActivitiesMigrate();
         /*
          UPDATE `jos_community_activities` as a
          SET
          a.`title` = a.`content` ,
          a.`content` = '',
          a.`groupid`= a.`cid`,
          a.`comment_type` = 'groups.wall',
          a.`comment_id` = a.`id`,
          a.`like_type` = 'groups.wall',
          a.`like_id` = a.`id`,
          a.`params` = ''
         
          WHERE a.`app` = 'groups.wall' AND a.`groupid` IS NULL
         
         
          $query	= 'UPDATE '. $this->_db->quoteName('#__community_activities') . ' as a '
          .' SET '
          .' a.'. $this->_db->quoteName('title'). ' = '. $this->_db->quoteName('content'). ' , '
          .' a.'. $this->_db->quoteName('content'). ' = '. $this->_db->Quote(''). ', '
          .' a.'. $this->_db->quoteName('groupid'). '= a.'. $this->_db->quoteName('cid'). ', '
          .' a.'. $this->_db->quoteName('comment_type'). ' = '. $this->_db->Quote('groups.wall'). ', '
          .' a.'. $this->_db->quoteName('comment_id'). ' = a.'. $this->_db->quoteName('id'). ', '
          .' a.'. $this->_db->quoteName('like_type'). ' = '. $this->_db->Quote('groups.wall'). ', '
          .' a.'. $this->_db->quoteName('like_id'). ' = a.'. $this->_db->quoteName('id'). ', '
          .' a.'. $this->_db->quoteName('params'). ' = '. $this->_db->Quote('')
          .' WHERE '
          .' a.'. $this->_db->quoteName('app'). ' = '. $this->_db->Quote('groups.wall')
          .' AND a.'. $this->_db->quoteName('groupid'). ' IS NULL ';
         
          $this->_db->setQuery($query);
          $this->_db->Query();
         */
         // Mark this group as upgraded
         $params = new CParameter($this->params);
         $params->set('stream', 1);
         $this->params = $params->toString();
         // Store will upgrade save the params AND update stream group_access data
         $this->store();
     }
 }
コード例 #17
0
ファイル: inbox.php プロジェクト: Jougito/DynWeb
 /**
  * A new message submitted via ajax
  */
 public function ajaxSend($postVars)
 {
     //$postVars pending filtering
     $objResponse = new JAXResponse();
     $config = CFactory::getConfig();
     $my = CFactory::getUser();
     if ($my->id == 0) {
         return $this->ajaxBlockUnregister();
     }
     //CFactory::load( 'helpers', 'time' );
     $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));
     }
     // Prevent users to send message to themselves.
     if ($postVars['to'] == $my->id) {
         $json = array();
         $json['title'] = JText::_('COM_COMMUNITY_NOTICE');
         $json['error'] = JText::_('COM_COMMUNITY_INBOX_MESSAGE_CANNOT_SEND_TO_SELF');
         die(json_encode($json));
     }
     $postVars = CAjaxHelper::toArray($postVars);
     $doCont = true;
     $errMsg = "";
     $resizeH = 0;
     if ($this->_isSpam($my, $postVars['subject'] . ' ' . $postVars['body'])) {
         $json = array();
         $json['title'] = JText::_('COM_COMMUNITY_NOTICE');
         $json['error'] = JText::_('COM_COMMUNITY_INBOX_MESSAGE_MARKED_SPAM');
         die(json_encode($json));
     }
     if (empty($postVars['subject']) || JString::trim($postVars['subject']) == '') {
         $json = array();
         $json['title'] = JText::_('COM_COMMUNITY_INBOX_TITLE_WRITE');
         $json['error'] = JText::_('COM_COMMUNITY_INBOX_SUBJECT_MISSING');
         $json['samestep'] = true;
         die(json_encode($json));
     }
     if (empty($postVars['body']) || JString::trim($postVars['body']) == '') {
         $json = array();
         $json['title'] = JText::_('COM_COMMUNITY_INBOX_TITLE_WRITE');
         $json['error'] = JText::_('COM_COMMUNITY_INBOX_MESSAGE_MISSING');
         $json['samestep'] = true;
         die(json_encode($json));
     }
     $data = $postVars;
     $model = $this->getModel('inbox');
     $pattern = "/<br \\/>/i";
     $replacement = "\r\n";
     $data['body'] = preg_replace($pattern, $replacement, $data['body']);
     $data['photo'] = isset($data['photo']) ? $data['photo'] : '';
     $msgid = $model->send($data);
     // Add user points.
     CUserPoints::assignPoint('inbox.message.send');
     // Add notification.
     $params = new CParameter('');
     $params->set('url', 'index.php?option=com_community&view=inbox&task=read&msgid=' . $msgid);
     $params->set('message', $data['body']);
     $params->set('title', $data['subject']);
     $params->set('msg_url', 'index.php?option=com_community&view=inbox&task=read&msgid=' . $msgid);
     $params->set('msg', JText::_('COM_COMMUNITY_PRIVATE_MESSAGE'));
     CNotificationLibrary::add('inbox_create_message', $my->id, $data['to'], JText::sprintf('COM_COMMUNITY_SENT_YOU_MESSAGE'), '', 'inbox.sent', $params);
     // Send response.
     $json = array();
     $json['message'] = JText::_('COM_COMMUNITY_INBOX_MESSAGE_SENT');
     die(json_encode($json));
 }
コード例 #18
0
ファイル: like.php プロジェクト: Jougito/DynWeb
 public function addLike($element, $itemId)
 {
     $my = CFactory::getUser();
     $like = JTable::getInstance('Like', 'CTable');
     $like->loadInfo($element, $itemId);
     $like->element = $element;
     $like->uid = $itemId;
     // Check if user already like
     $likesInArray = explode(',', trim($like->like, ','));
     /* Like once time */
     if (in_array($my->id, $likesInArray)) {
         return;
     }
     array_push($likesInArray, $my->id);
     $likesInArray = array_unique($likesInArray);
     $like->like = ltrim(implode(',', $likesInArray), ',');
     // Check if the user already dislike
     $dislikesInArray = explode(',', trim($like->dislike, ','));
     if (in_array($my->id, $dislikesInArray)) {
         // Remove user dislike from array
         $key = array_search($my->id, $dislikesInArray);
         unset($dislikesInArray[$key]);
         $like->dislike = implode(',', $dislikesInArray);
     }
     switch ($element) {
         case 'comment':
             //get the instance of the wall
             $wall = JTable::getInstance('Wall', 'CTable');
             $wall->load($itemId);
             if (!$wall->id) {
                 break;
             }
             if ($wall->type == "profile.status") {
                 $wall->type = "profile";
             }
             //load the stream id from activity stream
             $stream = JTable::getInstance('Activity', 'CTable');
             $stream->load(array('comment_id' => $wall->contentid, 'app' => $wall->type));
             if ($stream->id) {
                 $profile = CFactory::getUser($stream->actor);
                 $url = 'index.php?option=com_community&view=profile&userid=' . $profile->id . '&actid=' . $stream->id . '#activity-stream-container';
                 $params = new CParameter('');
                 $params->set('url', $url);
                 $params->set('comment', JText::_('COM_COMMUNITY_SINGULAR_COMMENT'));
                 $params->set('comment_url', $url);
                 $params->set('actor', $my->getDisplayName());
                 //add to notifications
                 CNotificationLibrary::add('comments_like', $my->id, $wall->post_by, JText::sprintf('COM_COMMUNITY_PROFILE_WALL_LIKE_EMAIL_SUBJECT'), '', 'comments.like', $params);
             }
             break;
         case 'photo':
             $photo = JTable::getInstance('Photo', 'CTable');
             $photo->load($itemId);
             if ($photo->id) {
                 $url = $photo->getRawPhotoURI();
                 $params = new CParameter('');
                 $params->set('url', $url);
                 $params->set('photo', JText::_('COM_COMMUNITY_SINGULAR_PHOTO'));
                 $params->set('photo_url', $url);
                 CNotificationLibrary::add('photos_like', $my->id, $photo->creator, JText::sprintf('COM_COMMUNITY_PHOTO_LIKE_EMAIL_SUBJECT'), '', 'photos.like', $params);
                 /* Adding user points */
                 CUserPoints::assignPoint('photos.like');
             }
             break;
         case 'album':
             $album = JTable::getInstance('Album', 'CTable');
             $album->load($itemId);
             if ($album->id) {
                 if ($album->groupid) {
                     $url = 'index.php?option=com_community&view=photos&task=album&albumid=' . $album->id . '&groupid=' . $album->groupid;
                 } else {
                     $url = 'index.php?option=com_community&view=photos&task=album&albumid=' . $album->id;
                 }
                 $params = new CParameter('');
                 $params->set('url', $url);
                 $params->set('album', $album->name);
                 $params->set('album_url', $url);
                 CNotificationLibrary::add('photos_like', $my->id, $album->creator, JText::sprintf('COM_COMMUNITY_ALBUM_LIKE_EMAIL_SUBJECT'), '', 'album.like', $params);
                 /* Adding user points */
                 CUserPoints::assignPoint('album.like');
             }
             break;
         case 'videos':
             $video = JTable::getInstance('Video', 'CTable');
             $video->load($itemId);
             if ($video->id) {
                 if ($video->groupid) {
                     $url = 'index.php?option=com_community&view=videos&task=video&groupid=' . $video->groupid . '&videoid=' . $video->id;
                 } else {
                     $url = 'index.php?option=com_community&view=videos&task=video&videoid=' . $video->id;
                 }
                 $params = new CParameter('');
                 $params->set('url', $url);
                 $params->set('video', $video->title);
                 $params->set('video_url', $url);
                 CNotificationLibrary::add('videos_like', $my->id, $video->creator, JText::sprintf('COM_COMMUNITY_VIDEO_LIKE_EMAIL_SUBJECT'), '', 'videos.like', $params);
                 /* Adding user points */
                 CUserPoints::assignPoint('videos.like');
             }
             break;
         case 'profile':
             $profile = CFactory::getUser($itemId);
             if ($profile->id) {
                 $url = 'index.php?option=com_community&view=profile&userid=' . $profile->id;
                 $params = new CParameter('');
                 $params->set('url', $url);
                 $params->set('profile', strtolower(JText::_('COM_COMMUNITY_NOTIFICATIONGROUP_PROFILE')));
                 $params->set('profile_url', $url);
                 CNotificationLibrary::add('profile_like', $my->id, $profile->id, JText::sprintf('COM_COMMUNITY_PROFILE_LIKE_EMAIL_SUBJECT'), '', 'profile.like', $params);
                 /* Adding user points */
                 CUserPoints::assignPoint('profile.like');
             }
             break;
         case 'profile.status':
             $stream = JTable::getInstance('Activity', 'CTable');
             $stream->load($itemId);
             if ($stream->id) {
                 $profile = CFactory::getUser($stream->actor);
                 $url = 'index.php?option=com_community&view=profile&userid=' . $profile->id . '&actid=' . $stream->id;
                 $params = new CParameter('');
                 $params->set('url', $url);
                 $params->set('stream', JText::_('COM_COMMUNITY_SINGULAR_STREAM'));
                 $params->set('stream_url', $url);
                 CNotificationLibrary::add('profile_stream_like', $my->id, $profile->id, JText::sprintf('COM_COMMUNITY_PROFILE_STREAM_LIKE_EMAIL_SUBJECT'), '', 'profile.stream.like', $params);
                 /* Adding user points */
                 CUserPoints::assignPoint('profile.stream.like');
             }
             break;
         case 'cover.upload':
             $photo = JTable::getInstance('Photo', 'CTable');
             $photo->load(CPhotosHelper::getPhotoOfStream($itemId));
             if ($photo->id) {
                 $url = $photo->getRawPhotoURI();
                 $params = new CParameter('');
                 $params->set('url', $url);
                 $params->set('photo', JText::_('COM_COMMUNITY_SINGULAR_PHOTO'));
                 $params->set('photo_url', $url);
                 CNotificationLibrary::add('photos_like', $my->id, $photo->creator, JText::sprintf('COM_COMMUNITY_COVER_LIKE_EMAIL_SUBJECT'), '', 'photos.like', $params);
                 /* Adding user points */
                 CUserPoints::assignPoint('photos.like');
             }
             break;
         case 'profile.avatar.upload':
             $stream = JTable::getInstance('Activity', 'CTable');
             $stream->load($itemId);
             if ($stream->id) {
                 $profile = CFactory::getUser($stream->actor);
                 $url = 'index.php?option=com_community&view=profile&userid=' . $profile->id . '&actid=' . $stream->id;
                 $params = new CParameter('');
                 $params->set('url', $url);
                 $params->set('stream', JText::_('COM_COMMUNITY_SINGULAR_STREAM'));
                 $params->set('stream_url', $url);
                 CNotificationLibrary::add('profile_stream_like', $my->id, $profile->id, JText::sprintf('COM_COMMUNITY_PROFILE_AVATAR_LIKE_EMAIL_SUBJECT'), '', 'profile.stream.like', $params);
                 /* Adding user points */
                 CUserPoints::assignPoint('profile.stream.like');
             }
             break;
         case 'album.self.share':
             $stream = JTable::getInstance('Activity', 'CTable');
             $stream->load($itemId);
             $profile = CFactory::getUser($stream->actor);
             //get total photo(s) uploaded and determine the string
             $actParam = new CParameter($stream->params);
             if ($actParam->get('batchcount') > 1) {
                 $content = JText::sprintf('COM_COMMUNITY_ACTIVITY_ALBUM_PICTURES_LIKE_SUBJECT');
             } else {
                 $content = JText::sprintf('COM_COMMUNITY_ACTIVITY_ALBUM_PICTURE_LIKE_SUBJECT');
             }
             $url = 'index.php?option=com_community&view=profile&userid=' . $profile->id . '&actid=' . $stream->id;
             $params = new CParameter('');
             $params->set('url', $url);
             $params->set('stream', JText::_('COM_COMMUNITY_SINGULAR_STREAM'));
             $params->set('stream_url', $url);
             CNotificationLibrary::add('profile_stream_like', $my->id, $profile->id, $content, '', 'profile.stream.like', $params);
         default:
             CUserPoints::assignPoint($element . '.like');
     }
     // Log user engagement
     CEngagement::log($element . '.like', $my->id);
     $like->store();
 }
コード例 #19
0
ファイル: wall.php プロジェクト: joshjim27/jobsglobal
 /**
  * @param $uniqueId
  * @param $message
  * @param $appType
  * @param $creator
  * @param $isOwner
  * @param string $processFunc
  * @param string $templateFile
  * @param int $wallId
  * @param int $photoId to attach photoid in the wall if exists
  * @return stdClass
  */
 public static function saveWall($uniqueId, $message, $appType, &$creator, $isOwner, $processFunc = '', $templateFile = 'wall/content', $wallId = 0, $photoId = 0)
 {
     $my = CFactory::getUser();
     // Add some required parameters, otherwise assert here
     CError::assert($uniqueId, '', '!empty', __FILE__, __LINE__);
     CError::assert($appType, '', '!empty', __FILE__, __LINE__);
     CError::assert($my->id, '', '!empty', __FILE__, __LINE__);
     // Load the models
     $wall = JTable::getInstance('Wall', 'CTable');
     $wall->load($wallId);
     if ($wallId == 0) {
         // Get current date
         $now = JFactory::getDate();
         $now = $now->toSql();
         // Set the wall properties
         $wall->type = $appType;
         $wall->contentid = $uniqueId;
         $wall->post_by = $creator->id;
         $wall->date = $now;
         $wall->published = 1;
         // @todo: set the ip address
         $wall->ip = $_SERVER['REMOTE_ADDR'];
     }
     //if photo id is not 0, this wall is appended with a picture
     if ($photoId > 0) {
         //lets check if the photo belongs to the uploader
         $photo = JTable::getInstance('Photo', 'CTable');
         $photo->load($photoId);
         //save the data into the wall table
         $wallParam = new CParameter($wall->params);
         if ($photo->creator == $my->id && $photo->albumid == '-1') {
             $wallParam->set('attached_photo_id', $photoId);
             //sets the status to ready so that it wont be deleted on cron run
             $photo->status = 'ready';
             $photo->store();
         }
         $wall->params = $wallParam->toString();
     } elseif ($photoId == -1) {
         //if there is nothing, remove the param if applicable
         $wallParam = new CParameter($wall->params);
         //delete from db and files
         $photoModel = CFactory::getModel('photos');
         if ($wallParam->get('attached_photo_id') > 0) {
             $photoTable = $photoModel->getPhoto($wallParam->get('attached_photo_id'));
             $photoTable->delete();
         }
         $wallParam->set('attached_photo_id', 0);
         $wall->params = $wallParam->toString();
     }
     /* URL fetch */
     $graphObject = CParsers::linkFetch($message);
     if ($graphObject) {
         $graphObject->merge(new CParameter($wall->params));
         $wall->params = $graphObject->toString();
     }
     $wall->comment = $message;
     // Store the wall message
     $wall->store();
     // Convert it to array so that the walls can be processed by plugins
     $args = array();
     $args[0] = $wall;
     //Process wall comments
     $comment = new CComment();
     $wallComments = $wall->comment;
     $wall->comment = $comment->stripCommentData($wall->comment);
     // Trigger the wall comments
     CWall::triggerWallComments($args);
     $wallData = new stdClass();
     $wallData->id = $wall->id;
     $wallData->content = CWallLibrary::_getWallHTML($wall, $wallComments, $appType, $isOwner, $processFunc, $templateFile);
     $wallData->content = CStringHelper::replaceThumbnails($wallData->content);
     CTags::add($wall);
     return $wallData;
 }
コード例 #20
0
ファイル: profile.php プロジェクト: joshjim27/jobsglobal
 public function removecover()
 {
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $message = '';
     $userId = $jinput->post->get('userid', 0, 'INT');
     $my = CFactory::getUser();
     if ($userId == 0) {
         /* redirect back to current user profile */
         $url = CRoute::_('index.php?option=com_community&view=profile', false);
     } else {
         /* redirect back to viewing user profile */
         $url = CRoute::_('index.php?option=com_community&view=profile&userid=' . $userId, false);
     }
     if ($my->id == 0) {
         return $this->blockUnregister();
     }
     //Admin and owner can use this function
     if (COwnerHelper::isCommunityAdmin($my->id) || $userId == $my->id) {
         $user = CFactory::getUser($userId);
         // User id should be valid and admin should not be allowed to block themselves.
         if ($user->id) {
             $userModel = CFactory::getModel('User');
             $userModel->removeProfileCover($user->id);
             $userTable = JTable::getInstance('Profile', 'CTable');
             $userTable->load($user->id);
             $params = new CParameter($userTable->params);
             $params->set('coverPosition', 0);
             $userTable->params = $params->toString();
             $userTable->store();
             $message = JText::_('COM_COMMUNITY_PROFILE_COVER_REMOVED');
         } else {
             $message = JText::_('COM_COMMUNITY_INVALID_PROFILE');
         }
     } else {
         $message = JText::_('COM_COMMUNITY_ADMIN_ACCESS_ONLY');
     }
     $mainframe->redirect($url, $message);
 }
コード例 #21
0
ファイル: zencoder.php プロジェクト: Simarpreet05/joomla
 public function ajaxSubmitForm($form = null)
 {
     if (!is_array($form)) {
         return false;
     }
     // validation
     if (!$form['email']) {
         $form['_error'] = 'You need to enter an email';
         $this->ajaxShowForm($form);
     }
     if ($form['password'] == '' || $form['password'] !== $form['password2']) {
         $form['_error'] = 'Password empty or do not match';
         $this->ajaxShowForm($form);
     }
     if (!isset($form['terms_of_service'])) {
         $form['_error'] = 'You did not agree to the Term of Service';
         $this->ajaxShowForm($form);
     }
     $data = array('terms_of_service' => 0, 'email' => '', 'password' => '', 'affiliate_code' => 'jomsocial', 'newsletter' => 0);
     // something is weird with the returning value of jax.getFormValues
     // we can't use array_merge here :( //array_merge($form, $values);
     $data['email'] = $form['email'];
     $data['password'] = $form['password2'];
     $data['terms_of_service'] = $form['terms_of_service'];
     $data = json_encode($data);
     CFactory::load('libraries', 'zencoder');
     $curl = new CZenCoderCURL();
     if (!$curl->post('https://app.zencoder.com/api/account', $data)) {
         $this->ajaxShowSuccss($curl->getError());
     }
     $content = '';
     $code = $curl->getStatusCode();
     $result = $curl->getResults();
     $result = json_decode($result);
     if (isset($result->errors)) {
         foreach ($result->errors as $error) {
             $content .= $error . '<br />';
         }
     }
     if (isset($result->api_key)) {
         $content .= 'Your API key: ' . $result->api_key . '<br />';
         $content .= 'Password: '******'configuration', 'CommunityTable');
         $config->load('config');
         $params = new CParameter($config->params);
         $params->set('zencoder_api_key', $result->api_key);
         $config->params = $params->toString();
         $config->store();
     }
     if (!isset($result->errors) && !isset($result->api_key)) {
         $content = 'Something is wrong here...';
     }
     $this->ajaxShowSuccss($content);
 }
コード例 #22
0
ファイル: activity.php プロジェクト: anawu2006/PeerLearning
 public function onAfterThankyou($actor, $target, $message)
 {
     CFactory::load('libraries', 'userpoints');
     CUserPoints::assignPoint('com_kunena.thread.thankyou', $target);
     $actor = CFactory::getUser($actor);
     $target = CFactory::getUser($target);
     //Create CParameter use for params
     $params = new CParameter('');
     $params->set('actorName', $actor->getDisplayName());
     $params->set('recipientName', $target->getDisplayName());
     $params->set('recipientUrl', 'index.php?option=com_community&view=profile&userid=' . $target->id);
     // Actor Link
     $params->set('url', JUri::getInstance()->toString(array('scheme', 'host', 'port')) . $message->getPermaUrl(null));
     // {url} tag for activity. Used when hovering over avatar in notification window, as well as in email notification
     $params->set('title', $message->displayField('subject'));
     // (title) tag in language file
     $params->set('title_url', $message->getPermaUrl());
     // Make the title in notification - linkable
     $params->set('message', $message->message);
     // (message) tag in language file
     $params->set('actor', $actor->getDisplayName());
     // Actor in the stream
     $params->set('actor_url', 'index.php?option=com_community&view=profile&userid=' . $actor->id);
     // Actor Link
     // Finally, send notifications
     CNotificationLibrary::add('kunena_thankyou', $actor->id, $target->id, JText::sprintf('PLG_KUNENA_COMMUNITY_ACTIVITY_THANKYOU_TITLE_ACT'), JText::sprintf('PLG_KUNENA_COMMUNITY_ACTIVITY_THANKYOU_TEXT'), '', $params);
     $act = new stdClass();
     $act->cmd = 'wall.write';
     $act->actor = $actor->id;
     $act->target = $target->id;
     $act->title = JText::sprintf('PLG_KUNENA_COMMUNITY_ACTIVITY_THANKYOU_WALL', $params->get('actor_url'), $params->get('actor'), $params->get('recipientUrl'), $params->get('recipientName'), $params->get('url'), $params->get('title'));
     $act->content = NULL;
     $act->app = 'kunena.message.thankyou';
     $act->cid = $target->id;
     $act->access = $this->getAccess($message->getCategory());
     // Comments and like support
     $act->comment_id = $target->id;
     $act->comment_type = 'kunena.message.thankyou';
     $act->like_id = $target->id;
     $act->like_type = 'kunena.message.thankyou';
     // Do not add private activities
     if ($act->access > 20) {
         return;
     }
     CFactory::load('libraries', 'activities');
     $table = CActivityStream::add($act);
     if (is_object($table)) {
         $table->like_id = $table->id;
         $table->store();
     }
 }
コード例 #23
0
ファイル: reporting.php プロジェクト: Simarpreet05/joomla
 /**
  * Executes a default action
  */
 public function executeDefaultAction()
 {
     $db =& JFactory::getDBO();
     // Send notification to specified emails notifying them the action has been taken.
     $jConfig =& JFactory::getConfig();
     $config = CFactory::getConfig();
     $from = $jConfig->getValue('mailfrom');
     $fromName = $jConfig->getValue('fromname');
     $recipients = $config->get('notifyMaxReport');
     $recipients = explode(',', $recipients);
     $query = 'SELECT * FROM ' . $db->nameQuote('#__community_reports_actions') . ' ' . 'WHERE ' . $db->nameQuote('reportid') . '=' . $db->Quote($this->report->id) . ' ' . 'AND ' . $db->nameQuote('defaultaction') . '=' . $db->Quote(1) . ' ' . 'ORDER BY ' . $db->nameQuote('id') . ' LIMIT 1';
     $db->setQuery($query);
     $result = $db->loadObject();
     // No defaultaction specified for this current
     if (!$result) {
         return false;
     }
     // Execute the default action
     $method = explode(',', $result->method);
     $args = explode(',', $result->parameters);
     if (is_array($method) && $method[0] != 'plugins') {
         $controller = JString::strtolower($method[0]);
         require_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'controllers' . DS . 'controller.php';
         require_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'controllers' . DS . $controller . '.php';
         $controller = JString::ucfirst($controller);
         $controller = 'Community' . $controller . 'Controller';
         $controller = new $controller();
         if (method_exists($controller, $method[1])) {
             $resultData = call_user_func_array(array(&$controller, $method[1]), $args);
         } else {
             // Continue adding the action as there might be changes to the method name.
             return false;
         }
     } else {
         if (is_array($method) && $method[0] == 'plugins') {
             // Application method calls
             $element = JString::strtolower($method[1]);
             require_once CPluginHelper::getPluginPath('community', $element) . DS . $element . '.php';
             $className = 'plgCommunity' . JString::ucfirst($element);
             $plugin = new $className();
             if (method_exists($plugin, $method[2])) {
                 $resultData = call_user_func_array(array($plugin, $method[2]), $args);
             } else {
                 // Continue adding the action as there might be changes to the method name.
                 return false;
             }
         } else {
             return false;
         }
     }
     // Send notification to specified emails notifying them the action has been taken.
     $jConfig =& JFactory::getConfig();
     $config = CFactory::getConfig();
     $from = $jConfig->getValue('mailfrom');
     $fromName = $jConfig->getValue('fromname');
     $recipients = $config->get('notifyMaxReport');
     $recipients = explode(',', $recipients);
     $subject = JText::sprintf('COM_COMMUNITY_REPORT_THRESHOLD_REACHED_SUBJECT', $this->report->link);
     CFactory::load('libraries', 'notification');
     $params = new CParameter('');
     $params->set('url', $this->report->link);
     CNotificationLibrary::add('etype_system_reports_threshold', $from, $recipients, $subject, '', 'reports.threshold', $params);
     $this->report->status = 1;
     $this->report->store();
     return true;
 }
コード例 #24
0
ファイル: notification.php プロジェクト: Jougito/DynWeb
 /**
  * Ajax function to accept Private Group Request
  *
  **/
 public function ajaxGroupJoinRequest($memberId, $groupId)
 {
     $filter = JFilterInput::getInstance();
     $groupId = $filter->clean($groupId, 'int');
     $memberId = $filter->clean($memberId, 'int');
     if (!COwnerHelper::isRegisteredUser()) {
         return $this->ajaxBlockUnregister();
     }
     $objResponse = new JAXResponse();
     $my = CFactory::getUser();
     $model = $this->getModel('groups');
     //CFactory::load( 'helpers' , 'owner' );
     if (!$model->isAdmin($my->id, $groupId) && !COwnerHelper::isCommunityAdmin()) {
         $objResponse->addScriptCall(JText::_('COM_COMMUNITY_NOT_ALLOWED_TO_ACCESS_SECTION'));
     } else {
         //Load Necessary Table
         $member = JTable::getInstance('GroupMembers', 'CTable');
         $group = JTable::getInstance('Group', 'CTable');
         // Load the group and the members table
         $group->load($groupId);
         $keys = array('groupId' => $groupId, 'memberId' => $memberId);
         $member->load($keys);
         // Only approve members that is really not approved yet.
         if ($member->approved) {
             $objResponse->addScriptCall('joms.jQuery("#error-request-' . $group->id . '").html("' . JText::_('COM_COMMUNITY_EVENTS_NOT_INVITED_NOTIFICATION') . '");');
             $objResponse->addScriptCall('joms.jQuery("#error-request-' . $group->id . '").attr("class", "error");');
         } else {
             $member->approve();
             $user = CFactory::getUser($memberId);
             $user->updateGroupList(true);
             // Add notification
             //CFactory::load( 'libraries' , 'notification' );
             $params = new CParameter('');
             $params->set('url', CRoute::getExternalURL('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id));
             $params->set('group', $group->name);
             $params->set('group_url', 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id);
             CNotificationLibrary::add('groups_member_approved', $group->ownerid, $user->id, JText::sprintf('COM_COMMUNITY_GROUP_MEMBER_APPROVED_EMAIL_SUBJECT'), '', 'groups.memberapproved', $params);
             $act = new stdClass();
             $act->cmd = 'group.join';
             $act->actor = $memberId;
             $act->target = 0;
             $act->title = '';
             //JText::sprintf('COM_COMMUNITY_GROUPS_ACTIVITIES_MEMBER_JOIN_GROUP' , '{group_url}' , $group->name );
             $act->content = '';
             $act->app = 'groups.join';
             $act->cid = $group->id;
             $params = new CParameter('');
             $params->set('action', 'group.join');
             $params->set('group_url', 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id);
             // Add activity logging
             if (CUserPoints::assignPoint('group.join', $memberId)) {
                 CActivityStream::addActor($act, $params->toString());
             }
             //trigger for onGroupJoinApproved
             $this->triggerEvents('onGroupJoinApproved', $group, $memberId);
             $this->triggerEvents('onGroupJoin', $group, $memberId);
             // UPdate group stats();
             $group->updateStats();
             $group->store();
             $url = CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id);
             $objResponse->addScriptCall('joms.jQuery("#msg-request-' . $memberId . '").html("' . addslashes(JText::sprintf('COM_COMMUNITY_EVENTS_ACCEPTED', $group->name, $url)) . '");');
             $objResponse->addScriptCall('joms.notifications.updateNotifyCount();');
             $objResponse->addScriptCall('joms.jQuery("#noti-request-group-' . $memberId . '").fadeOut(1000, function() { joms.jQuery("#noti-request-group-' . $memberId . '").remove();} );');
             $objResponse->addScriptCall('aspan = joms.jQuery(".cMenu-Icon b"); aspan.html(parseInt(aspan.html())-1);');
         }
     }
     return $objResponse->sendResponse();
 }
コード例 #25
0
ファイル: system.php プロジェクト: joshjim27/jobsglobal
 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));
 }
コード例 #26
0
ファイル: view.html.php プロジェクト: Jougito/DynWeb
 /**
  * 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');
 }
コード例 #27
0
ファイル: community.php プロジェクト: Simarpreet05/joomla
        // Log average page load
        jimport('joomla.filesystem.file');
        $logFile = COMMUNITY_COM_PATH . DS . 'access.log';
        $content = '';
        if (JFile::exists($logFile)) {
            $content = JFile::read(COMMUNITY_COM_PATH . DS . 'access.log');
        }
        $params = new CParameter($content);
        $today = strftime('%Y-%m-%d');
        $loadTime = $params->get($today, 0);
        if ($loadTime > 0) {
            $loadTime = ($loadTime + (xdebug_time_index() - $tm)) / 2;
        } else {
            $loadTime = xdebug_time_index() - $tm;
        }
        $params->set($today, $loadTime);
        JFile::write(COMMUNITY_COM_PATH . DS . 'access.log', $params->toString());
    }
    echo getJomSocialPoweredByLink();
    //	 getTriggerCount
    //	$appLib = CAppPlugins::getInstance();
    //	echo 'Trigger count: '. $appLib->triggerCount . '<br/>';
    //	$time_end = microtime(true);
    //	$time = $time_end - $time_start;
    //	echo $time;
}
/**
 * Entry poitn for all ajax call
 */
function communityAjaxEntry($func, $args = null)
{
コード例 #28
0
ファイル: groups.php プロジェクト: joshjim27/jobsglobal
 /**
  *
  */
 public static function joinApproved($groupId, $userid)
 {
     $group = JTable::getInstance('Group', 'CTable');
     $member = JTable::getInstance('GroupMembers', 'CTable');
     $group->load($groupId);
     $act = new stdClass();
     $act->cmd = 'group.join';
     $act->actor = $userid;
     $act->target = 0;
     $act->title = '';
     //JText::sprintf('COM_COMMUNITY_GROUPS_GROUP_JOIN' , '{group_url}' , $group->name );
     $act->content = '';
     $act->app = 'groups.join';
     $act->cid = $group->id;
     $act->groupid = $group->id;
     $params = new CParameter('');
     $params->set('group_url', 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id);
     $params->set('action', 'group.join');
     // Add logging
     if (CUserPoints::assignPoint('group.join')) {
         CActivityStream::addActor($act, $params->toString());
     }
     // Store the group and update stats
     $group->updateStats();
     $group->store();
 }
コード例 #29
0
ファイル: groups.php プロジェクト: joshjim27/jobsglobal
 public function notificationApproval($group)
 {
     $lang = JFactory::getLanguage();
     $lang->load('com_community', JPATH_ROOT);
     $my = CFactory::getUser();
     // Add notification
     //Send notification email to owner
     $params = new CParameter('');
     $params->set('url', 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id);
     $params->set('groupName', $group->name);
     $params->set('group', $group->name);
     $params->set('group_url', 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id);
     CNotificationLibrary::add('groups_notify_creator', $my->id, $group->ownerid, JText::_('COM_COMMUNITY_GROUPS_PUBLISHED_MAIL_SUBJECT'), '', 'groups.notifycreator', $params);
 }
コード例 #30
0
ファイル: controller.php プロジェクト: joshjim27/jobsglobal
 /**
  * AJAX method to toggle publish status
  *
  * @param	int	id	Current field id
  * @param	string field	The field publish type
  *
  * @return	JAXResponse object	Azrul's AJAX Response object
  **/
 public function ajaxTogglePublish($id, $field, $viewName)
 {
     $user = JFactory::getUser();
     // @rule: Disallow guests.
     if ($user->get('guest')) {
         JError::raiseError(403, JText::_('COM_COMMUNITY_ACCESS_FORBIDDEN'));
         return;
     }
     $response = new JAXResponse();
     // Load the JTable Object.
     $row = JTable::getInstance($viewName, 'CommunityTable');
     $row->load($id);
     if ($row->{$field} == 1) {
         $row->{$field} = 0;
         $row->store();
         $image = 'publish_x.png';
     } else {
         $row->{$field} = 1;
         $row->store();
         $image = 'tick.png';
     }
     // Get the view
     $view = $this->getView($viewName, 'html');
     $html = $view->getPublish($row, $field, $viewName . ',ajaxTogglePublish');
     $response->addAssign($field . $id, 'innerHTML', $html);
     if ($viewName == 'videos' && $row->{$field} == 0) {
         $params = new CParameter('');
         $params->set('url', '');
         $params->set('target', $row->creator);
         CNotificationLibrary::add('system_messaging', NULL, $row->creator, JText::sprintf('COM_COMMUNITY_VIDEO_UNPUBLISHED', $row->title), '', '', $params);
     }
     return $response->sendResponse();
 }