Example #1
1
 /**
  * Do a batch send
  */
 function send($total = 100)
 {
     $mailqModel = CFactory::getModel('mailq');
     $userModel = CFactory::getModel('user');
     $mails = $mailqModel->get($total);
     $jconfig = JFactory::getConfig();
     $mailer = JFactory::getMailer();
     $config = CFactory::getConfig();
     $senderEmail = $jconfig->getValue('mailfrom');
     $senderName = $jconfig->getValue('fromname');
     if (empty($mails)) {
         return;
     }
     CFactory::load('helpers', 'string');
     foreach ($mails as $row) {
         // @rule: only send emails that is valid.
         // @rule: make sure recipient is not blocked!
         $userid = $userModel->getUserFromEmail($row->recipient);
         $user = CFactory::getUser($userid);
         if (!$user->isBlocked() && !JString::stristr($row->recipient, 'foo.bar')) {
             $mailer->setSender(array($senderEmail, $senderName));
             $mailer->addRecipient($row->recipient);
             $mailer->setSubject($row->subject);
             $tmpl = new CTemplate();
             $raw = isset($row->params) ? $row->params : '';
             $params = new JParameter($row->params);
             $base = $config->get('htmlemail') ? 'email.html' : 'email.text';
             if ($config->get('htmlemail')) {
                 $row->body = JString::str_ireplace(array("\r\n", "\r", "\n"), '<br />', $row->body);
                 $mailer->IsHTML(true);
             } else {
                 //@rule: Some content might contain 'html' tags. Strip them out since this mail should never contain html tags.
                 $row->body = CStringHelper::escape(strip_tags($row->body));
             }
             $tmpl->set('content', $row->body);
             $tmpl->set('template', rtrim(JURI::root(), '/') . '/components/com_community/templates/' . $config->get('template'));
             $tmpl->set('sitename', $config->get('sitename'));
             $row->body = $tmpl->fetch($base);
             // Replace any occurences of custom variables within the braces scoe { }
             if (!empty($row->body)) {
                 preg_match_all("/{(.*?)}/", $row->body, $matches, PREG_SET_ORDER);
                 foreach ($matches as $val) {
                     $replaceWith = $params->get($val[1], null);
                     //if the replacement start with 'index.php', we can CRoute it
                     if (strpos($replaceWith, 'index.php') === 0) {
                         $replaceWith = CRoute::getExternalURL($replaceWith);
                     }
                     if (!is_null($replaceWith)) {
                         $row->body = JString::str_ireplace($val[0], $replaceWith, $row->body);
                     }
                 }
             }
             unset($tmpl);
             $mailer->setBody($row->body);
             $mailer->send();
         }
         $mailqModel->markSent($row->id);
         $mailer->ClearAllRecipients();
     }
 }
Example #2
0
 function display($data = null)
 {
     $mainframe = JFactory::getApplication();
     $config = CFactory::getConfig();
     $document =& JFactory::getDocument();
     $document->setTitle(JText::sprintf('CC FRONTPAGE TITLE', $config->get('sitename')));
     $document->setLink(CRoute::_('index.php?option=com_community'));
     $my = CFactory::getUser();
     CFactory::load('libraries', 'activities');
     CFactory::load('helpers', 'string');
     $act = new CActivityStream();
     $rows = $act->getFEED('', '', null, $mainframe->getCfg('feed_limit'));
     if ($config->get('showactivitystream') == COMMUNITY_SHOW || $config->get('showactivitystream') == COMMUNITY_MEMBERS_ONLY && $my->id != 0) {
         foreach ($rows->data as $row) {
             if ($row->type != 'title') {
                 // load individual item creator class
                 $item = new JFeedItem();
                 // cannot escape the title. it's already formated. we should
                 // escape it during CActivityStream::add
                 //$item->title 		= CStringHelper::escape($row->title);
                 $item->title = $row->title;
                 $item->link = CRoute::_('index.php?option=com_community&view=profile&userid=' . $row->actor);
                 $item->description = "<img src=\"{$row->favicon}\" alt=\"\"/>&nbsp;" . $row->title;
                 $item->date = $row->createdDate;
                 $item->category = '';
                 //$row->category;
                 // Make sure url is absolute
                 $item->description = JString::str_ireplace('href="/', 'href="' . JURI::base(), $item->description);
                 // loads item info into rss array
                 $document->addItem($item);
             }
         }
     }
 }
Example #3
0
 public function getRegistrationURL()
 {
     $usersConfig = JComponentHelper::getParams('com_users');
     if ($usersConfig->get('allowUserRegistration')) {
         return CRoute::_('index.php?option=com_community&view=register');
     }
 }
Example #4
0
 /**
  * Inject data from paramter to content tags ({}) .
  *
  * @param	$content	Original content with content tags.
  * @param	$params	Text contain all values need to be replaced.
  * @param	$html	Auto detect url tag and insert inline.
  * @return	$text	The content after replacing.
  **/
 public static function injectTags($content, $paramsTxt, $html = false)
 {
     $params = new CParameter($paramsTxt);
     preg_match_all("/{(.*?)}/", $content, $matches, PREG_SET_ORDER);
     if (!empty($matches)) {
         foreach ($matches as $val) {
             $replaceWith = JString::trim($params->get($val[1], null));
             if (!is_null($replaceWith)) {
                 //if the replacement start with 'index.php', we can CRoute it
                 if (JString::strpos($replaceWith, 'index.php') === 0) {
                     $replaceWith = CRoute::getExternalURL($replaceWith);
                 }
                 if ($html) {
                     $replaceUrl = $params->get($val[1] . '_url', null);
                     if (!is_null($replaceUrl)) {
                         if ($val[1] == 'stream') {
                             $replaceUrl .= '#activity-stream-container';
                         }
                         //if the replacement start with 'index.php', we can CRoute it
                         if (JString::strpos($replaceUrl, 'index.php') === 0) {
                             $replaceUrl = CRoute::getExternalURL($replaceUrl);
                         }
                         $replaceWith = '<a href="' . $replaceUrl . '">' . $replaceWith . '</a>';
                     }
                 }
                 $content = CString::str_ireplace($val[0], $replaceWith, $content);
             }
         }
     }
     return $content;
 }
Example #5
0
 public function getProfileLink($user_id, &$object, &$attribs = array())
 {
     $user = CFactory::getUser($user_id);
     //parameters
     $params = $this->params;
     if (!$user || $params->get('view_individual_link', '1') == 0) {
         return true;
     }
     JHTML::_('behavior.tooltip');
     $name = $user->getDisplayName();
     $url = CRoute::_('index.php?option=com_community&view=profile&userid=' . $user_id);
     switch ($params->get('view_individual_link', '1')) {
         case 2:
             $avatar = $user->getThumbAvatar();
             $text = '<img class="hasTip" src="' . $avatar . '" title="' . $name . '"/>';
             break;
         case 1:
         default:
             $text = JText::_('PLG_TRACKS_JOMSOCIAL_VIEW_USER_PROFILE');
             break;
     }
     $attribs = array_merge($attribs, array('alt' => $user->get('username')));
     $object->text = JHTML::link($url, $text, $attribs);
     return true;
 }
Example #6
0
 public function getInboxLink($text)
 {
     if (!$text) {
         $text = JText::_('COM_KUNENA_PMS_INBOX');
     }
     return CKunenaLink::GetHrefLink(CRoute::_('index.php?option=com_community&view=inbox'), $text, '', 'follow');
 }
Example #7
0
	public function getProfileURL($userid, $task='', $xhtml = true) {
		// Make sure that user profile exist.
		if (!$userid || CFactory::getUser($userid) === null) {
			return false;
		}
		return CRoute::_('index.php?option=com_community&view=profile&userid=' . (int) $userid, $xhtml);
	}
Example #8
0
 public static function _getMutualFriendsHTML($userid = null)
 {
     $my = CFactory::getUser();
     if ($my->id == $userid) {
         return;
     }
     $friendsModel = CFactory::getModel('Friends');
     $friends = $friendsModel->getFriends($userid, 'latest', false, 'mutual');
     $html = "<ul class='joms-list--friend single-column'>";
     if (sizeof($friends)) {
         foreach ($friends as $friend) {
             $html .= "<li class='joms-list__item'>";
             $html .= "<div class='joms-list__avatar'>";
             $html .= '<div class="joms-avatar ' . CUserHelper::onlineIndicator($friend) . '"><a href="' . CRoute::_('index.php?option=com_community&view=profile&userid=' . $friend->id) . '">';
             $html .= '<img src="' . $friend->getThumbAvatar() . '" data-author="' . $friend->id . '" />';
             $html .= "</a></div></div>";
             $html .= "<div class='joms-list__body'>";
             $html .= CFriendsHelper::getUserCog($friend->id, null, null, true);
             $html .= CFriendsHelper::getUserFriendDropdown($friend->id);
             $html .= '<a href="' . CRoute::_('index.php?option=com_community&view=profile&userid=' . $friend->id) . '">';
             $html .= '<h4 class="joms-text--username">' . $friend->getDisplayName() . '</h4></a>';
             $html .= '<span class="joms-text--title">' . JText::sprintf('COM_COMMUNITY_TOTAL_MUTUAL_FRIENDS', CFriendsHelper::getTotalMutualFriends($friend->id)) . '</span>';
             $html .= "</div></li>";
         }
         $html .= "</ul>";
     } else {
         $html .= JText::_('COM_COMMUNITY_NO_MUTUAL_FRIENDS');
     }
     return $html;
 }
Example #9
0
 function getMembersData(&$params)
 {
     $model = CFactory::getModel('user');
     $db = JFactory::getDBO();
     $limit = $params->get('count', '5');
     $query = 'SELECT ' . $db->quoteName('userid') . ' FROM ' . $db->quoteName('#__community_users') . ' AS a ' . ' INNER JOIN ' . $db->quoteName('#__users') . ' AS b ON a.' . $db->quoteName('userid') . '=b.' . $db->quoteName('id') . ' WHERE ' . $db->quoteName('thumb') . '!=' . $db->Quote('components/com_community/assets/default_thumb.jpg') . ' ' . ' AND ' . $db->quoteName('block') . '=' . $db->Quote(0) . ' ' . ' ORDER BY ' . $db->quoteName('points') . ' DESC ' . ' LIMIT ' . $limit;
     $db->setQuery($query);
     $row = $db->loadObjectList();
     if ($db->getErrorNum()) {
         JError::raiseError(500, $db->stderr());
     }
     $_members = array();
     if (!empty($row)) {
         foreach ($row as $data) {
             $user = CFactory::getUser($data->userid);
             $_obj = new stdClass();
             $_obj->id = $data->userid;
             $_obj->name = $user->getDisplayName();
             $_obj->avatar = $user->getThumbAvatar();
             $CUserPoints = new CUserPoints();
             $_obj->karma = $CUserPoints->getPointsImage($user);
             $_obj->userpoints = $user->_points;
             $_obj->link = CRoute::_('index.php?option=com_community&view=profile&userid=' . $data->userid);
             $_members[] = $_obj;
         }
     }
     return $_members;
 }
 function onPromoteData($id)
 {
     $db = JFactory::getDBO();
     $Itemid = JRequest::getInt('Itemid');
     $jschk = $this->_chkextension();
     if (!empty($jschk)) {
         $query = "SELECT cf.id FROM #__community_fields as cf\n\t\t\t\t\t\t\t\tLEFT JOIN #__community_fields_values AS cfv ON cfv.field_id=cf.id\n\t\t\t\t\t\t\t\t\tWHERE cf.name like '%About me%' AND cfv.user_id=" . $id;
         $db->setQuery($query);
         $fieldid = $db->loadresult();
         $query = "SELECT u.name AS title, cu.avatar AS image, cfv.value AS bodytext\n\t\t\t\t\t\t\t\t\tFROM #__users AS u\n\t\t\t\t\t\t\t\t\tLEFT JOIN #__community_users AS cu ON u.id=cu.userid\n\t\t\t\t\t\t\t\t\tLEFT JOIN #__community_fields_values AS cfv ON cu.userid=cfv.user_id\n\t\t\t\t\t\t\t\t\tLEFT JOIN #__community_fields AS cf ON cfv.field_id=cf.id\n\t\t\t\t\t\t\t\t\tWHERE cu.userid =" . $id;
         if ($fieldid) {
             $query .= " AND cfv.field_id=" . $fieldid;
         }
         $db->setQuery($query);
         $previewdata = $db->loadObjectlist();
         if (!$fieldid) {
             $previewdata[0]->bodytext = '';
         }
         // Include Jomsocial core
         $jspath = JPATH_ROOT . DS . 'components' . DS . 'com_community';
         include_once $jspath . DS . 'libraries' . DS . 'core.php';
         $previewdata[0]->url = JUri::root() . substr(CRoute::_('index.php?option=com_community&view=profile&userid=' . $id), strlen(JUri::base(true)) + 1);
         if ($previewdata[0]->image == '') {
             $previewdata[0]->image = 'components/com_community/assets/user-Male.png';
         }
         return $previewdata;
     } else {
         return '';
     }
 }
Example #11
0
 /**
  * 获取单列
  */
 public static function getInstance()
 {
     if (null == self::$instance) {
         self::$instance = new self();
         return self::$instance;
     }
     return self::$instance;
 }
Example #12
0
	public function getProfileURL($userid, $task='', $xhtml = true)
	{
		if ($userid == 0) return false;
		// Get CUser object
		$user = CFactory::getUser($userid);
		if($user === null) return false;
		return CRoute::_('index.php?option=com_community&view=profile&userid='.$userid, $xhtml);
	}
Example #13
0
 /**
  * Create a link to a event page
  * 
  * @param	id		integer		ther user id
  * @param	route   bool		do we want to wrap it with Jroute func ?
  */
 public static function eventLink($id, $route = true)
 {
     $url = 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $id;
     if ($route) {
         $url = CRoute::_($url);
     }
     return $url;
 }
Example #14
0
 /**
  * Retrieves the profile link
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return	
  */
 public function getLink()
 {
     if (!EB::jomsocial()->exists()) {
         return parent::getLink();
     }
     $link = CRoute::_('index.php?option=com_community&view=profile&userid=' . $this->profile->id);
     return $link;
 }
Example #15
0
 /**
  * Displays the viewing profile page.
  * 	 	
  * @access	public
  * @param	array  An associative array to display the fields
  */
 public function profile(&$data)
 {
     $mainframe = JFactory::getApplication();
     $friendsModel = CFactory::getModel('friends');
     $showfriends = JRequest::getVar('showfriends', false);
     $userid = JRequest::getVar('userid', '');
     $user = CFactory::getUser($userid);
     $linkUrl = CRoute::_('index.php?option=com_community&view=profile&userid=' . $user->id);
     $document = JFactory::getDocument();
     $document->setTitle(JText::sprintf('COM_COMMUNITY_USERS_FEED_TITLE', $user->getDisplayName()));
     $document->setDescription(JText::sprintf('COM_COMMUNITY_USERS_FEED_DESCRIPTION', $user->getDisplayName(), $user->lastvisitDate));
     $document->setLink($linkUrl);
     include_once JPATH_COMPONENT . '/libraries/activities.php';
     $act = new CActivityStream();
     $friendIds = $friendsModel->getFriendIds($user->id);
     $friendIds = $showfriends ? $friendIds : null;
     $rows = $act->getFEED($user->id, $friendIds, null, $mainframe->getCfg('feed_limit'));
     // add the avatar image
     $rssImage = new JFeedImage();
     $rssImage->url = $user->getThumbAvatar();
     $rssImage->link = $linkUrl;
     $rssImage->width = 64;
     $rssImage->height = 64;
     $document->image = $rssImage;
     //CFactory::load( 'helpers' , 'string' );
     //CFactory::load( 'helpers' , 'time' );
     foreach ($rows->data as $row) {
         if ($row->type != 'title') {
             // Get activities link
             $pattern = '/<a href=\\"(.*?)\\"/';
             preg_match_all($pattern, $row->title, $matches);
             // Use activity owner link when activity link is not available
             if (!empty($matches[1][1])) {
                 $linkUrl = $matches[1][1];
             } else {
                 if (!empty($matches[1][0])) {
                     $linkUrl = $matches[1][0];
                 }
             }
             // load individual item creator class
             $item = new JFeedItem();
             $item->title = $row->title;
             $item->link = $linkUrl;
             $item->description = "<img src=\"{$row->favicon}\" alt=\"\" />&nbsp;" . $row->title;
             $item->date = CTimeHelper::getDate($row->createdDateRaw)->toRFC822();
             $item->category = '';
             //$row->category;
             $item->description = CString::str_ireplace('_QQQ_', '"', $item->description);
             // Make sure url is absolute
             $pattern = '/href="(.*?)index.php/';
             $replace = 'href="' . JURI::base() . 'index.php';
             $string = $item->description;
             $item->description = preg_replace($pattern, $replace, $string);
             // loads item info into rss array
             $document->addItem($item);
         }
     }
 }
Example #16
0
 function getUserProfileUrl($integration_option, $userid)
 {
     //$cominvitexHelper=new cominvitexHelper();
     //$invitex_settings=$cominvitexHelper->getconfigData();
     //$params=JComponentHelper::getParams('com_jlike');
     //$integration_option=$invitex_settings['reg_direct'];
     //$integration_option='JomSocial'
     $link = '';
     if ($integration_option == 'Joomla') {
         //$itemid=jgiveFrontendHelper::getItemId('option=com_users');
         $link = '';
     } else {
         if ($integration_option == 'Community Builder') {
             $cbpath = JPATH_ROOT . DS . 'components' . DS . 'com_community';
             if ($cbpath) {
                 //$itemid=$cominvitexHelper->getItemId('option=com_comprofiler');
                 $link = JUri::root() . substr(JRoute::_('index.php?option=com_comprofiler&task=userprofile&user='******'&Itemid=' . $itemid), strlen(JUri::base(true)) + 1);
             }
         } else {
             if ($integration_option == 'JomSocial') {
                 $jspath = JPATH_ROOT . DS . 'components' . DS . 'com_community';
                 if ($jspath) {
                     $link = '';
                     if (file_exists($jspath)) {
                         include_once $jspath . DS . 'libraries' . DS . 'core.php';
                         $link = JUri::root() . substr(CRoute::_('index.php?option=com_community&view=profile&userid=' . $userid), strlen(JUri::base(true)) + 1);
                     }
                 }
             } else {
                 if ($integration_option == 'Jomwall') {
                     $awdpath = JPATH_ROOT . DS . 'components' . DS . 'com_awdwall';
                     if ($awdpath) {
                         if (!class_exists('AwdwallHelperUser')) {
                             require_once JPATH_SITE . DS . 'components' . DS . 'com_awdwall' . DS . 'helpers' . DS . 'user.php';
                         }
                         $awduser = new AwdwallHelperUser();
                         $Itemid = $awduser->getComItemId();
                         $link = JRoute::_('index.php?option=com_awdwall&view=awdwall&layout=mywall&wuid=' . $userid . '&Itemid=' . $Itemid);
                     }
                 } else {
                     if ($integration_option == 'EasySocial') {
                         $espath = JPATH_ROOT . DS . 'components' . DS . 'com_easysocial';
                         if ($espath) {
                             $link = '';
                             if (file_exists($espath)) {
                                 require_once JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/foundry.php';
                                 $user = Foundry::user($userid);
                                 $link = JRoute::_($user->getPermalink());
                             }
                         }
                     }
                 }
             }
         }
     }
     return $link;
 }
Example #17
0
 function add_stream($listing_id, $cids, $ctype = '')
 {
     include_once JPATH_BASE . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'core.php';
     // load language strings for this component so we get translated activity stream messages
     $lang =& JFactory::getLanguage();
     $lang->load('com_relate');
     $sql = "SELECT id, title, catid FROM #__content WHERE id = '{$listing_id}'";
     $this->_db->setQuery($sql);
     $listing = $this->_db->loadObject();
     $listing_title = $listing->title;
     $listing_href = CRoute::_('index.php?option=com_content&view=article&catid=' . $listing->catid . '&id=' . $listing->id);
     $listing_link = '<a href="' . $listing_href . '">' . $listing_title . '</a>';
     if ($ctype != '') {
         $content_type = $ctype;
         $category_id = 1;
         $is_listing = false;
     } else {
         $sql = "SELECT l.id, l.catid, l.title, c.title AS cat_title FROM #__categories c, #__content l " . "WHERE c.id = l.catid AND l.id IN (" . implode(",", $cids) . ")";
         $this->_db->setQuery($sql);
         $content = $this->_db->loadObjectList('id');
         $is_listing = true;
     }
     foreach ($cids as $cid) {
         if ($is_listing) {
             $content_title = $content[$cid]->title;
             $content_type = $content[$cid]->cat_title;
             $category_id = $content[$cid]->catid;
             $content_id = $content[$cid]->id;
             $href = CRoute::_('index.php?option=com_content&view=article&catid=' . $category_id . '&id=' . $content_id);
             $content_link = '<a href="' . $href . '">' . $content_title . '</a>';
             $content_info = $content_link . ' (' . $content_type . ')';
         } else {
             $content_id = $cid;
             $tab = '';
             if ($content_type == "photo") {
                 $tab = '#bilder';
             } else {
                 if ($content_type == "video") {
                     $tab = '#video';
                 }
             }
             $content_link = '<a href="' . $listing_href . $tab . '">' . JText::_("a {$content_type}") . '</a>';
             $content_info = $content_link;
         }
         $act = new stdClass();
         $act->cmd = 'wall.write';
         $act->actor = JFactory::getUser()->id;
         $act->target = 0;
         $act->title = JText::sprintf('RELATION ADDED', $content_info, $listing_link);
         $act->content = '';
         $act->app = 'wall';
         $act->cid = $content_id;
         CFactory::load('libraries', 'activities');
         CActivityStream::add($act);
     }
 }
Example #18
0
 static function getThumb($userId, $imageClass = '', $anchorClass = '')
 {
     CFactory::load('helpers', 'string');
     $user = CFactory::getUser($userId);
     $imageClass = !empty($imageClass) ? ' class="' . $imageClass . '"' : '';
     $anchorClass = !empty($anchorClass) ? ' class="' . $anchorClass . '"' : '';
     $data = '<a href="' . CRoute::_('index.php?option=com_community&view=profile&userid=' . $user->id) . '"' . $anchorClass . '>';
     $data .= '<img src="{user:thumbnail:' . $userId . '}" alt="' . CStringHelper::escape($user->getDisplayName()) . '"' . $imageClass . ' />';
     $data .= '</a>';
     return $data;
 }
Example #19
0
 public function friends($data = null)
 {
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $document = JFactory::getDocument();
     $id = JRequest::getCmd('userid', 0);
     $sorted = $jinput->get->get('sort', 'latest', 'STRING');
     //JRequest::getVar( 'sort' , 'latest' , 'GET' );
     $filter = JRequest::getWord('filter', 'all', 'GET');
     $isMine = $id == $my->id && $my->id != 0;
     $my = CFactory::getUser();
     $id = $id == 0 ? $my->id : $id;
     $user = CFactory::getUser($id);
     $friends = CFactory::getModel('friends');
     $blockModel = CFactory::getModel('block');
     $document->setLink(CRoute::_('index.php?option=com_community'));
     $rows = $friends->getFriends($id, $sorted, true, $filter);
     // Hide submenu if we are viewing other's friends
     if ($isMine) {
         $document->setTitle(JText::_('COM_COMMUNITY_FRIENDS_MY_FRIENDS'));
     } else {
         $document->setTitle(JText::sprintf('COM_COMMUNITY_FRIENDS_ALL_FRIENDS', $user->getDisplayName()));
     }
     $sortItems = array('latest' => JText::_('COM_COMMUNITY_SORT_RECENT_FRIENDS'), 'online' => JText::_('COM_COMMUNITY_ONLINE'));
     $resultRows = array();
     // @todo: preload all friends
     foreach ($rows as $row) {
         $user = CFactory::getUser($row->id);
         $obj = clone $row;
         $obj->friendsCount = $user->getFriendCount();
         $obj->profileLink = CUrlHelper::userLink($row->id);
         $obj->isFriend = true;
         $obj->isBlocked = $blockModel->getBlockStatus($user->id, $my->id);
         $resultRows[] = $obj;
     }
     unset($rows);
     foreach ($resultRows as $row) {
         if (!$row->isBlocked) {
             // load individual item creator class
             $item = new JFeedItem();
             $item->title = strip_tags($row->name);
             $item->link = CRoute::_('index.php?option=com_community&view=profile&userid=' . $row->id);
             $item->description = '<img src="' . JURI::base() . $row->_thumb . '" alt="" />&nbsp;' . $row->_status;
             $item->date = $row->lastvisitDate;
             $item->category = '';
             //$row->category;
             $item->description = CString::str_ireplace('_QQQ_', '"', $item->description);
             // Make sure url is absolute
             $item->description = CString::str_ireplace('href="/', 'href="' . JURI::base(), $item->description);
             // loads item info into rss array
             $document->addItem($item);
         }
     }
 }
Example #20
0
 /**
  * When user remove Avatar then set to default avatar as profile pix
  */
 static function removeProfilePicture()
 {
     //when admin remove any avatar of user by admin panel then get userid
     // at default value,if user remove self avatar.(when fron end user login)
     $userId = JRequest::getVar('userid', JFactory::getUser()->id, 'POST');
     $pType = XiptLibProfiletypes::getUserData($userId, 'PROFILETYPE');
     $newPath = XiptLibProfiletypes::getProfiletypeData($pType, 'avatar');
     self::_removeProfilePicture($userId, $pType, $newPath);
     $view = JRequest::getVar('view', 'profile', 'GET');
     //$task =	JRequest::getVar('task','profile','GET');
     JFactory::getApplication()->redirect(CRoute::_("index.php?option=com_community&view={$view}&userid={$userId}", false), JText::_('CC_PROFILE_PICTURE_REMOVED'));
 }
Example #21
0
 /**
  * Once a user changed their profile, request them to update their profile
  **/
 public function updateProfile()
 {
     $profileType = JRequest::getVar('profileType', '');
     $document = JFactory::getDocument();
     $document->setTitle(JText::_('CC MULTIPROFILE UPDATE'));
     $my = CFactory::getUser();
     $this->addPathway(JText::_('CC PROFILE'), CRoute::_('index.php?option=com_community&view=profile&userid=' . $my->id));
     $this->addPathway(JText::_('CC MULTIPROFILE CHANGE TYPE'), CRoute::_('index.php?option=com_community&view=multiprofile&task=changeprofile'));
     $this->addPathway(JText::_('CC MULTIPROFILE UPDATE'));
     $model = CFactory::getModel('profile');
     $profileType = JRequest::getVar('profileType', 0);
     // Get all published custom field for profile
     $filter = array('published' => '1', 'registration' => '1');
     //		$fields		=& $model->getAllFields( $filter , $profileType );
     $result = $model->getEditableProfile($my->id, $profileType);
     $empty_html = array();
     $post = JRequest::get('post');
     // Bind result from previous post into the field object
     if (!empty($post)) {
         foreach ($fields as $group) {
             $field = $group->fields;
             for ($i = 0; $i < count($field); $i++) {
                 $fieldid = $field[$i]->id;
                 $fieldType = $field[$i]->type;
                 if (!empty($post['field' . $fieldid])) {
                     if (is_array($post['field' . $fieldid])) {
                         if ($fieldType != 'date') {
                             $values = $post['field' . $fieldid];
                             $value = '';
                             foreach ($values as $listValue) {
                                 $value .= $listValue . ',';
                             }
                             $field[$i]->value = $value;
                         } else {
                             $field[$i]->value = $post['field' . $fieldid];
                         }
                     } else {
                         $field[$i]->value = $post['field' . $fieldid];
                     }
                 }
             }
         }
     }
     $config =& CFactory::getConfig();
     $js = 'assets/validate-1.5' . ($config->getBool('usepackedjavascript') ? '.pack.js' : '.js');
     CAssets::attach($js, 'js');
     $profileType = JRequest::getVar('profileType', 0, 'GET');
     CFactory::load('libraries', 'profile');
     $tmpl = new CTemplate();
     $tmpl->set('fields', $result['fields']);
     $tmpl->set('profileType', $profileType);
     echo $tmpl->fetch('multiprofile.update');
 }
Example #22
0
 public function save()
 {
     if (!COwnerHelper::isCommunityAdmin()) {
         echo JText::_('CC RESTRICTED ACCESS');
         return;
     }
     $mainframe =& JFactory::getApplication();
     $post = JRequest::get('post');
     $table =& JTable::getInstance('Memberlist', 'CTable');
     $table->bind($post);
     $date =& JFactory::getDate();
     $table->created = $date->toMySQL();
     $table->store();
     if (empty($table->title)) {
         $mainframe->redirect(CRoute::_('index.php?option=com_community&view=memberlist', false), JText::_('CC MEMBERLIST TITLE EMPTY'), 'error');
     }
     if (empty($table->description)) {
         $mainframe->redirect(CRoute::_('index.php?option=com_community&view=memberlist', false), JText::_('CC MEMBERLIST DESCRIPTION EMPTY'), 'error');
     }
     $total = JRequest::getVar('totalfilters', '', 'POST');
     for ($i = 0; $i < $total; $i++) {
         $filter = JRequest::getVar('filter' . $i, '', 'POST');
         if (!empty($filter)) {
             $filters = explode(',', $filter, 4);
             $field = explode('=', $filters[0], 2);
             $condition = explode('=', $filters[1], 2);
             $type = explode('=', $filters[2], 2);
             $value = explode('=', $filters[3], 2);
             $criteria =& JTable::getInstance('MemberlistCriteria', 'CTable');
             $criteria->listid = $table->id;
             $criteria->field = $field[1];
             $criteria->value = $value[1];
             $criteria->condition = $condition[1];
             $criteria->type = $type[1];
             $criteria->store();
         }
     }
     // Create the menu.
     CFactory::load('helpers', 'menu');
     $menu =& JTable::getInstance('Menu', 'JTable');
     $menu->menutype = JRequest::getWord('menutype', '', 'POST');
     $menu->name = $table->title;
     $menu->alias = JFilterOutput::stringURLSafe($table->title);
     $menu->link = 'index.php?option=com_community&view=memberlist&listid=' . $table->id;
     $menu->published = 1;
     $menu->type = 'component';
     $menu->ordering = $menu->getNextOrder('menutype="' . $menu->menutype . '"');
     $menu->componentid = CMenuHelper::getComponentId();
     $menu->access = JRequest::getWord('access', '', 'POST');
     $menu->store();
     $mainframe->redirect(CRoute::_('index.php?option=com_community&view=memberlist&listid=' . $table->id, false), JText::_('CC MEMBERLIST CREATED'));
 }
Example #23
0
 /**
  * Once a user changed their profile, request them to update their profile
  * */
 public function updateProfile()
 {
     /**
      * Opengraph
      */
     CHeadHelper::setType('website', JText::_('COM_COMMUNITY_MULTIPROFILE_UPDATE'));
     $profileType = JRequest::getVar('profileType', '');
     $my = CFactory::getUser();
     $this->addPathway(JText::_('COM_COMMUNITY_PROFILE'), CRoute::_('index.php?option=com_community&view=profile&userid=' . $my->id));
     $this->addPathway(JText::_('COM_COMMUNITY_MULTIPROFILE_CHANGE_TYPE'), CRoute::_('index.php?option=com_community&view=multiprofile&task=changeprofile'));
     $this->addPathway(JText::_('COM_COMMUNITY_MULTIPROFILE_UPDATE'));
     $model = CFactory::getModel('profile');
     $profileType = JRequest::getVar('profileType', 0);
     // Get all published custom field for profile
     $filter = array('published' => '1', 'registration' => '1');
     //		$fields		= $model->getAllFields( $filter , $profileType );
     $result = $model->getEditableProfile($my->id, $profileType);
     $empty_html = array();
     $post = JRequest::get('post');
     // Bind result from previous post into the field object
     if (!empty($post)) {
         foreach ($fields as $group) {
             $field = $group->fields;
             for ($i = 0; $i < count($field); $i++) {
                 $fieldid = $field[$i]->id;
                 $fieldType = $field[$i]->type;
                 if (!empty($post['field' . $fieldid])) {
                     if (is_array($post['field' . $fieldid])) {
                         if ($fieldType != 'date') {
                             $values = $post['field' . $fieldid];
                             $value = '';
                             foreach ($values as $listValue) {
                                 $value .= $listValue . ',';
                             }
                             $field[$i]->value = $value;
                         } else {
                             $field[$i]->value = $post['field' . $fieldid];
                         }
                     } else {
                         $field[$i]->value = $post['field' . $fieldid];
                     }
                 }
             }
         }
     }
     $js = 'assets/validate-1.5.min.js';
     CFactory::attach($js, 'js');
     $profileType = JRequest::getVar('profileType', 0, 'GET');
     //CFactory::load( 'libraries' , 'profile' );
     $tmpl = new CTemplate();
     echo $tmpl->set('fields', $result['fields'])->set('profileType', $profileType)->fetch('multiprofile.update');
 }
Example #24
0
	static function getUserAdsLink($userid)
	{
		if (COMMUNITY_BUILDER_ADSTAB == 1)
			return JRoute::_("index.php?option=com_comprofiler&tab=adsmanagerTab&user="******"index.php?option=com_adsmanager&view=list&user=".$userid);
	}
Example #25
0
 static function _($url, $xhtml = true, $ssl = null)
 {
     $config =& JFactory::getConfig();
     if (JFactory::getApplication()->isAdmin()) {
         return $url;
     }
     if (strpos($url, 'com_community')) {
         return CRoute::_($url, $xhtml, $ssl);
     }
     if (strpos($url, 'com_xipt') && $config->getValue('sef') === '0') {
         $url = self::_addItemId($url);
     }
     return JRoute::_($url, $xhtml, $ssl);
 }
Example #26
0
 public function render()
 {
     CFactory::load('libraries', 'privacy');
     $my = CFactory::getUser();
     $config = CFactory::getConfig();
     if ($my->id && is_array($this->creators)) {
         $tmpl = new CTemplate();
         $html = $tmpl->set('my', $my)->set('target', $this->target)->set('type', $this->type)->set('creators', $this->creators)->set('maxStatusChar', $config->get('statusmaxchar'))->fetch('status.form');
         // Some of the creator might need custom url replacement
         // Take a look at status.photo.php template for example
         $group_url = $this->type == 'groups' ? CRoute::_('index.php?option=com_community&view=photos&task=ajaxPreview&no_html=1&tmpl=component&groupid=' . $this->target) : CRoute::_('index.php?option=com_community&view=photos&task=ajaxPreview&no_html=1&tmpl=component');
         $html = str_replace('{url}', $group_url, $html);
         echo $html;
     }
 }
Example #27
0
 /**
  * unblock user(removeBan)
  */
 public function unBlock($userId, $layout = null)
 {
     $my = CFactory::getUser();
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $viewName = $jinput->get->get('view', '');
     //JRequest::getVar('view','','GET');
     $task = !empty($layout) && $layout != 'null' ? '&task=' . $layout : null;
     $urlUserId = $viewName == 'friends' ? '' : "&userid=" . $userId;
     $url = CRoute::_("index.php?option=com_community&view=" . $viewName . $task . $urlUserId, false);
     $message = empty($my->id) || empty($userId) ? JText::_('COM_COMMUNITY_ERROR_BLOCK_USER') : '';
     if (!empty($my->id) && !empty($userId)) {
         $model = CFactory::getModel('block');
         $message = $model->removeBannedUser($my->id, $userId) ? JText::_('COM_COMMUNITY_USER_UNBLOCKED') : JText::_('COM_COMMUNITY_ERROR_BLOCK_USER');
     }
     $mainframe->redirect($url, $message);
 }
Example #28
0
 /**
  * 自动加载
  */
 public function load($className)
 {
     //优先使用映射集合
     if (isset(self::$_loadMapp[$className])) {
         return CLoader::import($className, self::$_loadMapp[$className]);
     } else {
         if (file_exists($path = APP_PATH . '/modules/' . CRoute::getInstance()->getModule() . '/controllers/' . $className . '.php')) {
             return CLoader::importFile($path);
         } else {
             if (file_exists($path = APP_PATH . '/modules/' . CRoute::getInstance()->getModule() . '/classes/' . $className . '.php')) {
                 return CLoader::importFile($path);
             } else {
                 if (file_exists($path = CODE_PATH . '/controllers/' . $className . '.php')) {
                     return CLoader::importFile($path);
                 } else {
                     if (file_exists($path = FRAME_PATH . '/components/' . $className . '.php')) {
                         return CLoader::importFile($path);
                     } else {
                         $list = array();
                         $importList = CConfig::getInstance()->load('IMPORT');
                         if (!empty($importList)) {
                             foreach ((array) $importList as $thisPath) {
                                 $list[] = APP_PATH . '/' . str_replace(array('.', '*'), array('/', ''), $thisPath);
                             }
                         }
                         //查询指定的加载目录
                         foreach ($list as $val) {
                             if (file_exists($path = $val . $className . '.php')) {
                                 return CLoader::importFile($path);
                             } else {
                                 if (false !== strpos($className, '_')) {
                                     //处理类名中的路径
                                     $path = str_replace('_', '/', $className);
                                     if (file_exists($path = trim($val, '/\\') . '/' . $path . '.php')) {
                                         return CLoader::importFile($path);
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Example #29
0
 /**
  * unblock user(removeBan)
  */
 function unBlock($userId, $layout = null)
 {
     $my = CFactory::getUser();
     $mainframe =& JFactory::getApplication();
     $viewName = JRequest::getVar('view', '', 'GET');
     $task = !empty($layout) && $layout != 'null' ? '&task=' . $layout : null;
     $urlUserId = $viewName == 'friends' ? '' : "&userid=" . $userId;
     $url = CRoute::_("index.php?option=com_community&view=" . $viewName . $task . $urlUserId, false);
     $message = empty($my->id) || empty($userId) ? JText::_('CC ERROR BLOCK USER') : '';
     if (!empty($my->id) && !empty($userId)) {
         $model = CFactory::getModel('block');
         $message = $model->removeBannedUser($my->id, $userId) ? JText::_('CC USER UNBLOCKED') : JText::_('CC ERROR BLOCK USER');
     }
     $mainframe->redirect($url, $message);
     // 		$view->addInfo( JText::_( 'CC USER UNBLOCKED' ) );
     // 		$view->get('friends');
     // 		echo "<script>setTimeout(\"location='$url'\", 3500);</script>\n";
 }
Example #30
0
 public function render($return = false)
 {
     $my = CFactory::getUser();
     $albumModel = CFactory::getModel('Photos');
     $excludedAlbumType = array('profile.avatar', 'group.avatar', 'event.avatar', 'group.Cover', 'profile.Cover', 'event.Cover');
     if ($this->type == 'groups') {
         $album = $albumModel->getGroupAlbums($this->target, false, false, '', false, '', $excludedAlbumType);
     } else {
         $album = $albumModel->getProfileAlbums($my->id, false, true);
     }
     $this->permission = new stdClass();
     $this->permission->enablephotos = CFactory::getConfig()->get("enablephotos");
     $this->permission->enablevideos = CFactory::getConfig()->get("enablevideos");
     $this->permission->enablevideosupload = CFactory::getConfig()->get("enablevideosupload");
     $this->permission->enableevents = CFactory::getConfig()->get("enableevents") && $my->canCreateEvents();
     if ($this->type == 'profile' && $this->target != $my->id) {
         $this->permission->enablephotos = false;
         $this->permission->enablevideos = false;
         $this->permission->enablevideosupload = false;
         $this->permission->enableevents = false;
     }
     $moodsModel = CFactory::getModel('Moods');
     $moods = $moodsModel->getMoods();
     $publishedMoods = array();
     if (count($moods) > 0) {
         foreach ($moods as $key => $mood) {
             if ($mood->published) {
                 $publishedMoods[$key] = $mood;
             }
         }
     }
     if ($my->id && is_array($this->creators)) {
         $tmpl = new CTemplate();
         $html = $tmpl->set('my', $my)->set('target', $this->target)->set('type', $this->type)->set('creators', $this->creators)->set('album', $album)->set('permission', $this->permission)->set('moods', $publishedMoods)->fetch('status.form');
         // Some of the creator might need custom url replacement
         // Take a look at status.photo.php template for example
         $group_url = $this->type == 'groups' ? CRoute::_('index.php?option=com_community&view=photos&task=ajaxPreview&no_html=1&tmpl=component&groupid=' . $this->target) : CRoute::_('index.php?option=com_community&view=photos&task=ajaxPreview&no_html=1&tmpl=component');
         $html = str_replace('{url}', $group_url, $html);
         if ($return) {
             return $html;
         }
         echo $html;
     }
 }